aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/crypto/prfs
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2007-03-08 00:14:17 +0000
committerMartin Willi <martin@strongswan.org>2007-03-08 00:14:17 +0000
commit3243e90188094c9d763fa88cd4a8152457e632ca (patch)
tree50f7bbd5120ad18e178660767710ff1c5c20b3ab /src/libstrongswan/crypto/prfs
parent40695383aeab77a3294e85fa8d3a59759d1770df (diff)
downloadstrongswan-3243e90188094c9d763fa88cd4a8152457e632ca.tar.bz2
strongswan-3243e90188094c9d763fa88cd4a8152457e632ca.tar.xz
experimental SHA2 HMAC and PRF implementations
Diffstat (limited to 'src/libstrongswan/crypto/prfs')
-rw-r--r--src/libstrongswan/crypto/prfs/prf.c15
-rw-r--r--src/libstrongswan/crypto/prfs/prf.h6
2 files changed, 18 insertions, 3 deletions
diff --git a/src/libstrongswan/crypto/prfs/prf.c b/src/libstrongswan/crypto/prfs/prf.c
index f3b05ea00..f803829af 100644
--- a/src/libstrongswan/crypto/prfs/prf.c
+++ b/src/libstrongswan/crypto/prfs/prf.c
@@ -32,12 +32,15 @@ ENUM_BEGIN(pseudo_random_function_names, PRF_UNDEFINED, PRF_FIPS_DES,
"PRF_UNDEFINED",
"PRF_FIPS_SHA1_160",
"PRF_FIPS_DES");
-ENUM_NEXT(pseudo_random_function_names, PRF_HMAC_MD5, PRF_AES128_CBC, PRF_FIPS_DES,
+ENUM_NEXT(pseudo_random_function_names, PRF_HMAC_MD5, PRF_HMAC_SHA2_512, PRF_FIPS_DES,
"PRF_HMAC_MD5",
"PRF_HMAC_SHA1",
"PRF_HMAC_TIGER",
- "PRF_AES128_CBC");
-ENUM_END(pseudo_random_function_names, PRF_AES128_CBC);
+ "PRF_AES128_CBC",
+ "PRF_HMAC_SHA2_256",
+ "PRF_HMAC_SHA2_384",
+ "PRF_HMAC_SHA2_512");
+ENUM_END(pseudo_random_function_names, PRF_HMAC_SHA2_512);
/*
* Described in header.
@@ -50,6 +53,12 @@ prf_t *prf_create(pseudo_random_function_t pseudo_random_function)
return (prf_t*)hmac_prf_create(HASH_SHA1);
case PRF_HMAC_MD5:
return (prf_t*)hmac_prf_create(HASH_MD5);
+ case PRF_HMAC_SHA2_256:
+ return (prf_t*)hmac_prf_create(HASH_SHA256);
+ case PRF_HMAC_SHA2_384:
+ return (prf_t*)hmac_prf_create(HASH_SHA384);
+ case PRF_HMAC_SHA2_512:
+ return (prf_t*)hmac_prf_create(HASH_SHA512);
case PRF_FIPS_SHA1_160:
return (prf_t*)fips_prf_create(20, g_sha1);
case PRF_FIPS_DES:
diff --git a/src/libstrongswan/crypto/prfs/prf.h b/src/libstrongswan/crypto/prfs/prf.h
index 7a4501866..8560a4a9c 100644
--- a/src/libstrongswan/crypto/prfs/prf.h
+++ b/src/libstrongswan/crypto/prfs/prf.h
@@ -45,6 +45,12 @@ enum pseudo_random_function_t {
PRF_HMAC_SHA1 = 2,
PRF_HMAC_TIGER = 3,
PRF_AES128_CBC = 4,
+ /** Implemented via hmac_prf_t. */
+ PRF_HMAC_SHA2_256 = 5,
+ /** Implemented via hmac_prf_t. */
+ PRF_HMAC_SHA2_384 = 6,
+ /** Implemented via hmac_prf_t. */
+ PRF_HMAC_SHA2_512 = 7,
/** Implemented via fips_prf_t, other output sizes would be possible */
PRF_FIPS_SHA1_160 = 1025,
/** Could be implemented via fips_prf_t, uses fixed output size of 160bit */