openssl.git
3 months agoPrepare for release of 3.2.1 openssl-3.2.1
Matt Caswell [Tue, 30 Jan 2024 13:14:56 +0000 (13:14 +0000)]
Prepare for release of 3.2.1

Reviewed-by: Richard Levitte <levitte@openssl.org>
Release: yes

3 months agomake update
Matt Caswell [Tue, 30 Jan 2024 13:14:55 +0000 (13:14 +0000)]
make update

Reviewed-by: Richard Levitte <levitte@openssl.org>
Release: yes

3 months agoCopyright year updates
Matt Caswell [Tue, 30 Jan 2024 13:13:27 +0000 (13:13 +0000)]
Copyright year updates

Reviewed-by: Richard Levitte <levitte@openssl.org>
Release: yes

3 months agoUpdate CHANGES.md and NEWS.md for new release
Matt Caswell [Mon, 29 Jan 2024 16:19:24 +0000 (16:19 +0000)]
Update CHANGES.md and NEWS.md for new release

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Release: yes
(Merged from https://github.com/openssl/openssl/pull/23422)

3 months agoHave OSSL_PARAM_allocate_from_text() fail on odd number of hex digits
Richard Levitte [Tue, 23 Jan 2024 12:17:31 +0000 (13:17 +0100)]
Have OSSL_PARAM_allocate_from_text() fail on odd number of hex digits

The failure would be caught later on, so this went unnoticed, until someone
tried with just one hex digit, which was simply ignored.

Fixes #23373

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23374)

(cherry picked from commit ea6268cfceaba24328d66bd14bfc97c4fac14a58)

3 months agoAdd some tests for various PKCS12 files with NULL ContentInfo
Matt Caswell [Fri, 19 Jan 2024 14:32:18 +0000 (14:32 +0000)]
Add some tests for various PKCS12 files with NULL ContentInfo

PKCS7 ContentInfo fields held within a PKCS12 file can be NULL, even if the
type has been set to a valid value. CVE-2024-0727 is a result of OpenSSL
attempting to dereference the NULL pointer as a result of this.

We add test for various instances of this problem.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23361)

(cherry picked from commit 8a85df7c60ba1372ee98acc5982e902d75f52130)

3 months agoAdd NULL checks where ContentInfo data can be NULL
Matt Caswell [Fri, 19 Jan 2024 11:28:58 +0000 (11:28 +0000)]
Add NULL checks where ContentInfo data can be NULL

PKCS12 structures contain PKCS7 ContentInfo fields. These fields are
optional and can be NULL even if the "type" is a valid value. OpenSSL
was not properly accounting for this and a NULL dereference can occur
causing a crash.

CVE-2024-0727

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23361)

(cherry picked from commit 041962b429ebe748c8b6b7922980dfb6decfef26)

4 months agoFix a possible memory leak in req_main
Bernd Edlinger [Mon, 22 Jan 2024 15:02:59 +0000 (16:02 +0100)]
Fix a possible memory leak in req_main

if the private key is output to stdout using the HARNESS_OSSL_PREFIX,
out is a stack of BIOs and must therefore free'd using BIO_free_all.

Steps to reproduce:

$ HARNESS_OSSL_PREFIX=x OPENSSL_CONF=apps/openssl.cnf util/shlib_wrap.sh apps/openssl req -new -keyout - -passout pass: </dev/null
[...]
Direct leak of 128 byte(s) in 1 object(s) allocated from:
    #0 0x7f6f692b89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x7f6f686eda00 in CRYPTO_malloc crypto/mem.c:202
    #2 0x7f6f686edba0 in CRYPTO_zalloc crypto/mem.c:222
    #3 0x7f6f68471bdf in BIO_new_ex crypto/bio/bio_lib.c:83
    #4 0x7f6f68491a8f in BIO_new_fp crypto/bio/bss_file.c:95
    #5 0x555c5f58b378 in dup_bio_out apps/lib/apps.c:3014
    #6 0x555c5f58f9ac in bio_open_default_ apps/lib/apps.c:3175
    #7 0x555c5f58f9ac in bio_open_default apps/lib/apps.c:3203
    #8 0x555c5f528537 in req_main apps/req.c:683
    #9 0x555c5f50e315 in do_cmd apps/openssl.c:426
    #10 0x555c5f4c5575 in main apps/openssl.c:307
    #11 0x7f6f680461c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

SUMMARY: AddressSanitizer: 128 byte(s) leaked in 1 allocation(s).

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23365)

(cherry picked from commit ff78d94b131d7bb3b761509d3ce0dd864b1420e3)

4 months agoci.yml: Replace actions-rs/toolchain@v1 with dtolnay/rust-toolchain
Tomas Mraz [Mon, 8 Jan 2024 13:13:49 +0000 (14:13 +0100)]
ci.yml: Replace actions-rs/toolchain@v1 with dtolnay/rust-toolchain

actions-rs/toolchain is unmaintained and generates warnings

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23232)

(cherry picked from commit cd5911a6b300453eefb4b6d9d797c9d1cdefb956)

4 months agotlsfuzzer.sh: Use python3
Tomas Mraz [Fri, 19 Jan 2024 09:59:03 +0000 (10:59 +0100)]
tlsfuzzer.sh: Use python3

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/23342)

(cherry picked from commit 15f479e25f9591a2749fabb436dcdfb9304c5c7b)

4 months agotlsfuzzer.sh: Make it more informative on errors
Tomas Mraz [Thu, 18 Jan 2024 15:32:33 +0000 (16:32 +0100)]
tlsfuzzer.sh: Make it more informative on errors

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/23342)

(cherry picked from commit 825b7cb16e0624d81421441949e843e9876c81f9)

4 months agotlsfuzzer.sh: Run openssl version on the built app and not system one
Tomas Mraz [Fri, 5 Jan 2024 10:22:28 +0000 (11:22 +0100)]
tlsfuzzer.sh: Run openssl version on the built app and not system one

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/23342)

(cherry picked from commit 150b3b18dfde317621a6bf26acfe0d06193e52fd)

4 months agogost_engine.sh: Set OPENSSL_ENGINES_DIR
Tomas Mraz [Wed, 3 Jan 2024 11:36:10 +0000 (12:36 +0100)]
gost_engine.sh: Set OPENSSL_ENGINES_DIR

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/23342)

(cherry picked from commit 017c7cf2bb5f5461071d9e992eb3206c34a69c2c)

4 months agoUninitialized array variable
shashankmca80 [Sat, 13 Jan 2024 12:46:25 +0000 (18:16 +0530)]
Uninitialized array variable

array"key" is uninitialized and it is being read directly in function SipHash_Init() as per the below statements making a way for the garbage values :
uint64_t k0 = U8TO64_LE(k);
uint64_t k1 = U8TO64_LE(k + 8);

CLA: trivial

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23298)

(cherry picked from commit a0826b184eed2dccc56cdf80e3e0bc061cc89ddc)

4 months agoprevent integer overflow in ossl_asn1_time_from_tm
Paul Dreik [Thu, 7 Dec 2023 15:59:57 +0000 (16:59 +0100)]
prevent integer overflow in ossl_asn1_time_from_tm

this could be triggered by the following code (assuming 64 bit time_t):

time_t t = 67768011791126057ULL;
ASN1_TIME* at = ASN1_TIME_set(NULL, t);

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22976)

(cherry picked from commit 5b2d8bc28a8ff59689da98f31459819db09a9099)

4 months agoadd test for provoking integer overflow in ossl_asn1_time_from_tm
Paul Dreik [Thu, 7 Dec 2023 19:31:50 +0000 (20:31 +0100)]
add test for provoking integer overflow in ossl_asn1_time_from_tm

this needs a sanitized 64 bit time_t build to be detected (or possibly
valgrind, trapv or similar)

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22976)

(cherry picked from commit 017fd465a4f01323465823a3dcf318553365dfdd)

4 months agoDon't apply max_frag_len checking if no Max Fragment Length extension
Matt Caswell [Tue, 2 Jan 2024 16:48:43 +0000 (16:48 +0000)]
Don't apply max_frag_len checking if no Max Fragment Length extension

Don't check the Max Fragment Length if the it hasn't been negotiated. We
were checking it anyway, and using the default value
(SSL3_RT_MAX_PLAIN_LENGTH). This works in most cases but KTLS can cause the
record length to actually exceed this in some cases.

Fixes #23169

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23182)

(cherry picked from commit c1decd62460072082833909a962892e5042b16bb)

4 months agoFix a FreeBSD build failure when KTLS is enabled
Matt Caswell [Tue, 2 Jan 2024 16:37:29 +0000 (16:37 +0000)]
Fix a FreeBSD build failure when KTLS is enabled

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23182)

(cherry picked from commit 2cac2feff2612c0a324675d8151fea3e2d03397c)

4 months agoAdd a KTLS test where we write long app data records
Matt Caswell [Tue, 2 Jan 2024 15:56:43 +0000 (15:56 +0000)]
Add a KTLS test where we write long app data records

Check that we can write and read back long app data records when using
KTLS.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23182)

(cherry picked from commit 563f4be8976ea776ec4fb90d084e2ce80c92f0d1)

4 months agoX509_dup.pod: add caveat that extra data is not copied and hints, e.g., to use X509_u...
Dr. David von Oheimb [Thu, 14 Dec 2023 11:48:33 +0000 (12:48 +0100)]
X509_dup.pod: add caveat that extra data is not copied and hints, e.g., to use X509_up_ref() instead

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23043)

(cherry picked from commit 66adaf2b31bb51e00ffad784f60bdf195e5dd736)

4 months agoDocument SSL_R_UNEXPECTED_EOF_WHILE_READING
Matt Caswell [Mon, 15 Jan 2024 08:55:48 +0000 (08:55 +0000)]
Document SSL_R_UNEXPECTED_EOF_WHILE_READING

Also document that it is ok to use this for control flow decisions.

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23304)

(cherry picked from commit ead44e19fa3ff7d189876081880f1adb3dfdf30b)

4 months agoAdd a deprecation warning for a function in docs
Kevin Jerebica [Tue, 16 Jan 2024 15:30:26 +0000 (16:30 +0100)]
Add a deprecation warning for a function in docs

The function in question is SSL_get_peer_certificate()

CLA: trivial

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23315)

(cherry picked from commit 3e938453be47751d50917e25b8f7334b482844b3)

4 months agoFix performance regression of ChaCha20 on LoongArch64
Lin Runze [Sun, 14 Jan 2024 12:21:49 +0000 (20:21 +0800)]
Fix performance regression of ChaCha20 on LoongArch64

The regression was introduced in PR #22817.

In that pull request, the input length check was moved forward,
but the related ori instruction was missing, and it will cause
input of any length down to the much slower scalar implementation.

Fixes #23300

CLA: trivial

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23301)

(cherry picked from commit 971028535e6531c89449e06b1f6862c18f04ff91)

4 months agohurd: Fix dgram_sendmmsg
Samuel Thibault [Sat, 13 Jan 2024 00:03:56 +0000 (01:03 +0100)]
hurd: Fix dgram_sendmmsg

GNU/Hurd does not have IP_PKTINFO yet, thus SUPPORT_LOCAL_ADDR is undef,
data->local_addr_enabled never set to 1, and thus the M_METHOD_RECVMSG
method would end up raising BIO_R_LOCAL_ADDR_NOT_AVAILABLE immediately.

Fixes #22872

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23293)

(cherry picked from commit 2f85736e9c66248528f132d46508f06a0bb8dd88)

4 months agoCheck whether the pubkey exists in ossl_ecx_key_dup
lan1120 [Wed, 13 Dec 2023 11:02:29 +0000 (19:02 +0800)]
Check whether the pubkey exists in ossl_ecx_key_dup

Signed-off-by: lan1120 <lanming@huawei.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22984)

(cherry picked from commit aac531e5daa2edec5d47e702a7f115cf77fe07f9)

4 months agoError in s_server when -rev option is used with dtls.
Frederik Wedel-Heinen [Fri, 12 Jan 2024 09:14:43 +0000 (10:14 +0100)]
Error in s_server when -rev option is used with dtls.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23278)

(cherry picked from commit 575117efe1e0eb8073c2d26ae3dff8926be00591)

4 months agoAdd CHANGES.md and NEWS.md entries for CVE-2023-6237
Tomas Mraz [Tue, 9 Jan 2024 17:08:22 +0000 (18:08 +0100)]
Add CHANGES.md and NEWS.md entries for CVE-2023-6237

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23243)

(cherry picked from commit 38b2508f638787842750aec9a75745e1d8786743)

4 months agoLimit the execution time of RSA public key check
Tomas Mraz [Fri, 22 Dec 2023 15:25:56 +0000 (16:25 +0100)]
Limit the execution time of RSA public key check

Fixes CVE-2023-6237

If a large and incorrect RSA public key is checked with
EVP_PKEY_public_check() the computation could take very long time
due to no limit being applied to the RSA public key size and
unnecessarily high number of Miller-Rabin algorithm rounds
used for non-primality check of the modulus.

Now the keys larger than 16384 bits (OPENSSL_RSA_MAX_MODULUS_BITS)
will fail the check with RSA_R_MODULUS_TOO_LARGE error reason.
Also the number of Miller-Rabin rounds was set to 5.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23243)

(cherry picked from commit e09fc1d746a4fd15bb5c3d7bbbab950aadd005db)

4 months agoFix arithmetic expression overflow
Drokov Pavel [Fri, 12 Jan 2024 07:10:17 +0000 (02:10 -0500)]
Fix arithmetic expression overflow

If the value of a->length is large (>= 2^12), then an integer overflow will
occur for the signed type, which according to the C standard is UB.

CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23274)

(cherry picked from commit 486ab0fb003d05f89620662260486d31bd3faa8c)

4 months agoFix grammar in documentation
Akshat Maheshwari [Thu, 11 Jan 2024 17:21:59 +0000 (22:51 +0530)]
Fix grammar in documentation

CLA: trivial

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23266)

(cherry picked from commit 441b3b7ba15d5dc6e034b030bd8b88ce596f53ba)

4 months agoCheck ASN1_OBJECT_new result
Drokov Pavel [Thu, 11 Jan 2024 23:51:15 +0000 (18:51 -0500)]
Check ASN1_OBJECT_new result

CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23270)

(cherry picked from commit 6b92a966e0de3ad848fcf11fbcab7ee8cae24ba1)

4 months agoAdd test/recipes/15-test_gensm2.t, to test SM2 key generation results
Richard Levitte [Thu, 4 Jan 2024 11:42:05 +0000 (12:42 +0100)]
Add test/recipes/15-test_gensm2.t, to test SM2 key generation results

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22529)

(cherry picked from commit d4d9b57530b2ecdca6b4263b5841b42c820e5275)

4 months agoFix the encoding of SM2 keys
Richard Levitte [Fri, 27 Oct 2023 07:01:19 +0000 (09:01 +0200)]
Fix the encoding of SM2 keys

OpenSSL's encoding of SM2 keys used the SM2 OID for the algorithm OID
where an AlgorithmIdentifier is encoded (for encoding into the structures
PrivateKeyInfo and SubjectPublicKeyInfo).

Such keys should be encoded as ECC keys.

Fixes #22184

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22529)

(cherry picked from commit 1d490694dfa790d8e47f8f2ea62ea1d9b1251179)

4 months agoFix NULL pointer deref when parsing the stable section
Neil Horman [Thu, 7 Dec 2023 21:56:39 +0000 (16:56 -0500)]
Fix NULL pointer deref when parsing the stable section

When parsing the stable section of a config such as this:
openssl_conf = openssl_init
[openssl_init]
stbl_section = mstbl
[mstbl]
id-tc26 = min

Can lead to a SIGSEGV, as the parsing code doesnt recognize min as a
proper section name without a trailing colon to associate it with a
value.  As a result the stack of configuration values has an entry with
a null value in it, which leads to the SIGSEGV in do_tcreate when we
attempt to pass NULL to strtoul.

Fix it by skipping any entry in the config name/value list that has a
null value, prior to passing it to stroul

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22988)

(cherry picked from commit 0981c20f8efa68bf9d68d7715280f83812c19a7e)

4 months agoAdd tests for re-using cipher contexts
Holger Dengler [Thu, 4 Jan 2024 18:25:08 +0000 (19:25 +0100)]
Add tests for re-using cipher contexts

Add test case for re-using a cipher context with the same key, iv and
cipher. It detects, if the hardware-specific cipher context is reset
correctly, like reported in issue #23175.

This test has encrypt and decrypt iterations for cfb128 and
ofb128. All iteations use the same key, iv and plaintext.

Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23201)

(cherry picked from commit 3cb1b51dddf4deaf5e3886b827f3245d81670bc7)

4 months agoFix partial block encryption in cfb and ofb for s390x (legacy)
Holger Dengler [Fri, 5 Jan 2024 13:16:53 +0000 (14:16 +0100)]
Fix partial block encryption in cfb and ofb for s390x (legacy)

Use the number of processed bytes information (num) from the generic
cipher context for the partial block handling in cfb and ofb also in
s390x-legacy code. For more details see 4df92c1a14 ("Fix partial block
encryption in cfb and ofb for s390x").

Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23201)

(cherry picked from commit f9ccd209c3d121668c51a992613c698f2a774cb3)

4 months agoFix partial block encryption in cfb and ofb for s390x
Holger Dengler [Thu, 4 Jan 2024 08:37:39 +0000 (09:37 +0100)]
Fix partial block encryption in cfb and ofb for s390x

Use the number of processed bytes information (num) from the generic
cipher context for the partial block handling in cfb and ofb, instead
of keep this information in the s390x-specific part of the cipher
context. The information in the generic context is reset properly,
even if the context is re-initialized without resetting the key or iv.

Fixes: #23175
Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23201)

(cherry picked from commit 576a3572bebf6115df1c03527114cbf74d06f861)

4 months agoUpdate Docs for EVP_MAC
Neil Horman [Mon, 8 Jan 2024 19:29:52 +0000 (14:29 -0500)]
Update Docs for EVP_MAC

For GMAC/CMAC, its not possible to re-init the algorithm without
explicitly passing an OSSL_MAC_PARAM_IV to each init call, as it is
not possible to extract the IV value from the prior init call (be it
explicitly passed or auto generated).  As such, document the fact that
re-initalization requires passing an IV parameter

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23235)

(cherry picked from commit 7c1d533a512181b13de3bc0b7fa2fd8c481032d3)

4 months agoDisable build of HWAES on PPC Macs
Tomas Mraz [Wed, 29 Nov 2023 08:17:39 +0000 (09:17 +0100)]
Disable build of HWAES on PPC Macs

Fixes #22818

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22860)

(cherry picked from commit 493ad484e9312b54d177d85e2f4aa0b636e708f0)

4 months agoevp_fetch.c: Check meth_id instead of name_id
sashan [Mon, 8 Jan 2024 21:53:42 +0000 (22:53 +0100)]
evp_fetch.c: Check meth_id instead of name_id

Fixes #23226

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23238)

(cherry picked from commit da840c3775f52fc9766c654b5ad6ee031ffc9fd9)

4 months agodoc: "digest" must be explicitly set with deterministic ECDSA/DSA
James Muir [Wed, 10 Jan 2024 03:38:43 +0000 (22:38 -0500)]
doc: "digest" must be explicitly set with deterministic ECDSA/DSA

Fixes #23205

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23250)

(cherry picked from commit ff7b32e1d7af590eab3163f0c6be7792876c36bc)

4 months agoFix a similar memory leak in SXNET_add_id_INTEGER
Bernd Edlinger [Tue, 9 Jan 2024 14:05:30 +0000 (15:05 +0100)]
Fix a similar memory leak in SXNET_add_id_INTEGER

Even in the good case there was memory leak here.
Add a simple test case to have at least some test coverage.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23234)

(cherry picked from commit 398011848468c7e8e481b295f7904afc30934217)

4 months agoFix a possible memory leak in sxnet_v2i
Bernd Edlinger [Mon, 8 Jan 2024 14:31:32 +0000 (15:31 +0100)]
Fix a possible memory leak in sxnet_v2i

When a subsequent call to SXNET_add_id_asc fails
e.g. because user is a string larger than 64 char
or the zone is a duplicate zone id,
or the zone is not an integer,
a memory leak may be the result.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23234)

(cherry picked from commit 0151e772195fc03cce0f12e5e266e51dc15243a0)

4 months agoCheck appropriate OSSL_PARAM_get_* functions for NULL
Neil Horman [Mon, 18 Dec 2023 15:55:25 +0000 (10:55 -0500)]
Check appropriate OSSL_PARAM_get_* functions for NULL

The base type OSSL_PARAM getters will NULL deref if they are initalized
as null.  Add NULL checks for those parameters that have no expectation
of returning null (int32/64/uint32/64/BN).  Other types can be left as
allowing NULL, as a NULL setting may be meaningful (string, utf8str,
octet string, etc).

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23083)

(cherry picked from commit 806bbafe2df5b699feac6ef26e50c14e701950cf)

4 months agoAdd CHANGES.md and NEWS.md entries for CVE-2023-6129
Tomas Mraz [Thu, 4 Jan 2024 09:32:32 +0000 (10:32 +0100)]
Add CHANGES.md and NEWS.md entries for CVE-2023-6129

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23200)

(cherry picked from commit 858c7bc210a406cc7f891ac2aed78692d2e02937)

4 months agopoly1305-ppc.pl: Fix vector register clobbering
Rohan McLure [Thu, 4 Jan 2024 09:25:50 +0000 (10:25 +0100)]
poly1305-ppc.pl: Fix vector register clobbering

Fixes CVE-2023-6129

The POLY1305 MAC (message authentication code) implementation in OpenSSL for
PowerPC CPUs saves the the contents of vector registers in different order
than they are restored. Thus the contents of some of these vector registers
is corrupted when returning to the caller. The vulnerable code is used only
on newer PowerPC processors supporting the PowerISA 2.07 instructions.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23200)

(cherry picked from commit 8d847a3ffd4f0b17ee33962cf69c36224925b34f)

4 months agoAvoid memory leak if SXNET_add_id_INTEGER() fails
Tomas Mraz [Fri, 5 Jan 2024 10:01:34 +0000 (11:01 +0100)]
Avoid memory leak if SXNET_add_id_INTEGER() fails

Fixes Coverity 1560046

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23211)

(cherry picked from commit 7054fc1ca3945342777f588fba43b77f669509ad)

4 months agoVMS: Add the missing -p32 and -p64 variants for x86_64
Richard Levitte [Wed, 20 Dec 2023 07:25:22 +0000 (08:25 +0100)]
VMS: Add the missing -p32 and -p64 variants for x86_64

The pointer size support is already in the code, and is present for
all other supported hardwares.

Fixes #22899

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/23081)

(cherry picked from commit a43f253d586279b5d96fffcaf1b26c7a2b0dd938)

4 months agoFix VMS installation - update vmsconfig.pm for consistency
Richard Levitte [Mon, 18 Dec 2023 11:49:08 +0000 (12:49 +0100)]
Fix VMS installation - update vmsconfig.pm for consistency

An effort was made to update the VMS installation data to align with
configuration data.  This touched the script templates in VMS/, but
didn't update the generation of vmsconfig.pm to match...  and also
missed a spot.

This change adds the missing updates

Ref:
https://github.com/openssl/openssl/pull/16842

Fixes #22899

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/23081)

(cherry picked from commit 4058e121cbc6818235b0dcb618e636ce3c4d1f2f)

4 months agocleanse stack variable in kdf_pbkdf1_do_derive
Neil Horman [Wed, 3 Jan 2024 18:47:05 +0000 (13:47 -0500)]
cleanse stack variable in kdf_pbkdf1_do_derive

kdf_pbkdf1_do_derive stores key derivation information in a stack
variable, which is left uncleansed prior to returning.  Ensure that the
stack information is zeroed prior to return to avoid potential leaks of
key information

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23194)

(cherry picked from commit 5963aa8c196d7c5a940a979299a07418527932af)

4 months agoValidate config options during x509 extension creation
Neil Horman [Tue, 2 Jan 2024 20:48:00 +0000 (15:48 -0500)]
Validate config options during x509 extension creation

There are several points during x509 extension creation which rely on
configuration options which may have been incorrectly parsed due to
invalid settings.  Preform a value check for null in those locations to
avoid various crashes/undefined behaviors

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23183)

(cherry picked from commit bac7e687d71b124b09ad6ad3e15be9b38c08a1ba)

4 months agofixup! Adding interop tests
Neil Horman [Fri, 15 Dec 2023 19:35:04 +0000 (14:35 -0500)]
fixup! Adding interop tests

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22726)

(cherry picked from commit b062a3c552bf283319dede3437598f1747730053)

4 months agoAdding interop tests
Neil Horman [Tue, 14 Nov 2023 11:01:51 +0000 (06:01 -0500)]
Adding interop tests

Fedora has some fairly nice interoperability tests that we can leverage
to build a PR and test it against gnutls and nss libraries.  This commit
adds the interop-tests.yml ci job to do that work, and run the interop
tests from beaker.

Fixes #20685

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22726)

(cherry picked from commit 83783dd16e767483020e5b2dc3b1c0ac26520917)

4 months agoUpdate workflow to use GITHUB_WORKSPACE
Neil Horman [Tue, 19 Dec 2023 11:15:39 +0000 (06:15 -0500)]
Update workflow to use GITHUB_WORKSPACE

It was pointed out the GITHUB_WORKSPACE points to the container path of
the workspace, so we can use it instead of hardcoding the
__w/openssl/openssl path

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22726)

(cherry picked from commit 638ad52ae53ece2e870984430493e454f75d048a)

4 months agoAdding interop tests
Neil Horman [Tue, 14 Nov 2023 11:01:51 +0000 (06:01 -0500)]
Adding interop tests

Fedora has some fairly nice interoperability tests that we can leverage
to build a PR and test it against gnutls and nss libraries.  This commit
adds the interop-tests.yml ci job to do that work, and run the interop
tests from beaker.

Fixes #20685

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22726)

(cherry picked from commit 337eb99c8474ed380f3aa6fbd6b2a4ab5d39aa26)

4 months agoCorrect ssl_old_test stream handling
Matt Caswell [Wed, 3 Jan 2024 09:43:16 +0000 (09:43 +0000)]
Correct ssl_old_test stream handling

The ssl_old_test has not been fully converted to the test framework but
it still reuses some test framework utilities. Notably it was creating
it's own copy of the global bio_err object directly (which is normally
created and owned by the test framework). This causes a problem because
ever since commit 2fa9044 access to the bio_err object is controlled by
a lock. Since ssl_old_test was circumventing the normal creation and
destruction of bio_err, the lock was not being created resulting in a
crash under certain error conditions.

We fix this by creating and destroying the bio_err object using the
test framework functions designed for that purpose.

Fixes #23184

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23187)

(cherry picked from commit 2995be50e8c2f2ef907866e35347be1e200558a2)

4 months agoClarify the PKCS12 docs
Matt Caswell [Wed, 3 Jan 2024 11:03:03 +0000 (11:03 +0000)]
Clarify the PKCS12 docs

Issue #23151 asks a question about the meaning of the PKCS12
documentation. This PR attempts to clarify how friendlyName and localKeyID
are added to the PKCS12 structure.

Fixes #23151

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/23188)

(cherry picked from commit 3348713ad390372ba5a0a0f98b46b2f637475e47)

4 months agocleanse stack variable in blake2[b|s] finalization
Neil Horman [Mon, 1 Jan 2024 14:25:03 +0000 (09:25 -0500)]
cleanse stack variable in blake2[b|s] finalization

If the output of a blake2[b|s] digest isn't a multipl of 8, then a stack
buffer is used to compute the final output, which is left un-zeroed
prior to return, allowing the potential leak of key data.  Ensure that,
if the stack variable is used, it gets cleared prior to return.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23173)

(cherry picked from commit 8b9cf1bc2c3085b6e9493a057209ffd0bddf48a6)

4 months agovalidate requested key length in kdf_pbkdf1_do_derive
Neil Horman [Mon, 1 Jan 2024 16:53:50 +0000 (11:53 -0500)]
validate requested key length in kdf_pbkdf1_do_derive

When using pbkdf1 key deriviation, it is possible to request a key
length larger than the maximum digest size a given digest can produce,
leading to a read of random stack memory.

fix it by returning an error if the requested key size n is larger than
the EVP_MD_size of the digest

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23174)

(cherry picked from commit 8d89050f0f676b429043fd5445e5a570d54ad225)

4 months agoprovider-keymgmt.pod: fix typo
rilysh [Fri, 29 Dec 2023 07:30:56 +0000 (02:30 -0500)]
provider-keymgmt.pod: fix typo

Fix a typo from asymmmetric to asymmetric

CLA: trivial

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23164)

(cherry picked from commit cf8fea86f73c4606f132133cb34c07f8dad42482)

4 months agoAdd missing documentation for X509_ATTRIBUTE related functions.
slontis [Wed, 8 Nov 2023 06:14:44 +0000 (16:14 +1000)]
Add missing documentation for X509_ATTRIBUTE related functions.

Partial fix for #8026

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22656)

(cherry picked from commit f1f0731ddf6cb31d62a2c0f406b009ae9817ed7f)

4 months agoAllow duplicate CMS attributes
Tomas Mraz [Wed, 13 Dec 2023 11:21:04 +0000 (12:21 +0100)]
Allow duplicate CMS attributes

Fixes regression introduced with https://github.com/openssl/openssl/pull/21505

Fixes #22266

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23029)

(cherry picked from commit d7e707cb4983a35b1a265c6042da410d829f3b19)

4 months agoriscv: Fix mispelling of extension test macro
Grant Nichol [Sat, 23 Dec 2023 05:46:39 +0000 (23:46 -0600)]
riscv: Fix mispelling of extension test macro

When refactoring the riscv extension test macros,
RISCV_HAS_ZKND_AND_ZKNE was mispelled.

CLA: trivial

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23139)

(cherry picked from commit d8fa4cf76308924daaf2335c6c0ff2f7334a5b26)

4 months agogate calling of evp_method_id on having a non-zero name id
Neil Horman [Wed, 20 Dec 2023 15:01:17 +0000 (10:01 -0500)]
gate calling of evp_method_id on having a non-zero name id

If a name is passed to EVP_<OBJ>_fetch of the form:
name1:name2:name3

The names are parsed on the separator ':' and added to the store, but
during the lookup in inner_evp_generic_fetch, the subsequent search of
the store uses the full name1:name2:name3 string, which fails lookup,
and causes subsequent assertion failures in evp_method_id.

instead catch the failure in inner_evp_generic_fetch and return an error
code if the name_id against a colon separated list of names fails.  This
provides a graceful error return path without asserts, and leaves room
for a future feature in which such formatted names can be parsed and
searched for iteratively

Add a simple test to verify that providing a colon separated name
results in an error indicating an invalid lookup.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/23110)

(cherry picked from commit 94be985cbcc1f0a5cf4f172d4a8d06c5c623122b)

4 months agoapps: Don't print hostname on bio_out during connect.
Sebastian Andrzej Siewior [Thu, 14 Dec 2023 19:53:35 +0000 (20:53 +0100)]
apps: Don't print hostname on bio_out during connect.

Printing the hostname on bio_out clutters the output and breaks
pipe like forwarding via openssl.

Print the hostname via bio_err.

Fixes #23013

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23056)

(cherry picked from commit 8a1694f22588c0777d642253ffdc307a61245d51)

4 months agodoc: fix "the a" typos (and other things nearby)
James Muir [Sat, 16 Dec 2023 02:21:46 +0000 (21:21 -0500)]
doc: fix "the a" typos (and other things nearby)

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/23068)

(cherry picked from commit aa3347ba9d670a747b46974ce46f2ed9ecb38662)

4 months agoddd-02-conn-nonblocking-threads.c: Fix the leak of conn
zengwei2000 [Thu, 21 Dec 2023 08:41:57 +0000 (08:41 +0000)]
ddd-02-conn-nonblocking-threads.c: Fix the leak of conn

Signed-off-by: zengwei zengwei1@uniontech.com
CLA: trivial

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23115)

(cherry picked from commit 1635d7a078b21d8fc3078f6115a4d8f7e18ad1ab)

4 months agoAdd missing settable entry OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST_PROPS for RSA asym
slontis [Fri, 17 Feb 2023 00:00:50 +0000 (10:00 +1000)]
Add missing settable entry OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST_PROPS for RSA asym

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20319)

(cherry picked from commit 26183614ed1dc03f509f26839b8a465684ca0f84)

4 months agoLimit RSA-OAEP related functions to RSA keys only
slontis [Thu, 16 Feb 2023 23:54:58 +0000 (09:54 +1000)]
Limit RSA-OAEP related functions to RSA keys only

Make EVP_PKEY_CTX_set_rsa_oaep_md() and
EVP_PKEY_CTX_get_rsa_oaep_md_name() only work for RSA keys.

Since these calls use "digest" as a OSSL_PARAM, they should not
work for other key types.

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20319)

(cherry picked from commit 0c3eb31b55d3c1544e4e044c2e3c939655bac93d)

4 months agoFix memleak in rsa_cms_decrypt
slontis [Thu, 16 Feb 2023 23:51:59 +0000 (09:51 +1000)]
Fix memleak in rsa_cms_decrypt

If a call to EVP_PKEY_CTX_set_rsa_mgf1_md() fails then the caller
needs to free the label.

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20319)

(cherry picked from commit d32dd65053431ee744d213b336b9a03a035807e6)

4 months agoFix error handling in ASN1_mbstring_ncopy
Bernd Edlinger [Fri, 22 Dec 2023 18:28:38 +0000 (19:28 +0100)]
Fix error handling in ASN1_mbstring_ncopy

Sometimes the error handling returns an ASN1_STRING
object in *out although that was not passed in by the
caller, and sometimes the error handling deletes the
ASN1_STRING but forgets to clear the *out parameter.
Therefore the caller has no chance to know, if the leaked
object in *out shall be deleted or not.
This may cause a use-after-free error e.g. in asn1_str2type:

==63312==ERROR: AddressSanitizer: heap-use-after-free on address 0x603000073280 at pc 0x7f2652e93b08 bp 0x7ffe0e1951c0 sp 0x7ffe0e1951b0
READ of size 8 at 0x603000073280 thread T0
    #0 0x7f2652e93b07 in asn1_string_embed_free crypto/asn1/asn1_lib.c:354
    #1 0x7f2652eb521a in asn1_primitive_free crypto/asn1/tasn_fre.c:204
    #2 0x7f2652eb50a9 in asn1_primitive_free crypto/asn1/tasn_fre.c:199
    #3 0x7f2652eb5b67 in ASN1_item_free crypto/asn1/tasn_fre.c:20
    #4 0x7f2652e8e13b in asn1_str2type crypto/asn1/asn1_gen.c:740
    #5 0x7f2652e8e13b in generate_v3 crypto/asn1/asn1_gen.c:137
    #6 0x7f2652e9166c in ASN1_generate_v3 crypto/asn1/asn1_gen.c:92
    #7 0x7f2653307b9b in do_othername crypto/x509v3/v3_alt.c:577
    #8 0x7f2653307b9b in a2i_GENERAL_NAME crypto/x509v3/v3_alt.c:492
    #9 0x7f26533087c2 in v2i_subject_alt crypto/x509v3/v3_alt.c:327
    #10 0x7f26533107fc in do_ext_nconf crypto/x509v3/v3_conf.c:100
    #11 0x7f2653310f33 in X509V3_EXT_nconf crypto/x509v3/v3_conf.c:45
    #12 0x7f2653311426 in X509V3_EXT_add_nconf_sk crypto/x509v3/v3_conf.c:312
    #13 0x7f265331170c in X509V3_EXT_REQ_add_nconf crypto/x509v3/v3_conf.c:360
    #14 0x564ed19d5f25 in req_main apps/req.c:806
    #15 0x564ed19b8de0 in do_cmd apps/openssl.c:564
    #16 0x564ed1985165 in main apps/openssl.c:183
    #17 0x7f2651c4a082 in __libc_start_main ../csu/libc-start.c:308
    #18 0x564ed1985acd in _start (/home/ed/OPCToolboxV5/Source/Core/OpenSSL/openssl/apps/openssl+0x139acd)

0x603000073280 is located 16 bytes inside of 24-byte region [0x603000073270,0x603000073288)
freed by thread T0 here:
    #0 0x7f265413440f in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:122
    #1 0x7f265315a429 in CRYPTO_free crypto/mem.c:311
    #2 0x7f265315a429 in CRYPTO_free crypto/mem.c:300
    #3 0x7f2652e757b9 in ASN1_mbstring_ncopy crypto/asn1/a_mbstr.c:191
    #4 0x7f2652e75ec5 in ASN1_mbstring_copy crypto/asn1/a_mbstr.c:38
    #5 0x7f2652e8e227 in asn1_str2type crypto/asn1/asn1_gen.c:681
    #6 0x7f2652e8e227 in generate_v3 crypto/asn1/asn1_gen.c:137
    #7 0x7f2652e9166c in ASN1_generate_v3 crypto/asn1/asn1_gen.c:92
    #8 0x7f2653307b9b in do_othername crypto/x509v3/v3_alt.c:577
    #9 0x7f2653307b9b in a2i_GENERAL_NAME crypto/x509v3/v3_alt.c:492
    #10 0x7f26533087c2 in v2i_subject_alt crypto/x509v3/v3_alt.c:327
    #11 0x7f26533107fc in do_ext_nconf crypto/x509v3/v3_conf.c:100
    #12 0x7f2653310f33 in X509V3_EXT_nconf crypto/x509v3/v3_conf.c:45
    #13 0x7f2653311426 in X509V3_EXT_add_nconf_sk crypto/x509v3/v3_conf.c:312
    #14 0x7f265331170c in X509V3_EXT_REQ_add_nconf crypto/x509v3/v3_conf.c:360
    #15 0x564ed19d5f25 in req_main apps/req.c:806
    #16 0x564ed19b8de0 in do_cmd apps/openssl.c:564
    #17 0x564ed1985165 in main apps/openssl.c:183
    #18 0x7f2651c4a082 in __libc_start_main ../csu/libc-start.c:308

previously allocated by thread T0 here:
    #0 0x7f2654134808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
    #1 0x7f265315a4fd in CRYPTO_malloc crypto/mem.c:221
    #2 0x7f265315a4fd in CRYPTO_malloc crypto/mem.c:198
    #3 0x7f265315a945 in CRYPTO_zalloc crypto/mem.c:236
    #4 0x7f2652e939a4 in ASN1_STRING_type_new crypto/asn1/asn1_lib.c:341
    #5 0x7f2652e74e51 in ASN1_mbstring_ncopy crypto/asn1/a_mbstr.c:150
    #6 0x7f2652e75ec5 in ASN1_mbstring_copy crypto/asn1/a_mbstr.c:38
    #7 0x7f2652e8e227 in asn1_str2type crypto/asn1/asn1_gen.c:681
    #8 0x7f2652e8e227 in generate_v3 crypto/asn1/asn1_gen.c:137
    #9 0x7f2652e9166c in ASN1_generate_v3 crypto/asn1/asn1_gen.c:92
    #10 0x7f2653307b9b in do_othername crypto/x509v3/v3_alt.c:577
    #11 0x7f2653307b9b in a2i_GENERAL_NAME crypto/x509v3/v3_alt.c:492
    #12 0x7f26533087c2 in v2i_subject_alt crypto/x509v3/v3_alt.c:327
    #13 0x7f26533107fc in do_ext_nconf crypto/x509v3/v3_conf.c:100
    #14 0x7f2653310f33 in X509V3_EXT_nconf crypto/x509v3/v3_conf.c:45
    #15 0x7f2653311426 in X509V3_EXT_add_nconf_sk crypto/x509v3/v3_conf.c:312
    #16 0x7f265331170c in X509V3_EXT_REQ_add_nconf crypto/x509v3/v3_conf.c:360
    #17 0x564ed19d5f25 in req_main apps/req.c:806
    #18 0x564ed19b8de0 in do_cmd apps/openssl.c:564
    #19 0x564ed1985165 in main apps/openssl.c:183
    #20 0x7f2651c4a082 in __libc_start_main ../csu/libc-start.c:308

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23138)

(cherry picked from commit 73ebaac827180bb51ccf807673758d7d06d5db21)

4 months agoDisable building quicserver utility when configured with `no-apps` option
Vitalii Koshura [Mon, 25 Dec 2023 11:38:24 +0000 (12:38 +0100)]
Disable building quicserver utility when configured with `no-apps` option

Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23149)

(cherry picked from commit f60559eb957b53d7fd5c8c9ab566fe353ea2d9f8)

4 months agoFix typos found by codespell in man pages
Dimitri Papadopoulos [Fri, 22 Dec 2023 13:06:24 +0000 (14:06 +0100)]
Fix typos found by codespell in man pages

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23131)

(cherry picked from commit 7deb2b433a08706337d8520793702f78765ecf90)

5 months agoAES: Document that the XTS, SIV, WRAP modes do not support streaming
Tomas Mraz [Wed, 13 Dec 2023 09:06:59 +0000 (10:06 +0100)]
AES: Document that the XTS, SIV, WRAP modes do not support streaming

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/23028)

(cherry picked from commit 8f0f814d791e0825b96c30494594de619da3e5a5)

5 months agoSM4: Document that the XTS mode does not support streaming
Tomas Mraz [Wed, 13 Dec 2023 09:03:07 +0000 (10:03 +0100)]
SM4: Document that the XTS mode does not support streaming

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/23028)

(cherry picked from commit e2f9c2dd373c0859b87ecda6bf88b01a8bc6200e)

5 months agoDetect and prevent recursive config parsing
Neil Horman [Thu, 30 Nov 2023 19:28:09 +0000 (14:28 -0500)]
Detect and prevent recursive config parsing

If a malformed config file is provided such as the following:

openssl_conf = openssl_init
[openssl_init]
providers = provider_sect
[provider_sect]
 = provider_sect

The config parsing library will crash overflowing the stack, as it
recursively parses the same provider_sect ad nauseum.

Prevent this by maintaing a list of visited nodes as we recurse through
referenced sections, and erroring out in the event we visit any given
section node more than once.

Note, adding the test for this revealed that our diagnostic code
inadvertently pops recorded errors off the error stack because
provider_conf_load returns success even in the event that a
configuration parse failed. The call path to provider_conf_load has been
updated in this commit to address that shortcoming, allowing recorded
errors to be visibile to calling applications.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22898)

(cherry picked from commit 682fd21afb5428b5716e62eaefb09a7419f9cfd7)

5 months agoImprove the documentation on TLS record compression
Matt Caswell [Wed, 20 Dec 2023 10:07:39 +0000 (10:07 +0000)]
Improve the documentation on TLS record compression

TLS record compression is off by default. Even if you switch it on, it
cannot be used at security level 2 which is the default in OpenSSL 3.2 and
above. Update the docs to point this out.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23104)

(cherry picked from commit 2462e431ffe75027f253d8f1aab44ba09129c628)

5 months agoMake SSL_clear_options pass new options to record layer
lan1120 [Tue, 19 Dec 2023 09:15:58 +0000 (17:15 +0800)]
Make SSL_clear_options pass new options to record layer

Signed-off-by: lan1120 <lanming@huawei.com>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23045)

(cherry picked from commit e8e95f20a9b00ca62d407263110663eba7614683)

5 months agoBump actions/setup-python from 4.7.1 to 5.0.0
dependabot[bot] [Tue, 19 Dec 2023 18:00:12 +0000 (18:00 +0000)]
Bump actions/setup-python from 4.7.1 to 5.0.0

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.7.1 to 5.0.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4.7.1...v5.0.0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
CLA: trivial

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22963)

(cherry picked from commit 51c85496dc227f277adbe0748d596e07d9a34bc2)

5 months agoLoongArch64 assembly pack: Fix ChaCha20 ABI breakage
Xi Ruoyao [Sat, 25 Nov 2023 09:53:57 +0000 (17:53 +0800)]
LoongArch64 assembly pack: Fix ChaCha20 ABI breakage

The [LP64D ABI][1] requires the floating-point registers f24-f31
(aka fs0-fs7) callee-saved.  The low 64 bits of a LSX/LASX vector
register aliases with the corresponding FPR, so we must save and restore
the callee-saved FPR when we writes into the corresponding vector
register.

This ABI breakage can be easily demonstrated by injecting the use of a
saved FPR into the test in bio_enc_test.c:

    static int test_bio_enc_chacha20(int idx)
    {
        register double fs7 asm("f31") = 114.514;
        asm("#optimize barrier":"+f"(fs7));
        return do_test_bio_cipher(EVP_chacha20(), idx) && fs7 == 114.514;
    }

So fix it.  To make the logic simpler, jump into the scalar
implementation earlier when LSX and LASX are not enumerated in AT_HWCAP,
or the input is too short.

[1]: https://github.com/loongson/la-abi-specs/blob/v2.20/lapcs.adoc#floating-point-registers

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22817)

(cherry picked from commit b46de72c260e7c4d9bfefa35b02295ba32ad2ac6)

5 months agoFix declspec align syntax
Kai Pastor [Sun, 17 Dec 2023 10:27:19 +0000 (11:27 +0100)]
Fix declspec align syntax

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/23072)

(cherry picked from commit dfd986b6f5402e5646e42425d14f098ed6bc4544)

5 months agoFix comment syntax
Kai Pastor [Sun, 17 Dec 2023 10:26:50 +0000 (11:26 +0100)]
Fix comment syntax

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/23072)

(cherry picked from commit 1fda942e8cd425263433094bf8714a80c05bcb2c)

5 months agoFix no-des failure in test_cms
Bernd Edlinger [Mon, 18 Dec 2023 20:38:22 +0000 (21:38 +0100)]
Fix no-des failure in test_cms

The newly introduced test case do not work
when configured with no-des, fix that by
choosing -aes128 as cipher.

Fixes ffed597882ba ("cms: avoid intermittent test failure")

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23086)

(cherry picked from commit 5b4f4474b2562c4422193e1719461a0ef5cbc3e5)

5 months agoConsolidate raising errors in SSL_CONF_cmd()
Tomas Mraz [Thu, 14 Dec 2023 17:33:57 +0000 (18:33 +0100)]
Consolidate raising errors in SSL_CONF_cmd()

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/23048)

(cherry picked from commit 430dcbd0463573fece704263648cc15e891c3d49)

5 months agoTest that incorrect entry in the ssl section is not fatal
Tomas Mraz [Thu, 14 Dec 2023 15:37:58 +0000 (16:37 +0100)]
Test that incorrect entry in the ssl section is not fatal

The following entries should be still applied.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/23048)

(cherry picked from commit 17b4277d9ac6665e9b53a6270949418154cab2dc)

5 months agoAlways apply all configuration settings from the ssl section
Tomas Mraz [Thu, 14 Dec 2023 15:26:21 +0000 (16:26 +0100)]
Always apply all configuration settings from the ssl section

Even if some configuration entry is incorrect, do not
skip the remaining ones.

Fixes #20789

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/23048)

(cherry picked from commit 69c067ffbc2c02295e20c90e557b6fcb2f7da69c)

5 months agoAdd a daily test for an alternative value for SSL3_ALIGN_PAYLOAD
Matt Caswell [Tue, 12 Dec 2023 13:47:11 +0000 (13:47 +0000)]
Add a daily test for an alternative value for SSL3_ALIGN_PAYLOAD

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23021)

(cherry picked from commit 5ccd4dec6f732b4144e16cc6c9e73f07fb506279)

5 months agoEnsure the default length calculation includes the content type byte
Matt Caswell [Tue, 12 Dec 2023 13:17:51 +0000 (13:17 +0000)]
Ensure the default length calculation includes the content type byte

TLSv1.3 includes an extra byte after the payload for the content type.
We should incorporate that in the calculation of the default buffer length.

Fixes #23015

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23021)

(cherry picked from commit e07b5e1a0a76f25c633a468d4f7945b82ae436bd)

5 months agorun Windows GitHub CI workflow on self-hosted runners
Dmitry Misharov [Thu, 14 Dec 2023 12:36:04 +0000 (13:36 +0100)]
run Windows GitHub CI workflow on self-hosted runners

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23042)

(cherry picked from commit ce42b72cb1ca2ba8669bc28a70ed9dca28b7a551)

5 months agorun GitHub CI workflow on self-hosted runners
Dmitry Misharov [Thu, 14 Dec 2023 11:29:23 +0000 (12:29 +0100)]
run GitHub CI workflow on self-hosted runners

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23042)

(cherry picked from commit 834a2d7088a042a4f8f95fa2b8327fd388556151)

5 months agorun Cross Compiles workflow on self-hosted runner
Dmitry Misharov [Thu, 14 Dec 2023 10:09:15 +0000 (11:09 +0100)]
run Cross Compiles workflow on self-hosted runner

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23042)

(cherry picked from commit 625287bc80129deedab7484ee4c0ac112ae874a0)

5 months agocms: avoid intermittent test failure
James Muir [Thu, 14 Dec 2023 19:14:37 +0000 (14:14 -0500)]
cms: avoid intermittent test failure

If you decrypt a random input using RSAES-PKCS-v1_5, then there is a
non-negligible chance that the result will look like a valid plaintext
(that is why RSAES-PKCS-v1_5 shouldn't be used anymore).  This was the
cause of an intermittent failure in a test that did a cms-encrypt
operation targetting multiple recipients.

The failure happened during key-only decrypt.  The recipient decrypts
every RSA ciphertext -- only one is supposed to decrypt successfully,
which would reveal the right content-key.  Occassionally, more than
one decrypted successfully.

Update the test by specifying the recipient cert in the decrypt op
(this avoids looping over all RSA ciphertexts).

Add a new test to get coverage for key-only decrypt, but use RSA-OAEP
during the encrypt op.

Fixes https://github.com/openssl/project/issues/380

Testing:

  $ make TESTS='test_cms' test

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23055)

(cherry picked from commit ffed597882baf2f07274e7eaa8f3c4fa9fa74ac1)

5 months agoDefine L_ENDIAN for linux64-loongarch64
Xi Ruoyao [Tue, 12 Dec 2023 19:36:48 +0000 (03:36 +0800)]
Define L_ENDIAN for linux64-loongarch64

In commit d7c0fc5b1a7b5cb2219f8d89a861f3879582fc16 we removed L_ENDIAN
definition for guessed linux64-loongarch64 as it had caused an
inconsistency between configurations with and without explicit
specifying linux64-loongarch64.  Now add it back to the proper location.

Unlike MIPS or RISC-V, LoongArch is always little-endian [1].

By the way, change "LOONGARCH" to "LoongArch" in a comment as LOONGARCH
should only appear in the identifiers of macros, constants, etc.

[1]:https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#endian

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23064)

(cherry picked from commit e1002c84725a64b6a097f3155dc6851b57f7ba8e)

5 months agoBump actions/download-artifact from 3 to 4
dependabot[bot] [Mon, 18 Dec 2023 10:05:05 +0000 (10:05 +0000)]
Bump actions/download-artifact from 3 to 4

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
CLA: trivial

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23052)

(cherry picked from commit c4496b8f5ec8c23c3d072efa8e5c0f443c64dc71)

5 months agoBump actions/upload-artifact from 3 to 4
dependabot[bot] [Mon, 18 Dec 2023 09:58:53 +0000 (09:58 +0000)]
Bump actions/upload-artifact from 3 to 4

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
CLA: trivial

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23053)

(cherry picked from commit 1ee0560f43a38d3a2de6c2cd2cacb0879c75cf46)

5 months agoFix instructions for running tests on Windows
Dmitry Kobets [Fri, 15 Dec 2023 04:12:43 +0000 (20:12 -0800)]
Fix instructions for running tests on Windows

In the command `nmake TEST='foo' test`, on Windows the runner
will look for test `'foo'` and complain about the test not being found
(due to the extraneous single quotes), whereas with `nmake TEST="foo" test`,
the test `foo` will be correctly found.

CLA: trivial

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23059)

(cherry picked from commit cf424d1da05b3cd928c97596af08e260429b308c)

5 months agoFix provider compatibility check crash in evp_test
Tomas Mraz [Mon, 11 Dec 2023 14:19:47 +0000 (15:19 +0100)]
Fix provider compatibility check crash in evp_test

EVP_MAC_CTX_get_mac_size() cannot be called on older
unfixed versions before EVP_MAC_init().

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/23006)

(cherry picked from commit e4542332fa36eab6d6bbf33815bde433ade3b547)

5 months agoLHASH: Document down_load functions
Hugo Landau [Mon, 11 Dec 2023 07:57:54 +0000 (07:57 +0000)]
LHASH: Document down_load functions

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23032)

5 months agoLHASH: Fix documentation for doall-delete hazards
Hugo Landau [Fri, 8 Dec 2023 10:14:27 +0000 (10:14 +0000)]
LHASH: Fix documentation for doall-delete hazards

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23032)

5 months agoCONTRIBUTING.md: add reference to util/check-format.pl and fix several nits
Dr. David von Oheimb [Sat, 2 Dec 2023 14:54:27 +0000 (15:54 +0100)]
CONTRIBUTING.md: add reference to util/check-format.pl and fix several nits

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22911)

(cherry picked from commit 260d97229c467d17934ca3e2e0455b1b5c0994a6)