Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp531653yba; Wed, 15 May 2019 05:45:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqxM7awxUPbbc31rU23kayROSfRtaUMNJa9lHE0KeV7XvhlZSEMNIvuN1kW6bNnTuR6Nd63v X-Received: by 2002:a65:5244:: with SMTP id q4mr42695626pgp.79.1557924355935; Wed, 15 May 2019 05:45:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557924355; cv=none; d=google.com; s=arc-20160816; b=cCuts7xQlWXkiF7S51A3RVmS7wC6wWt/rxkjqrVFymFWpJciYzM5KHlbRJVbKcxk0f LE+2gTXmTn9zYvqXEdv8BX3zo8FQxs8sq0y1+eOT6BO6qpoYf7aUZusJMl7ZEYHR8aoZ 7X+mD6Yqe4LO9bGAg+2hJD7hxdfx5MIP2ccyAgrRoU66BfP0hYWqXGO7/U/YPaqJyD2e tOdnDfqO7H4GomqncpKN+5JfTVBErKu3Jt3xnm7mdn4NZT4++rp1Pa2gGUJwwLQPIjne N2e17QUYh6MRr7OeqUfgyRW9S3RwPLlnVwVwLeeyH2EljuoVB5LUoklOnWkOvoa/vGqF wH7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=6vjulWNtFIuDzzZVLB3YmibWuEZ93u2o20N7TkbUFrI=; b=0u1US1ARRmsPwfQ5LjFYQRZXj5tFlUnwLOjTcj9Kcg4FczRh0pDo+9Vj/HTKQcs6WZ 0T60bQztKAmhEE2i+xTmKmUbFQhFxjTmQUTL8uGlkwdeOK1Dl0HPTyU32nytHGNomONr 6ZyuklS6dGpyHAYrOQJi/c8ip09qWU1ow+KGCIVmHJoPlwG7CC3Toz6hR+B9fBCiZZ9C raF1Z2+9XJ9YhzaVGQ41YvQZYSRBHuEB2/jaCj4/5qDgKZp6mdgikAmsomvX0gOPOIs5 YGmtg0u/bjJda9Pn9FrxOUtrj03wCAsghVAOHu/KS6R6w62xw0zfd8+1SkauLyqZbbua cEHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=C6MlpCQK; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v10si1677618pgj.576.2019.05.15.05.45.37; Wed, 15 May 2019 05:45:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=C6MlpCQK; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726533AbfEOMpg (ORCPT + 99 others); Wed, 15 May 2019 08:45:36 -0400 Received: from mail-eopbgr20046.outbound.protection.outlook.com ([40.107.2.46]:8260 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726594AbfEOMpg (ORCPT ); Wed, 15 May 2019 08:45:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6vjulWNtFIuDzzZVLB3YmibWuEZ93u2o20N7TkbUFrI=; b=C6MlpCQK0Iisv09AcfN36zfMyjdZL4TvMbwhtXMuiq8NIfAwq0C2qlxqBvI850YmhrD3tbwDpydzikblt5zecYbo+Lbl5a4PbSk/6Ki5HfxcaCcoQakMYpnJIk0vvFI0oNEEY/UcQ1Fh8+Jl0P8BkRKMmaUgSBtd0RiE7Nu//JI= Received: from VI1PR0402MB3485.eurprd04.prod.outlook.com (52.134.3.153) by VI1PR0402MB2896.eurprd04.prod.outlook.com (10.175.24.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1900.16; Wed, 15 May 2019 12:45:32 +0000 Received: from VI1PR0402MB3485.eurprd04.prod.outlook.com ([fe80::dd3c:969d:89b9:f422]) by VI1PR0402MB3485.eurprd04.prod.outlook.com ([fe80::dd3c:969d:89b9:f422%4]) with mapi id 15.20.1878.024; Wed, 15 May 2019 12:45:32 +0000 From: Horia Geanta To: Iuliana Prodan , Herbert Xu , Aymen Sghaier CC: "David S. Miller" , "linux-crypto@vger.kernel.org" , "linux-kernel@vger.kernel.org" , dl-linux-imx Subject: Re: [PATCH v2 1/2] crypto: caam - fix pkcs1pad(rsa-caam, sha256) failure because of invalid input Thread-Topic: [PATCH v2 1/2] crypto: caam - fix pkcs1pad(rsa-caam, sha256) failure because of invalid input Thread-Index: AQHVCxD13Q1EOIwSiEGsSCDp99Uy8Q== Date: Wed, 15 May 2019 12:45:32 +0000 Message-ID: References: <1557919546-360-1-git-send-email-iuliana.prodan@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=horia.geanta@nxp.com; x-originating-ip: [212.146.100.6] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: fce0594e-26df-43c3-1075-08d6d93337f7 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020);SRVR:VI1PR0402MB2896; x-ms-traffictypediagnostic: VI1PR0402MB2896: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 0038DE95A2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(39860400002)(396003)(366004)(136003)(376002)(189003)(199004)(8936002)(256004)(81156014)(6116002)(33656002)(2906002)(66476007)(86362001)(68736007)(8676002)(3846002)(66066001)(76116006)(73956011)(71200400001)(71190400001)(66946007)(66556008)(64756008)(66446008)(53936002)(102836004)(26005)(9686003)(52536014)(6246003)(186003)(99286004)(81166006)(5660300002)(53546011)(6506007)(7696005)(76176011)(55016002)(74316002)(476003)(6436002)(4326008)(305945005)(6636002)(44832011)(14454004)(7736002)(229853002)(446003)(478600001)(486006)(25786009)(4744005)(316002)(110136005)(54906003)(32563001);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0402MB2896;H:VI1PR0402MB3485.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: DcDUpBmAazVTfpJFjmckR6N/61PsPr/3XlRDsfVnDVVEkPs3+wC+vnHr6I8z7tBdRtu2bVNhn/pOXntMB9NyS8DRchwrZdRFXyDnuwPkGaPL3M9f/eNulBIXV67E7Kh1mEcU2AqOjvz2e6zyJ1Fldn9AsWPM89P5eExPSJqfJPvwi8mlbDo6oqRYDmnvMWfn8DC37uC9xhqmN1niCgU1AF7gl6vUFDbC109VA0/FgC6QJmWYfWH28OhsgBecIMqGaO2NGynjuOkv8LIESkhoHmHMfN+tHV7prdHBMpktGBQXiERHw7CqudzNgpPsu6VV6rGQi8PX/XjBQ2epvXCDpNuk0QtNfYzyWqarOm3mMrUWKAh/4TwXyoaIhfpTbu95Qflvaob5KarQChQ9fTN6SBEMs/z82xQRWQArQkMpOmk= Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fce0594e-26df-43c3-1075-08d6d93337f7 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 May 2019 12:45:32.3130 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB2896 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 5/15/2019 2:25 PM, Iuliana Prodan wrote:=0A= > The problem is with the input data size sent to CAAM for encrypt/decrypt.= =0A= > Pkcs1pad is failing due to pkcs1 padding done in SW starting with0x01=0A= > instead of 0x00 0x01.=0A= > CAAM expects an input of modulus size. For this we strip the leading=0A= > zeros in case the size is more than modulus or pad the input with zeros= =0A= > until the modulus size is reached.=0A= > =0A= > Signed-off-by: Iuliana Prodan =0A= Reviewed-by: Horia Geant=E3 =0A= =0A= Thanks,=0A= Horia=0A=