Skip to content

Commit 83d9afe

Browse files
committed
crypto/internal/boring: upgrade module to fips-20220613 / certificate 4735
Reapplies CL 549695 now that the certificate was issued. Updates #64717 Updates #62372 Change-Id: Ie37abed5c5aceac435d92397ed626dfeefabe5ab Reviewed-on: https://go-review.googlesource.com/c/go/+/603375 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]> Reviewed-by: David Chase <[email protected]>
1 parent 198b2e1 commit 83d9afe

9 files changed

+44
-16
lines changed

src/crypto/internal/boring/Dockerfile

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,18 @@ WORKDIR /boring
1313
ENV LANG=C
1414
ENV LANGUAGE=
1515

16-
# Following NIST submission draft dated July 3, 2021.
17-
# This corresponds to boringssl.googlesource.com/boringssl tag fips-20210429.
18-
ENV ClangV=12
16+
# Following the Security Policy for FIPS 140 certificate #4735.
17+
# https://csrc.nist.gov/CSRC/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp4735.pdf
18+
# This corresponds to boringssl.googlesource.com/boringssl tag fips-20220613.
1919
RUN apt-get update && \
20-
apt-get install --no-install-recommends -y cmake xz-utils wget unzip ca-certificates clang-$ClangV python
20+
apt-get install --no-install-recommends -y xz-utils wget unzip ca-certificates python lsb-release software-properties-common gnupg make libssl-dev faketime
21+
22+
# Install Clang.
23+
ENV ClangV=14
24+
RUN \
25+
wget https://apt.llvm.org/llvm.sh && \
26+
chmod +x llvm.sh && \
27+
./llvm.sh $ClangV
2128

2229
# Download, validate, unpack, build, and install Ninja.
2330
ENV NinjaV=1.10.2
@@ -31,11 +38,23 @@ RUN \
3138
CC=clang-$ClangV CXX=clang++-$ClangV ./configure.py --bootstrap && \
3239
mv ninja /usr/local/bin/
3340

41+
# Download, validate, unpack, build, and install Cmake.
42+
ENV CmakeV=3.22.1
43+
ENV CmakeH=0e998229549d7b3f368703d20e248e7ee1f853910d42704aa87918c213ea82c0
44+
RUN \
45+
wget https://github.com/Kitware/CMake/releases/download/v$CmakeV/cmake-$CmakeV.tar.gz && \
46+
echo "$CmakeH cmake-$CmakeV.tar.gz" >sha && sha256sum -c sha && \
47+
tar -xzf cmake-$CmakeV.tar.gz && \
48+
rm cmake-$CmakeV.tar.gz && \
49+
cd cmake-$CmakeV && \
50+
CC=clang-$ClangV CXX=clang++-$ClangV ./bootstrap && \
51+
make && make install
52+
3453
# Download, validate, unpack, and install Go.
3554
ARG GOARCH
36-
ENV GoV=1.16.5
37-
ENV GoHamd64=b12c23023b68de22f74c0524f10b753e7b08b1504cb7e417eccebdd3fae49061
38-
ENV GoHarm64=d5446b46ef6f36fdffa852f73dfbbe78c1ddf010b99fa4964944b9ae8b4d6799
55+
ENV GoV=1.18.1
56+
ENV GoHamd64=b3b815f47ababac13810fc6021eb73d65478e0b2db4b09d348eefad9581a2334
57+
ENV GoHarm64=56a91851c97fb4697077abbca38860f735c32b38993ff79b088dac46e4735633
3958
RUN \
4059
eval GoH=\${GoH$GOARCH} && \
4160
wget https://golang.org/dl/go$GoV.linux-$GOARCH.tar.gz && \
@@ -45,8 +64,8 @@ RUN \
4564
ln -s /usr/local/go/bin/go /usr/local/bin/
4665

4766
# Download, validate, and unpack BoringCrypto.
48-
ENV BoringV=853ca1ea1168dff08011e5d42d94609cc0ca2e27
49-
ENV BoringH=a4d069ccef6f3c7bc0c68de82b91414f05cb817494cd1ab483dcf3368883c7c2
67+
ENV BoringV=0c6f40132b828e92ba365c6b7680e32820c63fa7
68+
ENV BoringH=62f733289f2d677c2723f556aa58034c438f3a7bbca6c12b156538a88e38da8a
5069
RUN \
5170
wget https://commondatastorage.googleapis.com/chromium-boringssl-fips/boringssl-$BoringV.tar.xz && \
5271
echo "$BoringH boringssl-$BoringV.tar.xz" >sha && sha256sum -c sha && \

src/crypto/internal/boring/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ When building with GOEXPERIMENT=boringcrypto, the following applies.
66
The goboringcrypto_linux_amd64.syso object file is built
77
from BoringSSL source code by build/build.sh and is covered
88
by the BoringSSL license reproduced below and also at
9-
https://boringssl.googlesource.com/boringssl/+/fips-20190808/LICENSE.
9+
https://boringssl.googlesource.com/boringssl/+/fips-20220613/LICENSE.
1010

1111
BoringSSL is a fork of OpenSSL. As such, large parts of it fall under OpenSSL
1212
licensing. Files that are completely new have a Google copyright and an ISC

src/crypto/internal/boring/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ syso/goboringcrypto_linux_arm64.syso is built with:
2727

2828
GOARCH=arm64 ./build.sh
2929

30-
Both run on an x86 Debian Linux system using Docker.
30+
Both run using Docker.
31+
3132
For the arm64 build to run on an x86 system, you need
3233

3334
apt-get install qemu-user-static qemu-binfmt-support
3435

3536
to allow the x86 kernel to run arm64 binaries via QEMU.
3637

37-
See build.sh for more details about the build.
38-
38+
For the amd64 build to run on an Apple Silicon macOS, you need Rosetta 2.
3939

40+
See build.sh for more details about the build.

src/crypto/internal/boring/build-boring.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ perl -p -i -e 's/defined.*ELF.*defined.*GNUC.*/$0 \&\& !defined(GOBORING)/' bori
3434
printf "set(CMAKE_C_COMPILER \"clang\")\nset(CMAKE_CXX_COMPILER \"clang++\")\n" >${HOME}/toolchain
3535
cd boringssl
3636
mkdir build && cd build && cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=${HOME}/toolchain -DFIPS=1 -DCMAKE_BUILD_TYPE=Release ..
37-
ninja
38-
./crypto/crypto_test
37+
# SSLTest.HostMatching fails due to an expired certificate.
38+
ninja && faketime 2022-06-13 ninja run_tests
3939
cd ../..
4040

4141
if [ "$(./boringssl/build/tool/bssl isfips)" != 1 ]; then

src/crypto/internal/boring/build-goboring.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ awk -f boringx.awk goboringcrypto.h # writes goboringcrypto.x
122122
awk -f boringh.awk goboringcrypto.h # writes goboringcrypto[01].h
123123

124124
ls -l ../boringssl/include
125-
clang++ -std=c++11 -fPIC -I../boringssl/include -O2 -o a.out goboringcrypto.cc
125+
clang++ -fPIC -I../boringssl/include -O2 -o a.out goboringcrypto.cc
126126
./a.out || exit 2
127127

128128
# clang implements u128 % u128 -> u128 by calling __umodti3,

src/crypto/internal/boring/build.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ platform=""
2222
buildargs=""
2323
case "$GOARCH" in
2424
amd64)
25+
if ! docker run --rm -t amd64/ubuntu:focal uname -m >/dev/null 2>&1; then
26+
echo "# Docker cannot run amd64 binaries."
27+
exit 1
28+
fi
29+
platform="--platform linux/amd64"
30+
buildargs="--build-arg ubuntu=amd64/ubuntu"
2531
;;
2632
arm64)
2733
if ! docker run --rm -t arm64v8/ubuntu:focal uname -m >/dev/null 2>&1; then

src/crypto/internal/boring/goboringcrypto.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ void _goboringcrypto_EVP_AEAD_CTX_cleanup(GO_EVP_AEAD_CTX*);
125125
int _goboringcrypto_EVP_AEAD_CTX_seal(const GO_EVP_AEAD_CTX*, uint8_t*, size_t*, size_t, const uint8_t*, size_t, const uint8_t*, size_t, const uint8_t*, size_t);
126126
int _goboringcrypto_EVP_AEAD_CTX_open(const GO_EVP_AEAD_CTX*, uint8_t*, size_t*, size_t, const uint8_t*, size_t, const uint8_t*, size_t, const uint8_t*, size_t);
127127
const GO_EVP_AEAD* _goboringcrypto_EVP_aead_aes_128_gcm_tls12(void);
128+
const GO_EVP_AEAD* _goboringcrypto_EVP_aead_aes_128_gcm_tls13(void);
128129
const GO_EVP_AEAD* _goboringcrypto_EVP_aead_aes_256_gcm_tls12(void);
130+
const GO_EVP_AEAD* _goboringcrypto_EVP_aead_aes_256_gcm_tls13(void);
129131
enum go_evp_aead_direction_t {
130132
go_evp_aead_open = 0,
131133
go_evp_aead_seal = 1
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)