Maxim Dounin
April 26, 2018 09:34AM
Hello!

On Wed, Apr 25, 2018 at 11:52:45AM -0400, Anderson Sasaki wrote:

> # HG changeset patch
> # User Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
> # Date 1524670310 -7200
> # Wed Apr 25 17:31:50 2018 +0200
> # Node ID f916a804d526c1acb493c7c4e5c114d947e0eed1
> # Parent 46c0c7ef4913011f3f1e073f9ac880b07b1a8154
> SSL: Add ENGINE_init() calls before using engines.
> It is necessary to call ENGINE_init() before using a OpenSSL engine
> to get the engine functional reference.
>
> diff -r 46c0c7ef4913 -r f916a804d526 src/event/ngx_event_openssl.c
> --- a/src/event/ngx_event_openssl.c Wed Apr 25 14:57:24 2018 +0300
> +++ b/src/event/ngx_event_openssl.c Wed Apr 25 17:31:50 2018 +0200
> @@ -527,27 +527,44 @@
> return NGX_ERROR;
> }
>
> + if (!ENGINE_init(engine)) {
> + ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
> + "ENGINE_init(\"%s\") failed", p);
> + ENGINE_free(engine);
> + return NGX_ERROR;
> + }
> +
> *last++ = ':';
>
> pkey = ENGINE_load_private_key(engine, (char *) last, 0, 0);
>
> if (pkey == NULL) {
> ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
> - "ENGINE_load_private_key(\"%s\") failed", last);
> + "ENGINE_load_private_key(\"%s\", %s, %d, %d) failed",
> + p, last, 0, 0);
> ENGINE_free(engine);
> return NGX_ERROR;
> }
>
> - ENGINE_free(engine);
> + if (!ENGINE_set_default(engine, ENGINE_METHOD_PKEY_METHS)) {
> + ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
> + "ENGINE_set_default(\"%s\", %s) failed",
> + p, "ENGINE_METHOD_PKEY_METHS");
> + EVP_PKEY_free(pkey);
> + ENGINE_free(engine);
> + return NGX_ERROR;
> + }

Apart from the ENGINE_init() discussion you are having with
Dmirty, the patch seems to contain various unrelated changes,
including logging changes and the ENGINE_set_default() call quoted
above.

If you really think these changes are needed, you may want to
either submit these changes separately (or document why these
changes should be in the ENGINE_init() patch in the commit log, if
you really think these changes should be an integral part of the
ENGINE_init() patch).

[...]

> @@ -4215,13 +4232,18 @@
> return NGX_CONF_ERROR;
> }
>
> - if (ENGINE_set_default(engine, ENGINE_METHOD_ALL) == 0) {
> - ngx_ssl_error(NGX_LOG_EMERG, cf->log, 0,
> - "ENGINE_set_default(\"%V\", ENGINE_METHOD_ALL) failed",
> + if (!ENGINE_init(engine)) {
> + ngx_ssl_error(NGX_LOG_EMERG, cf->log, 0, "ENGINE_init(\"%V\") failed",
> &value[1]);
> -
> ENGINE_free(engine);
> -
> + return NGX_CONF_ERROR;
> + }
> +
> + if (ENGINE_set_default(engine, ENGINE_METHOD_PKEY_METHS) == 0) {
> + ngx_ssl_error(NGX_LOG_EMERG, cf->log, 0,
> + "ENGINE_set_default(\"%V\", %s) failed",
> + &value[1], "ENGINE_METHOD_PKEY_METHS");
> + ENGINE_free(engine);
> return NGX_CONF_ERROR;
> }

Note well that the change in the ENGINE_set_default() arguments
here seems to be simply wrong.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] SSL: Add ENGINE_init() calls before using engines.

Anderson Sasaki 1160 April 25, 2018 11:54AM

Re: [PATCH] SSL: Add ENGINE_init() calls before using engines.

Anderson Sasaki 360 April 25, 2018 12:12PM

Re: [PATCH] SSL: Add ENGINE_init() calls before using engines.

Пичулин Дмитрий Николаевич 276 April 25, 2018 12:42PM

Re: [PATCH] SSL: Add ENGINE_init() calls before using engines.

Anderson Sasaki 277 April 25, 2018 01:50PM

Re: [PATCH] SSL: Add ENGINE_init() calls before using engines.

Пичулин Дмитрий Николаевич 272 April 25, 2018 04:00PM

Re: [PATCH] SSL: Add ENGINE_init() calls before using engines.

Anderson Sasaki 291 April 26, 2018 12:40PM

Re: [PATCH] SSL: Add ENGINE_init() calls before using engines.

Пичулин Дмитрий Николаевич 295 April 26, 2018 03:34PM

Re: [PATCH] SSL: Add ENGINE_init() calls before using engines.

Maxim Dounin 352 April 27, 2018 09:42AM

Re: [PATCH] SSL: Add ENGINE_init() calls before using engines.

Anderson Sasaki 466 April 27, 2018 11:30AM

Re: [PATCH] SSL: Add ENGINE_init() calls before using engines.

Maxim Dounin 295 May 03, 2018 10:34AM

Re: [PATCH] SSL: Add ENGINE_init() calls before using engines.

Anderson Sasaki 494 May 10, 2018 12:44PM

Re: [PATCH] SSL: Add ENGINE_init() calls before using engines.

Maxim Dounin 379 May 17, 2018 04:30PM

Re: [PATCH] SSL: Add ENGINE_init() calls before using engines.

Anderson Sasaki 374 May 18, 2018 04:38AM

Re: [PATCH] SSL: Add ENGINE_init() calls before using engines.

Maxim Dounin 1100 May 22, 2018 10:20AM

Re: [PATCH] SSL: Add ENGINE_init() calls before using engines.

Maxim Dounin 313 April 26, 2018 09:34AM

Re: [PATCH] SSL: Add ENGINE_init() calls before using engines.

Anderson Sasaki 312 April 26, 2018 12:56PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 146
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready