PolarSSL v1.1.5
aes.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_AES_H
28 #define POLARSSL_AES_H
29 
30 #include <string.h>
31 
32 #define AES_ENCRYPT 1
33 #define AES_DECRYPT 0
34 
35 #define POLARSSL_ERR_AES_INVALID_KEY_LENGTH -0x0020
36 #define POLARSSL_ERR_AES_INVALID_INPUT_LENGTH -0x0022
41 typedef struct
42 {
43  int nr;
44  unsigned long *rk;
45  unsigned long buf[68];
46 }
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
62 int aes_setkey_enc( aes_context *ctx, const unsigned char *key, unsigned int keysize );
63 
73 int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int keysize );
74 
85 int aes_crypt_ecb( aes_context *ctx,
86  int mode,
87  const unsigned char input[16],
88  unsigned char output[16] );
89 
104 int aes_crypt_cbc( aes_context *ctx,
105  int mode,
106  size_t length,
107  unsigned char iv[16],
108  const unsigned char *input,
109  unsigned char *output );
110 
129 int aes_crypt_cfb128( aes_context *ctx,
130  int mode,
131  size_t length,
132  size_t *iv_off,
133  unsigned char iv[16],
134  const unsigned char *input,
135  unsigned char *output );
136 
158 int aes_crypt_ctr( aes_context *ctx,
159  size_t length,
160  size_t *nc_off,
161  unsigned char nonce_counter[16],
162  unsigned char stream_block[16],
163  const unsigned char *input,
164  unsigned char *output );
170 int aes_self_test( int verbose );
171 
172 #ifdef __cplusplus
173 }
174 #endif
175 
176 #endif /* aes.h */