Skip to content

Commit 7f9a5ed

Browse files
committedMay 11, 2022
deps: upgrade openssl sources to 1.1.1o
This updates all sources in deps/openssl/openssl by: $ cd deps/openssl/ $ rm -rf openssl $ tar zxf ~/tmp/openssl-1.1.1o.tar.gz $ mv openssl-1.1.1o openssl $ git add --all openssl $ git commit openssl PR-URL: #42956 Refs: https://mta.openssl.org/pipermail/openssl-announce/2022-May/000223.html Reviewed-By: Beth Griggs <bgriggs@redhat.com>
1 parent 20c299b commit 7f9a5ed

38 files changed

+685
-115
lines changed
 

‎deps/openssl/openssl/CHANGES

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

10+
Changes between 1.1.1n and 1.1.1o [3 May 2022]
11+
12+
*) Fixed a bug in the c_rehash script which was not properly sanitising shell
13+
metacharacters to prevent command injection. This script is distributed by
14+
some operating systems in a manner where it is automatically executed. On
15+
such operating systems, an attacker could execute arbitrary commands with the
16+
privileges of the script.
17+
18+
Use of the c_rehash script is considered obsolete and should be replaced
19+
by the OpenSSL rehash command line tool.
20+
(CVE-2022-1292)
21+
[Tomáš Mráz]
22+
1023
Changes between 1.1.1m and 1.1.1n [15 Mar 2022]
1124

1225
*) Fixed a bug in the BN_mod_sqrt() function that can cause it to loop forever

‎deps/openssl/openssl/NEWS

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@
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.1n and OpenSSL 1.1.1o [3 May 2022]
9+
10+
o Fixed a bug in the c_rehash script which was not properly sanitising
11+
shell metacharacters to prevent command injection (CVE-2022-1292)
12+
813
Major changes between OpenSSL 1.1.1m and OpenSSL 1.1.1n [15 Mar 2022]
914

1015
o Fixed a bug in the BN_mod_sqrt() function that can cause it to loop
11-
forever for non-prime moduli ([CVE-2022-0778])
16+
forever for non-prime moduli (CVE-2022-0778)
1217

1318
Major changes between OpenSSL 1.1.1l and OpenSSL 1.1.1m [14 Dec 2021]
1419

‎deps/openssl/openssl/README

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

2-
OpenSSL 1.1.1n 15 Mar 2022
2+
OpenSSL 1.1.1o 3 May 2022
33

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

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

+2
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ int password_callback(char *buf, int bufsiz, int verify, PW_CB_DATA *cb_tmp)
307307
if (cb_data != NULL && cb_data->password != NULL
308308
&& *(const char*)cb_data->password != '\0')
309309
pw_min_len = 1;
310+
else if (!verify)
311+
pw_min_len = 0;
310312
prompt = UI_construct_prompt(ui, "pass phrase", prompt_info);
311313
if (!prompt) {
312314
BIO_printf(bio_err, "Out of memory\n");

‎deps/openssl/openssl/apps/x509.c

+3-3
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-2022 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
@@ -590,6 +590,8 @@ int x509_main(int argc, char **argv)
590590
xca = load_cert(CAfile, CAformat, "CA Certificate");
591591
if (xca == NULL)
592592
goto end;
593+
if (!X509_set_issuer_name(x, X509_get_subject_name(xca)))
594+
goto end;
593595
}
594596

595597
out = bio_open_default(outfile, 'w', outformat);
@@ -987,8 +989,6 @@ static int x509_certify(X509_STORE *ctx, const char *CAfile, const EVP_MD *diges
987989
goto end;
988990
}
989991

990-
if (!X509_set_issuer_name(x, X509_get_subject_name(xca)))
991-
goto end;
992992
if (!X509_set_serialNumber(x, bs))
993993
goto end;
994994

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 1995-2022 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
@@ -446,8 +446,10 @@ int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num,
446446
snum->neg = num_neg;
447447
snum->top = div_n;
448448
snum->flags |= BN_FLG_FIXED_TOP;
449-
if (rm != NULL)
450-
bn_rshift_fixed_top(rm, snum, norm_shift);
449+
450+
if (rm != NULL && bn_rshift_fixed_top(rm, snum, norm_shift) == 0)
451+
goto err;
452+
451453
BN_CTX_end(ctx);
452454
return 1;
453455
err:

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

+3-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-2022 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
@@ -188,13 +188,14 @@ int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
188188
return ret;
189189
}
190190

191+
BN_RECP_CTX_init(&recp);
192+
191193
BN_CTX_start(ctx);
192194
aa = BN_CTX_get(ctx);
193195
val[0] = BN_CTX_get(ctx);
194196
if (val[0] == NULL)
195197
goto err;
196198

197-
BN_RECP_CTX_init(&recp);
198199
if (m->neg) {
199200
/* ignore sign of 'm' */
200201
if (!BN_copy(aa, m))

‎deps/openssl/openssl/crypto/ec/curve448/curve448.c

+2-1
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-2022 The OpenSSL Project Authors. All Rights Reserved.
33
* Copyright 2015-2016 Cryptography Research, Inc.
44
*
55
* Licensed under the OpenSSL license (the "License"). You may not use
@@ -577,6 +577,7 @@ static int recode_wnaf(struct smvt_control *control,
577577
int32_t delta = odd & mask;
578578

579579
assert(position >= 0);
580+
assert(pos < 32); /* can't fail since current & 0xFFFF != 0 */
580581
if (odd & (1 << (table_bits + 1)))
581582
delta -= (1 << (table_bits + 1));
582583
current -= delta * (1 << pos);

‎deps/openssl/openssl/crypto/ec/ecp_nistz256.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2020 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 2014-2022 The OpenSSL Project Authors. All Rights Reserved.
33
* Copyright (c) 2014, Intel Corporation. All Rights Reserved.
44
* Copyright (c) 2015, CloudFlare, Inc.
55
*
@@ -973,6 +973,7 @@ __owur static int ecp_nistz256_points_mul(const EC_GROUP *group,
973973
return 0;
974974
}
975975

976+
memset(&p, 0, sizeof(p));
976977
BN_CTX_start(ctx);
977978

978979
if (scalar) {

‎deps/openssl/openssl/crypto/engine/eng_dyn.c

+22-11
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,26 @@ static int int_load(dynamic_data_ctx *ctx)
393393
return 0;
394394
}
395395

396+
/*
397+
* Unfortunately the version checker does not distinguish between
398+
* engines built for openssl 1.1.x and openssl 3.x, but loading
399+
* an engine that is built for openssl 3.x will cause a fatal
400+
* error. Detect such engines, since EVP_PKEY_get_base_id is exported
401+
* as a function in openssl 3.x, while it is named EVP_PKEY_base_id
402+
* in openssl 1.1.x. Therefore we take the presence of that symbol
403+
* as an indication that the engine will be incompatible.
404+
*/
405+
static int using_libcrypto_3(dynamic_data_ctx *ctx)
406+
{
407+
int ret;
408+
409+
ERR_set_mark();
410+
ret = DSO_bind_func(ctx->dynamic_dso, "EVP_PKEY_get_base_id") != NULL;
411+
ERR_pop_to_mark();
412+
413+
return ret;
414+
}
415+
396416
static int dynamic_load(ENGINE *e, dynamic_data_ctx *ctx)
397417
{
398418
ENGINE cpy;
@@ -442,18 +462,9 @@ static int dynamic_load(ENGINE *e, dynamic_data_ctx *ctx)
442462
/*
443463
* We fail if the version checker veto'd the load *or* if it is
444464
* deferring to us (by returning its version) and we think it is too
445-
* old.
446-
* Unfortunately the version checker does not distinguish between
447-
* engines built for openssl 1.1.x and openssl 3.x, but loading
448-
* an engine that is built for openssl 3.x will cause a fatal
449-
* error. Detect such engines, since EVP_PKEY_get_base_id is exported
450-
* as a function in openssl 3.x, while it is named EVP_PKEY_base_id
451-
* in openssl 1.1.x. Therefore we take the presence of that symbol
452-
* as an indication that the engine will be incompatible.
465+
* old. Also fail if this is engine for openssl 3.x.
453466
*/
454-
if (vcheck_res < OSSL_DYNAMIC_OLDEST
455-
|| DSO_bind_func(ctx->dynamic_dso,
456-
"EVP_PKEY_get_base_id") != NULL) {
467+
if (vcheck_res < OSSL_DYNAMIC_OLDEST || using_libcrypto_3(ctx)) {
457468
/* Fail */
458469
ctx->bind_engine = NULL;
459470
ctx->v_check = NULL;

‎deps/openssl/openssl/crypto/err/err.c

+38-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 1995-2022 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
@@ -23,7 +23,9 @@
2323
#include "internal/constant_time.h"
2424
#include "e_os.h"
2525

26+
#ifndef OPENSSL_NO_ERR
2627
static int err_load_strings(const ERR_STRING_DATA *str);
28+
#endif
2729

2830
static void ERR_STATE_free(ERR_STATE *s);
2931
#ifndef OPENSSL_NO_ERR
@@ -76,9 +78,9 @@ static ERR_STRING_DATA ERR_str_functs[] = {
7678
{ERR_PACK(0, SYS_F_BIND, 0), "bind"},
7779
{ERR_PACK(0, SYS_F_LISTEN, 0), "listen"},
7880
{ERR_PACK(0, SYS_F_ACCEPT, 0), "accept"},
79-
# ifdef OPENSSL_SYS_WINDOWS
81+
#ifdef OPENSSL_SYS_WINDOWS
8082
{ERR_PACK(0, SYS_F_WSASTARTUP, 0), "WSAstartup"},
81-
# endif
83+
#endif
8284
{ERR_PACK(0, SYS_F_OPENDIR, 0), "opendir"},
8385
{ERR_PACK(0, SYS_F_FREAD, 0), "fread"},
8486
{ERR_PACK(0, SYS_F_GETADDRINFO, 0), "getaddrinfo"},
@@ -141,21 +143,26 @@ static int set_err_thread_local;
141143
static CRYPTO_THREAD_LOCAL err_thread_local;
142144

143145
static CRYPTO_ONCE err_string_init = CRYPTO_ONCE_STATIC_INIT;
144-
static CRYPTO_RWLOCK *err_string_lock;
146+
static CRYPTO_RWLOCK *err_string_lock = NULL;
145147

148+
#ifndef OPENSSL_NO_ERR
146149
static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *);
150+
#endif
147151

148152
/*
149153
* The internal state
150154
*/
151155

156+
#ifndef OPENSSL_NO_ERR
152157
static LHASH_OF(ERR_STRING_DATA) *int_error_hash = NULL;
158+
#endif
153159
static int int_err_library_number = ERR_LIB_USER;
154160

155161
static unsigned long get_error_values(int inc, int top, const char **file,
156162
int *line, const char **data,
157163
int *flags);
158164

165+
#ifndef OPENSSL_NO_ERR
159166
static unsigned long err_string_data_hash(const ERR_STRING_DATA *a)
160167
{
161168
unsigned long ret, l;
@@ -184,7 +191,6 @@ static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *d)
184191
return p;
185192
}
186193

187-
#ifndef OPENSSL_NO_ERR
188194
/* 2019-05-21: Russian and Ukrainian locales on Linux require more than 6,5 kB */
189195
# define SPACE_SYS_STR_REASONS 8 * 1024
190196
# define NUM_SYS_STR_REASONS 127
@@ -299,13 +305,15 @@ DEFINE_RUN_ONCE_STATIC(do_err_strings_init)
299305
err_string_lock = CRYPTO_THREAD_lock_new();
300306
if (err_string_lock == NULL)
301307
return 0;
308+
#ifndef OPENSSL_NO_ERR
302309
int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash,
303310
err_string_data_cmp);
304311
if (int_error_hash == NULL) {
305312
CRYPTO_THREAD_lock_free(err_string_lock);
306313
err_string_lock = NULL;
307314
return 0;
308315
}
316+
#endif
309317
return 1;
310318
}
311319

@@ -315,10 +323,13 @@ void err_cleanup(void)
315323
CRYPTO_THREAD_cleanup_local(&err_thread_local);
316324
CRYPTO_THREAD_lock_free(err_string_lock);
317325
err_string_lock = NULL;
326+
#ifndef OPENSSL_NO_ERR
318327
lh_ERR_STRING_DATA_free(int_error_hash);
319328
int_error_hash = NULL;
329+
#endif
320330
}
321331

332+
#ifndef OPENSSL_NO_ERR
322333
/*
323334
* Legacy; pack in the library.
324335
*/
@@ -342,6 +353,7 @@ static int err_load_strings(const ERR_STRING_DATA *str)
342353
CRYPTO_THREAD_unlock(err_string_lock);
343354
return 1;
344355
}
356+
#endif
345357

346358
int ERR_load_ERR_strings(void)
347359
{
@@ -360,24 +372,31 @@ int ERR_load_ERR_strings(void)
360372

361373
int ERR_load_strings(int lib, ERR_STRING_DATA *str)
362374
{
375+
#ifndef OPENSSL_NO_ERR
363376
if (ERR_load_ERR_strings() == 0)
364377
return 0;
365378

366379
err_patch(lib, str);
367380
err_load_strings(str);
381+
#endif
382+
368383
return 1;
369384
}
370385

371386
int ERR_load_strings_const(const ERR_STRING_DATA *str)
372387
{
388+
#ifndef OPENSSL_NO_ERR
373389
if (ERR_load_ERR_strings() == 0)
374390
return 0;
375391
err_load_strings(str);
392+
#endif
393+
376394
return 1;
377395
}
378396

379397
int ERR_unload_strings(int lib, ERR_STRING_DATA *str)
380398
{
399+
#ifndef OPENSSL_NO_ERR
381400
if (!RUN_ONCE(&err_string_init, do_err_strings_init))
382401
return 0;
383402

@@ -389,14 +408,14 @@ int ERR_unload_strings(int lib, ERR_STRING_DATA *str)
389408
for (; str->error; str++)
390409
(void)lh_ERR_STRING_DATA_delete(int_error_hash, str);
391410
CRYPTO_THREAD_unlock(err_string_lock);
411+
#endif
392412

393413
return 1;
394414
}
395415

396416
void err_free_strings_int(void)
397417
{
398-
if (!RUN_ONCE(&err_string_init, do_err_strings_init))
399-
return;
418+
/* obsolete */
400419
}
401420

402421
/********************************************************/
@@ -636,6 +655,7 @@ char *ERR_error_string(unsigned long e, char *ret)
636655

637656
const char *ERR_lib_error_string(unsigned long e)
638657
{
658+
#ifndef OPENSSL_NO_ERR
639659
ERR_STRING_DATA d, *p;
640660
unsigned long l;
641661

@@ -647,10 +667,14 @@ const char *ERR_lib_error_string(unsigned long e)
647667
d.error = ERR_PACK(l, 0, 0);
648668
p = int_err_get_item(&d);
649669
return ((p == NULL) ? NULL : p->string);
670+
#else
671+
return NULL;
672+
#endif
650673
}
651674

652675
const char *ERR_func_error_string(unsigned long e)
653676
{
677+
#ifndef OPENSSL_NO_ERR
654678
ERR_STRING_DATA d, *p;
655679
unsigned long l, f;
656680

@@ -663,10 +687,14 @@ const char *ERR_func_error_string(unsigned long e)
663687
d.error = ERR_PACK(l, f, 0);
664688
p = int_err_get_item(&d);
665689
return ((p == NULL) ? NULL : p->string);
690+
#else
691+
return NULL;
692+
#endif
666693
}
667694

668695
const char *ERR_reason_error_string(unsigned long e)
669696
{
697+
#ifndef OPENSSL_NO_ERR
670698
ERR_STRING_DATA d, *p = NULL;
671699
unsigned long l, r;
672700

@@ -683,6 +711,9 @@ const char *ERR_reason_error_string(unsigned long e)
683711
p = int_err_get_item(&d);
684712
}
685713
return ((p == NULL) ? NULL : p->string);
714+
#else
715+
return NULL;
716+
#endif
686717
}
687718

688719
void err_delete_thread_state(void)

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

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 1995-2022 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
@@ -281,7 +281,7 @@ int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
281281
# define PTRDIFF_T size_t
282282
#endif
283283

284-
int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
284+
int is_partially_overlapping(const void *ptr1, const void *ptr2, size_t len)
285285
{
286286
PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;
287287
/*
@@ -299,7 +299,8 @@ static int evp_EncryptDecryptUpdate(EVP_CIPHER_CTX *ctx,
299299
unsigned char *out, int *outl,
300300
const unsigned char *in, int inl)
301301
{
302-
int i, j, bl, cmpl = inl;
302+
int i, j, bl;
303+
size_t cmpl = (size_t)inl;
303304

304305
if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS))
305306
cmpl = (cmpl + 7) / 8;
@@ -464,8 +465,9 @@ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
464465
int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
465466
const unsigned char *in, int inl)
466467
{
467-
int fix_len, cmpl = inl;
468+
int fix_len;
468469
unsigned int b;
470+
size_t cmpl = (size_t)inl;
469471

470472
/* Prevent accidental use of encryption context when decrypting */
471473
if (ctx->encrypt) {

‎deps/openssl/openssl/crypto/evp/evp_local.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 2000-2022 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
@@ -65,4 +65,4 @@ struct evp_Encode_Ctx_st {
6565
typedef struct evp_pbe_st EVP_PBE_CTL;
6666
DEFINE_STACK_OF(EVP_PBE_CTL)
6767

68-
int is_partially_overlapping(const void *ptr1, const void *ptr2, int len);
68+
int is_partially_overlapping(const void *ptr1, const void *ptr2, size_t len);

‎deps/openssl/openssl/crypto/init.c

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 2016-2022 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
@@ -211,7 +211,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_nodelete)
211211
}
212212

213213
static CRYPTO_ONCE load_crypto_strings = CRYPTO_ONCE_STATIC_INIT;
214-
static int load_crypto_strings_inited = 0;
214+
215215
DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_strings)
216216
{
217217
int ret = 1;
@@ -225,7 +225,6 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_strings)
225225
"err_load_crypto_strings_int()\n");
226226
# endif
227227
ret = err_load_crypto_strings_int();
228-
load_crypto_strings_inited = 1;
229228
#endif
230229
return ret;
231230
}
@@ -549,14 +548,6 @@ void OPENSSL_cleanup(void)
549548
async_deinit();
550549
}
551550

552-
if (load_crypto_strings_inited) {
553-
#ifdef OPENSSL_INIT_DEBUG
554-
fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: "
555-
"err_free_strings_int()\n");
556-
#endif
557-
err_free_strings_int();
558-
}
559-
560551
key = destructor_key.value;
561552
destructor_key.sane = -1;
562553
CRYPTO_THREAD_cleanup_local(&key);

‎deps/openssl/openssl/crypto/s390x_arch.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 2017-2022 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
@@ -47,6 +47,9 @@ struct OPENSSL_s390xcap_st {
4747
unsigned long long kma[2];
4848
};
4949

50+
#if defined(__GNUC__) && defined(__linux)
51+
__attribute__ ((visibility("hidden")))
52+
#endif
5053
extern struct OPENSSL_s390xcap_st OPENSSL_s390xcap_P;
5154

5255
/* convert facility bit number or function code to bit mask */

‎deps/openssl/openssl/crypto/s390xcap.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2019 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 2010-2022 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
@@ -26,6 +26,9 @@ void OPENSSL_vx_probe(void);
2626

2727
struct OPENSSL_s390xcap_st OPENSSL_s390xcap_P;
2828

29+
#if defined(__GNUC__) && defined(__linux)
30+
__attribute__ ((visibility("hidden")))
31+
#endif
2932
void OPENSSL_cpuid_setup(void)
3033
{
3134
sigset_t oset;

‎deps/openssl/openssl/doc/fingerprints.txt

+10
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,13 @@ pub 2048R/0E604491 2013-04-30
2222
Key fingerprint = 8657 ABB2 60F0 56B1 E519 0839 D9C4 D26D 0E60 4491
2323
uid Matt Caswell <matt@openssl.org>
2424
uid Matt Caswell <frodo@baggins.org>
25+
26+
pub rsa4096 2021-02-14
27+
B7C1 C143 60F3 53A3 6862 E4D5 231C 84CD DCC6 9C45
28+
uid Paul Dale <pauli@openssl.org>
29+
30+
pub rsa4096 2021-07-16
31+
A21F AB74 B008 8AA3 6115 2586 B8EF 1A6B A9DA 2D5C
32+
uid Tomáš Mráz <tm@t8m.info>
33+
uid Tomáš Mráz <tomas@arleto.cz>
34+
uid Tomáš Mráz <tomas@openssl.org>

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

+11-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ basis, see L<SSL_get_default_timeout(3)>.
4242
All currently supported protocols have the same default timeout value
4343
of 300 seconds.
4444

45+
This timeout value is used as the ticket lifetime hint for stateless session
46+
tickets. It is also used as the timeout value within the ticket itself.
47+
48+
For TLSv1.3, RFC8446 limits transmission of this value to 1 week (604800
49+
seconds).
50+
51+
For TLSv1.2, tickets generated during an initial handshake use the value
52+
as specified. Tickets generated during a resumed handshake have a value
53+
of 0 for the ticket lifetime hint.
54+
4555
=head1 RETURN VALUES
4656

4757
SSL_CTX_set_timeout() returns the previously set timeout value.
@@ -58,7 +68,7 @@ L<SSL_get_default_timeout(3)>
5868

5969
=head1 COPYRIGHT
6070

61-
Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
71+
Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.
6272

6373
Licensed under the OpenSSL license (the "License"). You may not use
6474
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-2021 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 1999-2022 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 0x101010efL
43-
# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1n 15 Mar 2022"
42+
# define OPENSSL_VERSION_NUMBER 0x101010ffL
43+
# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1o 3 May 2022"
4444

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

‎deps/openssl/openssl/ssl/s3_enc.c

+3-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-2022 The OpenSSL Project Authors. All Rights Reserved.
33
* Copyright 2005 Nokia. All rights reserved.
44
*
55
* Licensed under the OpenSSL license (the "License"). You may not use
@@ -589,6 +589,8 @@ int ssl3_alert_code(int code)
589589
return TLS1_AD_NO_APPLICATION_PROTOCOL;
590590
case SSL_AD_CERTIFICATE_REQUIRED:
591591
return SSL_AD_HANDSHAKE_FAILURE;
592+
case SSL_AD_MISSING_EXTENSION:
593+
return SSL_AD_HANDSHAKE_FAILURE;
592594
default:
593595
return -1;
594596
}

‎deps/openssl/openssl/ssl/ssl_init.c

+2-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 2016-2022 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
@@ -116,7 +116,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_ssl_base)
116116
}
117117

118118
static CRYPTO_ONCE ssl_strings = CRYPTO_ONCE_STATIC_INIT;
119-
static int ssl_strings_inited = 0;
119+
120120
DEFINE_RUN_ONCE_STATIC(ossl_init_load_ssl_strings)
121121
{
122122
/*
@@ -129,7 +129,6 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_load_ssl_strings)
129129
"ERR_load_SSL_strings()\n");
130130
# endif
131131
ERR_load_SSL_strings();
132-
ssl_strings_inited = 1;
133132
#endif
134133
return 1;
135134
}
@@ -157,20 +156,6 @@ static void ssl_library_stop(void)
157156
ssl_comp_free_compression_methods_int();
158157
#endif
159158
}
160-
161-
if (ssl_strings_inited) {
162-
#ifdef OPENSSL_INIT_DEBUG
163-
fprintf(stderr, "OPENSSL_INIT: ssl_library_stop: "
164-
"err_free_strings_int()\n");
165-
#endif
166-
/*
167-
* If both crypto and ssl error strings are inited we will end up
168-
* calling err_free_strings_int() twice - but that's ok. The second
169-
* time will be a no-op. It's easier to do that than to try and track
170-
* between the two libraries whether they have both been inited.
171-
*/
172-
err_free_strings_int();
173-
}
174159
}
175160

176161
/*

‎deps/openssl/openssl/ssl/ssl_lib.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 1995-2022 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
*
@@ -2084,6 +2084,7 @@ int SSL_shutdown(SSL *s)
20842084
if ((s->mode & SSL_MODE_ASYNC) && ASYNC_get_current_job() == NULL) {
20852085
struct ssl_async_args args;
20862086

2087+
memset(&args, 0, sizeof(args));
20872088
args.s = s;
20882089
args.type = OTHERFUNC;
20892090
args.f.func_other = s->method->ssl_shutdown;
@@ -3709,6 +3710,7 @@ int SSL_do_handshake(SSL *s)
37093710
if ((s->mode & SSL_MODE_ASYNC) && ASYNC_get_current_job() == NULL) {
37103711
struct ssl_async_args args;
37113712

3713+
memset(&args, 0, sizeof(args));
37123714
args.s = s;
37133715

37143716
ret = ssl_start_async_job(s, &args, ssl_do_handshake_intern);

‎deps/openssl/openssl/ssl/ssl_txt.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-2022 The OpenSSL Project Authors. All Rights Reserved.
33
* Copyright 2005 Nokia. All rights reserved.
44
*
55
* Licensed under the OpenSSL license (the "License"). You may not use
@@ -130,11 +130,11 @@ int SSL_SESSION_print(BIO *bp, const SSL_SESSION *x)
130130
}
131131
#endif
132132
if (x->time != 0L) {
133-
if (BIO_printf(bp, "\n Start Time: %ld", x->time) <= 0)
133+
if (BIO_printf(bp, "\n Start Time: %lld", (long long)x->time) <= 0)
134134
goto err;
135135
}
136136
if (x->timeout != 0L) {
137-
if (BIO_printf(bp, "\n Timeout : %ld (sec)", x->timeout) <= 0)
137+
if (BIO_printf(bp, "\n Timeout : %lld (sec)", (long long)x->timeout) <= 0)
138138
goto err;
139139
}
140140
if (BIO_puts(bp, "\n") <= 0)

‎deps/openssl/openssl/ssl/statem/statem_clnt.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 1995-2022 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
*
@@ -1422,6 +1422,11 @@ MSG_PROCESS_RETURN tls_process_server_hello(SSL *s, PACKET *pkt)
14221422
&& sversion == TLS1_2_VERSION
14231423
&& PACKET_remaining(pkt) >= SSL3_RANDOM_SIZE
14241424
&& memcmp(hrrrandom, PACKET_data(pkt), SSL3_RANDOM_SIZE) == 0) {
1425+
if (s->hello_retry_request != SSL_HRR_NONE) {
1426+
SSLfatal(s, SSL_AD_UNEXPECTED_MESSAGE,
1427+
SSL_F_TLS_PROCESS_SERVER_HELLO, SSL_R_UNEXPECTED_MESSAGE);
1428+
goto err;
1429+
}
14251430
s->hello_retry_request = SSL_HRR_PENDING;
14261431
hrr = 1;
14271432
if (!PACKET_forward(pkt, SSL3_RANDOM_SIZE)) {

‎deps/openssl/openssl/ssl/statem/statem_dtls.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2005-2018 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 2005-2022 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
@@ -218,8 +218,8 @@ int dtls1_do_write(SSL *s, int type)
218218
else
219219
len = s->init_num;
220220

221-
if (len > s->max_send_fragment)
222-
len = s->max_send_fragment;
221+
if (len > ssl_get_max_send_fragment(s))
222+
len = ssl_get_max_send_fragment(s);
223223

224224
/*
225225
* XDTLS: this function is too long. split out the CCS part
@@ -241,7 +241,7 @@ int dtls1_do_write(SSL *s, int type)
241241

242242
ret = dtls1_write_bytes(s, type, &s->init_buf->data[s->init_off], len,
243243
&written);
244-
if (ret < 0) {
244+
if (ret <= 0) {
245245
/*
246246
* might need to update MTU here, but we don't know which
247247
* previous packet caused the failure -- so can't really

‎deps/openssl/openssl/ssl/statem/statem_srvr.c

+16-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 1995-2022 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
*
@@ -3820,15 +3820,24 @@ int tls_construct_server_certificate(SSL *s, WPACKET *pkt)
38203820
static int create_ticket_prequel(SSL *s, WPACKET *pkt, uint32_t age_add,
38213821
unsigned char *tick_nonce)
38223822
{
3823+
uint32_t timeout = (uint32_t)s->session->timeout;
3824+
38233825
/*
3824-
* Ticket lifetime hint: For TLSv1.2 this is advisory only and we leave this
3825-
* unspecified for resumed session (for simplicity).
3826+
* Ticket lifetime hint:
38263827
* In TLSv1.3 we reset the "time" field above, and always specify the
3827-
* timeout.
3828+
* timeout, limited to a 1 week period per RFC8446.
3829+
* For TLSv1.2 this is advisory only and we leave this unspecified for
3830+
* resumed session (for simplicity).
38283831
*/
3829-
if (!WPACKET_put_bytes_u32(pkt,
3830-
(s->hit && !SSL_IS_TLS13(s))
3831-
? 0 : s->session->timeout)) {
3832+
#define ONE_WEEK_SEC (7 * 24 * 60 * 60)
3833+
3834+
if (SSL_IS_TLS13(s)) {
3835+
if (s->session->timeout > ONE_WEEK_SEC)
3836+
timeout = ONE_WEEK_SEC;
3837+
} else if (s->hit)
3838+
timeout = 0;
3839+
3840+
if (!WPACKET_put_bytes_u32(pkt, timeout)) {
38323841
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_CREATE_TICKET_PREQUEL,
38333842
ERR_R_INTERNAL_ERROR);
38343843
return 0;

‎deps/openssl/openssl/ssl/t1_enc.c

+3-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-2022 The OpenSSL Project Authors. All Rights Reserved.
33
* Copyright 2005 Nokia. All rights reserved.
44
*
55
* Licensed under the OpenSSL license (the "License"). You may not use
@@ -672,6 +672,8 @@ int tls1_alert_code(int code)
672672
return TLS1_AD_NO_APPLICATION_PROTOCOL;
673673
case SSL_AD_CERTIFICATE_REQUIRED:
674674
return SSL_AD_HANDSHAKE_FAILURE;
675+
case SSL_AD_MISSING_EXTENSION:
676+
return SSL_AD_HANDSHAKE_FAILURE;
675677
default:
676678
return -1;
677679
}

‎deps/openssl/openssl/test/dtls_mtu_test.c

+48-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 2016-2022 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
@@ -185,12 +185,58 @@ static int run_mtu_tests(void)
185185

186186
end:
187187
SSL_CTX_free(ctx);
188-
bio_s_mempacket_test_free();
189188
return ret;
190189
}
191190

191+
static int test_server_mtu_larger_than_max_fragment_length(void)
192+
{
193+
SSL_CTX *ctx = NULL;
194+
SSL *srvr_ssl = NULL, *clnt_ssl = NULL;
195+
int rv = 0;
196+
197+
if (!TEST_ptr(ctx = SSL_CTX_new(DTLS_method())))
198+
goto end;
199+
200+
SSL_CTX_set_psk_server_callback(ctx, srvr_psk_callback);
201+
SSL_CTX_set_psk_client_callback(ctx, clnt_psk_callback);
202+
203+
#ifndef OPENSSL_NO_DH
204+
if (!TEST_true(SSL_CTX_set_dh_auto(ctx, 1)))
205+
goto end;
206+
#endif
207+
208+
if (!TEST_true(create_ssl_objects(ctx, ctx, &srvr_ssl, &clnt_ssl,
209+
NULL, NULL)))
210+
goto end;
211+
212+
SSL_set_options(srvr_ssl, SSL_OP_NO_QUERY_MTU);
213+
if (!TEST_true(DTLS_set_link_mtu(srvr_ssl, 1500)))
214+
goto end;
215+
216+
SSL_set_tlsext_max_fragment_length(clnt_ssl,
217+
TLSEXT_max_fragment_length_512);
218+
219+
if (!TEST_true(create_ssl_connection(srvr_ssl, clnt_ssl,
220+
SSL_ERROR_NONE)))
221+
goto end;
222+
223+
rv = 1;
224+
225+
end:
226+
SSL_free(clnt_ssl);
227+
SSL_free(srvr_ssl);
228+
SSL_CTX_free(ctx);
229+
return rv;
230+
}
231+
192232
int setup_tests(void)
193233
{
194234
ADD_TEST(run_mtu_tests);
235+
ADD_TEST(test_server_mtu_larger_than_max_fragment_length);
195236
return 1;
196237
}
238+
239+
void cleanup_tests(void)
240+
{
241+
bio_s_mempacket_test_free();
242+
}

‎deps/openssl/openssl/test/recipes/70-test_tls13hrr.t

+50-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /usr/bin/env perl
2-
# Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
2+
# Copyright 2017-2022 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
@@ -37,7 +37,8 @@ my $proxy = TLSProxy::Proxy->new(
3737

3838
use constant {
3939
CHANGE_HRR_CIPHERSUITE => 0,
40-
CHANGE_CH1_CIPHERSUITE => 1
40+
CHANGE_CH1_CIPHERSUITE => 1,
41+
DUPLICATE_HRR => 2
4142
};
4243

4344
#Test 1: A client should fail if the server changes the ciphersuite between the
@@ -46,7 +47,7 @@ $proxy->filter(\&hrr_filter);
4647
$proxy->serverflags("-curves P-256");
4748
my $testtype = CHANGE_HRR_CIPHERSUITE;
4849
$proxy->start() or plan skip_all => "Unable to start up Proxy for tests";
49-
plan tests => 2;
50+
plan tests => 3;
5051
ok(TLSProxy::Message->fail(), "Server ciphersuite changes");
5152

5253
#Test 2: It is an error if the client changes the offered ciphersuites so that
@@ -58,6 +59,19 @@ $testtype = CHANGE_CH1_CIPHERSUITE;
5859
$proxy->start();
5960
ok(TLSProxy::Message->fail(), "Client ciphersuite changes");
6061

62+
#Test 3: A client should fail with unexpected_message alert if the server
63+
# sends more than 1 HRR
64+
my $fatal_alert = 0;
65+
$proxy->clear();
66+
if (disabled("ec")) {
67+
$proxy->serverflags("-curves ffdhe3072");
68+
} else {
69+
$proxy->serverflags("-curves P-256");
70+
}
71+
$testtype = DUPLICATE_HRR;
72+
$proxy->start();
73+
ok($fatal_alert, "Server duplicated HRR");
74+
6175
sub hrr_filter
6276
{
6377
my $proxy = shift;
@@ -78,6 +92,39 @@ sub hrr_filter
7892
return;
7993
}
8094

95+
if ($testtype == DUPLICATE_HRR) {
96+
# We're only interested in the HRR
97+
# and the unexpected_message alert from client
98+
if ($proxy->flight == 4) {
99+
$fatal_alert = 1
100+
if @{$proxy->record_list}[-1]->is_fatal_alert(0) == 10;
101+
return;
102+
}
103+
if ($proxy->flight != 3) {
104+
return;
105+
}
106+
107+
# Find ServerHello record (HRR actually) and insert after that
108+
my $i;
109+
for ($i = 0; ${$proxy->record_list}[$i]->flight() < 1; $i++) {
110+
next;
111+
}
112+
my $hrr_record = ${$proxy->record_list}[$i];
113+
my $dup_hrr = TLSProxy::Record->new(3,
114+
$hrr_record->content_type(),
115+
$hrr_record->version(),
116+
$hrr_record->len(),
117+
$hrr_record->sslv2(),
118+
$hrr_record->len_real(),
119+
$hrr_record->decrypt_len(),
120+
$hrr_record->data(),
121+
$hrr_record->decrypt_data());
122+
123+
$i++;
124+
splice @{$proxy->record_list}, $i, 0, $dup_hrr;
125+
return;
126+
}
127+
81128
# CHANGE_CH1_CIPHERSUITE
82129
if ($proxy->flight != 0) {
83130
return;

‎deps/openssl/openssl/test/recipes/95-test_external_pyca_data/cryptography.sh

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
#
3-
# Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
3+
# Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
44
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
55
#
66
# Licensed under the OpenSSL license (the "License"). You may not use
@@ -12,6 +12,7 @@
1212
# OpenSSL external testing using the Python Cryptography module
1313
#
1414
set -e
15+
set -x
1516

1617
O_EXE=`pwd`/$BLDTOP/apps
1718
O_BINC=`pwd`/$BLDTOP/include
@@ -35,30 +36,29 @@ echo "------------------------------------------------------------------"
3536
cd $SRCTOP
3637

3738
# Create a python virtual env and activate
38-
rm -rf venv-pycrypto
39-
virtualenv venv-pycrypto
40-
. ./venv-pycrypto/bin/activate
39+
rm -rf venv-cryptography
40+
python -m venv venv-cryptography
41+
. ./venv-cryptography/bin/activate
4142

4243
cd pyca-cryptography
4344

4445
pip install .[test]
46+
pip install -e vectors
4547

4648
echo "------------------------------------------------------------------"
4749
echo "Building cryptography"
4850
echo "------------------------------------------------------------------"
49-
python ./setup.py clean
50-
51-
CFLAGS="-I$O_BINC -I$O_SINC -L$O_LIB" python ./setup.py build
51+
CFLAGS="-I$O_BINC -I$O_SINC -L$O_LIB" pip install .
5252

5353
echo "------------------------------------------------------------------"
5454
echo "Running tests"
5555
echo "------------------------------------------------------------------"
5656

57-
CFLAGS="-I$O_BINC -I$O_SINC -L$O_LIB" python ./setup.py test
57+
CFLAGS="-I$O_BINC -I$O_SINC -L$O_LIB" pytest -n auto tests --wycheproof-root=../wycheproof
5858

5959
cd ../
6060
deactivate
61-
rm -rf venv-pycrypto
61+
rm -rf venv-cryptography
6262

6363
exit 0
6464

‎deps/openssl/openssl/test/ssl-tests/10-resumption.conf

+120-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Generated with generate_ssl_tests.pl
22

3-
num_tests = 65
3+
num_tests = 68
44

55
test-0 = 0-resumption
66
test-1 = 1-resumption
@@ -67,6 +67,9 @@ test-61 = 61-resumption
6767
test-62 = 62-resumption
6868
test-63 = 63-resumption
6969
test-64 = 64-resumption-with-hrr
70+
test-65 = 65-resumption-when-mfl-ext-is-missing
71+
test-66 = 66-resumption-when-mfl-ext-is-different
72+
test-67 = 67-resumption-when-mfl-ext-is-correct
7073
# ===========================================================
7174

7275
[0-resumption]
@@ -2437,3 +2440,119 @@ Method = TLS
24372440
ResumptionExpected = Yes
24382441

24392442

2443+
# ===========================================================
2444+
2445+
[65-resumption-when-mfl-ext-is-missing]
2446+
ssl_conf = 65-resumption-when-mfl-ext-is-missing-ssl
2447+
2448+
[65-resumption-when-mfl-ext-is-missing-ssl]
2449+
server = 65-resumption-when-mfl-ext-is-missing-server
2450+
client = 65-resumption-when-mfl-ext-is-missing-client
2451+
resume-server = 65-resumption-when-mfl-ext-is-missing-server
2452+
resume-client = 65-resumption-when-mfl-ext-is-missing-resume-client
2453+
2454+
[65-resumption-when-mfl-ext-is-missing-server]
2455+
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
2456+
CipherString = DEFAULT
2457+
PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
2458+
2459+
[65-resumption-when-mfl-ext-is-missing-client]
2460+
CipherString = DEFAULT
2461+
VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
2462+
VerifyMode = Peer
2463+
2464+
[65-resumption-when-mfl-ext-is-missing-resume-client]
2465+
CipherString = DEFAULT
2466+
VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
2467+
VerifyMode = Peer
2468+
2469+
[test-65]
2470+
ExpectedResult = ServerFail
2471+
HandshakeMode = Resume
2472+
ResumptionExpected = No
2473+
client = 65-resumption-when-mfl-ext-is-missing-client-extra
2474+
2475+
[65-resumption-when-mfl-ext-is-missing-client-extra]
2476+
MaxFragmentLenExt = 512
2477+
2478+
2479+
# ===========================================================
2480+
2481+
[66-resumption-when-mfl-ext-is-different]
2482+
ssl_conf = 66-resumption-when-mfl-ext-is-different-ssl
2483+
2484+
[66-resumption-when-mfl-ext-is-different-ssl]
2485+
server = 66-resumption-when-mfl-ext-is-different-server
2486+
client = 66-resumption-when-mfl-ext-is-different-client
2487+
resume-server = 66-resumption-when-mfl-ext-is-different-server
2488+
resume-client = 66-resumption-when-mfl-ext-is-different-resume-client
2489+
2490+
[66-resumption-when-mfl-ext-is-different-server]
2491+
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
2492+
CipherString = DEFAULT
2493+
PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
2494+
2495+
[66-resumption-when-mfl-ext-is-different-client]
2496+
CipherString = DEFAULT
2497+
VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
2498+
VerifyMode = Peer
2499+
2500+
[66-resumption-when-mfl-ext-is-different-resume-client]
2501+
CipherString = DEFAULT
2502+
VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
2503+
VerifyMode = Peer
2504+
2505+
[test-66]
2506+
ExpectedResult = ServerFail
2507+
HandshakeMode = Resume
2508+
ResumptionExpected = No
2509+
client = 66-resumption-when-mfl-ext-is-different-client-extra
2510+
resume-client = 66-resumption-when-mfl-ext-is-different-resume-client-extra
2511+
2512+
[66-resumption-when-mfl-ext-is-different-client-extra]
2513+
MaxFragmentLenExt = 512
2514+
2515+
[66-resumption-when-mfl-ext-is-different-resume-client-extra]
2516+
MaxFragmentLenExt = 1024
2517+
2518+
2519+
# ===========================================================
2520+
2521+
[67-resumption-when-mfl-ext-is-correct]
2522+
ssl_conf = 67-resumption-when-mfl-ext-is-correct-ssl
2523+
2524+
[67-resumption-when-mfl-ext-is-correct-ssl]
2525+
server = 67-resumption-when-mfl-ext-is-correct-server
2526+
client = 67-resumption-when-mfl-ext-is-correct-client
2527+
resume-server = 67-resumption-when-mfl-ext-is-correct-server
2528+
resume-client = 67-resumption-when-mfl-ext-is-correct-resume-client
2529+
2530+
[67-resumption-when-mfl-ext-is-correct-server]
2531+
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
2532+
CipherString = DEFAULT
2533+
PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
2534+
2535+
[67-resumption-when-mfl-ext-is-correct-client]
2536+
CipherString = DEFAULT
2537+
VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
2538+
VerifyMode = Peer
2539+
2540+
[67-resumption-when-mfl-ext-is-correct-resume-client]
2541+
CipherString = DEFAULT
2542+
VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
2543+
VerifyMode = Peer
2544+
2545+
[test-67]
2546+
ExpectedResult = Success
2547+
HandshakeMode = Resume
2548+
ResumptionExpected = Yes
2549+
client = 67-resumption-when-mfl-ext-is-correct-client-extra
2550+
resume-client = 67-resumption-when-mfl-ext-is-correct-resume-client-extra
2551+
2552+
[67-resumption-when-mfl-ext-is-correct-client-extra]
2553+
MaxFragmentLenExt = 512
2554+
2555+
[67-resumption-when-mfl-ext-is-correct-resume-client-extra]
2556+
MaxFragmentLenExt = 512
2557+
2558+

‎deps/openssl/openssl/test/ssl-tests/11-dtls_resumption.conf

+123-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Generated with generate_ssl_tests.pl
22

3-
num_tests = 16
3+
num_tests = 19
44

55
test-0 = 0-resumption
66
test-1 = 1-resumption
@@ -18,6 +18,9 @@ test-12 = 12-resumption
1818
test-13 = 13-resumption
1919
test-14 = 14-resumption
2020
test-15 = 15-resumption
21+
test-16 = 16-resumption-when-mfl-ext-is-missing
22+
test-17 = 17-resumption-when-mfl-ext-is-different
23+
test-18 = 18-resumption-when-mfl-ext-is-correct
2124
# ===========================================================
2225

2326
[0-resumption]
@@ -618,3 +621,122 @@ Method = DTLS
618621
ResumptionExpected = Yes
619622

620623

624+
# ===========================================================
625+
626+
[16-resumption-when-mfl-ext-is-missing]
627+
ssl_conf = 16-resumption-when-mfl-ext-is-missing-ssl
628+
629+
[16-resumption-when-mfl-ext-is-missing-ssl]
630+
server = 16-resumption-when-mfl-ext-is-missing-server
631+
client = 16-resumption-when-mfl-ext-is-missing-client
632+
resume-server = 16-resumption-when-mfl-ext-is-missing-server
633+
resume-client = 16-resumption-when-mfl-ext-is-missing-resume-client
634+
635+
[16-resumption-when-mfl-ext-is-missing-server]
636+
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
637+
CipherString = DEFAULT
638+
PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
639+
640+
[16-resumption-when-mfl-ext-is-missing-client]
641+
CipherString = DEFAULT
642+
VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
643+
VerifyMode = Peer
644+
645+
[16-resumption-when-mfl-ext-is-missing-resume-client]
646+
CipherString = DEFAULT
647+
VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
648+
VerifyMode = Peer
649+
650+
[test-16]
651+
ExpectedResult = ServerFail
652+
HandshakeMode = Resume
653+
Method = DTLS
654+
ResumptionExpected = No
655+
client = 16-resumption-when-mfl-ext-is-missing-client-extra
656+
657+
[16-resumption-when-mfl-ext-is-missing-client-extra]
658+
MaxFragmentLenExt = 512
659+
660+
661+
# ===========================================================
662+
663+
[17-resumption-when-mfl-ext-is-different]
664+
ssl_conf = 17-resumption-when-mfl-ext-is-different-ssl
665+
666+
[17-resumption-when-mfl-ext-is-different-ssl]
667+
server = 17-resumption-when-mfl-ext-is-different-server
668+
client = 17-resumption-when-mfl-ext-is-different-client
669+
resume-server = 17-resumption-when-mfl-ext-is-different-server
670+
resume-client = 17-resumption-when-mfl-ext-is-different-resume-client
671+
672+
[17-resumption-when-mfl-ext-is-different-server]
673+
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
674+
CipherString = DEFAULT
675+
PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
676+
677+
[17-resumption-when-mfl-ext-is-different-client]
678+
CipherString = DEFAULT
679+
VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
680+
VerifyMode = Peer
681+
682+
[17-resumption-when-mfl-ext-is-different-resume-client]
683+
CipherString = DEFAULT
684+
VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
685+
VerifyMode = Peer
686+
687+
[test-17]
688+
ExpectedResult = ServerFail
689+
HandshakeMode = Resume
690+
Method = DTLS
691+
ResumptionExpected = No
692+
client = 17-resumption-when-mfl-ext-is-different-client-extra
693+
resume-client = 17-resumption-when-mfl-ext-is-different-resume-client-extra
694+
695+
[17-resumption-when-mfl-ext-is-different-client-extra]
696+
MaxFragmentLenExt = 512
697+
698+
[17-resumption-when-mfl-ext-is-different-resume-client-extra]
699+
MaxFragmentLenExt = 1024
700+
701+
702+
# ===========================================================
703+
704+
[18-resumption-when-mfl-ext-is-correct]
705+
ssl_conf = 18-resumption-when-mfl-ext-is-correct-ssl
706+
707+
[18-resumption-when-mfl-ext-is-correct-ssl]
708+
server = 18-resumption-when-mfl-ext-is-correct-server
709+
client = 18-resumption-when-mfl-ext-is-correct-client
710+
resume-server = 18-resumption-when-mfl-ext-is-correct-server
711+
resume-client = 18-resumption-when-mfl-ext-is-correct-resume-client
712+
713+
[18-resumption-when-mfl-ext-is-correct-server]
714+
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
715+
CipherString = DEFAULT
716+
PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
717+
718+
[18-resumption-when-mfl-ext-is-correct-client]
719+
CipherString = DEFAULT
720+
VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
721+
VerifyMode = Peer
722+
723+
[18-resumption-when-mfl-ext-is-correct-resume-client]
724+
CipherString = DEFAULT
725+
VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
726+
VerifyMode = Peer
727+
728+
[test-18]
729+
ExpectedResult = Success
730+
HandshakeMode = Resume
731+
Method = DTLS
732+
ResumptionExpected = Yes
733+
client = 18-resumption-when-mfl-ext-is-correct-client-extra
734+
resume-client = 18-resumption-when-mfl-ext-is-correct-resume-client-extra
735+
736+
[18-resumption-when-mfl-ext-is-correct-client-extra]
737+
MaxFragmentLenExt = 512
738+
739+
[18-resumption-when-mfl-ext-is-correct-resume-client-extra]
740+
MaxFragmentLenExt = 512
741+
742+

‎deps/openssl/openssl/test/ssl-tests/protocol_version.pm

+64-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- mode: perl; -*-
2-
# Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
2+
# Copyright 2016-2022 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
@@ -265,6 +265,69 @@ sub generate_resumption_tests {
265265
};
266266
}
267267

268+
push @client_tests, {
269+
"name" => "resumption-when-mfl-ext-is-missing",
270+
"server" => {
271+
},
272+
"client" => {
273+
"extra" => {
274+
"MaxFragmentLenExt" => 512,
275+
},
276+
},
277+
"resume_client" => {
278+
},
279+
"test" => {
280+
"Method" => $method,
281+
"HandshakeMode" => "Resume",
282+
"ResumptionExpected" => "No",
283+
"ExpectedResult" => "ServerFail",
284+
}
285+
};
286+
287+
push @client_tests, {
288+
"name" => "resumption-when-mfl-ext-is-different",
289+
"server" => {
290+
},
291+
"client" => {
292+
"extra" => {
293+
"MaxFragmentLenExt" => 512,
294+
},
295+
},
296+
"resume_client" => {
297+
"extra" => {
298+
"MaxFragmentLenExt" => 1024,
299+
},
300+
},
301+
"test" => {
302+
"Method" => $method,
303+
"HandshakeMode" => "Resume",
304+
"ResumptionExpected" => "No",
305+
"ExpectedResult" => "ServerFail",
306+
}
307+
};
308+
309+
push @client_tests, {
310+
"name" => "resumption-when-mfl-ext-is-correct",
311+
"server" => {
312+
},
313+
"client" => {
314+
"extra" => {
315+
"MaxFragmentLenExt" => 512,
316+
},
317+
},
318+
"resume_client" => {
319+
"extra" => {
320+
"MaxFragmentLenExt" => 512,
321+
},
322+
},
323+
"test" => {
324+
"Method" => $method,
325+
"HandshakeMode" => "Resume",
326+
"ResumptionExpected" => "Yes",
327+
"ExpectedResult" => "Success",
328+
}
329+
};
330+
268331
return (@server_tests, @client_tests);
269332
}
270333

‎deps/openssl/openssl/test/sslapitest.c

+65-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
2+
* Copyright 2016-2022 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
@@ -6734,6 +6734,69 @@ static int test_sni_tls13(void)
67346734
SSL_CTX_free(cctx);
67356735
return testresult;
67366736
}
6737+
6738+
/*
6739+
* Test that the lifetime hint of a TLSv1.3 ticket is no more than 1 week
6740+
* 0 = TLSv1.2
6741+
* 1 = TLSv1.3
6742+
*/
6743+
static int test_ticket_lifetime(int idx)
6744+
{
6745+
SSL_CTX *cctx = NULL, *sctx = NULL;
6746+
SSL *clientssl = NULL, *serverssl = NULL;
6747+
int testresult = 0;
6748+
int version = TLS1_3_VERSION;
6749+
6750+
#define ONE_WEEK_SEC (7 * 24 * 60 * 60)
6751+
#define TWO_WEEK_SEC (2 * ONE_WEEK_SEC)
6752+
6753+
if (idx == 0) {
6754+
#ifdef OPENSSL_NO_TLS1_2
6755+
TEST_info("Skipping: TLS 1.2 is disabled.");
6756+
return 1;
6757+
#else
6758+
version = TLS1_2_VERSION;
6759+
#endif
6760+
}
6761+
6762+
if (!TEST_true(create_ssl_ctx_pair(TLS_server_method(),
6763+
TLS_client_method(), version, version,
6764+
&sctx, &cctx, cert, privkey)))
6765+
goto end;
6766+
6767+
if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl,
6768+
&clientssl, NULL, NULL)))
6769+
goto end;
6770+
6771+
/*
6772+
* Set the timeout to be more than 1 week
6773+
* make sure the returned value is the default
6774+
*/
6775+
if (!TEST_long_eq(SSL_CTX_set_timeout(sctx, TWO_WEEK_SEC),
6776+
SSL_get_default_timeout(serverssl)))
6777+
goto end;
6778+
6779+
if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)))
6780+
goto end;
6781+
6782+
if (idx == 0) {
6783+
/* TLSv1.2 uses the set value */
6784+
if (!TEST_ulong_eq(SSL_SESSION_get_ticket_lifetime_hint(SSL_get_session(clientssl)), TWO_WEEK_SEC))
6785+
goto end;
6786+
} else {
6787+
/* TLSv1.3 uses the limited value */
6788+
if (!TEST_ulong_le(SSL_SESSION_get_ticket_lifetime_hint(SSL_get_session(clientssl)), ONE_WEEK_SEC))
6789+
goto end;
6790+
}
6791+
testresult = 1;
6792+
6793+
end:
6794+
SSL_free(serverssl);
6795+
SSL_free(clientssl);
6796+
SSL_CTX_free(sctx);
6797+
SSL_CTX_free(cctx);
6798+
return testresult;
6799+
}
67376800
#endif
67386801
/*
67396802
* Test that setting an ALPN does not violate RFC
@@ -6973,6 +7036,7 @@ int setup_tests(void)
69737036
#endif
69747037
#ifndef OPENSSL_NO_TLS1_3
69757038
ADD_TEST(test_sni_tls13);
7039+
ADD_ALL_TESTS(test_ticket_lifetime, 2);
69767040
#endif
69777041
ADD_TEST(test_set_alpn);
69787042
ADD_TEST(test_inherit_verify_param);

‎deps/openssl/openssl/tools/c_rehash.in

+26-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!{- $config{HASHBANGPERL} -}
22

33
# {- join("\n# ", @autowarntext) -}
4-
# Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved.
4+
# Copyright 1999-2022 The OpenSSL Project Authors. All Rights Reserved.
55
#
66
# Licensed under the OpenSSL license (the "License"). You may not use
77
# this file except in compliance with the License. You can obtain a copy
@@ -152,6 +152,23 @@ sub check_file {
152152
return ($is_cert, $is_crl);
153153
}
154154

155+
sub compute_hash {
156+
my $fh;
157+
if ( $^O eq "VMS" ) {
158+
# VMS uses the open through shell
159+
# The file names are safe there and list form is unsupported
160+
if (!open($fh, "-|", join(' ', @_))) {
161+
print STDERR "Cannot compute hash on '$fname'\n";
162+
return;
163+
}
164+
} else {
165+
if (!open($fh, "-|", @_)) {
166+
print STDERR "Cannot compute hash on '$fname'\n";
167+
return;
168+
}
169+
}
170+
return (<$fh>, <$fh>);
171+
}
155172

156173
# Link a certificate to its subject name hash value, each hash is of
157174
# the form <hash>.<n> where n is an integer. If the hash value already exists
@@ -161,10 +178,12 @@ sub check_file {
161178

162179
sub link_hash_cert {
163180
my $fname = $_[0];
164-
$fname =~ s/\"/\\\"/g;
165-
my ($hash, $fprint) = `"$openssl" x509 $x509hash -fingerprint -noout -in "$fname"`;
181+
my ($hash, $fprint) = compute_hash($openssl, "x509", $x509hash,
182+
"-fingerprint", "-noout",
183+
"-in", $fname);
166184
chomp $hash;
167185
chomp $fprint;
186+
return if !$hash;
168187
$fprint =~ s/^.*=//;
169188
$fprint =~ tr/://d;
170189
my $suffix = 0;
@@ -202,10 +221,12 @@ sub link_hash_cert {
202221

203222
sub link_hash_crl {
204223
my $fname = $_[0];
205-
$fname =~ s/'/'\\''/g;
206-
my ($hash, $fprint) = `"$openssl" crl $crlhash -fingerprint -noout -in '$fname'`;
224+
my ($hash, $fprint) = compute_hash($openssl, "crl", $crlhash,
225+
"-fingerprint", "-noout",
226+
"-in", $fname);
207227
chomp $hash;
208228
chomp $fprint;
229+
return if !$hash;
209230
$fprint =~ s/^.*=//;
210231
$fprint =~ tr/://d;
211232
my $suffix = 0;

0 commit comments

Comments
 (0)
Please sign in to comment.