/src/strongswan/src/libstrongswan/plugins/nonce/nonce_plugin.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright (C) 2012 Adrian-Ken Rueegsegger |
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 "nonce_plugin.h" |
18 | | |
19 | | #include <library.h> |
20 | | #include "nonce_nonceg.h" |
21 | | |
22 | | typedef struct private_nonce_plugin_t private_nonce_plugin_t; |
23 | | |
24 | | /** |
25 | | * private data of nonce_plugin |
26 | | */ |
27 | | struct private_nonce_plugin_t { |
28 | | |
29 | | /** |
30 | | * public functions |
31 | | */ |
32 | | nonce_plugin_t public; |
33 | | }; |
34 | | |
35 | | METHOD(plugin_t, get_name, char*, |
36 | | private_nonce_plugin_t *this) |
37 | 0 | { |
38 | 0 | return "nonce"; |
39 | 0 | } |
40 | | |
41 | | METHOD(plugin_t, get_features, int, |
42 | | private_nonce_plugin_t *this, plugin_feature_t *features[]) |
43 | 0 | { |
44 | 0 | static plugin_feature_t f[] = { |
45 | 0 | PLUGIN_REGISTER(NONCE_GEN, nonce_nonceg_create), |
46 | 0 | PLUGIN_PROVIDE(NONCE_GEN), |
47 | 0 | PLUGIN_DEPENDS(RNG, NONCE_RNG_QUALITY), |
48 | 0 | }; |
49 | 0 | *features = f; |
50 | 0 | return countof(f); |
51 | 0 | } |
52 | | |
53 | | METHOD(plugin_t, destroy, void, |
54 | | private_nonce_plugin_t *this) |
55 | 0 | { |
56 | 0 | free(this); |
57 | 0 | } |
58 | | |
59 | | /* |
60 | | * see header file |
61 | | */ |
62 | | PLUGIN_DEFINE(nonce) |
63 | 0 | { |
64 | 0 | private_nonce_plugin_t *this; |
65 | |
|
66 | 0 | INIT(this, |
67 | 0 | .public = { |
68 | 0 | .plugin = { |
69 | 0 | .get_name = _get_name, |
70 | 0 | .get_features = _get_features, |
71 | 0 | .destroy = _destroy, |
72 | 0 | }, |
73 | 0 | }, |
74 | 0 | ); |
75 | |
|
76 | 0 | return &this->public.plugin; |
77 | 0 | } |