1 /* 2 * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /****************************************************************************** 18 * @file ck_aes.h 19 * @brief header file for aes driver 20 * @version V1.0 21 * @date 02. June 2017 22 ******************************************************************************/ 23 #ifndef _CK_AES_H_ 24 #define _CK_AES_H_ 25 26 #include <stdio.h> 27 #include "drv_aes.h" 28 #include "soc.h" 29 30 #define AES_LITTLE_ENDIAN 0x00000100 31 32 #define AES_MAX_KEY_LENGTH 32 33 #define AES_IT_DATAINT 0x4 34 #define AES_IT_KEYINT 0x2 35 #define AES_IT_BUSY 0x1 36 #define AES_IT_ALL 0x7 37 #define AES_CRYPTO_KEYEXP 0x2 38 39 #define AES_WORK_ENABLE_OFFSET 0 40 #define AES_INT_ENABLE_OFFSET 2 41 #define AES_MODE_OFFSET 3 42 #define AES_KEY_LEN_OFFSET 4 43 #define AES_OPCODE_OFFSET 6 44 45 typedef struct { 46 __IOM uint32_t datain[4]; /* Offset: 0x000 (R/W) Data input 0~127 */ 47 __IOM uint32_t key[8]; /* Offset: 0x010 (R/W) Key 0~255 */ 48 __IOM uint32_t iv[4]; /* Offset: 0x030 (R/W) Initial Vector: 0~127 */ 49 __IOM uint32_t ctrl; /* Offset: 0x040 (R/W) AES Control Register */ 50 __IOM uint32_t state; /* Offset: 0x044 (R/W) AES State Register */ 51 __IOM uint32_t dataout[4]; /* Offset: 0x048 (R/W) Data Output 0~31 */ 52 } ck_aes_reg_t; 53 54 #endif 55