diff options
author | Bodo Möller <bodo@openssl.org> | 2002-08-15 09:21:31 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2002-08-15 09:21:31 +0000 |
commit | 7eb18f1237f517d7072c6d5d4602b68c8e0a1a21 (patch) | |
tree | 540d2a01ec526fdc3429275b87b95678661da158 | |
parent | 265e892fede07013088e383bc630b8186c8b6e7c (diff) |
Simplify handling of named curves: get rid of EC_GROUP_new_by_name(),
EC_GROUP_new_by_nid() should be enough. This avoids a lot of
redundancy.
Submitted by: Nils Larsch
-rw-r--r-- | CHANGES | 3 | ||||
-rw-r--r-- | apps/ecparam.c | 103 | ||||
-rw-r--r-- | apps/s_server.c | 2 | ||||
-rw-r--r-- | apps/speed.c | 30 | ||||
-rw-r--r-- | crypto/ec/Makefile.ssl | 11 | ||||
-rw-r--r-- | crypto/ec/ec.h | 234 | ||||
-rw-r--r-- | crypto/ec/ec_asn1.c | 2 | ||||
-rw-r--r-- | crypto/ec/ec_curve.c | 1849 | ||||
-rw-r--r-- | crypto/ec/ec_err.c | 17 | ||||
-rw-r--r-- | crypto/ecdh/ecdhtest.c | 32 | ||||
-rw-r--r-- | crypto/ecdsa/ecdsatest.c | 36 | ||||
-rwxr-xr-x | util/libeay.num | 13 |
12 files changed, 1271 insertions, 1061 deletions
@@ -233,9 +233,8 @@ TODO: bug: pad x with leading zeros if necessary *) Include some named elliptic curves, and add OIDs from X9.62, SECG, and WAP/WTLS. The curves can be obtained from the new - functions + function EC_GROUP_new_by_nid() - EC_GROUP_new_by_name() Also add a 'curve_name' member to EC_GROUP objects, which can be accessed via EC_GROUP_set_nid() diff --git a/apps/ecparam.c b/apps/ecparam.c index 228791decd..f7f2fafead 100644 --- a/apps/ecparam.c +++ b/apps/ecparam.c @@ -1,6 +1,6 @@ /* apps/ecparam.c */ /* - * Originally written by Nils Larsch for the OpenSSL project. + * Written by Nils Larsch for the OpenSSL project. */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. @@ -92,9 +92,6 @@ #include <openssl/err.h> #include <openssl/bn.h> #include <openssl/ec.h> -#ifndef OPENSSL_NO_ECDSA -#include <openssl/ecdsa.h> -#endif #include <openssl/x509.h> #include <openssl/pem.h> @@ -123,80 +120,11 @@ * explicit * -no_seed - if 'explicit' parameters are choosen do not * use the seed - * -genkey - generates a ecdsa private key + * -genkey - generates a ec private key * -rand file * -engine e - use engine e, possible a hardware device */ -static const char *curve_list[67] = { - "prime192v1 - 192 bit prime curve from the X9.62 draft", - "prime192v2 - 192 bit prime curve from the X9.62 draft", - "prime192v3 - 192 bit prime curve from the X9.62 draft", - "prime239v1 - 239 bit prime curve from the X9.62 draft", - "prime239v2 - 239 bit prime curve from the X9.62 draft", - "prime239v3 - 239 bit prime curve from the X9.62 draft", - "prime256v1 - 256 bit prime curve from the X9.62 draft", - "secp112r1 - SECG recommended curve over a 112 bit prime field", - "secp112r2 - SECG recommended curve over a 112 bit prime field", - "secp128r1 - SECG recommended curve over a 128 bit prime field", - "secp128r2 - SECG recommended curve over a 128 bit prime field", - "secp160k1 - SECG recommended curve over a 160 bit prime field", - "secp160r1 - SECG recommended curve over a 160 bit prime field", - "secp160r2 - SECG recommended curve over a 160 bit prime field", - "secp192k1 - SECG recommended curve over a 192 bit prime field", - "prime192v1 - SECG recommended curve over a 192 bit prime field (aka secp192r1)", - "secp224k1 - SECG recommended curve over a 224 bit prime field", - "secp224r1 - SECG/NIST recommended curve over a 224 bit prime field", - "secp256k1 - SECG recommended curve over a 256 bit prime field", - "prime256v1 - SECG recommended curve over a 256 bit prime field (aka secp256r1)", - "secp384r1 - SECG/NIST recommended curve over a 384 bit prime field", - "secp521r1 - SECG/NIST recommended curve over a 521 bit prime field", - "wap-wsg-idm-ecid-wtls6 - 112 bit prime curve from the WTLS standard", - "wap-wsg-idm-ecid-wtls8 - 112 bit prime curve from the WTLS standard", - "wap-wsg-idm-ecid-wtls7 - 160 bit prime curve from the WTLS standard", - "wap-wsg-idm-ecid-wtls9 - 160 bit prime curve from the WTLS standard", - "wap-wsg-idm-ecid-wtls12 - 224 bit prime curve from the WTLS standard", - "c2pnb163v1 - 163 bit binary curve from the X9.62 draft", - "c2pnb163v2 - 163 bit binary curve from the X9.62 draft", - "c2pnb163v3 - 163 bit binary curve from the X9.62 draft", - "c2pnb176v1 - 176 bit binary curve from the X9.62 draft", - "c2tnb191v1 - 191 bit binary curve from the X9.62 draft", - "c2tnb191v2 - 191 bit binary curve from the X9.62 draft", - "c2tnb191v3 - 191 bit binary curve from the X9.62 draft", - "c2pnb208w1 - 208 bit binary curve from the X9.62 draft", - "c2tnb239v1 - 239 bit binary curve from the X9.62 draft", - "c2tnb239v2 - 239 bit binary curve from the X9.62 draft", - "c2tnb239v3 - 239 bit binary curve from the X9.62 draft", - "c2pnb272w1 - 272 bit binary curve from the X9.62 draft", - "c2pnb304w1 - 304 bit binary curve from the X9.62 draft", - "c2tnb359v1 - 359 bit binary curve from the X9.62 draft", - "c2pnb368w1 - 368 bit binary curve from the X9.62 draft", - "c2tnb431r1 - 431 bit binary curve from the X9.62 draft", - "sect113r1 - SECG recommended curve over a 113 bit binary field", - "sect113r2 - SECG recommended curve over a 113 bit binary field", - "sect131r1 - SECG recommended curve over a 131 bit binary field", - "sect131r2 - SECG recommended curve over a 131 bit binary field", - "sect163k1 - SECG/NIST recommended curve over a 163 bit binary field", - "sect163r1 - SECG recommended curve over a 163 bit binary field", - "sect163r2 - SECG/NIST recommended curve over a 163 bit binary field", - "sect193r1 - SECG recommended curve over a 193 bit binary field", - "sect193r2 - SECG recommended curve over a 193 bit binary field", - "sect233k1 - SECG/NIST recommended curve over a 233 bit binary field", - "sect233r1 - SECG/NIST recommended curve over a 233 bit binary field", - "sect239k1 - SECG recommended curve over a 239 bit binary field", - "sect283k1 - SECG/NIST recommended curve over a 283 bit binary field", - "sect283r1 - SECG/NIST recommended curve over a 283 bit binary field", - "sect409k1 - SECG/NIST recommended curve over a 409 bit binary field", - "sect409r1 - SECG/NIST recommended curve over a 409 bit binary field", - "sect571k1 - SECG/NIST recommended curve over a 571 bit binary field", - "sect571r1 - SECG/NIST recommended curve over a 571 bit binary field", - "wap-wsg-idm-ecid-wtls1 - 113 bit binary curve from the WTLS standard", - "wap-wsg-idm-ecid-wtls4 - 113 bit binary curve from the WTLS standard", - "wap-wsg-idm-ecid-wtls3 - 163 bit binary curve from the WTLS standard", - "wap-wsg-idm-ecid-wtls5 - 163 bit binary curve from the WTLS standard", - "wap-wsg-idm-ecid-wtls10 - 233 bit binary curve from the WTLS standard", - "wap-wsg-idm-ecid-wtls11 - 233 bit binary curve from the WTLS standard" -}; static int ecparam_print_var(BIO *,BIGNUM *,const char *,int,unsigned char *); @@ -376,7 +304,7 @@ bad: BIO_printf(bio_err, " -no_seed if 'explicit'" " parameters are choosen do not\n"); BIO_printf(bio_err, " use the seed\n"); - BIO_printf(bio_err, " -genkey generate ecdsa" + BIO_printf(bio_err, " -genkey generate ec" " key\n"); BIO_printf(bio_err, " -rand file files to use for" " random number input\n"); @@ -430,10 +358,27 @@ bad: { int counter=0; - for (; counter < sizeof(curve_list)/sizeof(char *); counter++) - if (BIO_printf(bio_err, " %s\n", curve_list[counter]) - <= 0) - goto end; + for (;;) + { + const char *comment; + const char *sname; + int len, nid = ec_group_index2nid(counter++); + if (!nid) + break; + comment = EC_GROUP_get0_comment(nid); + sname = OBJ_nid2sn(nid); + if (comment == NULL) + comment = ""; + if (sname == NULL) + sname == ""; + + len = BIO_printf(out, " %-10s: ", sname); + if (len + strlen(comment) > 80) + BIO_printf(out, "\n%80s\n", comment); + else + BIO_printf(out, "%s\n", comment); + } + ret = 0; goto end; } diff --git a/apps/s_server.c b/apps/s_server.c index 828d5ef3a0..725efd3b1e 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -110,7 +110,7 @@ */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. - * ECDH support in OpenSSL originally developed by + * ECC cipher suite support in OpenSSL originally developed by * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. */ diff --git a/apps/speed.c b/apps/speed.c index abcede337e..84e8f98e87 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -559,22 +559,22 @@ int MAIN(int argc, char **argv) static unsigned int test_curves[EC_NUM] = { /* Prime Curves */ - EC_GROUP_SECG_PRIME_160R1, - EC_GROUP_NIST_PRIME_224, - EC_GROUP_NIST_PRIME_256, - EC_GROUP_NIST_PRIME_384, - EC_GROUP_NIST_PRIME_521, + NID_secp160r1, + NID_secp224r1, + NID_X9_62_prime256v1, + NID_secp384r1, + NID_secp521r1, /* Binary Curves */ - EC_GROUP_NIST_CHAR2_K163, - EC_GROUP_NIST_CHAR2_K233, - EC_GROUP_NIST_CHAR2_K283, - EC_GROUP_NIST_CHAR2_K409, - EC_GROUP_NIST_CHAR2_K571, - EC_GROUP_NIST_CHAR2_B163, - EC_GROUP_NIST_CHAR2_B233, - EC_GROUP_NIST_CHAR2_B283, - EC_GROUP_NIST_CHAR2_B409, - EC_GROUP_NIST_CHAR2_B571 + NID_sect163k1, + NID_sect233k1, + NID_sect283k1, + NID_sect409k1, + NID_sect571k1, + NID_sect163r2, + NID_sect233r1, + NID_sect283r1, + NID_sect409r1, + NID_sect571r1 }; static char * test_curves_names[EC_NUM] = { diff --git a/crypto/ec/Makefile.ssl b/crypto/ec/Makefile.ssl index d183f679c4..431a14c8a6 100644 --- a/crypto/ec/Makefile.ssl +++ b/crypto/ec/Makefile.ssl @@ -118,12 +118,11 @@ ec_check.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h ec_check.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h ec_check.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h ec_check.o: ../../include/openssl/symhacks.h ec_check.c ec_lcl.h -ec_curve.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h -ec_curve.o: ../../include/openssl/bio.h ../../include/openssl/bn.h -ec_curve.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h -ec_curve.o: ../../include/openssl/ec.h ../../include/openssl/err.h -ec_curve.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h -ec_curve.o: ../../include/openssl/opensslconf.h +ec_curve.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +ec_curve.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h +ec_curve.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h +ec_curve.o: ../../include/openssl/err.h ../../include/openssl/lhash.h +ec_curve.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h ec_curve.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h ec_curve.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h ec_curve.o: ../../include/openssl/symhacks.h ec_curve.c ec_lcl.h diff --git a/crypto/ec/ec.h b/crypto/ec/ec.h index 17083f23a2..4eb4ad678c 100644 --- a/crypto/ec/ec.h +++ b/crypto/ec/ec.h @@ -182,94 +182,15 @@ int EC_GROUP_check_discriminant(const EC_GROUP *, BN_CTX *); EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *); EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *); -/* EC_GROUP_new_by_nid() and EC_GROUP_new_by_name() also set - * generator and order */ +/* EC_GROUP_new_by_nid() creates a EC_GROUP structure specified by a NID */ EC_GROUP *EC_GROUP_new_by_nid(int nid); -EC_GROUP *EC_GROUP_new_by_name(int name); -/* Currently valid arguments to EC_GROUP_new_by_name() */ -#define EC_GROUP_NO_CURVE 0 -#define EC_GROUP_NIST_PRIME_192 NID_X9_62_prime192v1 -#define EC_GROUP_NIST_PRIME_224 NID_secp224r1 -#define EC_GROUP_NIST_PRIME_256 NID_X9_62_prime256v1 -#define EC_GROUP_NIST_PRIME_384 NID_secp384r1 -#define EC_GROUP_NIST_PRIME_521 NID_secp521r1 -#define EC_GROUP_X9_62_PRIME_192V1 NID_X9_62_prime192v1 -#define EC_GROUP_X9_62_PRIME_192V2 NID_X9_62_prime192v2 -#define EC_GROUP_X9_62_PRIME_192V3 NID_X9_62_prime192v3 -#define EC_GROUP_X9_62_PRIME_239V1 NID_X9_62_prime239v1 -#define EC_GROUP_X9_62_PRIME_239V2 NID_X9_62_prime239v2 -#define EC_GROUP_X9_62_PRIME_239V3 NID_X9_62_prime239v3 -#define EC_GROUP_X9_62_PRIME_256V1 NID_X9_62_prime256v1 -#define EC_GROUP_SECG_PRIME_112R1 NID_secp112r1 -#define EC_GROUP_SECG_PRIME_112R2 NID_secp112r2 -#define EC_GROUP_SECG_PRIME_128R1 NID_secp128r1 -#define EC_GROUP_SECG_PRIME_128R2 NID_secp128r2 -#define EC_GROUP_SECG_PRIME_160K1 NID_secp160k1 -#define EC_GROUP_SECG_PRIME_160R1 NID_secp160r1 -#define EC_GROUP_SECG_PRIME_160R2 NID_secp160r2 -#define EC_GROUP_SECG_PRIME_192K1 NID_secp192k1 -#define EC_GROUP_SECG_PRIME_192R1 NID_X9_62_prime192v1 -#define EC_GROUP_SECG_PRIME_224K1 NID_secp224k1 -#define EC_GROUP_SECG_PRIME_224R1 NID_secp224r1 -#define EC_GROUP_SECG_PRIME_256K1 NID_secp256k1 -#define EC_GROUP_SECG_PRIME_256R1 NID_X9_62_prime256v1 -#define EC_GROUP_SECG_PRIME_384R1 NID_secp384r1 -#define EC_GROUP_SECG_PRIME_521R1 NID_secp521r1 -#define EC_GROUP_WTLS_6 NID_wap_wsg_idm_ecid_wtls6 -#define EC_GROUP_WTLS_7 NID_wap_wsg_idm_ecid_wtls7 -#define EC_GROUP_WTLS_8 NID_wap_wsg_idm_ecid_wtls8 -#define EC_GROUP_WTLS_9 NID_wap_wsg_idm_ecid_wtls9 -#define EC_GROUP_WTLS_12 NID_wap_wsg_idm_ecid_wtls12 -#define EC_GROUP_NIST_CHAR2_K163 NID_sect163k1 -#define EC_GROUP_NIST_CHAR2_B163 NID_sect163r2 -#define EC_GROUP_NIST_CHAR2_K233 NID_sect233k1 -#define EC_GROUP_NIST_CHAR2_B233 NID_sect233r1 -#define EC_GROUP_NIST_CHAR2_K283 NID_sect283k1 -#define EC_GROUP_NIST_CHAR2_B283 NID_sect283r1 -#define EC_GROUP_NIST_CHAR2_K409 NID_sect409k1 -#define EC_GROUP_NIST_CHAR2_B409 NID_sect409r1 -#define EC_GROUP_NIST_CHAR2_K571 NID_sect571k1 -#define EC_GROUP_NIST_CHAR2_B571 NID_sect571r1 -#define EC_GROUP_X9_62_CHAR2_163V1 NID_X9_62_c2pnb163v1 -#define EC_GROUP_X9_62_CHAR2_163V2 NID_X9_62_c2pnb163v2 -#define EC_GROUP_X9_62_CHAR2_163V3 NID_X9_62_c2pnb163v3 -#define EC_GROUP_X9_62_CHAR2_176V1 NID_X9_62_c2pnb176v1 -#define EC_GROUP_X9_62_CHAR2_191V1 NID_X9_62_c2tnb191v1 -#define EC_GROUP_X9_62_CHAR2_191V2 NID_X9_62_c2tnb191v2 -#define EC_GROUP_X9_62_CHAR2_191V3 NID_X9_62_c2tnb191v3 -#define EC_GROUP_X9_62_CHAR2_208W1 NID_X9_62_c2pnb208w1 -#define EC_GROUP_X9_62_CHAR2_239V1 NID_X9_62_c2tnb239v1 -#define EC_GROUP_X9_62_CHAR2_239V2 NID_X9_62_c2tnb239v2 -#define EC_GROUP_X9_62_CHAR2_239V3 NID_X9_62_c2tnb239v3 -#define EC_GROUP_X9_62_CHAR2_272W1 NID_X9_62_c2pnb272w1 -#define EC_GROUP_X9_62_CHAR2_304W1 NID_X9_62_c2pnb304w1 -#define EC_GROUP_X9_62_CHAR2_359V1 NID_X9_62_c2tnb359v1 -#define EC_GROUP_X9_62_CHAR2_368W1 NID_X9_62_c2pnb368w1 -#define EC_GROUP_X9_62_CHAR2_431R1 NID_X9_62_c2tnb431r1 -#define EC_GROUP_SECG_CHAR2_113R1 NID_sect113r1 -#define EC_GROUP_SECG_CHAR2_113R2 NID_sect113r2 -#define EC_GROUP_SECG_CHAR2_131R1 NID_sect131r1 -#define EC_GROUP_SECG_CHAR2_131R2 NID_sect131r2 -#define EC_GROUP_SECG_CHAR2_163K1 NID_sect163k1 -#define EC_GROUP_SECG_CHAR2_163R1 NID_sect163r1 -#define EC_GROUP_SECG_CHAR2_163R2 NID_sect163r2 -#define EC_GROUP_SECG_CHAR2_193R1 NID_sect193r1 -#define EC_GROUP_SECG_CHAR2_193R2 NID_sect193r2 -#define EC_GROUP_SECG_CHAR2_233K1 NID_sect233k1 -#define EC_GROUP_SECG_CHAR2_233R1 NID_sect233r1 -#define EC_GROUP_SECG_CHAR2_239K1 NID_sect239k1 -#define EC_GROUP_SECG_CHAR2_283K1 NID_sect283k1 -#define EC_GROUP_SECG_CHAR2_283R1 NID_sect283r1 -#define EC_GROUP_SECG_CHAR2_409K1 NID_sect409k1 -#define EC_GROUP_SECG_CHAR2_409R1 NID_sect409r1 -#define EC_GROUP_SECG_CHAR2_571K1 NID_sect571k1 -#define EC_GROUP_SECG_CHAR2_571R1 NID_sect571r1 -#define EC_GROUP_WTLS_1 NID_wap_wsg_idm_ecid_wtls1 -#define EC_GROUP_WTLS_3 NID_wap_wsg_idm_ecid_wtls3 -#define EC_GROUP_WTLS_4 NID_wap_wsg_idm_ecid_wtls4 -#define EC_GROUP_WTLS_5 NID_wap_wsg_idm_ecid_wtls5 -#define EC_GROUP_WTLS_10 NID_wap_wsg_idm_ecid_wtls10 -#define EC_GROUP_WTLS_11 NID_wap_wsg_idm_ecid_wtls11 +/* EC_GROUP_get0_comment() returns a pointer to the 'comment' field of + * ec_curve_data_st structure */ +const char *EC_GROUP_get0_comment(int nid); +/* internal function : ec_group_index2nid() returns the NID of curve + * with the given index i from the internal curve list */ +int ec_group_index2nid(int i); + EC_POINT *EC_POINT_new(const EC_GROUP *); void EC_POINT_free(EC_POINT *); @@ -426,111 +347,109 @@ void ERR_load_EC_strings(void); /* Function codes. */ #define EC_F_COMPUTE_WNAF 143 -#define EC_F_D2I_ECPARAMETERS 155 -#define EC_F_D2I_ECPKPARAMETERS 161 -#define EC_F_D2I_ECPRIVATEKEY 168 -#define EC_F_ECPARAMETERS_PRINT 173 -#define EC_F_ECPARAMETERS_PRINT_FP 174 -#define EC_F_ECPKPARAMETERS_PRINT 166 -#define EC_F_ECPKPARAMETERS_PRINT_FP 167 -#define EC_F_ECPUBLICKEY_GET_OCTET 170 -#define EC_F_ECPUBLICKEY_SET_OCTET 171 -#define EC_F_EC_ASN1_GROUP2CURVE 159 -#define EC_F_EC_ASN1_GROUP2FIELDID 156 -#define EC_F_EC_ASN1_GROUP2PARAMETERS 160 -#define EC_F_EC_ASN1_GROUP2PKPARAMETERS 162 +#define EC_F_D2I_ECPARAMETERS 144 +#define EC_F_D2I_ECPKPARAMETERS 145 +#define EC_F_D2I_ECPRIVATEKEY 146 +#define EC_F_ECPARAMETERS_PRINT 147 +#define EC_F_ECPARAMETERS_PRINT_FP 148 +#define EC_F_ECPKPARAMETERS_PRINT 149 +#define EC_F_ECPKPARAMETERS_PRINT_FP 150 +#define EC_F_ECPUBLICKEY_GET_OCTET 151 +#define EC_F_ECPUBLICKEY_SET_OCTET 152 +#define EC_F_EC_ASN1_GROUP2CURVE 153 +#define EC_F_EC_ASN1_GROUP2FIELDID 154 +#define EC_F_EC_ASN1_GROUP2PARAMETERS 155 +#define EC_F_EC_ASN1_GROUP2PKPARAMETERS 156 #define EC_F_EC_ASN1_PARAMETERS2GROUP 157 -#define EC_F_EC_ASN1_PKPARAMETERS2GROUP 163 -#define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT 168 -#define EC_F_EC_GF2M_SIMPLE_OCT2POINT 169 -#define EC_F_EC_GF2M_SIMPLE_POINT2OCT 170 -#define EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES 171 -#define EC_F_EC_GF2M_SIMPLE_POINT_SET_AFFINE_COORDINATES 172 -#define EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES 182 +#define EC_F_EC_ASN1_PKPARAMETERS2GROUP 158 +#define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT 159 +#define EC_F_EC_GF2M_SIMPLE_OCT2POINT 160 +#define EC_F_EC_GF2M_SIMPLE_POINT2OCT 161 +#define EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES 162 +#define EC_F_EC_GF2M_SIMPLE_POINT_SET_AFFINE_COORDINATES 163 +#define EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES 164 #define EC_F_EC_GFP_MONT_FIELD_DECODE 133 #define EC_F_EC_GFP_MONT_FIELD_ENCODE 134 #define EC_F_EC_GFP_MONT_FIELD_MUL 131 #define EC_F_EC_GFP_MONT_FIELD_SQR 132 -#define EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT 152 -#define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE 100 +#define EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT 165 +#define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE 166 +#define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE_GFP 100 #define EC_F_EC_GFP_SIMPLE_GROUP_SET_GENERATOR 101 #define EC_F_EC_GFP_SIMPLE_MAKE_AFFINE 102 #define EC_F_EC_GFP_SIMPLE_OCT2POINT 103 #define EC_F_EC_GFP_SIMPLE_POINT2OCT 104 #define EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE 137 -#define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES 105 -#define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES 128 -#define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES 129 -#define EC_F_EC_GROUP_CHECK 150 -#define EC_F_EC_GROUP_CHECK_DISCRIMINANT 153 +#define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES 167 +#define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES_GFP 105 +#define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES 168 +#define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES_GFP 128 +#define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES 169 +#define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES_GFP 129 +#define EC_F_EC_GROUP_CHECK 170 +#define EC_F_EC_GROUP_CHECK_DISCRIMINANT 171 #define EC_F_EC_GROUP_COPY 106 #define EC_F_EC_GROUP_GET0_GENERATOR 139 #define EC_F_EC_GROUP_GET_COFACTOR 140 -#define EC_F_EC_GROUP_GET_CURVE_GF2M 173 +#define EC_F_EC_GROUP_GET_CURVE_GF2M 172 #define EC_F_EC_GROUP_GET_CURVE_GFP 130 -#define EC_F_EC_GROUP_GET_DEGREE 174 +#define EC_F_EC_GROUP_GET_DEGREE 173 #define EC_F_EC_GROUP_GET_EXTRA_DATA 107 #define EC_F_EC_GROUP_GET_ORDER 141 #define EC_F_EC_GROUP_GROUP2NID 147 #define EC_F_EC_GROUP_NEW 108 -#define EC_F_EC_GROUP_NEW_BY_NAME 144 -#define EC_F_EC_GROUP_NEW_BY_NID 146 -#define EC_F_EC_GROUP_NEW_GF2M_FROM_HEX 175 -#define EC_F_EC_GROUP_NEW_GFP_FROM_HEX 148 +#define EC_F_EC_GROUP_NEW_BY_NID 174 +#define EC_F_EC_GROUP_NEW_FROM_DATA 175 #define EC_F_EC_GROUP_PRECOMPUTE_MULT 142 #define EC_F_EC_GROUP_SET_CURVE_GF2M 176 #define EC_F_EC_GROUP_SET_CURVE_GFP 109 #define EC_F_EC_GROUP_SET_EXTRA_DATA 110 #define EC_F_EC_GROUP_SET_GENERATOR 111 -#define EC_F_EC_KEY_CHECK_KEY 184 -#define EC_F_EC_KEY_COPY 186 -#define EC_F_EC_KEY_GENERATE_KEY 185 -#define EC_F_EC_KEY_PRINT 175 -#define EC_F_EC_KEY_PRINT_FP 176 -#define EC_F_EC_NEW 172 +#define EC_F_EC_KEY_CHECK_KEY 177 +#define EC_F_EC_KEY_COPY 178 +#define EC_F_EC_KEY_GENERATE_KEY 179 +#define EC_F_EC_KEY_PRINT 180 +#define EC_F_EC_KEY_PRINT_FP 181 +#define EC_F_EC_NEW 182 #define EC_F_EC_POINTS_MAKE_AFFINE 136 #define EC_F_EC_POINTS_MUL 138 #define EC_F_EC_POINT_ADD 112 #define EC_F_EC_POINT_CMP 113 #define EC_F_EC_POINT_COPY 114 #define EC_F_EC_POINT_DBL 115 -#define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M 177 +#define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M 183 #define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP 116 #define EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP 117 #define EC_F_EC_POINT_IS_AT_INFINITY 118 #define EC_F_EC_POINT_IS_ON_CURVE 119 #define EC_F_EC_POINT_MAKE_AFFINE 120 -#define EC_F_EC_POINT_MUL 179 +#define EC_F_EC_POINT_MUL 184 #define EC_F_EC_POINT_NEW 121 #define EC_F_EC_POINT_OCT2POINT 122 #define EC_F_EC_POINT_POINT2OCT 123 -#define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M 180 +#define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M 185 #define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP 124 -#define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M 181 +#define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M 186 #define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP 125 #define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP 126 #define EC_F_EC_POINT_SET_TO_INFINITY 127 -#define EC_F_EC_WNAF_MUL 183 -#define EC_F_EC_WNAF_PRECOMPUTE_MULT 178 -#define EC_F_GFP_MONT_GROUP_SET_CURVE 135 -#define EC_F_I2D_ECDSAPARAMETERS 158 -#define EC_F_I2D_ECPARAMETERS 164 -#define EC_F_I2D_ECPKPARAMETERS 165 -#define EC_F_I2D_ECPRIVATEKEY 169 +#define EC_F_EC_WNAF_MUL 187 +#define EC_F_EC_WNAF_PRECOMPUTE_MULT 188 +#define EC_F_GFP_MONT_GROUP_SET_CURVE 189 +#define EC_F_GFP_MONT_GROUP_SET_CURVE_GFP 135 +#define EC_F_I2D_ECPARAMETERS 190 +#define EC_F_I2D_ECPKPARAMETERS 191 +#define EC_F_I2D_ECPRIVATEKEY 192 /* Reason codes. */ -#define EC_R_ASN1_ERROR 130 -#define EC_R_ASN1_UNKNOWN_FIELD 131 +#define EC_R_ASN1_ERROR 115 +#define EC_R_ASN1_UNKNOWN_FIELD 116 #define EC_R_BUFFER_TOO_SMALL 100 -#define EC_R_D2I_ECPARAMETERS_FAILURE 132 -#define EC_R_D2I_ECPKPARAMETERS_FAILURE 133 -#define EC_R_D2I_EC_PARAMETERS_FAILURE 123 +#define EC_R_D2I_ECPKPARAMETERS_FAILURE 117 #define EC_R_DISCRIMINANT_IS_ZERO 118 -#define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 124 -#define EC_R_GROUP2PARAMETERS_FAILURE 125 -#define EC_R_GROUP2PKPARAMETERS_FAILURE 134 -#define EC_R_I2D_ECPKPARAMETERS_FAILURE 135 -#define EC_R_I2D_EC_PARAMETERS_FAILURE 126 +#define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119 +#define EC_R_GROUP2PKPARAMETERS_FAILURE 120 +#define EC_R_I2D_ECPKPARAMETERS_FAILURE 121 #define EC_R_INCOMPATIBLE_OBJECTS 101 #define EC_R_INVALID_ARGUMENT 112 #define EC_R_INVALID_COMPRESSED_POINT 110 @@ -538,25 +457,22 @@ void ERR_load_EC_strings(void); #define EC_R_INVALID_ENCODING 102 #define EC_R_INVALID_FIELD 103 #define EC_R_INVALID_FORM 104 -#define EC_R_INVALID_GROUP_ORDER 119 -#define EC_R_INVALID_PRIVATE_KEY 139 -#define EC_R_MISSING_PARAMETERS 127 -#define EC_R_MISSING_PRIVATE_KEY 138 -#define EC_R_NOT_IMPLEMENTED 136 +#define EC_R_INVALID_GROUP_ORDER 122 +#define EC_R_INVALID_PRIVATE_KEY 123 +#define EC_R_MISSING_PARAMETERS 124 +#define EC_R_MISSING_PRIVATE_KEY 125 +#define EC_R_NOT_IMPLEMENTED 126 #define EC_R_NOT_INITIALIZED 111 #define EC_R_NO_SUCH_EXTRA_DATA 105 -#define EC_R_PARAMETERS2GROUP_FAILURE 128 -#define EC_R_PKPARAMETERS2GROUP_FAILURE 137 +#define EC_R_PKPARAMETERS2GROUP_FAILURE 127 #define EC_R_POINT_AT_INFINITY 106 #define EC_R_POINT_IS_NOT_ON_CURVE 107 #define EC_R_SLOT_FULL 108 #define EC_R_UNDEFINED_GENERATOR 113 -#define EC_R_UNDEFINED_ORDER 122 -#define EC_R_UNKNOWN_GROUP 116 -#define EC_R_UNKNOWN_NID 117 +#define EC_R_UNDEFINED_ORDER 128 +#define EC_R_UNKNOWN_GROUP 129 #define EC_R_UNKNOWN_ORDER 114 -#define EC_R_UNKNOWN_PARAMETERS_TYPE 129 -#define EC_R_WRONG_ORDER 140 +#define EC_R_WRONG_ORDER 130 #ifdef __cplusplus } diff --git a/crypto/ec/ec_asn1.c b/crypto/ec/ec_asn1.c index c1879dc510..8aa07c4dce 100644 --- a/crypto/ec/ec_asn1.c +++ b/crypto/ec/ec_asn1.c @@ -770,7 +770,7 @@ EC_GROUP *EC_ASN1_pkparameters2group(const ECPKPARAMETERS *params) if (params->type == 0) { /* the curve is given by an OID */ tmp = OBJ_obj2nid(params->value.named_curve); - if ((ret = EC_GROUP_new_by_name(tmp)) == NULL) + if ((ret = EC_GROUP_new_by_nid(tmp)) == NULL) { ECerr(EC_F_EC_ASN1_PKPARAMETERS2GROUP, EC_R_EC_GROUP_NEW_BY_NAME_FAILURE); diff --git a/crypto/ec/ec_curve.c b/crypto/ec/ec_curve.c index 55ce45d8cf..93f775d556 100644 --- a/crypto/ec/ec_curve.c +++ b/crypto/ec/ec_curve.c @@ -1,4 +1,7 @@ /* crypto/ec/ec_curve.c */ +/* + * Written by Nils Larsch for the OpenSSL project. + */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * @@ -82,793 +85,1141 @@ #include "ec_lcl.h" #include <openssl/err.h> #include <openssl/obj_mac.h> -#include <openssl/asn1.h> -#include <openssl/asn1t.h> -/* #define _EC_GROUP_EXAMPLE_PRIME_CURVE \ - * "the prime number p", "a", "b", "the compressed base point", "y-bit", "order", "cofactor" - */ +typedef struct ec_curve_data_st { + int field_type; /* either NID_X9_62_prime_field or + * NID_X9_62_characteristic_two_field */ + const char *p; /* either a prime number or a polynomial */ + const char *a; + const char *b; + const char *x; /* the x coordinate of the generator */ + const char *y; /* the y coordinate of the generator */ + const char *order; /* the order of the group generated by the + * generator */ + const BN_ULONG cofactor;/* the cofactor */ + const unsigned char *seed;/* the seed (optional) */ + size_t seed_len; + const char *comment; /* a short (less than 80 characters) + * description of the curve */ +} EC_CURVE_DATA; + /* the nist prime curves */ -#define _EC_GROUP_NIST_PRIME_192 \ - "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF",\ - "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC",\ - "64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1",\ - "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012",1,\ - "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831",1 -#define _EC_GROUP_NIST_PRIME_224 \ - "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001",\ - "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE",\ - "B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4",\ - "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21",0,\ - "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D",1 -#define _EC_GROUP_NIST_PRIME_384 \ - "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF",\ - "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC",\ - "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF",\ - "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7",1,\ - "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973",1 -#define _EC_GROUP_NIST_PRIME_521 \ - "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\ - "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",\ - "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\ - "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC",\ - "051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B"\ - "315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00",\ - "C6858E06B70404E9CD9E3ECB662395B4429C648139053F"\ - "B521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66",0,\ - "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\ - "FFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409",1 +static const unsigned char _EC_NIST_PRIME_192_SEED[] = { + 0x30,0x45,0xAE,0x6F,0xC8,0x42,0x2F,0x64,0xED,0x57, + 0x95,0x28,0xD3,0x81,0x20,0xEA,0xE1,0x21,0x96,0xD5}; +static const EC_CURVE_DATA _EC_NIST_PRIME_192 = { + NID_X9_62_prime_field, + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF", + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC", + "64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1", + "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012", + "07192b95ffc8da78631011ed6b24cdd573f977a11e794811", + "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831",1, + _EC_NIST_PRIME_192_SEED, 20, + "192 bit prime curve from the X9.62 draft" + }; + +static const unsigned char _EC_NIST_PRIME_224_SEED[] = { + 0xBD,0x71,0x34,0x47,0x99,0xD5,0xC7,0xFC,0xDC,0x45, + 0xB5,0x9F,0xA3,0xB9,0xAB,0x8F,0x6A,0x94,0x8B,0xC5}; +static const EC_CURVE_DATA _EC_NIST_PRIME_224 = { + NID_X9_62_prime_field, + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001", + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE", + "B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4", + "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21", + "bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34", + "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D",1, + _EC_NIST_PRIME_224_SEED, 20, + "SECG/NIST recommended curve over a 224 bit prime field" + }; + +static const unsigned char _EC_NIST_PRIME_384_SEED[] = { + 0xA3,0x35,0x92,0x6A,0xA3,0x19,0xA2,0x7A,0x1D,0x00, + 0x89,0x6A,0x67,0x73,0xA4,0x82,0x7A,0xCD,0xAC,0x73}; +static const EC_CURVE_DATA _EC_NIST_PRIME_384 = { + NID_X9_62_prime_field, + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFF" + "FFF0000000000000000FFFFFFFF", + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFF" + "FFF0000000000000000FFFFFFFC", + "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC6563" + "98D8A2ED19D2A85C8EDD3EC2AEF", + "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F" + "25DBF55296C3A545E3872760AB7", + "3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b" + "1ce1d7e819d7a431d7c90ea0e5f", + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0" + "DB248B0A77AECEC196ACCC52973",1, + _EC_NIST_PRIME_384_SEED, 20, + "SECG/NIST recommended curve over a 384 bit prime field" + }; + +static const unsigned char _EC_NIST_PRIME_521_SEED[] = { + 0xD0,0x9E,0x88,0x00,0x29,0x1C,0xB8,0x53,0x96,0xCC, + 0x67,0x17,0x39,0x32,0x84,0xAA,0xA0,0xDA,0x64,0xBA}; +static const EC_CURVE_DATA _EC_NIST_PRIME_521 = { + NID_X9_62_prime_field, + "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", + "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC", + "051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156" + "193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00", + "C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14" + "B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66", + "011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c9" + "7ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650", + "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51" + "868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409",1, + _EC_NIST_PRIME_521_SEED, 20, + "SECG/NIST recommended curve over a 521 bit prime field" + }; /* the x9.62 prime curves (minus the nist prime curves) */ -#define _EC_GROUP_X9_62_PRIME_192V2 \ - "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF",\ - "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC",\ - "CC22D6DFB95C6B25E49C0D6364A4E5980C393AA21668D953",\ - "EEA2BAE7E1497842F2DE7769CFE9C989C072AD696F48034A",1,\ - "FFFFFFFFFFFFFFFFFFFFFFFE5FB1A724DC80418648D8DD31",1 -#define _EC_GROUP_X9_62_PRIME_192V3 \ - "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF",\ - "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC",\ - "22123DC2395A05CAA7423DAECCC94760A7D462256BD56916",\ - "7D29778100C65A1DA1783716588DCE2B8B4AEE8E228F1896",0,\ - "FFFFFFFFFFFFFFFFFFFFFFFF7A62D031C83F4294F640EC13",1 -#define _EC_GROUP_X9_62_PRIME_239V1 \ - "7FFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFF8000000000007FFFFFFFFFFF",\ - "7FFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFF8000000000007FFFFFFFFFFC",\ - "6B016C3BDCF18941D0D654921475CA71A9DB2FB27D1D37796185C2942C0A",\ - "0FFA963CDCA8816CCC33B8642BEDF905C3D358573D3F27FBBD3B3CB9AAAF",0,\ - "7FFFFFFFFFFFFFFFFFFFFFFF7FFFFF9E5E9A9F5D9071FBD1522688909D0B",1 -#define _EC_GROUP_X9_62_PRIME_239V2 \ - "7FFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFF8000000000007FFFFFFFFFFF",\ - "7FFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFF8000000000007FFFFFFFFFFC",\ - "617FAB6832576CBBFED50D99F0249C3FEE58B94BA0038C7AE84C8C832F2C",\ - "38AF09D98727705120C921BB5E9E26296A3CDCF2F35757A0EAFD87B830E7",0,\ - "7FFFFFFFFFFFFFFFFFFFFFFF800000CFA7E8594377D414C03821BC582063",1 -#define _EC_GROUP_X9_62_PRIME_239V3 \ - "7FFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFF8000000000007FFFFFFFFFFF",\ - "7FFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFF8000000000007FFFFFFFFFFC",\ - "255705FA2A306654B1F4CB03D6A750A30C250102D4988717D9BA15AB6D3E",\ - "6768AE8E18BB92CFCF005C949AA2C6D94853D0E660BBF854B1C9505FE95A",1,\ - "7FFFFFFFFFFFFFFFFFFFFFFF7FFFFF975DEB41B3A6057C3C432146526551",1 -#define _EC_GROUP_X9_62_PRIME_256V1 \ - "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF",\ - "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC",\ - "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B",\ - "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296",1,\ - "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551",1 +static const unsigned char _EC_X9_62_PRIME_192V2_SEED[] = { + 0x31,0xA9,0x2E,0xE2,0x02,0x9F,0xD1,0x0D,0x90,0x1B, + 0x11,0x3E,0x99,0x07,0x10,0xF0,0xD2,0x1A,0xC6,0xB6}; +static const EC_CURVE_DATA _EC_X9_62_PRIME_192V2 = { + NID_X9_62_prime_field, + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF", + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC", + "CC22D6DFB95C6B25E49C0D6364A4E5980C393AA21668D953", + "EEA2BAE7E1497842F2DE7769CFE9C989C072AD696F48034A", |