Skip to content

Commit 8841cb1

Browse files
committed
Update BoringSSL to 6a2ccdcc2ed1d37a43a2183658d2ae61fd5ce208
1 parent f69d613 commit 8841cb1

File tree

344 files changed

+46390
-38512
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

344 files changed

+46390
-38512
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// Sources/CCryptoBoringSSL directory. The source repository is at
2121
// https://boringssl.googlesource.com/boringssl.
2222
//
23-
// BoringSSL Commit: dbad745811195c00b729efd0ee0a09b7d9fce1d2
23+
// BoringSSL Commit: 6a2ccdcc2ed1d37a43a2183658d2ae61fd5ce208
2424

2525
import PackageDescription
2626

Sources/CCryptoBoringSSL/CMakeLists.txt

Lines changed: 21 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ add_library(CCryptoBoringSSL STATIC
9191
"crypto/dh_extra/dh_asn1.c"
9292
"crypto/dh_extra/params.c"
9393
"crypto/digest_extra/digest_extra.c"
94+
"crypto/dilithium/dilithium.c"
9495
"crypto/dsa/dsa.c"
9596
"crypto/dsa/dsa_asn1.c"
9697
"crypto/ec_extra/ec_asn1.c"
@@ -100,10 +101,11 @@ add_library(CCryptoBoringSSL STATIC
100101
"crypto/ecdsa_extra/ecdsa_asn1.c"
101102
"crypto/engine/engine.c"
102103
"crypto/err/err.c"
103-
"crypto/err/err_data.c"
104104
"crypto/evp/evp.c"
105105
"crypto/evp/evp_asn1.c"
106106
"crypto/evp/evp_ctx.c"
107+
"crypto/evp/p_dh.c"
108+
"crypto/evp/p_dh_asn1.c"
107109
"crypto/evp/p_dsa_asn1.c"
108110
"crypto/evp/p_ec.c"
109111
"crypto/evp/p_ec_asn1.c"
@@ -119,89 +121,17 @@ add_library(CCryptoBoringSSL STATIC
119121
"crypto/evp/scrypt.c"
120122
"crypto/evp/sign.c"
121123
"crypto/ex_data.c"
122-
"crypto/fipsmodule/aes/aes.c"
123-
"crypto/fipsmodule/aes/aes_nohw.c"
124-
"crypto/fipsmodule/aes/key_wrap.c"
125-
"crypto/fipsmodule/aes/mode_wrappers.c"
126-
"crypto/fipsmodule/bn/add.c"
127-
"crypto/fipsmodule/bn/asm/x86_64-gcc.c"
128-
"crypto/fipsmodule/bn/bn.c"
129-
"crypto/fipsmodule/bn/bytes.c"
130-
"crypto/fipsmodule/bn/cmp.c"
131-
"crypto/fipsmodule/bn/ctx.c"
132-
"crypto/fipsmodule/bn/div.c"
133-
"crypto/fipsmodule/bn/div_extra.c"
134-
"crypto/fipsmodule/bn/exponentiation.c"
135-
"crypto/fipsmodule/bn/gcd.c"
136-
"crypto/fipsmodule/bn/gcd_extra.c"
137-
"crypto/fipsmodule/bn/generic.c"
138-
"crypto/fipsmodule/bn/jacobi.c"
139-
"crypto/fipsmodule/bn/montgomery.c"
140-
"crypto/fipsmodule/bn/montgomery_inv.c"
141-
"crypto/fipsmodule/bn/mul.c"
142-
"crypto/fipsmodule/bn/prime.c"
143-
"crypto/fipsmodule/bn/random.c"
144-
"crypto/fipsmodule/bn/rsaz_exp.c"
145-
"crypto/fipsmodule/bn/shift.c"
146-
"crypto/fipsmodule/bn/sqrt.c"
147-
"crypto/fipsmodule/cipher/aead.c"
148-
"crypto/fipsmodule/cipher/cipher.c"
149-
"crypto/fipsmodule/cipher/e_aes.c"
150-
"crypto/fipsmodule/cipher/e_aesccm.c"
151-
"crypto/fipsmodule/cmac/cmac.c"
152-
"crypto/fipsmodule/dh/check.c"
153-
"crypto/fipsmodule/dh/dh.c"
154-
"crypto/fipsmodule/digest/digest.c"
155-
"crypto/fipsmodule/digest/digests.c"
156-
"crypto/fipsmodule/digestsign/digestsign.c"
157-
"crypto/fipsmodule/ec/ec.c"
158-
"crypto/fipsmodule/ec/ec_key.c"
159-
"crypto/fipsmodule/ec/ec_montgomery.c"
160-
"crypto/fipsmodule/ec/felem.c"
161-
"crypto/fipsmodule/ec/oct.c"
162-
"crypto/fipsmodule/ec/p224-64.c"
163-
"crypto/fipsmodule/ec/p256-nistz.c"
164-
"crypto/fipsmodule/ec/p256.c"
165-
"crypto/fipsmodule/ec/scalar.c"
166-
"crypto/fipsmodule/ec/simple.c"
167-
"crypto/fipsmodule/ec/simple_mul.c"
168-
"crypto/fipsmodule/ec/util.c"
169-
"crypto/fipsmodule/ec/wnaf.c"
170-
"crypto/fipsmodule/ecdh/ecdh.c"
171-
"crypto/fipsmodule/ecdsa/ecdsa.c"
124+
"crypto/fipsmodule/bcm.c"
172125
"crypto/fipsmodule/fips_shared_support.c"
173-
"crypto/fipsmodule/hkdf/hkdf.c"
174-
"crypto/fipsmodule/hmac/hmac.c"
175-
"crypto/fipsmodule/md4/md4.c"
176-
"crypto/fipsmodule/md5/md5.c"
177-
"crypto/fipsmodule/modes/cbc.c"
178-
"crypto/fipsmodule/modes/cfb.c"
179-
"crypto/fipsmodule/modes/ctr.c"
180-
"crypto/fipsmodule/modes/gcm.c"
181-
"crypto/fipsmodule/modes/gcm_nohw.c"
182-
"crypto/fipsmodule/modes/ofb.c"
183-
"crypto/fipsmodule/modes/polyval.c"
184-
"crypto/fipsmodule/rand/ctrdrbg.c"
185-
"crypto/fipsmodule/rand/fork_detect.c"
186-
"crypto/fipsmodule/rand/rand.c"
187-
"crypto/fipsmodule/rand/urandom.c"
188-
"crypto/fipsmodule/rsa/blinding.c"
189-
"crypto/fipsmodule/rsa/padding.c"
190-
"crypto/fipsmodule/rsa/rsa.c"
191-
"crypto/fipsmodule/rsa/rsa_impl.c"
192-
"crypto/fipsmodule/self_check/fips.c"
193-
"crypto/fipsmodule/self_check/self_check.c"
194-
"crypto/fipsmodule/service_indicator/service_indicator.c"
195-
"crypto/fipsmodule/sha/sha1.c"
196-
"crypto/fipsmodule/sha/sha256.c"
197-
"crypto/fipsmodule/sha/sha512.c"
198-
"crypto/fipsmodule/tls/kdf.c"
199126
"crypto/hpke/hpke.c"
200127
"crypto/hrss/hrss.c"
201128
"crypto/keccak/keccak.c"
202129
"crypto/kyber/kyber.c"
203130
"crypto/lhash/lhash.c"
131+
"crypto/md4/md4.c"
132+
"crypto/md5/md5.c"
204133
"crypto/mem.c"
134+
"crypto/mldsa/mldsa.c"
205135
"crypto/obj/obj.c"
206136
"crypto/obj/obj_xref.c"
207137
"crypto/pem/pem_all.c"
@@ -222,26 +152,29 @@ add_library(CCryptoBoringSSL STATIC
222152
"crypto/poly1305/poly1305_vec.c"
223153
"crypto/pool/pool.c"
224154
"crypto/rand_extra/deterministic.c"
155+
"crypto/rand_extra/fork_detect.c"
225156
"crypto/rand_extra/forkunsafe.c"
226157
"crypto/rand_extra/getentropy.c"
227158
"crypto/rand_extra/ios.c"
228159
"crypto/rand_extra/passive.c"
229160
"crypto/rand_extra/rand_extra.c"
230161
"crypto/rand_extra/trusty.c"
162+
"crypto/rand_extra/urandom.c"
231163
"crypto/rand_extra/windows.c"
232164
"crypto/rc4/rc4.c"
233165
"crypto/refcount.c"
234166
"crypto/rsa_extra/rsa_asn1.c"
235167
"crypto/rsa_extra/rsa_crypt.c"
236168
"crypto/rsa_extra/rsa_print.c"
169+
"crypto/sha/sha1.c"
237170
"crypto/siphash/siphash.c"
238-
"crypto/spx/address.c"
239-
"crypto/spx/fors.c"
240-
"crypto/spx/merkle.c"
241171
"crypto/spx/spx.c"
172+
"crypto/spx/spx_address.c"
173+
"crypto/spx/spx_fors.c"
174+
"crypto/spx/spx_merkle.c"
175+
"crypto/spx/spx_thash.c"
242176
"crypto/spx/spx_util.c"
243-
"crypto/spx/thash.c"
244-
"crypto/spx/wots.c"
177+
"crypto/spx/spx_wots.c"
245178
"crypto/stack/stack.c"
246179
"crypto/thread.c"
247180
"crypto/thread_none.c"
@@ -319,80 +252,21 @@ add_library(CCryptoBoringSSL STATIC
319252
"crypto/x509/x_spki.c"
320253
"crypto/x509/x_val.c"
321254
"crypto/x509/x_x509.c"
322-
"crypto/x509/x_x509a.c")
255+
"crypto/x509/x_x509a.c"
256+
"gen/crypto/err_data.c")
323257

324258
if(CMAKE_SYSTEM_NAME STREQUAL Darwin AND CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64")
325259
target_sources(CCryptoBoringSSL PRIVATE
326-
crypto/chacha/chacha-x86_64-mac.mac.x86_64.S
327-
crypto/cipher_extra/aes128gcmsiv-x86_64-mac.mac.x86_64.S
328-
crypto/cipher_extra/chacha20_poly1305_x86_64-mac.mac.x86_64.S
329-
crypto/fipsmodule/aesni-gcm-x86_64-mac.mac.x86_64.S
330-
crypto/fipsmodule/aesni-x86_64-mac.mac.x86_64.S
331-
crypto/fipsmodule/ghash-ssse3-x86_64-mac.mac.x86_64.S
332-
crypto/fipsmodule/ghash-x86_64-mac.mac.x86_64.S
333-
crypto/fipsmodule/md5-x86_64-mac.mac.x86_64.S
334-
crypto/fipsmodule/p256-x86_64-asm-mac.mac.x86_64.S
335-
crypto/fipsmodule/p256_beeu-x86_64-asm-mac.mac.x86_64.S
336-
crypto/fipsmodule/rdrand-x86_64-mac.mac.x86_64.S
337-
crypto/fipsmodule/rsaz-avx2-mac.mac.x86_64.S
338-
crypto/fipsmodule/sha1-x86_64-mac.mac.x86_64.S
339-
crypto/fipsmodule/sha256-x86_64-mac.mac.x86_64.S
340-
crypto/fipsmodule/sha512-x86_64-mac.mac.x86_64.S
341-
crypto/fipsmodule/vpaes-x86_64-mac.mac.x86_64.S
342-
crypto/fipsmodule/x86_64-mont-mac.mac.x86_64.S
343-
crypto/fipsmodule/x86_64-mont5-mac.mac.x86_64.S)
260+
)
344261
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|Android" AND CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64")
345262
target_sources(CCryptoBoringSSL PRIVATE
346-
crypto/chacha/chacha-x86_64-linux.linux.x86_64.S
347-
crypto/cipher_extra/aes128gcmsiv-x86_64-linux.linux.x86_64.S
348-
crypto/cipher_extra/chacha20_poly1305_x86_64-linux.linux.x86_64.S
349-
crypto/fipsmodule/aesni-gcm-x86_64-linux.linux.x86_64.S
350-
crypto/fipsmodule/aesni-x86_64-linux.linux.x86_64.S
351-
crypto/fipsmodule/ghash-ssse3-x86_64-linux.linux.x86_64.S
352-
crypto/fipsmodule/ghash-x86_64-linux.linux.x86_64.S
353-
crypto/fipsmodule/md5-x86_64-linux.linux.x86_64.S
354-
crypto/fipsmodule/p256-x86_64-asm-linux.linux.x86_64.S
355-
crypto/fipsmodule/p256_beeu-x86_64-asm-linux.linux.x86_64.S
356-
crypto/fipsmodule/rdrand-x86_64-linux.linux.x86_64.S
357-
crypto/fipsmodule/rsaz-avx2-linux.linux.x86_64.S
358-
crypto/fipsmodule/sha1-x86_64-linux.linux.x86_64.S
359-
crypto/fipsmodule/sha256-x86_64-linux.linux.x86_64.S
360-
crypto/fipsmodule/sha512-x86_64-linux.linux.x86_64.S
361-
crypto/fipsmodule/vpaes-x86_64-linux.linux.x86_64.S
362-
crypto/fipsmodule/x86_64-mont-linux.linux.x86_64.S
363-
crypto/fipsmodule/x86_64-mont5-linux.linux.x86_64.S)
263+
)
364264
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64")
365265
target_sources(CCryptoBoringSSL PRIVATE
366-
crypto/chacha/chacha-armv8-ios.ios.aarch64.S
367-
crypto/cipher_extra/chacha20_poly1305_armv8-ios.ios.aarch64.S
368-
crypto/fipsmodule/aesv8-armv8-ios.ios.aarch64.S
369-
crypto/fipsmodule/aesv8-gcm-armv8-ios.ios.aarch64.S
370-
crypto/fipsmodule/armv8-mont-ios.ios.aarch64.S
371-
crypto/fipsmodule/bn-armv8-ios.ios.aarch64.S
372-
crypto/fipsmodule/ghash-neon-armv8-ios.ios.aarch64.S
373-
crypto/fipsmodule/ghashv8-armv8-ios.ios.aarch64.S
374-
crypto/fipsmodule/p256-armv8-asm-ios.ios.aarch64.S
375-
crypto/fipsmodule/p256_beeu-armv8-asm-ios.ios.aarch64.S
376-
crypto/fipsmodule/sha1-armv8-ios.ios.aarch64.S
377-
crypto/fipsmodule/sha256-armv8-ios.ios.aarch64.S
378-
crypto/fipsmodule/sha512-armv8-ios.ios.aarch64.S
379-
crypto/fipsmodule/vpaes-armv8-ios.ios.aarch64.S)
266+
)
380267
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|Android" AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64")
381268
target_sources(CCryptoBoringSSL PRIVATE
382-
crypto/chacha/chacha-armv8-linux.linux.aarch64.S
383-
crypto/cipher_extra/chacha20_poly1305_armv8-linux.linux.aarch64.S
384-
crypto/fipsmodule/aesv8-armv8-linux.linux.aarch64.S
385-
crypto/fipsmodule/aesv8-gcm-armv8-linux.linux.aarch64.S
386-
crypto/fipsmodule/armv8-mont-linux.linux.aarch64.S
387-
crypto/fipsmodule/bn-armv8-linux.linux.aarch64.S
388-
crypto/fipsmodule/ghash-neon-armv8-linux.linux.aarch64.S
389-
crypto/fipsmodule/ghashv8-armv8-linux.linux.aarch64.S
390-
crypto/fipsmodule/p256-armv8-asm-linux.linux.aarch64.S
391-
crypto/fipsmodule/p256_beeu-armv8-asm-linux.linux.aarch64.S
392-
crypto/fipsmodule/sha1-armv8-linux.linux.aarch64.S
393-
crypto/fipsmodule/sha256-armv8-linux.linux.aarch64.S
394-
crypto/fipsmodule/sha512-armv8-linux.linux.aarch64.S
395-
crypto/fipsmodule/vpaes-armv8-linux.linux.aarch64.S)
269+
)
396270
endif()
397271

398272
target_include_directories(CCryptoBoringSSL PUBLIC

Sources/CCryptoBoringSSL/crypto/base64/base64.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,10 @@ static int base64_decode_quad(uint8_t *out, size_t *out_num_bytes,
307307
(in[2] == '=') << 1 |
308308
(in[3] == '=');
309309

310+
// In presence of padding, the lowest bits of v are unused. Canonical encoding
311+
// (RFC 4648, section 3.5) requires that these bits all be set to zero. Common
312+
// PEM parsers accept noncanonical base64, adding to the malleability of the
313+
// format. This decoder follows OpenSSL's and Go's PEM parsers and accepts it.
310314
switch (padding_pattern) {
311315
case 0:
312316
// The common case of no padding.

Sources/CCryptoBoringSSL/crypto/fipsmodule/rand/fork_detect.h renamed to Sources/CCryptoBoringSSL/crypto/bcm_support.h

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2020, Google Inc.
1+
/* Copyright (c) 2024, Google Inc.
22
*
33
* Permission to use, copy, modify, and/or distribute this software for any
44
* purpose with or without fee is hereby granted, provided that the above
@@ -12,11 +12,17 @@
1212
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
1313
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
1414

15-
#ifndef OPENSSL_HEADER_CRYPTO_FORK_DETECT_H
16-
#define OPENSSL_HEADER_CRYPTO_FORK_DETECT_H
15+
#ifndef OPENSSL_HEADER_CRYPTO_BCM_SUPPORT_H
16+
#define OPENSSL_HEADER_CRYPTO_BCM_SUPPORT_H
1717

1818
#include <CCryptoBoringSSL_base.h>
1919

20+
// Provided by libcrypto, called from BCM
21+
22+
#if defined(__cplusplus)
23+
extern "C" {
24+
#endif
25+
2026
#if defined(OPENSSL_LINUX)
2127
// On linux we use MADVISE instead of pthread_atfork(), due
2228
// to concerns about clone() being used for address space
@@ -29,15 +35,54 @@
2935
// iOS doesn't normally allow fork in apps, but it's there.
3036
#define OPENSSL_FORK_DETECTION
3137
#define OPENSSL_FORK_DETECTION_PTHREAD_ATFORK
32-
#elif defined(OPENSSL_WINDOWS) || defined(OPENSSL_TRUSTY)
38+
#elif defined(OPENSSL_WINDOWS) || defined(OPENSSL_TRUSTY) || \
39+
defined(__ZEPHYR__) || defined(CROS_EC)
3340
// These platforms do not fork.
3441
#define OPENSSL_DOES_NOT_FORK
3542
#endif
3643

37-
#if defined(__cplusplus)
38-
extern "C" {
44+
#if defined(BORINGSSL_UNSAFE_DETERMINISTIC_MODE)
45+
#define OPENSSL_RAND_DETERMINISTIC
46+
#elif defined(OPENSSL_TRUSTY)
47+
#define OPENSSL_RAND_TRUSTY
48+
#elif defined(OPENSSL_WINDOWS)
49+
#define OPENSSL_RAND_WINDOWS
50+
#elif defined(OPENSSL_LINUX)
51+
#define OPENSSL_RAND_URANDOM
52+
#elif defined(OPENSSL_APPLE) && !defined(OPENSSL_MACOS)
53+
// Unlike macOS, iOS and similar hide away getentropy().
54+
#define OPENSSL_RAND_IOS
55+
#else
56+
// By default if you are integrating BoringSSL we expect you to
57+
// provide getentropy from the <unistd.h> header file.
58+
#define OPENSSL_RAND_GETENTROPY
3959
#endif
4060

61+
// Provided by libcrypto, called from BCM
62+
63+
// CRYPTO_init_sysrand initializes long-lived resources needed to draw entropy
64+
// from the operating system, if the operating system requires initialization.
65+
void CRYPTO_init_sysrand(void);
66+
67+
// CRYPTO_sysrand fills |len| bytes at |buf| with entropy from the operating
68+
// system.
69+
void CRYPTO_sysrand(uint8_t *buf, size_t len);
70+
71+
// CRYPTO_sysrand_if_available fills |len| bytes at |buf| with entropy from the
72+
// operating system, or early /dev/urandom data, and returns 1, _if_ the entropy
73+
// pool is initialized or if getrandom() is not available and not in FIPS mode.
74+
// Otherwise it will not block and will instead fill |buf| with all zeros and
75+
// return 0.
76+
int CRYPTO_sysrand_if_available(uint8_t *buf, size_t len);
77+
78+
// CRYPTO_sysrand_for_seed fills |len| bytes at |buf| with entropy from the
79+
// operating system. It may draw from the |GRND_RANDOM| pool on Android,
80+
// depending on the vendor's configuration.
81+
void CRYPTO_sysrand_for_seed(uint8_t *buf, size_t len);
82+
83+
// RAND_need_entropy is called whenever the BCM module has stopped because it
84+
// has run out of entropy.
85+
void RAND_need_entropy(size_t bytes_needed);
4186

4287
// crypto_get_fork_generation returns the fork generation number for the current
4388
// process, or zero if not supported on the platform. The fork generation number
@@ -60,8 +105,9 @@ OPENSSL_EXPORT uint64_t CRYPTO_get_fork_generation(void);
60105
OPENSSL_EXPORT void CRYPTO_fork_detect_force_madv_wipeonfork_for_testing(
61106
int on);
62107

108+
63109
#if defined(__cplusplus)
64110
} // extern C
65111
#endif
66112

67-
#endif // OPENSSL_HEADER_CRYPTO_FORK_DETECT_H
113+
#endif // OPENSSL_HEADER_CRYPTO_BCM_SUPPORT_H

0 commit comments

Comments
 (0)