Skip to content

Commit

Permalink
SSL: fixed possible configuration overwrite loading "engine:" keys.
Browse files Browse the repository at this point in the history
When loading certificate keys via ENGINE_load_private_key() in runtime,
it was possible to overwrite configuration on ENGINE_by_id() failure.
OpenSSL documention doesn't describe errors in details, the only reason
I found in the comment to example is when the engine is not available.
  • Loading branch information
pluknet committed May 3, 2024
1 parent a7e3cd5 commit 6f74940
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/event/ngx_event_openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,13 +764,13 @@ ngx_ssl_load_certificate_key(ngx_pool_t *pool, char **err,

engine = ENGINE_by_id((char *) p);

*last++ = ':';

if (engine == NULL) {
*err = "ENGINE_by_id() failed";
return NULL;
}

*last++ = ':';

pkey = ENGINE_load_private_key(engine, (char *) last, 0, 0);

if (pkey == NULL) {
Expand Down

0 comments on commit 6f74940

Please sign in to comment.