]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
4 days agoech_store.c: Fix casts and avoid leaks on error return feature/ech
Tomas Mraz [Thu, 18 Sep 2025 17:41:49 +0000 (19:41 +0200)] 
ech_store.c: Fix casts and avoid leaks on error return

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28611)

4 days agoech_ssl_apis.c: Check some invalid argument passing
Tomas Mraz [Thu, 18 Sep 2025 16:01:49 +0000 (18:01 +0200)] 
ech_ssl_apis.c: Check some invalid argument passing

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28611)

4 days agoFix warnings about casts in ECH code
Tomas Mraz [Thu, 18 Sep 2025 15:13:28 +0000 (17:13 +0200)] 
Fix warnings about casts in ECH code

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28611)

7 weeks agoAdd server-side handling of Encrypted Client Hello
sftcd [Mon, 5 May 2025 13:23:55 +0000 (14:23 +0100)] 
Add server-side handling of Encrypted Client Hello

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

7 weeks agoAdd a test for the new PACKET_msg_start() function
Matt Caswell [Thu, 5 Jun 2025 14:29:01 +0000 (15:29 +0100)] 
Add a test for the new PACKET_msg_start() function

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

7 weeks agoIntroduce the PACKET_msg_start() function
Matt Caswell [Thu, 5 Jun 2025 13:41:55 +0000 (14:41 +0100)] 
Introduce the PACKET_msg_start() function

This gives us the start of the buffer in use for the PACKET.

We then use this information when calculating the TLS PSK binder.
Previously we were assuming knowledge about where the buffer starts.
However, with ECH, we may be using a different buffer to normal so it is
better to ask the PACKET where the start of the buffer is.

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

7 weeks agoECH client support for sending multiple key shares
sftcd [Fri, 2 May 2025 11:58:30 +0000 (12:58 +0100)] 
ECH client support for sending multiple key shares

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

7 weeks agoECH client side transcript refactor
sftcd [Sat, 28 Dec 2024 02:49:12 +0000 (02:49 +0000)] 
ECH client side transcript refactor

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

7 weeks agoECH client side
sftcd [Wed, 20 Nov 2024 14:10:30 +0000 (14:10 +0000)] 
ECH client side

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

7 weeks agoECH external APIs
sftcd [Thu, 10 Oct 2024 16:46:11 +0000 (17:46 +0100)] 
ECH external APIs

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

7 weeks agoECH CLI implementation
sftcd [Tue, 10 Sep 2024 23:28:32 +0000 (00:28 +0100)] 
ECH CLI implementation

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

7 weeks agoECH build artefacts and a bit of code
Stephen Farrell [Thu, 15 Aug 2024 00:27:24 +0000 (01:27 +0100)] 
ECH build artefacts and a bit of code

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

7 weeks agoDocuments initial agreed APIs for Encrypted Client Hello (ECH)
Stephen Farrell [Tue, 6 Aug 2024 22:16:58 +0000 (23:16 +0100)] 
Documents initial agreed APIs for Encrypted Client Hello (ECH)
and includes a minimal demo for some of those APIs.

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

7 weeks agoadd ech-api.md
Stephen Farrell [Wed, 26 Jun 2024 11:55:17 +0000 (12:55 +0100)] 
add ech-api.md

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

7 weeks agodoc/man3/SSL_CTX_set_domain_flags: fix version in HISTORY section
Nikolas Gauder [Wed, 30 Jul 2025 17:50:50 +0000 (19:50 +0200)] 
doc/man3/SSL_CTX_set_domain_flags: fix version in HISTORY section

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

7 weeks agotest/sanitytest.c: fix setitimer usage in timer disarmament
Eugene Syromiatnikov [Sun, 10 Aug 2025 00:00:25 +0000 (02:00 +0200)] 
test/sanitytest.c: fix setitimer usage in timer disarmament

It is incorrect to call setitimer(which, NULL, NULL) to disarm a timer,
Linux just gives a pass on that;  properly provide a zeroed-out
structure instead.

Fixes: 760929f6ba18 "crypto/sleep.c: avoid returning early due to signal"
Reported-by: Neil Horman <nhorman@openssl.org>
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28215)

7 weeks agoFix memory leak on EVP_CIPHER_param_to_asn1 failure
77tiann [Thu, 31 Jul 2025 00:47:06 +0000 (17:47 -0700)] 
Fix memory leak on EVP_CIPHER_param_to_asn1 failure

When EVP_CIPHER_param_to_asn1() fails, xalg->parameter was not freed,
leading to a memory leak. This patch adds proper cleanup for that case.
CLA: trivial

Signed-off-by: 77tiann <27392025k@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28131)

7 weeks agofix: Apply cascade-disables before showing status
BMDan [Sat, 4 Nov 2023 20:00:45 +0000 (13:00 -0700)] 
fix: Apply cascade-disables before showing status

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/22621)

7 weeks agofix: restore missing --help in Configure
BMDan [Fri, 3 Nov 2023 22:25:50 +0000 (15:25 -0700)] 
fix: restore missing --help in Configure

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/22621)

7 weeks agoossl_prov_drbg_generate(): Move syscalls out of the write locked section
Tomas Mraz [Thu, 31 Jul 2025 19:24:55 +0000 (21:24 +0200)] 
ossl_prov_drbg_generate(): Move syscalls out of the write locked section

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

7 weeks agoFix RSA key size validation in EVP_PKEY_RSA_keygen demo
Quin-Darcy [Thu, 31 Jul 2025 14:07:46 +0000 (09:07 -0500)] 
Fix RSA key size validation in EVP_PKEY_RSA_keygen demo

The validation was checking the default 'bits' value (4096) instead of
the parsed 'bits_i' from the command line arguments, allowing invalid
key sizes to bypass the 512-bit minimum.

CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28139)

7 weeks agocms_kemri.c: Fix Coverity issues
Tomas Mraz [Thu, 31 Jul 2025 08:40:40 +0000 (10:40 +0200)] 
cms_kemri.c: Fix Coverity issues

Add return value check of ASN1_OCTET_STRING_set().
Do not call OPENSSL_cleanse() if keklen is greater than the cleaned buffer.

Fixes Coverity 16608241660825

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28132)

7 weeks agocrypto/{cmp,crmf}/: clean up unneeded #include directives
Dr. David von Oheimb [Wed, 26 Feb 2025 17:56:21 +0000 (18:56 +0100)] 
crypto/{cmp,crmf}/: clean up unneeded #include directives

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/28035)

7 weeks agox509: Accept 'contentCommitment' as alias
Clemens Lang [Sun, 3 Aug 2025 18:47:36 +0000 (20:47 +0200)] 
x509: Accept 'contentCommitment' as alias

ITU-T X.509 (10/2019) section 9.2.2.3 [1] defines 'contentCommitment' as
the current name for what had previously been called 'nonRepudiation',
and deprecates the old name:

> It is not incorrect to refer to this keyUsage bit using the identifier
> nonRepudiation. However, the use of this identifier has been
> deprecated.

Allow 'contentCommitment' as an alias wherever 'nonRepudiation' has been
accepted before, so that passing

    -addext keyUsage=critical,contentCommitment

works as expected.

Add a test that checks that contentCommitment sets the same keyUsage bit
as nonRepudiation. Adjust the docs to mention the available alias name.

[1]: https://www.itu.int/rec/T-REC-X.509-201910-I/en

Signed-off-by: Clemens Lang <cllang@redhat.com>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28161)

8 weeks agoquic_channel.c: NULL check SSL_CONNECTION
Norbert Pocs [Fri, 8 Aug 2025 13:17:06 +0000 (15:17 +0200)] 
quic_channel.c: NULL check SSL_CONNECTION

Addresses coverity issue #1662037

Fixes: https://github.com/openssl/project/issues/1316
Signed-off-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28208)

8 weeks agocrypto/sleep.c: avoid returning early due to signal
Eugene Syromiatnikov [Thu, 7 Aug 2025 14:01:23 +0000 (16:01 +0200)] 
crypto/sleep.c: avoid returning early due to signal

On POSIX systems, sleep/usleep/nanosleep may return early due to arrival
of a signal, and OSSL_sleep does not report that, so it is assumed that
it cannot return early.  Fix that by introducing a loop that checks
the remaining time and sleep some more if the time has not passed;
that also solves the issue of limited sleeping time on some systems.

Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28193)

8 weeks agos/veirfy/verify
Alexandr Nedvedicky [Mon, 4 Aug 2025 09:11:15 +0000 (11:11 +0200)] 
s/veirfy/verify

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

8 weeks ago- veirfy downloaded package
Alexandr Nedvedicky [Mon, 4 Aug 2025 08:24:40 +0000 (10:24 +0200)] 
- veirfy downloaded package

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

8 weeks ago- add --no-check-certificate option to wget, pointed out by @esyr
sashan [Mon, 4 Aug 2025 07:32:51 +0000 (09:32 +0200)] 
- add --no-check-certificate option to wget, pointed out by @esyr

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

8 weeks agothe rpki-client external test should use relase version not a master branch on github
Alexandr Nedvedicky [Thu, 31 Jul 2025 12:15:13 +0000 (14:15 +0200)] 
the rpki-client external test should use relase version not a master branch on github

@botovq asked me not to use master branch of rpki-client. This will keep CI-run
green regardless of what happens in rpki-client active development branch.
Once new version of rpki-client will be released we will just update the
test here to fetch new msater version.

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

8 weeks agoFix failure checking on rcu_read_lock
Neil Horman [Thu, 7 Aug 2025 13:50:58 +0000 (09:50 -0400)] 
Fix failure checking on rcu_read_lock

during memfail testing:
https://github.com/openssl/openssl/actions/runs/16794088536/job/47561223902

We get lots of test failures in ossl_rcu_read_lock.  This occurs
because we have a few cases in the read lock path that attempt mallocs,
which, if they fail, trigger an assert or a silent failure, which isn't
really appropriate.  We should instead fail gracefully, by informing the
caller that the lock failed, like we do for CRYPTO_THREAD_read_lock.

Fortunately, these are all internal apis, so we can convert
ossl_rcu_read_lock to return an int indicating success/failure, and fail
gracefully during the test, rather than hitting an assert abort.

Fixes openssl/project#1315

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28195)

8 weeks agoFix failure checking on thread_local storage assignment in rand_lib
Neil Horman [Thu, 7 Aug 2025 13:16:11 +0000 (09:16 -0400)] 
Fix failure checking on thread_local storage assignment in rand_lib

The new malloc failure test caught an asan error in this code:
Direct leak of 40 byte(s) in 1 object(s) allocated from:
2025-08-07T03:22:20.3655117Z     #0 0x7fb88d8fd9c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
2025-08-07T03:22:20.3655796Z     #1 0x5584f0e4670a in CRYPTO_malloc crypto/mem.c:211
2025-08-07T03:22:20.3656291Z     #2 0x5584f0e4679d in CRYPTO_zalloc crypto/mem.c:231
2025-08-07T03:22:20.3657040Z     #3 0x5584f11c4c10 in EVP_RAND_CTX_new crypto/evp/evp_rand.c:353
2025-08-07T03:22:20.3657656Z     #4 0x5584f0e93b27 in rand_new_drbg crypto/rand/rand_lib.c:666
2025-08-07T03:22:20.3658289Z     #5 0x5584f0e949d0 in rand_get0_public crypto/rand/rand_lib.c:843
2025-08-07T03:22:20.3658914Z     #6 0x5584f0e9305b in RAND_bytes_ex crypto/rand/rand_lib.c:490
2025-08-07T03:22:20.3659486Z     #7 0x5584f0b2405f in SSL_CTX_new_ex ssl/ssl_lib.c:4191
2025-08-07T03:22:20.3660183Z     #8 0x5584f0ae313c in create_ssl_ctx_pair test/helpers/ssltestlib.c:958
2025-08-07T03:22:20.3660871Z     #9 0x5584f0adeaf6 in do_handshake test/handshake-memfail.c:56
2025-08-07T03:22:20.3661539Z     #10 0x5584f0adee50 in test_alloc_failures test/handshake-memfail.c:125
2025-08-07T03:22:20.3662161Z     #11 0x5584f0cd9da8 in run_tests test/testutil/driver.c:342
2025-08-07T03:22:20.3662664Z     #12 0x5584f0cda9e5 in main test/testutil/main.c:31
2025-08-07T03:22:20.3663450Z     #13 0x7fb88d42a1c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 282c2c16e7b6600b0b22ea0c99010d2795752b5f)
2025-08-07T03:22:20.3664630Z     #14 0x7fb88d42a28a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 282c2c16e7b6600b0b22ea0c99010d2795752b5f)
2025-08-07T03:22:20.3666608Z     #15 0x5584f0ade864 in _start (/home/runner/work/openssl/openssl/test/handshake-memfail+0x22a864) (BuildId: 19659a44d8bed2c082918d25425f77e3a98df534)

It occurs because when rand_get0_public/rand_get0_private sets an
EVP_RAND_CTX object in its thread local storage, it neglects to check
the return code of the operation, which may fail when the associated
sparse array is expanded.

fix it by checking the return code and failing the get0_[public|private]
operation so the failure is graceful.

Fixes openssl/project#1315

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28195)

8 weeks agotest: add a sanity test for memory allocation functions
Eugene Syromiatnikov [Fri, 25 Jul 2025 17:08:18 +0000 (19:08 +0200)] 
test: add a sanity test for memory allocation functions

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agotest/testutil/main.c: move global_init before test_open_streams
Eugene Syromiatnikov [Wed, 30 Jul 2025 14:54:09 +0000 (16:54 +0200)] 
test/testutil/main.c: move global_init before test_open_streams

So it is possible to change the allocator implementation,
as it must be before the first malloc call.

Suggested-by: Matt Caswell <matt@openssl.org>
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agoOPENSSL_secure_malloc.pod: articulate possibly non-secure pointer being returned
Eugene Syromiatnikov [Thu, 31 Jul 2025 13:21:01 +0000 (15:21 +0200)] 
OPENSSL_secure_malloc.pod: articulate possibly non-secure pointer being returned

The semantics of OPENSSL_secure_[mz]alloc is somewhat unorthodox,
as it silently return a pointer to non-secure memory if the arena
is not initialised, which, while mentioned in the DESCRIPTION, is not
clear from reading the pertaining part of the RETURNING VALUE section alone;
explicitly state that the memory may be allocated by OPENSSL_calloc instead
if the secure heap is not initialised.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agodoc/man3/OPENSSL_malloc.pod: explicitly document freeptr value on failures
Eugene Syromiatnikov [Thu, 31 Jul 2025 12:35:07 +0000 (14:35 +0200)] 
doc/man3/OPENSSL_malloc.pod: explicitly document freeptr value on failures

Explicitly document that it is set to NULL, so can be passed to free()
without additional checks.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agodoc/man3/OPENSSL_malloc.pod: document OPENSSL_aligned_alloc peculiarity
Eugene Syromiatnikov [Thu, 31 Jul 2025 11:42:41 +0000 (13:42 +0200)] 
doc/man3/OPENSSL_malloc.pod: document OPENSSL_aligned_alloc peculiarity

OPENSSL_aligned_alloc can return NULL in cases other than memory
exhaustion or incorrect arguments, document that.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agoOPENSSL_malloc.pod: tfix, wfix in OPENSSL_aligned_alloc description
Eugene Syromiatnikov [Tue, 29 Jul 2025 04:30:50 +0000 (06:30 +0200)] 
OPENSSL_malloc.pod: tfix, wfix in OPENSSL_aligned_alloc description

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agocrypto/mem.c: check for overflow in size calculation in CRYPTO_aligned_alloc
Eugene Syromiatnikov [Thu, 31 Jul 2025 12:32:27 +0000 (14:32 +0200)] 
crypto/mem.c: check for overflow in size calculation in CRYPTO_aligned_alloc

The open-coded implementation performs addition of size and alignment,
that may overflow.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agocrypto/mem.c: bump alignment to sizeof(void *) when posix_memaling() is used
Eugene Syromiatnikov [Thu, 31 Jul 2025 13:09:36 +0000 (15:09 +0200)] 
crypto/mem.c: bump alignment to sizeof(void *) when posix_memaling() is used

Per [1]:

    The value of alignment shall be a power of two multiple of sizeof(void *).

[1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/posix_memalign.html

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agocrypto/mem.c: report posix_memalign() errors in CRYPTO_aligned_alloc
Eugene Syromiatnikov [Fri, 25 Jul 2025 01:48:23 +0000 (03:48 +0200)] 
crypto/mem.c: report posix_memalign() errors in CRYPTO_aligned_alloc

Report the errors for the known error codes returned
by posix_memalign().

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agocrypto/mem.c: check the alignment for being a power of 2 in CRYPTO_aligned_alloc
Eugene Syromiatnikov [Thu, 31 Jul 2025 12:27:22 +0000 (14:27 +0200)] 
crypto/mem.c: check the alignment for being a power of 2 in CRYPTO_aligned_alloc

Otherwise the roundup calculation performed in the open-coded implementation
may put the pointer out of bounds.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agocrypto/mem.c: don't use aligned_alloc in CRYPTO_aligned_alloc
Eugene Syromiatnikov [Thu, 31 Jul 2025 12:07:43 +0000 (14:07 +0200)] 
crypto/mem.c: don't use aligned_alloc in CRYPTO_aligned_alloc

The original C11 specification is pretty weird: it specifies that the size
must be a multiple of alignment (rendering it useless for small page-aligned
allocations that, for example, might be useful for RDMA) and until DR460[1]
it was UB in failing to do so (as it is with OPENSSL_ligned_alloc() calls
in alloc_new_neighborhood_list() on 32-bit systems, for example).
Moreover, it has arguably not been used much before, as all supported POSIX
systems have at least POSIX 2001 compatibility level nowadays,
Windows doesn't implement aligned_alloc() at all (because implementation
of free() in MS CRT is unable to handle aligned allocations[2]),
and _ISOC11_SOURCE is a glibc-specific feature test macro.

[1] https://open-std.org/JTC1/SC22/WG14/www/docs/summary.htm#dr_460
[2] https://learn.microsoft.com/en-us/cpp/standard-library/cstdlib?view=msvc-170#remarks-6

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agocrypto/mem.c: simplify OPENSSL_SMALL_FOOTPRINT handling in CRYPTO_aligned_alloc
Eugene Syromiatnikov [Thu, 31 Jul 2025 12:23:44 +0000 (14:23 +0200)] 
crypto/mem.c: simplify OPENSSL_SMALL_FOOTPRINT handling in CRYPTO_aligned_alloc

There is no need to initialise neither *freeptr, as it is initialised
already, nor ret, as NULL can be simply returned instead.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agocrypto/mem.c: tfix in CRYPTO_aligned_alloc
Eugene Syromiatnikov [Fri, 25 Jul 2025 01:46:36 +0000 (03:46 +0200)] 
crypto/mem.c: tfix in CRYPTO_aligned_alloc

* crypto/mem.c [OPENSSL_SMALL_FOOTPRINT] (CRYPTO_aligned_alloc): Change
freeptr to *freeptr to properly update the variable passed by pointer.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agoCall ctags on *.inc files as well
Eugene Syromiatnikov [Thu, 24 Jul 2025 15:40:21 +0000 (17:40 +0200)] 
Call ctags on *.inc files as well

There are some *.inc already in the repository, mostly in demos/tests
and related to some algorithm implementations.  Introduction
of array_alloc.inc has made including these files in the tags generation
even more pertinent, so they are included now.

Also, this commit explicitly marks *.h files as containing C code,
overriding universal-ctags default of interpreting them as C++/ObjectiveC
ones.

Suggested-by: Neil Horman <nhorman@openssl.org>
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agoutil/ctags.sh: tfix in a "set --" call
Eugene Syromiatnikov [Thu, 24 Jul 2025 15:33:14 +0000 (17:33 +0200)] 
util/ctags.sh: tfix in a "set --" call

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agoapps, fuzz, providers: use array memory (re)allocation routines
Eugene Syromiatnikov [Wed, 23 Jul 2025 13:49:18 +0000 (15:49 +0200)] 
apps, fuzz, providers: use array memory (re)allocation routines

Co-Authored-by: Alexandr Nedvedicky <sashan@openssl.org>
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agotest: use array memory (re)allocation routines
Eugene Syromiatnikov [Thu, 17 Jul 2025 13:19:56 +0000 (15:19 +0200)] 
test: use array memory (re)allocation routines

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agossl: use array memory (re)allocation routines
Eugene Syromiatnikov [Thu, 17 Jul 2025 08:40:15 +0000 (10:40 +0200)] 
ssl: use array memory (re)allocation routines

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agodemos: use array memory (re)allocation routines
Eugene Syromiatnikov [Thu, 17 Jul 2025 13:18:02 +0000 (15:18 +0200)] 
demos: use array memory (re)allocation routines

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agocrypto: use array memory (re)allocation routines
Eugene Syromiatnikov [Thu, 17 Jul 2025 13:17:38 +0000 (15:17 +0200)] 
crypto: use array memory (re)allocation routines

Co-Authored-by: Alexandr Nedvedicky <sashan@openssl.org>
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agocrypto/ec: use array memory (re)allocation routines
Eugene Syromiatnikov [Thu, 17 Jul 2025 13:12:59 +0000 (15:12 +0200)] 
crypto/ec: use array memory (re)allocation routines

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agocrypto/bn: use array memory (re)allocation routines
Eugene Syromiatnikov [Thu, 17 Jul 2025 13:11:38 +0000 (15:11 +0200)] 
crypto/bn: use array memory (re)allocation routines

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agocrypto/params_dup.c: add overflow check to ossl_param_buf_alloc
Eugene Syromiatnikov [Thu, 17 Jul 2025 13:10:25 +0000 (15:10 +0200)] 
crypto/params_dup.c: add overflow check to ossl_param_buf_alloc

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agoAdd array memory allocation routines
Eugene Syromiatnikov [Thu, 17 Jul 2025 01:32:02 +0000 (03:32 +0200)] 
Add array memory allocation routines

Such routines allow alleviating the need to perform explicit integer
overflow check during allocation size calculation and generally make
the allocations more semantic (as they signify that a collection
of NUM items, each occupying SIZE bytes is being allocated), which paves
the road for additional correctness checks in the future.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agoinclude/openssl/crypto.h.in: fix alignment for OPENSSL_*alloc macros
Eugene Syromiatnikov [Thu, 17 Jul 2025 13:51:44 +0000 (15:51 +0200)] 
include/openssl/crypto.h.in: fix alignment for OPENSSL_*alloc macros

Otherwise util/check-format-commit.sh complains about the wrong
alignment.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agocrypto/ec/ecp_nistp256.c: use OPENSSL_zalloc instead of malloc+memset
Eugene Syromiatnikov [Thu, 17 Jul 2025 11:21:33 +0000 (13:21 +0200)] 
crypto/ec/ecp_nistp256.c: use OPENSSL_zalloc instead of malloc+memset

Complements: b51bce942023 "Add and use OPENSSL_zalloc"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agossl: drop multiplication by sizeof(char) in allocation size calculations
Eugene Syromiatnikov [Thu, 17 Jul 2025 08:41:07 +0000 (10:41 +0200)] 
ssl: drop multiplication by sizeof(char) in allocation size calculations

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agocrypto/mem.c: report realloc_impl failures
Eugene Syromiatnikov [Thu, 31 Jul 2025 12:34:21 +0000 (14:34 +0200)] 
crypto/mem.c: report realloc_impl failures

Analogous to the way CRYPTO_malloc does it.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agocrypto/mem.c: report realloc failures
Eugene Syromiatnikov [Thu, 17 Jul 2025 01:30:13 +0000 (03:30 +0200)] 
crypto/mem.c: report realloc failures

Seems like the case of realloc() returning NULL with non-zero size
has been overlooked.

Complements: 5639ee79bdc9 "ERR: Make CRYPTO_malloc() and friends report ERR_R_MALLOC_FAILURE"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agocrypto/mem.c: factor out memory allocation failure reporting
Eugene Syromiatnikov [Thu, 17 Jul 2025 01:29:35 +0000 (03:29 +0200)] 
crypto/mem.c: factor out memory allocation failure reporting

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28059)

8 weeks agoFix msquic-openssl workflow to build container correctly
Andrew Dinh [Mon, 28 Jul 2025 11:17:09 +0000 (18:17 +0700)] 
Fix msquic-openssl workflow to build container correctly

- Fix inline file replacement on qns.Dockerfile
- Add check to ensure patch ran successfully

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28140)

8 weeks agoFixes for build failures on OS X 10.4 Tiger
GAlvare [Fri, 2 May 2025 16:57:22 +0000 (11:57 -0500)] 
Fixes for build failures on OS X 10.4 Tiger

Also added darwin8-ppc-cc and darwin8-ppc64-cc build configurations for
handling OS X 10.4 PowerPC specific configuration options, specifically
disabling async by default.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27578)

8 weeks agoskey: include extra error header file
Pauli [Tue, 5 Aug 2025 22:42:23 +0000 (08:42 +1000)] 
skey: include extra error header file

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28163)

8 weeks agox942kdf: introduce conditionals on the FIPS only parameters
Pauli [Mon, 4 Aug 2025 01:20:22 +0000 (11:20 +1000)] 
x942kdf: introduce conditionals on the FIPS only parameters

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28163)

8 weeks agotls1_prf: introduce conditionals on the FIPS only parameters
Pauli [Mon, 4 Aug 2025 01:20:21 +0000 (11:20 +1000)] 
tls1_prf: introduce conditionals on the FIPS only parameters

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28163)

8 weeks agosskdf: introduce conditionals on the FIPS only parameters
Pauli [Mon, 4 Aug 2025 01:20:21 +0000 (11:20 +1000)] 
sskdf: introduce conditionals on the FIPS only parameters

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28163)

8 weeks agosshkdf: introduce conditionals on the FIPS only parameters
Pauli [Mon, 4 Aug 2025 01:20:21 +0000 (11:20 +1000)] 
sshkdf: introduce conditionals on the FIPS only parameters

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28163)

8 weeks agopbkdf2: introduce conditionals on the FIPS only parameters
Pauli [Mon, 4 Aug 2025 01:20:21 +0000 (11:20 +1000)] 
pbkdf2: introduce conditionals on the FIPS only parameters

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28163)

8 weeks agokbkdf: introduce conditionals on the FIPS only parameters
Pauli [Mon, 4 Aug 2025 01:20:21 +0000 (11:20 +1000)] 
kbkdf: introduce conditionals on the FIPS only parameters

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28163)

8 weeks agohkdf: introduce conditionals on the FIPS only parameters
Pauli [Mon, 4 Aug 2025 01:20:21 +0000 (11:20 +1000)] 
hkdf: introduce conditionals on the FIPS only parameters

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28163)

8 weeks agoparams: produce an error if a parameter is repeated
Pauli [Mon, 4 Aug 2025 01:05:57 +0000 (11:05 +1000)] 
params: produce an error if a parameter is repeated

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28163)

8 weeks agoerror: add new repeated parameter error
Pauli [Mon, 4 Aug 2025 01:02:01 +0000 (11:02 +1000)] 
error: add new repeated parameter error

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28163)

8 weeks agoparams: add conditional params to the generation script
Pauli [Mon, 4 Aug 2025 00:51:26 +0000 (10:51 +1000)] 
params: add conditional params to the generation script

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28163)

8 weeks ago[RISC-V] Further optimization for AES-128-CBC decryption performance
zhoulu [Sun, 3 Aug 2025 13:46:13 +0000 (21:46 +0800)] 
[RISC-V] Further optimization for AES-128-CBC decryption performance

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28048)

8 weeks agoCoverity nits
Viktor Dukhovni [Tue, 5 Aug 2025 13:10:20 +0000 (23:10 +1000)] 
Coverity nits

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28176)

8 weeks agoEnsure that the largest_pn values are migrated to our channel qrx
Neil Horman [Mon, 4 Aug 2025 22:29:52 +0000 (18:29 -0400)] 
Ensure that the largest_pn values are migrated to our channel qrx

Recently, our overnight QUIC interop runs began failing in CI when an
openssl server was tested against an ngtcp2 client:
https://github.com/openssl/openssl/actions/runs/16739736813

The underlying cause bears some explination for historical purposes

The problem began happening with a recent update to ngtcp2 in which
ngtcp2 updated its wolfssl tls backend to support ML-KEM, which caused
ngtcp to emit a client hello message that offered several groups
(including X25519MLKEM768) but only provided a keyshare for x25519.
This in turn triggered the openssl server to respond with a hello retry
request (HRR), requesting an ML-KEM keyshare instead, which ngtcp2
obliged. However all subsequent frames from the client were discarded by
the server, due to failing packet body decryption.

The problem was tracked down to a mismatch in the initial vectors used
by the client and server, leading to an AEAD tag mismatch.

Packet protection keys generate their IV's in QUIC by xoring the packet
number of the received frame with the base IV as derived via HKDF in the
tls layer.

The underlying problem was that openssl hit a very odd corner case with
how we compute the packet number of the received frame.  To save space,
QUIC encodes packet numbers using a variable length integer, and only
sends the changed bits in the packet number.  This requires that the
receiver (openssl) store the largest received pn of the connection,
which we nominally do.

However, in default_port_packet_handler (where QUIC frames are processed
prior to having an established channel allocated) we use a temporary qrx
to validate the packet protection of those frames.  This temporary qrx
may be incorporated into the channel in some cases, but is not in the
case of a valid frame that generates an HRR at the TLS layer.  In this
case, the channel allocates its own qrx independently.  When this
occurs, the largest_pn value of the temporary qrx is lost, and
subsequent frames are unable to be received, as the newly allocated qrx
belives that the larges_pn for a given pn_space is 0, rather than the
value received in the initial frame (which was a complete 32 bit value,
rather than just the changed lower 8 bits).  As a result the IV
construction produced the wrong value, and the decrypt failed on those
subsequent frames.

Up to this point, that wasn't even a problem, as most quic
implementations start their packet numbering at 0, so the next packet
could still have its packet number computed properly.  The combination
of ngtcp using large random values for initial packet numbers, along
with the HRR triggering a separate qrx creation on a channel led to the
discovery of this discrepancy.

The fix seems pretty straightforward.  When we detect in
port_default_packet_handler, that we have a separate qrx in the new
channel, we migrate processed packets from the temporary qrx to the
canonical channel qrx.  In addition to doing that, we also need to
migrate the largest_pn array from the temporary qrx to the channel_qrx
so that subsequent frame reception is guaranteed to compute the received
frame packet number properly, and as such, compute the proper IV for
packet protection decryption.

Fixes openssl/project#1296

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28115)

8 weeks agoquic_channel: Handle HRR and the second transport params extension
Norbert Pocs [Mon, 28 Jul 2025 13:45:09 +0000 (15:45 +0200)] 
quic_channel: Handle HRR and the second transport params extension

When HRR happens a second client hello is sent and it consist of a
transport params extension. This must be processed and not cause
failure.

Fixes: https://github.com/openssl/project/issues/1296
Signed-off-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28115)

8 weeks agoquicapitest: Check if we can handle HRR
Norbert Pocs [Mon, 28 Jul 2025 08:32:53 +0000 (10:32 +0200)] 
quicapitest: Check if we can handle HRR

Signed-off-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28115)

8 weeks agoutil/analyze-contention-log.sh: print status output to stderr
Eugene Syromiatnikov [Tue, 8 Jul 2025 13:52:04 +0000 (15:52 +0200)] 
util/analyze-contention-log.sh: print status output to stderr

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27983)

8 weeks agocrypto/threads_pthread: rewrite contention data storage to per-tid
Eugene Syromiatnikov [Mon, 7 Jul 2025 14:03:09 +0000 (16:03 +0200)] 
crypto/threads_pthread: rewrite contention data storage to per-tid

This eliminates locking during writing out of the lock contation report
data, which claws back some of the lost performance degradation imposed
by the lock contention reporting instrumentation:

    [Without -DREPORT_RWLOCK_CONTENTION]
    ~/dev/perftools/source$ ./evp_fetch 100
    Average time per fetch call: 4.502162us
    ~/dev/perftools/source$ ./evp_fetch 200
    Average time per fetch call: 8.224920us

    [Before]
    ~/dev/perftools/source$ ./evp_fetch 100
    Average time per fetch call: 13.079795us
    ~/dev/perftools/source$ ./evp_fetch 200
    Average time per fetch call: 23.420235us

    [After]
    ~/dev/perftools/source$ ./evp_fetch 100
    Average time per fetch call: 6.557428us
    ~/dev/perftools/source$ ./evp_fetch 200
    Average time per fetch call: 13.415148us

The downside is that it produces a file for each TID, which floods
the working directory with debug files, but that mich be an acceptable
trade-off.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27983)

8 weeks agoutil/analyze-contention-log: call the bash interpreter with -eu flags
Eugene Syromiatnikov [Mon, 7 Jul 2025 14:13:24 +0000 (16:13 +0200)] 
util/analyze-contention-log: call the bash interpreter with -eu flags

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27983)

8 weeks agocrypto/threads_lock_contention: factor out lock contention recording
Eugene Syromiatnikov [Mon, 7 Jul 2025 13:42:07 +0000 (15:42 +0200)] 
crypto/threads_lock_contention: factor out lock contention recording

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27983)

8 weeks agocrypto/threads_lock_contention: factor out obtaining the stack traces data pointer
Eugene Syromiatnikov [Mon, 7 Jul 2025 13:28:11 +0000 (15:28 +0200)] 
crypto/threads_lock_contention: factor out obtaining the stack traces data pointer

It also drops the premature initalisation of it in
ossl_init_rwlock_contention_data(), deferring it to on-demand one
in ossl_rwlock_{rd,wr}lock(), which seems to shave some of the incurred
overhead:

    [Before]
    ~/dev/perftools/source$ ./evp_fetch 100
    Average time per fetch call: 16.944004us
    ~/dev/perftools/source$ ./evp_fetch 200
    Average time per fetch call: 26.325767us

    [After]
    ~/dev/perftools/source$ ./evp_fetch 100
    Average time per fetch call: 13.079795us
    ~/dev/perftools/source$ ./evp_fetch 200
    Average time per fetch call: 23.420235us

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27983)

8 weeks agocrypto/threads_lock_contention: condition file suffix on FIPS_MODULE and not fopen...
Eugene Syromiatnikov [Mon, 7 Jul 2025 13:15:44 +0000 (15:15 +0200)] 
crypto/threads_lock_contention: condition file suffix on FIPS_MODULE and not fopen() call

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27983)

8 weeks agocrypto/threads_lock_contention: typo: s/stack_info/stack_traces/ in ossl_init_rwlock_...
Eugene Syromiatnikov [Mon, 7 Jul 2025 13:14:31 +0000 (15:14 +0200)] 
crypto/threads_lock_contention: typo: s/stack_info/stack_traces/ in ossl_init_rwlock_contention_data

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27983)

8 weeks agocrypto/threads_lock_contention: Remove duplicating code
Eugene Syromiatnikov [Mon, 7 Jul 2025 13:00:17 +0000 (15:00 +0200)] 
crypto/threads_lock_contention: Remove duplicating code

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27983)

8 weeks agoFactor out the lock contention reporting facility implementation
Eugene Syromiatnikov [Mon, 7 Jul 2025 12:51:35 +0000 (14:51 +0200)] 
Factor out the lock contention reporting facility implementation

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27983)

8 weeks ago.github/workflows/run_quic_interop.yml: remove superfluous docker-compose.yml patching
Nikolas Gauder [Mon, 4 Aug 2025 20:23:33 +0000 (22:23 +0200)] 
.github/workflows/run_quic_interop.yml: remove superfluous docker-compose.yml patching

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28179)

8 weeks agobn: save space in bn_mont_ctx_st by reordering elements
Nikola Pajkovsky [Wed, 6 Aug 2025 09:58:57 +0000 (11:58 +0200)] 
bn: save space in bn_mont_ctx_st by reordering elements

 # pahole -C bn_mont_ctx_st ./crypto/bn/libcrypto-shlib-bn_mont.o

 struct bn_mont_ctx_st {
         int                        ri;                   /*     0     4 */

         /* XXX 4 bytes hole, try to pack */

         BIGNUM                     RR;                   /*     8    24 */
         BIGNUM                     N;                    /*    32    24 */
         BIGNUM                     Ni;                   /*    56    24 */
         /* --- cacheline 1 boundary (64 bytes) was 16 bytes ago --- */
         long unsigned int          n0[2];                /*    80    16 */
         int                        flags;                /*    96     4 */

         /* size: 104, cachelines: 2, members: 6 */
         /* sum members: 96, holes: 1, sum holes: 4 */
         /* padding: 4 */
         /* last cacheline: 40 bytes */
 };

 # pahole -C bn_mont_ctx_st ./crypto/bn/libcrypto-shlib-bn_mont.o

 struct bn_mont_ctx_st {
         BIGNUM                     RR;                   /*     0    24 */
         BIGNUM                     N;                    /*    24    24 */
         BIGNUM                     Ni;                   /*    48    24 */
         /* --- cacheline 1 boundary (64 bytes) was 8 bytes ago --- */
         long unsigned int          n0[2];                /*    72    16 */
         int                        ri;                   /*    88     4 */
         int                        flags;                /*    92     4 */

         /* size: 96, cachelines: 2, members: 6 */
         /* last cacheline: 32 bytes */
 };

8 bytes were saved.

Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28185)

8 weeks agoAdd mdebug config for coveralls on master branch
Neil Horman [Wed, 23 Jul 2025 15:52:03 +0000 (11:52 -0400)] 
Add mdebug config for coveralls on master branch

enable mdebug on coveralls for the master branch so that, when testing
we run our memory failure tests and pick up the extra test coverage

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28078)

8 weeks agoAdd a daily memory allocation failure test
Neil Horman [Wed, 23 Jul 2025 14:56:38 +0000 (10:56 -0400)] 
Add a daily memory allocation failure test

nightly, run the memory allocation failure test.

We build with asan enabled to log memory leaks and other issues

Note the test is designed to pass even if the test fails, as currently
(perhaps not suprisingly), several error paths result in asan errors.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28078)

8 weeks agoadd a handshake memory failure test
Neil Horman [Wed, 23 Jul 2025 13:09:05 +0000 (09:09 -0400)] 
add a handshake memory failure test

We would like to be able to test our memory failure paths, but forcing
malloc to return NULL at certain points in time.

This test does that, by running a sepcific workload n+1 time.  In this
case the workload is a simple ssl handshake.

We run 1 test which sets our malloc wrapper into record mode, in which
it just acts as a pass through to the system malloc call and records the
number of times it was called.

Then we run a second test, which does the same handshake N times, where
N is the number of times malloc was called in the previous test.  For
each iteration in i=0..N we fail the ith malloc operation.

We don't check for functional failures in the second test (as we expect
failures), we just want to make sure that (a) we don't crash and (b)
asan doesn't report any errors.

Currently, we get _lots_ of asan failures, but we can use this test to
log issues for that and fix those up.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28078)

8 weeks agossl/quic/quic_channel.c: Fix endianness of supported versions from received version...
Nikolas Gauder [Mon, 4 Aug 2025 21:47:23 +0000 (23:47 +0200)] 
ssl/quic/quic_channel.c: Fix endianness of supported versions from received version negotiation packets

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

8 weeks agossl/quic/quic_port.c: Fix endianness of supported versions in sent version negotiatio...
Nikolas Gauder [Mon, 4 Aug 2025 19:12:35 +0000 (21:12 +0200)] 
ssl/quic/quic_port.c: Fix endianness of supported versions in sent version negotiation packets

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

2 months agoImprove english in endian comment
Chiller Dragon [Mon, 4 Aug 2025 12:55:10 +0000 (14:55 +0200)] 
Improve english in endian comment

CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28167)

2 months agoEliminate indentation tabs from *.c and *.h files
Eugene Syromiatnikov [Sun, 3 Aug 2025 22:55:59 +0000 (00:55 +0200)] 
Eliminate indentation tabs from *.c and *.h files

While the majority of the sites assumed 8-wide tabs, at least engines/e_capi.c
assumed 4-wide;  in any case it is better to just follow the code style guide
and eliminate them altogether.  Some addition changes (namely, curly
brackets in apps/crl.c and apps/req.c, and additional whitespace changes
in apps/s_client.c and test/provider_pkey_test.c) are made to placate
check-format-commit.sh.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28162)

2 months agoutil/perl/OpenSSL/Test.pm: consistently use 4 spaces for indentation
Eugene Syromiatnikov [Mon, 21 Jul 2025 11:22:16 +0000 (13:22 +0200)] 
util/perl/OpenSSL/Test.pm: consistently use 4 spaces for indentation

While the majority of the file uses 4 spaces for indentation, some parts
contain 8-wide tabs.  Use the spaces for indentation consistently
throughout the file.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28162)

2 months agoshake: update to use generated param decoders
Pauli [Mon, 28 Jul 2025 07:15:25 +0000 (17:15 +1000)] 
shake: update to use generated param decoders

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28151)