aboutsummaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2001-11-22 09:01:11 +0000
committerGeoff Thorpe <geoff@openssl.org>2001-11-22 09:01:11 +0000
commit329636d6e30c15f71bbf46d7f69a6ab6c3fb4726 (patch)
tree240c0540ee68d4e6c424586c3bd2c525fc546188 /crypto
parent9163b8fb238ece12091753c137db37b6489719bb (diff)
downloadopenssl-329636d6e30c15f71bbf46d7f69a6ab6c3fb4726.zip
openssl-329636d6e30c15f71bbf46d7f69a6ab6c3fb4726.tar.gz
openssl-329636d6e30c15f71bbf46d7f69a6ab6c3fb4726.tar.bz2
The "openssl" ENGINE is no longer used except as a testing/debugging
device. This change enables it for building as a self-contained "dynamic" ENGINE, to help testing such mechanisms.
Diffstat (limited to 'crypto')
-rw-r--r--crypto/engine/eng_openssl.c50
1 files changed, 38 insertions, 12 deletions
diff --git a/crypto/engine/eng_openssl.c b/crypto/engine/eng_openssl.c
index d3e4cac..97642ae 100644
--- a/crypto/engine/eng_openssl.c
+++ b/crypto/engine/eng_openssl.c
@@ -89,30 +89,41 @@ static int openssl_digests(ENGINE *e, const EVP_MD **digest,
static const char *engine_openssl_id = "openssl";
static const char *engine_openssl_name = "Software engine support";
-static ENGINE *engine_openssl(void)
+/* This internal function is used by ENGINE_openssl() and possibly by the
+ * "dynamic" ENGINE support too */
+static int bind_helper(ENGINE *e)
{
- ENGINE *ret = ENGINE_new();
- if(!ret)
- return NULL;
- if(!ENGINE_set_id(ret, engine_openssl_id)
- || !ENGINE_set_name(ret, engine_openssl_name)
+ if(!ENGINE_set_id(e, engine_openssl_id)
+ || !ENGINE_set_name(e, engine_openssl_name)
#ifndef OPENSSL_NO_RSA
- || !ENGINE_set_RSA(ret, RSA_get_default_method())
+ || !ENGINE_set_RSA(e, RSA_get_default_method())
#endif
#ifndef OPENSSL_NO_DSA
- || !ENGINE_set_DSA(ret, DSA_get_default_method())
+ || !ENGINE_set_DSA(e, DSA_get_default_method())
#endif
#ifndef OPENSSL_NO_DH
- || !ENGINE_set_DH(ret, DH_get_default_method())
+ || !ENGINE_set_DH(e, DH_get_default_method())
#endif
- || !ENGINE_set_RAND(ret, RAND_SSLeay())
+ || !ENGINE_set_RAND(e, RAND_SSLeay())
#ifdef TEST_ENG_OPENSSL_RC4
- || !ENGINE_set_ciphers(ret, openssl_ciphers)
+ || !ENGINE_set_ciphers(e, openssl_ciphers)
#endif
#ifdef TEST_ENG_OPENSSL_SHA
- || !ENGINE_set_digests(ret, openssl_digests)
+ || !ENGINE_set_digests(e, openssl_digests)
#endif
)
+ return 0;
+ /* If we add errors to this ENGINE, ensure the error handling is setup here */
+ /* openssl_load_error_strings(); */
+ return 1;
+ }
+
+static ENGINE *engine_openssl(void)
+ {
+ ENGINE *ret = ENGINE_new();
+ if(!ret)
+ return NULL;
+ if(!bind_helper(ret))
{
ENGINE_free(ret);
return NULL;
@@ -131,6 +142,21 @@ void ENGINE_load_openssl(void)
ERR_clear_error();
}
+/* This stuff is needed if this ENGINE is being compiled into a self-contained
+ * shared-library. */
+#ifdef ENGINE_DYNAMIC_SUPPORT
+static int bind_fn(ENGINE *e, const char *id)
+ {
+ if(id && (strcmp(id, engine_openssl_id) != 0))
+ return 0;
+ if(!bind_helper(e))
+ return 0;
+ return 1;
+ }
+IMPLEMENT_DYNAMIC_CHECK_FN()
+IMPLEMENT_DYNAMIC_BIND_FN(bind_fn)
+#endif /* ENGINE_DYNAMIC_SUPPORT */
+
#ifdef TEST_ENG_OPENSSL_RC4
/* This section of code compiles an "alternative implementation" of two modes of
* RC4 into this ENGINE. The result is that EVP_CIPHER operation for "rc4"