1 /****************************************************************************** 2 * 3 * Copyright(c) 2007 - 2014 Realtek Corporation. All rights reserved. 4 * 5 * This is ROM code section. 6 * 7 * 8 ******************************************************************************/ 9 #ifndef ROM_AES_H 10 #define ROM_AES_H 11 12 typedef struct 13 { 14 u32 erk[64]; /* encryption round keys */ 15 u32 drk[64]; /* decryption round keys */ 16 int nr; /* number of rounds */ 17 }aes_context; 18 19 20 #define AES_BLOCKSIZE8 8 21 #define AES_BLK_SIZE 16 // # octets in an AES block 22 typedef union _aes_block // AES cipher block 23 { 24 unsigned long x[AES_BLK_SIZE/4]; // access as 8-bit octets or 32-bit words 25 unsigned char b[AES_BLK_SIZE]; 26 }aes_block; 27 28 29 void AES_WRAP(unsigned char * plain, int plain_len, 30 unsigned char * iv, int iv_len, 31 unsigned char * kek, int kek_len, 32 unsigned char *cipher, unsigned short *cipher_len); 33 34 void AES_UnWRAP(unsigned char * cipher, int cipher_len, 35 unsigned char * kek, int kek_len, 36 unsigned char * plain); 37 38 #endif 39