From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by dpdk.org (Postfix) with ESMTP id AC13C2B84 for ; Sun, 16 Sep 2018 05:18:26 +0200 (CEST) Received: by mail-lj1-f196.google.com with SMTP id v9-v6so10409303ljk.4 for ; Sat, 15 Sep 2018 20:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=2Kk+Jvfz1ZJxM5CTSQc/tuOkgyBoNd5m/ArBi5fF1ko=; b=L2ftE/+odtgWJ95SseLF8zhM/Wv+q1HcHJuthTNkWjNd5nOFhvSa710tf0nPSb6xIP ovwezhEFm3iMW/uYYDBRcr661bdma9Q15oP8jX3/PFg90mR1AUTiMnNoG5Rd9RBlorEV 95XZ4xE8Tq8AkDSiJpz1naBgsBgMsUjcGjI04= 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; bh=2Kk+Jvfz1ZJxM5CTSQc/tuOkgyBoNd5m/ArBi5fF1ko=; b=AC9LpMREXr1RNddOPRmm/gZLqm039/pvbCvk37SdRBX8YYl20xSJXLZ2N/vNJtkJzN cLmtjfAR5Wn75U9N+hvhfTEKjNeHmGa3lrYjM4QT90qwsxfaRWPQlf0dcQ121/xmOjut PsDAEKn7qDevrRzaa0cR5ysxdauxfTe7cDf1UqgERDNgKPwg3Qi6Cc3VzPbX62OIM9rr dNE1+monrmvcOw/tjG/G7+g/oBru+8xkPT+/LWpvSaPqaRqPnymnWKmXpkRXa2eufy8X +S2jdlScUA4oZMA0ig/CVHGzdR8Jkws+sz9rswCy267o/si5iXHErItd4kwwzw/cDZ2i nHzQ== X-Gm-Message-State: APzg51B1+X3hX0jG5yQlUMiizlw/ldZ7rBwTigGzbd85ZEt2UVwwwCy5 N9F7kMPKQnvXdheUCQSvT9ys5LRKsv0rsA== X-Google-Smtp-Source: ANB0VdYaCJ7EuB7FTcUMWCHW2Z8OQ4ka3I3WGasFCXVeGfaBOJWc8RnsFV7SNNv4eb7PEK9yrix0Pw== X-Received: by 2002:a2e:860d:: with SMTP id a13-v6mr12176720lji.43.1537067905689; Sat, 15 Sep 2018 20:18:25 -0700 (PDT) Received: from rhovanion.lumag.spb.ru ([188.162.65.197]) by smtp.gmail.com with ESMTPSA id 135-v6sm2063490ljj.35.2018.09.15.20.18.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Sep 2018 20:18:24 -0700 (PDT) From: Dmitry Eremin-Solenikov To: dev@dpdk.org Date: Sun, 16 Sep 2018 06:18:23 +0300 Message-Id: <20180916031823.17560-1-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.18.0 Subject: [dpdk-dev] [PATCH v2] 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: , X-List-Received-Date: Sun, 16 Sep 2018 03:18:26 -0000 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 V1: - support all digest sizes from half of corresponding digest size up to full length. --- drivers/crypto/openssl/rte_openssl_pmd.c | 19 ++++++++-------- drivers/crypto/openssl/rte_openssl_pmd_ops.c | 24 ++++++++++---------- 2 files changed, 22 insertions(+), 21 deletions(-) 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..6d3e21de404d 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 = 8, .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 = 10, .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 = 14, .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 = 16, .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 = 24, .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 = 32, .max = 64, - .increment = 0 + .increment = 1 }, .iv_size = { 0 } }, } -- 2.18.0