Added support for AUTH_HMAC_SHA2_256_256, used in TLS

This commit is contained in:
Martin Willi
2010-08-03 15:39:24 +02:00
parent 4c0c2283a5
commit 9dc73cd21c
3 changed files with 9 additions and 3 deletions
+4 -3
View File
@@ -16,11 +16,12 @@
#include "signer.h" #include "signer.h"
ENUM_BEGIN(integrity_algorithm_names, AUTH_UNDEFINED, AUTH_HMAC_SHA2_256_96, ENUM_BEGIN(integrity_algorithm_names, AUTH_UNDEFINED, AUTH_HMAC_SHA2_256_256,
"UNDEFINED", "UNDEFINED",
"HMAC_SHA1_128", "HMAC_SHA1_128",
"HMAC_SHA2_256_96"); "HMAC_SHA2_256_96",
ENUM_NEXT(integrity_algorithm_names, AUTH_HMAC_MD5_96, AUTH_HMAC_SHA2_512_256, AUTH_HMAC_SHA2_256_96, "HMAC_SHA2_256_256");
ENUM_NEXT(integrity_algorithm_names, AUTH_HMAC_MD5_96, AUTH_HMAC_SHA2_512_256, AUTH_HMAC_SHA2_256_256,
"HMAC_MD5_96", "HMAC_MD5_96",
"HMAC_SHA1_96", "HMAC_SHA1_96",
"DES_MAC", "DES_MAC",
@@ -66,6 +66,8 @@ enum integrity_algorithm_t {
AUTH_HMAC_SHA1_128 = 1025, AUTH_HMAC_SHA1_128 = 1025,
/** SHA256 96 bit truncation variant, supported by Linux kernels */ /** SHA256 96 bit truncation variant, supported by Linux kernels */
AUTH_HMAC_SHA2_256_96 = 1026, AUTH_HMAC_SHA2_256_96 = 1026,
/** SHA256 full length tuncation variant, as used in TLS */
AUTH_HMAC_SHA2_256_256 = 1027,
}; };
/** /**
@@ -177,6 +177,9 @@ hmac_signer_t *hmac_signer_create(integrity_algorithm_t algo)
hash = HASH_SHA512; hash = HASH_SHA512;
trunc = 32; trunc = 32;
break; break;
case AUTH_HMAC_SHA2_256_256:
hash = HASH_SHA256;
trunc = 32;
default: default:
return NULL; return NULL;
} }