diff options
-rw-r--r-- | configure.in | 21 | ||||
-rw-r--r-- | src/libstrongswan/Makefile.am | 4 | ||||
-rw-r--r-- | src/libstrongswan/plugins/gcrypt/Makefile.am | 12 | ||||
-rw-r--r-- | src/libstrongswan/plugins/gcrypt/gcrypt_plugin.c | 52 | ||||
-rw-r--r-- | src/libstrongswan/plugins/gcrypt/gcrypt_plugin.h | 47 |
5 files changed, 136 insertions, 0 deletions
diff --git a/configure.in b/configure.in index 6832abaf1..d7af864b0 100644 --- a/configure.in +++ b/configure.in @@ -711,6 +711,16 @@ AC_ARG_ENABLE( ) AC_ARG_ENABLE( + [gcrypt], + AS_HELP_STRING([--enable-gcrypt],[enables the libgcrypt plugin. (default is NO).]), + [if test x$enableval = xyes; then + gcrypt=true + else + gcrypt=false + fi], +) + +AC_ARG_ENABLE( [agent], AS_HELP_STRING([--enable-agent],[enables the ssh-agent signing plugin. (default is NO).]), [if test x$enableval = xyes; then @@ -1006,6 +1016,11 @@ if test x$openssl = xtrue; then AC_CHECK_HEADER([openssl/evp.h],,[AC_MSG_ERROR([OpenSSL header openssl/evp.h not found!])]) fi +if test x$gcrypt = xtrue; then + AC_HAVE_LIBRARY([gcrypt],[LIBS="$LIBS"],[AC_MSG_ERROR([libgcrypt library not found])]) + AC_CHECK_HEADER([gcrypt.h],,[AC_MSG_ERROR([libgcrypt header gcrypt.h not found!])]) +fi + if test x$uci = xtrue; then AC_HAVE_LIBRARY([uci],[LIBS="$LIBS"],[AC_MSG_ERROR([UCI library libuci not found])]) AC_CHECK_HEADER([uci.h],,[AC_MSG_ERROR([UCI header uci.h not found!])]) @@ -1109,6 +1124,10 @@ if test x$openssl = xtrue; then libstrongswan_plugins=${libstrongswan_plugins}" openssl" pluto_plugins=${pluto_plugins}" openssl" fi +if test x$gcrypt = xtrue; then + libstrongswan_plugins=${libstrongswan_plugins}" gcrypt" + pluto_plugins=${pluto_plugins}" gcrypt" +fi if test x$agent = xtrue; then libstrongswan_plugins=${libstrongswan_plugins}" agent" fi @@ -1148,6 +1167,7 @@ AM_CONDITIONAL(USE_MYSQL, test x$mysql = xtrue) AM_CONDITIONAL(USE_SQLITE, test x$sqlite = xtrue) AM_CONDITIONAL(USE_PADLOCK, test x$padlock = xtrue) AM_CONDITIONAL(USE_OPENSSL, test x$openssl = xtrue) +AM_CONDITIONAL(USE_GCRYPT, test x$gcrypt = xtrue) AM_CONDITIONAL(USE_AGENT, test x$agent = xtrue) dnl charon plugins @@ -1243,6 +1263,7 @@ AC_OUTPUT( src/libstrongswan/plugins/sqlite/Makefile src/libstrongswan/plugins/padlock/Makefile src/libstrongswan/plugins/openssl/Makefile + src/libstrongswan/plugins/gcrypt/Makefile src/libstrongswan/plugins/agent/Makefile src/libstrongswan/fips/Makefile src/libfreeswan/Makefile diff --git a/src/libstrongswan/Makefile.am b/src/libstrongswan/Makefile.am index c2a1a5a4f..ca5f5e5e2 100644 --- a/src/libstrongswan/Makefile.am +++ b/src/libstrongswan/Makefile.am @@ -200,6 +200,10 @@ if USE_OPENSSL SUBDIRS += plugins/openssl endif +if USE_GCRYPT + SUBDIRS += plugins/gcrypt +endif + if USE_AGENT SUBDIRS += plugins/agent endif diff --git a/src/libstrongswan/plugins/gcrypt/Makefile.am b/src/libstrongswan/plugins/gcrypt/Makefile.am new file mode 100644 index 000000000..237df30e3 --- /dev/null +++ b/src/libstrongswan/plugins/gcrypt/Makefile.am @@ -0,0 +1,12 @@ + +INCLUDES = -I$(top_srcdir)/src/libstrongswan + +AM_CFLAGS = -rdynamic + +plugin_LTLIBRARIES = libstrongswan-gcrypt.la + +libstrongswan_gcrypt_la_SOURCES = gcrypt_plugin.h gcrypt_plugin.c + +libstrongswan_gcrypt_la_LDFLAGS = -module +libstrongswan_gcrypt_la_LIBADD = -lgcrypt + diff --git a/src/libstrongswan/plugins/gcrypt/gcrypt_plugin.c b/src/libstrongswan/plugins/gcrypt/gcrypt_plugin.c new file mode 100644 index 000000000..1b3c66d1d --- /dev/null +++ b/src/libstrongswan/plugins/gcrypt/gcrypt_plugin.c @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2009 Martin Willi + * Hochschule fuer Technik Rapperswil + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "gcrypt_plugin.h" + +#include <library.h> + +typedef struct private_gcrypt_plugin_t private_gcrypt_plugin_t; + +/** + * private data of gcrypt_plugin + */ +struct private_gcrypt_plugin_t { + + /** + * public functions + */ + gcrypt_plugin_t public; +}; + +/** + * Implementation of gcrypt_plugin_t.destroy + */ +static void destroy(private_gcrypt_plugin_t *this) +{ + free(this); +} + +/* + * see header file + */ +plugin_t *plugin_create() +{ + private_gcrypt_plugin_t *this = malloc_thing(private_gcrypt_plugin_t); + + this->public.plugin.destroy = (void(*)(plugin_t*))destroy; + + return &this->public.plugin; +} + diff --git a/src/libstrongswan/plugins/gcrypt/gcrypt_plugin.h b/src/libstrongswan/plugins/gcrypt/gcrypt_plugin.h new file mode 100644 index 000000000..f2247ed5c --- /dev/null +++ b/src/libstrongswan/plugins/gcrypt/gcrypt_plugin.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2009 Martin Willi + * Hochschule fuer Technik Rapperswil + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +/** + * @defgroup gcrypt_p gcrypt + * @ingroup plugins + * + * @defgroup gcrypt_plugin gcrypt_plugin + * @{ @ingroup gcrypt_p + */ + +#ifndef GCRYPT_PLUGIN_H_ +#define GCRYPT_PLUGIN_H_ + +#include <plugins/plugin.h> + +typedef struct gcrypt_plugin_t gcrypt_plugin_t; + +/** + * Plugin implementing crypto functions via libgcrypt. + */ +struct gcrypt_plugin_t { + + /** + * implements plugin interface + */ + plugin_t plugin; +}; + +/** + * Create a gcrypt_plugin instance. + */ +plugin_t *plugin_create(); + +#endif /** GCRYPT_PLUGIN_H_ @}*/ |