OLD | NEW |
| (Empty) |
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 /* | |
12 * | |
13 * Copyright (c) 2001-2006, Cisco Systems, Inc. | |
14 * All rights reserved. | |
15 * | |
16 * Redistribution and use in source and binary forms, with or without | |
17 * modification, are permitted provided that the following conditions | |
18 * are met: | |
19 * | |
20 * Redistributions of source code must retain the above copyright | |
21 * notice, this list of conditions and the following disclaimer. | |
22 * | |
23 * Redistributions in binary form must reproduce the above | |
24 * copyright notice, this list of conditions and the following | |
25 * disclaimer in the documentation and/or other materials provided | |
26 * with the distribution. | |
27 * | |
28 * Neither the name of the Cisco Systems, Inc. nor the names of its | |
29 * contributors may be used to endorse or promote products derived | |
30 * from this software without specific prior written permission. | |
31 * | |
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | |
35 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |
36 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
37 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
38 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
39 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
41 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
42 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | |
43 * OF THE POSSIBILITY OF SUCH DAMAGE. | |
44 * | |
45 */ | |
46 | |
47 #ifndef AES_ICM_H | |
48 #define AES_ICM_H | |
49 | |
50 #include "aes.h" | |
51 #include "cipher.h" | |
52 | |
53 typedef struct { | |
54 v128_t counter; /* holds the counter value */ | |
55 v128_t offset; /* initial offset value */ | |
56 v128_t keystream_buffer; /* buffers bytes of keystream */ | |
57 aes_expanded_key_t expanded_key; /* the cipher key */ | |
58 int bytes_in_buffer; /* number of unused bytes in buffer */ | |
59 } aes_icm_ctx_t; | |
60 | |
61 | |
62 err_status_t | |
63 aes_icm_context_init(aes_icm_ctx_t *c, | |
64 const unsigned char *key, | |
65 int key_len); | |
66 | |
67 err_status_t | |
68 aes_icm_set_iv(aes_icm_ctx_t *c, void *iv, int direction); | |
69 | |
70 err_status_t | |
71 aes_icm_encrypt(aes_icm_ctx_t *c, | |
72 unsigned char *buf, unsigned int *bytes_to_encr); | |
73 | |
74 err_status_t | |
75 aes_icm_output(aes_icm_ctx_t *c, | |
76 unsigned char *buf, unsigned int bytes_to_output); | |
77 | |
78 err_status_t | |
79 aes_icm_dealloc(cipher_t *c); | |
80 | |
81 err_status_t | |
82 aes_icm_encrypt_ismacryp(aes_icm_ctx_t *c, | |
83 unsigned char *buf, | |
84 unsigned int *enc_len, | |
85 int forIsmacryp); | |
86 | |
87 err_status_t | |
88 aes_icm_alloc_ismacryp(cipher_t **c, | |
89 int key_len, | |
90 int forIsmacryp); | |
91 | |
92 uint16_t | |
93 aes_icm_bytes_encrypted(aes_icm_ctx_t *c); | |
94 | |
95 #endif /* AES_ICM_H */ | |
96 | |
OLD | NEW |