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 nbits field to ecc_curve structure

Add the number of bits a curve has to the ecc_curve definition to be able
to derive the number of bytes a curve requires for its coordinates from it.
It also allows one to identify a curve by its particular size. Set the
number of bits on all curve definitions.

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

authored by

Stefan Berger and committed by
Herbert Xu
c0d6bd1f 48e8d3a5

+11
+4
crypto/ecc_curve_defs.h
··· 17 17 0x64210519E59C80E7ull }; 18 18 static struct ecc_curve nist_p192 = { 19 19 .name = "nist_192", 20 + .nbits = 192, 20 21 .g = { 21 22 .x = nist_p192_g_x, 22 23 .y = nist_p192_g_y, ··· 44 43 0xB3EBBD55769886BCull, 0x5AC635D8AA3A93E7ull }; 45 44 static struct ecc_curve nist_p256 = { 46 45 .name = "nist_256", 46 + .nbits = 256, 47 47 .g = { 48 48 .x = nist_p256_g_x, 49 49 .y = nist_p256_g_y, ··· 77 75 0x988e056be3f82d19ull, 0xb3312fa7e23ee7e4ull }; 78 76 static struct ecc_curve nist_p384 = { 79 77 .name = "nist_384", 78 + .nbits = 384, 80 79 .g = { 81 80 .x = nist_p384_g_x, 82 81 .y = nist_p384_g_y, ··· 98 95 0x0000000000000000, 0x0000000000000000 }; 99 96 static const struct ecc_curve ecc_25519 = { 100 97 .name = "curve25519", 98 + .nbits = 255, 101 99 .g = { 102 100 .x = curve25519_g_x, 103 101 .ndigits = 4,
+5
crypto/ecrdsa_defs.h
··· 47 47 48 48 static struct ecc_curve gost_cp256a = { 49 49 .name = "cp256a", 50 + .nbits = 256, 50 51 .g = { 51 52 .x = cp256a_g_x, 52 53 .y = cp256a_g_y, ··· 81 80 82 81 static struct ecc_curve gost_cp256b = { 83 82 .name = "cp256b", 83 + .nbits = 256, 84 84 .g = { 85 85 .x = cp256b_g_x, 86 86 .y = cp256b_g_y, ··· 119 117 120 118 static struct ecc_curve gost_cp256c = { 121 119 .name = "cp256c", 120 + .nbits = 256, 122 121 .g = { 123 122 .x = cp256c_g_x, 124 123 .y = cp256c_g_y, ··· 169 166 170 167 static struct ecc_curve gost_tc512a = { 171 168 .name = "tc512a", 169 + .nbits = 512, 172 170 .g = { 173 171 .x = tc512a_g_x, 174 172 .y = tc512a_g_y, ··· 215 211 216 212 static struct ecc_curve gost_tc512b = { 217 213 .name = "tc512b", 214 + .nbits = 512, 218 215 .g = { 219 216 .x = tc512b_g_x, 220 217 .y = tc512b_g_y,
+2
include/crypto/ecc_curve.h
··· 23 23 * struct ecc_curve - definition of elliptic curve 24 24 * 25 25 * @name: Short name of the curve. 26 + * @nbits: The number of bits of a curve. 26 27 * @g: Generator point of the curve. 27 28 * @p: Prime number, if Barrett's reduction is used for this curve 28 29 * pre-calculated value 'mu' is appended to the @p after ndigits. ··· 35 34 */ 36 35 struct ecc_curve { 37 36 char *name; 37 + u32 nbits; 38 38 struct ecc_point g; 39 39 u64 *p; 40 40 u64 *n;