xof: Defined Extended Output Functions
[strongswan.git] / src / libstrongswan / crypto / transform.c
1 /*
2 * Copyright (C) 2006-2009 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 #include <crypto/transform.h>
17 #include <crypto/hashers/hasher.h>
18 #include <crypto/rngs/rng.h>
19
20 ENUM_BEGIN(transform_type_names, UNDEFINED_TRANSFORM_TYPE, EXTENDED_OUTPUT_FUNCTION,
21 "UNDEFINED_TRANSFORM_TYPE",
22 "HASH_ALGORITHM",
23 "RANDOM_NUMBER_GENERATOR",
24 "AEAD_ALGORITHM",
25 "COMPRESSION_ALGORITHM",
26 "EXTENDED OUTPUT FUNCTION");
27 ENUM_NEXT(transform_type_names, ENCRYPTION_ALGORITHM, EXTENDED_SEQUENCE_NUMBERS,
28 EXTENDED_OUTPUT_FUNCTION,
29 "ENCRYPTION_ALGORITHM",
30 "PSEUDO_RANDOM_FUNCTION",
31 "INTEGRITY_ALGORITHM",
32 "DIFFIE_HELLMAN_GROUP",
33 "EXTENDED_SEQUENCE_NUMBERS");
34 ENUM_END(transform_type_names, EXTENDED_SEQUENCE_NUMBERS);
35
36
37 ENUM(extended_sequence_numbers_names, NO_EXT_SEQ_NUMBERS, EXT_SEQ_NUMBERS,
38 "NO_EXT_SEQ",
39 "EXT_SEQ",
40 );
41
42
43 /**
44 * See header
45 */
46 enum_name_t* transform_get_enum_names(transform_type_t type)
47 {
48 switch (type)
49 {
50 case HASH_ALGORITHM:
51 return hash_algorithm_names;
52 case RANDOM_NUMBER_GENERATOR:
53 return rng_quality_names;
54 case AEAD_ALGORITHM:
55 case ENCRYPTION_ALGORITHM:
56 return encryption_algorithm_names;
57 case PSEUDO_RANDOM_FUNCTION:
58 return pseudo_random_function_names;
59 case INTEGRITY_ALGORITHM:
60 return integrity_algorithm_names;
61 case DIFFIE_HELLMAN_GROUP:
62 return diffie_hellman_group_names;
63 case EXTENDED_SEQUENCE_NUMBERS:
64 return extended_sequence_numbers_names;
65 case EXTENDED_OUTPUT_FUNCTION:
66 return ext_out_function_names;
67 case UNDEFINED_TRANSFORM_TYPE:
68 case COMPRESSION_ALGORITHM:
69 break;
70 }
71 return NULL;
72 }