]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * AES Cryptographic Algorithm Header File. Include this header file in | |
3 | * your source which uses these given APIs. (This source is kept under | |
4 | * public domain) | |
5 | */ | |
6 | #ifndef __AES_H | |
7 | #define __AES_H | |
8 | ||
9 | // AES context structure | |
10 | typedef struct { | |
11 | unsigned int Ek[60]; | |
12 | unsigned int Dk[60]; | |
13 | unsigned int Iv[4]; | |
14 | unsigned char Nr; | |
15 | unsigned char Mode; | |
16 | } AesCtx; | |
17 | ||
18 | // key length in bytes | |
19 | #define KEY128 16 | |
20 | #define KEY192 24 | |
21 | #define KEY256 32 | |
22 | // block size in bytes | |
23 | #define BLOCKSZ 16 | |
24 | // mode | |
25 | #define EBC 0 | |
26 | #define CBC 1 | |
27 | ||
28 | // AES API function prototype | |
29 | ||
30 | int AesCtxIni(AesCtx *pCtx, unsigned char *pIV, unsigned char *pKey, unsigned int KeyLen, unsigned char Mode); | |
31 | int AesEncrypt(AesCtx *pCtx, unsigned char *pData, unsigned char *pCipher, unsigned int DataLen); | |
32 | int AesDecrypt(AesCtx *pCtx, unsigned char *pCipher, unsigned char *pData, unsigned int CipherLen); | |
33 | ||
34 | #endif |