1 |
diff -up openssl-3.0.1/providers/fips/self_test.c.earlykats openssl-3.0.1/providers/fips/self_test.c |
2 |
--- openssl-3.0.1/providers/fips/self_test.c.earlykats 2022-01-19 13:10:00.635830783 +0100 |
3 |
+++ openssl-3.0.1/providers/fips/self_test.c 2022-01-19 13:11:43.309342656 +0100 |
4 |
@@ -362,6 +362,16 @@ int SELF_TEST_post(SELF_TEST_POST_PARAMS |
5 |
if (ev == NULL) |
6 |
goto end; |
7 |
|
8 |
+ /* |
9 |
+ * Run the KAT's before HMAC verification according to FIPS-140-3 requirements |
10 |
+ */ |
11 |
+ if (kats_already_passed == 0) { |
12 |
+ if (!SELF_TEST_kats(ev, st->libctx)) { |
13 |
+ ERR_raise(ERR_LIB_PROV, PROV_R_SELF_TEST_KAT_FAILURE); |
14 |
+ goto end; |
15 |
+ } |
16 |
+ } |
17 |
+ |
18 |
module_checksum = fips_hmac_container; |
19 |
checksum_len = sizeof(fips_hmac_container); |
20 |
|
21 |
@@ -411,18 +421,6 @@ int SELF_TEST_post(SELF_TEST_POST_PARAMS |
22 |
kats_already_passed = 1; |
23 |
} |
24 |
} |
25 |
- |
26 |
- /* |
27 |
- * Only runs the KAT's during installation OR on_demand(). |
28 |
- * NOTE: If the installation option 'self_test_onload' is chosen then this |
29 |
- * path will always be run, since kats_already_passed will always be 0. |
30 |
- */ |
31 |
- if (on_demand_test || kats_already_passed == 0) { |
32 |
- if (!SELF_TEST_kats(ev, st->libctx)) { |
33 |
- ERR_raise(ERR_LIB_PROV, PROV_R_SELF_TEST_KAT_FAILURE); |
34 |
- goto end; |
35 |
- } |
36 |
- } |
37 |
ok = 1; |
38 |
end: |
39 |
OSSL_SELF_TEST_free(ev); |