From 62b0a1a7b54aca9c628b1ade6d4718b5faeacaeb Mon Sep 17 00:00:00 2001 From: Kaushik Raina <103954755+k-raina@users.noreply.github.com> Date: Thu, 5 Oct 2023 17:58:58 +0530 Subject: [PATCH] FIPS: Add pom profile to build fips compliant boringSSL netty-tcnative (#821) ### Motivation: As discussed in [issue](https://github.com/netty/netty-tcnative/issues/799), considering the growing demand for FIPS compliance in security-sensitive environments, an official netty-tcnative release supporting FIPS validation would greatly benefit the open-source community. This would simplify integration and provide a reliable, community-supported solution. ### Setup Configurations: Tools: cmake 3.20, ninja build 1.10.0, clang-12, golang, java 11, maven 3.6.3, libapr1, automake, autoconf, libtool, libunwind-dev, pkg-config Fips validated BoringSSL commit used is 853ca1ea1168dff08011e5d42d94609cc0ca2e27 ### Build Steps: - Run Maven ``` mvn clean install -f boringssl-static/pom.xml -Pfips-boringssl-static ``` - While build is running you should see in logs: ``` ... Boringssl is fips compliant ... ``` - After build steps are completed you should see Jars eg. ``` .m2/repository/io/netty/netty-tcnative-boringssl-static/2.0.61.Final/netty-tcnative-boringssl-static-2.0.61.Final.jar .m2/repository/io/netty/netty-tcnative-boringssl-static/2.0.61.Final/netty-tcnative-boringssl-static-2.0.61.Final-linux-x86_64.jar ``` ### Modifications: - Added pom profile `fips-boringssl-static` for fips compliant ### Tested on: Tested on linux AMD and ARM machine, which are supported as per FIPS security document attached in reference. Output: https://drive.google.com/file/d/1eAFUIrHLbB7xiTpxHPs__N3Ha_Ltli76/view?usp=sharing ### Reference: Guidance on how to build FIPS validated modules: https://csrc.nist.gov/CSRC/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp4407.pdf --------- Co-authored-by: Norman Maurer --- boringssl-static/pom.xml | 278 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 277 insertions(+), 1 deletion(-) diff --git a/boringssl-static/pom.xml b/boringssl-static/pom.xml index 2acd2e9be..1cb667fd2 100644 --- a/boringssl-static/pom.xml +++ b/boringssl-static/pom.xml @@ -75,6 +75,282 @@ + + + + fips-boringssl-static + + ${project.build.directory}/boringssl-${boringsslBranch}/boringssl + ${boringsslCheckoutDir}/build + + 853ca1ea1168dff08011e5d42d94609cc0ca2e27 + true + ${boringsslCheckoutDir}/include + ${boringsslBuildDir}/ssl;${boringsslBuildDir}/crypto;${boringsslBuildDir}/decrepit + ssl.lib;crypto.lib;decrepit.lib + ${os.detected.arch} + + + + + + + + com.googlecode.maven-download-plugin + download-maven-plugin + 1.6.8 + + + install-fips-boringssl + process-sources + + wget + + + + + https://commondatastorage.googleapis.com/chromium-boringssl-fips/boringssl-${boringsslBranch}.tar.xz + true + ${project.build.directory}/boringssl-${boringsslBranch} + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + generate-sources + + add-source + + + + ${generatedSourcesDir}/java + + + + + + + + + org.apache.felix + maven-bundle-plugin + + + ${aprVersion} + ${boringsslBuildNumber} + ${boringsslBranch} + + + + + + maven-antrun-plugin + + + + build-boringssl + compile + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + native-jar + package + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.fusesource.hawtjni + maven-hawtjni-plugin + + + build-native-lib + + generate + build + + compile + + netty_tcnative + ${generatedSourcesDir}/c + ${generatedSourcesDir}/native-package + ${nativeLibOnlyDir} + ${forceAutogen} + ${forceConfigure} + msbuild + + + --with-ssl=no + --with-apr=${aprHome} + --with-static-libs + --libdir=${project.build.directory}/native-build/target/lib + CFLAGS=-O3 -Werror -fno-omit-frame-pointer -fvisibility=hidden -Wunused -Wno-unused-value + CPPFLAGS=-DHAVE_OPENSSL -I${boringsslCheckoutDir}/include + LDFLAGS=-L${boringsslBuildDir}/ssl -L${boringsslBuildDir}/crypto -L${boringsslBuildDir}/decrepit -ldecrepit -lssl -lcrypto + + + + + + + + + boringssl-static-default @@ -285,7 +561,7 @@ - +