added skeleton for libgcrypt based crypto plugin

This commit is contained in:
Martin Willi 2009-06-04 14:23:39 +02:00
parent 86ab0bb65e
commit 4977018c23
5 changed files with 136 additions and 0 deletions

View File

@ -710,6 +710,16 @@ AC_ARG_ENABLE(
fi],
)
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).]),
@ -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

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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_ @}*/