1 /* streamcipher_descriptor.h */
3 This file is part of the AVR-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_
31 #include <avr/pgmspace.h>
36 typedef void(*void_fpt)(void);
39 typedef void(*sc_init1_fpt)(const void*, void*); /* key of fixed length, no IV*/
40 typedef void(*sc_init2_fpt)(const void*, const void*, void*); /* key and IV of fixed length */
41 typedef void(*sc_init3_fpt)(const void*, uint16_t,void*); /* key of variable length, no IV */
42 typedef void(*sc_init4_fpt)(const void*, uint16_t,const void*, void*); /* key of variable length, IV of fixed length */
43 typedef void(*sc_init5_fpt)(const void*, uint16_t,const void*, uint16_t, void*); /* key and IV of variable length */
45 typedef uint8_t(*sc_gen1_fpt)(void*); /* return keystream data */
46 typedef void(*sc_gen2_fpt)(void*, void*); /* write keystream data to buffer */
48 typedef uint8_t(*sc_genra1_fpt)(void*, uint64_t); /* return keystream data */
49 typedef void(*sc_genra2_fpt)(void*, void*, uint64_t); /* write keystream data to buffer */
52 typedef void(*sc_free_fpt)(void*);
75 #define SC_INIT_TYPE 0x07
76 #define SC_INIT_TYPE_1 0x00 /* key of fixed length, no IV*/
77 #define SC_INIT_TYPE_2 0x02 /* key and IV of fixed length */
78 #define SC_INIT_TYPE_3 0x03 /* key of variable length, no IV */
79 #define SC_INIT_TYPE_4 0x04 /* key of variable length, IV of fixed length */
80 #define SC_INIT_TYPE_5 0x05 /* key and IV of variable length */
82 #define SC_GEN_TYPE 0x08
83 #define SC_GEN_TYPE_1 0x00 /* return data stream byte */
84 #define SC_GEN_TYPE_2 0x08 /* write data stream block into buffer */
86 #define SCDESC_TYPE_STREAMCIPHER 0x03
89 uint8_t type; /* 3==streamcipher */
98 PGM_VOID_P valid_keysize_desc;
99 PGM_VOID_P valid_ivsize_desc;
100 } scdesc_t; /* streamcipher descriptor type */
103 const scdesc_t* desc_ptr;
111 #endif /* STREAMCIPHER_DESCRIPTOR_H_ */