Skip to content

Commit 57a0c7d

Browse files
authored
Update BoringSSL to 1f51cfc7d7f54d2bee30bb5793470ef9c36a5083 (#121)
1 parent 9580d7e commit 57a0c7d

File tree

148 files changed

+8989
-2379
lines changed

Some content is hidden

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

148 files changed

+8989
-2379
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: f961de5c47ed265c3e758ec70dd15ece20809962
23+
// BoringSSL Commit: 1f51cfc7d7f54d2bee30bb5793470ef9c36a5083
2424

2525
import PackageDescription
2626

Sources/CCryptoBoringSSL/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ add_library(CCryptoBoringSSL STATIC
6565
"crypto/chacha/chacha.c"
6666
"crypto/cipher_extra/cipher_extra.c"
6767
"crypto/cipher_extra/derive_key.c"
68-
"crypto/cipher_extra/e_aesccm.c"
6968
"crypto/cipher_extra/e_aesctrhmac.c"
7069
"crypto/cipher_extra/e_aesgcmsiv.c"
7170
"crypto/cipher_extra/e_chacha20poly1305.c"
@@ -75,7 +74,6 @@ add_library(CCryptoBoringSSL STATIC
7574
"crypto/cipher_extra/e_rc4.c"
7675
"crypto/cipher_extra/e_tls.c"
7776
"crypto/cipher_extra/tls_cbc.c"
78-
"crypto/cmac/cmac.c"
7977
"crypto/conf/conf.c"
8078
"crypto/cpu_aarch64_apple.c"
8179
"crypto/cpu_aarch64_fuchsia.c"
@@ -102,7 +100,6 @@ add_library(CCryptoBoringSSL STATIC
102100
"crypto/engine/engine.c"
103101
"crypto/err/err.c"
104102
"crypto/err/err_data.c"
105-
"crypto/evp/digestsign.c"
106103
"crypto/evp/evp.c"
107104
"crypto/evp/evp_asn1.c"
108105
"crypto/evp/evp_ctx.c"
@@ -111,6 +108,7 @@ add_library(CCryptoBoringSSL STATIC
111108
"crypto/evp/p_ec_asn1.c"
112109
"crypto/evp/p_ed25519.c"
113110
"crypto/evp/p_ed25519_asn1.c"
111+
"crypto/evp/p_hkdf.c"
114112
"crypto/evp/p_rsa.c"
115113
"crypto/evp/p_rsa_asn1.c"
116114
"crypto/evp/p_x25519.c"
@@ -148,10 +146,13 @@ add_library(CCryptoBoringSSL STATIC
148146
"crypto/fipsmodule/cipher/aead.c"
149147
"crypto/fipsmodule/cipher/cipher.c"
150148
"crypto/fipsmodule/cipher/e_aes.c"
149+
"crypto/fipsmodule/cipher/e_aesccm.c"
150+
"crypto/fipsmodule/cmac/cmac.c"
151151
"crypto/fipsmodule/dh/check.c"
152152
"crypto/fipsmodule/dh/dh.c"
153153
"crypto/fipsmodule/digest/digest.c"
154154
"crypto/fipsmodule/digest/digests.c"
155+
"crypto/fipsmodule/digestsign/digestsign.c"
155156
"crypto/fipsmodule/ec/ec.c"
156157
"crypto/fipsmodule/ec/ec_key.c"
157158
"crypto/fipsmodule/ec/ec_montgomery.c"
@@ -188,6 +189,7 @@ add_library(CCryptoBoringSSL STATIC
188189
"crypto/fipsmodule/rsa/rsa_impl.c"
189190
"crypto/fipsmodule/self_check/fips.c"
190191
"crypto/fipsmodule/self_check/self_check.c"
192+
"crypto/fipsmodule/service_indicator/service_indicator.c"
191193
"crypto/fipsmodule/sha/sha1-altivec.c"
192194
"crypto/fipsmodule/sha/sha1.c"
193195
"crypto/fipsmodule/sha/sha256.c"
@@ -360,6 +362,7 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|Android" AND CMAKE_SYSTEM_PROCESSOR MATC
360362
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64")
361363
target_sources(CCryptoBoringSSL PRIVATE
362364
crypto/chacha/chacha-armv8.ios.aarch64.S
365+
crypto/cipher_extra/chacha20_poly1305_armv8.ios.aarch64.S
363366
crypto/fipsmodule/aesv8-armx64.ios.aarch64.S
364367
crypto/fipsmodule/armv8-mont.ios.aarch64.S
365368
crypto/fipsmodule/ghash-neon-armv8.ios.aarch64.S
@@ -373,6 +376,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm
373376
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|Android" AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64")
374377
target_sources(CCryptoBoringSSL PRIVATE
375378
crypto/chacha/chacha-armv8.linux.aarch64.S
379+
crypto/cipher_extra/chacha20_poly1305_armv8.linux.aarch64.S
376380
crypto/fipsmodule/aesv8-armx64.linux.aarch64.S
377381
crypto/fipsmodule/armv8-mont.linux.aarch64.S
378382
crypto/fipsmodule/ghash-neon-armv8.linux.aarch64.S

Sources/CCryptoBoringSSL/crypto/asn1/a_gentm.c

Lines changed: 10 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -55,130 +55,26 @@
5555
* [including the GNU Public Licence.] */
5656

5757
#include <CCryptoBoringSSL_asn1.h>
58+
#include <CCryptoBoringSSL_bytestring.h>
59+
#include <CCryptoBoringSSL_err.h>
60+
#include <CCryptoBoringSSL_mem.h>
5861

5962
#include <string.h>
6063
#include <time.h>
6164

62-
#include <CCryptoBoringSSL_err.h>
63-
#include <CCryptoBoringSSL_mem.h>
64-
6565
#include "internal.h"
6666

6767
int asn1_generalizedtime_to_tm(struct tm *tm, const ASN1_GENERALIZEDTIME *d)
6868
{
69-
static const int min[9] = { 0, 0, 1, 1, 0, 0, 0, 0, 0 };
70-
static const int max[9] = { 99, 99, 12, 31, 23, 59, 59, 12, 59 };
71-
char *a;
72-
int n, i, l, o;
73-
74-
if (d->type != V_ASN1_GENERALIZEDTIME)
75-
return (0);
76-
l = d->length;
77-
a = (char *)d->data;
78-
o = 0;
79-
/*
80-
* GENERALIZEDTIME is similar to UTCTIME except the year is represented
81-
* as YYYY. This stuff treats everything as a two digit field so make
82-
* first two fields 00 to 99
83-
*/
84-
if (l < 13)
85-
goto err;
86-
for (i = 0; i < 7; i++) {
87-
if ((i == 6) && ((a[o] == 'Z') || (a[o] == '+') || (a[o] == '-'))) {
88-
i++;
89-
if (tm)
90-
tm->tm_sec = 0;
91-
break;
92-
}
93-
if ((a[o] < '0') || (a[o] > '9'))
94-
goto err;
95-
n = a[o] - '0';
96-
if (++o > l)
97-
goto err;
98-
99-
if ((a[o] < '0') || (a[o] > '9'))
100-
goto err;
101-
n = (n * 10) + a[o] - '0';
102-
if (++o > l)
103-
goto err;
104-
105-
if ((n < min[i]) || (n > max[i]))
106-
goto err;
107-
if (tm) {
108-
switch (i) {
109-
case 0:
110-
tm->tm_year = n * 100 - 1900;
111-
break;
112-
case 1:
113-
tm->tm_year += n;
114-
break;
115-
case 2:
116-
tm->tm_mon = n - 1;
117-
break;
118-
case 3:
119-
tm->tm_mday = n;
120-
break;
121-
case 4:
122-
tm->tm_hour = n;
123-
break;
124-
case 5:
125-
tm->tm_min = n;
126-
break;
127-
case 6:
128-
tm->tm_sec = n;
129-
break;
130-
}
131-
}
132-
}
133-
/*
134-
* Optional fractional seconds: decimal point followed by one or more
135-
* digits.
136-
*/
137-
if (a[o] == '.') {
138-
if (++o > l)
139-
goto err;
140-
i = o;
141-
while ((a[o] >= '0') && (a[o] <= '9') && (o <= l))
142-
o++;
143-
/* Must have at least one digit after decimal point */
144-
if (i == o)
145-
goto err;
69+
if (d->type != V_ASN1_GENERALIZEDTIME) {
70+
return 0;
14671
}
147-
148-
if (a[o] == 'Z')
149-
o++;
150-
else if ((a[o] == '+') || (a[o] == '-')) {
151-
int offsign = a[o] == '-' ? 1 : -1, offset = 0;
152-
o++;
153-
if (o + 4 > l)
154-
goto err;
155-
for (i = 7; i < 9; i++) {
156-
if ((a[o] < '0') || (a[o] > '9'))
157-
goto err;
158-
n = a[o] - '0';
159-
o++;
160-
if ((a[o] < '0') || (a[o] > '9'))
161-
goto err;
162-
n = (n * 10) + a[o] - '0';
163-
if ((n < min[i]) || (n > max[i]))
164-
goto err;
165-
if (tm) {
166-
if (i == 7)
167-
offset = n * 3600;
168-
else if (i == 8)
169-
offset += n * 60;
170-
}
171-
o++;
172-
}
173-
if (offset && !OPENSSL_gmtime_adj(tm, 0, offset * offsign))
174-
return 0;
175-
} else if (a[o]) {
176-
/* Missing time zone information. */
177-
goto err;
72+
CBS cbs;
73+
CBS_init(&cbs, d->data, (size_t)d->length);
74+
if (!CBS_parse_generalized_time(&cbs, tm, /*allow_timezone_offset=*/0)) {
75+
return 0;
17876
}
179-
return (o == l);
180-
err:
181-
return (0);
77+
return 1;
18278
}
18379

18480
int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *d)

0 commit comments

Comments
 (0)