[dpdk-dev] [PATCH v9 08/11] crypto/virtio: support HMAC-SHA1
Jay Zhou
jianjay.zhou at huawei.com
Sun Apr 15 10:51:25 CEST 2018
The AES-CBC with HMAC-SHA1 has been supported now.
Signed-off-by: Jay Zhou <jianjay.zhou at huawei.com>
Reviewed-by: Fan Zhang <roy.fan.zhang at intel.com>
Acked-by: Fan Zhang <roy.fan.zhang at intel.com>
---
drivers/crypto/virtio/virtio_crypto_capabilities.h | 21 +++++++++++++++++++++
drivers/crypto/virtio/virtio_cryptodev.c | 4 +++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/virtio/virtio_crypto_capabilities.h b/drivers/crypto/virtio/virtio_crypto_capabilities.h
index db6932f..03c30de 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 f924b04..df88953 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -1196,11 +1196,13 @@ static int virtio_crypto_sym_configure_session(struct rte_cryptodev *dev,
}
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;
}
--
1.8.3.1
More information about the dev
mailing list