Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: ecc - Add special case for NIST P521 in ecc_point_mult

In ecc_point_mult use the number of bits of the NIST P521 curve + 2. The
change is required specifically for NIST P521 to pass mathematical tests
on the public key.

Tested-by: Lukas Wunner <lukas@wunner.de>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Stefan Berger and committed by
Herbert Xu
114e8043 e7fb0627

+4 -1
+4 -1
crypto/ecc.c
··· 1320 1320 carry = vli_add(sk[0], scalar, curve->n, ndigits); 1321 1321 vli_add(sk[1], sk[0], curve->n, ndigits); 1322 1322 scalar = sk[!carry]; 1323 - num_bits = sizeof(u64) * ndigits * 8 + 1; 1323 + if (curve->nbits == 521) /* NIST P521 */ 1324 + num_bits = curve->nbits + 2; 1325 + else 1326 + num_bits = sizeof(u64) * ndigits * 8 + 1; 1324 1327 1325 1328 vli_set(rx[1], point->x, ndigits); 1326 1329 vli_set(ry[1], point->y, ndigits);