[DRAFT] Fix Windows ARM64 FIPS build; add Clang support for Windows FIPS#3013
Draft
[DRAFT] Fix Windows ARM64 FIPS build; add Clang support for Windows FIPS#3013
Conversation
| @@ -54,4 +68,3 @@ const uint8_t BORINGSSL_bcm_rodata_end[16] = | |||
| #error "This file should be compiled only as part of the Shared FIPS build on macOS/iOS/Windows." | |||
Contributor
There was a problem hiding this comment.
warning: "This file should be compiled only as part of the Shared FIPS build on macOS/iOS/Windows." [clang-diagnostic-error]
#error "This file should be compiled only as part of the Shared FIPS build on macOS/iOS/Windows."
^
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3013 +/- ##
==========================================
+ Coverage 78.32% 78.35% +0.02%
==========================================
Files 689 689
Lines 121007 121010 +3
Branches 16994 16991 -3
==========================================
+ Hits 94783 94820 +37
+ Misses 25330 25296 -34
Partials 894 894 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
69f7463 to
77103f0
Compare
7e5a8e8 to
93ef530
Compare
93ef530 to
77103f0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issues:
Addresses: #2981
Related PR: #2982
Description of changes:
The Windows FIPS shared library build previously used a two-DLL approach: build
precrypto.dllwith a placeholder hash, run it to capture the real hash, then rebuild a separatecrypto.dllwith the correct hash embedded. This fails on ARM64 Windows (mandatory ASLR causes the linker to produce different ADRP immediates between the two DLLs) and with Clang'slld-linklinker.This PR replaces the two-DLL approach with a single-DLL capture-and-patch strategy for all Windows FIPS builds:
crypto.dllonce with a placeholder hashfips_empty_main.exe(linked against it) — the integrity check fails and prints the correct hashcrypto.dllThis eliminates the
precrypto/generated_fipsmodule/generated_fips_shared_support.cmachinery entirely.Additionally, this PR adds Clang compiler support for the Windows FIPS build:
_MSC_VERpreprocessor guards to_MSC_VER || (__clang__ && _WIN32)for FIPS section pragmas, CRT constructors/destructors,__declspec(noreturn), and binary-mode I/O#pragma section+__declspec(allocate())for FIPS rodata markers (needed by clang-cl on ARM64)#pragma const_seg()reset infips_shared_support.cto keep the hash outside the FIPS integrity boundaryllvm-libsupport infipsmodule/CMakeLists.txtfor buildingbcm.libwith plain ClangCall-outs:
fips_empty_main.exeat build time, so FIPS cross-compilation (e.g., building ARM64 on x64) is not supported. This is the same limitation the previouscapture_hashapproach had.capture_hash.gooutput parser was made more robust (content-based search instead of strict line numbers) to tolerate additional diagnostic output.code_seg,const_seg, etc.) required for FIPS section placement, so FIPS remains unsupported with MinGW.Testing:
windows-alt.ymlupdated with FIPS=1 build matrix variants forclang,clang-cl-msbuild(x64),clang-cl-ninja(x64), andmsys2(clang64 only).actions-ci.ymlandwindows-omnibus.ymljobs cover MSVC x64 and ARM64 FIPS builds.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.