Tristan Matthews | 0a329cc | 2013-07-17 13:20:14 -0400 | [diff] [blame] | 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 | |
| 17 | typedef 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 | |
| 26 | err_status_t |
| 27 | aes_icm_context_init(aes_icm_ctx_t *c, |
| 28 | const unsigned char *key); |
| 29 | |
| 30 | err_status_t |
| 31 | aes_icm_set_iv(aes_icm_ctx_t *c, void *iv); |
| 32 | |
| 33 | err_status_t |
| 34 | aes_icm_encrypt(aes_icm_ctx_t *c, |
| 35 | unsigned char *buf, unsigned int *bytes_to_encr); |
| 36 | |
| 37 | err_status_t |
| 38 | aes_icm_output(aes_icm_ctx_t *c, |
| 39 | unsigned char *buf, int bytes_to_output); |
| 40 | |
| 41 | err_status_t |
| 42 | aes_icm_dealloc(cipher_t *c); |
| 43 | |
| 44 | err_status_t |
| 45 | aes_icm_encrypt_ismacryp(aes_icm_ctx_t *c, |
| 46 | unsigned char *buf, |
| 47 | unsigned int *enc_len, |
| 48 | int forIsmacryp); |
| 49 | |
| 50 | err_status_t |
| 51 | aes_icm_alloc_ismacryp(cipher_t **c, |
| 52 | int key_len, |
| 53 | int forIsmacryp); |
| 54 | |
| 55 | #endif /* AES_ICM_H */ |
| 56 | |