mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
To: Ignat Korchagin <ignat@cloudflare.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S . Miller" <davem@davemloft.net>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-team@cloudflare.com, Eric Biggers <ebiggers@kernel.org>,
	Tasmiya Nalatwad <tasmiya@linux.vnet.ibm.com>
Subject: Re: [PATCH] crypto: testmgr - populate RSA CRT parameters in RSA test vectors
Date: Sat, 2 Jul 2022 09:37:42 +0100	[thread overview]
Message-ID: <YsAD1rHPsG8OG36x@silpixa00400314> (raw)
In-Reply-To: <20220630140506.904-1-ignat@cloudflare.com>

On Thu, Jun 30, 2022 at 03:05:06PM +0100, Ignat Korchagin wrote:
> In f145d411a67e ("crypto: rsa - implement Chinese Remainder Theorem for faster
> private key operations") we have started to use the additional primes and
> coefficients for RSA private key operations. However, these additional
> parameters are not present (defined as 0 integers) in the RSA test vectors.
> 
> Some parameters were borrowed from OpenSSL, so I was able to find the source.
> I could not find the public source for 1 vector though, so had to recover the
> parameters by implementing Appendix C from [1].
> 
> [1]: https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Br1.pdf
> 
> Fixes: f145d411a67e ("crypto: rsa - implement Chinese Remainder Theorem for faster private key operations")
> Reported-by: Tasmiya Nalatwad <tasmiya@linux.vnet.ibm.com>
> Signed-off-by: Ignat Korchagin <ignat@cloudflare.com>
> ---
>  crypto/testmgr.h | 121 +++++++++++++++++++++++++++++++++++++++--------
>  1 file changed, 100 insertions(+), 21 deletions(-)
> 
> diff --git a/crypto/testmgr.h b/crypto/testmgr.h
> index 8e2dce86dd48..7d503b4e1e41 100644
> --- a/crypto/testmgr.h
> +++ b/crypto/testmgr.h
> @@ -185,7 +185,7 @@ static const struct akcipher_testvec rsa_tv_template[] = {
>  	{
>  #ifndef CONFIG_CRYPTO_FIPS
>  	.key =
> -	"\x30\x81\x9A" /* sequence of 154 bytes */
> +	"\x30\x82\x01\x38" /* sequence of 312 bytes */
>  	"\x02\x01\x00" /* version - integer of 1 byte */
>  	"\x02\x41" /* modulus - integer of 65 bytes */
>  	"\x00\xAA\x36\xAB\xCE\x88\xAC\xFD\xFF\x55\x52\x3C\x7F\xC4\x52\x3F"
> @@ -199,23 +199,36 @@ static const struct akcipher_testvec rsa_tv_template[] = {
>  	"\xC2\xCD\x2D\xFF\x43\x40\x98\xCD\x20\xD8\xA1\x38\xD0\x90\xBF\x64"
>  	"\x79\x7C\x3F\xA7\xA2\xCD\xCB\x3C\xD1\xE0\xBD\xBA\x26\x54\xB4\xF9"
>  	"\xDF\x8E\x8A\xE5\x9D\x73\x3D\x9F\x33\xB3\x01\x62\x4A\xFD\x1D\x51"
> -	"\x02\x01\x00" /* prime1 - integer of 1 byte */
> -	"\x02\x01\x00" /* prime2 - integer of 1 byte */
> -	"\x02\x01\x00" /* exponent1 - integer of 1 byte */
> -	"\x02\x01\x00" /* exponent2 - integer of 1 byte */
> -	"\x02\x01\x00", /* coefficient - integer of 1 byte */
> +	"\x02\x21" /* prime1 - integer of 33 bytes */
> +	"\x00\xD8\x40\xB4\x16\x66\xB4\x2E\x92\xEA\x0D\xA3\xB4\x32\x04\xB5"
> +    "\xCF\xCE\x33\x52\x52\x4D\x04\x16\xA5\xA4\x41\xE7\x00\xAF\x46\x12"
> +    "\x0D"
Spaces should be replaced with tabs.
Checkpatch reports 1 error and 27 warnings.

Regards,

-- 
Giovanni

  reply	other threads:[~2022-07-02  8:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 14:05 Ignat Korchagin
2022-07-02  8:37 ` Giovanni Cabiddu [this message]
2022-07-04 10:40   ` Ignat Korchagin

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=YsAD1rHPsG8OG36x@silpixa00400314 \
    --to=giovanni.cabiddu@intel.com \
    --cc=davem@davemloft.net \
    --cc=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=ignat@cloudflare.com \
    --cc=kernel-team@cloudflare.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tasmiya@linux.vnet.ibm.com \
    /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

all inboxes | Powered by JetHome®