/src/strongswan/src/libstrongswan/plugins/kdf/kdf_plugin.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright (C) 2022 Tobias Brunner |
3 | | * |
4 | | * Copyright (C) secunet Security Networks AG |
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 "kdf_plugin.h" |
18 | | #include "kdf_kdf.h" |
19 | | |
20 | | #include <library.h> |
21 | | |
22 | | typedef struct private_kdf_plugin_t private_kdf_plugin_t; |
23 | | |
24 | | /** |
25 | | * Private data |
26 | | */ |
27 | | struct private_kdf_plugin_t { |
28 | | |
29 | | /** |
30 | | * Public interface |
31 | | */ |
32 | | kdf_plugin_t public; |
33 | | }; |
34 | | |
35 | | METHOD(plugin_t, get_name, char*, |
36 | | private_kdf_plugin_t *this) |
37 | 0 | { |
38 | 0 | return "kdf"; |
39 | 0 | } |
40 | | |
41 | | METHOD(plugin_t, get_features, int, |
42 | | private_kdf_plugin_t *this, plugin_feature_t *features[]) |
43 | 0 | { |
44 | 0 | static plugin_feature_t f[] = { |
45 | 0 | PLUGIN_REGISTER(KDF, kdf_kdf_create), |
46 | 0 | PLUGIN_PROVIDE(KDF, KDF_PRF), |
47 | 0 | PLUGIN_SDEPEND(PRF, PRF_HMAC_SHA1), |
48 | 0 | PLUGIN_SDEPEND(PRF, PRF_HMAC_SHA2_256), |
49 | 0 | PLUGIN_SDEPEND(PRF, PRF_HMAC_SHA2_384), |
50 | 0 | PLUGIN_SDEPEND(PRF, PRF_HMAC_SHA2_512), |
51 | 0 | PLUGIN_SDEPEND(PRF, PRF_AES128_XCBC), |
52 | 0 | PLUGIN_SDEPEND(PRF, PRF_AES128_CMAC), |
53 | 0 | PLUGIN_PROVIDE(KDF, KDF_PRF_PLUS), |
54 | 0 | PLUGIN_SDEPEND(PRF, PRF_HMAC_SHA1), |
55 | 0 | PLUGIN_SDEPEND(PRF, PRF_HMAC_SHA2_256), |
56 | 0 | PLUGIN_SDEPEND(PRF, PRF_HMAC_SHA2_384), |
57 | 0 | PLUGIN_SDEPEND(PRF, PRF_HMAC_SHA2_512), |
58 | 0 | PLUGIN_SDEPEND(PRF, PRF_AES128_XCBC), |
59 | 0 | PLUGIN_SDEPEND(PRF, PRF_AES128_CMAC), |
60 | 0 | }; |
61 | 0 | *features = f; |
62 | 0 | return countof(f); |
63 | 0 | } |
64 | | |
65 | | METHOD(plugin_t, destroy, void, |
66 | | private_kdf_plugin_t *this) |
67 | 0 | { |
68 | 0 | free(this); |
69 | 0 | } |
70 | | |
71 | | /* |
72 | | * Described in header |
73 | | */ |
74 | | PLUGIN_DEFINE(kdf) |
75 | 0 | { |
76 | 0 | private_kdf_plugin_t *this; |
77 | |
|
78 | 0 | INIT(this, |
79 | 0 | .public = { |
80 | 0 | .plugin = { |
81 | 0 | .get_name = _get_name, |
82 | 0 | .get_features = _get_features, |
83 | 0 | .destroy = _destroy, |
84 | 0 | }, |
85 | 0 | }, |
86 | 0 | ); |
87 | |
|
88 | 0 | return &this->public.plugin; |
89 | 0 | } |