summaryrefslogtreecommitdiff
path: root/src/libstrongswan/crypto/hashers/hasher.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@corsac.net>2017-04-01 16:26:44 +0200
committerYves-Alexis Perez <corsac@corsac.net>2017-04-01 16:26:44 +0200
commit05ddd767992d68bb38c7f16ece142e8c2e9ae016 (patch)
tree302c618be306d4ed3c7f9fc58a1f6aaad4dd252f /src/libstrongswan/crypto/hashers/hasher.c
parent25663e04c3ab01ef8dc9f906608282319cfea2db (diff)
downloadvyos-strongswan-05ddd767992d68bb38c7f16ece142e8c2e9ae016.tar.gz
vyos-strongswan-05ddd767992d68bb38c7f16ece142e8c2e9ae016.zip
New upstream version 5.5.2
Diffstat (limited to 'src/libstrongswan/crypto/hashers/hasher.c')
-rw-r--r--src/libstrongswan/crypto/hashers/hasher.c40
1 files changed, 33 insertions, 7 deletions
diff --git a/src/libstrongswan/crypto/hashers/hasher.c b/src/libstrongswan/crypto/hashers/hasher.c
index d136799d7..26aab0ccc 100644
--- a/src/libstrongswan/crypto/hashers/hasher.c
+++ b/src/libstrongswan/crypto/hashers/hasher.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2012-2015 Tobias Brunner
- * Copyright (C) 2015-2016 Andreas Steffen
+ * Copyright (C) 2015-2017 Andreas Steffen
* Copyright (C) 2005-2006 Martin Willi
* Copyright (C) 2005 Jan Hutter
* HSR Hochschule fuer Technik Rapperswil
@@ -20,12 +20,13 @@
#include <asn1/oid.h>
-ENUM_BEGIN(hash_algorithm_names, HASH_SHA1, HASH_SHA512,
+ENUM_BEGIN(hash_algorithm_names, HASH_SHA1, HASH_IDENTITY,
"HASH_SHA1",
"HASH_SHA256",
"HASH_SHA384",
- "HASH_SHA512");
-ENUM_NEXT(hash_algorithm_names, HASH_UNKNOWN, HASH_SHA3_512, HASH_SHA512,
+ "HASH_SHA512",
+ "HASH_IDENTITY");
+ENUM_NEXT(hash_algorithm_names, HASH_UNKNOWN, HASH_SHA3_512, HASH_IDENTITY,
"HASH_UNKNOWN",
"HASH_MD2",
"HASH_MD4",
@@ -37,12 +38,13 @@ ENUM_NEXT(hash_algorithm_names, HASH_UNKNOWN, HASH_SHA3_512, HASH_SHA512,
"HASH_SHA3_512");
ENUM_END(hash_algorithm_names, HASH_SHA3_512);
-ENUM_BEGIN(hash_algorithm_short_names, HASH_SHA1, HASH_SHA512,
+ENUM_BEGIN(hash_algorithm_short_names, HASH_SHA1, HASH_IDENTITY,
"sha1",
"sha256",
"sha384",
- "sha512");
-ENUM_NEXT(hash_algorithm_short_names, HASH_UNKNOWN, HASH_SHA3_512, HASH_SHA512,
+ "sha512",
+ "identity");
+ENUM_NEXT(hash_algorithm_short_names, HASH_UNKNOWN, HASH_SHA3_512, HASH_IDENTITY,
"unknown",
"md2",
"md4",
@@ -94,6 +96,9 @@ hash_algorithm_t hasher_algorithm_from_oid(int oid)
case OID_SHA3_512:
case OID_RSASSA_PKCS1V15_WITH_SHA3_512:
return HASH_SHA3_512;
+ case OID_ED25519:
+ case OID_ED448:
+ return HASH_IDENTITY;
default:
return HASH_UNKNOWN;
}
@@ -267,6 +272,7 @@ integrity_algorithm_t hasher_algorithm_to_integrity(hash_algorithm_t alg,
case HASH_SHA3_256:
case HASH_SHA3_384:
case HASH_SHA3_512:
+ case HASH_IDENTITY:
case HASH_UNKNOWN:
break;
}
@@ -280,6 +286,7 @@ bool hasher_algorithm_for_ikev2(hash_algorithm_t alg)
{
switch (alg)
{
+ case HASH_IDENTITY:
case HASH_SHA1:
case HASH_SHA256:
case HASH_SHA384:
@@ -396,6 +403,22 @@ int hasher_signature_algorithm_to_oid(hash_algorithm_t alg, key_type_t key)
default:
return OID_UNKNOWN;
}
+ case KEY_ED25519:
+ switch (alg)
+ {
+ case HASH_IDENTITY:
+ return OID_ED25519;
+ default:
+ return OID_UNKNOWN;
+ }
+ case KEY_ED448:
+ switch (alg)
+ {
+ case HASH_IDENTITY:
+ return OID_ED448;
+ default:
+ return OID_UNKNOWN;
+ }
case KEY_BLISS:
switch (alg)
{
@@ -430,6 +453,9 @@ hash_algorithm_t hasher_from_signature_scheme(signature_scheme_t scheme)
case SIGN_RSA_EMSA_PKCS1_NULL:
case SIGN_ECDSA_WITH_NULL:
break;
+ case SIGN_ED25519:
+ case SIGN_ED448:
+ return HASH_IDENTITY;
case SIGN_RSA_EMSA_PKCS1_MD5:
return HASH_MD5;
case SIGN_RSA_EMSA_PKCS1_SHA1: