1 /* keysize_descriptor.h */
3 This file is part of the ARM-Crypto-Lib.
4 Copyright (C) 2009 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 keysize_descriptor.h
22 * \email daniel.otte@rub.de
24 * \license GPLv3 or later
27 #ifndef KEYSIZE_DESCRIPTOR_H_
28 #define KEYSIZE_DESCRIPTOR_H_
32 #define KS_TYPE_TERMINATOR 0x00
33 #define KS_TYPE_LIST 0x01
34 #define KS_TYPE_RANGE 0x02
35 #define KS_TYPE_ARG_RANGE 0x03
37 #define KS_INT(a) ((a)&0xFF), ((a)>>8)
39 typedef struct{ /* keysize is valid if listed in items */
40 uint8_t n_items; /* number of items (value 0 is reserved) */
41 uint16_t items[]; /* list of valid lengths */
44 typedef struct{ /* keysize is valid if min<=keysize<=max */
47 }keysize_desc_range_t;
49 typedef struct{ /* keysize is valid if min<=keysize<=max and if keysize mod distance == offset */
54 }keysize_desc_arg_range_t;
56 uint8_t is_valid_keysize_P(const void* ks_desc, uint16_t keysize);
57 uint16_t get_keysize(const void* ks_desc);
58 #endif /* KEYSIZE_DESCRIPTOR_H_ */