X-Git-Url: https://git.openssl.org/?a=blobdiff_plain;f=apps%2Fecparam.c;h=50eef797ccd36003e573d97433e269cd397517d4;hb=b5cadfb564a604c0ba1c49984ac796cfd8310731;hp=b9786288d958ffedc62876a751065177aa524a2a;hpb=8b15c740180725e3e1e71ff619151840cdec46a5;p=openssl.git diff --git a/apps/ecparam.c b/apps/ecparam.c index b9786288d9..50eef797cc 100644 --- a/apps/ecparam.c +++ b/apps/ecparam.c @@ -3,7 +3,7 @@ * Written by Nils Larsch for the OpenSSL project. */ /* ==================================================================== - * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. + * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -68,6 +68,8 @@ * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories. * */ + +#include #ifndef OPENSSL_NO_EC #include #include @@ -127,9 +129,6 @@ 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, @@ -338,7 +337,7 @@ bad: } #ifndef OPENSSL_NO_ENGINE - e = setup_engine(bio_err, engine, 0); + setup_engine(bio_err, engine, 0); #endif if (list_curves) @@ -403,6 +402,9 @@ bad: } else nid = OBJ_sn2nid(curve_name); + + if (nid == 0) + nid = EC_curve_nist2nid(curve_name); if (nid == 0) { @@ -647,11 +649,11 @@ bad: assert(need_rand); - eckey->group = group; + if (EC_KEY_set_group(eckey, group) == 0) + goto end; if (!EC_KEY_generate_key(eckey)) { - eckey->group = NULL; EC_KEY_free(eckey); goto end; } @@ -664,11 +666,9 @@ bad: { BIO_printf(bio_err, "bad output format specified " "for outfile\n"); - eckey->group = NULL; EC_KEY_free(eckey); goto end; } - eckey->group = NULL; EC_KEY_free(eckey); } @@ -725,4 +725,10 @@ static int ecparam_print_var(BIO *out, BIGNUM *in, const char *var, BIO_printf(out, "\n\t};\n\n"); return 1; } +#else /* !OPENSSL_NO_EC */ + +# if PEDANTIC +static void *dummy=&dummy; +# endif + #endif