started migration to encryption plugins
This commit is contained in:
@@ -104,6 +104,18 @@ if USE_DES
|
||||
SUBDIRS += plugins/des
|
||||
endif
|
||||
|
||||
if USE_BLOWFISH
|
||||
SUBDIRS += plugins/blowfish
|
||||
endif
|
||||
|
||||
if USE_SERPENT
|
||||
SUBDIRS += plugins/serpent
|
||||
endif
|
||||
|
||||
if USE_TWOFISH
|
||||
SUBDIRS += plugins/twofish
|
||||
endif
|
||||
|
||||
if USE_MD4
|
||||
SUBDIRS += plugins/md4
|
||||
endif
|
||||
|
||||
@@ -236,10 +236,21 @@
|
||||
0x65 "gov"
|
||||
0x03 "csor"
|
||||
0x04 "nistalgorithm"
|
||||
0x01 "aes"
|
||||
0x02 "id-aes128-CBC" OID_AES128_CBC
|
||||
0x06 "id-aes128-GCM" OID_AES128_GCM
|
||||
0x07 "id-aes128-CCM" OID_AES128_CCM
|
||||
0x16 "id-aes192-CBC" OID_AES192_CBC
|
||||
0x1A "id-aes192-GCM" OID_AES192_GCM
|
||||
0x1B "id-aes192-CCM" OID_AES192_CCM
|
||||
0x2A "id-aes256-CBC" OID_AES256_CBC
|
||||
0x2E "id-aes256-GCM" OID_AES256_GCM
|
||||
0x2F "id-aes256-CCM" OID_AES256_CCM
|
||||
0x02 "hashalgs"
|
||||
0x01 "id-SHA-256" OID_SHA256
|
||||
0x02 "id-SHA-384" OID_SHA384
|
||||
0x03 "id-SHA-512" OID_SHA512
|
||||
0x04 "id-SHA-224" OID_SHA224
|
||||
0x86 ""
|
||||
0xf8 ""
|
||||
0x42 "netscape"
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include <asn1/oid.h>
|
||||
|
||||
#include "crypter.h"
|
||||
|
||||
ENUM_BEGIN(encryption_algorithm_names, ENCR_DES_IV64, ENCR_DES_IV32,
|
||||
@@ -51,3 +53,82 @@ ENUM_NEXT(encryption_algorithm_names, ENCR_UNDEFINED, ENCR_TWOFISH, ENCR_CAMELLI
|
||||
"TWOFISH");
|
||||
ENUM_END(encryption_algorithm_names, ENCR_TWOFISH);
|
||||
|
||||
/*
|
||||
* Described in header.
|
||||
*/
|
||||
encryption_algorithm_t encryption_algorithm_from_oid(int oid, size_t *key_size)
|
||||
{
|
||||
encryption_algorithm_t alg;
|
||||
size_t alg_key_size;
|
||||
|
||||
switch (oid)
|
||||
{
|
||||
case OID_DES_CBC:
|
||||
alg = ENCR_DES;
|
||||
alg_key_size = 0;
|
||||
break;
|
||||
case OID_3DES_EDE_CBC:
|
||||
alg = ENCR_3DES;
|
||||
alg_key_size = 0;
|
||||
break;
|
||||
case OID_AES128_CBC:
|
||||
alg = ENCR_AES_CBC;
|
||||
alg_key_size = 128;
|
||||
break;
|
||||
case OID_AES192_CBC:
|
||||
alg = ENCR_AES_CBC;
|
||||
alg_key_size = 192;
|
||||
break;
|
||||
case OID_AES256_CBC:
|
||||
alg = ENCR_AES_CBC;
|
||||
alg_key_size = 256;
|
||||
break;
|
||||
default:
|
||||
alg = ENCR_UNDEFINED;
|
||||
alg_key_size = 0;
|
||||
}
|
||||
if (key_size)
|
||||
{
|
||||
*key_size = alg_key_size;
|
||||
}
|
||||
return alg;
|
||||
}
|
||||
|
||||
/*
|
||||
* Described in header.
|
||||
*/
|
||||
int encryption_algorithm_to_oid(encryption_algorithm_t alg, size_t key_size)
|
||||
{
|
||||
int oid;
|
||||
|
||||
switch(alg)
|
||||
{
|
||||
case ENCR_DES:
|
||||
oid = OID_DES_CBC;
|
||||
break;
|
||||
case ENCR_3DES:
|
||||
oid = OID_3DES_EDE_CBC;
|
||||
break;
|
||||
case ENCR_AES_CBC:
|
||||
switch (key_size)
|
||||
{
|
||||
case 128:
|
||||
oid = OID_AES128_CBC;
|
||||
break;
|
||||
case 192:
|
||||
oid = OID_AES192_CBC;
|
||||
break;
|
||||
case 256:
|
||||
oid = OID_AES256_CBC;
|
||||
break;
|
||||
default:
|
||||
oid = OID_UNKNOWN;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
oid = OID_UNKNOWN;
|
||||
}
|
||||
return oid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -128,4 +128,22 @@ struct crypter_t {
|
||||
void (*destroy) (crypter_t *this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Conversion of ASN.1 OID to encryption algorithm.
|
||||
*
|
||||
* @param oid ASN.1 OID
|
||||
* @param key_size returns size of encryption key in bits
|
||||
* @return encryption algorithm, ENCR_UNDEFINED if OID unsupported
|
||||
*/
|
||||
encryption_algorithm_t encryption_algorithm_from_oid(int oid, size_t *key_size);
|
||||
|
||||
/**
|
||||
* Conversion of encryption algorithm to ASN.1 OID.
|
||||
*
|
||||
* @param alg encryption algorithm
|
||||
* @param key_size size of encryption key in bits
|
||||
* @return ASN.1 OID, OID_UNKNOWN if OID is unknown
|
||||
*/
|
||||
int encryption_algorithm_to_oid(encryption_algorithm_t alg, size_t key_size);
|
||||
|
||||
#endif /** CRYPTER_H_ @}*/
|
||||
|
||||
@@ -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_ @}*/
|
||||
Reference in New Issue
Block a user