Configure/Makefile: install the fips provider if it was configured
authorDr. Matthias St. Pierre <matthias.st.pierre@ncp-e.com>
Sun, 25 Apr 2021 22:14:59 +0000 (00:14 +0200)
committerDr. Matthias St. Pierre <matthias.st.pierre@ncp-e.com>
Thu, 29 Apr 2021 09:26:57 +0000 (11:26 +0200)
To follow the principle "what you configure is what you install",
the `make install` target now includes the installation of the
fips provider (`make install_fips`) if (and only if) OpenSSL was
configured with fips support (`enable-fips`).

The `make install_fips` target exists as well and can be used
to install just the fips provider. It requires `enable-fips`
and issues an error message if `no-fips` was configured.

The anologue holds for the 'uninstall_fips' target.

Fixes #13693

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13684)

Configurations/unix-Makefile.tmpl
Configurations/windows-makefile.tmpl

index bc82527579d061a42c0df3ab19420070d49fa19d..4ace44477d0416284d0ff9eec9d9f0502e18e54b 100644 (file)
@@ -526,9 +526,9 @@ list-tests:
        @echo "Tests are not supported with your chosen Configure options"
        @ : {- output_on() if !$disabled{tests}; "" -}
 
-install: install_sw install_ssldirs install_docs
+install: install_sw install_ssldirs install_docs {- $disabled{fips} ? "" : "install_fips" -}
 
-uninstall: uninstall_docs uninstall_sw
+uninstall: uninstall_docs uninstall_sw {- $disabled{fips} ? "" : "uninstall_fips" -}
 
 libclean:
        @set -e; for s in $(SHLIB_INFO); do \
@@ -594,6 +594,7 @@ install_docs: install_man_docs install_html_docs
 uninstall_docs: uninstall_man_docs uninstall_html_docs
        $(RM) -r $(DESTDIR)$(DOCDIR)
 
+{- output_off() if $disabled{fips}; "" -}
 install_fips: build_sw providers/fipsmodule.cnf
        @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
        @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MODULESDIR)
@@ -612,6 +613,14 @@ uninstall_fips:
        $(RM) $(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf
        @$(ECHO) "*** Uninstalling FIPS module"
        $(RM) $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)
+{- if ($disabled{fips}) { output_on(); } else { output_off(); } "" -}
+install_fips:
+       @$(ECHO) "The 'install_fips' target requires the 'enable-fips' option"
+
+uninstall_fips:
+       @$(ECHO) "The 'uninstall_fips' target requires the 'enable-fips' option"
+{- output_on() if !$disabled{fips}; "" -}
+
 
 install_ssldirs:
        @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
index 1e388d0b5f6e480d1adc2c1d7a390cfa09eee60e..c6d63651cbd04c7f1b3b0f249242b240edc42162 100644 (file)
@@ -477,6 +477,7 @@ install_docs: install_html_docs
 
 uninstall_docs: uninstall_html_docs
 
+{- output_off() if $disabled{fips}; "" -}
 install_fips: build_sw providers\fipsmodule.cnf
 #      @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
        @$(PERL) $(SRCDIR)\util\mkdir-p.pl $(MODULESDIR)
@@ -494,6 +495,13 @@ uninstall_fips:
        $(RM) "$(OPENSSLDIR)\fipsmodule.cnf"
        @$(ECHO) "*** Uninstalling FIPS module"
        $(RM) "$(MODULESDIR)\$(FIPSMODULENAME)"
+{- if ($disabled{fips}) { output_on(); } else { output_off(); } "" -}
+install_fips:
+       @$(ECHO) "The 'install_fips' target requires the 'enable-fips' option"
+
+uninstall_fips:
+       @$(ECHO) "The 'uninstall_fips' target requires the 'enable-fips' option"
+{- output_on() if !$disabled{fips}; "" -}
 
 install_ssldirs:
        @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\certs"