]>
Commit | Line | Data |
---|---|---|
433cb51b | 1 | /* |
22550bd2 | 2 | * Copyright (C) 2012-2019 Tobias Brunner |
6f299040 | 3 | * Copyright (C) 2006-2009 Martin Willi |
19ef2aec TB |
4 | * |
5 | * Copyright (C) secunet Security Networks AG | |
433cb51b AS |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | |
8 | * under the terms of the GNU General Public License as published by the | |
9 | * Free Software Foundation; either version 2 of the License, or (at your | |
10 | * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, but | |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 | * for more details. | |
16 | */ | |
17 | ||
18 | /** | |
19 | * @defgroup transforms transforms | |
20 | * @{ @ingroup crypto | |
21 | */ | |
22 | ||
23 | #ifndef TRANSFORM_H_ | |
24 | #define TRANSFORM_H_ | |
25 | ||
26 | typedef enum transform_type_t transform_type_t; | |
27 | ||
9ee8b3b4 | 28 | #include <utils/utils.h> |
433cb51b AS |
29 | |
30 | /** | |
31 | * Type of a transform, as in IKEv2 RFC 3.3.2. | |
32 | */ | |
33 | enum transform_type_t { | |
433cb51b AS |
34 | ENCRYPTION_ALGORITHM = 1, |
35 | PSEUDO_RANDOM_FUNCTION = 2, | |
36 | INTEGRITY_ALGORITHM = 3, | |
3af7c6db | 37 | KEY_EXCHANGE_METHOD = 4, |
ec1ebb23 | 38 | EXTENDED_SEQUENCE_NUMBERS = 5, |
22550bd2 TB |
39 | ADDITIONAL_KEY_EXCHANGE_1 = 6, |
40 | ADDITIONAL_KEY_EXCHANGE_2 = 7, | |
41 | ADDITIONAL_KEY_EXCHANGE_3 = 8, | |
42 | ADDITIONAL_KEY_EXCHANGE_4 = 9, | |
43 | ADDITIONAL_KEY_EXCHANGE_5 = 10, | |
44 | ADDITIONAL_KEY_EXCHANGE_6 = 11, | |
45 | ADDITIONAL_KEY_EXCHANGE_7 = 12, | |
ec1ebb23 TB |
46 | HASH_ALGORITHM = 256, |
47 | RANDOM_NUMBER_GENERATOR = 257, | |
48 | AEAD_ALGORITHM = 258, | |
49 | COMPRESSION_ALGORITHM = 259, | |
50 | EXTENDED_OUTPUT_FUNCTION = 260, | |
737375a2 | 51 | DETERMINISTIC_RANDOM_BIT_GENERATOR = 261, |
e93882c6 | 52 | KEY_DERIVATION_FUNCTION = 262, |
433cb51b AS |
53 | }; |
54 | ||
55 | /** | |
56 | * enum names for transform_type_t. | |
57 | */ | |
58 | extern enum_name_t *transform_type_names; | |
59 | ||
1d55e075 MW |
60 | /** |
61 | * Get the enum names for a specific transform type. | |
62 | * | |
63 | * @param type type of transform to get enum names for | |
64 | * @return enum names | |
65 | */ | |
66 | enum_name_t *transform_get_enum_names(transform_type_t type); | |
67 | ||
2e059e0c TB |
68 | /** |
69 | * Check if the given transform type is used to negotiate a key exchange. | |
70 | * | |
71 | * @param type type of transform to check | |
72 | * @return TRUE if the transform type negotiates a key exchange | |
73 | */ | |
74 | static inline bool is_ke_transform(transform_type_t type) | |
75 | { | |
76 | return type == KEY_EXCHANGE_METHOD || (ADDITIONAL_KEY_EXCHANGE_1 <= type && | |
77 | type <= ADDITIONAL_KEY_EXCHANGE_7); | |
78 | } | |
79 | ||
f8b26c45 MW |
80 | /** |
81 | * Extended sequence numbers, as in IKEv2 RFC 3.3.2. | |
82 | */ | |
83 | enum extended_sequence_numbers_t { | |
84 | NO_EXT_SEQ_NUMBERS = 0, | |
85 | EXT_SEQ_NUMBERS = 1 | |
86 | }; | |
87 | ||
88 | /** | |
89 | * enum strings for extended_sequence_numbers_t. | |
90 | */ | |
91 | extern enum_name_t *extended_sequence_numbers_names; | |
92 | ||
433cb51b | 93 | #endif /** TRANSFORM_H_ @}*/ |