From: Tadeusz Struk <tadeusz.struk@intel.com>
To: Andrew Zaborowski <andrew.zaborowski@intel.com>,
linux-crypto@vger.kernel.org
Subject: Re: [RFC PATCH] crypto: RSA padding transform
Date: Mon, 7 Sep 2015 07:06:22 -0700 [thread overview]
Message-ID: <55ED99DE.2000004@intel.com> (raw)
In-Reply-To: <1441494029-6765-1-git-send-email-andrew.zaborowski@intel.com>
Hi Andrew,
On 09/05/2015 04:00 PM, Andrew Zaborowski wrote:
> +static int crypto_akcipher_init(struct crypto_tfm *tfm, u32 type, u32 mask)
> +{
> + return 0;
> +}
> +
This is not needed I think.
>
> +static int pkcs1pad_decrypt_complete(struct akcipher_request *req, int err)
> +{
> + struct akcipher_request *child_req = akcipher_request_ctx(req);
> + int pos;
> + uint8_t *dst = child_req->dst;
> +
> + BUG_ON(err == -EOVERFLOW);
> +
> + if (err)
> + goto done;
> +
> + if (dst[0] != 0x00) {
> + err = -EINVAL;
> + goto done;
> + }
This won't work I'm afraid, because MPI strips all leading zeors.
> + if (dst[1] != 0x02) {
> + err = -EINVAL;
> + goto done;
> + }
>
> +static int pkcs1pad_verify_complete(struct akcipher_request *req, int err)
> +{
> + struct akcipher_request *child_req = akcipher_request_ctx(req);
> + int pos;
> + uint8_t *dst = child_req->dst;
> +
> + BUG_ON(err == -EOVERFLOW);
> +
> + if (err)
> + goto done;
> +
> + if (dst[0] != 0x00) {
> + err = -EINVAL;
> + goto done;
> + }
same here the zero will be stripped off.
next prev parent reply other threads:[~2015-09-07 14:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-05 23:00 [RFC PATCH] crypto: RSA padding transform Andrew Zaborowski
2015-09-06 8:34 ` Stephan Mueller
2015-09-06 14:33 ` Andrzej Zaborowski
2015-09-06 21:17 ` Stephan Mueller
2015-09-07 14:42 ` Andrzej Zaborowski
2015-09-07 15:10 ` Stephan Mueller
2015-09-07 14:31 ` Tadeusz Struk
2015-09-07 17:54 ` Stephan Mueller
2015-09-08 16:09 ` Andrzej Zaborowski
2015-10-30 8:35 ` Marcel Holtmann
2015-09-08 1:07 ` Herbert Xu
2015-09-07 14:11 ` Tadeusz Struk
2015-09-07 15:07 ` Stephan Mueller
2015-09-07 14:06 ` Tadeusz Struk [this message]
2015-09-07 14:38 ` Andrzej Zaborowski
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=55ED99DE.2000004@intel.com \
--to=tadeusz.struk@intel.com \
--cc=andrew.zaborowski@intel.com \
--cc=linux-crypto@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