Commit Diff


commit - 21617eda73fc4f7b75e6e27b6c102160aba57e9e
commit + bd2330769039944d0acbf10e81e798698be13a20
blob - b24cb4310c4d9b192970ed9e2cd43091bff8f496
blob + 1028131efee3c6cdba41ab741b21655db7cdc56e
--- crypto.c
+++ crypto.c
@@ -22,7 +22,6 @@
 
 #include <openssl/err.h>
 #include <openssl/pem.h>
-#include <openssl/engine.h>
 
 #include "log.h"
 #include "proc.h"
@@ -519,24 +518,10 @@ ecdsae_do_sign(const unsigned char *dgst, int dgst_len
 static void
 rsa_engine_init(void)
 {
-	ENGINE		*e;
-	const char	*errstr, *name;
+	const char	*errstr;
 
-	if ((e = ENGINE_get_default_RSA()) == NULL) {
-		if ((e = ENGINE_new()) == NULL) {
-			errstr = "ENGINE_new";
-			goto fail;
-		}
-		if (!ENGINE_set_name(e, "RSA privsep engine")) {
-			errstr = "ENGINE_set_name";
-			goto fail;
-		}
-		if ((rsa_default = RSA_get_default_method()) == NULL) {
-			errstr = "RSA_get_default_method";
-			goto fail;
-		}
-	} else if ((rsa_default = ENGINE_get_RSA(e)) == NULL) {
-		errstr = "ENGINE_get_RSA";
+	if ((rsa_default = RSA_get_default_method()) == NULL) {
+		errstr = "RSA_get_default_method";
 		goto fail;
 	}
 
@@ -545,11 +530,6 @@ rsa_engine_init(void)
 		goto fail;
 	}
 
-	if ((name = ENGINE_get_name(e)) == NULL)
-		name = "unknown RSA engine";
-
-	log_debug("debug: %s: using %s", __func__, name);
-
 	RSA_meth_set_priv_enc(rsae_method, rsae_priv_enc);
 	RSA_meth_set_priv_dec(rsae_method, rsae_priv_dec);
 
@@ -558,14 +538,7 @@ rsa_engine_init(void)
 	RSA_meth_set0_app_data(rsae_method,
 		RSA_meth_get0_app_data(rsa_default));
 
-	if (!ENGINE_set_RSA(e, rsae_method)) {
-		errstr = "ENGINE_set_RSA";
-		goto fail;
-	}
-	if (!ENGINE_set_default_RSA(e)) {
-		errstr = "ENGINE_set_default_RSA";
-		goto fail;
-	}
+	RSA_set_default_method(rsae_method);
 
 	return;
 
@@ -577,35 +550,16 @@ rsa_engine_init(void)
 static void
 ecdsa_engine_init(void)
 {
-	ENGINE		*e;
-	const char	*errstr, *name;
 	int (*sign)(int, const unsigned char *, int, unsigned char *,
 	    unsigned int *, const BIGNUM *, const BIGNUM *, EC_KEY *);
 	int (*sign_setup)(EC_KEY *, BN_CTX *, BIGNUM **, BIGNUM **);
+	const char *errstr;
 
-	if ((e = ENGINE_get_default_EC()) == NULL) {
-		if ((e = ENGINE_new()) == NULL) {
-			errstr = "ENGINE_new";
-			goto fail;
-		}
-		if (!ENGINE_set_name(e, "ECDSA privsep engine")) {
-			errstr = "ENGINE_set_name";
-			goto fail;
-		}
-		if ((ecdsa_default = EC_KEY_get_default_method()) == NULL) {
-			errstr = "EC_KEY_get_default_method";
-			goto fail;
-		}
-	} else if ((ecdsa_default = ENGINE_get_EC(e)) == NULL) {
-		errstr = "ENGINE_get_EC";
+	if ((ecdsa_default = EC_KEY_get_default_method()) == NULL) {
+		errstr = "EC_KEY_get_default_method";
 		goto fail;
 	}
 
-	if ((name = ENGINE_get_name(e)) == NULL)
-		name = "unknown ECDSA engine";
-
-	log_debug("debug: %s: using %s", __func__, name);
-
 	if ((ecdsae_method = EC_KEY_METHOD_new(ecdsa_default)) == NULL) {
 		errstr = "EC_KEY_METHOD_new";
 		goto fail;
@@ -615,14 +569,7 @@ ecdsa_engine_init(void)
 	EC_KEY_METHOD_set_sign(ecdsae_method, sign, sign_setup,
 	    ecdsae_do_sign);
 
-	if (!ENGINE_set_EC(e, ecdsae_method)) {
-		errstr = "ENGINE_set_EC";
-		goto fail;
-	}
-	if (!ENGINE_set_default_EC(e)) {
-		errstr = "ENGINE_set_default_EC";
-		goto fail;
-	}
+	EC_KEY_set_default_method(ecdsae_method);
 
 	return;