Blame SOURCES/nginx-1.14.0-pkcs11.patch
|
|
67ea12 |
# HG changeset patch
|
|
|
67ea12 |
# User Anderson Sasaki <ansasaki@redhat.com>
|
|
|
67ea12 |
# Date 1533742801 -7200
|
|
|
67ea12 |
# Wed Aug 08 17:40:01 2018 +0200
|
|
|
67ea12 |
# Node ID ae457c9b2967da1b05aefcf1e81c099e9375c0d7
|
|
|
67ea12 |
# Parent ba971deb4b447662e3c47fcc860b34d43469162a
|
|
|
67ea12 |
SSL: added ENGINE_init() call before loading key.
|
|
|
67ea12 |
|
|
|
67ea12 |
It is necessary to call ENGINE_init() before using an OpenSSL engine
|
|
|
67ea12 |
to get the engine functional reference. Without this, when
|
|
|
67ea12 |
ENGINE_load_private_key() is called, the engine is still uninitialized.
|
|
|
67ea12 |
|
|
|
67ea12 |
diff -r ba971deb4b44 -r ae457c9b2967 src/event/ngx_event_openssl.c
|
|
|
67ea12 |
--- a/src/event/ngx_event_openssl.c Tue Aug 07 02:16:07 2018 +0300
|
|
|
67ea12 |
+++ b/src/event/ngx_event_openssl.c Wed Aug 08 17:40:01 2018 +0200
|
|
|
67ea12 |
@@ -533,6 +533,13 @@
|
|
|
67ea12 |
return NGX_ERROR;
|
|
|
67ea12 |
}
|
|
|
67ea12 |
|
|
|
67ea12 |
+ if (!ENGINE_init(engine)) {
|
|
|
67ea12 |
+ ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
|
|
|
67ea12 |
+ "ENGINE_init(\"%s\") failed", p);
|
|
|
67ea12 |
+ ENGINE_free(engine);
|
|
|
67ea12 |
+ return NGX_ERROR;
|
|
|
67ea12 |
+ }
|
|
|
67ea12 |
+
|
|
|
67ea12 |
*last++ = ':';
|
|
|
67ea12 |
|
|
|
67ea12 |
pkey = ENGINE_load_private_key(engine, (char *) last, 0, 0);
|
|
|
67ea12 |
@@ -540,10 +547,12 @@
|
|
|
67ea12 |
if (pkey == NULL) {
|
|
|
67ea12 |
ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
|
|
|
67ea12 |
"ENGINE_load_private_key(\"%s\") failed", last);
|
|
|
67ea12 |
+ ENGINE_finish(engine);
|
|
|
67ea12 |
ENGINE_free(engine);
|
|
|
67ea12 |
return NGX_ERROR;
|
|
|
67ea12 |
}
|
|
|
67ea12 |
|
|
|
67ea12 |
+ ENGINE_finish(engine);
|
|
|
67ea12 |
ENGINE_free(engine);
|
|
|
67ea12 |
|
|
|
67ea12 |
if (SSL_CTX_use_PrivateKey(ssl->ctx, pkey) == 0) {
|