Skip to content

Loading OpenSSL config files twice #29702

Closed
@OYTIS

Description

@OYTIS

Problem

When OPENSSL_CONF environment variable is set, config files are loaded twice.

Reason

InitCryptoOnce function in node_crypto.cc first calls SSL_load_error_strings() which is a macro for OPENSSL_init_ssl() which in turn will at some point will call CONF_modules_load_file() for the file pointed to by OPENSSL_CONF environment variable. Then in the same function (InitCryptoOnce()) CONF_modules_load_file() will be called again for the file pointed to by openssl_config command line option.

But upon nodejs initialization, if openssl_config is not given, and if OPENSSL_CONF is set, openssl_config is set to the value in OPENSSL_CONF. As a result CONF_modules_load_file() will be called twice.

Impact

Normally none, except for cases when the config is not idempotent, as is the case e.g. when dynamic engines need to be loaded. In which case it is also not a huge deal, but the user will see a scary error message:

openssl config failed: error:26078067:engine routines:engine_list_add:conflicting engine id

Not sure what would be the best fix, probably it's also not too urgent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions