From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 6F03DA045E for ; Fri, 31 May 2019 16:53:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 739001B94E; Fri, 31 May 2019 16:53:35 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 163CE2C55 for ; Fri, 31 May 2019 16:53:33 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 May 2019 07:53:33 -0700 X-ExtLoop1: 1 Received: from irsmsx108.ger.corp.intel.com ([163.33.3.3]) by orsmga008.jf.intel.com with ESMTP; 31 May 2019 07:53:32 -0700 Received: from irsmsx101.ger.corp.intel.com ([169.254.1.10]) by IRSMSX108.ger.corp.intel.com ([169.254.11.19]) with mapi id 14.03.0415.000; Fri, 31 May 2019 15:53:31 +0100 From: "Trahe, Fiona" To: "Kusztal, ArkadiuszX" , "dev@dpdk.org" CC: "akhil.goyal@nxp.com" , "Doherty, Declan" , "Trahe, Fiona" Thread-Topic: [PATCH] crypto/openssl: fix usage of non constant time memcmp for mac and signature Thread-Index: AQHVF36LJvld5dSkUUWYCFlQ4QafLaaFUDEQ Date: Fri, 31 May 2019 14:53:30 +0000 Message-ID: <348A99DA5F5B7549AA880327E580B43589778706@IRSMSX101.ger.corp.intel.com> References: <20190531065928.3420-1-arkadiuszx.kusztal@intel.com> <20190531065928.3420-2-arkadiuszx.kusztal@intel.com> In-Reply-To: <20190531065928.3420-2-arkadiuszx.kusztal@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNjdlOTI3MjItMmMyZi00YjYyLWFjZGMtYjI5YjdlZjg1YjkyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZUgrWnhuSHhVSmI3NmFZUlphKzlWMllZYklYWkdHZThsRlFKVDhWWTFhVTJEc1lUeG0rZG4wQ0tRaHNNOHlyciJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] crypto/openssl: fix usage of non constant time memcmp for mac and signature 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" > -----Original Message----- > From: Kusztal, ArkadiuszX > Sent: Friday, May 31, 2019 7:59 AM > To: dev@dpdk.org > Cc: akhil.goyal@nxp.com; Trahe, Fiona ; Doherty, D= eclan > ; Kusztal, ArkadiuszX > Subject: [PATCH] crypto/openssl: fix usage of non constant time memcmp fo= r mac and signature >=20 > ANSI C memcmp is not constant time function per spec so it should > be avoided in cryptography usage. >=20 > Fixes: d61f70b4c918 ("crypto/libcrypto: add driver for OpenSSL library") >=20 > Signed-off-by: Arek Kusztal > --- > drivers/crypto/openssl/rte_openssl_pmd.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/op= enssl/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, stru= ct rte_crypto_op *op, > } >=20 > if (sess->auth.operation =3D=3D 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) !=3D 0) { > op->status =3D 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 <=3D 0) || (memcmp(tmp, op->rsa.message.data, > + if ((ret <=3D 0) || (CRYPTO_memcmp(tmp, op->rsa.message.data, > op->rsa.message.length))) { > OPENSSL_LOG(ERR, "RSA sign Verification failed"); > cop->status =3D RTE_CRYPTO_OP_STATUS_ERROR; > -- > 2.1.0 Hadn't heard of that time const fn before so just read up on it - interesti= ng. Acked-by: Fiona Trahe