* 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
* Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.
*
*/
+
+#include <openssl/opensslconf.h>
#ifndef OPENSSL_NO_EC
#include <assert.h>
#include <stdio.h>
* in the asn1 der encoding
* possible values: named_curve (default)
* explicit
- * -no_seed - if 'explicit' parameters are choosen do not use the seed
+ * -no_seed - if 'explicit' parameters are chosen do not use the seed
* -genkey - generate ec key
* -rand file - files to use for random number input
* -engine e - use engine e, possibly a hardware device
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,
BIO_printf(bio_err, " "
" explicit\n");
BIO_printf(bio_err, " -no_seed if 'explicit'"
- " parameters are choosen do not"
+ " parameters are chosen do not"
" use the seed\n");
BIO_printf(bio_err, " -genkey generate ec"
" key\n");
}
#ifndef OPENSSL_NO_ENGINE
- e = setup_engine(bio_err, engine, 0);
+ setup_engine(bio_err, engine, 0);
#endif
if (list_curves)
}
else
nid = OBJ_sn2nid(curve_name);
+
+ if (nid == 0)
+ nid = EC_curve_nist2nid(curve_name);
if (nid == 0)
{
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",
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;
}
{
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);
}
BIO_printf(out, "\n\t};\n\n");
return 1;
}
+#else /* !OPENSSL_NO_EC */
+
+# if PEDANTIC
+static void *dummy=&dummy;
+# endif
+
#endif