00001
00023 #ifndef POLARSSL_AES_H
00024 #define POLARSSL_AES_H
00025
00026 #define AES_ENCRYPT 1
00027 #define AES_DECRYPT 0
00028
00029 #define POLARSSL_ERR_AES_INVALID_KEY_LENGTH -0x0800
00030
00034 typedef struct
00035 {
00036 int nr;
00037 unsigned long *rk;
00038 unsigned long buf[68];
00039 }
00040 aes_context;
00041
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045
00055 int aes_setkey_enc( aes_context *ctx, unsigned char *key, int keysize );
00056
00066 int aes_setkey_dec( aes_context *ctx, unsigned char *key, int keysize );
00067
00076 void aes_crypt_ecb( aes_context *ctx,
00077 int mode,
00078 unsigned char input[16],
00079 unsigned char output[16] );
00080
00093 void aes_crypt_cbc( aes_context *ctx,
00094 int mode,
00095 int length,
00096 unsigned char iv[16],
00097 unsigned char *input,
00098 unsigned char *output );
00099
00111 void aes_crypt_cfb128( aes_context *ctx,
00112 int mode,
00113 int length,
00114 int *iv_off,
00115 unsigned char iv[16],
00116 unsigned char *input,
00117 unsigned char *output );
00118
00124 int aes_self_test( int verbose );
00125
00126 #ifdef __cplusplus
00127 }
00128 #endif
00129
00130 #endif