Skip to content

Commit 3417cc5

Browse files
hassaanptargos
authored andcommittedApr 11, 2020
deps: upgrade openssl sources to 1.1.1f
This updates all sources in deps/openssl/openssl by: $ cd deps/openssl/ $ rm -rf openssl $ tar zxf ~/tmp/openssl-1.1.1f.tar.gz $ mv openssl-1.1.0h openssl $ git add --all openssl $ git commit openssl PR-URL: #32583 Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent 28077a0 commit 3417cc5

30 files changed

+367
-345
lines changed
 

‎deps/openssl/openssl/CHANGES

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

10+
Changes between 1.1.1e and 1.1.1f [31 Mar 2020]
11+
12+
*) Revert the change of EOF detection while reading in libssl to avoid
13+
regressions in applications depending on the current way of reporting
14+
the EOF. As the existing method is not fully accurate the change to
15+
reporting the EOF via SSL_ERROR_SSL is kept on the current development
16+
branch and will be present in the 3.0 release.
17+
[Tomas Mraz]
18+
19+
*) Revised BN_generate_prime_ex to not avoid factors 3..17863 in p-1
20+
when primes for RSA keys are computed.
21+
Since we previously always generated primes == 2 (mod 3) for RSA keys,
22+
the 2-prime and 3-prime RSA modules were easy to distinguish, since
23+
N = p*q = 1 (mod 3), but N = p*q*r = 2 (mod 3). Therefore fingerprinting
24+
2-prime vs. 3-prime RSA keys was possible by computing N mod 3.
25+
This avoids possible fingerprinting of newly generated RSA modules.
26+
[Bernd Edlinger]
27+
1028
Changes between 1.1.1d and 1.1.1e [17 Mar 2020]
1129
*) Properly detect EOF while reading in libssl. Previously if we hit an EOF
1230
while reading in libssl then we would report an error back to the

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

+100-100
Large diffs are not rendered by default.

‎deps/openssl/openssl/NEWS

+6
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@
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.1e and OpenSSL 1.1.1f [31 Mar 2020]
9+
10+
o Revert the unexpected EOF reporting via SSL_ERROR_SSL
11+
812
Major changes between OpenSSL 1.1.1d and OpenSSL 1.1.1e [17 Mar 2020]
913

1014
o Fixed an overflow bug in the x64_64 Montgomery squaring procedure
1115
used in exponentiation with 512-bit moduli (CVE-2019-1551)
16+
o Properly detect unexpected EOF while reading in libssl and report
17+
it via SSL_ERROR_SSL
1218

1319
Major changes between OpenSSL 1.1.1c and OpenSSL 1.1.1d [10 Sep 2019]
1420

‎deps/openssl/openssl/README

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

2-
OpenSSL 1.1.1e 17 Mar 2020
2+
OpenSSL 1.1.1f 31 Mar 2020
33

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

‎deps/openssl/openssl/apps/rehash.c

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2019 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
33
* Copyright (c) 2013-2014 Timo Teräs <timo.teras@gmail.com>
44
*
55
* Licensed under the OpenSSL license (the "License"). You may not use
@@ -274,11 +274,19 @@ static int do_file(const char *filename, const char *fullpath, enum Hash h)
274274
if (x->x509 != NULL) {
275275
type = TYPE_CERT;
276276
name = X509_get_subject_name(x->x509);
277-
X509_digest(x->x509, evpmd, digest, NULL);
277+
if (!X509_digest(x->x509, evpmd, digest, NULL)) {
278+
BIO_printf(bio_err, "out of memory\n");
279+
++errs;
280+
goto end;
281+
}
278282
} else if (x->crl != NULL) {
279283
type = TYPE_CRL;
280284
name = X509_CRL_get_issuer(x->crl);
281-
X509_CRL_digest(x->crl, evpmd, digest, NULL);
285+
if (!X509_CRL_digest(x->crl, evpmd, digest, NULL)) {
286+
BIO_printf(bio_err, "out of memory\n");
287+
++errs;
288+
goto end;
289+
}
282290
} else {
283291
++errs;
284292
goto end;

‎deps/openssl/openssl/apps/s_server.c

+2-2
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-2020 The OpenSSL Project Authors. All Rights Reserved.
33
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
44
* Copyright 2005 Nokia. All rights reserved.
55
*
@@ -1904,7 +1904,7 @@ int s_server_main(int argc, char *argv[])
19041904
BIO_printf(bio_s_out, "Setting secondary ctx parameters\n");
19051905

19061906
if (sdebug)
1907-
ssl_ctx_security_debug(ctx, sdebug);
1907+
ssl_ctx_security_debug(ctx2, sdebug);
19081908

19091909
if (session_id_prefix) {
19101910
if (strlen(session_id_prefix) >= 32)

‎deps/openssl/openssl/crypto/bn/bn_local.h

+1-4
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-2020 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
@@ -654,9 +654,6 @@ BIGNUM *int_bn_mod_inverse(BIGNUM *in,
654654
const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx,
655655
int *noinv);
656656

657-
int bn_probable_prime_dh(BIGNUM *rnd, int bits,
658-
const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
659-
660657
static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
661658
{
662659
if (bits > (INT_MAX - BN_BITS2 + 1))

‎deps/openssl/openssl/crypto/bn/bn_prime.c

+60-141
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-2020 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
@@ -22,10 +22,12 @@
2222
static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
2323
const BIGNUM *a1_odd, int k, BN_CTX *ctx,
2424
BN_MONT_CTX *mont);
25-
static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods);
26-
static int probable_prime_dh_safe(BIGNUM *rnd, int bits,
27-
const BIGNUM *add, const BIGNUM *rem,
28-
BN_CTX *ctx);
25+
static int probable_prime(BIGNUM *rnd, int bits, int safe, prime_t *mods);
26+
static int probable_prime_dh(BIGNUM *rnd, int bits, int safe, prime_t *mods,
27+
const BIGNUM *add, const BIGNUM *rem,
28+
BN_CTX *ctx);
29+
30+
#define square(x) ((BN_ULONG)(x) * (BN_ULONG)(x))
2931

3032
int BN_GENCB_call(BN_GENCB *cb, int a, int b)
3133
{
@@ -87,16 +89,11 @@ int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe,
8789
loop:
8890
/* make a random number and set the top and bottom bits */
8991
if (add == NULL) {
90-
if (!probable_prime(ret, bits, mods))
92+
if (!probable_prime(ret, bits, safe, mods))
9193
goto err;
9294
} else {
93-
if (safe) {
94-
if (!probable_prime_dh_safe(ret, bits, add, rem, ctx))
95-
goto err;
96-
} else {
97-
if (!bn_probable_prime_dh(ret, bits, add, rem, ctx))
98-
goto err;
99-
}
95+
if (!probable_prime_dh(ret, bits, safe, mods, add, rem, ctx))
96+
goto err;
10097
}
10198

10299
if (!BN_GENCB_call(cb, 0, c1++))
@@ -272,79 +269,44 @@ static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
272269
return 1;
273270
}
274271

275-
static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods)
272+
static int probable_prime(BIGNUM *rnd, int bits, int safe, prime_t *mods)
276273
{
277274
int i;
278275
BN_ULONG delta;
279276
BN_ULONG maxdelta = BN_MASK2 - primes[NUMPRIMES - 1];
280-
char is_single_word = bits <= BN_BITS2;
281277

282278
again:
283279
/* TODO: Not all primes are private */
284280
if (!BN_priv_rand(rnd, bits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ODD))
285281
return 0;
282+
if (safe && !BN_set_bit(rnd, 1))
283+
return 0;
286284
/* we now have a random number 'rnd' to test. */
287285
for (i = 1; i < NUMPRIMES; i++) {
288286
BN_ULONG mod = BN_mod_word(rnd, (BN_ULONG)primes[i]);
289287
if (mod == (BN_ULONG)-1)
290288
return 0;
291289
mods[i] = (prime_t) mod;
292290
}
293-
/*
294-
* If bits is so small that it fits into a single word then we
295-
* additionally don't want to exceed that many bits.
296-
*/
297-
if (is_single_word) {
298-
BN_ULONG size_limit;
299-
300-
if (bits == BN_BITS2) {
301-
/*
302-
* Shifting by this much has undefined behaviour so we do it a
303-
* different way
304-
*/
305-
size_limit = ~((BN_ULONG)0) - BN_get_word(rnd);
306-
} else {
307-
size_limit = (((BN_ULONG)1) << bits) - BN_get_word(rnd) - 1;
308-
}
309-
if (size_limit < maxdelta)
310-
maxdelta = size_limit;
311-
}
312291
delta = 0;
313292
loop:
314-
if (is_single_word) {
315-
BN_ULONG rnd_word = BN_get_word(rnd);
316-
317-
/*-
318-
* In the case that the candidate prime is a single word then
319-
* we check that:
320-
* 1) It's greater than primes[i] because we shouldn't reject
321-
* 3 as being a prime number because it's a multiple of
322-
* three.
323-
* 2) That it's not a multiple of a known prime. We don't
324-
* check that rnd-1 is also coprime to all the known
325-
* primes because there aren't many small primes where
326-
* that's true.
293+
for (i = 1; i < NUMPRIMES; i++) {
294+
/*
295+
* check that rnd is a prime and also that
296+
* gcd(rnd-1,primes) == 1 (except for 2)
297+
* do the second check only if we are interested in safe primes
298+
* in the case that the candidate prime is a single word then
299+
* we check only the primes up to sqrt(rnd)
327300
*/
328-
for (i = 1; i < NUMPRIMES && primes[i] < rnd_word; i++) {
329-
if ((mods[i] + delta) % primes[i] == 0) {
330-
delta += 2;
331-
if (delta > maxdelta)
332-
goto again;
333-
goto loop;
334-
}
335-
}
336-
} else {
337-
for (i = 1; i < NUMPRIMES; i++) {
338-
/*
339-
* check that rnd is not a prime and also that gcd(rnd-1,primes)
340-
* == 1 (except for 2)
341-
*/
342-
if (((mods[i] + delta) % primes[i]) <= 1) {
343-
delta += 2;
344-
if (delta > maxdelta)
345-
goto again;
346-
goto loop;
347-
}
301+
if (bits <= 31 && delta <= 0x7fffffff
302+
&& square(primes[i]) > BN_get_word(rnd) + delta)
303+
break;
304+
if (safe ? (mods[i] + delta) % primes[i] <= 1
305+
: (mods[i] + delta) % primes[i] == 0) {
306+
delta += safe ? 4 : 2;
307+
if (delta > maxdelta)
308+
goto again;
309+
goto loop;
348310
}
349311
}
350312
if (!BN_add_word(rnd, delta))
@@ -355,16 +317,23 @@ static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods)
355317
return 1;
356318
}
357319

358-
int bn_probable_prime_dh(BIGNUM *rnd, int bits,
359-
const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx)
320+
static int probable_prime_dh(BIGNUM *rnd, int bits, int safe, prime_t *mods,
321+
const BIGNUM *add, const BIGNUM *rem,
322+
BN_CTX *ctx)
360323
{
361324
int i, ret = 0;
362325
BIGNUM *t1;
326+
BN_ULONG delta;
327+
BN_ULONG maxdelta = BN_MASK2 - primes[NUMPRIMES - 1];
363328

364329
BN_CTX_start(ctx);
365330
if ((t1 = BN_CTX_get(ctx)) == NULL)
366331
goto err;
367332

333+
if (maxdelta > BN_MASK2 - BN_get_word(add))
334+
maxdelta = BN_MASK2 - BN_get_word(add);
335+
336+
again:
368337
if (!BN_rand(rnd, bits, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD))
369338
goto err;
370339

@@ -375,98 +344,48 @@ int bn_probable_prime_dh(BIGNUM *rnd, int bits,
375344
if (!BN_sub(rnd, rnd, t1))
376345
goto err;
377346
if (rem == NULL) {
378-
if (!BN_add_word(rnd, 1))
347+
if (!BN_add_word(rnd, safe ? 3u : 1u))
379348
goto err;
380349
} else {
381350
if (!BN_add(rnd, rnd, rem))
382351
goto err;
383352
}
384353

385-
/* we now have a random number 'rand' to test. */
354+
if (BN_num_bits(rnd) < bits
355+
|| BN_get_word(rnd) < (safe ? 5u : 3u)) {
356+
if (!BN_add(rnd, rnd, add))
357+
goto err;
358+
}
386359

387-
loop:
360+
/* we now have a random number 'rnd' to test. */
388361
for (i = 1; i < NUMPRIMES; i++) {
389-
/* check that rnd is a prime */
390362
BN_ULONG mod = BN_mod_word(rnd, (BN_ULONG)primes[i]);
391363
if (mod == (BN_ULONG)-1)
392364
goto err;
393-
if (mod <= 1) {
394-
if (!BN_add(rnd, rnd, add))
395-
goto err;
396-
goto loop;
397-
}
398-
}
399-
ret = 1;
400-
401-
err:
402-
BN_CTX_end(ctx);
403-
bn_check_top(rnd);
404-
return ret;
405-
}
406-
407-
static int probable_prime_dh_safe(BIGNUM *p, int bits, const BIGNUM *padd,
408-
const BIGNUM *rem, BN_CTX *ctx)
409-
{
410-
int i, ret = 0;
411-
BIGNUM *t1, *qadd, *q;
412-
413-
bits--;
414-
BN_CTX_start(ctx);
415-
t1 = BN_CTX_get(ctx);
416-
q = BN_CTX_get(ctx);
417-
qadd = BN_CTX_get(ctx);
418-
if (qadd == NULL)
419-
goto err;
420-
421-
if (!BN_rshift1(qadd, padd))
422-
goto err;
423-
424-
if (!BN_rand(q, bits, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD))
425-
goto err;
426-
427-
/* we need ((rnd-rem) % add) == 0 */
428-
if (!BN_mod(t1, q, qadd, ctx))
429-
goto err;
430-
if (!BN_sub(q, q, t1))
431-
goto err;
432-
if (rem == NULL) {
433-
if (!BN_add_word(q, 1))
434-
goto err;
435-
} else {
436-
if (!BN_rshift1(t1, rem))
437-
goto err;
438-
if (!BN_add(q, q, t1))
439-
goto err;
365+
mods[i] = (prime_t) mod;
440366
}
441-
442-
/* we now have a random number 'rand' to test. */
443-
if (!BN_lshift1(p, q))
444-
goto err;
445-
if (!BN_add_word(p, 1))
446-
goto err;
447-
367+
delta = 0;
448368
loop:
449369
for (i = 1; i < NUMPRIMES; i++) {
450-
/* check that p and q are prime */
451-
/*
452-
* check that for p and q gcd(p-1,primes) == 1 (except for 2)
453-
*/
454-
BN_ULONG pmod = BN_mod_word(p, (BN_ULONG)primes[i]);
455-
BN_ULONG qmod = BN_mod_word(q, (BN_ULONG)primes[i]);
456-
if (pmod == (BN_ULONG)-1 || qmod == (BN_ULONG)-1)
457-
goto err;
458-
if (pmod == 0 || qmod == 0) {
459-
if (!BN_add(p, p, padd))
460-
goto err;
461-
if (!BN_add(q, q, qadd))
462-
goto err;
370+
/* check that rnd is a prime */
371+
if (bits <= 31 && delta <= 0x7fffffff
372+
&& square(primes[i]) > BN_get_word(rnd) + delta)
373+
break;
374+
/* rnd mod p == 1 implies q = (rnd-1)/2 is divisible by p */
375+
if (safe ? (mods[i] + delta) % primes[i] <= 1
376+
: (mods[i] + delta) % primes[i] == 0) {
377+
delta += BN_get_word(add);
378+
if (delta > maxdelta)
379+
goto again;
463380
goto loop;
464381
}
465382
}
383+
if (!BN_add_word(rnd, delta))
384+
goto err;
466385
ret = 1;
467386

468387
err:
469388
BN_CTX_end(ctx);
470-
bn_check_top(p);
389+
bn_check_top(rnd);
471390
return ret;
472391
}

‎deps/openssl/openssl/crypto/conf/conf_lib.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 2000-2020 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
@@ -356,8 +356,10 @@ OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void)
356356
{
357357
OPENSSL_INIT_SETTINGS *ret = malloc(sizeof(*ret));
358358

359-
if (ret != NULL)
360-
memset(ret, 0, sizeof(*ret));
359+
if (ret == NULL)
360+
return NULL;
361+
362+
memset(ret, 0, sizeof(*ret));
361363
ret->flags = DEFAULT_CONF_MFLAGS;
362364

363365
return ret;

‎deps/openssl/openssl/crypto/err/openssl.txt

-1
Original file line numberDiff line numberDiff line change
@@ -2852,7 +2852,6 @@ SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES:242:unable to load ssl3 md5 routines
28522852
SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES:243:unable to load ssl3 sha1 routines
28532853
SSL_R_UNEXPECTED_CCS_MESSAGE:262:unexpected ccs message
28542854
SSL_R_UNEXPECTED_END_OF_EARLY_DATA:178:unexpected end of early data
2855-
SSL_R_UNEXPECTED_EOF_WHILE_READING:294:unexpected eof while reading
28562855
SSL_R_UNEXPECTED_MESSAGE:244:unexpected message
28572856
SSL_R_UNEXPECTED_RECORD:245:unexpected record
28582857
SSL_R_UNINITIALIZED:276:uninitialized

‎deps/openssl/openssl/crypto/ex_data.c

+3-3
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-2020 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
@@ -235,7 +235,7 @@ int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad)
235235
return 0;
236236
}
237237
for (i = 0; i < mx; i++) {
238-
if (storage[i] && storage[i]->new_func) {
238+
if (storage[i] != NULL && storage[i]->new_func != NULL) {
239239
ptr = CRYPTO_get_ex_data(ad, i);
240240
storage[i]->new_func(obj, ptr, ad, i,
241241
storage[i]->argl, storage[i]->argp);
@@ -299,7 +299,7 @@ int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
299299

300300
for (i = 0; i < mx; i++) {
301301
ptr = CRYPTO_get_ex_data(from, i);
302-
if (storage[i] && storage[i]->dup_func)
302+
if (storage[i] != NULL && storage[i]->dup_func != NULL)
303303
if (!storage[i]->dup_func(to, from, &ptr, i,
304304
storage[i]->argl, storage[i]->argp))
305305
goto err;

‎deps/openssl/openssl/crypto/pkcs12/p12_crt.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 1999-2020 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
@@ -62,7 +62,8 @@ PKCS12 *PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey, X509 *
6262
if (pkey && cert) {
6363
if (!X509_check_private_key(cert, pkey))
6464
return NULL;
65-
X509_digest(cert, EVP_sha1(), keyid, &keyidlen);
65+
if (!X509_digest(cert, EVP_sha1(), keyid, &keyidlen))
66+
return NULL;
6667
}
6768

6869
if (cert) {

‎deps/openssl/openssl/crypto/ts/ts_rsp_sign.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 2006-2020 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
@@ -771,7 +771,8 @@ static ESS_CERT_ID *ess_CERT_ID_new_init(X509 *cert, int issuer_needed)
771771
X509_check_purpose(cert, -1, 0);
772772
if ((cid = ESS_CERT_ID_new()) == NULL)
773773
goto err;
774-
X509_digest(cert, EVP_sha1(), cert_sha1, NULL);
774+
if (!X509_digest(cert, EVP_sha1(), cert_sha1, NULL))
775+
goto err;
775776
if (!ASN1_OCTET_STRING_set(cid->hash, cert_sha1, SHA_DIGEST_LENGTH))
776777
goto err;
777778

‎deps/openssl/openssl/crypto/ts/ts_rsp_verify.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 2006-2020 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
@@ -289,11 +289,12 @@ static int ts_find_cert(STACK_OF(ESS_CERT_ID) *cert_ids, X509 *cert)
289289
if (!cert_ids || !cert)
290290
return -1;
291291

292-
X509_digest(cert, EVP_sha1(), cert_sha1, NULL);
293-
294292
/* Recompute SHA1 hash of certificate if necessary (side effect). */
295293
X509_check_purpose(cert, -1, 0);
296294

295+
if (!X509_digest(cert, EVP_sha1(), cert_sha1, NULL))
296+
return -1;
297+
297298
/* Look for cert in the cert_ids vector. */
298299
for (i = 0; i < sk_ESS_CERT_ID_num(cert_ids); ++i) {
299300
ESS_CERT_ID *cid = sk_ESS_CERT_ID_value(cert_ids, i);
@@ -326,7 +327,8 @@ static int ts_find_cert_v2(STACK_OF(ESS_CERT_ID_V2) *cert_ids, X509 *cert)
326327
else
327328
md = EVP_sha256();
328329

329-
X509_digest(cert, md, cert_digest, &len);
330+
if (!X509_digest(cert, md, cert_digest, &len))
331+
return -1;
330332
if (cid->hash->length != (int)len)
331333
return -1;
332334

‎deps/openssl/openssl/crypto/x509/x509_cmp.c

+6-3
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-2020 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
@@ -134,9 +134,12 @@ unsigned long X509_subject_name_hash_old(X509 *x)
134134
int X509_cmp(const X509 *a, const X509 *b)
135135
{
136136
int rv;
137+
137138
/* ensure hash is valid */
138-
X509_check_purpose((X509 *)a, -1, 0);
139-
X509_check_purpose((X509 *)b, -1, 0);
139+
if (X509_check_purpose((X509 *)a, -1, 0) != 1)
140+
return -2;
141+
if (X509_check_purpose((X509 *)b, -1, 0) != 1)
142+
return -2;
140143

141144
rv = memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH);
142145
if (rv)

‎deps/openssl/openssl/crypto/x509/x509_trs.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 1999-2020 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
@@ -240,8 +240,9 @@ static int trust_1oid(X509_TRUST *trust, X509 *x, int flags)
240240
static int trust_compat(X509_TRUST *trust, X509 *x, int flags)
241241
{
242242
/* Call for side-effect of computing hash and caching extensions */
243-
X509_check_purpose(x, -1, 0);
244-
if ((flags & X509_TRUST_NO_SS_COMPAT) == 0 && x->ex_flags & EXFLAG_SS)
243+
if (X509_check_purpose(x, -1, 0) != 1)
244+
return X509_TRUST_UNTRUSTED;
245+
if ((flags & X509_TRUST_NO_SS_COMPAT) == 0 && (x->ex_flags & EXFLAG_SS))
245246
return X509_TRUST_TRUSTED;
246247
else
247248
return X509_TRUST_UNTRUSTED;

‎deps/openssl/openssl/crypto/x509/x509_vfy.c

+3-7
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-2020 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
@@ -107,12 +107,8 @@ static int null_callback(int ok, X509_STORE_CTX *e)
107107
/* Return 1 is a certificate is self signed */
108108
static int cert_self_signed(X509 *x)
109109
{
110-
/*
111-
* FIXME: x509v3_cache_extensions() needs to detect more failures and not
112-
* set EXFLAG_SET when that happens. Especially, if the failures are
113-
* parse errors, rather than memory pressure!
114-
*/
115-
X509_check_purpose(x, -1, 0);
110+
if (X509_check_purpose(x, -1, 0) != 1)
111+
return 0;
116112
if (x->ex_flags & EXFLAG_SS)
117113
return 1;
118114
else

‎deps/openssl/openssl/crypto/x509/x_all.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 1995-2020 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
@@ -362,7 +362,8 @@ int X509_pubkey_digest(const X509 *data, const EVP_MD *type,
362362
int X509_digest(const X509 *data, const EVP_MD *type, unsigned char *md,
363363
unsigned int *len)
364364
{
365-
if (type == EVP_sha1() && (data->ex_flags & EXFLAG_SET) != 0) {
365+
if (type == EVP_sha1() && (data->ex_flags & EXFLAG_SET) != 0
366+
&& (data->ex_flags & EXFLAG_INVALID) == 0) {
366367
/* Asking for SHA1 and we already computed it. */
367368
if (len != NULL)
368369
*len = sizeof(data->sha1_hash);
@@ -376,7 +377,8 @@ int X509_digest(const X509 *data, const EVP_MD *type, unsigned char *md,
376377
int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type,
377378
unsigned char *md, unsigned int *len)
378379
{
379-
if (type == EVP_sha1() && (data->flags & EXFLAG_SET) != 0) {
380+
if (type == EVP_sha1() && (data->flags & EXFLAG_SET) != 0
381+
&& (data->flags & EXFLAG_INVALID) == 0) {
380382
/* Asking for SHA1; always computed in CRL d2i. */
381383
if (len != NULL)
382384
*len = sizeof(data->sha1_hash);

‎deps/openssl/openssl/crypto/x509/x_crl.c

+25-12
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-2020 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
@@ -17,7 +17,7 @@
1717

1818
static int X509_REVOKED_cmp(const X509_REVOKED *const *a,
1919
const X509_REVOKED *const *b);
20-
static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp);
20+
static int setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp);
2121

2222
ASN1_SEQUENCE(X509_REVOKED) = {
2323
ASN1_EMBED(X509_REVOKED,serialNumber, ASN1_INTEGER),
@@ -155,7 +155,7 @@ static int crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
155155
X509_CRL *crl = (X509_CRL *)*pval;
156156
STACK_OF(X509_EXTENSION) *exts;
157157
X509_EXTENSION *ext;
158-
int idx;
158+
int idx, i;
159159

160160
switch (operation) {
161161
case ASN1_OP_D2I_PRE:
@@ -184,23 +184,35 @@ static int crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
184184
break;
185185

186186
case ASN1_OP_D2I_POST:
187-
X509_CRL_digest(crl, EVP_sha1(), crl->sha1_hash, NULL);
187+
if (!X509_CRL_digest(crl, EVP_sha1(), crl->sha1_hash, NULL))
188+
crl->flags |= EXFLAG_INVALID;
188189
crl->idp = X509_CRL_get_ext_d2i(crl,
189-
NID_issuing_distribution_point, NULL,
190+
NID_issuing_distribution_point, &i,
190191
NULL);
191-
if (crl->idp)
192-
setup_idp(crl, crl->idp);
192+
if (crl->idp != NULL) {
193+
if (!setup_idp(crl, crl->idp))
194+
crl->flags |= EXFLAG_INVALID;
195+
}
196+
else if (i != -1) {
197+
crl->flags |= EXFLAG_INVALID;
198+
}
193199

194200
crl->akid = X509_CRL_get_ext_d2i(crl,
195-
NID_authority_key_identifier, NULL,
201+
NID_authority_key_identifier, &i,
196202
NULL);
203+
if (crl->akid == NULL && i != -1)
204+
crl->flags |= EXFLAG_INVALID;
197205

198206
crl->crl_number = X509_CRL_get_ext_d2i(crl,
199-
NID_crl_number, NULL, NULL);
207+
NID_crl_number, &i, NULL);
208+
if (crl->crl_number == NULL && i != -1)
209+
crl->flags |= EXFLAG_INVALID;
200210

201211
crl->base_crl_number = X509_CRL_get_ext_d2i(crl,
202-
NID_delta_crl, NULL,
212+
NID_delta_crl, &i,
203213
NULL);
214+
if (crl->base_crl_number == NULL && i != -1)
215+
crl->flags |= EXFLAG_INVALID;
204216
/* Delta CRLs must have CRL number */
205217
if (crl->base_crl_number && !crl->crl_number)
206218
crl->flags |= EXFLAG_INVALID;
@@ -259,9 +271,10 @@ static int crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
259271

260272
/* Convert IDP into a more convenient form */
261273

262-
static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp)
274+
static int setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp)
263275
{
264276
int idp_only = 0;
277+
265278
/* Set various flags according to IDP */
266279
crl->idp_flags |= IDP_PRESENT;
267280
if (idp->onlyuser > 0) {
@@ -292,7 +305,7 @@ static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp)
292305
crl->idp_reasons &= CRLDP_ALL_REASONS;
293306
}
294307

295-
DIST_POINT_set_dpname(idp->distpoint, X509_CRL_get_issuer(crl));
308+
return DIST_POINT_set_dpname(idp->distpoint, X509_CRL_get_issuer(crl));
296309
}
297310

298311
ASN1_SEQUENCE_ref(X509_CRL, crl_cb) = {

‎deps/openssl/openssl/crypto/x509v3/v3_purp.c

+68-29
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 1999-2020 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
@@ -81,6 +81,8 @@ int X509_check_purpose(X509 *x, int id, int ca)
8181
const X509_PURPOSE *pt;
8282

8383
x509v3_cache_extensions(x);
84+
if (x->ex_flags & EXFLAG_INVALID)
85+
return -1;
8486

8587
/* Return if side-effect only call */
8688
if (id == -1)
@@ -300,10 +302,11 @@ int X509_supported_extension(X509_EXTENSION *ex)
300302
return 0;
301303
}
302304

303-
static void setup_dp(X509 *x, DIST_POINT *dp)
305+
static int setup_dp(X509 *x, DIST_POINT *dp)
304306
{
305307
X509_NAME *iname = NULL;
306308
int i;
309+
307310
if (dp->reasons) {
308311
if (dp->reasons->length > 0)
309312
dp->dp_reasons = dp->reasons->data[0];
@@ -313,7 +316,7 @@ static void setup_dp(X509 *x, DIST_POINT *dp)
313316
} else
314317
dp->dp_reasons = CRLDP_ALL_REASONS;
315318
if (!dp->distpoint || (dp->distpoint->type != 1))
316-
return;
319+
return 1;
317320
for (i = 0; i < sk_GENERAL_NAME_num(dp->CRLissuer); i++) {
318321
GENERAL_NAME *gen = sk_GENERAL_NAME_value(dp->CRLissuer, i);
319322
if (gen->type == GEN_DIRNAME) {
@@ -324,16 +327,21 @@ static void setup_dp(X509 *x, DIST_POINT *dp)
324327
if (!iname)
325328
iname = X509_get_issuer_name(x);
326329

327-
DIST_POINT_set_dpname(dp->distpoint, iname);
328-
330+
return DIST_POINT_set_dpname(dp->distpoint, iname);
329331
}
330332

331-
static void setup_crldp(X509 *x)
333+
static int setup_crldp(X509 *x)
332334
{
333335
int i;
334-
x->crldp = X509_get_ext_d2i(x, NID_crl_distribution_points, NULL, NULL);
335-
for (i = 0; i < sk_DIST_POINT_num(x->crldp); i++)
336-
setup_dp(x, sk_DIST_POINT_value(x->crldp, i));
336+
337+
x->crldp = X509_get_ext_d2i(x, NID_crl_distribution_points, &i, NULL);
338+
if (x->crldp == NULL && i != -1)
339+
return 0;
340+
for (i = 0; i < sk_DIST_POINT_num(x->crldp); i++) {
341+
if (!setup_dp(x, sk_DIST_POINT_value(x->crldp, i)))
342+
return 0;
343+
}
344+
return 1;
337345
}
338346

339347
#define V1_ROOT (EXFLAG_V1|EXFLAG_SS)
@@ -366,12 +374,13 @@ static void x509v3_cache_extensions(X509 *x)
366374
return;
367375
}
368376

369-
X509_digest(x, EVP_sha1(), x->sha1_hash, NULL);
377+
if (!X509_digest(x, EVP_sha1(), x->sha1_hash, NULL))
378+
x->ex_flags |= EXFLAG_INVALID;
370379
/* V1 should mean no extensions ... */
371380
if (!X509_get_version(x))
372381
x->ex_flags |= EXFLAG_V1;
373382
/* Handle basic constraints */
374-
if ((bs = X509_get_ext_d2i(x, NID_basic_constraints, NULL, NULL))) {
383+
if ((bs = X509_get_ext_d2i(x, NID_basic_constraints, &i, NULL))) {
375384
if (bs->ca)
376385
x->ex_flags |= EXFLAG_CA;
377386
if (bs->pathlen) {
@@ -385,9 +394,11 @@ static void x509v3_cache_extensions(X509 *x)
385394
x->ex_pathlen = -1;
386395
BASIC_CONSTRAINTS_free(bs);
387396
x->ex_flags |= EXFLAG_BCONS;
397+
} else if (i != -1) {
398+
x->ex_flags |= EXFLAG_INVALID;
388399
}
389400
/* Handle proxy certificates */
390-
if ((pci = X509_get_ext_d2i(x, NID_proxyCertInfo, NULL, NULL))) {
401+
if ((pci = X509_get_ext_d2i(x, NID_proxyCertInfo, &i, NULL))) {
391402
if (x->ex_flags & EXFLAG_CA
392403
|| X509_get_ext_by_NID(x, NID_subject_alt_name, -1) >= 0
393404
|| X509_get_ext_by_NID(x, NID_issuer_alt_name, -1) >= 0) {
@@ -399,9 +410,11 @@ static void x509v3_cache_extensions(X509 *x)
399410
x->ex_pcpathlen = -1;
400411
PROXY_CERT_INFO_EXTENSION_free(pci);
401412
x->ex_flags |= EXFLAG_PROXY;
413+
} else if (i != -1) {
414+
x->ex_flags |= EXFLAG_INVALID;
402415
}
403416
/* Handle key usage */
404-
if ((usage = X509_get_ext_d2i(x, NID_key_usage, NULL, NULL))) {
417+
if ((usage = X509_get_ext_d2i(x, NID_key_usage, &i, NULL))) {
405418
if (usage->length > 0) {
406419
x->ex_kusage = usage->data[0];
407420
if (usage->length > 1)
@@ -410,9 +423,11 @@ static void x509v3_cache_extensions(X509 *x)
410423
x->ex_kusage = 0;
411424
x->ex_flags |= EXFLAG_KUSAGE;
412425
ASN1_BIT_STRING_free(usage);
426+
} else if (i != -1) {
427+
x->ex_flags |= EXFLAG_INVALID;
413428
}
414429
x->ex_xkusage = 0;
415-
if ((extusage = X509_get_ext_d2i(x, NID_ext_key_usage, NULL, NULL))) {
430+
if ((extusage = X509_get_ext_d2i(x, NID_ext_key_usage, &i, NULL))) {
416431
x->ex_flags |= EXFLAG_XKUSAGE;
417432
for (i = 0; i < sk_ASN1_OBJECT_num(extusage); i++) {
418433
switch (OBJ_obj2nid(sk_ASN1_OBJECT_value(extusage, i))) {
@@ -455,18 +470,26 @@ static void x509v3_cache_extensions(X509 *x)
455470
}
456471
}
457472
sk_ASN1_OBJECT_pop_free(extusage, ASN1_OBJECT_free);
473+
} else if (i != -1) {
474+
x->ex_flags |= EXFLAG_INVALID;
458475
}
459476

460-
if ((ns = X509_get_ext_d2i(x, NID_netscape_cert_type, NULL, NULL))) {
477+
if ((ns = X509_get_ext_d2i(x, NID_netscape_cert_type, &i, NULL))) {
461478
if (ns->length > 0)
462479
x->ex_nscert = ns->data[0];
463480
else
464481
x->ex_nscert = 0;
465482
x->ex_flags |= EXFLAG_NSCERT;
466483
ASN1_BIT_STRING_free(ns);
484+
} else if (i != -1) {
485+
x->ex_flags |= EXFLAG_INVALID;
467486
}
468-
x->skid = X509_get_ext_d2i(x, NID_subject_key_identifier, NULL, NULL);
469-
x->akid = X509_get_ext_d2i(x, NID_authority_key_identifier, NULL, NULL);
487+
x->skid = X509_get_ext_d2i(x, NID_subject_key_identifier, &i, NULL);
488+
if (x->skid == NULL && i != -1)
489+
x->ex_flags |= EXFLAG_INVALID;
490+
x->akid = X509_get_ext_d2i(x, NID_authority_key_identifier, &i, NULL);
491+
if (x->akid == NULL && i != -1)
492+
x->ex_flags |= EXFLAG_INVALID;
470493
/* Does subject name match issuer ? */
471494
if (!X509_NAME_cmp(X509_get_subject_name(x), X509_get_issuer_name(x))) {
472495
x->ex_flags |= EXFLAG_SI;
@@ -475,16 +498,22 @@ static void x509v3_cache_extensions(X509 *x)
475498
!ku_reject(x, KU_KEY_CERT_SIGN))
476499
x->ex_flags |= EXFLAG_SS;
477500
}
478-
x->altname = X509_get_ext_d2i(x, NID_subject_alt_name, NULL, NULL);
501+
x->altname = X509_get_ext_d2i(x, NID_subject_alt_name, &i, NULL);
502+
if (x->altname == NULL && i != -1)
503+
x->ex_flags |= EXFLAG_INVALID;
479504
x->nc = X509_get_ext_d2i(x, NID_name_constraints, &i, NULL);
480-
if (!x->nc && (i != -1))
505+
if (x->nc == NULL && i != -1)
506+
x->ex_flags |= EXFLAG_INVALID;
507+
if (!setup_crldp(x))
481508
x->ex_flags |= EXFLAG_INVALID;
482-
setup_crldp(x);
483509

484510
#ifndef OPENSSL_NO_RFC3779
485-
x->rfc3779_addr = X509_get_ext_d2i(x, NID_sbgp_ipAddrBlock, NULL, NULL);
486-
x->rfc3779_asid = X509_get_ext_d2i(x, NID_sbgp_autonomousSysNum,
487-
NULL, NULL);
511+
x->rfc3779_addr = X509_get_ext_d2i(x, NID_sbgp_ipAddrBlock, &i, NULL);
512+
if (x->rfc3779_addr == NULL && i != -1)
513+
x->ex_flags |= EXFLAG_INVALID;
514+
x->rfc3779_asid = X509_get_ext_d2i(x, NID_sbgp_autonomousSysNum, &i, NULL);
515+
if (x->rfc3779_asid == NULL && i != -1)
516+
x->ex_flags |= EXFLAG_INVALID;
488517
#endif
489518
for (i = 0; i < X509_get_ext_count(x); i++) {
490519
ex = X509_get_ext(x, i);
@@ -777,7 +806,11 @@ int X509_check_issued(X509 *issuer, X509 *subject)
777806
return X509_V_ERR_SUBJECT_ISSUER_MISMATCH;
778807

779808
x509v3_cache_extensions(issuer);
809+
if (issuer->ex_flags & EXFLAG_INVALID)
810+
return X509_V_ERR_UNSPECIFIED;
780811
x509v3_cache_extensions(subject);
812+
if (subject->ex_flags & EXFLAG_INVALID)
813+
return X509_V_ERR_UNSPECIFIED;
781814

782815
if (subject->akid) {
783816
int ret = X509_check_akid(issuer, subject->akid);
@@ -842,7 +875,8 @@ uint32_t X509_get_extension_flags(X509 *x)
842875
uint32_t X509_get_key_usage(X509 *x)
843876
{
844877
/* Call for side-effect of computing hash and caching extensions */
845-
X509_check_purpose(x, -1, -1);
878+
if (X509_check_purpose(x, -1, -1) != 1)
879+
return 0;
846880
if (x->ex_flags & EXFLAG_KUSAGE)
847881
return x->ex_kusage;
848882
return UINT32_MAX;
@@ -851,7 +885,8 @@ uint32_t X509_get_key_usage(X509 *x)
851885
uint32_t X509_get_extended_key_usage(X509 *x)
852886
{
853887
/* Call for side-effect of computing hash and caching extensions */
854-
X509_check_purpose(x, -1, -1);
888+
if (X509_check_purpose(x, -1, -1) != 1)
889+
return 0;
855890
if (x->ex_flags & EXFLAG_XKUSAGE)
856891
return x->ex_xkusage;
857892
return UINT32_MAX;
@@ -860,28 +895,32 @@ uint32_t X509_get_extended_key_usage(X509 *x)
860895
const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x)
861896
{
862897
/* Call for side-effect of computing hash and caching extensions */
863-
X509_check_purpose(x, -1, -1);
898+
if (X509_check_purpose(x, -1, -1) != 1)
899+
return NULL;
864900
return x->skid;
865901
}
866902

867903
const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x)
868904
{
869905
/* Call for side-effect of computing hash and caching extensions */
870-
X509_check_purpose(x, -1, -1);
906+
if (X509_check_purpose(x, -1, -1) != 1)
907+
return NULL;
871908
return (x->akid != NULL ? x->akid->keyid : NULL);
872909
}
873910

874911
const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x)
875912
{
876913
/* Call for side-effect of computing hash and caching extensions */
877-
X509_check_purpose(x, -1, -1);
914+
if (X509_check_purpose(x, -1, -1) != 1)
915+
return NULL;
878916
return (x->akid != NULL ? x->akid->issuer : NULL);
879917
}
880918

881919
const ASN1_INTEGER *X509_get0_authority_serial(X509 *x)
882920
{
883921
/* Call for side-effect of computing hash and caching extensions */
884-
X509_check_purpose(x, -1, -1);
922+
if (X509_check_purpose(x, -1, -1) != 1)
923+
return NULL;
885924
return (x->akid != NULL ? x->akid->serial : NULL);
886925
}
887926

‎deps/openssl/openssl/doc/man3/BN_generate_prime.pod

+7-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ Deprecated:
5252

5353
BN_generate_prime_ex() generates a pseudo-random prime number of
5454
at least bit length B<bits>. The returned number is probably prime
55-
with a negligible error.
55+
with a negligible error. If B<add> is B<NULL> the returned prime
56+
number will have exact bit length B<bits> with the top most two
57+
bits set.
5658

5759
If B<ret> is not B<NULL>, it will be used to store the number.
5860

@@ -89,7 +91,9 @@ If B<add> is not B<NULL>, the prime will fulfill the condition p % B<add>
8991
generator.
9092

9193
If B<safe> is true, it will be a safe prime (i.e. a prime p so
92-
that (p-1)/2 is also prime).
94+
that (p-1)/2 is also prime). If B<safe> is true, and B<rem> == B<NULL>
95+
the condition will be p % B<add> == 3.
96+
It is recommended that B<add> is a multiple of 4.
9397

9498
The random generator must be seeded prior to calling BN_generate_prime_ex().
9599
If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to
@@ -206,7 +210,7 @@ and BN_GENCB_get_arg() functions were added in OpenSSL 1.1.0.
206210

207211
=head1 COPYRIGHT
208212

209-
Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
213+
Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
210214

211215
Licensed under the OpenSSL license (the "License"). You may not use
212216
this file except in compliance with the License. You can obtain a copy

‎deps/openssl/openssl/doc/man3/SSL_get_error.pod

+13-1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,18 @@ connection and SSL_shutdown() must not be called.
155155

156156
=back
157157

158+
=head1 BUGS
159+
160+
The B<SSL_ERROR_SYSCALL> with B<errno> value of 0 indicates unexpected EOF from
161+
the peer. This will be properly reported as B<SSL_ERROR_SSL> with reason
162+
code B<SSL_R_UNEXPECTED_EOF_WHILE_READING> in the OpenSSL 3.0 release because
163+
it is truly a TLS protocol error to terminate the connection without
164+
a SSL_shutdown().
165+
166+
The issue is kept unfixed in OpenSSL 1.1.1 releases because many applications
167+
which choose to ignore this protocol error depend on the existing way of
168+
reporting the error.
169+
158170
=head1 SEE ALSO
159171

160172
L<ssl(7)>
@@ -166,7 +178,7 @@ The SSL_ERROR_WANT_CLIENT_HELLO_CB error code was added in OpenSSL 1.1.1.
166178

167179
=head1 COPYRIGHT
168180

169-
Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
181+
Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
170182

171183
Licensed under the OpenSSL license (the "License"). You may not use
172184
this file except in compliance with the License. You can obtain a copy

‎deps/openssl/openssl/doc/man3/X509_get_extension_flags.pod

+12-1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,17 @@ The certificate contains an unhandled critical extension.
8080

8181
Some certificate extension values are invalid or inconsistent. The
8282
certificate should be rejected.
83+
This bit may also be raised after an out-of-memory error while
84+
processing the X509 object, so it may not be related to the processed
85+
ASN1 object itself.
86+
87+
=item B<EXFLAG_INVALID_POLICY>
88+
89+
The NID_certificate_policies certificate extension is invalid or
90+
inconsistent. The certificate should be rejected.
91+
This bit may also be raised after an out-of-memory error while
92+
processing the X509 object, so it may not be related to the processed
93+
ASN1 object itself.
8394

8495
=item B<EXFLAG_KUSAGE>
8596

@@ -183,7 +194,7 @@ X509_get_proxy_pathlen() were added in OpenSSL 1.1.0.
183194

184195
=head1 COPYRIGHT
185196

186-
Copyright 2015-2019 The OpenSSL Project Authors. All Rights Reserved.
197+
Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
187198

188199
Licensed under the OpenSSL license (the "License"). You may not use
189200
this file except in compliance with the License. You can obtain a copy

‎deps/openssl/openssl/include/crypto/bn_conf.h

-1
This file was deleted.

‎deps/openssl/openssl/include/crypto/dso_conf.h

-1
This file was deleted.

‎deps/openssl/openssl/include/openssl/opensslconf.h

-1
This file was deleted.

‎deps/openssl/openssl/include/openssl/opensslv.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 1999-2020 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
@@ -39,8 +39,8 @@ extern "C" {
3939
* (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
4040
* major minor fix final patch/beta)
4141
*/
42-
# define OPENSSL_VERSION_NUMBER 0x1010105fL
43-
# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1e 17 Mar 2020"
42+
# define OPENSSL_VERSION_NUMBER 0x1010106fL
43+
# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1f 31 Mar 2020"
4444

4545
/*-
4646
* The macros below are to be used for shared library (.so, .dll, ...)

‎deps/openssl/openssl/include/openssl/sslerr.h

-1
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,6 @@ int ERR_load_SSL_strings(void);
734734
# define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES 243
735735
# define SSL_R_UNEXPECTED_CCS_MESSAGE 262
736736
# define SSL_R_UNEXPECTED_END_OF_EARLY_DATA 178
737-
# define SSL_R_UNEXPECTED_EOF_WHILE_READING 294
738737
# define SSL_R_UNEXPECTED_MESSAGE 244
739738
# define SSL_R_UNEXPECTED_RECORD 245
740739
# define SSL_R_UNINITIALIZED 276

‎deps/openssl/openssl/ssl/record/rec_layer_s3.c

-6
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,6 @@ int ssl3_read_n(SSL *s, size_t n, size_t max, int extend, int clearold,
296296
ret = BIO_read(s->rbio, pkt + len + left, max - left);
297297
if (ret >= 0)
298298
bioread = ret;
299-
if (ret <= 0
300-
&& !BIO_should_retry(s->rbio)
301-
&& BIO_eof(s->rbio)) {
302-
SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_SSL3_READ_N,
303-
SSL_R_UNEXPECTED_EOF_WHILE_READING);
304-
}
305299
} else {
306300
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_READ_N,
307301
SSL_R_READ_BIO_NOT_SET);

‎deps/openssl/openssl/ssl/ssl_err.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Generated by util/mkerr.pl DO NOT EDIT
3-
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
3+
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
44
*
55
* Licensed under the OpenSSL license (the "License"). You may not use
66
* this file except in compliance with the License. You can obtain a copy
@@ -1205,8 +1205,6 @@ static const ERR_STRING_DATA SSL_str_reasons[] = {
12051205
"unexpected ccs message"},
12061206
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNEXPECTED_END_OF_EARLY_DATA),
12071207
"unexpected end of early data"},
1208-
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNEXPECTED_EOF_WHILE_READING),
1209-
"unexpected eof while reading"},
12101208
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNEXPECTED_MESSAGE), "unexpected message"},
12111209
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNEXPECTED_RECORD), "unexpected record"},
12121210
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNINITIALIZED), "uninitialized"},

0 commit comments

Comments
 (0)
Please sign in to comment.