]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
3 months agoAdd LMS public key decoder.
slontis [Mon, 30 Sep 2024 16:38:58 +0000 (02:38 +1000)] 
Add LMS public key decoder.

This uses OSSL_DECODER_CTX_new_for_pkey().
"XDR" can be specified for the input type, and the key type is "LMS"

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

3 months agoAdd base code to load a LMS public key.
slontis [Thu, 3 Oct 2024 01:16:15 +0000 (11:16 +1000)] 
Add base code to load a LMS public key.

This loads a XDR encoded LMS public key.
It adds a simple LMS keymanager to import this key.

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

3 months agoAdd Configurable "lms" option
slontis [Thu, 3 Oct 2024 01:10:01 +0000 (11:10 +1000)] 
Add Configurable "lms" option

This option will be used by the base code for enabling
Leighton-Micali Signatures (LMS)

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

3 months agoHKDF updates
Daniel Van Geest [Mon, 7 Apr 2025 11:21:47 +0000 (12:21 +0100)] 
HKDF updates

- prevent fixed-digest HKDF from having its digest changed
- implement gettable params in HKDF
- update fixed-digest HKDF tests

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

3 months agoAdd fixed-digest HKDF documentation
Daniel Van Geest [Fri, 4 Apr 2025 09:25:48 +0000 (10:25 +0100)] 
Add fixed-digest HKDF documentation

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

3 months agoAdd HKDF algorithms with fixed digests.
Daniel Van Geest [Thu, 3 Apr 2025 09:45:20 +0000 (10:45 +0100)] 
Add HKDF algorithms with fixed digests.

Add HKDF-SHA256, HKDF-SHA384 and HKDF-SHA512 which are versions
of HKDF that have the digest pre-set. The digest cannot be changed
for contexts of these types.

RFC 8619 defines algorithm identifiers for these combinations.
These algorithm identifiers will be used in future features, e.g.
KEMRecipientInfo.

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

3 months agoAddress coverity issue 1655295
Norbert Pocs [Tue, 8 Jul 2025 08:10:32 +0000 (10:10 +0200)] 
Address coverity issue 1655295

Fixes: https://github.com/openssl/project/issues/1267
Signed-off-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27989)

3 months agoAddress coverity issue 1655294
Norbert Pocs [Tue, 8 Jul 2025 08:05:00 +0000 (10:05 +0200)] 
Address coverity issue 1655294

Fixes: https://github.com/openssl/project/issues/1267
Signed-off-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27989)

3 months agoIntroduce SSL_OP_SERVER_PREFERENCE to replace SSL_OP_CIPHER_SERVER_PREFERENCE misnomer
Michael Baentsch [Mon, 7 Jul 2025 13:00:01 +0000 (15:00 +0200)] 
Introduce SSL_OP_SERVER_PREFERENCE to replace SSL_OP_CIPHER_SERVER_PREFERENCE misnomer

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

3 months agoFixup non-optional use of IO::Socket::IP
Neil Horman [Tue, 1 Jul 2025 18:19:17 +0000 (14:19 -0400)] 
Fixup non-optional use of IO::Socket::IP

IO::Socket::IP is an optionally used package in our perl scripts, and a
recent change of mine used it unilaterally, causing breakage on older
perl installations.  Fix it up to use it optionally again, falling back
to IO::Socket::INET when needed.

Fixes #27940

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

3 months agoUpdate rpki-client-portable to fix build
Theo Buehler [Wed, 9 Jul 2025 09:33:57 +0000 (11:33 +0200)] 
Update rpki-client-portable to fix build

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28004)

3 months agocrypto/slh_dsa/slh_hash.c: Add check for EVP_MD_get_size()
Jiasheng Jiang [Thu, 26 Jun 2025 00:58:51 +0000 (00:58 +0000)] 
crypto/slh_dsa/slh_hash.c: Add check for EVP_MD_get_size()

Add the check for the return value of EVP_MD_get_size() to avoid invalid size.

Fixes: 2f9e152d86 ("Add SLH_DSA signature verification.")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27900)

3 months agoSeparate public and private ML-KEM allocations
Daniel Frink [Mon, 9 Jun 2025 21:26:32 +0000 (16:26 -0500)] 
Separate public and private ML-KEM allocations

Previously, this change had grouped the public and private
portions of the ML-KEM key structure into one allocation that
was changed to use secure memory. There were concerns raised
that there may be use cases where storage of many ML-KEM public
keys may be necessary. Since the total secure memory size is configured
by the user, reduce the footprint of secure memory usage to
reduce the impact of these changes on users of these flows.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27625)

3 months agoUse secure memory allocation for ML-KEM and ML-DSA private key storage areas
Daniel Frink [Tue, 13 May 2025 20:27:05 +0000 (15:27 -0500)] 
Use secure memory allocation for ML-KEM and ML-DSA private key storage areas

Resolves: #27603

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27625)

3 months agoRISC-V: Provide optimized SM3 implementation using Zbb extension
Julian Zhu [Wed, 28 May 2025 05:24:24 +0000 (13:24 +0800)] 
RISC-V: Provide optimized SM3 implementation using Zbb extension

Signed-off-by: Julian Zhu <julian.oerv@isrc.iscas.ac.cn>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27709)

3 months agoAdd CI for backports to be run when respective branch label is set
Tomas Mraz [Wed, 2 Jul 2025 10:25:02 +0000 (12:25 +0200)] 
Add CI for backports to be run when respective branch label is set

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

3 months agoAdd .[ch].in files to ctags
Neil Horman [Fri, 4 Jul 2025 11:57:19 +0000 (07:57 -0400)] 
Add .[ch].in files to ctags

Pull in our templates for various c and h files for searching

Fixes #27966

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/27967)

3 months agoUpdate util/analyze-contention-log.sh
Neil Horman [Wed, 2 Jul 2025 11:03:36 +0000 (07:03 -0400)] 
Update util/analyze-contention-log.sh

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

3 months agoAdd lock contention log analyzer
Neil Horman [Thu, 26 Jun 2025 17:38:43 +0000 (13:38 -0400)] 
Add lock contention log analyzer

With the introduction of REPORT_RWLOCK_CONTENTION, it would be nice
if we could do some quick analysis on it.

This script parses the log, and generates a histogram of lock contention
events, uniquely identified by the stack trace that caused it, and
prints out all unique latency event, sorted from largest (as measured
by cumulative latency in that path).

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

4 months agoFix some conversion from size_t to const int errors
Matt Caswell [Thu, 3 Jul 2025 13:45:09 +0000 (14:45 +0100)] 
Fix some conversion from size_t to const int errors

When #27806 was merged these fixes were missed

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27960)

4 months agoThe check-ansi job is failing in the openssl-3.5 branch as a result of commit 60775e3...
Daniel Van Geest [Tue, 1 Jul 2025 20:57:57 +0000 (21:57 +0100)] 
The check-ansi job is failing in the openssl-3.5 branch as a result of commit 60775e3. Fix that.

I guess this job doesn't run on PRs in master?

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27944)

(cherry picked from commit 96fa08c6a521b30da54b9b5847bf4a62ee46acab)

4 months agoExtend create_accept_stream test
Andrew Dinh [Mon, 30 Jun 2025 15:21:48 +0000 (22:21 +0700)] 
Extend create_accept_stream test

- Create more options for creating server-initiated
- Check that correct stream is accepted with SSL_get_stream_type

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

4 months agoAdd test for SSL_accept_stream
Andrew Dinh [Thu, 26 Jun 2025 15:37:18 +0000 (22:37 +0700)] 
Add test for SSL_accept_stream

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

4 months agoAdd stream type flags to SSL_accept_stream
Andrew Dinh [Tue, 24 Jun 2025 12:26:38 +0000 (19:26 +0700)] 
Add stream type flags to SSL_accept_stream

Introduces SSL_ACCEPT_STREAM_UNI and SSL_ACCEPT_STREAM_BIDI flags to SSL_accept_stream, allowing callers to specify whether to accept only unidirectional or bidirectional streams. Returns the first of its type from the queue

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

4 months agoRemove need for BN_BLINDING lock
Neil Horman [Wed, 25 Jun 2025 18:26:24 +0000 (14:26 -0400)] 
Remove need for BN_BLINDING lock

Issue https://github.com/openssl/project/issues/1245 has identified that
we encounter a significant amount of time waiting to acquire the
BN_BLINDING_lock when running our handshake perf test with 10 threads
using an rsa key.  Specifically, with 10 threads we spend about 19327731
usecs just waiting.  So it would be great if we could eliminate the need
to get the write lock here.

Currently, the need for the lock is based off the fact that each rsa key
has only a single blinding pointer, for which exclusive access is
needed, with an attempt to use a fallback mt_blinding pointer in the
shared case.  If a key is shared by many threads, then we find ourselves
needing to maniuplate this lock quite frequently if we are doing lots of
ssl connections.

To address this, I've come up with this approach.  It replaces the
blinding pointer with a pointer to a sparse array.  The sparse array is
then indexed by thread id.  This allows us to do two things:

When getting the blinding, we only need to take the read lock in the
common case when looking up this threads blinding structure.  Only in
the first lookup for any thread do we need to take the write side lock
when updating the table, and only then for a very brief critical section
(i.e. we don't need to hold the lock when allocating/setting the
blinding up via RSA_setup_blinding

This trades off some extra memory usage for the above significant
reduction in execution time.

it also allows us to simplify the blinding code quite a bit by
eliminating the need to handle shared blindings because blindings are
never shared anymore

Fixes openssl/project#1245

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

4 months agodemos: Silence warnings on Win64 builds
Tomas Mraz [Thu, 19 Jun 2025 08:12:13 +0000 (10:12 +0200)] 
demos: Silence warnings on Win64 builds

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

4 months agoCI: Enable strict warnings on all Windows CI builds
Tomas Mraz [Wed, 18 Jun 2025 16:45:24 +0000 (18:45 +0200)] 
CI: Enable strict warnings on all Windows CI builds

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

4 months agotest: Silence warnings on Win64 builds
Tomas Mraz [Wed, 18 Jun 2025 09:59:04 +0000 (11:59 +0200)] 
test: Silence warnings on Win64 builds

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

4 months agofuzz: Silence warnings on Win64 builds
Tomas Mraz [Wed, 18 Jun 2025 08:50:27 +0000 (10:50 +0200)] 
fuzz: Silence warnings on Win64 builds

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

4 months agoapps: Silence warnings on Win64 builds
Tomas Mraz [Tue, 17 Jun 2025 18:08:49 +0000 (20:08 +0200)] 
apps: Silence warnings on Win64 builds

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

4 months agoengines: Silence warnings on Win64 builds
Tomas Mraz [Tue, 17 Jun 2025 17:37:05 +0000 (19:37 +0200)] 
engines: Silence warnings on Win64 builds

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

4 months agolibssl: Silence warnings on Win64 builds
Tomas Mraz [Tue, 17 Jun 2025 09:13:35 +0000 (11:13 +0200)] 
libssl: Silence warnings on Win64 builds

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

4 months agoproviders: Silence warnings on Win64 builds
Tomas Mraz [Wed, 11 Jun 2025 11:47:38 +0000 (13:47 +0200)] 
providers: Silence warnings on Win64 builds

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

4 months agolibapps + libcrypto: Silence warnings on Win64 builds
Tomas Mraz [Wed, 11 Jun 2025 08:48:01 +0000 (10:48 +0200)] 
libapps + libcrypto: Silence warnings on Win64 builds

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

4 months agoRemove accidentally left debug statements from ec.c
Chris [Sat, 28 Jun 2025 10:49:11 +0000 (20:49 +1000)] 
Remove accidentally left debug statements from ec.c

CLA: trivial

- Cleaned up hardcoded debug statements that were inadvertently
  left in the open source distribution
- No functional changes to the EC key processing logic

Reviewed-by: Neil Horman <nhorman@openssl.org>
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/27921)

4 months agotest/quic-openssl-docker/hq-interop/quic-hq-interop.c: Add check for OPENSSL_zalloc()
Jiasheng Jiang [Thu, 26 Jun 2025 19:23:42 +0000 (19:23 +0000)] 
test/quic-openssl-docker/hq-interop/quic-hq-interop.c: Add check for OPENSSL_zalloc()

Add check for the return value of OPENSSL_zalloc() to avoid potential NULL pointer dereference.

Fixes: 2858149e44 ("Adding an hq-interop alpn client")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27915)

4 months agotest/quic_multistream_test.c: Add OPENSSL_free() to avoid memory leak
Jiasheng Jiang [Thu, 26 Jun 2025 19:07:39 +0000 (19:07 +0000)] 
test/quic_multistream_test.c: Add OPENSSL_free() to avoid memory leak

Add OPENSSL_free() to free bdata if an error occurs to avoid memory leak.

Fixes: a55b689499 ("Use reported short conn id len in qtestlib")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27914)

4 months agoapps/openssl.c: Add OPENSSL_free() to avoid memory leak
Jiasheng Jiang [Thu, 26 Jun 2025 17:00:55 +0000 (17:00 +0000)] 
apps/openssl.c: Add OPENSSL_free() to avoid memory leak

Add OPENSSL_free() to release trace_data if trace_data is not NULL but other errors occur to avoid memory leak.

Fixes: 682b444f8a ("apps/openssl.c: Adapt to enable tracing output")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27911)

4 months agoRemove unused data from self test.
slontis [Thu, 26 Jun 2025 03:19:59 +0000 (13:19 +1000)] 
Remove unused data from self test.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27902)

4 months agoUpdate FIPS provider doc to match the current code.
slontis [Thu, 26 Jun 2025 03:18:18 +0000 (13:18 +1000)] 
Update FIPS provider doc to match the current code.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27902)

4 months agotest/bio_pw_callback_test.c: Add BIO_free() to avoid memory leak
Jiasheng Jiang [Wed, 25 Jun 2025 19:22:30 +0000 (19:22 +0000)] 
test/bio_pw_callback_test.c: Add BIO_free() to avoid memory leak

Add BIO_free() if PEM_read_bio_PrivateKey fails to avoid memory leak.

Fixes: fa6ae88a47 ("Add test for BIO password callback functionality")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27898)

4 months agodemos/cms/cms_denc.c: Add check for BIO_new_file()
Jiasheng Jiang [Wed, 25 Jun 2025 23:06:59 +0000 (23:06 +0000)] 
demos/cms/cms_denc.c: Add check for BIO_new_file()

Add check for the return value of BIO_new_file().

Fixes: 1728756 ("Detached encrypt/decrypt example, fix decrypt sample.")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27897)

4 months agodemos/cms/cms_ddec.c: Replace "in" with "dcont" to correctly check the success of...
Jiasheng Jiang [Fri, 27 Jun 2025 15:59:13 +0000 (15:59 +0000)] 
demos/cms/cms_ddec.c: Replace "in" with "dcont" to correctly check the success of BIO_new_file()

Replace "in" with "dcont" to properly check the return value of BIO_new_file().

Fixes: 1728756 ("Detached encrypt/decrypt example, fix decrypt sample.")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27896)

4 months agoapps/lib/apps.c: Add check for BIO_new()
Jiasheng Jiang [Thu, 26 Jun 2025 00:01:35 +0000 (00:01 +0000)] 
apps/lib/apps.c: Add check for BIO_new()

Add checks for the return value of BIO_new() to guarantee successful
allocation, consistent with other usages.

Fixes: a412b89 ("dup_bio_* and bio_open_* are utility functions and belong in apps.c")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27894)

4 months agoFix internal documentation of ossl_namemap_num2name()
Tomas Mraz [Wed, 25 Jun 2025 10:21:53 +0000 (12:21 +0200)] 
Fix internal documentation of ossl_namemap_num2name()

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/27889)

4 months agodecoders: Fix prioritization of decoders via property query
Daniel Van Geest [Mon, 23 Jun 2025 11:45:59 +0000 (12:45 +0100)] 
decoders: Fix prioritization of decoders via property query

When a property query string was used, it was not being applied to decoders.
When multiple providers supporting the same algorithm were loaded, it was
undefined which provider would be used when decoding a key, even when a
propquery string was provided.  This fix scores decoder instances based on
property query matching and selects the highest scored decoder instance when
building the decoder chain.

The fake_rsa test provider is updated to support basic encoding and decoding.
A test is added using the fake_rsa provider to ensure that property query
strings are respected when loading decoders.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27876)

4 months agoIntroduce cms kekcipher option to select cipher for pwri
Jakub Zelenka [Thu, 6 Feb 2025 18:07:28 +0000 (19:07 +0100)] 
Introduce cms kekcipher option to select cipher for pwri

This is useful for AEAD ciphers where it is not possible to use AEAD
cipher (currently only AES GCM supported) for password recipient info
because the same cipher is used for encrypting the password and it is
not possible to store tag for this purpose so different cipher (e.g.
AES CBC) needs to be selected.

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

4 months agoCHANGES.md / NEWS.md fixups ahead of release
Neil Horman [Tue, 1 Jul 2025 11:21:56 +0000 (07:21 -0400)] 
CHANGES.md / NEWS.md fixups ahead of release

Release: yes

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

4 months agoFixes #27831: Decreased NAMEMAP_HT_BUCKETS to 512.
INDIA\kanagavels [Wed, 18 Jun 2025 13:12:54 +0000 (18:42 +0530)] 
Fixes #27831: Decreased NAMEMAP_HT_BUCKETS to 512.

Decreased the NAMEMAP_HT_BUCKETS value to 512, to avoid memory
allocation fail issues.

CLA: Trivial

Signed-off-by: Kanagavel S <kanagavels@ami.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27850)

4 months agofix: msg callback in dtls1_do_write that incorrectly shows message (like a certificat...
noctuelles [Thu, 29 May 2025 19:01:21 +0000 (21:01 +0200)] 
fix: msg callback in dtls1_do_write that incorrectly shows message (like a certificate) that spans over multiple fragments.

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27811)

4 months agoFix nullpointer dereference in OSSL_PARAM_merge
Christian Vögl [Thu, 26 Jun 2025 16:37:37 +0000 (18:37 +0200)] 
Fix nullpointer dereference in OSSL_PARAM_merge

OSSL_PARAM_merge contained an error, where a nullpointer was
dereferenced when both parameter arrays ended with the same key

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

4 months agoEnforce permissions 0600 for SSLKEYLOGFILE
Dmitry Belyavskiy [Wed, 25 Jun 2025 14:41:30 +0000 (16:41 +0200)] 
Enforce permissions 0600 for SSLKEYLOGFILE

Fixes #27890

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

4 months agoBetter lookup for openssl executable
Dmitry Belyavskiy [Wed, 25 Jun 2025 15:33:16 +0000 (17:33 +0200)] 
Better lookup for openssl executable

Fixes #27891

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/27895)

4 months agospeed: Increase MAX_SIG_NUM and fix its usage in loopargs_t fields
Ingo Franzki [Mon, 23 Jun 2025 11:42:08 +0000 (13:42 +0200)] 
speed: Increase MAX_SIG_NUM and fix its usage in loopargs_t fields

Increase the maximum number of signature algorithms.

With the introduction of the SignMessage and VerifyMessage API with
OpenSSL 3.4 the providers that support combined digest and sign algorithms
register quite a lot more signature algorithms, so the current limit of
111 is hit easily.

While at it correct the definitions of the signature fields within the
loopargs_t structure to use MAX_SIG_NUM instead of MAX_KEM_NUM.

Closes: https://github.com/openssl/openssl/issues/27873
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27878)

4 months agotest/build.info: minimize use of static libcrypto.a and libssl.a
Dr. David von Oheimb [Mon, 23 Jun 2025 13:59:24 +0000 (15:59 +0200)] 
test/build.info: minimize use of static libcrypto.a and libssl.a

Fixes #27874

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/27881)

4 months agoeddsa: convert to using struct based TRIE decoder for params processing
Pauli [Fri, 20 Jun 2025 02:37:56 +0000 (12:37 +1000)] 
eddsa: convert to using struct based TRIE decoder for params processing

Also return correct param list for the variant settables.

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

4 months agoupdate build infrastructure to support generated eddsa_sig.c
Pauli [Fri, 20 Jun 2025 02:37:29 +0000 (12:37 +1000)] 
update build infrastructure to support generated eddsa_sig.c

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

4 months agorename eddsa_sig.c for autogeneration
Pauli [Fri, 20 Jun 2025 02:17:22 +0000 (12:17 +1000)] 
rename eddsa_sig.c for autogeneration

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

4 months agoeddsa: remove impossible parameters from gettable array
Pauli [Fri, 20 Jun 2025 02:14:24 +0000 (12:14 +1000)] 
eddsa: remove impossible parameters from gettable array

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

4 months agodigest: convert algorithm gettable parameters to use struct based TRIE decoding
Pauli [Fri, 20 Jun 2025 02:08:13 +0000 (12:08 +1000)] 
digest: convert algorithm gettable parameters to use struct based TRIE decoding

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

4 months agoupdate build infrastructure for digestcommon.c.in
Pauli [Fri, 20 Jun 2025 02:08:08 +0000 (12:08 +1000)] 
update build infrastructure for digestcommon.c.in

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

4 months agomlx: use TRIE & struct based param decoding
Pauli [Fri, 20 Jun 2025 01:29:00 +0000 (11:29 +1000)] 
mlx: use TRIE & struct based param decoding

Also fix two bugs with the properties parameter to the set_params call:
- the parameter wasn't listed in the settables table
- the parameter was ignored unless there was a public key present

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

4 months agoupdate build instructions for mlx key management
Pauli [Thu, 19 Jun 2025 05:08:17 +0000 (15:08 +1000)] 
update build instructions for mlx key management

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

4 months agorename mlx_kmgmt.c to mlx_kmgmt.c.in
Pauli [Thu, 19 Jun 2025 05:08:01 +0000 (15:08 +1000)] 
rename mlx_kmgmt.c to mlx_kmgmt.c.in

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

4 months agoml-dsa: use TRIE & struct based param name decoders
Pauli [Thu, 19 Jun 2025 03:45:14 +0000 (13:45 +1000)] 
ml-dsa: use TRIE & struct based param name decoders

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

4 months agobuild infrastructure updates for ml_dsa signatures
Pauli [Thu, 19 Jun 2025 03:44:50 +0000 (13:44 +1000)] 
build infrastructure updates for ml_dsa signatures

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

4 months agorename ml_dsa_sig.c to ml_dsa_sig.c.in
Pauli [Thu, 19 Jun 2025 03:44:27 +0000 (13:44 +1000)] 
rename ml_dsa_sig.c to ml_dsa_sig.c.in

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

4 months agocipher: use table based param decoding for ciphers
Pauli [Thu, 19 Jun 2025 01:40:46 +0000 (11:40 +1000)] 
cipher: use table based param decoding for ciphers

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

4 months agocipher: declare common OSSL_PARAM structures and helper functions
Pauli [Thu, 19 Jun 2025 01:40:16 +0000 (11:40 +1000)] 
cipher: declare common OSSL_PARAM structures and helper functions

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

4 months agoparamnams: add new line to break long function declaration
Pauli [Thu, 19 Jun 2025 01:39:43 +0000 (11:39 +1000)] 
paramnams: add new line to break long function declaration

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

4 months ago3des: remove redundant OSSL_PARAMs from settable list
Pauli [Thu, 19 Jun 2025 00:07:40 +0000 (10:07 +1000)] 
3des: remove redundant OSSL_PARAMs from settable list

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

4 months agoinit_master_key(): Check return of CRYPTO_THREAD_init_local()
Tomas Mraz [Mon, 23 Jun 2025 12:49:11 +0000 (14:49 +0200)] 
init_master_key(): Check return of CRYPTO_THREAD_init_local()

Fixes Coverity 1649566

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27880)

4 months agoevp_extra_test2.c: Fix doublefree of PKEY and leak of RSA
Tomas Mraz [Mon, 23 Jun 2025 12:41:38 +0000 (14:41 +0200)] 
evp_extra_test2.c: Fix doublefree of PKEY and leak of RSA

Fixes Coverity 1649567

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27880)

4 months agoNit: macro parameters should always be parenthesised in expressions
Richard Levitte [Fri, 20 Jun 2025 12:29:04 +0000 (14:29 +0200)] 
Nit: macro parameters should always be parenthesised in expressions

Affected macros: ossl_likely and ossl_unlikely

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

4 months agoFix exit code for s_time when -new command line switch specified
Neil Horman [Thu, 19 Jun 2025 16:38:41 +0000 (12:38 -0400)] 
Fix exit code for s_time when -new command line switch specified

When operating with the -new switch in apps/openssl s_time, we neglect
to set the exit code properly, and so the app exits with a code of 1
rather than 0 as expected

Fixes #27856

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27857)

4 months agoClean up thread_local function names in initthread.c
Neil Horman [Thu, 19 Jun 2025 13:52:07 +0000 (09:52 -0400)] 
Clean up thread_local function names in initthread.c

The naming of the thread-local management functions in initthread.c is a
bit...much.  init_manage_thread_local/init_fetch_clear_thread_local, etc
are better written as just manage_thread_local/clear_thread_local/etc.

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

4 months agoRefactor init_get_thread_local to be more understandable
Neil Horman [Wed, 18 Jun 2025 15:16:47 +0000 (11:16 -0400)] 
Refactor init_get_thread_local to be more understandable

We currently have a single function that does thread_local key
allocation/cleanup/fetching for our OSSL_init_thread_start/stop apis,
and its pretty confusing.  Wrap it up in some helper functions to make
it more clear at the call sites what we're trying to do.

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

4 months agoRestore use of crypto_thread_default_context
Neil Horman [Wed, 18 Jun 2025 11:33:47 +0000 (07:33 -0400)] 
Restore use of crypto_thread_default_context

This thread-local key isn't per thread*context, and is potentially in a
hot path for users of openssl that switch their default contexts
regularly, so lets leave it as an OS level key, rather than a library
managed key.

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

4 months agoFix fips cleanup of master key
Neil Horman [Tue, 17 Jun 2025 17:32:44 +0000 (13:32 -0400)] 
Fix fips cleanup of master key

With the conversion to a fixed array, we can no longer just clean the
top level sparse array, as we don't enjoy the NULL check within the
sa_doall loop.

Add a NULL check in the fips cleanup routine to make up for this

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

4 months agoAllow for differentiating between default and NULL context
Neil Horman [Tue, 17 Jun 2025 15:49:54 +0000 (11:49 -0400)] 
Allow for differentiating between default and NULL context

Allow for use of default context in the thread-local api by using
get_concrete

This creates a problem however in that get_concrete access a
thread-local api, creating a recursive call that exhausts stack space

So create a special context token that identifys the no context use case
when we want to store thread-local data without an explicit context
index

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

4 months agoCheck setting of master key value
Neil Horman [Tue, 17 Jun 2025 14:53:58 +0000 (10:53 -0400)] 
Check setting of master key value

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

4 months agoreduce memory overhead of CTX_TABLE_ENTRY
Neil Horman [Tue, 17 Jun 2025 14:18:20 +0000 (10:18 -0400)] 
reduce memory overhead of CTX_TABLE_ENTRY

We don't need to allocate entries for the ctx table.  we can just make
it a sparse array of void* values, and set the thread-local data
directly.  This saves on allocation and cleanup costs

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

4 months agoconvert master_key to use a top level fixed array
Neil Horman [Tue, 17 Jun 2025 12:52:23 +0000 (08:52 -0400)] 
convert master_key to use a top level fixed array

Since we have a pre-defined list of keys, save some computation time
by just looking up by index rather than via a sparse array

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

4 months agoMove the async-job api to use the new thread-local api
Neil Horman [Thu, 12 Jun 2025 17:17:34 +0000 (13:17 -0400)] 
Move the async-job api to use the new thread-local api

Make the async-job api use our new thread-local storage api.  Not
strictly needed, but reduces our OS level key usage

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

4 months agoUpdate ERR lib to use new thread-local storage api
Neil Horman [Thu, 12 Jun 2025 17:16:10 +0000 (13:16 -0400)] 
Update ERR lib to use new thread-local storage api

Move the err lib to use the new thread-local storage api.  This isn't
strictly needed, as each thread uses the same key for each context, but
it does reduce our Os level key count.

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

4 months agoMove thread-event handlers to the new thread-local api
Neil Horman [Thu, 12 Jun 2025 17:18:41 +0000 (13:18 -0400)] 
Move thread-event handlers to the new thread-local api

Thread event handlers in the fips provider create a thread-local storage
key per context, meaning we can exhaust our thread-local space quickly
by creating lots of contexts.  Avoid that by moving to the new
thread-local storage api.

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

4 months agoAdjust rand_lib to use new thread-local mgmt api
Neil Horman [Thu, 12 Jun 2025 17:14:47 +0000 (13:14 -0400)] 
Adjust rand_lib to use new thread-local mgmt api

Rand instances create a thread-local storage key per context, so we need
to move them to the new api to avoid exhausting our thread-local storage
space at the Os level

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

4 months agoupdate RCU to use the new thread-local key mgmt api
Neil Horman [Thu, 12 Jun 2025 17:12:14 +0000 (13:12 -0400)] 
update RCU to use the new thread-local key mgmt api

RCU stores a per-thread local structure per context-thread, making it
necessecary to move them to the new api to avoid exhausting our OS level
thread-local storage resources when creating lots of contexts

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

4 months agoAdd new CRYPTO_THREAD_[get|set]_local_ex api
Neil Horman [Thu, 12 Jun 2025 17:09:56 +0000 (13:09 -0400)] 
Add new CRYPTO_THREAD_[get|set]_local_ex api

As opposed to CRYPTO_THREAD_[get|set]_local counterparts

These api use an ennumerated set of fixed key ids, that allow for
thread-local storage indexed by key AND libctx value.  They also store
this data against a single OS level thread-local key, reducing the
amount of (limited) thread-local key storage space we use

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

4 months agoAdd return check to BIO_new, SSL_CTX_new and EVP_PKEY_new
icy17 [Mon, 16 Jun 2025 04:12:57 +0000 (12:12 +0800)] 
Add return check to BIO_new, SSL_CTX_new and EVP_PKEY_new

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

4 months agofix: difference between parameter name between doc and header file.
noctuelles [Sun, 15 Jun 2025 09:57:00 +0000 (11:57 +0200)] 
fix: difference between parameter name between doc and header file.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27828)

4 months agoSkip CI jobs for custom runners in forks
Vladimír Chlup [Fri, 13 Jun 2025 09:16:39 +0000 (11:16 +0200)] 
Skip CI jobs for custom runners in forks

These usualy timeout in 24 hours because custom runners are not
available

Fixes: #27818
CLA: trivial

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27819)

4 months agoFix buggy stringop-overflow error on s390
Neil Horman [Fri, 20 Jun 2025 14:22:10 +0000 (10:22 -0400)] 
Fix buggy stringop-overflow error on s390

Despite some recent changes to our s390 builds, we're still seeing
errors due to some stringop-overflow warnings:
https://github.com/openssl/openssl/actions/runs/15748518222/job/44389197443

It appears to be caused because the static analysis that gcc preforms in
gcc 12 (the version of the compiler on our s390 runner), fails to infer
the proper sizes of the buffer on which we do the reverse memcpy in
swap_copy(), resulting in warnings, which on --strict-warnings builds,
breaks us.

Fix it by using inlen rather than outlen to limit the copy length,
adjusting it if need be to match the size of the output buffer in
le_copy().  This allows the compiler to properly infer the array length
constraints and suppress the warnings.

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

4 months agoAdd params precondition in ASN1_STRING_TABLE_add, ASN1_STRING_TABLE_get
JohnnySavages [Sun, 25 May 2025 12:52:53 +0000 (08:52 -0400)] 
Add params precondition in ASN1_STRING_TABLE_add, ASN1_STRING_TABLE_get

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

4 months agoPreserve connection custom extensions in SSL_set_SSL_CTX()
Sergey Kandaurov [Wed, 28 May 2025 17:58:26 +0000 (21:58 +0400)] 
Preserve connection custom extensions in SSL_set_SSL_CTX()

The SSL_set_SSL_CTX() function is used to switch SSL contexts for
the given SSL object.  If contexts differ, this includes updating
a cert structure with custom extensions from the new context.  This
however overwrites connection custom extensions previously set on
top of inherited from the old context.

The fix is to preserve connection custom extensions using a newly
introduced flag SSL_EXT_FLAG_CONN in custom_ext_copy_conn().
Similar to custom_ext_copy(), it is a no-op if there are no custom
extensions to copy.

The only such consumer is ossl_quic_tls_configure() used to set the
"quic_transport_parameters" extension.  Before this change, context
switch resulted in transport parameters not being sent due to the
missing extension.

Initially reported at https://github.com/nginx/nginx/issues/711

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

4 months agoAdd a helper function to copy custom extensions with old style arguments
Sergey Kandaurov [Tue, 27 May 2025 19:01:40 +0000 (23:01 +0400)] 
Add a helper function to copy custom extensions with old style arguments

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

4 months agoThe comment should refer `ossl_quic_stream_has_recv_buffer()`
sashan [Fri, 18 Apr 2025 17:44:51 +0000 (19:44 +0200)] 
The comment should refer `ossl_quic_stream_has_recv_buffer()`
and `ossl_quic_stream_has_send_buffer()` explicitly.

This small tweak allows to find those functions more easily.

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

4 months agoUpdate pkeyutl documentation for PQC algorithms (Fixes #27415)
Samson S. Kolge [Thu, 17 Apr 2025 15:54:27 +0000 (21:24 +0530)] 
Update pkeyutl documentation for PQC algorithms (Fixes #27415)

Add examples and documentation for using ML-DSA, ML-KEM, and SLH-DSA algorithms with pkeyutl. This includes information about the context-string option for ML-DSA and examples of encapsulation/decapsulation with ML-KEM.

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

4 months agoAvoid potential double close of client_skt in sslecho
Levi Zim [Wed, 16 Apr 2025 06:21:33 +0000 (14:21 +0800)] 
Avoid potential double close of client_skt in sslecho

The server_running variable is declared as volatile and some comments in
the code are mentioning about implementing CTRL+C handler in the future.

In the client handling loop, the client_skt is closed at the end of the
loop if server_running is true. If (future) CTRL+C handler changes
server_running to false at this time. The next accept will not happen
and the exit clean up code will close client_skt for the second time.

This patch fixes this potential double close by setting client_skt back
to -1 after closing it.

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

4 months agoAdd a target to generate local coverage reports
Neil Horman [Mon, 16 Jun 2025 22:46:58 +0000 (18:46 -0400)] 
Add a target to generate local coverage reports

Add a target to allow developers to generate coverage reports for a
build like coveralls does.  This will let us identify rarely used
branches when doing development, so that we can optimize them.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27839)