123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- #ifndef _H_AES_CMAC_
- #define _H_AES_CMAC_
- #include "EM_os.h"
- #define AES_CMAC_PROC_PENDING 0x1100
- #define AES_CMAC_MAC_GENERATE 0x00
- #define AES_CMAC_MAC_VERIFY 0x01
- #define AES_CMAC_KEY_SIZE 16
- #define AES_CMAC_BLOCK_SIZE 16
- #define AES_128_ENC_KEY_SIZE 16
- #define AES_128_ENC_DATA_SIZE 16
- #define AES_128_ENC_OUT_SIZE 16
- #define AES_CMAC_BLOCK_EXPONENT 4
- #define AES_CMAC_STATE_INIT 0x01
- #define AES_CMAC_STATE_OPERATING 0x02
- #define AES_CMAC_STATE_IN_ENCRYPT 0x04
- #define AES_CMAC_STATE_SUBKEY_GEN 0x10
- #define AES_CMAC_STATE_MAC_GENERATE 0x20
- #define AES_CMAC_STATE_MAC_VERIFY 0x40
- typedef void (* AES_CMAC_CB) (void);
- typedef struct _AES_CMAC_CONTEXT
- {
-
-
- UCHAR * key;
-
- UCHAR * data;
-
- UINT16 datalen;
-
- UCHAR * mac;
-
- UCHAR maclen;
-
- UCHAR action;
-
- AES_CMAC_CB cb;
-
-
- UCHAR state;
-
- UINT16 num_blocks;
-
- UINT16 processed;
-
- UCHAR subkey1[AES_CMAC_KEY_SIZE];
- UCHAR subkey2[AES_CMAC_KEY_SIZE];
- } AES_CMAC_CONTEXT;
- EM_RESULT aes_cmac_init (void);
- EM_RESULT aes_cmac_context_init (AES_CMAC_CONTEXT * context);
- EM_RESULT aes_cmac (AES_CMAC_CONTEXT * context);
- void aes_cmac_aes_128_encryption_complete (UCHAR status, UCHAR * data, UINT16 datalen);
- #endif
|