Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4025577ybi; Mon, 27 May 2019 09:39:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/5HJ2m85EdyX9uM/l51Mk4qyUtM79HTijolUT3u+5OIusfo2Jqj4drW7VsZjPcKByGpMv X-Received: by 2002:a17:90a:2e87:: with SMTP id r7mr31302374pjd.112.1558975164007; Mon, 27 May 2019 09:39:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558975163; cv=none; d=google.com; s=arc-20160816; b=HYoxovMuvdFJ3O11C55BxdWJn5km5vS/j/ZMAf/jG2pT/FsQQKD4FJVu4oEYKSiv3i b4uPqYgpWSeHcwgvEdUtIY0y0d7GDsVXG/BYr3smcYE69oZ6GYS5u9K7BrgZwnIGWGKj FhG749ozU19GI1g35aWsDLYt4hPzWiHtxxU9D41I3wg7Dp77IiU7OR1HUPZEFsXkb0WI UftOoWnM7xTRRBims/l77c51ZjdpqIpuDrOwEWjjE/zNYQkwmb8YTjqFSUqujwSHkvaG Va/Ej8t5qRP3aGrzXjvCl31U/yRrKtT6UAMJOmuaSg2DrVu+ioJDlcwQyiZMjfd2qOu2 IIbA== 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=DV6PUodTsUn3itp8Ad6lHWB2/j2xNErj+Qu5oDa4jrc=; b=DNT8m8plDdJNiHiLK4o2WYV/qpAKhpCi8OTfHxAfmYQ4tIoRZCU+sUnVFoALdIQzit L+fB0soU5wlEYq3GHCn4v+9X0mPkGhEKH/ggyjg7cQdF7553dCEehKQ0+KtfctaGbE9t Xh7iiuqdrqnIa/Npv3td3foIMxCnSvU3a57hD9N7zgPwY4KMpAFW3nBjCwy6QmBMkjEW 2yfqCiabdykm8rKUrqL/wgABlp6POyUzosYrNb+0klnExh/Myxey85wOJyxHlptQCuzZ 1oRRdPvR3XrwE2qmx+Ndyp1fuPk/sA9JUdw8rEFfJayLMCbH2XjtEduC0pfVpVAbsHtH F6Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=lh04h7ep; 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 k17si21941044pfd.278.2019.05.27.09.39.08; Mon, 27 May 2019 09:39:23 -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=lh04h7ep; 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 S1725991AbfE0QhU (ORCPT + 99 others); Mon, 27 May 2019 12:37:20 -0400 Received: from mail-eopbgr80048.outbound.protection.outlook.com ([40.107.8.48]:54361 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726937AbfE0QhS (ORCPT ); Mon, 27 May 2019 12:37:18 -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=DV6PUodTsUn3itp8Ad6lHWB2/j2xNErj+Qu5oDa4jrc=; b=lh04h7epcWPDTDSvViaYFQsGmnWyNv1zQvvUOtnNEkTY8eIKmPrA1bve7dZCgOcL+1UcsFcoKIA6NVULeuw2PSYfcxq6x/7pBL7JdLW69RcdiP+IZiEiANgtZQ9xrcnVig8KRhFS9sWSTo+2RBRN4C8WJLYxhsQ2cWOO7G5uJT8= Received: from VI1PR0402MB3485.eurprd04.prod.outlook.com (52.134.3.153) by VI1PR0402MB3792.eurprd04.prod.outlook.com (52.134.16.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1922.17; Mon, 27 May 2019 16:37:15 +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; Mon, 27 May 2019 16:37:15 +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 v3 1/2] crypto: caam - fix pkcs1pad(rsa-caam, sha256) failure because of invalid input Thread-Topic: [PATCH v3 1/2] crypto: caam - fix pkcs1pad(rsa-caam, sha256) failure because of invalid input Thread-Index: AQHVEj+CGyNNQHQJmUKR+9DV1yltFQ== Date: Mon, 27 May 2019 16:37:15 +0000 Message-ID: References: <1558709189-7237-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: 9f6df39d-02e3-4507-29f7-08d6e2c1938a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600148)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020);SRVR:VI1PR0402MB3792; x-ms-traffictypediagnostic: VI1PR0402MB3792: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2803; x-forefront-prvs: 0050CEFE70 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(346002)(136003)(39860400002)(376002)(366004)(189003)(199004)(64756008)(66446008)(66556008)(66476007)(54906003)(8936002)(110136005)(66946007)(76116006)(55016002)(26005)(229853002)(86362001)(25786009)(71200400001)(71190400001)(66066001)(4744005)(9686003)(5660300002)(81156014)(81166006)(256004)(53546011)(6506007)(76176011)(186003)(4326008)(74316002)(7736002)(52536014)(14454004)(316002)(478600001)(476003)(33656002)(6436002)(68736007)(8676002)(305945005)(73956011)(6116002)(2906002)(6636002)(7696005)(6246003)(446003)(486006)(53936002)(99286004)(44832011)(102836004)(3846002)(32563001);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0402MB3792;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: 2pZbyO8OdGoR56NBHVQ+j9BG42Xtev+HBAc48CVzJDmGUjaq8UiK9EOCf7wAOKhaJR4bpq607pJNUKJrnoLQbHiaiWezPP3e/iMmZAW/FiDdXfl3A8LGQXHdIK86lX0Yr9PmO/OyKX6lyELUy91goqhhv42Bfv/QP1fCirw5KY96JI45nPLSHgluf/1Ip+l4uCcwdQallvMExOR8yzS2o51mKZe8m1azhiQPtZ9VaBpmk4lFbMw736HCgGP0dE3cIlq30qNy6Zp7CVY63G+80Ic4pQx22IE3QfBXtbwIzHj1rr8kJO8YOGg/r+70knzZW+i+2ju77jUs53OJj6SjbPM2EdHTPQYodfJC1mhRbFlUwvPX17RDjUfEyj3ik0fZutuE38+LKfsIfJ24TNPZvDWXTVfqJTZz893qVRCchRA= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f6df39d-02e3-4507-29f7-08d6e2c1938a X-MS-Exchange-CrossTenant-originalarrivaltime: 27 May 2019 16:37:15.0355 (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: VI1PR0402MB3792 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 5/24/2019 5:46 PM, Iuliana Prodan wrote:=0A= > @@ -1030,17 +1076,26 @@ int caam_pkc_init(struct device *ctrldev)=0A= > if (!pk_inst)=0A= > return 0;=0A= > =0A= > + /* allocate zero buffer, used for padding input */=0A= > + zero_buffer =3D kzalloc(CAAM_RSA_MAX_INPUT_SIZE - 1, GFP_DMA |=0A= > + GFP_KERNEL);=0A= > + if (!zero_buffer)=0A= > + err =3D -ENOMEM;=0A= Either return -ENOMEM or jump to a label before return err.=0A= =0A= > +=0A= > err =3D crypto_register_akcipher(&caam_rsa);=0A= > - if (err)=0A= > + if (err) {=0A= > + kfree(zero_buffer);=0A= > dev_warn(ctrldev, "%s alg registration failed\n",=0A= > caam_rsa.base.cra_driver_name);=0A= > - else=0A= > + } else {=0A= > dev_info(ctrldev, "caam pkc algorithms registered in /proc/crypto\n");= =0A= > + }=0A= > =0A= > return err;=0A= > }=0A= > =0A= > void caam_pkc_exit(void)=0A= > {=0A= > + kfree(zero_buffer);=0A= > crypto_unregister_akcipher(&caam_rsa);=0A= > }=0A= =0A= Regards,=0A= Horia=0A=