PolarSSL v1.2.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 #ifdef _MSC_VER
33 #include <basetsd.h>
34 typedef UINT32 uint32_t;
35 #else
36 #include <inttypes.h>
37 #endif
38 
39 #define AES_ENCRYPT 1
40 #define AES_DECRYPT 0
41 
42 #define POLARSSL_ERR_AES_INVALID_KEY_LENGTH -0x0020
43 #define POLARSSL_ERR_AES_INVALID_INPUT_LENGTH -0x0022
48 typedef struct
49 {
50  int nr;
51  uint32_t *rk;
52  uint32_t buf[68];
53 }
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
69 int aes_setkey_enc( aes_context *ctx, const unsigned char *key, unsigned int keysize );
70 
80 int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int keysize );
81 
92 int aes_crypt_ecb( aes_context *ctx,
93  int mode,
94  const unsigned char input[16],
95  unsigned char output[16] );
96 
111 int aes_crypt_cbc( aes_context *ctx,
112  int mode,
113  size_t length,
114  unsigned char iv[16],
115  const unsigned char *input,
116  unsigned char *output );
117 
136 int aes_crypt_cfb128( aes_context *ctx,
137  int mode,
138  size_t length,
139  size_t *iv_off,
140  unsigned char iv[16],
141  const unsigned char *input,
142  unsigned char *output );
143 
165 int aes_crypt_ctr( aes_context *ctx,
166  size_t length,
167  size_t *nc_off,
168  unsigned char nonce_counter[16],
169  unsigned char stream_block[16],
170  const unsigned char *input,
171  unsigned char *output );
177 int aes_self_test( int verbose );
178 
179 #ifdef __cplusplus
180 }
181 #endif
182 
183 #endif /* aes.h */