| OLD | NEW |
| (Empty) |
| 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 /* | |
| 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_CBC_H | |
| 48 #define AES_CBC_H | |
| 49 | |
| 50 #include "aes.h" | |
| 51 #include "cipher.h" | |
| 52 | |
| 53 typedef struct { | |
| 54 v128_t state; /* cipher chaining state */ | |
| 55 v128_t previous; /* previous ciphertext block */ | |
| 56 uint8_t key[32]; | |
| 57 int key_len; | |
| 58 aes_expanded_key_t expanded_key; /* the cipher key */ | |
| 59 } aes_cbc_ctx_t; | |
| 60 | |
| 61 err_status_t | |
| 62 aes_cbc_set_key(aes_cbc_ctx_t *c, | |
| 63 const unsigned char *key); | |
| 64 | |
| 65 err_status_t | |
| 66 aes_cbc_encrypt(aes_cbc_ctx_t *c, | |
| 67 unsigned char *buf, | |
| 68 unsigned int *bytes_in_data); | |
| 69 | |
| 70 err_status_t | |
| 71 aes_cbc_context_init(aes_cbc_ctx_t *c, const uint8_t *key, | |
| 72 int key_len); | |
| 73 | |
| 74 err_status_t | |
| 75 aes_cbc_set_iv(aes_cbc_ctx_t *c, void *iv, int direction); | |
| 76 | |
| 77 err_status_t | |
| 78 aes_cbc_nist_encrypt(aes_cbc_ctx_t *c, | |
| 79 unsigned char *data, | |
| 80 unsigned int *bytes_in_data); | |
| 81 | |
| 82 err_status_t | |
| 83 aes_cbc_nist_decrypt(aes_cbc_ctx_t *c, | |
| 84 unsigned char *data, | |
| 85 unsigned int *bytes_in_data); | |
| 86 | |
| 87 #endif /* AES_CBC_H */ | |
| 88 | |
| OLD | NEW |