|
118 | 118 | <properties> |
119 | 119 | <boringsslCheckoutDir>${project.build.directory}/boringssl-${boringsslBranch}/boringssl</boringsslCheckoutDir> |
120 | 120 | <boringsslBuildDir>${boringsslCheckoutDir}/build</boringsslBuildDir> |
121 | | - <!-- Latest FIPS compliant boringSSL commit --> |
122 | | - <boringsslBranch>6d503ae1cf8b2e25162435225610b8c1f063d6f4</boringsslBranch> |
| 121 | + <!-- The newest BoringCrypto module that holds a certificate: FIPS 140-3 #5244, module |
| 122 | + version 20240805, validated 2026-04-18. This sha is the head of BoringSSL's |
| 123 | + fips-20240805 branch, the tree the certificate's security policy names. Newer |
| 124 | + fips-YYYYMMDD branches exist (20250107, 20250728, 20251031, 2026xxxx) but their |
| 125 | + modules are still in the CMVP queue, so they hold no certificate anyone can cite. |
| 126 | + Any of them builds with this profile: -DboringsslBranch=<sha>. --> |
| 127 | + <boringsslBranch>1a089be69fdf568c6cf2cab05bd55f97e1f21025</boringsslBranch> |
123 | 128 | <linkStatic>true</linkStatic> |
124 | 129 | <msvcSslIncludeDirs>${boringsslCheckoutDir}/include</msvcSslIncludeDirs> |
125 | 130 | <msvcSslLibDirs>${boringsslBuildDir}/ssl;${boringsslBuildDir}/crypto;${boringsslBuildDir}/decrepit</msvcSslLibDirs> |
126 | 131 | <msvcSslLibs>ssl.lib;crypto.lib;decrepit.lib</msvcSslLibs> |
127 | 132 | <jniArch>${os.detected.arch}</jniArch> |
128 | 133 | <project.artifactId>netty-tcnative-boringssl-static-fips</project.artifactId> |
| 134 | + <!-- Compiler for BoringSSL itself (tcnative and APR are built with the host cc). |
| 135 | + Validation covers the toolchain as well as the source, and the version comes from |
| 136 | + the certificate's security policy: for #5244 that is clang 17.0.6, go 1.22.3, |
| 137 | + ninja 1.12.1, cmake 3.29.3, built with `ninja bcm.o`. The CI image |
| 138 | + (docker/Dockerfile.debian13) carries exactly those. clang-12 was the toolchain of |
| 139 | + an older validation and had been carried forward through two BoringSSL bumps. |
| 140 | + Override with -DfipsCC=... -DfipsCXX=... to build with something else. --> |
| 141 | + <fipsCC>clang-17</fipsCC> |
| 142 | + <fipsCXX>clang++-17</fipsCXX> |
129 | 143 | </properties> |
130 | 144 |
|
131 | 145 | <build> |
132 | 146 | <plugins> |
133 | 147 |
|
134 | | - <!-- Download the BoringSSL source --> |
| 148 | + <!-- Check out the FIPS-validated BoringSSL commit from git, the same way the default |
| 149 | + profile does. This used to download |
| 150 | + https://commondatastorage.googleapis.com/chromium-boringssl-fips/boringssl-<sha>.tar.xz |
| 151 | + but that bucket stopped being anonymously readable (403 AccessDenied on every |
| 152 | + object, 401 on the bucket itself, from several networks), so a fresh machine can |
| 153 | + no longer build this profile that way - downstream builds only kept working off |
| 154 | + download-maven-plugin's cache. The tarball is a snapshot of the tree at that |
| 155 | + commit, so checking out the same sha yields the same sources. The directory layout |
| 156 | + is kept identical to what the unpacked tarball produced, so nothing below changes. --> |
135 | 157 | <plugin> |
136 | | - <groupId>com.googlecode.maven-download-plugin</groupId> |
137 | | - <artifactId>download-maven-plugin</artifactId> |
138 | | - <version>1.6.8</version> |
| 158 | + <artifactId>maven-scm-plugin</artifactId> |
139 | 159 | <executions> |
140 | 160 | <execution> |
141 | | - <id>install-fips-boringssl</id> |
142 | | - <phase>process-sources</phase> |
| 161 | + <id>get-fips-boringssl</id> |
| 162 | + <phase>generate-sources</phase> |
143 | 163 | <goals> |
144 | | - <goal>wget</goal> |
| 164 | + <goal>checkout</goal> |
145 | 165 | </goals> |
| 166 | + <configuration> |
| 167 | + <checkoutDirectory>${boringsslCheckoutDir}</checkoutDirectory> |
| 168 | + <connectionType>developerConnection</connectionType> |
| 169 | + <developerConnectionUrl>scm:git:${boringsslRepository}</developerConnectionUrl> |
| 170 | + <scmVersion>main</scmVersion> |
| 171 | + <scmVersionType>branch</scmVersionType> |
| 172 | + <skipCheckoutIfExists>true</skipCheckoutIfExists> |
| 173 | + </configuration> |
146 | 174 | </execution> |
147 | 175 | </executions> |
148 | | - <configuration> |
149 | | - <url>https://commondatastorage.googleapis.com/chromium-boringssl-fips/boringssl-${boringsslBranch}.tar.xz</url> |
150 | | - <unpack>true</unpack> |
151 | | - <outputDirectory>${project.build.directory}/boringssl-${boringsslBranch}</outputDirectory> |
152 | | - </configuration> |
153 | 176 | </plugin> |
154 | 177 |
|
155 | 178 | <plugin> |
|
207 | 230 | <else> |
208 | 231 | <echo message="Building BoringSSL" /> |
209 | 232 |
|
| 233 | + <!-- Pin the checkout to the FIPS-validated commit --> |
| 234 | + <exec executable="git" failonerror="true" dir="${boringsslCheckoutDir}" resolveexecutable="true"> |
| 235 | + <arg value="checkout" /> |
| 236 | + <arg value="${boringsslBranch}" /> |
| 237 | + </exec> |
| 238 | + |
210 | 239 | <mkdir dir="${boringsslBuildDir}" /> |
211 | 240 |
|
212 | 241 | <if> |
|
234 | 263 | <property name="cmakeCxxFlags" value="-O3 -fno-omit-frame-pointer" /> |
235 | 264 | </else> |
236 | 265 | </if> |
| 266 | + <!-- The static archives end up inside a shared library, so they must be |
| 267 | + PIC, same as the default profile asks. Without it the aarch64 link |
| 268 | + fails on libcrypto.a(crypto.cc.o): "relocation |
| 269 | + R_AARCH64_ADR_PREL_PG_HI21 against symbol stderr ... can not be used |
| 270 | + when making a shared object; recompile with -fPIC". delocate is |
| 271 | + written for PIC input, so this does not affect the FIPS module. --> |
237 | 272 | <exec executable="cmake" failonerror="true" dir="${boringsslBuildDir}" resolveexecutable="true"> |
| 273 | + <arg value="-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE" /> |
238 | 274 | <arg value="-DCMAKE_BUILD_TYPE=Release" /> |
239 | 275 | <arg value="-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded" /> |
240 | | - <arg value="-DCMAKE_C_COMPILER=clang-12" /> |
241 | | - <arg value="-DCMAKE_CXX_COMPILER=clang++-12" /> |
| 276 | + <arg value="-DCMAKE_C_COMPILER=${fipsCC}" /> |
| 277 | + <arg value="-DCMAKE_CXX_COMPILER=${fipsCXX}" /> |
242 | 278 | <arg value="-DFIPS=1" /> |
243 | 279 | <arg value="-GNinja" /> |
244 | 280 | <arg value="${boringsslCheckoutDir}" /> |
|
257 | 293 | <if> |
258 | 294 | <equals arg1="${os.detected.name}" arg2="linux" /> |
259 | 295 | <then> |
260 | | - <!-- This is needed to generate bssl execute file to verify isfips property--> |
| 296 | + <!-- Only what the link and the isfips gate below need. A bare `ninja` |
| 297 | + builds every target, and the test binaries alone are most of the |
| 298 | + wall-clock time of this profile. --> |
261 | 299 | <exec executable="${ninjaExecutable}" failonerror="true" dir="${boringsslBuildDir}" resolveexecutable="true"> |
| 300 | + <arg value="crypto" /> |
| 301 | + <arg value="ssl" /> |
| 302 | + <arg value="decrepit" /> |
| 303 | + <arg value="bssl" /> |
262 | 304 | </exec> |
263 | 305 | <exec executable="./bssl" failonerror="false" dir="${boringsslBuildDir}" outputproperty="boringssl.isfips.result"> |
264 | 306 | <arg value="isfips" /> |
|