From: "Trahe, Fiona" <fiona.trahe@intel.com>
To: "Kusztal, ArkadiuszX" <arkadiuszx.kusztal@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>
Cc: "akhil.goyal@nxp.com" <akhil.goyal@nxp.com>,
"Doherty, Declan" <declan.doherty@intel.com>,
"Trahe, Fiona" <fiona.trahe@intel.com>
Subject: Re: [dpdk-dev] [PATCH] crypto/openssl: fix usage of non constant time memcmp for mac and signature
Date: Fri, 31 May 2019 14:53:30 +0000 [thread overview]
Message-ID: <348A99DA5F5B7549AA880327E580B43589778706@IRSMSX101.ger.corp.intel.com> (raw)
In-Reply-To: <20190531065928.3420-2-arkadiuszx.kusztal@intel.com>
> -----Original Message-----
> From: Kusztal, ArkadiuszX
> Sent: Friday, May 31, 2019 7:59 AM
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com; Trahe, Fiona <fiona.trahe@intel.com>; Doherty, Declan
> <declan.doherty@intel.com>; Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>
> Subject: [PATCH] crypto/openssl: fix usage of non constant time memcmp for mac and signature
>
> ANSI C memcmp is not constant time function per spec so it should
> be avoided in cryptography usage.
>
> Fixes: d61f70b4c918 ("crypto/libcrypto: add driver for OpenSSL library")
>
> Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
> ---
> drivers/crypto/openssl/rte_openssl_pmd.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
> index 6504959..73ce383 100644
> --- a/drivers/crypto/openssl/rte_openssl_pmd.c
> +++ b/drivers/crypto/openssl/rte_openssl_pmd.c
> @@ -1529,7 +1529,7 @@ process_openssl_auth_op(struct openssl_qp *qp, struct rte_crypto_op *op,
> }
>
> if (sess->auth.operation == RTE_CRYPTO_AUTH_OP_VERIFY) {
> - if (memcmp(dst, op->sym->auth.digest.data,
> + if (CRYPTO_memcmp(dst, op->sym->auth.digest.data,
> sess->auth.digest_length) != 0) {
> op->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED;
> }
> @@ -1914,7 +1914,7 @@ process_openssl_rsa_op(struct rte_crypto_op *cop,
> "Length of public_decrypt %d "
> "length of message %zd\n",
> ret, op->rsa.message.length);
> - if ((ret <= 0) || (memcmp(tmp, op->rsa.message.data,
> + if ((ret <= 0) || (CRYPTO_memcmp(tmp, op->rsa.message.data,
> op->rsa.message.length))) {
> OPENSSL_LOG(ERR, "RSA sign Verification failed");
> cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
> --
> 2.1.0
Hadn't heard of that time const fn before so just read up on it - interesting.
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
next prev parent reply other threads:[~2019-05-31 14:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-31 6:59 [dpdk-dev] [PATCH] crypto/openssl: fix inproper freeing of asymmetric crypto keys in rsa Arek Kusztal
2019-05-31 6:59 ` [dpdk-dev] [PATCH] crypto/openssl: fix usage of non constant time memcmp for mac and signature Arek Kusztal
2019-05-31 14:53 ` Trahe, Fiona [this message]
2019-06-19 14:48 ` Akhil Goyal
2019-06-18 12:59 ` [dpdk-dev] [PATCH] crypto/openssl: fix inproper freeing of asymmetric crypto keys in rsa Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=348A99DA5F5B7549AA880327E580B43589778706@IRSMSX101.ger.corp.intel.com \
--to=fiona.trahe@intel.com \
--cc=akhil.goyal@nxp.com \
--cc=arkadiuszx.kusztal@intel.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).