3 @@ -133,6 +133,7 @@ ARG_DISBL_SET([fips-prf], [disable
4 ARG_ENABL_SET([gcm], [enables the GCM AEAD wrapper crypto plugin.])
5 ARG_ENABL_SET([gcrypt], [enables the libgcrypt plugin.])
6 ARG_DISBL_SET([gmp], [disable GNU MP (libgmp) based crypto implementation plugin.])
7 +ARG_DISBL_SET([gmpdh], [disable GNU MP (libgmp) based static-linked crypto DH minimal implementation plugin.])
8 ARG_DISBL_SET([curve25519], [disable Curve25519 Diffie-Hellman plugin.])
9 ARG_DISBL_SET([hmac], [disable HMAC crypto implementation plugin.])
10 ARG_ENABL_SET([md4], [enable MD4 software implementation plugin.])
11 @@ -1362,6 +1363,7 @@ ADD_PLUGIN([gcrypt], [s ch
12 ADD_PLUGIN([af-alg], [s charon scepclient pki scripts medsrv attest nm cmd aikgen])
13 ADD_PLUGIN([fips-prf], [s charon nm cmd])
14 ADD_PLUGIN([gmp], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen])
15 +ADD_PLUGIN([gmpdh], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen])
16 ADD_PLUGIN([curve25519], [s charon scripts nm cmd])
17 ADD_PLUGIN([agent], [s charon nm cmd])
18 ADD_PLUGIN([keychain], [s charon cmd])
19 @@ -1498,6 +1500,7 @@ AM_CONDITIONAL(USE_SHA3, test x$sha3 = x
20 AM_CONDITIONAL(USE_MGF1, test x$mgf1 = xtrue)
21 AM_CONDITIONAL(USE_FIPS_PRF, test x$fips_prf = xtrue)
22 AM_CONDITIONAL(USE_GMP, test x$gmp = xtrue)
23 +AM_CONDITIONAL(USE_GMPDH, test x$gmpdh = xtrue)
24 AM_CONDITIONAL(USE_CURVE25519, test x$curve25519 = xtrue)
25 AM_CONDITIONAL(USE_RDRAND, test x$rdrand = xtrue)
26 AM_CONDITIONAL(USE_AESNI, test x$aesni = xtrue)
27 @@ -1756,6 +1759,7 @@ AC_CONFIG_FILES([
28 src/libstrongswan/plugins/mgf1/Makefile
29 src/libstrongswan/plugins/fips_prf/Makefile
30 src/libstrongswan/plugins/gmp/Makefile
31 + src/libstrongswan/plugins/gmpdh/Makefile
32 src/libstrongswan/plugins/curve25519/Makefile
33 src/libstrongswan/plugins/rdrand/Makefile
34 src/libstrongswan/plugins/aesni/Makefile
35 --- a/src/libstrongswan/Makefile.am
36 +++ b/src/libstrongswan/Makefile.am
37 @@ -313,6 +313,13 @@ if MONOLITHIC
42 + SUBDIRS += plugins/gmpdh
44 + libstrongswan_la_LIBADD += plugins/gmpdh/libstrongswan-gmpdh.la
49 SUBDIRS += plugins/curve25519
52 +++ b/src/libstrongswan/plugins/gmpdh/Makefile.am
55 + -I$(top_srcdir)/src/libstrongswan
61 +noinst_LTLIBRARIES = libstrongswan-gmpdh.la
63 +plugin_LTLIBRARIES = libstrongswan-gmpdh.la
66 +libstrongswan_gmpdh_la_SOURCES = \
67 + gmpdh_plugin.h gmpdh_plugin.c \
68 + ../gmp/gmp_diffie_hellman.c ../gmp/gmp_diffie_hellman.h
71 +libstrongswan_gmpdh_la_LDFLAGS = -module -avoid-version -Wl,-Bstatic -Wl,-lgmp -Wl,-Bdynamic -Wl,--as-needed
72 +libstrongswan_gmpdh_la_LIBADD =
74 +++ b/src/libstrongswan/plugins/gmpdh/gmpdh_plugin.c
77 + * Copyright (C) 2008-2009 Martin Willi
78 + * Hochschule fuer Technik Rapperswil
80 + * This program is free software; you can redistribute it and/or modify it
81 + * under the terms of the GNU General Public License as published by the
82 + * Free Software Foundation; either version 2 of the License, or (at your
83 + * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
85 + * This program is distributed in the hope that it will be useful, but
86 + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
87 + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
91 +#include "gmpdh_plugin.h"
94 +#include "../gmp/gmp_diffie_hellman.h"
96 +typedef struct private_gmpdh_plugin_t private_gmpdh_plugin_t;
99 + * private data of gmp_plugin
101 +struct private_gmpdh_plugin_t {
106 + gmpdh_plugin_t public;
109 +METHOD(plugin_t, get_name, char*,
110 + private_gmpdh_plugin_t *this)
115 +METHOD(plugin_t, get_features, int,
116 + private_gmpdh_plugin_t *this, plugin_feature_t *features[])
118 + static plugin_feature_t f[] = {
120 + PLUGIN_REGISTER(DH, gmp_diffie_hellman_create),
121 + PLUGIN_PROVIDE(DH, MODP_2048_BIT),
122 + PLUGIN_DEPENDS(RNG, RNG_STRONG),
123 + PLUGIN_PROVIDE(DH, MODP_2048_224),
124 + PLUGIN_DEPENDS(RNG, RNG_STRONG),
125 + PLUGIN_PROVIDE(DH, MODP_2048_256),
126 + PLUGIN_DEPENDS(RNG, RNG_STRONG),
127 + PLUGIN_PROVIDE(DH, MODP_1536_BIT),
128 + PLUGIN_DEPENDS(RNG, RNG_STRONG),
129 + PLUGIN_PROVIDE(DH, MODP_3072_BIT),
130 + PLUGIN_DEPENDS(RNG, RNG_STRONG),
131 + PLUGIN_PROVIDE(DH, MODP_4096_BIT),
132 + PLUGIN_DEPENDS(RNG, RNG_STRONG),
133 + PLUGIN_PROVIDE(DH, MODP_6144_BIT),
134 + PLUGIN_DEPENDS(RNG, RNG_STRONG),
135 + PLUGIN_PROVIDE(DH, MODP_8192_BIT),
136 + PLUGIN_DEPENDS(RNG, RNG_STRONG),
137 + PLUGIN_PROVIDE(DH, MODP_1024_BIT),
138 + PLUGIN_DEPENDS(RNG, RNG_STRONG),
139 + PLUGIN_PROVIDE(DH, MODP_1024_160),
140 + PLUGIN_DEPENDS(RNG, RNG_STRONG),
141 + PLUGIN_PROVIDE(DH, MODP_768_BIT),
142 + PLUGIN_DEPENDS(RNG, RNG_STRONG),
143 + PLUGIN_REGISTER(DH, gmp_diffie_hellman_create_custom),
144 + PLUGIN_PROVIDE(DH, MODP_CUSTOM),
145 + PLUGIN_DEPENDS(RNG, RNG_STRONG),
151 +METHOD(plugin_t, destroy, void,
152 + private_gmpdh_plugin_t *this)
160 +plugin_t *gmpdh_plugin_create()
162 + private_gmpdh_plugin_t *this;
167 + .get_name = _get_name,
168 + .get_features = _get_features,
169 + .destroy = _destroy,
174 + return &this->public.plugin;
178 +++ b/src/libstrongswan/plugins/gmpdh/gmpdh_plugin.h
181 + * Copyright (C) 2008 Martin Willi
182 + * Hochschule fuer Technik Rapperswil
184 + * This program is free software; you can redistribute it and/or modify it
185 + * under the terms of the GNU General Public License as published by the
186 + * Free Software Foundation; either version 2 of the License, or (at your
187 + * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
189 + * This program is distributed in the hope that it will be useful, but
190 + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
191 + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
192 + * for more details.
196 + * @defgroup gmpdh_p gmpdh
199 + * @defgroup gmpdh_plugin gmpdh_plugin
200 + * @{ @ingroup gmpdh_p
203 +#ifndef GMPDH_PLUGIN_H_
204 +#define GMPDH_PLUGIN_H_
206 +#include <plugins/plugin.h>
208 +typedef struct gmpdh_plugin_t gmpdh_plugin_t;
211 + * Plugin implementing asymmetric crypto algorithms using the GNU MP library.
213 +struct gmpdh_plugin_t {
216 + * implements plugin interface
221 +#endif /** GMPDH_PLUGIN_H_ @}*/