diff mbox series

[4/4] linux-generic: crypto: add HMAC-SHA-512 authentication support

Message ID 1493758812-21347-4-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [1/4] validation: crypto: add HMAC-SHA-1-96 test cases | expand

Commit Message

Github ODP bot May 2, 2017, 9 p.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 10 (lumag:crypto-update)
 ** https://github.com/Linaro/odp/pull/10
 ** Patch: https://github.com/Linaro/odp/pull/10.patch
 ** Base sha: 0b1dbf37b4030c6da4c6f13645c63fd4ac8ff923
 ** Merge commit sha: 72489ef29ea4586f487b1c806cf37fab63272c7a
 **/
 platform/linux-generic/odp_crypto.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
index 79e582e..f537828 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -60,6 +60,9 @@  static const odp_crypto_auth_capability_t auth_capa_sha1_hmac[] = {
 static const odp_crypto_auth_capability_t auth_capa_sha256_hmac[] = {
 {.digest_len = 16, .key_len = 32, .aad_len = {.min = 0, .max = 0, .inc = 0} } };
 
+static const odp_crypto_auth_capability_t auth_capa_sha512_hmac[] = {
+{.digest_len = 32, .key_len = 64, .aad_len = {.min = 0, .max = 0, .inc = 0} } };
+
 static const odp_crypto_auth_capability_t auth_capa_aes_gcm[] = {
 {.digest_len = 16, .key_len = 0, .aad_len = {.min = 8, .max = 12, .inc = 4} } };
 
@@ -566,7 +569,7 @@  int odp_crypto_capability(odp_crypto_capability_t *capa)
 	capa->auths.bit.md5_hmac     = 1;
 	capa->auths.bit.sha1_hmac    = 1;
 	capa->auths.bit.sha256_hmac  = 1;
-	capa->auths.bit.sha512_hmac  = 0;
+	capa->auths.bit.sha512_hmac  = 1;
 	capa->auths.bit.aes_gcm      = 1;
 
 	/* Deprecated */
@@ -646,6 +649,10 @@  int odp_crypto_auth_capability(odp_auth_alg_t auth,
 		src = auth_capa_sha256_hmac;
 		num = sizeof(auth_capa_sha256_hmac) / size;
 		break;
+	case ODP_AUTH_ALG_SHA512_HMAC:
+		src = auth_capa_sha512_hmac;
+		num = sizeof(auth_capa_sha512_hmac) / size;
+		break;
 	case ODP_AUTH_ALG_AES_GCM:
 		src = auth_capa_aes_gcm;
 		num = sizeof(auth_capa_aes_gcm) / size;
@@ -755,6 +762,9 @@  odp_crypto_session_create(odp_crypto_session_param_t *param,
 	case ODP_AUTH_ALG_SHA256_128:
 		rc = process_auth_param(session, 128, 32, EVP_sha256());
 		break;
+	case ODP_AUTH_ALG_SHA512_HMAC:
+		rc = process_auth_param(session, 256, 64, EVP_sha512());
+		break;
 	case ODP_AUTH_ALG_AES_GCM:
 	     /* deprecated */
 	case ODP_AUTH_ALG_AES128_GCM: