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 NIST P521 curve parameters

Add the parameters for the NIST P521 curve and define a new curve ID
for it. Make the curve available in ecc_get_curve.

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
288b46c5 114e8043

+48
+2
crypto/ecc.c
··· 60 60 return &nist_p256; 61 61 case ECC_CURVE_NIST_P384: 62 62 return &nist_p384; 63 + case ECC_CURVE_NIST_P521: 64 + return &nist_p521; 63 65 default: 64 66 return NULL; 65 67 }
+45
crypto/ecc_curve_defs.h
··· 89 89 .b = nist_p384_b 90 90 }; 91 91 92 + /* NIST P-521 */ 93 + static u64 nist_p521_g_x[] = { 0xf97e7e31c2e5bd66ull, 0x3348b3c1856a429bull, 94 + 0xfe1dc127a2ffa8deull, 0xa14b5e77efe75928ull, 95 + 0xf828af606b4d3dbaull, 0x9c648139053fb521ull, 96 + 0x9e3ecb662395b442ull, 0x858e06b70404e9cdull, 97 + 0xc6ull }; 98 + static u64 nist_p521_g_y[] = { 0x88be94769fd16650ull, 0x353c7086a272c240ull, 99 + 0xc550b9013fad0761ull, 0x97ee72995ef42640ull, 100 + 0x17afbd17273e662cull, 0x98f54449579b4468ull, 101 + 0x5c8a5fb42c7d1bd9ull, 0x39296a789a3bc004ull, 102 + 0x118ull }; 103 + static u64 nist_p521_p[] = { 0xffffffffffffffffull, 0xffffffffffffffffull, 104 + 0xffffffffffffffffull, 0xffffffffffffffffull, 105 + 0xffffffffffffffffull, 0xffffffffffffffffull, 106 + 0xffffffffffffffffull, 0xffffffffffffffffull, 107 + 0x1ffull }; 108 + static u64 nist_p521_n[] = { 0xbb6fb71e91386409ull, 0x3bb5c9b8899c47aeull, 109 + 0x7fcc0148f709a5d0ull, 0x51868783bf2f966bull, 110 + 0xfffffffffffffffaull, 0xffffffffffffffffull, 111 + 0xffffffffffffffffull, 0xffffffffffffffffull, 112 + 0x1ffull }; 113 + static u64 nist_p521_a[] = { 0xfffffffffffffffcull, 0xffffffffffffffffull, 114 + 0xffffffffffffffffull, 0xffffffffffffffffull, 115 + 0xffffffffffffffffull, 0xffffffffffffffffull, 116 + 0xffffffffffffffffull, 0xffffffffffffffffull, 117 + 0x1ffull }; 118 + static u64 nist_p521_b[] = { 0xef451fd46b503f00ull, 0x3573df883d2c34f1ull, 119 + 0x1652c0bd3bb1bf07ull, 0x56193951ec7e937bull, 120 + 0xb8b489918ef109e1ull, 0xa2da725b99b315f3ull, 121 + 0x929a21a0b68540eeull, 0x953eb9618e1c9a1full, 122 + 0x051ull }; 123 + static struct ecc_curve nist_p521 = { 124 + .name = "nist_521", 125 + .nbits = 521, 126 + .g = { 127 + .x = nist_p521_g_x, 128 + .y = nist_p521_g_y, 129 + .ndigits = 9, 130 + }, 131 + .p = nist_p521_p, 132 + .n = nist_p521_n, 133 + .a = nist_p521_a, 134 + .b = nist_p521_b 135 + }; 136 + 92 137 /* curve25519 */ 93 138 static u64 curve25519_g_x[] = { 0x0000000000000009, 0x0000000000000000, 94 139 0x0000000000000000, 0x0000000000000000 };
+1
include/crypto/ecdh.h
··· 26 26 #define ECC_CURVE_NIST_P192 0x0001 27 27 #define ECC_CURVE_NIST_P256 0x0002 28 28 #define ECC_CURVE_NIST_P384 0x0003 29 + #define ECC_CURVE_NIST_P521 0x0004 29 30 30 31 /** 31 32 * struct ecdh - define an ECDH private key