X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=apps%2Fecparam.c;h=29d215e883f9f9edbce0600dee74a1f13222f02b;hp=3bd0a974873b32cc7b101ccc76ba7ce16586c1f6;hb=10f92aac33de06d3bf0515b0e54bf282746113aa;hpb=1c3e4a366022c043ae87ff9715905e97582bf649 diff --git a/apps/ecparam.c b/apps/ecparam.c index 3bd0a97487..29d215e883 100644 --- a/apps/ecparam.c +++ b/apps/ecparam.c @@ -127,7 +127,9 @@ int MAIN(int argc, char **argv) char *infile = NULL, *outfile = NULL, *prog; BIO *in = NULL, *out = NULL; int informat, outformat, noout = 0, C = 0, ret = 1; +#ifndef OPENSSL_NO_ENGINE ENGINE *e = NULL; +#endif char *engine = NULL; BIGNUM *ec_p = NULL, *ec_a = NULL, *ec_b = NULL, @@ -335,14 +337,15 @@ bad: } } +#ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); +#endif if (list_curves) { EC_builtin_curve *curves = NULL; size_t crv_len = 0; size_t n = 0; - size_t len; crv_len = EC_get_builtin_curves(NULL, 0); @@ -369,11 +372,8 @@ bad: 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); + BIO_printf(out, " %-10s: ", sname); + BIO_printf(out, "%s\n", comment); } OPENSSL_free(curves); @@ -383,7 +383,26 @@ bad: if (curve_name != NULL) { - int nid = OBJ_sn2nid(curve_name); + int nid; + + /* workaround for the SECG curve names secp192r1 + * and secp256r1 (which are the same as the curves + * prime192v1 and prime256v1 defined in X9.62) + */ + if (!strcmp(curve_name, "secp192r1")) + { + BIO_printf(bio_err, "using curve name prime192v1 " + "instead of secp192r1\n"); + nid = NID_X9_62_prime192v1; + } + else if (!strcmp(curve_name, "secp256r1")) + { + BIO_printf(bio_err, "using curve name prime256v1 " + "instead of secp256r1\n"); + nid = NID_X9_62_prime256v1; + } + else + nid = OBJ_sn2nid(curve_name); if (nid == 0) { @@ -682,7 +701,7 @@ end: OPENSSL_EXIT(ret); } -int ecparam_print_var(BIO *out, BIGNUM *in, const char *var, +static int ecparam_print_var(BIO *out, BIGNUM *in, const char *var, int len, unsigned char *buffer) { BIO_printf(out, "static unsigned char %s_%d[] = {", var, len);