added support for 3DES encryption algorithm in IKE

This commit is contained in:
Martin Willi
2006-09-19 11:18:35 +00:00
parent b2ac140338
commit 462129d332
7 changed files with 1613 additions and 8 deletions
+1
View File
@@ -549,6 +549,7 @@ proposal_t *proposal_create_default(protocol_id_t protocol)
{ {
case PROTO_IKE: case PROTO_IKE:
add_algorithm(this, ENCRYPTION_ALGORITHM, ENCR_AES_CBC, 128); add_algorithm(this, ENCRYPTION_ALGORITHM, ENCR_AES_CBC, 128);
add_algorithm(this, ENCRYPTION_ALGORITHM, ENCR_3DES, 0);
add_algorithm(this, INTEGRITY_ALGORITHM, AUTH_HMAC_SHA1_96, 0); add_algorithm(this, INTEGRITY_ALGORITHM, AUTH_HMAC_SHA1_96, 0);
add_algorithm(this, INTEGRITY_ALGORITHM, AUTH_HMAC_MD5_96, 0); add_algorithm(this, INTEGRITY_ALGORITHM, AUTH_HMAC_MD5_96, 0);
add_algorithm(this, PSEUDO_RANDOM_FUNCTION, PRF_HMAC_SHA1, 0); add_algorithm(this, PSEUDO_RANDOM_FUNCTION, PRF_HMAC_SHA1, 0);
+1
View File
@@ -60,6 +60,7 @@ Todo-List for charon
+ use dpdaction/dpddelay parameters from ipsec.conf + use dpdaction/dpddelay parameters from ipsec.conf
/ add firewall script support / add firewall script support
- do not link unneeded libraries in bins
- include only a minimum of NATD payloads - include only a minimum of NATD payloads
- implement 3DES to load encrypted pem files - implement 3DES to load encrypted pem files
- implement a "event bus" mechanism - implement a "event bus" mechanism
+1
View File
@@ -16,6 +16,7 @@ crypto/signers/hmac_signer.c crypto/signers/hmac_signer.h \
crypto/signers/signer.c crypto/signers/signer.h \ crypto/signers/signer.c crypto/signers/signer.h \
crypto/crypters/crypter.c crypto/crypters/crypter.h \ crypto/crypters/crypter.c crypto/crypters/crypter.h \
crypto/crypters/aes_cbc_crypter.c crypto/crypters/aes_cbc_crypter.h\ crypto/crypters/aes_cbc_crypter.c crypto/crypters/aes_cbc_crypter.h\
crypto/crypters/des_crypter.c crypto/crypters/des_crypter.h\
crypto/hashers/hasher.h crypto/hashers/hasher.c \ crypto/hashers/hasher.h crypto/hashers/hasher.c \
crypto/hashers/sha1_hasher.c crypto/hashers/sha1_hasher.h \ crypto/hashers/sha1_hasher.c crypto/hashers/sha1_hasher.h \
crypto/hashers/md5_hasher.c crypto/hashers/md5_hasher.h \ crypto/hashers/md5_hasher.c crypto/hashers/md5_hasher.h \
@@ -25,6 +25,7 @@
#include "crypter.h" #include "crypter.h"
#include <crypto/crypters/aes_cbc_crypter.h> #include <crypto/crypters/aes_cbc_crypter.h>
#include <crypto/crypters/des_crypter.h>
/** /**
@@ -58,6 +59,11 @@ crypter_t *crypter_create(encryption_algorithm_t encryption_algorithm, size_t ke
{ {
return (crypter_t*)aes_cbc_crypter_create(key_size); return (crypter_t*)aes_cbc_crypter_create(key_size);
} }
case ENCR_DES:
case ENCR_3DES:
{
return (crypter_t*)des_crypter_create(encryption_algorithm);
}
default: default:
return NULL; return NULL;
} }
+11 -8
View File
@@ -31,17 +31,19 @@ typedef enum encryption_algorithm_t encryption_algorithm_t;
/** /**
* @brief Encryption algorithm, as in IKEv2 RFC 3.3.2. * @brief Encryption algorithm, as in IKEv2 RFC 3.3.2.
* *
* Currently only the following algorithms are implemented and therefore supported: * Currently only the following algorithms are implemented:
* - ENCR_AES_CBC * - ENCR_AES_CBC
* * - ENCR_DES
* @todo Implement more enryption algorithms, such as 3DES * - ENCR_3DES
* *
* @ingroup crypters * @ingroup crypters
*/ */
enum encryption_algorithm_t { enum encryption_algorithm_t {
ENCR_UNDEFINED = 1024, ENCR_UNDEFINED = 1024,
ENCR_DES_IV64 = 1, ENCR_DES_IV64 = 1,
/** Implemented in class des_crypter_t */
ENCR_DES = 2, ENCR_DES = 2,
/** Implemented in class des_crypter_t */
ENCR_3DES = 3, ENCR_3DES = 3,
ENCR_RC5 = 4, ENCR_RC5 = 4,
ENCR_IDEA = 5, ENCR_IDEA = 5,
@@ -50,9 +52,7 @@ enum encryption_algorithm_t {
ENCR_3IDEA = 8, ENCR_3IDEA = 8,
ENCR_DES_IV32 = 9, ENCR_DES_IV32 = 9,
ENCR_NULL = 11, ENCR_NULL = 11,
/** /** Implemented in class aes_cbc_crypter_t */
* Implemented in class aes_cbc_crypter_t.
*/
ENCR_AES_CBC = 12, ENCR_AES_CBC = 12,
ENCR_AES_CTR = 13 ENCR_AES_CTR = 13
}; };
@@ -74,9 +74,10 @@ typedef struct crypter_t crypter_t;
* @ingroup crypters * @ingroup crypters
*/ */
struct crypter_t { struct crypter_t {
/** /**
* @brief Encrypt a chunk of data and allocate space for the encrypted value. * @brief Encrypt a chunk of data and allocate space for the encrypted value.
* *
* @param this calling object * @param this calling object
* @param data data to encrypt * @param data data to encrypt
* @param iv initializing vector * @param iv initializing vector
@@ -138,8 +139,10 @@ struct crypter_t {
/** /**
* @brief Generic constructor for crypter_t objects. * @brief Generic constructor for crypter_t objects.
* *
* Currently only the following algorithms are implemented and therefore supported: * Currently only the following algorithms are implemented:
* - ENCR_AES_CBC * - ENCR_AES_CBC
* - ENCR_DES
* - ENCR_3DES
* *
* The key_size is ignored for algorithms with fixed key size. * The key_size is ignored for algorithms with fixed key size.
* *
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,58 @@
/**
* @file des_crypter.h
*
* @brief Interface of des_crypter_t
*
*/
/*
* Copyright (C) 2006 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.
*/
#ifndef DES_CRYPTER_H_
#define DES_CRYPTER_H_
#include <crypto/crypters/crypter.h>
typedef struct des_crypter_t des_crypter_t;
/**
* @brief Class implementing the DES and 3DES encryption algorithms.
*
* @b Constructors:
* - des_crypter_create()
*
* @ingroup crypters
*/
struct des_crypter_t {
/**
* The crypter_t interface.
*/
crypter_t crypter_interface;
};
/**
* @brief Constructor to create des_crypter_t objects.
*
* @param algo ENCR_DES for single DES, ENCR_3DES for triple DES
* @return
* - des_crypter_t object
* - NULL if algo not supported
*/
des_crypter_t *des_crypter_create(encryption_algorithm_t algo);
#endif /* DES_CRYPTER_H_ */