]>
Commit | Line | Data |
---|---|---|
272f0e1a MW |
1 | /* |
2 | * Copyright (C) 2010 Martin Willi | |
19ef2aec TB |
3 | * |
4 | * Copyright (C) secunet Security Networks AG | |
272f0e1a MW |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | |
7 | * under the terms of the GNU General Public License as published by the | |
8 | * Free Software Foundation; either version 2 of the License, or (at your | |
9 | * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, but | |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 | * for more details. | |
15 | */ | |
16 | ||
17 | #include "ctr_plugin.h" | |
18 | ||
19 | #include <library.h> | |
20 | ||
21 | #include "ctr_ipsec_crypter.h" | |
22 | ||
23 | typedef struct private_ctr_plugin_t private_ctr_plugin_t; | |
24 | ||
25 | /** | |
26 | * private data of ctr_plugin | |
27 | */ | |
28 | struct private_ctr_plugin_t { | |
29 | ||
30 | /** | |
31 | * public functions | |
32 | */ | |
33 | ctr_plugin_t public; | |
34 | }; | |
35 | ||
787b5884 MW |
36 | METHOD(plugin_t, get_name, char*, |
37 | private_ctr_plugin_t *this) | |
38 | { | |
39 | return "ctr"; | |
40 | } | |
41 | ||
d29d63c2 MW |
42 | METHOD(plugin_t, get_features, int, |
43 | private_ctr_plugin_t *this, plugin_feature_t *features[]) | |
44 | { | |
45 | static plugin_feature_t f[] = { | |
46 | PLUGIN_REGISTER(CRYPTER, ctr_ipsec_crypter_create), | |
47 | PLUGIN_PROVIDE(CRYPTER, ENCR_AES_CTR, 16), | |
48 | PLUGIN_DEPENDS(CRYPTER, ENCR_AES_CBC, 16), | |
49 | PLUGIN_PROVIDE(CRYPTER, ENCR_AES_CTR, 24), | |
50 | PLUGIN_DEPENDS(CRYPTER, ENCR_AES_CBC, 24), | |
51 | PLUGIN_PROVIDE(CRYPTER, ENCR_AES_CTR, 32), | |
52 | PLUGIN_DEPENDS(CRYPTER, ENCR_AES_CBC, 32), | |
53 | PLUGIN_PROVIDE(CRYPTER, ENCR_CAMELLIA_CTR, 16), | |
54 | PLUGIN_DEPENDS(CRYPTER, ENCR_CAMELLIA_CBC, 16), | |
55 | PLUGIN_PROVIDE(CRYPTER, ENCR_CAMELLIA_CTR, 24), | |
56 | PLUGIN_DEPENDS(CRYPTER, ENCR_CAMELLIA_CBC, 24), | |
57 | PLUGIN_PROVIDE(CRYPTER, ENCR_CAMELLIA_CTR, 32), | |
58 | PLUGIN_DEPENDS(CRYPTER, ENCR_CAMELLIA_CBC, 32), | |
59 | }; | |
60 | *features = f; | |
61 | return countof(f); | |
62 | } | |
63 | ||
272f0e1a MW |
64 | METHOD(plugin_t, destroy, void, |
65 | private_ctr_plugin_t *this) | |
66 | { | |
272f0e1a MW |
67 | free(this); |
68 | } | |
69 | ||
70 | /* | |
71 | * see header file | |
72 | */ | |
73 | plugin_t *ctr_plugin_create() | |
74 | { | |
75 | private_ctr_plugin_t *this; | |
76 | ||
77 | INIT(this, | |
ba31fe1f MW |
78 | .public = { |
79 | .plugin = { | |
787b5884 | 80 | .get_name = _get_name, |
d29d63c2 | 81 | .get_features = _get_features, |
ba31fe1f MW |
82 | .destroy = _destroy, |
83 | }, | |
84 | }, | |
272f0e1a MW |
85 | ); |
86 | ||
272f0e1a MW |
87 | return &this->public.plugin; |
88 | } |