PolarSSL
|
00001 00025 #ifndef POLARSSL_AES_H 00026 #define POLARSSL_AES_H 00027 00028 #define AES_ENCRYPT 1 00029 #define AES_DECRYPT 0 00030 00031 #define POLARSSL_ERR_AES_INVALID_KEY_LENGTH -0x0800 00032 #define POLARSSL_ERR_AES_INVALID_INPUT_LENGTH -0x0810 00033 00037 typedef struct 00038 { 00039 int nr; 00040 unsigned long *rk; 00041 unsigned long buf[68]; 00042 } 00043 aes_context; 00044 00045 #ifdef __cplusplus 00046 extern "C" { 00047 #endif 00048 00058 int aes_setkey_enc( aes_context *ctx, const unsigned char *key, int keysize ); 00059 00069 int aes_setkey_dec( aes_context *ctx, const unsigned char *key, int keysize ); 00070 00081 int aes_crypt_ecb( aes_context *ctx, 00082 int mode, 00083 const unsigned char input[16], 00084 unsigned char output[16] ); 00085 00100 int aes_crypt_cbc( aes_context *ctx, 00101 int mode, 00102 int length, 00103 unsigned char iv[16], 00104 const unsigned char *input, 00105 unsigned char *output ); 00106 00120 int aes_crypt_cfb128( aes_context *ctx, 00121 int mode, 00122 int length, 00123 int *iv_off, 00124 unsigned char iv[16], 00125 const unsigned char *input, 00126 unsigned char *output ); 00127 00133 int aes_self_test( int verbose ); 00134 00135 #ifdef __cplusplus 00136 } 00137 #endif 00138 00139 #endif /* aes.h */