• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * aes_cbc.h
3  *
4  * Header for AES Cipher Blobk Chaining Mode.
5  *
6  * David A. McGrew
7  * Cisco Systems, Inc.
8  *
9  */
10 
11 #ifndef AES_CBC_H
12 #define AES_CBC_H
13 
14 #include "aes.h"
15 #include "cipher.h"
16 
17 typedef struct {
18   v128_t   state;                  /* cipher chaining state            */
19   v128_t   previous;               /* previous ciphertext block        */
20   aes_expanded_key_t expanded_key; /* the cipher key                   */
21 } aes_cbc_ctx_t;
22 
23 err_status_t
24 aes_cbc_set_key(aes_cbc_ctx_t *c,
25 		const unsigned char *key);
26 
27 err_status_t
28 aes_cbc_encrypt(aes_cbc_ctx_t *c,
29 		unsigned char *buf,
30 		unsigned int  *bytes_in_data);
31 
32 err_status_t
33 aes_cbc_context_init(aes_cbc_ctx_t *c, const uint8_t *key,
34 		     cipher_direction_t dir);
35 
36 err_status_t
37 aes_cbc_set_iv(aes_cbc_ctx_t *c, void *iv);
38 
39 err_status_t
40 aes_cbc_nist_encrypt(aes_cbc_ctx_t *c,
41 		     unsigned char *data,
42 		     unsigned int *bytes_in_data);
43 
44 err_status_t
45 aes_cbc_nist_decrypt(aes_cbc_ctx_t *c,
46 		     unsigned char *data,
47 		     unsigned int *bytes_in_data);
48 
49 #endif /* AES_CBC_H */
50 
51