started migration to encryption plugins

This commit is contained in:
Andreas Steffen
2009-05-09 00:04:28 +02:00
parent bf45d6dd3b
commit d36ae9e305
24 changed files with 5630 additions and 253 deletions
@@ -0,0 +1,10 @@
INCLUDES = -I$(top_srcdir)/src/libstrongswan
AM_CFLAGS = -rdynamic
plugin_LTLIBRARIES = libstrongswan-blowfish.la
libstrongswan_blowfish_la_SOURCES = blowfish_plugin.h blowfish_plugin.c blowfish_crypter.c blowfish_crypter.h
libstrongswan_blowfish_la_LDFLAGS = -module
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,50 @@
/*
* Copyright (C) 2005-2008 Martin Willi
* Copyright (C) 2009 Andreas Steffen
* 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 blowfish_crypter blowfish_crypter
* @{ @ingroup blowfish_p
*/
#ifndef BLOWFISH_CRYPTER_H_
#define BLOWFISH_CRYPTER_H_
typedef struct blowfish_crypter_t blowfish_crypter_t;
#include <crypto/crypters/crypter.h>
/**
* Class implementing the Blowfish encryption algorithm.
*/
struct blowfish_crypter_t {
/**
* The crypter_t interface.
*/
crypter_t crypter_interface;
};
/**
* Constructor to create blowfish_crypter_t objects.
*
* @param key_size key size in bytes
* @param algo algorithm to implement
* @return blowfish_crypter_t object, NULL if not supported
*/
blowfish_crypter_t *blowfish_crypter_create(encryption_algorithm_t algo,
size_t key_size);
#endif /** BLOWFISH_CRYPTER_H_ @}*/
@@ -0,0 +1,59 @@
/*
* Copyright (C) 2008 Martin Willi
* Copyright (C) 2009 Andreas Steffen
* 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 "blowfish_plugin.h"
#include <library.h>
#include "blowfish_crypter.h"
typedef struct private_blowfish_plugin_t private_blowfish_plugin_t;
/**
* private data of blowfish_plugin
*/
struct private_blowfish_plugin_t {
/**
* public functions
*/
blowfish_plugin_t public;
};
/**
* Implementation of blowfish_plugin_t.destroy
*/
static void destroy(private_blowfish_plugin_t *this)
{
lib->crypto->remove_crypter(lib->crypto,
(crypter_constructor_t)blowfish_crypter_create);
free(this);
}
/*
* see header file
*/
plugin_t *plugin_create()
{
private_blowfish_plugin_t *this = malloc_thing(private_blowfish_plugin_t);
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
lib->crypto->add_crypter(lib->crypto, ENCR_BLOWFISH,
(crypter_constructor_t)blowfish_crypter_create);
return &this->public.plugin;
}
@@ -0,0 +1,48 @@
/*
* Copyright (C) 2008 Martin Willi
* Copyright (C) 2009 Andreas Steffen
* 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 blowfish_p blowfish
* @ingroup plugins
*
* @defgroup blowfish_plugin blowfish_plugin
* @{ @ingroup blowfish_p
*/
#ifndef BLOWFISH_PLUGIN_H_
#define BLOWFISH_PLUGIN_H_
#include <plugins/plugin.h>
typedef struct blowfish_plugin_t blowfish_plugin_t;
/**
* Plugin implementing Blowfish based algorithms in software.
*/
struct blowfish_plugin_t {
/**
* implements plugin interface
*/
plugin_t plugin;
};
/**
* Create a blowfish_plugin instance.
*/
plugin_t *plugin_create();
#endif /** BLOWFISH_PLUGIN_H_ @}*/
@@ -0,0 +1,10 @@
INCLUDES = -I$(top_srcdir)/src/libstrongswan
AM_CFLAGS = -rdynamic
plugin_LTLIBRARIES = libstrongswan-serpent.la
libstrongswan_serpent_la_SOURCES = serpent_plugin.h serpent_plugin.c serpent_crypter.c serpent_crypter.h
libstrongswan_serpent_la_LDFLAGS = -module
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,50 @@
/*
* Copyright (C) 2005-2008 Martin Willi
* Copyright (C) 2009 Andreas Steffen
* 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 serpent_crypter serpent_crypter
* @{ @ingroup serpent_p
*/
#ifndef SERPENT_CRYPTER_H_
#define SERPENT_CRYPTER_H_
typedef struct serpent_crypter_t serpent_crypter_t;
#include <crypto/crypters/crypter.h>
/**
* Class implementing the Serpent encryption algorithm.
*/
struct serpent_crypter_t {
/**
* The crypter_t interface.
*/
crypter_t crypter_interface;
};
/**
* Constructor to create serpent_crypter_t objects.
*
* @param key_size key size in bytes
* @param algo algorithm to implement
* @return serpent_crypter_t object, NULL if not supported
*/
serpent_crypter_t *serpent_crypter_create(encryption_algorithm_t algo,
size_t key_size);
#endif /** SERPENT_CRYPTER_H_ @}*/
@@ -0,0 +1,59 @@
/*
* Copyright (C) 2008 Martin Willi
* Copyright (C) 2009 Andreas Steffen
* 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 "serpent_plugin.h"
#include <library.h>
#include "serpent_crypter.h"
typedef struct private_serpent_plugin_t private_serpent_plugin_t;
/**
* private data of serpent_plugin
*/
struct private_serpent_plugin_t {
/**
* public functions
*/
serpent_plugin_t public;
};
/**
* Implementation of serpent_plugin_t.destroy
*/
static void destroy(private_serpent_plugin_t *this)
{
lib->crypto->remove_crypter(lib->crypto,
(crypter_constructor_t)serpent_crypter_create);
free(this);
}
/*
* see header file
*/
plugin_t *plugin_create()
{
private_serpent_plugin_t *this = malloc_thing(private_serpent_plugin_t);
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
lib->crypto->add_crypter(lib->crypto, ENCR_SERPENT,
(crypter_constructor_t)serpent_crypter_create);
return &this->public.plugin;
}
@@ -0,0 +1,48 @@
/*
* Copyright (C) 2008 Martin Willi
* Copyright (C) 2009 Andreas Steffen
* 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 serpent_p serpent
* @ingroup plugins
*
* @defgroup serpent_plugin serpent_plugin
* @{ @ingroup serpent_p
*/
#ifndef SERPENT_PLUGIN_H_
#define SERPENT_PLUGIN_H_
#include <plugins/plugin.h>
typedef struct serpent_plugin_t serpent_plugin_t;
/**
* Plugin implementing Serpent based algorithms in software.
*/
struct serpent_plugin_t {
/**
* implements plugin interface
*/
plugin_t plugin;
};
/**
* Create a serpent_plugin instance.
*/
plugin_t *plugin_create();
#endif /** SERPENT_PLUGIN_H_ @}*/
@@ -0,0 +1,10 @@
INCLUDES = -I$(top_srcdir)/src/libstrongswan
AM_CFLAGS = -rdynamic
plugin_LTLIBRARIES = libstrongswan-twofish.la
libstrongswan_twofish_la_SOURCES = twofish_plugin.h twofish_plugin.c twofish_crypter.c twofish_crypter.h
libstrongswan_twofish_la_LDFLAGS = -module
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,51 @@
/*
* Copyright (C) 2005-2008 Martin Willi
* Copyright (C) 2005 Jan Hutter
* Copyright (C) 2009 Andreas Steffen
* 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 twofish_crypter twofish_crypter
* @{ @ingroup twofish_p
*/
#ifndef TWOFISH_CRYPTER_H_
#define TWOFISH_CRYPTER_H_
typedef struct twofish_crypter_t twofish_crypter_t;
#include <crypto/crypters/crypter.h>
/**
* Class implementing the Twofish encryption algorithm.
*/
struct twofish_crypter_t {
/**
* The crypter_t interface.
*/
crypter_t crypter_interface;
};
/**
* Constructor to create twofish_crypter_t objects.
*
* @param key_size key size in bytes
* @param algo algorithm to implement
* @return twofish_crypter_t object, NULL if not supported
*/
twofish_crypter_t *twofish_crypter_create(encryption_algorithm_t algo,
size_t key_size);
#endif /** TWOFISH_CRYPTER_H_ @}*/
@@ -0,0 +1,59 @@
/*
* Copyright (C) 2008 Martin Willi
* Copyright (C) 2009 Andreas Steffen
* 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 "twofish_plugin.h"
#include <library.h>
#include "twofish_crypter.h"
typedef struct private_twofish_plugin_t private_twofish_plugin_t;
/**
* private data of twofish_plugin
*/
struct private_twofish_plugin_t {
/**
* public functions
*/
twofish_plugin_t public;
};
/**
* Implementation of twofish_plugin_t.destroy
*/
static void destroy(private_twofish_plugin_t *this)
{
lib->crypto->remove_crypter(lib->crypto,
(crypter_constructor_t)twofish_crypter_create);
free(this);
}
/*
* see header file
*/
plugin_t *plugin_create()
{
private_twofish_plugin_t *this = malloc_thing(private_twofish_plugin_t);
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
lib->crypto->add_crypter(lib->crypto, ENCR_TWOFISH,
(crypter_constructor_t)twofish_crypter_create);
return &this->public.plugin;
}
@@ -0,0 +1,48 @@
/*
* Copyright (C) 2008 Martin Willi
* Copyright (C) 2009 Andreas Steffen
* 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 twofish_p twofish
* @ingroup plugins
*
* @defgroup twofish_plugin twofish_plugin
* @{ @ingroup twofish_p
*/
#ifndef TWOFISH_PLUGIN_H_
#define TWOFISH_PLUGIN_H_
#include <plugins/plugin.h>
typedef struct twofish_plugin_t twofish_plugin_t;
/**
* Plugin implementing Twofish based algorithms in software.
*/
struct twofish_plugin_t {
/**
* implements plugin interface
*/
plugin_t plugin;
};
/**
* Create a twofish_plugin instance.
*/
plugin_t *plugin_create();
#endif /** TWOFISH_PLUGIN_H_ @}*/