7c6678b61eeadf7012b57c5e41dad9cb7b4f8d32
[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, COMPRESSION_ALGORITHM,
21 "UNDEFINED_TRANSFORM_TYPE",
22 "HASH_ALGORITHM",
23 "RANDOM_NUMBER_GENERATOR",
24 "AEAD_ALGORITHM",
25 "COMPRESSION_ALGORITHM");
26 ENUM_NEXT(transform_type_names, ENCRYPTION_ALGORITHM, EXTENDED_SEQUENCE_NUMBERS, COMPRESSION_ALGORITHM,
27 "ENCRYPTION_ALGORITHM",
28 "PSEUDO_RANDOM_FUNCTION",
29 "INTEGRITY_ALGORITHM",
30 "DIFFIE_HELLMAN_GROUP",
31 "EXTENDED_SEQUENCE_NUMBERS");
32 ENUM_END(transform_type_names, EXTENDED_SEQUENCE_NUMBERS);
33
34
35 ENUM(extended_sequence_numbers_names, NO_EXT_SEQ_NUMBERS, EXT_SEQ_NUMBERS,
36 "NO_EXT_SEQ",
37 "EXT_SEQ",
38 );
39
40
41 /**
42 * See header
43 */
44 enum_name_t* transform_get_enum_names(transform_type_t type)
45 {
46 switch (type)
47 {
48 case HASH_ALGORITHM:
49 return hash_algorithm_names;
50 case RANDOM_NUMBER_GENERATOR:
51 return rng_quality_names;
52 case AEAD_ALGORITHM:
53 case ENCRYPTION_ALGORITHM:
54 return encryption_algorithm_names;
55 case PSEUDO_RANDOM_FUNCTION:
56 return pseudo_random_function_names;
57 case INTEGRITY_ALGORITHM:
58 return integrity_algorithm_names;
59 case DIFFIE_HELLMAN_GROUP:
60 return diffie_hellman_group_names;
61 case EXTENDED_SEQUENCE_NUMBERS:
62 return extended_sequence_numbers_names;
63 case UNDEFINED_TRANSFORM_TYPE:
64 case COMPRESSION_ALGORITHM:
65 break;
66 }
67 return NULL;
68 }