]> git.kaiwu.me - haproxy.git/commitdiff
SCRIPTS: honor FIPS mode when building AWS-LC
authorWilliam Lallemand <wlallemand@haproxy.com>
Thu, 3 Dec 2026 14:55:54 +0000 (14:55 +0000)
committerWilliam Lallemand <wlallemand@haproxy.com>
Thu, 3 Dec 2026 15:00:05 +0000 (16:00 +0100)
The AWS-LC FIPS workflow passes FIPS=1 with AWS_LC_VERSION, but the
shared build helper ignored it and always disabled Go and Perl code
generation. Consequently the jobs built non-FIPS libraries and left
HAProxy's FIPS-specific code paths untested despite appearing to cover
them.

This was introduced by d572a131a7 ("CI: github: add AWS-LC FIPS testing
workflow"), which added the workflow without updating the build helper.

Pass the FIPS setting to CMake and enable the required generators for
FIPS builds. Append -fips to the installed-version marker only in FIPS
mode, leaving the build directory and workflow cache key unchanged.

This fix should be backported to 3.5.

scripts/build-ssl.sh

index 5421b055554f6f9949e80ba2768a0843222c36ad..5b5b0e072a8766652a3a052ee711db3261b286ab 100755 (executable)
@@ -6,6 +6,7 @@ BUILDSSL_TMPDIR=${BUILDSSL_TMPDIR:-/tmp/download-cache}
 QUICTLS_URL=${QUICTLS_URL:-https://github.com/quictls/openssl}
 WOLFSSL_DEBUG=${WOLFSSL_DEBUG:-0}
 GIT_TYPE=${GIT_TYPE:-commit}
+FIPS=${FIPS:-0}
 
 
 
@@ -150,21 +151,32 @@ download_aws_lc () {
 }
 
 build_aws_lc () {
-    if [ "$(cat ${BUILDSSL_DESTDIR}/.aws_lc-version)" != "${AWS_LC_VERSION}" ]; then
+    fips_suffix=
+    if [ "${FIPS}" -eq 1 ]; then
+        fips_suffix=-fips
+    fi
+    if [ "$(cat ${BUILDSSL_DESTDIR}/.aws_lc-version)" != "${AWS_LC_VERSION}${fips_suffix}" ]; then
         mkdir -p "${BUILDSSL_TMPDIR}/aws-lc-${AWS_LC_VERSION}/"
         tar zxf "${BUILDSSL_TMPDIR}/aws-lc-${AWS_LC_VERSION}.tar.gz" -C "${BUILDSSL_TMPDIR}/aws-lc-${AWS_LC_VERSION}/" --strip-components=1
         (
            cd "${BUILDSSL_TMPDIR}/aws-lc-${AWS_LC_VERSION}/"
            mkdir -p build
            cd build
+           # FIPS mode requires Go and Perl to generate the module and its integrity hash.
+           if [ "${FIPS}" -eq 1 ]; then
+               disable_codegen=0
+           else
+               disable_codegen=1
+           fi
            cmake -version
-           cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=1 -DDISABLE_GO=1 -DDISABLE_PERL=1 \
+           cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=1 -DFIPS=${FIPS} \
+                 -DDISABLE_GO=${disable_codegen} -DDISABLE_PERL=${disable_codegen} \
                  -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_INSTALL_RPATH=${BUILDSSL_DESTDIR}/lib \
                  -DBUILD_TESTING=0 -DCMAKE_INSTALL_PREFIX=${BUILDSSL_DESTDIR} ..
            make -j$(nproc)
            make install
         )
-        echo "${AWS_LC_VERSION}" > "${BUILDSSL_DESTDIR}/.aws_lc-version"
+        echo "${AWS_LC_VERSION}${fips_suffix}" > "${BUILDSSL_DESTDIR}/.aws_lc-version"
     fi
 }