File openssl-fips-run_selftests_only_when_module_is_complete.patch of Package openssl-1_1.31470

Index: openssl-1.1.0i/crypto/fips/fips.c
===================================================================
--- openssl-1.1.0i.orig/crypto/fips/fips.c	2019-12-16 12:24:37.467635634 +0100
+++ openssl-1.1.0i/crypto/fips/fips.c	2019-12-16 12:24:38.015639197 +0100
@@ -445,15 +445,15 @@ int FIPS_module_mode_set(int onoff)
         }
 # endif
 
-        if (!FIPS_selftest()) {
+        if (!verify_checksums()) {
+            FIPSerr(FIPS_F_FIPS_MODULE_MODE_SET,
+                    FIPS_R_FINGERPRINT_DOES_NOT_MATCH);
             fips_selftest_fail = 1;
             ret = 0;
             goto end;
         }
 
-        if (!verify_checksums()) {
-            FIPSerr(FIPS_F_FIPS_MODULE_MODE_SET,
-                    FIPS_R_FINGERPRINT_DOES_NOT_MATCH);
+        if (!FIPS_selftest()) {
             fips_selftest_fail = 1;
             ret = 0;
             goto end;
openSUSE Build Service is sponsored by