blob: 595d19d68ea5314b73f41c04570613856d0b2b67 [file] [log] [blame]
Alexandre Lision51140e12013-12-02 10:54:09 -05001/*
Alexandre Lision7fd5d3d2013-12-04 13:06:40 -05002 Copyright (C) 2006-2013 Werner Dittmann
Alexandre Lision51140e12013-12-02 10:54:09 -05003
4 This program is free software: you can redistribute it and/or modify
Alexandre Lision7fd5d3d2013-12-04 13:06:40 -05005 it under the terms of the GNU Lesser General Public License as published by
Alexandre Lision51140e12013-12-02 10:54:09 -05006 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 _TWOCFB_H__
23#define _TWOCFB_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 TWO_BLOCK_SIZE
36#define TWO_BLOCK_SIZE 16
37#endif
38
39/**
40 * Encrypt data with Twofish CFB mode, full block feedback size.
41 *
42 * This functions takes one data chunk and encrypts it with
43 * Twofish CFB mode. The lenght of the data may be arbitrary and
44 * it is not needed to be a multiple of Twofish 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 TWO_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
Alexandre Lision7fd5d3d2013-12-04 13:06:40 -050059void twoCfbEncrypt(uint8_t* key, int32_t keyLength, uint8_t* IV, uint8_t *data, int32_t dataLength);
Alexandre Lision51140e12013-12-02 10:54:09 -050060
61/**
62 * Decrypt data with Twofish CFB mode, full block feedback size.
63 *
64 * This functions takes one data chunk and decrypts it with
65 * Twofish CFB mode. The lenght of the data may be arbitrary and
66 * it is not needed to be a multiple of Twofish blocksize.
67 *
68 * @param key
69 * Points to the key bytes.
70 * @param keyLength
71 * Length of the key in bytes
72 * @param IV
73 * The initialization vector which must be TWO_BLOCKSIZE (16) bytes.
74 * @param data
75 * Points to a buffer that contains and receives the computed
76 * the data (in-place decryption).
77 * @param dataLength
78 * Length of the data in bytes
79 */
80
Alexandre Lision7fd5d3d2013-12-04 13:06:40 -050081void twoCfbDecrypt(uint8_t* key, int32_t keyLength, uint8_t* IV, uint8_t *data, int32_t dataLength);
Alexandre Lision51140e12013-12-02 10:54:09 -050082/**
83 * @}
84 */
85#endif