added skeleton for libgcrypt based crypto plugin

This commit is contained in:
Martin Willi
2009-06-09 11:18:56 +02:00
parent 86ab0bb65e
commit 4977018c23
5 changed files with 136 additions and 0 deletions
+4
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
@@ -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
@@ -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;
}
@@ -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_ @}*/