blob: 6b4ab6ef16b1ad2ad23c27ba1e5cd0dc539d8ffe [file] [log] [blame]
Alexandre Lision51140e12013-12-02 10:54:09 -05001/*
2 Copyright (C) 2006-2007 Werner Dittmann
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
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
59void 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
82void aesCfbDecrypt(uint8_t* key, int32_t keyLength, const uint8_t* IV, uint8_t *data,
83 int32_t dataLength);
84/**
85 * @}
86 */
87#endif