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
17typedef 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
23err_status_t
24aes_cbc_set_key(aes_cbc_ctx_t *c,
25		const unsigned char *key);
26
27err_status_t
28aes_cbc_encrypt(aes_cbc_ctx_t *c,
29		unsigned char *buf,
30		unsigned int  *bytes_in_data);
31
32err_status_t
33aes_cbc_context_init(aes_cbc_ctx_t *c, const uint8_t *key,
34		     cipher_direction_t dir);
35
36err_status_t
37aes_cbc_set_iv(aes_cbc_ctx_t *c, void *iv);
38
39err_status_t
40aes_cbc_nist_encrypt(aes_cbc_ctx_t *c,
41		     unsigned char *data,
42		     unsigned int *bytes_in_data);
43
44err_status_t
45aes_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