util/wrap.pl: use the apps/openssl.cnf from the source tree
authorDr. Matthias St. Pierre <matthias.st.pierre@ncp-e.com>
Mon, 8 Feb 2021 23:16:55 +0000 (00:16 +0100)
committerDr. Matthias St. Pierre <matthias.st.pierre@ncp-e.com>
Tue, 13 Apr 2021 10:13:10 +0000 (12:13 +0200)
commit3ab736acb89c277bd174f958591c65c66d611c72
treed0d10b08acc34c9a602208bedfad3ef501df1e93
parent0f10196042a4aa43b9b1966e0709060c5b8658bc
util/wrap.pl: use the apps/openssl.cnf from the source tree

The `make install_fips` target failed

    msp@debian:~/src/openssl$ make install_fips
    *** Installing FIPS module
    install providers/fips.so -> /opt/openssl-dev/lib/ossl-modules/fips.so
    *** Installing FIPS module configuration
    fipsinstall /opt/openssl-dev/ssl/fipsmodule.cnf
    FATAL: Startup failure (dev note: apps_startup()) for ./apps/openssl
    ... No such file or directory:crypto/conf/conf_def.c:771:calling stat(fipsmodule.cnf)
    ...
    make: *** [Makefile:3341: install_fips] Error 1

because the `openssl fipsinstall` command was loading a previously installed
configuration file instead of the copy shipped with the source tree.

    msp@debian:~/src/openssl$ strace -f make install_fips |& grep openssl.cnf
    [pid 128683] openat(AT_FDCWD, "/opt/openssl-dev/ssl/openssl.cnf", O_RDONLY) = 3

This issue reveiled a more general problem, which applies to the tests as well:
unless openssl is installed, the openssl app must not use any preinstalled
configuration file. This holds in particular when the preinstalled configuration
file load providers, which caused the above failure.

The most consistent way to achieve this behaviour is to set the OPENSSL_CONF
environment variable to the correct location in the util/wrap.pl perl wrapper.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14136)
Configurations/unix-Makefile.tmpl
Configurations/windows-makefile.tmpl
util/wrap.pl