diff options
author | tb <> | 2025-05-04 04:57:48 +0000 |
---|---|---|
committer | tb <> | 2025-05-04 04:57:48 +0000 |
commit | b7999bdfe03c80fde52ed4c185355cdf26bdb5d1 (patch) | |
tree | d3f5cd4a4f63ab080ec9eb6f17b77228fe335a19 /src | |
parent | 0f1927e6626d035e229dbec3b265edf9d94485d1 (diff) | |
download | openbsd-b7999bdfe03c80fde52ed4c185355cdf26bdb5d1.tar.gz openbsd-b7999bdfe03c80fde52ed4c185355cdf26bdb5d1.tar.bz2 openbsd-b7999bdfe03c80fde52ed4c185355cdf26bdb5d1.zip |
Move P-256 where it belongs
ok jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/ec/ec_curve.c | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/src/lib/libcrypto/ec/ec_curve.c b/src/lib/libcrypto/ec/ec_curve.c index a505ae5026..ec7a4f5390 100644 --- a/src/lib/libcrypto/ec/ec_curve.c +++ b/src/lib/libcrypto/ec/ec_curve.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_curve.c,v 1.55 2025/05/03 10:15:50 tb Exp $ */ | 1 | /* $OpenBSD: ec_curve.c,v 1.56 2025/05/04 04:57:48 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -130,6 +130,57 @@ static const struct { | |||
130 | 130 | ||
131 | static const struct { | 131 | static const struct { |
132 | uint8_t seed[20]; | 132 | uint8_t seed[20]; |
133 | uint8_t p[32]; | ||
134 | uint8_t a[32]; | ||
135 | uint8_t b[32]; | ||
136 | uint8_t x[32]; | ||
137 | uint8_t y[32]; | ||
138 | uint8_t order[32]; | ||
139 | } _EC_NIST_PRIME_256 = { | ||
140 | .seed = { | ||
141 | 0xc4, 0x9d, 0x36, 0x08, 0x86, 0xe7, 0x04, 0x93, 0x6a, 0x66, | ||
142 | 0x78, 0xe1, 0x13, 0x9d, 0x26, 0xb7, 0x81, 0x9f, 0x7e, 0x90, | ||
143 | }, | ||
144 | .p = { | ||
145 | 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, | ||
146 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
147 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
148 | 0xff, 0xff, | ||
149 | }, | ||
150 | .a = { | ||
151 | 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, | ||
152 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
153 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
154 | 0xff, 0xfc, | ||
155 | }, | ||
156 | .b = { | ||
157 | 0x5a, 0xc6, 0x35, 0xd8, 0xaa, 0x3a, 0x93, 0xe7, 0xb3, 0xeb, | ||
158 | 0xbd, 0x55, 0x76, 0x98, 0x86, 0xbc, 0x65, 0x1d, 0x06, 0xb0, | ||
159 | 0xcc, 0x53, 0xb0, 0xf6, 0x3b, 0xce, 0x3c, 0x3e, 0x27, 0xd2, | ||
160 | 0x60, 0x4b, | ||
161 | }, | ||
162 | .x = { | ||
163 | 0x6b, 0x17, 0xd1, 0xf2, 0xe1, 0x2c, 0x42, 0x47, 0xf8, 0xbc, | ||
164 | 0xe6, 0xe5, 0x63, 0xa4, 0x40, 0xf2, 0x77, 0x03, 0x7d, 0x81, | ||
165 | 0x2d, 0xeb, 0x33, 0xa0, 0xf4, 0xa1, 0x39, 0x45, 0xd8, 0x98, | ||
166 | 0xc2, 0x96, | ||
167 | }, | ||
168 | .y = { | ||
169 | 0x4f, 0xe3, 0x42, 0xe2, 0xfe, 0x1a, 0x7f, 0x9b, 0x8e, 0xe7, | ||
170 | 0xeb, 0x4a, 0x7c, 0x0f, 0x9e, 0x16, 0x2b, 0xce, 0x33, 0x57, | ||
171 | 0x6b, 0x31, 0x5e, 0xce, 0xcb, 0xb6, 0x40, 0x68, 0x37, 0xbf, | ||
172 | 0x51, 0xf5, | ||
173 | }, | ||
174 | .order = { | ||
175 | 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, | ||
176 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbc, 0xe6, 0xfa, 0xad, | ||
177 | 0xa7, 0x17, 0x9e, 0x84, 0xf3, 0xb9, 0xca, 0xc2, 0xfc, 0x63, | ||
178 | 0x25, 0x51, | ||
179 | }, | ||
180 | }; | ||
181 | |||
182 | static const struct { | ||
183 | uint8_t seed[20]; | ||
133 | uint8_t p[48]; | 184 | uint8_t p[48]; |
134 | uint8_t a[48]; | 185 | uint8_t a[48]; |
135 | uint8_t b[48]; | 186 | uint8_t b[48]; |
@@ -390,57 +441,6 @@ static const struct { | |||
390 | }; | 441 | }; |
391 | 442 | ||
392 | static const struct { | 443 | static const struct { |
393 | uint8_t seed[20]; | ||
394 | uint8_t p[32]; | ||
395 | uint8_t a[32]; | ||
396 | uint8_t b[32]; | ||
397 | uint8_t x[32]; | ||
398 | uint8_t y[32]; | ||
399 | uint8_t order[32]; | ||
400 | } _EC_X9_62_PRIME_256V1 = { | ||
401 | .seed = { | ||
402 | 0xc4, 0x9d, 0x36, 0x08, 0x86, 0xe7, 0x04, 0x93, 0x6a, 0x66, | ||
403 | 0x78, 0xe1, 0x13, 0x9d, 0x26, 0xb7, 0x81, 0x9f, 0x7e, 0x90, | ||
404 | }, | ||
405 | .p = { | ||
406 | 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, | ||
407 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
408 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
409 | 0xff, 0xff, | ||
410 | }, | ||
411 | .a = { | ||
412 | 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, | ||
413 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
414 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
415 | 0xff, 0xfc, | ||
416 | }, | ||
417 | .b = { | ||
418 | 0x5a, 0xc6, 0x35, 0xd8, 0xaa, 0x3a, 0x93, 0xe7, 0xb3, 0xeb, | ||
419 | 0xbd, 0x55, 0x76, 0x98, 0x86, 0xbc, 0x65, 0x1d, 0x06, 0xb0, | ||
420 | 0xcc, 0x53, 0xb0, 0xf6, 0x3b, 0xce, 0x3c, 0x3e, 0x27, 0xd2, | ||
421 | 0x60, 0x4b, | ||
422 | }, | ||
423 | .x = { | ||
424 | 0x6b, 0x17, 0xd1, 0xf2, 0xe1, 0x2c, 0x42, 0x47, 0xf8, 0xbc, | ||
425 | 0xe6, 0xe5, 0x63, 0xa4, 0x40, 0xf2, 0x77, 0x03, 0x7d, 0x81, | ||
426 | 0x2d, 0xeb, 0x33, 0xa0, 0xf4, 0xa1, 0x39, 0x45, 0xd8, 0x98, | ||
427 | 0xc2, 0x96, | ||
428 | }, | ||
429 | .y = { | ||
430 | 0x4f, 0xe3, 0x42, 0xe2, 0xfe, 0x1a, 0x7f, 0x9b, 0x8e, 0xe7, | ||
431 | 0xeb, 0x4a, 0x7c, 0x0f, 0x9e, 0x16, 0x2b, 0xce, 0x33, 0x57, | ||
432 | 0x6b, 0x31, 0x5e, 0xce, 0xcb, 0xb6, 0x40, 0x68, 0x37, 0xbf, | ||
433 | 0x51, 0xf5, | ||
434 | }, | ||
435 | .order = { | ||
436 | 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, | ||
437 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbc, 0xe6, 0xfa, 0xad, | ||
438 | 0xa7, 0x17, 0x9e, 0x84, 0xf3, 0xb9, 0xca, 0xc2, 0xfc, 0x63, | ||
439 | 0x25, 0x51, | ||
440 | }, | ||
441 | }; | ||
442 | |||
443 | static const struct { | ||
444 | uint8_t p[29]; | 444 | uint8_t p[29]; |
445 | uint8_t a[29]; | 445 | uint8_t a[29]; |
446 | uint8_t b[29]; | 446 | uint8_t b[29]; |
@@ -1121,7 +1121,21 @@ static const struct ec_curve { | |||
1121 | .order = _EC_SECG_PRIME_256K1.order, | 1121 | .order = _EC_SECG_PRIME_256K1.order, |
1122 | .cofactor = 1, | 1122 | .cofactor = 1, |
1123 | }, | 1123 | }, |
1124 | /* SECG secp256r1 is the same as X9.62 prime256v1 and hence omitted */ | 1124 | { |
1125 | /* Everyone except OpenSSL calls this secp256r1 or P-256. */ | ||
1126 | .comment = "X9.62/SECG curve prime256v1", | ||
1127 | .nid = NID_X9_62_prime256v1, | ||
1128 | .seed_len = sizeof(_EC_NIST_PRIME_256.seed), | ||
1129 | .param_len = sizeof(_EC_NIST_PRIME_256.p), | ||
1130 | .seed = _EC_NIST_PRIME_256.seed, | ||
1131 | .p = _EC_NIST_PRIME_256.p, | ||
1132 | .a = _EC_NIST_PRIME_256.a, | ||
1133 | .b = _EC_NIST_PRIME_256.b, | ||
1134 | .x = _EC_NIST_PRIME_256.x, | ||
1135 | .y = _EC_NIST_PRIME_256.y, | ||
1136 | .order = _EC_NIST_PRIME_256.order, | ||
1137 | .cofactor = 1, | ||
1138 | }, | ||
1125 | { | 1139 | { |
1126 | .comment = "NIST/SECG curve secp384r1", | 1140 | .comment = "NIST/SECG curve secp384r1", |
1127 | .nid = NID_secp384r1, | 1141 | .nid = NID_secp384r1, |
@@ -1193,20 +1207,6 @@ static const struct ec_curve { | |||
1193 | .order = _EC_X9_62_PRIME_239V3.order, | 1207 | .order = _EC_X9_62_PRIME_239V3.order, |
1194 | .cofactor = 1, | 1208 | .cofactor = 1, |
1195 | }, | 1209 | }, |
1196 | { | ||
1197 | .comment = "X9.62/SECG curve prime256v1", | ||
1198 | .nid = NID_X9_62_prime256v1, | ||
1199 | .seed_len = sizeof(_EC_X9_62_PRIME_256V1.seed), | ||
1200 | .param_len = sizeof(_EC_X9_62_PRIME_256V1.p), | ||
1201 | .seed = _EC_X9_62_PRIME_256V1.seed, | ||
1202 | .p = _EC_X9_62_PRIME_256V1.p, | ||
1203 | .a = _EC_X9_62_PRIME_256V1.a, | ||
1204 | .b = _EC_X9_62_PRIME_256V1.b, | ||
1205 | .x = _EC_X9_62_PRIME_256V1.x, | ||
1206 | .y = _EC_X9_62_PRIME_256V1.y, | ||
1207 | .order = _EC_X9_62_PRIME_256V1.order, | ||
1208 | .cofactor = 1, | ||
1209 | }, | ||
1210 | /* RFC 5639 curves */ | 1210 | /* RFC 5639 curves */ |
1211 | { | 1211 | { |
1212 | .comment = "RFC 5639 curve brainpoolP224r1", | 1212 | .comment = "RFC 5639 curve brainpoolP224r1", |