From: Jay Zhou Date: Tue, 17 Apr 2018 09:23:24 +0000 (+0800) Subject: crypto/virtio: support HMAC-SHA1 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=8144eada328029a42cf2be979cf264f4ba0b6651;p=dpdk.git crypto/virtio: support HMAC-SHA1 The AES-CBC with HMAC-SHA1 has been supported now. Signed-off-by: Jay Zhou Reviewed-by: Fan Zhang --- diff --git a/drivers/crypto/virtio/virtio_crypto_capabilities.h b/drivers/crypto/virtio/virtio_crypto_capabilities.h index db6932f961..03c30deefd 100644 --- a/drivers/crypto/virtio/virtio_crypto_capabilities.h +++ b/drivers/crypto/virtio/virtio_crypto_capabilities.h @@ -6,6 +6,27 @@ #define _VIRTIO_CRYPTO_CAPABILITIES_H_ #define VIRTIO_SYM_CAPABILITIES \ + { /* SHA1 HMAC */ \ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, \ + {.sym = { \ + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, \ + {.auth = { \ + .algo = RTE_CRYPTO_AUTH_SHA1_HMAC, \ + .block_size = 64, \ + .key_size = { \ + .min = 1, \ + .max = 64, \ + .increment = 1 \ + }, \ + .digest_size = { \ + .min = 1, \ + .max = 20, \ + .increment = 1 \ + }, \ + .iv_size = { 0 } \ + }, } \ + }, } \ + }, \ { /* AES CBC */ \ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, \ {.sym = { \ diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c index f924b049dc..df88953f6a 100644 --- a/drivers/crypto/virtio/virtio_cryptodev.c +++ b/drivers/crypto/virtio/virtio_cryptodev.c @@ -1196,11 +1196,13 @@ virtio_crypto_sym_pad_auth_param( } switch (auth_xform->algo) { + case RTE_CRYPTO_AUTH_SHA1_HMAC: + *algo = VIRTIO_CRYPTO_MAC_HMAC_SHA1; + break; default: VIRTIO_CRYPTO_SESSION_LOG_ERR( "Crypto: Undefined Hash algo %u specified", auth_xform->algo); - *algo = VIRTIO_CRYPTO_NO_MAC; return -1; }