1/*
2 * aes_icm.h
3 *
4 * Header for AES Integer Counter Mode.
5 *
6 * David A. McGrew
7 * Cisco Systems, Inc.
8 *
9 */
10
11#ifndef AES_ICM_H
12#define AES_ICM_H
13
14#include "aes.h"
15#include "cipher.h"
16
17typedef struct {
18 v128_t counter; /* holds the counter value */
19 v128_t offset; /* initial offset value */
20 v128_t keystream_buffer; /* buffers bytes of keystream */
21 aes_expanded_key_t expanded_key; /* the cipher key */
22 int bytes_in_buffer; /* number of unused bytes in buffer */
23} aes_icm_ctx_t;
24
25
26err_status_t
27aes_icm_context_init(aes_icm_ctx_t *c,
28 const unsigned char *key,
29 int key_len);
30
31err_status_t
32aes_icm_set_iv(aes_icm_ctx_t *c, void *iv);
33
34err_status_t
35aes_icm_encrypt(aes_icm_ctx_t *c,
36 unsigned char *buf, unsigned int *bytes_to_encr);
37
38err_status_t
39aes_icm_output(aes_icm_ctx_t *c,
40 unsigned char *buf, int bytes_to_output);
41
42err_status_t
43aes_icm_dealloc(cipher_t *c);
44
45err_status_t
46aes_icm_encrypt_ismacryp(aes_icm_ctx_t *c,
47 unsigned char *buf,
48 unsigned int *enc_len,
49 int forIsmacryp);
50
51err_status_t
52aes_icm_alloc_ismacryp(cipher_t **c,
53 int key_len,
54 int forIsmacryp);
55
56#endif /* AES_ICM_H */
57
58