Added PKCS#11 token plugin stub

This commit is contained in:
Martin Willi 2010-07-13 17:34:34 +02:00
parent f8bb082f1f
commit 6e862e2152
5 changed files with 121 additions and 0 deletions

View File

@ -145,6 +145,7 @@ ARG_ENABL_SET([padlock], [enables VIA Padlock crypto plugin.])
ARG_ENABL_SET([openssl], [enables the OpenSSL crypto plugin.])
ARG_ENABL_SET([gcrypt], [enables the libgcrypt plugin.])
ARG_ENABL_SET([agent], [enables the ssh-agent signing plugin.])
ARG_ENABL_SET([pkcs11], [enables the PKCS11 token support plugin.])
ARG_ENABL_SET([addrblock], [enables RFC 3779 address block constraint support.])
ARG_ENABL_SET([uci], [enable OpenWRT UCI configuration plugin.])
ARG_ENABL_SET([android], [enable Android specific plugin.])
@ -769,6 +770,9 @@ fi
if test x$agent = xtrue; then
libstrongswan_plugins=${libstrongswan_plugins}" agent"
fi
if test x$pkcs11 = xtrue; then
libstrongswan_plugins=${libstrongswan_plugins}" pkcs11"
fi
if test x$gmp = xtrue; then
libstrongswan_plugins=${libstrongswan_plugins}" gmp"
pluto_plugins=${pluto_plugins}" gmp"
@ -824,6 +828,7 @@ 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)
AM_CONDITIONAL(USE_PKCS11, test x$pkcs11 = xtrue)
dnl charon plugins
dnl ==============
@ -953,6 +958,7 @@ AC_OUTPUT(
src/libstrongswan/plugins/openssl/Makefile
src/libstrongswan/plugins/gcrypt/Makefile
src/libstrongswan/plugins/agent/Makefile
src/libstrongswan/plugins/pkcs11/Makefile
src/libstrongswan/plugins/test_vectors/Makefile
src/libhydra/Makefile
src/libhydra/plugins/attr/Makefile

View File

@ -314,6 +314,13 @@ if MONOLITHIC
endif
endif
if USE_PKCS11
SUBDIRS += plugins/pkcs11
if MONOLITHIC
libstrongswan_la_LIBADD += plugins/pkcs11/libstrongswan-pkcs11.la
endif
endif
if USE_TEST_VECTORS
SUBDIRS += plugins/test_vectors
if MONOLITHIC

View File

@ -0,0 +1,15 @@
INCLUDES = -I$(top_srcdir)/src/libstrongswan
AM_CFLAGS = -rdynamic
if MONOLITHIC
noinst_LTLIBRARIES = libstrongswan-pkcs11.la
else
plugin_LTLIBRARIES = libstrongswan-pkcs11.la
endif
libstrongswan_pkcs11_la_SOURCES = \
pkcs11_plugin.h pkcs11_plugin.c
libstrongswan_pkcs11_la_LDFLAGS = -module -avoid-version

View File

@ -0,0 +1,51 @@
/*
* Copyright (C) 2010 Martin Willi
* Copyright (C) 2010 revosec AG
*
* 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 "pkcs11_plugin.h"
#include <library.h>
typedef struct private_pkcs11_plugin_t private_pkcs11_plugin_t;
/**
* private data of pkcs11_plugin
*/
struct private_pkcs11_plugin_t {
/**
* public functions
*/
pkcs11_plugin_t public;
};
METHOD(plugin_t, destroy, void,
private_pkcs11_plugin_t *this)
{
free(this);
}
/*
* see header file
*/
plugin_t *pkcs11_plugin_create()
{
private_pkcs11_plugin_t *this;
INIT(this,
.public.plugin.destroy = _destroy,
);
return &this->public.plugin;
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (C) 2010 Martin Willi
* Copyright (C) 2010 revosec AG
*
* 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 pkcs11 pkcs11
* @ingroup plugins
*
* @defgroup pkcs11_plugin pkcs11_plugin
* @{ @ingroup pkcs11
*/
#ifndef PKCS11_PLUGIN_H_
#define PKCS11_PLUGIN_H_
#include <plugins/plugin.h>
typedef struct pkcs11_plugin_t pkcs11_plugin_t;
/**
* Plugin providing PKCS#11 token support.
*/
struct pkcs11_plugin_t {
/**
* Implements plugin interface,
*/
plugin_t plugin;
};
#endif /** PKCS11_PLUGIN_H_ @}*/