From: tb Date: Mon, 1 May 2023 07:56:05 +0000 (+0000) Subject: Mechanically convert curve_list[] to C99 initializers X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=978dd0cb7cdd69e8864a251725c3007b2613343b;p=openbsd Mechanically convert curve_list[] to C99 initializers ok jsing --- diff --git a/lib/libcrypto/ec/ec_curve.c b/lib/libcrypto/ec/ec_curve.c index 56959941f8a..1af7db55a83 100644 --- a/lib/libcrypto/ec/ec_curve.c +++ b/lib/libcrypto/ec/ec_curve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_curve.c,v 1.28 2023/05/01 07:54:08 tb Exp $ */ +/* $OpenBSD: ec_curve.c,v 1.29 2023/05/01 07:56:05 tb Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -1826,67 +1826,337 @@ typedef struct _ec_list_element_st { static const ec_list_element curve_list[] = { /* prime field curves */ /* secg curves */ - {NID_secp112r1, &_EC_SECG_PRIME_112R1.h, 0, "SECG/WTLS curve over a 112 bit prime field"}, - {NID_secp112r2, &_EC_SECG_PRIME_112R2.h, 0, "SECG curve over a 112 bit prime field"}, - {NID_secp128r1, &_EC_SECG_PRIME_128R1.h, 0, "SECG curve over a 128 bit prime field"}, - {NID_secp128r2, &_EC_SECG_PRIME_128R2.h, 0, "SECG curve over a 128 bit prime field"}, - {NID_secp160k1, &_EC_SECG_PRIME_160K1.h, 0, "SECG curve over a 160 bit prime field"}, - {NID_secp160r1, &_EC_SECG_PRIME_160R1.h, 0, "SECG curve over a 160 bit prime field"}, - {NID_secp160r2, &_EC_SECG_PRIME_160R2.h, 0, "SECG/WTLS curve over a 160 bit prime field"}, + { + .nid = NID_secp112r1, + .data = &_EC_SECG_PRIME_112R1.h, + .meth = 0, + .comment = "SECG/WTLS curve over a 112 bit prime field", + }, + { + .nid = NID_secp112r2, + .data = &_EC_SECG_PRIME_112R2.h, + .meth = 0, + .comment = "SECG curve over a 112 bit prime field", + }, + { + .nid = NID_secp128r1, + .data = &_EC_SECG_PRIME_128R1.h, + .meth = 0, + .comment = "SECG curve over a 128 bit prime field", + }, + { + .nid = NID_secp128r2, + .data = &_EC_SECG_PRIME_128R2.h, + .meth = 0, + .comment = "SECG curve over a 128 bit prime field", + }, + { + .nid = NID_secp160k1, + .data = &_EC_SECG_PRIME_160K1.h, + .meth = 0, + .comment = "SECG curve over a 160 bit prime field", + }, + { + .nid = NID_secp160r1, + .data = &_EC_SECG_PRIME_160R1.h, + .meth = 0, + .comment = "SECG curve over a 160 bit prime field", + }, + { + .nid = NID_secp160r2, + .data = &_EC_SECG_PRIME_160R2.h, + .meth = 0, + .comment = "SECG/WTLS curve over a 160 bit prime field", + }, /* SECG secp192r1 is the same as X9.62 prime192v1 and hence omitted */ - {NID_secp192k1, &_EC_SECG_PRIME_192K1.h, 0, "SECG curve over a 192 bit prime field"}, - {NID_secp224k1, &_EC_SECG_PRIME_224K1.h, 0, "SECG curve over a 224 bit prime field"}, - {NID_secp224r1, &_EC_NIST_PRIME_224.h, 0, "NIST/SECG curve over a 224 bit prime field"}, - {NID_secp256k1, &_EC_SECG_PRIME_256K1.h, 0, "SECG curve over a 256 bit prime field"}, + { + .nid = NID_secp192k1, + .data = &_EC_SECG_PRIME_192K1.h, + .meth = 0, + .comment = "SECG curve over a 192 bit prime field", + }, + { + .nid = NID_secp224k1, + .data = &_EC_SECG_PRIME_224K1.h, + .meth = 0, + .comment = "SECG curve over a 224 bit prime field", + }, + { + .nid = NID_secp224r1, + .data = &_EC_NIST_PRIME_224.h, + .meth = 0, + .comment = "NIST/SECG curve over a 224 bit prime field", + }, + { + .nid = NID_secp256k1, + .data = &_EC_SECG_PRIME_256K1.h, + .meth = 0, + .comment = "SECG curve over a 256 bit prime field", + }, /* SECG secp256r1 is the same as X9.62 prime256v1 and hence omitted */ - {NID_secp384r1, &_EC_NIST_PRIME_384.h, 0, "NIST/SECG curve over a 384 bit prime field"}, - {NID_secp521r1, &_EC_NIST_PRIME_521.h, 0, "NIST/SECG curve over a 521 bit prime field"}, + { + .nid = NID_secp384r1, + .data = &_EC_NIST_PRIME_384.h, + .meth = 0, + .comment = "NIST/SECG curve over a 384 bit prime field", + }, + { + .nid = NID_secp521r1, + .data = &_EC_NIST_PRIME_521.h, + .meth = 0, + .comment = "NIST/SECG curve over a 521 bit prime field", + }, /* X9.62 curves */ - {NID_X9_62_prime192v1, &_EC_NIST_PRIME_192.h, 0, "NIST/X9.62/SECG curve over a 192 bit prime field"}, - {NID_X9_62_prime192v2, &_EC_X9_62_PRIME_192V2.h, 0, "X9.62 curve over a 192 bit prime field"}, - {NID_X9_62_prime192v3, &_EC_X9_62_PRIME_192V3.h, 0, "X9.62 curve over a 192 bit prime field"}, - {NID_X9_62_prime239v1, &_EC_X9_62_PRIME_239V1.h, 0, "X9.62 curve over a 239 bit prime field"}, - {NID_X9_62_prime239v2, &_EC_X9_62_PRIME_239V2.h, 0, "X9.62 curve over a 239 bit prime field"}, - {NID_X9_62_prime239v3, &_EC_X9_62_PRIME_239V3.h, 0, "X9.62 curve over a 239 bit prime field"}, - {NID_X9_62_prime256v1, &_EC_X9_62_PRIME_256V1.h, 0, "X9.62/SECG curve over a 256 bit prime field"}, - {NID_wap_wsg_idm_ecid_wtls6, &_EC_SECG_PRIME_112R1.h, 0, "SECG/WTLS curve over a 112 bit prime field"}, - {NID_wap_wsg_idm_ecid_wtls7, &_EC_SECG_PRIME_160R2.h, 0, "SECG/WTLS curve over a 160 bit prime field"}, - {NID_wap_wsg_idm_ecid_wtls8, &_EC_WTLS_8.h, 0, "WTLS curve over a 112 bit prime field"}, - {NID_wap_wsg_idm_ecid_wtls9, &_EC_WTLS_9.h, 0, "WTLS curve over a 160 bit prime field"}, - {NID_wap_wsg_idm_ecid_wtls12, &_EC_WTLS_12.h, 0, "WTLS curve over a 224 bit prime field"}, + { + .nid = NID_X9_62_prime192v1, + .data = &_EC_NIST_PRIME_192.h, + .meth = 0, + .comment = "NIST/X9.62/SECG curve over a 192 bit prime field", + }, + { + .nid = NID_X9_62_prime192v2, + .data = &_EC_X9_62_PRIME_192V2.h, + .meth = 0, + .comment = "X9.62 curve over a 192 bit prime field", + }, + { + .nid = NID_X9_62_prime192v3, + .data = &_EC_X9_62_PRIME_192V3.h, + .meth = 0, + .comment = "X9.62 curve over a 192 bit prime field", + }, + { + .nid = NID_X9_62_prime239v1, + .data = &_EC_X9_62_PRIME_239V1.h, + .meth = 0, + .comment = "X9.62 curve over a 239 bit prime field", + }, + { + .nid = NID_X9_62_prime239v2, + .data = &_EC_X9_62_PRIME_239V2.h, + .meth = 0, + .comment = "X9.62 curve over a 239 bit prime field", + }, + { + .nid = NID_X9_62_prime239v3, + .data = &_EC_X9_62_PRIME_239V3.h, + .meth = 0, + .comment = "X9.62 curve over a 239 bit prime field", + }, + { + .nid = NID_X9_62_prime256v1, + .data = &_EC_X9_62_PRIME_256V1.h, + .meth = 0, + .comment = "X9.62/SECG curve over a 256 bit prime field", + }, + { + .nid = NID_wap_wsg_idm_ecid_wtls6, + .data = &_EC_SECG_PRIME_112R1.h, + .meth = 0, + .comment = "SECG/WTLS curve over a 112 bit prime field", + }, + { + .nid = NID_wap_wsg_idm_ecid_wtls7, + .data = &_EC_SECG_PRIME_160R2.h, + .meth = 0, + .comment = "SECG/WTLS curve over a 160 bit prime field", + }, + { + .nid = NID_wap_wsg_idm_ecid_wtls8, + .data = &_EC_WTLS_8.h, + .meth = 0, + .comment = "WTLS curve over a 112 bit prime field", + }, + { + .nid = NID_wap_wsg_idm_ecid_wtls9, + .data = &_EC_WTLS_9.h, + .meth = 0, + .comment = "WTLS curve over a 160 bit prime field", + }, + { + .nid = NID_wap_wsg_idm_ecid_wtls12, + .data = &_EC_WTLS_12.h, + .meth = 0, + .comment = "WTLS curve over a 224 bit prime field", + }, /* RFC 5639 curves */ - {NID_brainpoolP160r1, &_EC_brainpoolP160r1.h, 0, "RFC 5639 curve over a 160 bit prime field"}, - {NID_brainpoolP160t1, &_EC_brainpoolP160t1.h, 0, "RFC 5639 curve over a 160 bit prime field"}, - {NID_brainpoolP192r1, &_EC_brainpoolP192r1.h, 0, "RFC 5639 curve over a 192 bit prime field"}, - {NID_brainpoolP192t1, &_EC_brainpoolP192t1.h, 0, "RFC 5639 curve over a 192 bit prime field"}, - {NID_brainpoolP224r1, &_EC_brainpoolP224r1.h, 0, "RFC 5639 curve over a 224 bit prime field"}, - {NID_brainpoolP224t1, &_EC_brainpoolP224t1.h, 0, "RFC 5639 curve over a 224 bit prime field"}, - {NID_brainpoolP256r1, &_EC_brainpoolP256r1.h, 0, "RFC 5639 curve over a 256 bit prime field"}, - {NID_brainpoolP256t1, &_EC_brainpoolP256t1.h, 0, "RFC 5639 curve over a 256 bit prime field"}, - {NID_brainpoolP320r1, &_EC_brainpoolP320r1.h, 0, "RFC 5639 curve over a 320 bit prime field"}, - {NID_brainpoolP320t1, &_EC_brainpoolP320t1.h, 0, "RFC 5639 curve over a 320 bit prime field"}, - {NID_brainpoolP384r1, &_EC_brainpoolP384r1.h, 0, "RFC 5639 curve over a 384 bit prime field"}, - {NID_brainpoolP384t1, &_EC_brainpoolP384t1.h, 0, "RFC 5639 curve over a 384 bit prime field"}, - {NID_brainpoolP512r1, &_EC_brainpoolP512r1.h, 0, "RFC 5639 curve over a 512 bit prime field"}, - {NID_brainpoolP512t1, &_EC_brainpoolP512t1.h, 0, "RFC 5639 curve over a 512 bit prime field"}, + { + .nid = NID_brainpoolP160r1, + .data = &_EC_brainpoolP160r1.h, + .meth = 0, + .comment = "RFC 5639 curve over a 160 bit prime field", + }, + { + .nid = NID_brainpoolP160t1, + .data = &_EC_brainpoolP160t1.h, + .meth = 0, + .comment = "RFC 5639 curve over a 160 bit prime field", + }, + { + .nid = NID_brainpoolP192r1, + .data = &_EC_brainpoolP192r1.h, + .meth = 0, + .comment = "RFC 5639 curve over a 192 bit prime field", + }, + { + .nid = NID_brainpoolP192t1, + .data = &_EC_brainpoolP192t1.h, + .meth = 0, + .comment = "RFC 5639 curve over a 192 bit prime field", + }, + { + .nid = NID_brainpoolP224r1, + .data = &_EC_brainpoolP224r1.h, + .meth = 0, + .comment = "RFC 5639 curve over a 224 bit prime field", + }, + { + .nid = NID_brainpoolP224t1, + .data = &_EC_brainpoolP224t1.h, + .meth = 0, + .comment = "RFC 5639 curve over a 224 bit prime field", + }, + { + .nid = NID_brainpoolP256r1, + .data = &_EC_brainpoolP256r1.h, + .meth = 0, + .comment = "RFC 5639 curve over a 256 bit prime field", + }, + { + .nid = NID_brainpoolP256t1, + .data = &_EC_brainpoolP256t1.h, + .meth = 0, + .comment = "RFC 5639 curve over a 256 bit prime field", + }, + { + .nid = NID_brainpoolP320r1, + .data = &_EC_brainpoolP320r1.h, + .meth = 0, + .comment = "RFC 5639 curve over a 320 bit prime field", + }, + { + .nid = NID_brainpoolP320t1, + .data = &_EC_brainpoolP320t1.h, + .meth = 0, + .comment = "RFC 5639 curve over a 320 bit prime field", + }, + { + .nid = NID_brainpoolP384r1, + .data = &_EC_brainpoolP384r1.h, + .meth = 0, + .comment = "RFC 5639 curve over a 384 bit prime field", + }, + { + .nid = NID_brainpoolP384t1, + .data = &_EC_brainpoolP384t1.h, + .meth = 0, + .comment = "RFC 5639 curve over a 384 bit prime field", + }, + { + .nid = NID_brainpoolP512r1, + .data = &_EC_brainpoolP512r1.h, + .meth = 0, + .comment = "RFC 5639 curve over a 512 bit prime field", + }, + { + .nid = NID_brainpoolP512t1, + .data = &_EC_brainpoolP512t1.h, + .meth = 0, + .comment = "RFC 5639 curve over a 512 bit prime field", + }, /* ANSSI */ - {NID_FRP256v1, &_EC_FRP256v1.h, 0, "FRP256v1"}, + { + .nid = NID_FRP256v1, + .data = &_EC_FRP256v1.h, + .meth = 0, + .comment = "FRP256v1", + }, #ifndef OPENSSL_NO_GOST /* GOST R 34.10-2001 */ - {NID_id_GostR3410_2001_TestParamSet, &_EC_GOST_2001_Test.h, 0, "GOST R 34.10-2001 Test Curve"}, - {NID_id_GostR3410_2001_CryptoPro_A_ParamSet, &_EC_GOST_2001_CryptoPro_A.h, 0, "GOST R 34.10-2001 CryptoPro-A"}, - {NID_id_GostR3410_2001_CryptoPro_B_ParamSet, &_EC_GOST_2001_CryptoPro_B.h, 0, "GOST R 34.10-2001 CryptoPro-B"}, - {NID_id_GostR3410_2001_CryptoPro_C_ParamSet, &_EC_GOST_2001_CryptoPro_C.h, 0, "GOST R 34.10-2001 CryptoPro-C"}, - {NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet, &_EC_GOST_2001_CryptoPro_A.h, 0, "GOST R 34.10-2001 CryptoPro-XchA"}, - {NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet, &_EC_GOST_2001_CryptoPro_C.h, 0, "GOST R 34.10-2001 CryptoPro-XchB"}, - {NID_id_tc26_gost_3410_12_256_paramSetA, &_EC_GOST_2012_256_TC26_A.h, 0, "GOST R 34.10-2012 256 TC26-A"}, - {NID_id_tc26_gost_3410_12_256_paramSetB, &_EC_GOST_2001_CryptoPro_A.h, 0, "GOST R 34.10-2012 256 TC26-B"}, - {NID_id_tc26_gost_3410_12_256_paramSetC, &_EC_GOST_2001_CryptoPro_B.h, 0, "GOST R 34.10-2012 256 TC26-C"}, - {NID_id_tc26_gost_3410_12_256_paramSetD, &_EC_GOST_2001_CryptoPro_C.h, 0, "GOST R 34.10-2012 256 TC26-D"}, - {NID_id_tc26_gost_3410_12_512_paramSetTest, &_EC_GOST_2012_512_Test.h, 0, "GOST R 34.10-2012 512 Test Curve"}, - {NID_id_tc26_gost_3410_12_512_paramSetA, &_EC_GOST_2012_512_TC26_A.h, 0, "GOST R 34.10-2012 512 TC26-A"}, - {NID_id_tc26_gost_3410_12_512_paramSetB, &_EC_GOST_2012_512_TC26_B.h, 0, "GOST R 34.10-2012 512 TC26-B"}, - {NID_id_tc26_gost_3410_12_512_paramSetC, &_EC_GOST_2012_512_TC26_C.h, 0, "GOST R 34.10-2012 512 TC26-C"}, + { + .nid = NID_id_GostR3410_2001_TestParamSet, + .data = &_EC_GOST_2001_Test.h, + .meth = 0, + .comment = "GOST R 34.10-2001 Test Curve", + }, + { + .nid = NID_id_GostR3410_2001_CryptoPro_A_ParamSet, + .data = &_EC_GOST_2001_CryptoPro_A.h, + .meth = 0, + .comment = "GOST R 34.10-2001 CryptoPro-A", + }, + { + .nid = NID_id_GostR3410_2001_CryptoPro_B_ParamSet, + .data = &_EC_GOST_2001_CryptoPro_B.h, + .meth = 0, + .comment = "GOST R 34.10-2001 CryptoPro-B", + }, + { + .nid = NID_id_GostR3410_2001_CryptoPro_C_ParamSet, + .data = &_EC_GOST_2001_CryptoPro_C.h, + .meth = 0, + .comment = "GOST R 34.10-2001 CryptoPro-C", + }, + { + .nid = NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet, + .data = &_EC_GOST_2001_CryptoPro_A.h, + .meth = 0, + .comment = "GOST R 34.10-2001 CryptoPro-XchA", + }, + { + .nid = NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet, + .data = &_EC_GOST_2001_CryptoPro_C.h, + .meth = 0, + .comment = "GOST R 34.10-2001 CryptoPro-XchB", + }, + { + .nid = NID_id_tc26_gost_3410_12_256_paramSetA, + .data = &_EC_GOST_2012_256_TC26_A.h, + .meth = 0, + .comment = "GOST R 34.10-2012 256 TC26-A", + }, + { + .nid = NID_id_tc26_gost_3410_12_256_paramSetB, + .data = &_EC_GOST_2001_CryptoPro_A.h, + .meth = 0, + .comment = "GOST R 34.10-2012 256 TC26-B", + }, + { + .nid = NID_id_tc26_gost_3410_12_256_paramSetC, + .data = &_EC_GOST_2001_CryptoPro_B.h, + .meth = 0, + .comment = "GOST R 34.10-2012 256 TC26-C", + }, + { + .nid = NID_id_tc26_gost_3410_12_256_paramSetD, + .data = &_EC_GOST_2001_CryptoPro_C.h, + .meth = 0, + .comment = "GOST R 34.10-2012 256 TC26-D", + }, + { + .nid = NID_id_tc26_gost_3410_12_512_paramSetTest, + .data = &_EC_GOST_2012_512_Test.h, + .meth = 0, + .comment = "GOST R 34.10-2012 512 Test Curve", + }, + { + .nid = NID_id_tc26_gost_3410_12_512_paramSetA, + .data = &_EC_GOST_2012_512_TC26_A.h, + .meth = 0, + .comment = "GOST R 34.10-2012 512 TC26-A", + }, + { + .nid = NID_id_tc26_gost_3410_12_512_paramSetB, + .data = &_EC_GOST_2012_512_TC26_B.h, + .meth = 0, + .comment = "GOST R 34.10-2012 512 TC26-B", + }, + { + .nid = NID_id_tc26_gost_3410_12_512_paramSetC, + .data = &_EC_GOST_2012_512_TC26_C.h, + .meth = 0, + .comment = "GOST R 34.10-2012 512 TC26-C", + }, #endif };