1 /* streamcipher_descriptor.h */
3 This file is part of the ARM-Crypto-Lib.
4 Copyright (C) 2011 Daniel Otte (daniel.otte@rub.de)
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * \file stremcipher_descriptor.h
24 * \license GPLv3 or later
28 #ifndef STREAMCIPHER_DESCRIPTOR_H_
29 #define STREAMCIPHER_DESCRIPTOR_H_
35 typedef void(*void_fpt)(void);
38 typedef void(*sc_init1_fpt)(const void*, void*); /* key of fixed length, no IV*/
39 typedef void(*sc_init2_fpt)(const void*, const void*, void*); /* key and IV of fixed length */
40 typedef void(*sc_init3_fpt)(const void*, uint16_t,void*); /* key of variable length, no IV */
41 typedef void(*sc_init4_fpt)(const void*, uint16_t,const void*, void*); /* key of variable length, IV of fixed length */
42 typedef void(*sc_init5_fpt)(const void*, uint16_t,const void*, uint16_t, void*); /* key and IV of variable length */
44 typedef uint8_t(*sc_gen1_fpt)(void*); /* return keystream data */
45 typedef void(*sc_gen2_fpt)(void*, void*); /* write keystream data to buffer */
47 typedef uint8_t(*sc_genra1_fpt)(void*, uint64_t); /* return keystream data */
48 typedef void(*sc_genra2_fpt)(void*, void*, uint64_t); /* write keystream data to buffer */
51 typedef void(*sc_free_fpt)(void*);
74 #define SC_INIT_TYPE 0x07
75 #define SC_INIT_TYPE_1 0x00 /* key of fixed length, no IV*/
76 #define SC_INIT_TYPE_2 0x02 /* key and IV of fixed length */
77 #define SC_INIT_TYPE_3 0x03 /* key of variable length, no IV */
78 #define SC_INIT_TYPE_4 0x04 /* key of variable length, IV of fixed length */
79 #define SC_INIT_TYPE_5 0x05 /* key and IV of variable length */
81 #define SC_GEN_TYPE 0x08
82 #define SC_GEN_TYPE_1 0x00 /* return data stream byte */
83 #define SC_GEN_TYPE_2 0x08 /* write data stream block into buffer */
85 #define SCDESC_TYPE_STREAMCIPHER 0x03
88 uint8_t type; /* 3==streamcipher */
97 const void* valid_keysize_desc;
98 const void* valid_ivsize_desc;
99 } scdesc_t; /* streamcipher descriptor type */
102 const scdesc_t* desc_ptr;
110 #endif /* STREAMCIPHER_DESCRIPTOR_H_ */