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 30err_status_t 31aes_icm_set_iv(aes_icm_ctx_t *c, void *iv); 32 33err_status_t 34aes_icm_encrypt(aes_icm_ctx_t *c, 35 unsigned char *buf, unsigned int *bytes_to_encr); 36 37err_status_t 38aes_icm_output(aes_icm_ctx_t *c, 39 unsigned char *buf, int bytes_to_output); 40 41err_status_t 42aes_icm_dealloc(cipher_t *c); 43 44err_status_t 45aes_icm_encrypt_ismacryp(aes_icm_ctx_t *c, 46 unsigned char *buf, 47 unsigned int *enc_len, 48 int forIsmacryp); 49 50err_status_t 51aes_icm_alloc_ismacryp(cipher_t **c, 52 int key_len, 53 int forIsmacryp); 54 55#endif /* AES_ICM_H */ 56 57