feat(openssl): force SymCrypt as FIPS provider in kernel FIPS mode - #18345
feat(openssl): force SymCrypt as FIPS provider in kernel FIPS mode#18345Tobias Brick (tobiasb-ms) wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Replaces Fedora’s OpenSSL FIPS provider integration with Azure Linux’s SymCrypt provider.
Changes:
- Adds kernel-FIPS SymCrypt activation and property-query tests.
- Replaces the provider dependency and removes obsolete FIPS configuration.
- Refreshes rendered output and the component lock.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
base/comps/openssl/openssl.comp.toml |
Defines SymCrypt overlays. |
base/comps/openssl/0080-azl-force-symcrypt-in-kernel-fips-mode.patch |
Implements and tests FIPS behavior. |
specs/o/openssl/openssl.spec |
Contains rendered packaging changes. |
specs/o/openssl/0080-azl-force-symcrypt-in-kernel-fips-mode.patch |
Contains the rendered patch. |
locks/openssl.lock |
Refreshes the input fingerprint. |
Suppressed comments (1)
base/comps/openssl/0080-azl-force-symcrypt-in-kernel-fips-mode.patch:498
- This test codifies a fail-open path: with
config_diagnostics = 0, failure to find or activate mandatory SymCrypt is ignored and OpenSSL continues without SymCrypt or the merged FIPS property query. Kernel FIPS mode should make forced-provider activation failures fatal; update initialization accordingly and assert this command fails when the section/provider is unavailable.
+$ENV{OPENSSL_FORCE_FIPS_MODE} = 1;
+$ENV{OPENSSL_CONF} = srctop_file("test", "prov_conf_symcrypt_missing.cnf");
+
+ok(run(app(["openssl", "list", "-providers"])),
+ "real init retains Fedora's ignored provider-module failure behavior");
11656d7 to
73dd3ce
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.
Suppressed comments (3)
base/comps/openssl/0080-azl-force-symcrypt-in-kernel-fips-mode.patch:111
- In kernel FIPS mode, a custom
OPENSSL_CONFthat omits the system drop-in now makes this module return failure instead of loading SymCrypt. Because the shipped/default behavior usesconfig_diagnostics = 0,OPENSSL_init_crypto()ignores that failure (the new real-init test explicitly relies on this), so the process can continue without SymCrypt,base, or?fips=yes. This defeats the promised forced activation. Load the packaged SymCrypt configuration from a trusted fixed path, or fall back to activatingsymcryptproviderby name when the ambient section is absent.
+ if (NCONF_get_section(cnf, AZL_FIPS_PROVIDER_SECTION) == NULL) {
+ ERR_raise_data(ERR_LIB_CRYPTO, CRYPTO_R_PROVIDER_SECTION_ERROR,
+ "section=%s not found", AZL_FIPS_PROVIDER_SECTION);
+ return 0;
base/comps/openssl/overlays/0001-force-symcrypt-fips.overlay.toml:15
- The unversioned dependency can be satisfied by an engine-only SymCrypt-OpenSSL release: this repository's own changelog records that the OpenSSL 3 provider was introduced in 1.4.0 (
specs/s/SymCrypt-OpenSSL/SymCrypt-OpenSSL.spec:184-186). Such a transaction would satisfy RPM while leaving the required module/config section absent. Require at least the provider-bearing version whose OpenSSL 3.5 configuration was verified (preferably the current 1.11.0).
replacement = 'Requires: SymCrypt-OpenSSL'
base/comps/openssl/0080-azl-force-symcrypt-in-kernel-fips-mode.patch:498
- This “real init” test only checks a zero exit status while deliberately supplying a configuration with no SymCrypt section; it therefore passes when provider initialization fails and that failure is ignored. The other tests use
p_test.soand a nondefault library context, so no test exercises successful global initialization against the packaged provider contract. Add a valid real-init case that assertssymcryptproviderandbaseare listed and the merged property is effective.
+$ENV{OPENSSL_FORCE_FIPS_MODE} = 1;
+$ENV{OPENSSL_CONF} = srctop_file("test", "prov_conf_symcrypt_missing.cnf");
+
+ok(run(app(["openssl", "list", "-providers"])),
+ "real init retains Fedora's ignored provider-module failure behavior");
73dd3ce to
a1372f5
Compare
a1372f5 to
f634f01
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.
Suppressed comments (1)
base/comps/openssl/0080-azl-force-symcrypt-in-kernel-fips-mode.patch:127
- The merge happens while the
providersconfig module is running, but config modules execute in file order and the shippedopenssl_initlistsprovidersbeforealg_section(0002-Add-a-separate-config-file-to-use-for-rpm-installs.patch:95-120). If an application setsdefault_propertiesin that same config, the later alg module callsevp_set_default_properties_int()and replaces this merged query, so kernel FIPS mode ends without?fips=yes. The tests hide this by loading the property config in a separate call first. Apply the FIPS merge afteralg_sectionprocessing (or otherwise after all config modules), and add a single-config ordering test.
+ if (evp_default_properties_merge(libctx, "?fips=yes", 0) != 1)
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.
Suppressed comments (1)
base/comps/openssl/0080-azl-force-symcrypt-in-kernel-fips-mode.patch:127
- The FIPS property can be overwritten later in the same configuration load. OpenSSL runs modules in
[openssl_init]order, and the shipped config placesprovidersbeforealg_section; when an application setsdefault_properties,alg_module_init()subsequently replaces the global query, removing this?fips=yes. The test avoids this path by loadingapp_cnfin a separate earlier call. Reapply the FIPS merge after algorithm configuration and add a single-config test withprovidersbeforealg_section.
+ if (evp_default_properties_merge(libctx, "?fips=yes", 0) != 1)
|
/azp run |
|
Azure Pipelines: 2 pipeline(s) were filtered out due to trigger conditions. |
Replace Fedora's fips.so/fips_local.cnf activation with Azure Linux's SymCrypt provider. In kernel FIPS mode, openssl now forces activation of symcryptprovider and base and merges ?fips=yes (best-effort) into the existing default property query, preserving any application-configured properties. - Patch80 hard-codes symcryptprovider/symcrypt_prov_sect, matching the drop-in shipped by SymCrypt-OpenSSL. - openssl-libs now requires SymCrypt-OpenSSL instead of openssl-fips-provider. - Drop the obsolete fips_local.cnf symlink and %files entry. - Add a unit test documenting config-order semantics: a later alg_section default_properties replaces the merged ?fips=yes (production load order), matching current Fedora behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f634f01 to
40c90c8
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.
Suppressed comments (1)
base/comps/openssl/0080-azl-force-symcrypt-in-kernel-fips-mode.patch:127
?fips=yesis optional, and OpenSSL 3.5.4'sossl_property_is_enabled()explicitly returns false for optional clauses. ConsequentlyEVP_default_properties_is_fips_enabled()(andFIPS_mode()) remains false in kernel FIPS mode, disabling existing FIPS-gated behavior such as the RSA cipher restrictions, FIPS RNG path, PKCS#12 defaults, and weak-curve filtering. Please retain a mandatory FIPS indicator or introduce a separate kernel-FIPS state for those checks while keeping optional provider fallback, and add a regression assertion for the FIPS-mode API.
+ if (evp_default_properties_merge(libctx, "?fips=yes", 0) != 1)
|
/azp run |
|
Azure Pipelines: 2 pipeline(s) were filtered out due to trigger conditions. |
Replaces Fedora's fips.so/fips_local.cnf activation with Azure Linux's SymCrypt provider.
In kernel FIPS mode, openssl now forces activation of
symcryptproviderandbase, and merges best-effort?fips=yesinto the existing default property query (preserving any application-configured properties).AB#23016
symcryptprovider/symcrypt_prov_sect, matching the drop-in shipped by SymCrypt-OpenSSL.openssl-libsnow requiresSymCrypt-OpenSSLinstead ofopenssl-fips-provider.fips_local.cnfsymlink and%filesentry.Validation:
opensslrpms. Updatedopenssl, put the machine into kernel FIPS mode and rebooted. I was able tosshinto the machine, do generalopenssloperations anddnf --refreshinstall something (which is a real-world usage ofopenssl).