Skip to content

Commit cb85cac

Browse files
committed
Remove deprecated references to Engine configuration
1 parent 2cdea45 commit cb85cac

3 files changed

Lines changed: 1 addition & 77 deletions

File tree

native/include/ssl_private.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@
4949
#ifndef LIBRESSL_VERSION_NUMBER
5050
#include <openssl/provider.h>
5151
#endif
52-
/* Avoid tripping over an engine build installed globally and detected
53-
* when the user points at an explicit non-engine flavor of OpenSSL
54-
*/
55-
#ifndef OPENSSL_NO_ENGINE
56-
#include <openssl/engine.h>
57-
extern ENGINE *tcn_ssl_engine;
58-
#endif
5952

6053
#ifndef RAND_MAX
6154
#include <limits.h>

native/src/ssl.c

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ static int ssl_initialized = 0;
2626
static char *ssl_global_rand_file = NULL;
2727
extern apr_pool_t *tcn_global_pool;
2828

29-
ENGINE *tcn_ssl_engine = NULL;
3029
tcn_pass_cb_t tcn_password_callback;
3130

3231
static BIO *key_log_file = NULL;
@@ -78,14 +77,6 @@ static apr_status_t ssl_init_cleanup(void *data)
7877

7978
free_bio_methods();
8079

81-
#ifndef OPENSSL_NO_ENGINE
82-
if (tcn_ssl_engine != NULL) {
83-
/* Release the SSL Engine structural reference */
84-
ENGINE_free(tcn_ssl_engine);
85-
tcn_ssl_engine = NULL;
86-
}
87-
#endif
88-
8980
/* Openssl v1.1+ handles all termination automatically. */
9081

9182
if (key_log_file) {
@@ -105,22 +96,6 @@ static apr_status_t ssl_init_cleanup(void *data)
10596
return APR_SUCCESS;
10697
}
10798

108-
#ifndef OPENSSL_NO_ENGINE
109-
/* Try to load an engine in a shareable library */
110-
static ENGINE *ssl_try_load_engine(const char *engine)
111-
{
112-
ENGINE *e = ENGINE_by_id("dynamic");
113-
if (e) {
114-
if (!ENGINE_ctrl_cmd_string(e, "SO_PATH", engine, 0)
115-
|| !ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0)) {
116-
ENGINE_free(e);
117-
e = NULL;
118-
}
119-
}
120-
return e;
121-
}
122-
#endif
123-
12499
/*
125100
* To ensure thread-safetyness in LibreSSL
126101
*/
@@ -205,9 +180,6 @@ TCN_IMPLEMENT_CALL(jint, SSL, initialize)(TCN_STDARGS, jstring engine)
205180
{
206181
jclass clazz;
207182
jclass sClazz;
208-
#if !defined(OPENSSL_NO_ENGINE)
209-
apr_status_t err = APR_SUCCESS;
210-
#endif
211183

212184
TCN_ALLOC_CSTRING(engine);
213185

@@ -222,41 +194,6 @@ TCN_IMPLEMENT_CALL(jint, SSL, initialize)(TCN_STDARGS, jstring engine)
222194
TCN_FREE_CSTRING(engine);
223195
return (jint)APR_SUCCESS;
224196
}
225-
/* Openssl v1.1+ handles all initialisation automatically, apart
226-
* from hints as to how we want to use the library.
227-
*
228-
* We tell openssl we want to include engine support.
229-
*/
230-
OPENSSL_init_ssl(OPENSSL_INIT_ENGINE_ALL_BUILTIN, NULL);
231-
232-
#ifndef OPENSSL_NO_ENGINE
233-
if (J2S(engine)) {
234-
ENGINE *ee = NULL;
235-
if(strcmp(J2S(engine), "auto") == 0) {
236-
ENGINE_register_all_complete();
237-
}
238-
else {
239-
if ((ee = ENGINE_by_id(J2S(engine))) == NULL
240-
&& (ee = ssl_try_load_engine(J2S(engine))) == NULL)
241-
err = APR_ENOTIMPL;
242-
else {
243-
#ifdef ENGINE_CTRL_CHIL_SET_FORKCHECK
244-
if (strcmp(J2S(engine), "chil") == 0)
245-
ENGINE_ctrl(ee, ENGINE_CTRL_CHIL_SET_FORKCHECK, 1, 0, 0);
246-
#endif
247-
if (!ENGINE_set_default(ee, ENGINE_METHOD_ALL))
248-
err = APR_ENOTIMPL;
249-
}
250-
}
251-
if (err != APR_SUCCESS) {
252-
TCN_FREE_CSTRING(engine);
253-
ssl_init_cleanup(NULL);
254-
tcn_ThrowAPRException(e, err);
255-
return (jint)err;
256-
}
257-
tcn_ssl_engine = ee;
258-
}
259-
#endif
260197

261198
memset(&tcn_password_callback, 0, sizeof(tcn_pass_cb_t));
262199
/* Initialize PRNG

native/src/sslcontext.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -961,13 +961,7 @@ TCN_IMPLEMENT_CALL(jboolean, SSLContext, setCertificate)(TCN_STDARGS, jlong ctx,
961961
}
962962
}
963963
else {
964-
if ((c->keys[idx] = load_pem_key(c, key_file)) == NULL
965-
#ifndef OPENSSL_NO_ENGINE
966-
&& (tcn_ssl_engine == NULL ||
967-
(c->keys[idx] = ENGINE_load_private_key(tcn_ssl_engine, key_file,
968-
NULL, NULL)) == NULL)
969-
#endif
970-
) {
964+
if ((c->keys[idx] = load_pem_key(c, key_file)) == NULL) {
971965
ERR_error_string_n(SSL_ERR_get(), err, TCN_OPENSSL_ERROR_STRING_LENGTH);
972966
tcn_Throw(e, "Unable to load certificate key %s (%s)",
973967
key_file, err);

0 commit comments

Comments
 (0)