39780 Commits

Author SHA1 Message Date
Norbert Pocs 2d349da141 Merge .inc files with header
When the .inc is only used once, include the file at place.

Signed-off-by: Norbert Pocs <norbertp@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu May  7 19:30:01 2026
(Merged from https://github.com/openssl/openssl/pull/31075)
2026-05-07 15:28:44 -04:00
Bob Beck 4dca3082f8 Fix potential UB memcmps in obj_dat.c
By calling the real OBJ_cmp

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu May  7 18:14:54 2026
(Merged from https://github.com/openssl/openssl/pull/31048)
2026-05-07 14:14:45 -04:00
Bob Beck 945cc69f54 Add a test for a bogus SMTPUTF8 name constraint in a cert.
We will reject these.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu May  7 16:09:48 2026
(Merged from https://github.com/openssl/openssl/pull/30329)
2026-05-07 12:09:34 -04:00
Bob Beck 3eab35f175 Forbid GEN_OTHERNAME SMTP UTF8 email name constraints.
RFC 9598 States:

Certificate Authorities that wish to issue CA certificates with email
address name constraints MUST use rfc822Name subject alternative names
only. These MUST be IDNA2008-conformant names with no mappings and with
non-ASCII domains encoded in A-labels only.

This appears to be to get around the confusion created if someone
attempts to encode a name constraint for an email address into the
UTF-8 version of the name

Were someone to attempt to support this, not only would you now have
to check two separate sets of name constraints for the same thing, but
would now have to decide what to do if they said different things.

So we just flag any such certficiate as invalid

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu May  7 16:09:44 2026
(Merged from https://github.com/openssl/openssl/pull/30329)
2026-05-07 12:09:34 -04:00
Bob Beck c8676d939e Update crypto/objects/obj_dat.pl
Co-authored-by: Matt Caswell <matt@openssl.foundation>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu May  7 15:41:15 2026
(Merged from https://github.com/openssl/openssl/pull/31046)
2026-05-07 11:41:04 -04:00
Bob Beck 33a065a0b7 Don't rely on cmp of uninitialized values in obj_dat.pl
Since we use this for a sort, in theory this could become
inconsistent if we were to do a make update, re-generate
the output, and check it in from a different development
platform that returns different inconsistencies in how
cmp behaves on uninitialized values.

Rather than ponder this, just make this consistent
by ensuring undefined values have 0 length, and remove
the disabling of the warnings in obj_cmp

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu May  7 15:41:12 2026
(Merged from https://github.com/openssl/openssl/pull/31046)
2026-05-07 11:41:04 -04:00
Tomas Mraz 00fba2aca4 The tag value must fit into int
We cannot allow an unbounded tag value as this is an O(n^2) algorithm
and the tag cannot be larger than INT_MAX anyway.
Fixes 35852da1d9

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Simo Sorce <simo@redhat.com>
MergeDate: Thu May  7 12:12:25 2026
(Merged from https://github.com/openssl/openssl/pull/31091)
2026-05-07 14:11:41 +02:00
Jakub Zelenka 18924ab837 Add coverage files clean up make targets
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu May  7 07:09:02 2026
(Merged from https://github.com/openssl/openssl/pull/31071)
2026-05-07 09:08:47 +02:00
Moryakhin Stas 5b9f03c0f4 Add /MTd build for debug configuration for VC-noCE-common
Fixes #30936

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed May  6 19:17:18 2026
(Merged from https://github.com/openssl/openssl/pull/31073)
2026-05-06 21:17:12 +02:00
Abel Tom 6fa2e0fe74 Fixes #30966: return value for certain cases in EVP_cipher_get_type
The function previously returned `NID_des_cfb64` even when nid of the
passed cipher was NID_des_ede3_cfb64, NID_des_ede3_cfb8,
NID_des_ede3_cfb1.

Corrected now to return `NID_des_ede3_cfb64`.

Added an extra test to verify the change.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed May  6 18:58:09 2026
(Merged from https://github.com/openssl/openssl/pull/30977)
2026-05-06 20:58:08 +02:00
GGAutomaton 840ceecbd6 test: reinitialize buffer length in test_EVP_SM2
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed May  6 16:51:02 2026
(Merged from https://github.com/openssl/openssl/pull/30614)
2026-05-06 18:50:27 +02:00
GGAutomaton 8d165eb843 sm2: check buffer size before writing ciphertext
The SM2 encryption may write past the caller-provided output buffer
when the required ciphertext size exceeds the supplied buffer length.

Reject outputs that do not fit in the caller-provided buffer.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed May  6 16:51:00 2026
(Merged from https://github.com/openssl/openssl/pull/30614)
2026-05-06 18:50:27 +02:00
Igor Ustinov 53cf8b97ba Moved the EVP_EC_gen macro to evp.h
Also fixed the potential NULL pointer dereference in this macro.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed May  6 16:47:58 2026
(Merged from https://github.com/openssl/openssl/pull/30597)
2026-05-06 18:47:24 +02:00
Igor Ustinov e6fe06a719 Added the EVP_EC_affine2oct() helper function
This function converts affine coordinates of an EC point
to an octet string conforming to Sec. 2.3.4
of the SECG SEC 1 ("Elliptic Curve Cryptography") standard.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed May  6 16:47:57 2026
(Merged from https://github.com/openssl/openssl/pull/30597)
2026-05-06 18:46:51 +02:00
Igor Ustinov 18472994f0 The EVP_PKEY_Q_keygen function now explicitly handles NULL curve name
It errors out with ERR_R_PASSED_NULL_PARAMETER in such case.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed May  6 16:47:55 2026
(Merged from https://github.com/openssl/openssl/pull/30597)
2026-05-06 18:45:40 +02:00
Bob Beck ce22d29f5f Allow 0 length comparisons in OBJ_CMP to return 0 without UB memcmp
X509_verify is documented to return -1 if the algorithm is invalid
or can't be compared for any reason.

Sadly this implies that it is legitimate to pass it an incorrect X509
object and it should see this. If we hand it a new X509 object with
nothing filled in, it will memcmp(NULL...) at the end of a stack of
FOO_cmp abstractions, which is UB.

Fix this by permitting the 0 length case to return equal without
a memcmp, as suggested by slontis@ and botovq@

Fixes: https://github.com/openssl/openssl/issues/30922

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed May  6 14:55:20 2026
(Merged from https://github.com/openssl/openssl/pull/30943)
2026-05-06 10:55:07 -04:00
kovan bd85fd7cde doc: add documentation for BIO_nread0, BIO_nread, BIO_nwrite0, BIO_nwrite
Document the non-copying interface functions for BIO pairs that allow
direct access to the internal buffer:
- BIO_nread0/BIO_nread for zero-copy reading
- BIO_nwrite0/BIO_nwrite for zero-copy writing

Also add return value documentation for these functions and remove
the placeholder "[XXXXX: More return values need to be added here]".

Fixes #16366

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed May  6 14:51:27 2026
(Merged from https://github.com/openssl/openssl/pull/29849)
2026-05-06 16:50:52 +02:00
Nyveruus c5908ee434 Fix missing pointers in SSL_CTX_set_session_cache_mode synopsis
SSL_CTX_set_session_cache_mode and SSL_CTX_get_session_cache_mode
were documented with SSL_CTX ctx instead of SSL_CTX *ctx in their
synopsis.

CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed May  6 11:53:35 2026
(Merged from https://github.com/openssl/openssl/pull/30965)
2026-05-06 13:53:28 +02:00
Bob Beck 8b6a8a42af Add a CHANGES.md entry
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:36:09 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:41 +02:00
Bob Beck c06af2ec8a Fix accidental double guard in openssl/types.h
The windows goo before the guard tricked my tooling

(doing stuff like this on every include is a bit icky, we should
probably fix this somehow)

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:36:08 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:41 +02:00
Bob Beck 7029431ebe make providers includes self contained
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:36:07 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:41 +02:00
Bob Beck 58ad0bab9f Guard include files in providers
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:36:06 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:41 +02:00
Bob Beck 72fa902ccd Guard obj_mac.h from clang-format
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:36:04 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:41 +02:00
Bob Beck b855299a66 Guard charmap.h
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:36:02 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:41 +02:00
Bob Beck 14d3ad46a8 Guard output of keysets.pl
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:36:01 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:41 +02:00
Bob Beck e3b2632ffa Generate guarded bn_prime.h
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:36:00 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:41 +02:00
Bob Beck b7ed2cc579 Guard and make self-contained obj_dat.h and obj_xref.h
Modifies the perl to generate them as such

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:35:59 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:41 +02:00
Bob Beck cc7d680024 Make the crypto includes self-contained
Except for obj_dat.h and obj_xref.h which need perl mungery

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:35:57 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:41 +02:00
Bob Beck b976500815 the curve448 f_impl.h files are not self contained headers
They are inline implementations. rename to .inc

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:35:56 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:24 +02:00
Bob Beck b80bec55a0 Add missing header guards in local crypto includes.
These are guarded with "OSSL_LIBCRYPTO" to ensure the namespace
is distinct from the "OSSL_CRYPTO" guards used in include/crypto

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:35:55 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:24 +02:00
Bob Beck 1c9191ff55 Make apps self-contained
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:35:53 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:24 +02:00
Bob Beck 9b70ac27bf Fix progs.pl to generate guarded header
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:35:52 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:24 +02:00
Bob Beck 97609cb854 Add missing header guards in apps
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:35:51 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:24 +02:00
Bob Beck f3a0dfa766 Make ssl includes self-contained
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:35:50 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:24 +02:00
Bob Beck 230e4cbc3f Add missing header guards in ssl
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:35:49 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:24 +02:00
Bob Beck ad5277a4b1 make includes self-contained
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:35:48 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:24 +02:00
Bob Beck 5d84d82e00 Add missing include guards in include
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:35:47 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:24 +02:00
Bob Beck 54a52c9eae the async/arch/async_foo.h files are not self contained headers
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:35:46 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:24 +02:00
Bob Beck 2220ecf392 asn1_item_list.h is not a self contained header file
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:35:45 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:24 +02:00
Bob Beck 7852ae70c7 md32_common.h is not a self contained header file
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:35:44 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:24 +02:00
Bob Beck 7060a2fb0c qlog_events.h is not a self-contained header file
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:35:42 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
2026-05-06 13:35:24 +02:00
slontis e483d93b39 Doc: Add documentation for existing Hybrid ML_KEM algorithms used by
TLS1.3.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Mon May  4 11:51:12 2026
(Merged from https://github.com/openssl/openssl/pull/30037)
2026-05-04 07:51:09 -04:00
Neil Horman fa442ca7b5 Limit job count on compiler zoo builds
The security repo keeps failing our compiler zoo jobs, consistently.  It
appears to be happening because our compiler zoo jobs use make -j
without any limit on the number of jobs, leading to github aborting them
all when the workload gets too high.  I suspect that we're using a
smaller runner in the security repo than we are in our public repo,
which is why we don't see it there.

Our other CI jobs all limit the job count to 4 during make, do the same
here.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
MergeDate: Mon May  4 09:33:34 2026
(Merged from https://github.com/openssl/openssl/pull/31059)
2026-05-04 11:33:28 +02:00
kovan 69e54bee8d doc: Add documentation for X509_STORE_CTX_set_time
Document the X509_STORE_CTX_set_time() function which sets the
verification time for certificate chain validation. This is a
convenience wrapper around X509_VERIFY_PARAM_set_time().

Remove X509_STORE_CTX_set_time from missingcrypto.txt and
missingcrypto111.txt.

Fixes #21362

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Sun May  3 15:38:26 2026
(Merged from https://github.com/openssl/openssl/pull/29899)
2026-05-03 17:38:24 +02:00
Mounir IDRASSI 9949651bae test: respect disabled IPv6 in bio_tfo_test
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Sun May  3 15:25:55 2026
(Merged from https://github.com/openssl/openssl/pull/30988)
2026-05-03 17:25:36 +02:00
Eugene Adell 28b235549c demos/guide: switch clients to HTTP/1.1
The Host Header comes with HTTP/1.1, not 1.0, and some
Web Server now doesn't want to answer to such requests.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Sun May  3 15:21:35 2026
(Merged from https://github.com/openssl/openssl/pull/30981)
2026-05-03 17:21:23 +02:00
Matt Caswell 593c79ba8e According to RFC8446 there must always be one identity in the list
We were silently accepting a list with zero identities. Technically this
is a syntax error so we should fail with a decode_error in this case.

Fixes #31006

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Sun May  3 15:19:27 2026
(Merged from https://github.com/openssl/openssl/pull/31010)
2026-05-03 17:19:23 +02:00
Nikola Pajkovsky d4da2e74ab sparse_array: avoid ubsan violation in typed doall
clang-22 with enable-asan and enable-ubsan enabled fails with error

  crypto/sparse_array.c:93:21: runtime error: call to function alg_copy
  through pointer to incorrect function type 'void (*)(unsigned long, void *, void *)'

    ossl_sa_##type##_doall(const SPARSE_ARRAY_OF(type) * sa,
        void (*leaf)(ossl_uintmax_t, type *))
    {
        ossl_sa_doall((OPENSSL_SA *)sa,
            (void (*)(ossl_uintmax_t, void *))leaf);
    }

typed doall(_arg) expect leaf to have type, but generic code is using
void *, and the type-casting cases the error.

Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sun May  3 15:17:58 2026
(Merged from https://github.com/openssl/openssl/pull/31035)
2026-05-03 17:17:41 +02:00
Mounir IDRASSI 8780b5bcff slh_dsa: cleanse generated add_random buffer
Fix the inverted cleanse guard in the SLH DSA provider signing path.

When randomized signing populates the local add_rand buffer, the cleanup step currently skips that stack buffer. Other signing modes do not create this transient buffer, so they should not drive this cleanup. Swap the guard so only the transient per signature buffer is cleansed, and cleanse the full fixed size buffer directly.

Fixes #30950

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Sun May  3 14:49:20 2026
(Merged from https://github.com/openssl/openssl/pull/31029)
2026-05-03 16:49:14 +02:00
Craig Lorentzen cc5dd4ff66 Map rsaesOaep SubjectPublicKeyInfo to RSA
TPM 1.2 Endorsement Key certificates use id-RSAES-OAEP
(NID_rsaesOaep) as their SubjectPublicKeyInfo algorithm
identifier per TCG Credential Profiles V1.2 section 3.2.7.
The underlying key is a standard RSAPublicKey.  Without
this mapping, X509_get_pubkey() fails with a decode error
and X509_verify_cert() cannot validate these certificates.

Add NID_rsaesOaep handling to the three SPKI decode paths,
each of which points at the other two so future changes stay
in sync:

 - x509_pubkey_decode(): remap the NID to NID_rsaEncryption
   for the legacy ameth lookup.  This path is reached via
   d2i_RSA_PUBKEY()/ossl_d2i_PUBKEY_legacy(), which is in
   turn invoked by the provider RSA decoder's rsa_d2i_PUBKEY,
   so it is load-bearing even when the provider path is in
   use.

 - x509_pubkey_ex_d2i_ex(): use "RSA" as the decoder keytype
   name so OSSL_DECODER_CTX_new_for_pkey() selects the RSA
   provider decoder.  The NID check precedes OBJ_obj2txt()
   so the text conversion is skipped when unused.

 - ossl_spki2typespki_der_decode(): same remap in the
   SPKI-to-type-SPKI provider decoder chain.  Flatten the
   existing SM2 special case while here: the original code
   relied on a dangling else across the #endif, which made
   the rsaesOaep branch awkward to add.  The new structure
   initializes dataname to empty, applies each special case
   in turn, and falls back to OBJ_obj2txt() only when no
   override applied.  strcpy() is replaced with
   OPENSSL_strlcpy() for consistency with surrounding code.

The OAEP AlgorithmIdentifier parameters (which carry a
TCG-specific pSourceAlgorithm "TCPA" for TPM EKs) are
deliberately not interpreted; only the RSAPublicKey body is
consumed.

Add a test using a real TPM 1.2 EK certificate.  The test
exercises both the provider decoder path (via X509_from_strings
+ X509_get0_pubkey) and, when deprecated APIs are available,
the legacy path (via d2i_RSA_PUBKEY), confirming the key
decodes to an RSA EVP_PKEY of the expected size.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Sun May  3 14:44:24 2026
(Merged from https://github.com/openssl/openssl/pull/30961)
2026-05-03 16:43:41 +02:00