Re: [PATCH] crypto: testmgr - populate RSA CRT parameters in RSA test vectors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jul 2, 2022 at 9:38 AM Giovanni Cabiddu
<giovanni.cabiddu@xxxxxxxxx> wrote:
>
> 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@xxxxxxxxxxxxxxxxxx>
> > Signed-off-by: Ignat Korchagin <ignat@xxxxxxxxxxxxxx>
> > ---
> >  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.
Indeed! Not sure how they got there. Sent a v2.

Ignat
> Regards,
>
> --
> Giovanni



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux