From patchwork Tue Apr 17 09:23:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhoujian (jay)" X-Patchwork-Id: 38292 X-Patchwork-Delegate: pablo.de.lara.guarch@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0715DAADC; Tue, 17 Apr 2018 11:24:09 +0200 (CEST) Received: from huawei.com (unknown [45.249.212.35]) by dpdk.org (Postfix) with ESMTP id 78B6FAAC8 for ; Tue, 17 Apr 2018 11:23:53 +0200 (CEST) Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id F16816007A1E3; Tue, 17 Apr 2018 17:23:47 +0800 (CST) Received: from localhost (10.177.19.14) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.361.1; Tue, 17 Apr 2018 17:23:42 +0800 From: Jay Zhou To: CC: , , , , , , , , Date: Tue, 17 Apr 2018 17:23:24 +0800 Message-ID: X-Mailer: git-send-email 2.6.1.windows.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.177.19.14] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v11 08/10] crypto/virtio: support HMAC-SHA1 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The AES-CBC with HMAC-SHA1 has been supported now. Signed-off-by: Jay Zhou Reviewed-by: Fan Zhang Acked-by: Fan Zhang --- 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; }