Skip to content

Commit bbdcdad

Browse files
hassaanpMylesBorins
authored andcommitted
deps: upgrade openssl sources to 1.1.1k+quic
This updates all sources in deps/openssl/openssl by: $ git clone https://github.com/quictls/openssl $ cd openssl $ git checkout OpenSSL_1_1_1k+quic $ cd ../node/deps/openssl $ rm -rf openssl $ cp -R ../openssl openssl $ cd openssl && rm -rf .gitattributes .github/ .gitmodules .travis-apt-pin.preferences .travis-create-release.sh $ cd .. $ git add --all openssl $ git commit openssl PR-URL: #37916 Fixes: #37913 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 13c3924 commit bbdcdad

40 files changed

+600
-208
lines changed

deps/openssl/openssl/CHANGES

+44
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,50 @@
77
https://github.com/openssl/openssl/commits/ and pick the appropriate
88
release branch.
99

10+
Changes between 1.1.1j and 1.1.1k [25 Mar 2021]
11+
12+
*) Fixed a problem with verifying a certificate chain when using the
13+
X509_V_FLAG_X509_STRICT flag. This flag enables additional security checks
14+
of the certificates present in a certificate chain. It is not set by
15+
default.
16+
17+
Starting from OpenSSL version 1.1.1h a check to disallow certificates in
18+
the chain that have explicitly encoded elliptic curve parameters was added
19+
as an additional strict check.
20+
21+
An error in the implementation of this check meant that the result of a
22+
previous check to confirm that certificates in the chain are valid CA
23+
certificates was overwritten. This effectively bypasses the check
24+
that non-CA certificates must not be able to issue other certificates.
25+
26+
If a "purpose" has been configured then there is a subsequent opportunity
27+
for checks that the certificate is a valid CA. All of the named "purpose"
28+
values implemented in libcrypto perform this check. Therefore, where
29+
a purpose is set the certificate chain will still be rejected even when the
30+
strict flag has been used. A purpose is set by default in libssl client and
31+
server certificate verification routines, but it can be overridden or
32+
removed by an application.
33+
34+
In order to be affected, an application must explicitly set the
35+
X509_V_FLAG_X509_STRICT verification flag and either not set a purpose
36+
for the certificate verification or, in the case of TLS client or server
37+
applications, override the default purpose.
38+
(CVE-2021-3450)
39+
[Tomáš Mráz]
40+
41+
*) Fixed an issue where an OpenSSL TLS server may crash if sent a maliciously
42+
crafted renegotiation ClientHello message from a client. If a TLSv1.2
43+
renegotiation ClientHello omits the signature_algorithms extension (where
44+
it was present in the initial ClientHello), but includes a
45+
signature_algorithms_cert extension then a NULL pointer dereference will
46+
result, leading to a crash and a denial of service attack.
47+
48+
A server is only vulnerable if it has TLSv1.2 and renegotiation enabled
49+
(which is the default configuration). OpenSSL TLS clients are not impacted
50+
by this issue.
51+
(CVE-2021-3449)
52+
[Peter Kästle and Samuel Sapalski]
53+
1054
Changes between 1.1.1i and 1.1.1j [16 Feb 2021]
1155

1256
*) Fixed the X509_issuer_and_serial_hash() function. It attempts to

deps/openssl/openssl/Configurations/unix-Makefile.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -917,8 +917,8 @@ errors:
917917
done )
918918

919919
ordinals:
920-
( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update )
921-
( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update )
920+
$(PERL) $(SRCDIR)/util/mkdef.pl crypto update
921+
$(PERL) $(SRCDIR)/util/mkdef.pl ssl update
922922

923923
test_ordinals:
924924
( cd test; \

deps/openssl/openssl/NEWS

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
This file gives a brief overview of the major changes between each OpenSSL
66
release. For more details please read the CHANGES file.
77

8+
Major changes between OpenSSL 1.1.1j and OpenSSL 1.1.1k [25 Mar 2021]
9+
10+
o Fixed a problem with verifying a certificate chain when using the
11+
X509_V_FLAG_X509_STRICT flag (CVE-2021-3450)
12+
o Fixed an issue where an OpenSSL TLS server may crash if sent a
13+
maliciously crafted renegotiation ClientHello message from a client
14+
(CVE-2021-3449)
15+
816
Major changes between OpenSSL 1.1.1i and OpenSSL 1.1.1j [16 Feb 2021]
917

1018
o Fixed a NULL pointer deref in the X509_issuer_and_serial_hash()

deps/openssl/openssl/README

-93
This file was deleted.

deps/openssl/openssl/README-OpenSSL.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

2-
OpenSSL 1.1.1j 16 Feb 2021
2+
OpenSSL 1.1.1k 25 Mar 2021
33

4-
Copyright (c) 1998-2020 The OpenSSL Project
4+
Copyright (c) 1998-2021 The OpenSSL Project
55
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
66
All rights reserved.
77

deps/openssl/openssl/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ How are you keeping current with OpenSSL?
4747
-----------------------------------------
4848
(In other words, "What about rebasing?")
4949

50-
Our plan it to always rebase on top of an upstream release tag. In particular:
50+
Our plan is to always rebase on top of an upstream release tag. In particular:
5151
- The changes for QUIC will always be at the tip of the branch -- you will know what
5252
is from the original OpenSSL and what is for QUIC.
5353
- New versions are quickly created once upstream creates a new tag.

deps/openssl/openssl/apps/s_cb.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
33
*
44
* Licensed under the OpenSSL license (the "License"). You may not use
55
* this file except in compliance with the License. You can obtain a copy
@@ -934,7 +934,8 @@ static int set_cert_cb(SSL *ssl, void *arg)
934934
if (!SSL_build_cert_chain(ssl, 0))
935935
return 0;
936936
} else if (exc->chain != NULL) {
937-
SSL_set1_chain(ssl, exc->chain);
937+
if (!SSL_set1_chain(ssl, exc->chain))
938+
return 0;
938939
}
939940
}
940941
exc = exc->prev;

deps/openssl/openssl/apps/s_time.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
33
*
44
* Licensed under the OpenSSL license (the "License"). You may not use
55
* this file except in compliance with the License. You can obtain a copy
@@ -263,7 +263,8 @@ int s_time_main(int argc, char **argv)
263263
nConn, totalTime, ((double)nConn / totalTime), bytes_read);
264264
printf
265265
("%d connections in %ld real seconds, %ld bytes read per connection\n",
266-
nConn, (long)time(NULL) - finishtime + maxtime, bytes_read / nConn);
266+
nConn, (long)time(NULL) - finishtime + maxtime,
267+
nConn > 0 ? bytes_read / nConn : 0l);
267268

268269
/*
269270
* Now loop and time connections using the same session id over and over

deps/openssl/openssl/crypto/asn1/asn1_par.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
33
*
44
* Licensed under the OpenSSL license (the "License"). You may not use
55
* this file except in compliance with the License. You can obtain a copy
@@ -325,6 +325,7 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
325325
}
326326
if (BIO_puts(bp, "]") <= 0)
327327
goto end;
328+
dump_cont = 0;
328329
}
329330

330331
if (!nl) {

deps/openssl/openssl/crypto/asn1/bio_ndef.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2008-2018 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.
33
*
44
* Licensed under the OpenSSL license (the "License"). You may not use
55
* this file except in compliance with the License. You can obtain a copy
@@ -113,6 +113,8 @@ static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
113113
ndef_aux = *(NDEF_SUPPORT **)parg;
114114

115115
derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it);
116+
if (derlen < 0)
117+
return 0;
116118
if ((p = OPENSSL_malloc(derlen)) == NULL) {
117119
ASN1err(ASN1_F_NDEF_PREFIX, ERR_R_MALLOC_FAILURE);
118120
return 0;

deps/openssl/openssl/crypto/engine/eng_devcrypto.c

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
33
*
44
* Licensed under the OpenSSL license (the "License"). You may not use
55
* this file except in compliance with the License. You can obtain a copy
@@ -758,15 +758,28 @@ static int devcrypto_unload(ENGINE *e)
758758
void engine_load_devcrypto_int()
759759
{
760760
ENGINE *e = NULL;
761+
int fd;
761762

762-
if ((cfd = open("/dev/crypto", O_RDWR, 0)) < 0) {
763+
if ((fd = open("/dev/crypto", O_RDWR, 0)) < 0) {
763764
#ifndef ENGINE_DEVCRYPTO_DEBUG
764765
if (errno != ENOENT)
765766
#endif
766767
fprintf(stderr, "Could not open /dev/crypto: %s\n", strerror(errno));
767768
return;
768769
}
769770

771+
#ifdef CRIOGET
772+
if (ioctl(fd, CRIOGET, &cfd) < 0) {
773+
fprintf(stderr, "Could not create crypto fd: %s\n", strerror(errno));
774+
close(fd);
775+
cfd = -1;
776+
return;
777+
}
778+
close(fd);
779+
#else
780+
cfd = fd;
781+
#endif
782+
770783
if ((e = ENGINE_new()) == NULL
771784
|| !ENGINE_set_destroy_function(e, devcrypto_unload)) {
772785
ENGINE_free(e);

deps/openssl/openssl/crypto/evp/evp_enc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
33
*
44
* Licensed under the OpenSSL license (the "License"). You may not use
55
* this file except in compliance with the License. You can obtain a copy

deps/openssl/openssl/crypto/modes/cbc128.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2008-2020 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.
33
*
44
* Licensed under the OpenSSL license (the "License"). You may not use
55
* this file except in compliance with the License. You can obtain a copy
@@ -69,7 +69,8 @@ void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,
6969
in += 16;
7070
out += 16;
7171
}
72-
memcpy(ivec, iv, 16);
72+
if (ivec != iv)
73+
memcpy(ivec, iv, 16);
7374
}
7475

7576
void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
@@ -114,7 +115,8 @@ void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
114115
out += 16;
115116
}
116117
}
117-
memcpy(ivec, iv, 16);
118+
if (ivec != iv)
119+
memcpy(ivec, iv, 16);
118120
} else {
119121
if (STRICT_ALIGNMENT &&
120122
((size_t)in | (size_t)out | (size_t)ivec) % sizeof(size_t) != 0) {

deps/openssl/openssl/crypto/modes/gcm128.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2020 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 2010-2021 The OpenSSL Project Authors. All Rights Reserved.
33
*
44
* Licensed under the OpenSSL license (the "License"). You may not use
55
* this file except in compliance with the License. You can obtain a copy
@@ -1385,8 +1385,8 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,
13851385
else
13861386
ctx->Yi.d[3] = ctr;
13871387
for (i = 0; i < 16 / sizeof(size_t); ++i) {
1388-
size_t c = in[i];
1389-
out[i] = c ^ ctx->EKi.t[i];
1388+
size_t c = in_t[i];
1389+
out_t[i] = c ^ ctx->EKi.t[i];
13901390
ctx->Xi.t[i] ^= c;
13911391
}
13921392
GCM_MUL(ctx);

deps/openssl/openssl/crypto/o_time.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved.
33
*
44
* Licensed under the OpenSSL license (the "License"). You may not use
55
* this file except in compliance with the License. You can obtain a copy
@@ -133,8 +133,8 @@ int OPENSSL_gmtime_diff(int *pday, int *psec,
133133
static int julian_adj(const struct tm *tm, int off_day, long offset_sec,
134134
long *pday, int *psec)
135135
{
136-
int offset_hms, offset_day;
137-
long time_jd;
136+
int offset_hms;
137+
long offset_day, time_jd;
138138
int time_year, time_month, time_day;
139139
/* split offset into days and day seconds */
140140
offset_day = offset_sec / SECS_PER_DAY;

deps/openssl/openssl/crypto/rand/rand_lib.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
33
*
44
* Licensed under the OpenSSL license (the "License"). You may not use
55
* this file except in compliance with the License. You can obtain a copy
@@ -432,9 +432,13 @@ int RAND_poll(void)
432432
RAND_POOL *rand_pool_new(int entropy_requested, int secure,
433433
size_t min_len, size_t max_len)
434434
{
435-
RAND_POOL *pool = OPENSSL_zalloc(sizeof(*pool));
435+
RAND_POOL *pool;
436436
size_t min_alloc_size = RAND_POOL_MIN_ALLOCATION(secure);
437437

438+
if (!RUN_ONCE(&rand_init, do_rand_init))
439+
return NULL;
440+
441+
pool = OPENSSL_zalloc(sizeof(*pool));
438442
if (pool == NULL) {
439443
RANDerr(RAND_F_RAND_POOL_NEW, ERR_R_MALLOC_FAILURE);
440444
return NULL;

deps/openssl/openssl/crypto/rsa/rsa_ssl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
33
*
44
* Licensed under the OpenSSL license (the "License"). You may not use
55
* this file except in compliance with the License. You can obtain a copy

0 commit comments

Comments
 (0)