From patchwork Tue Oct 2 20:00:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Eremin-Solenikov X-Patchwork-Id: 148014 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp5574723lji; Tue, 2 Oct 2018 13:00:11 -0700 (PDT) X-Google-Smtp-Source: ACcGV63O5f7kWvOPY8kQRKLPcfd1kx7ewpQoxLmgf7u0EamJMKYnBsnFJmBa/M2bpxwB5yBClgHU X-Received: by 2002:a50:9806:: with SMTP id g6-v6mr25644034edb.235.1538510411895; Tue, 02 Oct 2018 13:00:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538510411; cv=none; d=google.com; s=arc-20160816; b=B82b0hMGT/KjqLoHn8xO5n+QE/PAnuX4C4t/+UHu0bJc/+R7clDsDfV9UkAcwszNTF Nrt/yY+XAHF5HikmkWcDbesD6rvDnD2thOT/8rg0r0jzATsTJIw/GqoZ1TqVE73Dt5kp 2xusPaJCuD1V82mWnS/X5wDV2nw50916WCR4g7NxB5HGPKAxpt6h+NB/LM0sym4uNFjX /COF1kIFuk6lR4Bzg+tt4cLcCizA+6kUDOW+V39CsZm5c3T2dygQbAz9opOwb2tkz86X XM484cOqZ3r2Knv+saZFGdsODacFAsfIUeaQ+nR5SoEFEPQ8FQKKqWasyXFO9wgQz5NJ n7ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:message-id:date:to:from :dkim-signature; bh=J5mdKItqB62ZHF99rmppBH1UXMdtVIb4HUCxJ8ochOY=; b=iyY6lcO+t/MC47V88e1He6jumZnWCKcH1tX2xAte2xUOtTYx1hxxfzvZJdE4L7YDvG 66ltTLbghSBbluifjTnaFS4sjdzSnbj21YZQT8mg4E3vRxO1W4b1dm4ptMduOl3JvGqo OoStYg1Hm5/0t5KeCBL9KZjJH4U4E2L6T7DNrgQLNbSQXTd+bNhNAE7lTZz0TTtopsoC TNzgQbWynVYQlBsnR6a9GdpdD5oonsfuP4whdqOFPzAfJwTBMBp2ve2b84hBX6LLqcVM farkDxT9NSoC4Cmi+VZobDjc/3u41iPJTUGHx6nZqqEEANp0yPCSvwLoE/WerbL6CA5D 5mcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ro1FpksH; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id o10-v6si378869edt.64.2018.10.02.13.00.11; Tue, 02 Oct 2018 13:00:11 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ro1FpksH; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4B0C1532C; Tue, 2 Oct 2018 22:00:10 +0200 (CEST) Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by dpdk.org (Postfix) with ESMTP id 2F60F4F94 for ; Tue, 2 Oct 2018 22:00:09 +0200 (CEST) Received: by mail-lj1-f196.google.com with SMTP id p89-v6so2941489ljb.3 for ; Tue, 02 Oct 2018 13:00:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=J5mdKItqB62ZHF99rmppBH1UXMdtVIb4HUCxJ8ochOY=; b=Ro1FpksHOoH/QrFaQwuCB4SwJCEhlAtMZtJeT6v6QiaJVXTDpxhS/vvPLwcbBxV40S cg2g1KbwXgz05zafNIpb7eEU2sUl520hgOz4s5b+g6DlZ7ZgXb3qSCYOwqEYlFtozy0P VL5GTbFkNwtmRT0CZAzq3UTapZ8Pn0ujozZBk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=J5mdKItqB62ZHF99rmppBH1UXMdtVIb4HUCxJ8ochOY=; b=cVbgZFZYkRX6h21Ro5VA14FzmSpLrIH9nUl0ctoXzhMSLeNUI4SxFF4/+wH/OpZO/4 L3P0O/HgmKujq1c6LmuMpS4RbYCY3dWzeh7VKvtwyDMvDLZc9QdDMGu96beN7pkv0dsb CVwk1blA9o++fWP6tZuDfaPJ0Z7sKZvLHhdRhOsWRkimmpKQLtTvEq+AqQWBEnslmYmm Z0+uXD2OTLXK1i9jtfLNEZPqKvJXAiNEAq9uKBtb5P7uo4K6J2ESmOQCGzgazsYlhKF0 pWuN0JHJf0utMGURjwEk9pGvmdlTjMEQ0qdZvfGVn+gFDBwFKDwT/JhF1kZM4ctIq4p9 PFNQ== X-Gm-Message-State: ABuFfohJ4kOe/3TSfoZxeMSvK6GVe5VPPZqEU7GUUtPGbFPjqlzGlZz2 iEujD5eN1PPFumQKiKgjHg5CPxdwd+abNA== X-Received: by 2002:a2e:6353:: with SMTP id x80-v6mr10038485ljb.11.1538510408246; Tue, 02 Oct 2018 13:00:08 -0700 (PDT) Received: from rhovanion.lumag.spb.ru ([188.162.64.65]) by smtp.gmail.com with ESMTPSA id q75-v6sm3389375lfq.95.2018.10.02.13.00.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Oct 2018 13:00:06 -0700 (PDT) From: Dmitry Eremin-Solenikov To: dev@dpdk.org Date: Tue, 2 Oct 2018 23:00:03 +0300 Message-Id: <20181002200003.10571-1-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3] crypto/openssl: support truncated HMAC operations 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" IPsec requires truncated HMAC operations support. Extend OpenSSL crypto PMD to support truncated HMAC operations necessary for IPsec. Signed-off-by: Dmitry Eremin-Solenikov --- Changes since V2: - support all digest sizes from 1 up to full digest length. drivers/crypto/openssl/rte_openssl_pmd.c | 19 ++++++------- drivers/crypto/openssl/rte_openssl_pmd_ops.c | 28 ++++++++++---------- 2 files changed, 24 insertions(+), 23 deletions(-) -- 2.19.0 Acked-by: Akhil Goyal diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index 7d263aba3bbd..c635f1e2493c 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -1509,15 +1509,7 @@ process_openssl_auth_op(struct openssl_qp *qp, struct rte_crypto_op *op, srclen = op->sym->auth.data.length; - if (sess->auth.operation == RTE_CRYPTO_AUTH_OP_VERIFY) - dst = qp->temp_digest; - else { - dst = op->sym->auth.digest.data; - if (dst == NULL) - dst = rte_pktmbuf_mtod_offset(mbuf_dst, uint8_t *, - op->sym->auth.data.offset + - op->sym->auth.data.length); - } + dst = qp->temp_digest; switch (sess->auth.mode) { case OPENSSL_AUTH_AS_AUTH: @@ -1540,6 +1532,15 @@ process_openssl_auth_op(struct openssl_qp *qp, struct rte_crypto_op *op, sess->auth.digest_length) != 0) { op->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED; } + } else { + uint8_t *auth_dst; + + auth_dst = op->sym->auth.digest.data; + if (auth_dst == NULL) + auth_dst = rte_pktmbuf_mtod_offset(mbuf_dst, uint8_t *, + op->sym->auth.data.offset + + op->sym->auth.data.length); + memcpy(auth_dst, dst, sess->auth.digest_length); } if (status != 0) diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c index de2284390b12..4c260e93db3a 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c +++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c @@ -26,9 +26,9 @@ static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = { .increment = 1 }, .digest_size = { - .min = 16, + .min = 1, .max = 16, - .increment = 0 + .increment = 1 }, .iv_size = { 0 } }, } @@ -68,9 +68,9 @@ static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = { .increment = 1 }, .digest_size = { - .min = 20, + .min = 1, .max = 20, - .increment = 0 + .increment = 1 }, .iv_size = { 0 } }, } @@ -110,9 +110,9 @@ static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = { .increment = 1 }, .digest_size = { - .min = 28, + .min = 1, .max = 28, - .increment = 0 + .increment = 1 }, .iv_size = { 0 } }, } @@ -131,9 +131,9 @@ static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = { .increment = 0 }, .digest_size = { - .min = 28, + .min = 1, .max = 28, - .increment = 0 + .increment = 1 }, .iv_size = { 0 } }, } @@ -152,9 +152,9 @@ static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = { .increment = 1 }, .digest_size = { - .min = 32, + .min = 1, .max = 32, - .increment = 0 + .increment = 1 }, .iv_size = { 0 } }, } @@ -194,9 +194,9 @@ static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = { .increment = 1 }, .digest_size = { - .min = 48, + .min = 1, .max = 48, - .increment = 0 + .increment = 1 }, .iv_size = { 0 } }, } @@ -236,9 +236,9 @@ static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = { .increment = 1 }, .digest_size = { - .min = 64, + .min = 1, .max = 64, - .increment = 0 + .increment = 1 }, .iv_size = { 0 } }, }