linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Horia Geanta <horia.geanta@nxp.com>
To: Iuliana Prodan <iuliana.prodan@nxp.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Aymen Sghaier <aymen.sghaier@nxp.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>
Subject: Re: [PATCH v3 1/2] crypto: caam - fix pkcs1pad(rsa-caam, sha256) failure because of invalid input
Date: Mon, 27 May 2019 16:37:15 +0000	[thread overview]
Message-ID: <VI1PR0402MB34853A1681A83D311AD74599981D0@VI1PR0402MB3485.eurprd04.prod.outlook.com> (raw)
In-Reply-To: 1558709189-7237-1-git-send-email-iuliana.prodan@nxp.com

On 5/24/2019 5:46 PM, Iuliana Prodan wrote:
> @@ -1030,17 +1076,26 @@ int caam_pkc_init(struct device *ctrldev)
>  	if (!pk_inst)
>  		return 0;
>  
> +	/* allocate zero buffer, used for padding input */
> +	zero_buffer = kzalloc(CAAM_RSA_MAX_INPUT_SIZE - 1, GFP_DMA |
> +			      GFP_KERNEL);
> +	if (!zero_buffer)
> +		err = -ENOMEM;
Either return -ENOMEM or jump to a label before return err.

> +
>  	err = crypto_register_akcipher(&caam_rsa);
> -	if (err)
> +	if (err) {
> +		kfree(zero_buffer);
>  		dev_warn(ctrldev, "%s alg registration failed\n",
>  			 caam_rsa.base.cra_driver_name);
> -	else
> +	} else {
>  		dev_info(ctrldev, "caam pkc algorithms registered in /proc/crypto\n");
> +	}
>  
>  	return err;
>  }
>  
>  void caam_pkc_exit(void)
>  {
> +	kfree(zero_buffer);
>  	crypto_unregister_akcipher(&caam_rsa);
>  }

Regards,
Horia

      parent reply	other threads:[~2019-05-27 16:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-24 14:46 [PATCH v3 1/2] crypto: caam - fix pkcs1pad(rsa-caam, sha256) failure because of invalid input Iuliana Prodan
2019-05-24 14:46 ` [PATCH v4] crypto: caam - strip input without changing crypto request Iuliana Prodan
2019-05-27 16:30   ` Horia Geanta
2019-05-27 16:37 ` Horia Geanta [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=VI1PR0402MB34853A1681A83D311AD74599981D0@VI1PR0402MB3485.eurprd04.prod.outlook.com \
    --to=horia.geanta@nxp.com \
    --cc=aymen.sghaier@nxp.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=iuliana.prodan@nxp.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).