Migrated the aes plugin to INIT/METHOD macros
[strongswan.git] / src / libstrongswan / plugins / aes / aes_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 "aes_plugin.h"
17
18 #include <library.h>
19 #include "aes_crypter.h"
20
21 typedef struct private_aes_plugin_t private_aes_plugin_t;
22
23 /**
24 * private data of aes_plugin
25 */
26 struct private_aes_plugin_t {
27
28 /**
29 * public functions
30 */
31 aes_plugin_t public;
32 };
33
34 METHOD(plugin_t, destroy, void,
35 private_aes_plugin_t *this)
36 {
37 lib->crypto->remove_crypter(lib->crypto,
38 (crypter_constructor_t)aes_crypter_create);
39 free(this);
40 }
41
42 /*
43 * see header file
44 */
45 plugin_t *aes_plugin_create()
46 {
47 private_aes_plugin_t *this;
48
49 INIT(this,
50 .public.plugin.destroy = _destroy,
51 );
52
53 lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC,
54 (crypter_constructor_t)aes_crypter_create);
55
56 return &this->public.plugin;
57 }
58