]> git.ipfire.org Git - thirdparty/strongswan.git/blob - programs/charon/lib/crypto/crypters/crypter.c
- renamed get_block_size of hasher
[thirdparty/strongswan.git] / programs / charon / lib / crypto / crypters / crypter.c
1 /**
2 * @file crypter.c
3 *
4 * @brief Generic constructor for crypter_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23
24 #include "crypter.h"
25
26 #include <crypto/crypters/aes_cbc_crypter.h>
27
28
29 /**
30 * String mappings for encryption_algorithm_t.
31 */
32 mapping_t encryption_algorithm_m[] = {
33 {ENCR_UNDEFINED, "ENCR_UNDEFINED"},
34 {ENCR_DES_IV64, "ENCR_DES_IV64"},
35 {ENCR_DES, "ENCR_DES"},
36 {ENCR_3DES, "ENCR_3DES"},
37 {ENCR_RC5, "ENCR_RC5"},
38 {ENCR_IDEA, "ENCR_IDEA"},
39 {ENCR_CAST, "ENCR_CAST"},
40 {ENCR_BLOWFISH, "ENCR_BLOWFISH"},
41 {ENCR_3IDEA, "ENCR_3IDEA"},
42 {ENCR_DES_IV32, "ENCR_DES_IV32"},
43 {ENCR_NULL, "ENCR_NULL"},
44 {ENCR_AES_CBC, "ENCR_AES_CBC"},
45 {ENCR_AES_CTR, "ENCR_AES_CTR"},
46 {MAPPING_END, NULL}
47 };
48
49 /*
50 * Described in header.
51 */
52 crypter_t *crypter_create(encryption_algorithm_t encryption_algorithm, size_t key_size)
53 {
54 switch (encryption_algorithm)
55 {
56 case ENCR_AES_CBC:
57 {
58 return (crypter_t*)aes_cbc_crypter_create(key_size);
59 }
60 default:
61 return NULL;
62 }
63 }