X-Git-Url: https://git.openssl.org/?a=blobdiff_plain;f=apps%2Fec.c;h=896eabc13fba53a1f0e677f8b3952fe9ab7abe33;hb=a09e4d24ada871ed0e6f5e37fadd52a76b29542a;hp=392e6a2ef64891bdfc3b79f43e016a8fc8e8d29c;hpb=58ae65cd1a18a68892b1eb8bb55b7f11a5cf6ea9;p=openssl.git diff --git a/apps/ec.c b/apps/ec.c index 392e6a2ef6..896eabc13f 100644 --- a/apps/ec.c +++ b/apps/ec.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 @@ -56,6 +56,7 @@ * */ +#include #ifndef OPENSSL_NO_EC #include #include @@ -84,11 +85,9 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { -#ifndef OPENSSL_NO_ENGINE - ENGINE *e = NULL; -#endif int ret = 1; EC_KEY *eckey = NULL; + const EC_GROUP *group; int i, badops = 0; const EVP_CIPHER *enc = NULL; BIO *in = NULL, *out = NULL; @@ -242,7 +241,7 @@ bad: " the ec parameters are encoded\n"); BIO_printf(bio_err, " in the asn1 der " "encoding\n"); - BIO_printf(bio_err, " possilbe values:" + BIO_printf(bio_err, " possible values:" " named_curve (default)\n"); BIO_printf(bio_err," " "explicit\n"); @@ -252,7 +251,7 @@ bad: ERR_load_crypto_strings(); #ifndef OPENSSL_NO_ENGINE - e = setup_engine(bio_err, engine, 0); + setup_engine(bio_err, engine, 0); #endif if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) @@ -328,14 +327,13 @@ bad: } } + group = EC_KEY_get0_group(eckey); + if (new_form) - { - EC_GROUP_set_point_conversion_form(eckey->group, form); - eckey->conv_form = form; - } + EC_KEY_set_conv_form(eckey, form); if (new_asn1_flag) - EC_GROUP_set_asn1_flag(eckey->group, asn1_flag); + EC_KEY_set_asn1_flag(eckey, asn1_flag); if (text) if (!EC_KEY_print(out, eckey, 0)) @@ -346,13 +344,16 @@ bad: } if (noout) + { + ret = 0; goto end; + } BIO_printf(bio_err, "writing EC key\n"); if (outformat == FORMAT_ASN1) { if (param_out) - i = i2d_ECPKParameters_bio(out, eckey->group); + i = i2d_ECPKParameters_bio(out, group); else if (pubin || pubout) i = i2d_EC_PUBKEY_bio(out, eckey); else @@ -361,7 +362,7 @@ bad: else if (outformat == FORMAT_PEM) { if (param_out) - i = PEM_write_bio_ECPKParameters(out, eckey->group); + i = PEM_write_bio_ECPKParameters(out, group); else if (pubin || pubout) i = PEM_write_bio_EC_PUBKEY(out, eckey); else @@ -396,4 +397,10 @@ end: apps_shutdown(); OPENSSL_EXIT(ret); } +#else /* !OPENSSL_NO_EC */ + +# if PEDANTIC +static void *dummy=&dummy; +# endif + #endif