Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4869207ybi; Tue, 28 May 2019 04:00:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqwClqgeQp5bBh4qw94m39tC+QfQHwQfMd0DbMy6cPELk759AmuwzUbkTlu26XyZ2ZN3KeVC X-Received: by 2002:a17:90a:20c4:: with SMTP id f62mr5003826pjg.16.1559041206590; Tue, 28 May 2019 04:00:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559041206; cv=none; d=google.com; s=arc-20160816; b=qzXqWmhNcr79kl3+SstgvmUdpdcWBkU4OKhlTLgAFy1ft0TJPDsT7hht+Y6ao4ry8U bVJ0X8asZduaRWZcEHMpvGV3Xyi801tlPPafWFysvcqM3c7OveO8eWlB1qWoDG2FBLqZ pQgrRxL2eaNracrddAvvsyjuwjoz70fMnn8+H2VmyR+hlQgGgfZocnXsc+VFg6Uy6/d5 c8pbQZcYsDfq0RvLhpccryCE1YydDF5aCktogY+HqlzwJYpENshXeYqvt7nT4JThJK7d VcjJwx03WPV43tEepxv8yLRQotgplHH259GVRxHHCI6Cp0p7FqxvUaWOD1Cykst597iO Pa6Q== 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=IZThu+XCpRZBM8jaMCMQA5O0s2CzjGyjWNprWfR641o=; b=zt/aNwhk9UppxAn4+4hhqefJ5U0tq7kD2Gm6Dr9lQ3vBDcLzo84VY0rFN1uS9tgnEb QmGpjVtrkGufX7qd0eQY9A6S4G1ID0Yyzz2XhUl7s1E2/iISmW27C0G2Gb4goncaM1mU 8VMPNPJX9ORS8+Cr8P9tJ9zzIvTV4t5ytMaous4PS8dWu5IsdIufl0PQRdsc7WvD3HOW BlMIyh6RZ6gZdRtPmZ3i+5o/u5CbtjM69/Bw+X28KLu1HZ36FVnE7Ml5tBcjUuplKMMv lJn7c/IOkcoXKtqJisPa+yZU7krHxoLo8g1M+WNWE8k6o3SqD4bBK538r+K/+4taiBk0 Xzag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=lYumoZui; 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 q205si24984699pfc.151.2019.05.28.03.59.46; Tue, 28 May 2019 04:00:06 -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=lYumoZui; 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 S1726591AbfE1K6l (ORCPT + 99 others); Tue, 28 May 2019 06:58:41 -0400 Received: from mail-eopbgr50060.outbound.protection.outlook.com ([40.107.5.60]:30238 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726305AbfE1K6l (ORCPT ); Tue, 28 May 2019 06:58:41 -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=IZThu+XCpRZBM8jaMCMQA5O0s2CzjGyjWNprWfR641o=; b=lYumoZuinJW9odDtFTw2+rrlfQ29IVpmYkFHafTx8IfBeAe5grzBLk8IJXLECI8kS6qQeq9CXqEzbxBbJJWtmc50mWU09k/nz2Iw+6XImZI5Rp5kW+/xSgR/M4+hEf5etG2gWcTAZVit70sf93r3qUmgmsfvujgzdAdbM/VdfCc= Received: from VI1PR0402MB3485.eurprd04.prod.outlook.com (52.134.3.153) by VI1PR0402MB3661.eurprd04.prod.outlook.com (52.134.14.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1922.19; Tue, 28 May 2019 10:58:37 +0000 Received: from VI1PR0402MB3485.eurprd04.prod.outlook.com ([fe80::ccaf:f4a1:704a:e745]) by VI1PR0402MB3485.eurprd04.prod.outlook.com ([fe80::ccaf:f4a1:704a:e745%4]) with mapi id 15.20.1922.021; Tue, 28 May 2019 10:58:37 +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 v5 1/2] crypto: caam - fix pkcs1pad(rsa-caam, sha256) failure because of invalid input Thread-Topic: [PATCH v5 1/2] crypto: caam - fix pkcs1pad(rsa-caam, sha256) failure because of invalid input Thread-Index: AQHVFTsIqleeE9MbU0ezlG/eKoEFfg== Date: Tue, 28 May 2019 10:58:36 +0000 Message-ID: References: <1559037131-4601-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: a240b2f9-a078-4688-4ef8-08d6e35b6f77 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:VI1PR0402MB3661; x-ms-traffictypediagnostic: VI1PR0402MB3661: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 00514A2FE6 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(136003)(39860400002)(366004)(346002)(396003)(199004)(189003)(33656002)(478600001)(68736007)(6436002)(8676002)(305945005)(476003)(14454004)(52536014)(4326008)(186003)(53936002)(7736002)(74316002)(316002)(44832011)(99286004)(102836004)(3846002)(6116002)(73956011)(486006)(446003)(6246003)(7696005)(6636002)(2906002)(76116006)(4744005)(25786009)(71190400001)(71200400001)(26005)(86362001)(66556008)(66446008)(64756008)(66476007)(8936002)(66946007)(54906003)(110136005)(256004)(81166006)(76176011)(53546011)(81156014)(6506007)(5660300002)(66066001)(9686003)(229853002)(55016002)(32563001);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0402MB3661;H:VI1PR0402MB3485.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX: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: oEYu/mSVeN3n5rE1eqHLyQmF+LPXDWhAWynP5L64cJO+orGB1IZ/etXU9Q09k7VUz7j7T7YL1byikrs+sCBasF7nqGvVH3vJyczilYJmk+c2jwAJR0Q6M0zN0Rcd6FYrAqRB6Aum67KqsEhuF4CSBkehw/fgWUD4SYIR2H0KTALsbCbIOscJMRnMACgLz/NFTXm+dkj4zSp3+HxrJaYfFv1Yluh4FRCh/ANYJUrk21B5cwcGZnxm9tiCQJQlx5d0WlD9H9Kj5tW71NK/bYyJCMUjsEvjHVEJeRF4IPa+z/mk5npRB+KR7/h/cHLC+0xRf0ZFq3oiuBDR7VMjKwyMBWAjdFVb5odnJtD2dfZqp0Lm4i0KuH16qd5t0GNafkrhJyroLtmrRafVvpLyktSlqr2lfIO3tejVJsSY7zm1Nw0= 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: a240b2f9-a078-4688-4ef8-08d6e35b6f77 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 May 2019 10:58:36.9893 (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-CrossTenant-userprincipalname: horia.geanta@nxp.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3661 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 5/28/2019 12:52 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=