Alexandre Lision | 51140e1 | 2013-12-02 10:54:09 -0500 | [diff] [blame] | 1 | /* |
Alexandre Lision | 907ed2e | 2014-02-04 10:33:09 -0500 | [diff] [blame^] | 2 | Copyright (C) 2006-2013 Werner Dittmann |
Alexandre Lision | 51140e1 | 2013-12-02 10:54:09 -0500 | [diff] [blame] | 3 | |
| 4 | This program is free software: you can redistribute it and/or modify |
Alexandre Lision | 907ed2e | 2014-02-04 10:33:09 -0500 | [diff] [blame^] | 5 | it under the terms of the GNU Lesser General Public License as published by |
Alexandre Lision | 51140e1 | 2013-12-02 10:54:09 -0500 | [diff] [blame] | 6 | the Free Software Foundation, either version 3 of the License, or |
| 7 | (at your option) any later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU General Public License |
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | /* |
| 19 | * Authors: Werner Dittmann <Werner.Dittmann@t-online.de> |
| 20 | */ |
| 21 | |
| 22 | #ifndef _AESCFB_H__ |
| 23 | #define _AESCFB_H__ |
| 24 | |
| 25 | #include <stdint.h> |
| 26 | |
| 27 | /** |
| 28 | * @file aesCFB.h |
| 29 | * @brief Function that provide AES CFB mode support |
| 30 | * |
| 31 | * @ingroup GNU_ZRTP |
| 32 | * @{ |
| 33 | */ |
| 34 | |
| 35 | #ifndef AES_BLOCK_SIZE |
| 36 | #define AES_BLOCK_SIZE 16 |
| 37 | #endif |
| 38 | |
| 39 | /** |
| 40 | * Encrypt data with AES CFB mode, full block feedback size. |
| 41 | * |
| 42 | * This functions takes one data chunk and encrypts it with |
| 43 | * AES CFB mode. The lenght of the data may be arbitrary and |
| 44 | * it is not needed to be a multiple of AES blocksize. |
| 45 | * |
| 46 | * @param key |
| 47 | * Points to the key bytes. |
| 48 | * @param keyLength |
| 49 | * Length of the key in bytes |
| 50 | * @param IV |
| 51 | * The initialization vector which must be AES_BLOCKSIZE (16) bytes. |
| 52 | * @param data |
| 53 | * Points to a buffer that contains and receives the computed |
| 54 | * the data (in-place encryption). |
| 55 | * @param dataLength |
| 56 | * Length of the data in bytes |
| 57 | */ |
| 58 | |
| 59 | void aesCfbEncrypt(uint8_t* key, int32_t keyLength, uint8_t* IV, uint8_t *data, |
| 60 | int32_t dataLength); |
| 61 | |
| 62 | /** |
| 63 | * Decrypt data with AES CFB mode, full block feedback size. |
| 64 | * |
| 65 | * This functions takes one data chunk and decrypts it with |
| 66 | * AES CFB mode. The lenght of the data may be arbitrary and |
| 67 | * it is not needed to be a multiple of AES blocksize. |
| 68 | * |
| 69 | * @param key |
| 70 | * Points to the key bytes. |
| 71 | * @param keyLength |
| 72 | * Length of the key in bytes |
| 73 | * @param IV |
| 74 | * The initialization vector which must be AES_BLOCKSIZE (16) bytes. |
| 75 | * @param data |
| 76 | * Points to a buffer that contains and receives the computed |
| 77 | * the data (in-place decryption). |
| 78 | * @param dataLength |
| 79 | * Length of the data in bytes |
| 80 | */ |
| 81 | |
Alexandre Lision | 7fd5d3d | 2013-12-04 13:06:40 -0500 | [diff] [blame] | 82 | void aesCfbDecrypt(uint8_t* key, int32_t keyLength, uint8_t* IV, uint8_t *data, |
Alexandre Lision | 51140e1 | 2013-12-02 10:54:09 -0500 | [diff] [blame] | 83 | int32_t dataLength); |
| 84 | /** |
| 85 | * @} |
| 86 | */ |
| 87 | #endif |