2023-08-22 14:39:12 +00:00
|
|
|
From 2c110cf5551a3869514e697d8dc06682b62ca57d Mon Sep 17 00:00:00 2001
|
|
|
|
From: Dmitry Belyavskiy <dbelyavs@redhat.com>
|
|
|
|
Date: Mon, 21 Aug 2023 11:59:02 +0200
|
|
|
|
Subject: [PATCH 16/48] 0032-Force-fips.patch
|
2023-07-31 08:04:55 +00:00
|
|
|
|
|
|
|
Patch-name: 0032-Force-fips.patch
|
|
|
|
Patch-id: 32
|
|
|
|
Patch-status: |
|
|
|
|
# We load FIPS provider and set FIPS properties implicitly
|
|
|
|
---
|
2023-08-22 14:39:12 +00:00
|
|
|
crypto/provider_conf.c | 28 +++++++++++++++++++++++++++-
|
|
|
|
1 file changed, 27 insertions(+), 1 deletion(-)
|
2023-07-31 08:04:55 +00:00
|
|
|
|
|
|
|
diff --git a/crypto/provider_conf.c b/crypto/provider_conf.c
|
2023-08-22 14:39:12 +00:00
|
|
|
index 058fb58837..5274265a70 100644
|
2023-07-31 08:04:55 +00:00
|
|
|
--- a/crypto/provider_conf.c
|
|
|
|
+++ b/crypto/provider_conf.c
|
2023-08-22 14:39:12 +00:00
|
|
|
@@ -10,6 +10,8 @@
|
2022-12-23 10:53:21 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <openssl/trace.h>
|
|
|
|
#include <openssl/err.h>
|
|
|
|
+#include <openssl/evp.h>
|
2023-08-22 14:39:12 +00:00
|
|
|
+#include <unistd.h>
|
2022-12-23 10:53:21 +00:00
|
|
|
#include <openssl/conf.h>
|
|
|
|
#include <openssl/safestack.h>
|
|
|
|
#include <openssl/provider.h>
|
2023-08-22 14:39:12 +00:00
|
|
|
@@ -169,7 +171,7 @@ static int provider_conf_activate(OSSL_LIB_CTX *libctx, const char *name,
|
2023-07-27 16:50:18 +00:00
|
|
|
if (path != NULL)
|
|
|
|
ossl_provider_set_module_path(prov, path);
|
2022-09-01 10:42:16 +00:00
|
|
|
|
2023-07-27 16:50:18 +00:00
|
|
|
- ok = provider_conf_params(prov, NULL, NULL, value, cnf);
|
|
|
|
+ ok = cnf ? provider_conf_params(prov, NULL, NULL, value, cnf) : 1;
|
2022-09-01 10:42:16 +00:00
|
|
|
|
2023-12-08 12:39:16 +00:00
|
|
|
if (ok == 1) {
|
2023-07-27 16:50:18 +00:00
|
|
|
if (!ossl_provider_activate(prov, 1, 0)) {
|
2023-08-22 14:39:12 +00:00
|
|
|
@@ -309,6 +311,30 @@ static int provider_conf_init(CONF_IMODULE *md, const CONF *cnf)
|
2022-09-01 10:42:16 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (ossl_get_kernel_fips_flag() != 0) { /* XXX from provider_conf_load */
|
|
|
|
+ OSSL_LIB_CTX *libctx = NCONF_get0_libctx((CONF *)cnf);
|
2023-08-22 14:39:12 +00:00
|
|
|
+# define FIPS_LOCAL_CONF OPENSSLDIR "/fips_local.cnf"
|
|
|
|
+
|
|
|
|
+ if (access(FIPS_LOCAL_CONF, R_OK) == 0) {
|
|
|
|
+ CONF *fips_conf = NCONF_new_ex(libctx, NCONF_default());
|
|
|
|
+ if (NCONF_load(fips_conf, FIPS_LOCAL_CONF, NULL) <= 0)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ if (provider_conf_load(libctx, "fips", "fips_sect", fips_conf) != 1) {
|
|
|
|
+ NCONF_free(fips_conf);
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ NCONF_free(fips_conf);
|
|
|
|
+ } else {
|
|
|
|
+ if (provider_conf_activate(libctx, "fips", NULL, NULL, 0, NULL) != 1)
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
2022-09-01 10:42:16 +00:00
|
|
|
+ if (provider_conf_activate(libctx, "base", NULL, NULL, 0, NULL) != 1)
|
|
|
|
+ return 0;
|
|
|
|
+ if (EVP_default_properties_enable_fips(libctx, 1) != 1)
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2023-07-31 08:04:55 +00:00
|
|
|
--
|
|
|
|
2.41.0
|
|
|
|
|