Update ECDSA and ECDH for OPENSSL_NO_ENGINE.
authorGeoff Thorpe <geoff@openssl.org>
Thu, 21 Oct 2004 00:06:14 +0000 (00:06 +0000)
committerGeoff Thorpe <geoff@openssl.org>
Thu, 21 Oct 2004 00:06:14 +0000 (00:06 +0000)
Reported by: Maxim Masiutin
Submitted by: Nils Larsch

apps/ec.c
apps/ecparam.c
crypto/ecdh/ech_key.c
crypto/ecdh/ech_lib.c
crypto/ecdsa/ecs_lib.c
crypto/ecdsa/ecs_sign.c
crypto/ecdsa/ecs_vrf.c

index 7d57341cb47d1046008b0638fe7eb2b5fa5a1de0..392e6a2ef64891bdfc3b79f43e016a8fc8e8d29c 100644 (file)
--- a/apps/ec.c
+++ b/apps/ec.c
@@ -84,7 +84,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;
        int     i, badops = 0;
@@ -249,7 +251,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)) 
                {
index ae046f9a8df19f1731ddd42510adcfedcb3c198a..29d215e883f9f9edbce0600dee74a1f13222f02b 100644 (file)
@@ -127,7 +127,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 +337,9 @@ bad:
                        }
                }
 
+#ifndef OPENSSL_NO_ENGINE
        e = setup_engine(bio_err, engine, 0);
+#endif
 
        if (list_curves)
                {
index 923a7e9dd92d43a33a941a6de2e1922d9cb72394..7d1bb32ae0623cba3640c4fb6a8fdc7119667b5c 100644 (file)
@@ -68,7 +68,9 @@
  */
 
 #include "ecdh.h"
+#ifndef OPENSSL_NO_ENGINE
 #include <openssl/engine.h>
+#endif
 
 int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *eckey,
                      void *(*KDF)(void *in, size_t inlen, void *out, size_t outlen))
index a0e4ef45f0d5ddd5fc776582acf9e6be2a83acd6..f2abfed5108cc07ab015af2b3190ad507702f55d 100644 (file)
@@ -69,7 +69,9 @@
 
 #include "ecdh.h"
 #include <string.h>
+#ifndef OPENSSL_NO_ENGINE
 #include <openssl/engine.h>
+#endif
 #include <openssl/err.h>
 
 const char *ECDH_version="ECDH" OPENSSL_VERSION_PTEXT;
@@ -105,11 +107,13 @@ int ECDH_set_method(EC_KEY *eckey, const ECDH_METHOD *meth)
         if (mtmp->finish)
                mtmp->finish(eckey);
 #endif
+#ifndef OPENSSL_NO_ENGINE
        if (ecdh->engine)
                {
                ENGINE_finish(ecdh->engine);
                ecdh->engine = NULL;
                }
+#endif
         ecdh->meth = meth;
 #if 0
         if (meth->init) 
@@ -139,6 +143,7 @@ ECDH_DATA *ECDH_DATA_new_method(ENGINE *engine)
 
        ret->meth = ECDH_get_default_method();
        ret->engine = engine;
+#ifndef OPENSSL_NO_ENGINE
        if (!ret->engine)
                ret->engine = ENGINE_get_default_ECDH();
        if (ret->engine)
@@ -152,6 +157,7 @@ ECDH_DATA *ECDH_DATA_new_method(ENGINE *engine)
                        return NULL;
                        }
                }
+#endif
 
        ret->flags = ret->meth->flags;
        CRYPTO_new_ex_data(CRYPTO_EX_INDEX_ECDH, ret, &ret->ex_data);
@@ -172,8 +178,10 @@ void ECDH_DATA_free(ECDH_DATA *r)
        if (r->meth->finish)
                r->meth->finish(r);
 #endif
+#ifndef OPENSSL_NO_ENGINE
        if (r->engine)
                ENGINE_finish(r->engine);
+#endif
 
        CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDH, r, &r->ex_data);
 
index d553ea1cd6039f260954416ae297375d17110c60..e355a35698526bb37522157d7483c91a75d80532 100644 (file)
@@ -55,7 +55,9 @@
 
 #include <string.h>
 #include "ecdsa.h"
+#ifndef OPENSSL_NO_ENGINE
 #include <openssl/engine.h>
+#endif
 #include <openssl/err.h>
 #include <openssl/bn.h>
 
@@ -92,11 +94,13 @@ int ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth)
         if (mtmp->finish)
                mtmp->finish(eckey);
 #endif
+#ifndef OPENSSL_NO_ENGINE
        if (ecdsa->engine)
        {
                ENGINE_finish(ecdsa->engine);
                ecdsa->engine = NULL;
        }
+#endif
         ecdsa->meth = meth;
 #if 0
         if (meth->init) 
@@ -129,6 +133,7 @@ ECDSA_DATA *ECDSA_DATA_new_method(ENGINE *engine)
 
        ret->meth = ECDSA_get_default_method();
        ret->engine = engine;
+#ifndef OPENSSL_NO_ENGINE
        if (!ret->engine)
                ret->engine = ENGINE_get_default_ECDSA();
        if (ret->engine)
@@ -142,6 +147,7 @@ ECDSA_DATA *ECDSA_DATA_new_method(ENGINE *engine)
                        return NULL;
                }
        }
+#endif
 
        ret->flags = ret->meth->flags;
        CRYPTO_new_ex_data(CRYPTO_EX_INDEX_ECDSA, ret, &ret->ex_data);
@@ -167,8 +173,10 @@ void ECDSA_DATA_free(ECDSA_DATA *r)
        if (r->meth->finish)
                r->meth->finish(r);
 #endif
+#ifndef OPENSSL_NO_ENGINE
        if (r->engine)
                ENGINE_finish(r->engine);
+#endif
 
        CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDSA, r, &r->ex_data);
 
index 215da1211a4610ba80f9c99f7926ad4a34fb8e68..4667c8cfcc4e7ca5849d7814310d23ac7707b786 100644 (file)
@@ -54,7 +54,9 @@
  */
 
 #include "ecdsa.h"
+#ifndef OPENSSL_NO_ENGINE
 #include <openssl/engine.h>
+#endif
 
 ECDSA_SIG * ECDSA_do_sign(const unsigned char *dgst, int dlen, EC_KEY *eckey)
 {
index 269671bec87cc4a9834631f15c1eeb72f3eb98d8..15a6ab49f9d30feafa114bed9878bc0e83968189 100644 (file)
@@ -54,7 +54,9 @@
  */
 
 #include "ecdsa.h"
+#ifndef OPENSSL_NO_ENGINE
 #include <openssl/engine.h>
+#endif
 
 /* returns
  *      1: correct signature