Skip to content

Commit 010a448

Browse files
authored
Update BoringSSL to 035e720641f385e82c72b7b0a9e1d89e58cb5ed5 (#356)
This patch updates BoringSSL to 035e720641f385e82c72b7b0a9e1d89e58cb5ed5. As with all of our patch updates to BoringSSL, this comes in multiple commits. The first contains the changes to the vendoring script, and the last contains the tweaks to product code. The middle commit can be ignored for review purposes.
1 parent 0d32399 commit 010a448

File tree

602 files changed

+37534
-43711
lines changed

Some content is hidden

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

602 files changed

+37534
-43711
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
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: aefa5d24da34ef77ac797bdbe684734e5bd870f4
23+
// BoringSSL Commit: 035e720641f385e82c72b7b0a9e1d89e58cb5ed5
2424

2525
import PackageDescription
2626

@@ -195,7 +195,7 @@ let package = Package(
195195
),
196196
.testTarget(name: "CryptoBoringWrapperTests", dependencies: ["CryptoBoringWrapper"]),
197197
],
198-
cxxLanguageStandard: .cxx14
198+
cxxLanguageStandard: .cxx17
199199
)
200200

201201
// Switch between local and remote dependencies depending on an environment variable

Sources/CCryptoBoringSSL/CMakeLists.txt

Lines changed: 49 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
##===----------------------------------------------------------------------===##
1414

1515
add_library(CCryptoBoringSSL STATIC
16+
"crypto/aes/aes.cc"
1617
"crypto/asn1/a_bitstr.cc"
1718
"crypto/asn1/a_bool.cc"
1819
"crypto/asn1/a_d2i_fp.cc"
@@ -53,26 +54,31 @@ add_library(CCryptoBoringSSL STATIC
5354
"crypto/bio/socket.cc"
5455
"crypto/bio/socket_helper.cc"
5556
"crypto/blake2/blake2.cc"
56-
"crypto/bn_extra/bn_asn1.cc"
57-
"crypto/bn_extra/convert.cc"
57+
"crypto/bn/bn_asn1.cc"
58+
"crypto/bn/convert.cc"
59+
"crypto/bn/div.cc"
60+
"crypto/bn/exponentiation.cc"
61+
"crypto/bn/sqrt.cc"
5862
"crypto/buf/buf.cc"
5963
"crypto/bytestring/asn1_compat.cc"
6064
"crypto/bytestring/ber.cc"
6165
"crypto/bytestring/cbb.cc"
6266
"crypto/bytestring/cbs.cc"
6367
"crypto/bytestring/unicode.cc"
6468
"crypto/chacha/chacha.cc"
65-
"crypto/cipher_extra/cipher_extra.cc"
66-
"crypto/cipher_extra/derive_key.cc"
67-
"crypto/cipher_extra/e_aesctrhmac.cc"
68-
"crypto/cipher_extra/e_aesgcmsiv.cc"
69-
"crypto/cipher_extra/e_chacha20poly1305.cc"
70-
"crypto/cipher_extra/e_des.cc"
71-
"crypto/cipher_extra/e_null.cc"
72-
"crypto/cipher_extra/e_rc2.cc"
73-
"crypto/cipher_extra/e_rc4.cc"
74-
"crypto/cipher_extra/e_tls.cc"
75-
"crypto/cipher_extra/tls_cbc.cc"
69+
"crypto/cipher/derive_key.cc"
70+
"crypto/cipher/e_aesctrhmac.cc"
71+
"crypto/cipher/e_aeseax.cc"
72+
"crypto/cipher/e_aesgcmsiv.cc"
73+
"crypto/cipher/e_chacha20poly1305.cc"
74+
"crypto/cipher/e_des.cc"
75+
"crypto/cipher/e_null.cc"
76+
"crypto/cipher/e_rc2.cc"
77+
"crypto/cipher/e_rc4.cc"
78+
"crypto/cipher/e_tls.cc"
79+
"crypto/cipher/get_cipher.cc"
80+
"crypto/cipher/tls_cbc.cc"
81+
"crypto/cms/cms.cc"
7682
"crypto/conf/conf.cc"
7783
"crypto/cpu_aarch64_apple.cc"
7884
"crypto/cpu_aarch64_fuchsia.cc"
@@ -88,16 +94,17 @@ add_library(CCryptoBoringSSL STATIC
8894
"crypto/curve25519/curve25519_64_adx.cc"
8995
"crypto/curve25519/spake25519.cc"
9096
"crypto/des/des.cc"
91-
"crypto/dh_extra/dh_asn1.cc"
92-
"crypto/dh_extra/params.cc"
93-
"crypto/digest_extra/digest_extra.cc"
97+
"crypto/dh/dh_asn1.cc"
98+
"crypto/dh/params.cc"
99+
"crypto/digest/digest_extra.cc"
94100
"crypto/dsa/dsa.cc"
95101
"crypto/dsa/dsa_asn1.cc"
96-
"crypto/ec_extra/ec_asn1.cc"
97-
"crypto/ec_extra/ec_derive.cc"
98-
"crypto/ec_extra/hash_to_curve.cc"
99-
"crypto/ecdh_extra/ecdh_extra.cc"
100-
"crypto/ecdsa_extra/ecdsa_asn1.cc"
102+
"crypto/ec/ec_asn1.cc"
103+
"crypto/ec/ec_derive.cc"
104+
"crypto/ec/hash_to_curve.cc"
105+
"crypto/ecdh/ecdh.cc"
106+
"crypto/ecdsa/ecdsa_asn1.cc"
107+
"crypto/ecdsa/ecdsa_p1363.cc"
101108
"crypto/engine/engine.cc"
102109
"crypto/err/err.cc"
103110
"crypto/evp/evp.cc"
@@ -122,6 +129,7 @@ add_library(CCryptoBoringSSL STATIC
122129
"crypto/ex_data.cc"
123130
"crypto/fipsmodule/bcm.cc"
124131
"crypto/fipsmodule/fips_shared_support.cc"
132+
"crypto/fuzzer_mode.cc"
125133
"crypto/hpke/hpke.cc"
126134
"crypto/hrss/hrss.cc"
127135
"crypto/kyber/kyber.cc"
@@ -150,31 +158,28 @@ add_library(CCryptoBoringSSL STATIC
150158
"crypto/poly1305/poly1305_arm.cc"
151159
"crypto/poly1305/poly1305_vec.cc"
152160
"crypto/pool/pool.cc"
153-
"crypto/rand_extra/deterministic.cc"
154-
"crypto/rand_extra/fork_detect.cc"
155-
"crypto/rand_extra/forkunsafe.cc"
156-
"crypto/rand_extra/getentropy.cc"
157-
"crypto/rand_extra/ios.cc"
158-
"crypto/rand_extra/passive.cc"
159-
"crypto/rand_extra/rand_extra.cc"
160-
"crypto/rand_extra/trusty.cc"
161-
"crypto/rand_extra/urandom.cc"
162-
"crypto/rand_extra/windows.cc"
161+
"crypto/rand/deterministic.cc"
162+
"crypto/rand/fork_detect.cc"
163+
"crypto/rand/forkunsafe.cc"
164+
"crypto/rand/getentropy.cc"
165+
"crypto/rand/ios.cc"
166+
"crypto/rand/passive.cc"
167+
"crypto/rand/rand.cc"
168+
"crypto/rand/trusty.cc"
169+
"crypto/rand/urandom.cc"
170+
"crypto/rand/windows.cc"
163171
"crypto/rc4/rc4.cc"
164172
"crypto/refcount.cc"
165-
"crypto/rsa_extra/rsa_asn1.cc"
166-
"crypto/rsa_extra/rsa_crypt.cc"
167-
"crypto/rsa_extra/rsa_extra.cc"
168-
"crypto/rsa_extra/rsa_print.cc"
173+
"crypto/rsa/rsa_asn1.cc"
174+
"crypto/rsa/rsa_crypt.cc"
175+
"crypto/rsa/rsa_extra.cc"
176+
"crypto/rsa/rsa_print.cc"
169177
"crypto/sha/sha1.cc"
170178
"crypto/sha/sha256.cc"
171179
"crypto/sha/sha512.cc"
172180
"crypto/siphash/siphash.cc"
173-
"crypto/slhdsa/fors.cc"
174-
"crypto/slhdsa/merkle.cc"
175181
"crypto/slhdsa/slhdsa.cc"
176-
"crypto/slhdsa/thash.cc"
177-
"crypto/slhdsa/wots.cc"
182+
"crypto/spake2plus/spake2plus.cc"
178183
"crypto/stack/stack.cc"
179184
"crypto/thread.cc"
180185
"crypto/thread_none.cc"
@@ -253,6 +258,7 @@ add_library(CCryptoBoringSSL STATIC
253258
"crypto/x509/x_val.cc"
254259
"crypto/x509/x_x509.cc"
255260
"crypto/x509/x_x509a.cc"
261+
"crypto/xwing/xwing.cc"
256262
"gen/crypto/err_data.cc"
257263
"$<$<NOT:$<PLATFORM_ID:Windows>>:crypto/hrss/asm/poly_rq_mul.S>"
258264
"$<$<NOT:$<PLATFORM_ID:Windows>>:third_party/fiat/asm/fiat_curve25519_adx_mul.S>"
@@ -262,7 +268,8 @@ add_library(CCryptoBoringSSL STATIC
262268

263269
if(CMAKE_SYSTEM_NAME STREQUAL Darwin AND CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64")
264270
target_sources(CCryptoBoringSSL PRIVATE
265-
gen/bcm/aes-gcm-avx10-x86_64-apple.S
271+
gen/bcm/aes-gcm-avx2-x86_64-apple.S
272+
gen/bcm/aes-gcm-avx512-x86_64-apple.S
266273
gen/bcm/aesni-gcm-x86_64-apple.S
267274
gen/bcm/aesni-x86_64-apple.S
268275
gen/bcm/ghash-ssse3-x86_64-apple.S
@@ -283,7 +290,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL Darwin AND CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x
283290
gen/crypto/md5-x86_64-apple.S)
284291
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|Android|FreeBSD|OpenBSD" AND CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64")
285292
target_sources(CCryptoBoringSSL PRIVATE
286-
gen/bcm/aes-gcm-avx10-x86_64-linux.S
293+
gen/bcm/aes-gcm-avx2-x86_64-linux.S
294+
gen/bcm/aes-gcm-avx512-x86_64-linux.S
287295
gen/bcm/aesni-gcm-x86_64-linux.S
288296
gen/bcm/aesni-x86_64-linux.S
289297
gen/bcm/ghash-ssse3-x86_64-linux.S
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright 2025 The BoringSSL Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include <assert.h>
16+
17+
#include <CCryptoBoringSSL_aes.h>
18+
19+
#include "../fipsmodule/bcm_interface.h"
20+
21+
void AES_encrypt(const uint8_t *in, uint8_t *out, const AES_KEY *key) {
22+
BCM_aes_encrypt(in, out, key);
23+
}
24+
25+
void AES_decrypt(const uint8_t *in, uint8_t *out, const AES_KEY *key) {
26+
BCM_aes_decrypt(in, out, key);
27+
}
28+
29+
int AES_set_encrypt_key(const uint8_t *key, unsigned bits, AES_KEY *aeskey) {
30+
if (bits != 128 && bits != 192 && bits != 256) {
31+
return -2;
32+
}
33+
return bcm_success(BCM_aes_set_encrypt_key(key, bits, aeskey)) ? 0 : -1;
34+
}
35+
36+
int AES_set_decrypt_key(const uint8_t *key, unsigned bits, AES_KEY *aeskey) {
37+
if (bits != 128 && bits != 192 && bits != 256) {
38+
return -2;
39+
}
40+
return bcm_success(BCM_aes_set_decrypt_key(key, bits, aeskey)) ? 0 : -1;
41+
}

Sources/CCryptoBoringSSL/crypto/asn1/a_bitstr.cc

Lines changed: 29 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,23 @@
1-
/* Copyright (C) 1995-1998 Eric Young ([email protected])
2-
* All rights reserved.
3-
*
4-
* This package is an SSL implementation written
5-
* by Eric Young ([email protected]).
6-
* The implementation was written so as to conform with Netscapes SSL.
7-
*
8-
* This library is free for commercial and non-commercial use as long as
9-
* the following conditions are aheared to. The following conditions
10-
* apply to all code found in this distribution, be it the RC4, RSA,
11-
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
12-
* included with this distribution is covered by the same copyright terms
13-
* except that the holder is Tim Hudson ([email protected]).
14-
*
15-
* Copyright remains Eric Young's, and as such any Copyright notices in
16-
* the code are not to be removed.
17-
* If this package is used in a product, Eric Young should be given attribution
18-
* as the author of the parts of the library used.
19-
* This can be in the form of a textual message at program startup or
20-
* in documentation (online or textual) provided with the package.
21-
*
22-
* Redistribution and use in source and binary forms, with or without
23-
* modification, are permitted provided that the following conditions
24-
* are met:
25-
* 1. Redistributions of source code must retain the copyright
26-
* notice, this list of conditions and the following disclaimer.
27-
* 2. Redistributions in binary form must reproduce the above copyright
28-
* notice, this list of conditions and the following disclaimer in the
29-
* documentation and/or other materials provided with the distribution.
30-
* 3. All advertising materials mentioning features or use of this software
31-
* must display the following acknowledgement:
32-
* "This product includes cryptographic software written by
33-
* Eric Young ([email protected])"
34-
* The word 'cryptographic' can be left out if the rouines from the library
35-
* being used are not cryptographic related :-).
36-
* 4. If you include any Windows specific code (or a derivative thereof) from
37-
* the apps directory (application code) you must include an acknowledgement:
38-
* "This product includes software written by Tim Hudson ([email protected])"
39-
*
40-
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
41-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43-
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
44-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46-
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47-
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48-
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49-
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50-
* SUCH DAMAGE.
51-
*
52-
* The licence and distribution terms for any publically available version or
53-
* derivative of this code cannot be changed. i.e. this code cannot simply be
54-
* copied and put under another distribution licence
55-
* [including the GNU Public Licence.] */
1+
// Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
5614

5715
#include <CCryptoBoringSSL_asn1.h>
5816

5917
#include <limits.h>
6018
#include <string.h>
6119

20+
#include <CCryptoBoringSSL_bytestring.h>
6221
#include <CCryptoBoringSSL_err.h>
6322
#include <CCryptoBoringSSL_mem.h>
6423

@@ -136,6 +95,21 @@ int i2c_ASN1_BIT_STRING(const ASN1_BIT_STRING *a, unsigned char **pp) {
13695
return ret;
13796
}
13897

98+
int asn1_marshal_bit_string(CBB *out, const ASN1_BIT_STRING *in,
99+
CBS_ASN1_TAG tag) {
100+
int len = i2c_ASN1_BIT_STRING(in, nullptr);
101+
if (len <= 0) {
102+
return 0;
103+
}
104+
tag = tag == 0 ? CBS_ASN1_BITSTRING : tag;
105+
CBB child;
106+
uint8_t *ptr;
107+
return CBB_add_asn1(out, &child, tag) && //
108+
CBB_add_space(&child, &ptr, static_cast<size_t>(len)) && //
109+
i2c_ASN1_BIT_STRING(in, &ptr) == len && //
110+
CBB_flush(out);
111+
}
112+
139113
ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
140114
const unsigned char **pp, long len) {
141115
ASN1_BIT_STRING *ret = NULL;

Sources/CCryptoBoringSSL/crypto/asn1/a_bool.cc

Lines changed: 13 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,16 @@
1-
/* Copyright (C) 1995-1998 Eric Young ([email protected])
2-
* All rights reserved.
3-
*
4-
* This package is an SSL implementation written
5-
* by Eric Young ([email protected]).
6-
* The implementation was written so as to conform with Netscapes SSL.
7-
*
8-
* This library is free for commercial and non-commercial use as long as
9-
* the following conditions are aheared to. The following conditions
10-
* apply to all code found in this distribution, be it the RC4, RSA,
11-
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
12-
* included with this distribution is covered by the same copyright terms
13-
* except that the holder is Tim Hudson ([email protected]).
14-
*
15-
* Copyright remains Eric Young's, and as such any Copyright notices in
16-
* the code are not to be removed.
17-
* If this package is used in a product, Eric Young should be given attribution
18-
* as the author of the parts of the library used.
19-
* This can be in the form of a textual message at program startup or
20-
* in documentation (online or textual) provided with the package.
21-
*
22-
* Redistribution and use in source and binary forms, with or without
23-
* modification, are permitted provided that the following conditions
24-
* are met:
25-
* 1. Redistributions of source code must retain the copyright
26-
* notice, this list of conditions and the following disclaimer.
27-
* 2. Redistributions in binary form must reproduce the above copyright
28-
* notice, this list of conditions and the following disclaimer in the
29-
* documentation and/or other materials provided with the distribution.
30-
* 3. All advertising materials mentioning features or use of this software
31-
* must display the following acknowledgement:
32-
* "This product includes cryptographic software written by
33-
* Eric Young ([email protected])"
34-
* The word 'cryptographic' can be left out if the rouines from the library
35-
* being used are not cryptographic related :-).
36-
* 4. If you include any Windows specific code (or a derivative thereof) from
37-
* the apps directory (application code) you must include an acknowledgement:
38-
* "This product includes software written by Tim Hudson ([email protected])"
39-
*
40-
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
41-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43-
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
44-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46-
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47-
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48-
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49-
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50-
* SUCH DAMAGE.
51-
*
52-
* The licence and distribution terms for any publically available version or
53-
* derivative of this code cannot be changed. i.e. this code cannot simply be
54-
* copied and put under another distribution licence
55-
* [including the GNU Public Licence.] */
1+
// Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
5614

5715
#include <CCryptoBoringSSL_asn1.h>
5816

0 commit comments

Comments
 (0)