X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=apps%2Fecparam.c;h=4e1fc837ed6aca2366287bf9e25bd616d7512130;hb=339654e1631f5e0707db0ad3cbad8b4db02cf4f9;hp=ae046f9a8df19f1731ddd42510adcfedcb3c198a;hpb=514871099478191c10cf600cf32758e6ae781058;p=oweals%2Fopenssl.git diff --git a/apps/ecparam.c b/apps/ecparam.c index ae046f9a8d..4e1fc837ed 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,7 +129,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,7 +339,9 @@ bad: } } +#ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); +#endif if (list_curves) { @@ -345,7 +351,7 @@ bad: crv_len = EC_get_builtin_curves(NULL, 0); - curves = OPENSSL_malloc(sizeof(EC_builtin_curve) * crv_len); + curves = OPENSSL_malloc((int)(sizeof(EC_builtin_curve) * crv_len)); if (curves == NULL) goto end; @@ -407,7 +413,7 @@ bad: goto end; } - group = EC_GROUP_new_by_nid(nid); + group = EC_GROUP_new_by_curve_name(nid); if (group == NULL) { BIO_printf(bio_err, "unable to create curve (%s)\n", @@ -643,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; } @@ -660,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); }