Migrated fips_prf plugin to INIT/METHOD macros
[strongswan.git] / src / libstrongswan / plugins / fips_prf / fips_prf_plugin.c
1 /*
2 * Copyright (C) 2008 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 "fips_prf_plugin.h"
17
18 #include <library.h>
19 #include "fips_prf.h"
20
21 typedef struct private_fips_prf_plugin_t private_fips_prf_plugin_t;
22
23 /**
24 * private data of fips_prf_plugin
25 */
26 struct private_fips_prf_plugin_t {
27
28 /**
29 * public functions
30 */
31 fips_prf_plugin_t public;
32 };
33
34 METHOD(plugin_t, destroy, void,
35 private_fips_prf_plugin_t *this)
36 {
37 lib->crypto->remove_prf(lib->crypto,
38 (prf_constructor_t)fips_prf_create);
39 free(this);
40 }
41
42 /*
43 * see header file
44 */
45 plugin_t *fips_prf_plugin_create()
46 {
47 private_fips_prf_plugin_t *this;
48
49 INIT(this,
50 .public = {
51 .plugin = {
52 .destroy = _destroy,
53 },
54 },
55 );
56
57 lib->crypto->add_prf(lib->crypto, PRF_FIPS_SHA1_160,
58 (prf_constructor_t)fips_prf_create);
59
60 return &this->public.plugin;
61 }