RFC 3161 compliant time stamp request creation, response generation
[openssl.git] / apps / ec.c
index 71ffaecb15cdb85c0cfbbf36eea790811e0433f8..9ddaddfe5e7033858f749b7c52f359e9d7a7462b 100644 (file)
--- 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 <openssl/opensslconf.h>
 #ifndef OPENSSL_NO_EC
 #include <stdio.h>
 #include <stdlib.h>
@@ -84,9 +85,12 @@ 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;
@@ -249,7 +253,9 @@ bad:
 
        ERR_load_crypto_strings();
 
+#ifndef OPENSSL_NO_ENGINE
         e = setup_engine(bio_err, engine, 0);
+#endif
 
        if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) 
                {
@@ -324,14 +330,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))
@@ -348,7 +353,7 @@ bad:
        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 
@@ -357,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 
@@ -390,6 +395,6 @@ end:
        if (passout)
                OPENSSL_free(passout);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
 }
 #endif