Remove HASH_PREFERRED, usages are replaced with HASH_SHA1, which is required for IKEv2 anyway
This commit is contained in:
@@ -655,7 +655,7 @@ receiver_t *receiver_create()
|
||||
this->initiator_only = lib->settings->get_bool(lib->settings,
|
||||
"%s.initiator_only", FALSE, charon->name),
|
||||
|
||||
this->hasher = lib->crypto->create_hasher(lib->crypto, HASH_PREFERRED);
|
||||
this->hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA1);
|
||||
if (!this->hasher)
|
||||
{
|
||||
DBG1(DBG_NET, "creating cookie hasher failed, no hashers supported");
|
||||
|
||||
@@ -2133,7 +2133,7 @@ ike_sa_manager_t *ike_sa_manager_create()
|
||||
},
|
||||
);
|
||||
|
||||
this->hasher = lib->crypto->create_hasher(lib->crypto, HASH_PREFERRED);
|
||||
this->hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA1);
|
||||
if (this->hasher == NULL)
|
||||
{
|
||||
DBG1(DBG_MGR, "manager initialization failed, no hasher supported");
|
||||
|
||||
@@ -249,9 +249,9 @@ METHOD(crypto_factory_t, create_hasher, hasher_t*,
|
||||
enumerator = this->hashers->create_enumerator(this->hashers);
|
||||
while (enumerator->enumerate(enumerator, &entry))
|
||||
{
|
||||
if (algo == HASH_PREFERRED || entry->algo == algo)
|
||||
if (entry->algo == algo)
|
||||
{
|
||||
if (this->test_on_create && algo != HASH_PREFERRED &&
|
||||
if (this->test_on_create &&
|
||||
!this->tester->test_hasher(this->tester, algo,
|
||||
entry->create_hasher, NULL,
|
||||
default_plugin_name))
|
||||
|
||||
@@ -213,9 +213,6 @@ struct crypto_factory_t {
|
||||
/**
|
||||
* Register a hasher constructor.
|
||||
*
|
||||
* The first added hasher is the preferred hasher returned on
|
||||
* create_hasher(HASH_PREFERRED).
|
||||
*
|
||||
* @param algo algorithm to constructor
|
||||
* @param plugin_name plugin that registered this algorithm
|
||||
* @param create constructor function for that algorithm
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
ENUM(hash_algorithm_names, HASH_UNKNOWN, HASH_SHA512,
|
||||
"HASH_UNKNOWN",
|
||||
"HASH_PREFERRED",
|
||||
"HASH_MD2",
|
||||
"HASH_MD4",
|
||||
"HASH_MD5",
|
||||
@@ -34,7 +33,6 @@ ENUM(hash_algorithm_names, HASH_UNKNOWN, HASH_SHA512,
|
||||
|
||||
ENUM(hash_algorithm_short_names, HASH_UNKNOWN, HASH_SHA512,
|
||||
"unknown",
|
||||
"preferred",
|
||||
"md2",
|
||||
"md4",
|
||||
"md5",
|
||||
@@ -199,7 +197,6 @@ integrity_algorithm_t hasher_algorithm_to_integrity(hash_algorithm_t alg,
|
||||
}
|
||||
break;
|
||||
case HASH_SHA1:
|
||||
case HASH_PREFERRED:
|
||||
switch (length)
|
||||
{
|
||||
case 12:
|
||||
|
||||
@@ -37,16 +37,14 @@ typedef struct hasher_t hasher_t;
|
||||
enum hash_algorithm_t {
|
||||
/** not specified hash function */
|
||||
HASH_UNKNOWN = 0,
|
||||
/** preferred hash function, general purpose */
|
||||
HASH_PREFERRED = 1,
|
||||
HASH_MD2 = 2,
|
||||
HASH_MD4 = 3,
|
||||
HASH_MD5 = 4,
|
||||
HASH_SHA1 = 5,
|
||||
HASH_SHA224 = 6,
|
||||
HASH_SHA256 = 7,
|
||||
HASH_SHA384 = 8,
|
||||
HASH_SHA512 = 9
|
||||
HASH_MD2 = 1,
|
||||
HASH_MD4 = 2,
|
||||
HASH_MD5 = 3,
|
||||
HASH_SHA1 = 4,
|
||||
HASH_SHA224 = 5,
|
||||
HASH_SHA256 = 6,
|
||||
HASH_SHA384 = 7,
|
||||
HASH_SHA512 = 8
|
||||
};
|
||||
|
||||
#define HASH_SIZE_MD2 16
|
||||
|
||||
@@ -47,13 +47,13 @@ static struct {
|
||||
char *name;
|
||||
size_t size;
|
||||
} algs[AF_ALG_HASHER] = {
|
||||
{HASH_SHA1, "sha1", HASH_SIZE_SHA1 },
|
||||
{HASH_MD4, "md4", HASH_SIZE_MD4 },
|
||||
{HASH_MD5, "md5", HASH_SIZE_MD5 },
|
||||
{HASH_SHA1, "sha1", HASH_SIZE_SHA1 },
|
||||
{HASH_SHA224, "sha224", HASH_SIZE_SHA224 },
|
||||
{HASH_SHA256, "sha256", HASH_SIZE_SHA256 },
|
||||
{HASH_SHA384, "sha384", HASH_SIZE_SHA384 },
|
||||
{HASH_SHA512, "sha512", HASH_SIZE_SHA512 },
|
||||
{HASH_MD4, "md4", HASH_SIZE_MD4 },
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -132,9 +132,9 @@ METHOD(plugin_t, get_features, int,
|
||||
PLUGIN_PROVIDE(CRYPTER, ENCR_TWOFISH_CBC, 32),
|
||||
/* hashers */
|
||||
PLUGIN_REGISTER(HASHER, gcrypt_hasher_create),
|
||||
PLUGIN_PROVIDE(HASHER, HASH_SHA1),
|
||||
PLUGIN_PROVIDE(HASHER, HASH_MD4),
|
||||
PLUGIN_PROVIDE(HASHER, HASH_MD5),
|
||||
PLUGIN_PROVIDE(HASHER, HASH_SHA1),
|
||||
PLUGIN_PROVIDE(HASHER, HASH_SHA224),
|
||||
PLUGIN_PROVIDE(HASHER, HASH_SHA256),
|
||||
PLUGIN_PROVIDE(HASHER, HASH_SHA384),
|
||||
|
||||
@@ -298,9 +298,6 @@ METHOD(plugin_t, get_features, int,
|
||||
PLUGIN_PROVIDE(CRYPTER, ENCR_NULL, 0),
|
||||
/* hashers */
|
||||
PLUGIN_REGISTER(HASHER, openssl_hasher_create),
|
||||
#ifndef OPENSSL_NO_SHA1
|
||||
PLUGIN_PROVIDE(HASHER, HASH_SHA1),
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_MD2
|
||||
PLUGIN_PROVIDE(HASHER, HASH_MD2),
|
||||
#endif
|
||||
@@ -310,6 +307,9 @@ METHOD(plugin_t, get_features, int,
|
||||
#ifndef OPENSSL_NO_MD5
|
||||
PLUGIN_PROVIDE(HASHER, HASH_MD5),
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SHA1
|
||||
PLUGIN_PROVIDE(HASHER, HASH_SHA1),
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SHA256
|
||||
PLUGIN_PROVIDE(HASHER, HASH_SHA224),
|
||||
PLUGIN_PROVIDE(HASHER, HASH_SHA256),
|
||||
|
||||
Reference in New Issue
Block a user