From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0063.outbound.protection.outlook.com [104.47.40.63]) by dpdk.org (Postfix) with ESMTP id 4C72C1B5BA for ; Thu, 11 Oct 2018 15:43:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NCSx7rb+Rsk3jFYqKQRv6E+LVdXwiuKPxC9NHh1sL9Y=; b=QB+L7ZT+9RqL6Cmp3Fb03rgogCD1GJk2D0ardW6/ZleQN2huwiUbyh41OUok+RD9sYHTCBtEKPPHGVhetv8CjeFfRjnQPhUY4NAID4lNLADDZUOhv1ZI3wJx9HyflBILo3YAbCDkQ+VCLf2MPXijYTXHOOv323whGyuPNnCXBzg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Akash.Saxena@cavium.com; Received: from hyd1asaxena-dt.caveonetworks.com (115.113.156.2) by BN6PR07MB2772.namprd07.prod.outlook.com (2603:10b6:404:3f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.22; Thu, 11 Oct 2018 13:43:51 +0000 From: Akash Saxena To: pablo.de.lara.guarch@intel.com Cc: dev@dpdk.org, akhil.goyal@nxp.com, shally.verma@caviumnetworks.com, ayuj.verma@caviumnetworks.com, Akash Saxena Date: Thu, 11 Oct 2018 19:13:10 +0530 Message-Id: <1539265391-9606-2-git-send-email-akash.saxena@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539265391-9606-1-git-send-email-akash.saxena@caviumnetworks.com> References: <1539265391-9606-1-git-send-email-akash.saxena@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: BMXPR01CA0024.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:d::34) To BN6PR07MB2772.namprd07.prod.outlook.com (2603:10b6:404:3f::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a4c4e22c-6ff3-4d09-bba3-08d62f7f9556 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:BN6PR07MB2772; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB2772; 3:UDsRbSP2InG/1cxb0IrccUhDbHNea1w30a/QnxzbJHt67tlFT0bqu3JhLw/B8kBdZ1lKPPnbJEzjY0O/8aQl7GSbZALFKGQsOtE7CdA22l7UcNZTDn2CLdnOEGoo0Z5B182aDvRnOGRp49mkSqtAl2lMgtYgINdWo7BDc5SKx89K/pvt2GhsSP3QMTEQ7S30fO8vFJTVvyYyxAK7UY7MqPOGv8dOPMSVdzsWsMxR96rrhi4XVqfiQhzGHXS8kI+H; 25:63hsnTJ2AxCHh3atyC5RThuXT6ZhUltKnhfQpbkpD9VAtjZWGNe1fR6Xpzd9yXcoXsxvWlhi2F0STT9hFso+URgPmePlyeN0wpoIfvs0NsLI+MHAbmOt7vMTJ6G5HwD6Y4neLFJXEbfNPBaRyVg5YC0j53GsOgAgy0za8TpIwduT/IGOYsw3FLBd1zOaMpxxaoqA/hNwkNQXDoxSnlX532ll/kg4R5Aqsn0DO16a5orjR1bzT0HNeWztvaxxVBSL1xEyQJimmoggVOXiwfj60+KifYI6ZMqDW6QeUtgZI7vdRqMjTeX7zuU6zQ6P2v4+XGrDfnKxozi4nc9EbZI8gg==; 31:xu0QyqD2CB0iGV2aIxvfdffnIJ7/G5uVP54mwD7l2qajKKQURgfBzV6h/vfu3ttshYVDrfoi5rckx5dH0VLu1nVh1pbpqkEVYz44kwx/XaJrTENYcYHZgzmYcyjkUvaJwc3yZqLg27MjLCrtb+gqqPcyt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Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(149066)(150057)(6041310)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(201708071742011)(7699051); SRVR:BN6PR07MB2772; BCL:0; PCL:0; RULEID:; SRVR:BN6PR07MB2772; X-Forefront-PRVS: 08220FA8D6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(366004)(346002)(396003)(136003)(189003)(199004)(6916009)(68736007)(6116002)(3846002)(316002)(48376002)(4326008)(50466002)(50226002)(107886003)(16526019)(44832011)(476003)(105586002)(2616005)(81156014)(97736004)(446003)(486006)(11346002)(8936002)(2361001)(26005)(956004)(186003)(106356001)(53416004)(2351001)(42882007)(81166006)(8676002)(305945005)(14444005)(7736002)(51416003)(52116002)(6486002)(76176011)(66066001)(36756003)(15650500001)(47776003)(16586007)(25786009)(6506007)(478600001)(386003)(6512007)(5660300001)(53936002)(2906002)(6666004)(69596002)(72206003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB2772; H:hyd1asaxena-dt.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR07MB2772; 23:IRKQx5ER6Vuo9hTb8fwd9Z0Klo/ZMzNfPbm+OHDWc?= =?us-ascii?Q?Bf9fSKeVVcHB91u3lrlrML4ssMdOA2I9IIOgOB7j2UkRllkTpfPcFrwoBi7a?= =?us-ascii?Q?A3Y2r8vYAowfaQwsbuHvOuxyNfo7oKphgvTfHeUzBc1K1LkfQbGwCxRLd8+M?= =?us-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Ed+HFaVEWOiZ55yhGZGeCk0Z4V58/fI6igq9bWoQ2tU9aSoV/cdI+KFNghJgATHPjvxe1cEF8XsgNVtmFuQyo5oNh5aqcxCeY4H94RU3Ta5hL0J69EjqLpxY3jz45tasDYptcCPUl6glCXq/39zRigAt1FsocQX/2j3d3NgKElHbtzBzgjtuafFlW9SVGJIOTyBHh7H2MUIZNqNsNFU6AfQJIOASTPm5fXfEh1w==; 5:HFDZrx3177cHRnvM+YHpX2gLi5200HYhfCZ1w5pXIGO9hkJFIcgQ9Hkfci5xeFH7fsld0MdE7pQji0lyc9oDL6I1seldOBg+pdofUKozOmZLxhn1IfMEvmx/9iAAAicT9ooeZ/g0IXvG0VHqtG8InAXPiv/NOlOX9VK/1g6rg2U=; 7:2fIxoklI6l5RsKxHhWO13silHaUB2B0tMi9jbwog6rGXlSizuJVl5tE3/agSi//diEVAOGRwUxNAM85ba3rS/89781yCe9lwfvyqqjr8lsKFuM+uOTj6QLvdZlxWzi8kBD/j/xmJc0TzHCN/WqENDywERblShisgUlEbtemKCMkqxzF9hHU8DCeTzEBPYTv1uwZfCv1Zrzy6rfNxQaDLbYQBc0Q8oUi9B36LLSY1TxYq8cuBQ04Hf7Jizfl8ExYR SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2018 13:43:51.5190 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4c4e22c-6ff3-4d09-bba3-08d62f7f9556 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB2772 Subject: [dpdk-dev] [PATCH v1 1/2] crypto/openssl: changes for RSA verify operation 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: Thu, 11 Oct 2018 13:43:58 -0000 Add tmp buffer to pass to OpenSSL sign API and memcmp output with original plain text to verify signature match. Set op->status = RTE_CRYPO_OP_STATUS_ERROR on signature mismatch. Signed-off-by: Ayuj Verma Signed-off-by: Akash Saxena Signed-off-by: Shally Verma --- drivers/crypto/openssl/rte_openssl_pmd.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index 003116d..cc33fca 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -1843,6 +1843,9 @@ process_openssl_rsa_op(struct rte_crypto_op *cop, struct rte_crypto_asym_op *op = cop->asym; RSA *rsa = sess->u.r.rsa; uint32_t pad = (op->rsa.pad); + uint8_t *tmp; + + cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS; switch (pad) { case RTE_CRYPTO_RSA_PKCS1_V1_5_BT0: @@ -1895,9 +1898,10 @@ process_openssl_rsa_op(struct rte_crypto_op *cop, break; case RTE_CRYPTO_ASYM_OP_VERIFY: + tmp = rte_malloc(NULL, op->rsa.sign.length, 0); ret = RSA_public_decrypt(op->rsa.sign.length, op->rsa.sign.data, - op->rsa.sign.data, + tmp, rsa, pad); @@ -1905,13 +1909,15 @@ 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 (memcmp(op->rsa.sign.data, op->rsa.message.data, - op->rsa.message.length)) { - OPENSSL_LOG(ERR, - "RSA sign Verification failed"); - return -1; + if (ret > 0) { + if (memcmp(tmp, op->rsa.message.data, + op->rsa.message.length)) { + OPENSSL_LOG(ERR, + "RSA sign Verification failed"); + cop->status = RTE_CRYPTO_OP_STATUS_ERROR; + } } + rte_free(tmp); break; default: -- 2.7.4