4494 Commits

Author SHA1 Message Date
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
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 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 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 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 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
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
Eugene Syromiatnikov 9d856e4d7f Avoid needless casting away of const in X509_VERIFY_PARAM_get1_ip_asc
Instead of needlessly casting const away, simply update the prototype
of ossl_ipaddr_to_asc(), that doesn't modify the passed data in any way
anyway.

Fixes: f584ae959c "Let's support multiple names for certificate verification"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Sat May  2 18:07:19 2026
(Merged from https://github.com/openssl/openssl/pull/31051)
2026-05-02 20:07:12 +02:00
Bob Beck 26c5742393 Use the actually correct define for solaris and gcc
And to avoid future confusion just namespace all of these
to OSSL_

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Apr 30 11:52:48 2026
(Merged from https://github.com/openssl/openssl/pull/30738)
2026-04-30 13:52:23 +02:00
Bob Beck 01fba667c2 Add an OSSL_ATOMICS_LOCKLESS internal define
So that we can decide to decide to do fast path things with conditional
compilaiton, and avoid adding a lock to save a lock

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Apr 30 11:52:47 2026
(Merged from https://github.com/openssl/openssl/pull/30738)
2026-04-30 13:51:14 +02:00
Alexandr Nedvedicky 211b564f86 Make SSL_get_stream_write_state() safe for concluded streams
QUIC stack may panic when application calls SSL_get_stream_write_state()
on cocluded QUIC stream onject. The sequence of action which leads
to NULL pointer dereference is as follows:
  - application uses SSL_stream_conclude(ssl_stream, 0) to conclude
    the stream (let remote peer know no to expect more data)

  - application uses SSL_get_stream_write_state(ssl_stream)
    to query stream state.

If underlying sstream object is gone by the time when
SSL_get_stream_wtite_state() is called, then application
may see NULL pointer dereference. The underlying sstream
object is freed when FIN sent on beahalf of SSL_stream_conclude()
is ACKed by remote peer.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Tue Apr 28 12:35:41 2026
(Merged from https://github.com/openssl/openssl/pull/30913)
2026-04-28 14:34:12 +02:00
Mounir IDRASSI 0c3ffa04a7 Fix property method cache insert failure handling
Treat method-cache hash table inserts as successful only when they
return 1. This handles allocation/grow failures distinctly from
successful replacement and avoids using temporary QUERY entries after
failed insertion.

Separate cleanup for unlinked temporary QUERY objects from linked
cache entries, and release both the pending cache reference and
caller-visible method reference when deferred providerless cache
insertion fails.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Apr 28 06:33:15 2026
(Merged from https://github.com/openssl/openssl/pull/30891)
2026-04-28 06:33:06 +00:00
Alexandr Nedvedicky bed6d88c26 remove ossl_quic_detach_stream() and ossl_quic_attach_stream()
Those function used to be backends for SSL_attach_stream() and
SSL_detach_stream(). Both those functions were removed from
API back 2023. And it does not look like there is a plan
to revive them. This PR removes implementation of stream detach/attach
functions with their tests.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sun Apr 26 13:26:58 2026
(Merged from https://github.com/openssl/openssl/pull/30956)
2026-04-26 15:26:32 +02:00
Norbert Pocs 41a3fdde52 Deprecate ASN1_BIT_STRING_set()
Replacement: ASN1_BIT_STRING_set1

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

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
MergeDate: Sun Apr 26 11:45:27 2026
(Merged from https://github.com/openssl/openssl/pull/30692)
2026-04-26 13:45:20 +02:00
Frederik Wedel-Heinen d31fbbeded Removes duplicated __owur.
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Apr 24 08:09:10 2026
(Merged from https://github.com/openssl/openssl/pull/30933)
2026-04-24 08:09:09 +00:00
Viktor Dukhovni c1f74671ae Add valgrind CT support to ML-DSA
Also slightly refactor the ML-KEM version to share the necesasry
defines, and add a daily CI run to check both (presently, for just some
platforms with known working valgrind support).

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Wed Apr 22 07:55:14 2026
(Merged from https://github.com/openssl/openssl/pull/30863)
2026-04-22 09:55:12 +02:00
Kelvin Lee d53bba4eb0 Use proper compiler features abstraction for older compilers
"inline" -> "ossl_inline"
"__func__" -> "OPENSSL_FUNC"
"snprintf" -> "BIO_snprintf"

CLA: trivial
Fixes: 8e9771cf22 "Use stub declarations in engine.h"
Fixes: da8f09846b "Add ASN1_BIT_STRING_get_length()"
Fixes: 74d47c8e66 "Provide ASN1_BIT_STRING_set1()"
Fixes: 7debe0ddef "ECH external APIs"
Fixes: 4af71a7738 "ECH CLI implementation"

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Apr 22 07:22:57 2026
(Merged from https://github.com/openssl/openssl/pull/30901)
2026-04-22 09:22:48 +02:00
Christoph Müllner f34f715d03 riscv: fix IS_IN_DEPEND_VECTOR range check
The macro checked (ZVX_MIN >= offset) which is equivalent to
(offset <= ZVX_MIN), making it true for offsets 0-15 instead of
the intended range [ZVX_MIN, ZVX_MAX] = [15, 23].

The practical effect in hwprobe_to_cap() was inverted:
- Scalar extensions (ZBA..ZKT, offsets 0-14) were incorrectly
  treated as vector-dependent and suppressed when VECTOR_CAPABLE
  was false, preventing their detection via hwprobe.
- Vector extensions ZVBC..ZVKSH (offsets 16-23) were not treated
  as vector-dependent, allowing them to be enabled via hwprobe
  even when the V extension was absent.

Fix by changing >= to <= so the macro correctly tests whether
offset falls in [ZVX_MIN, ZVX_MAX].

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Apr 16 17:03:40 2026
(Merged from https://github.com/openssl/openssl/pull/30713)
2026-04-16 19:03:19 +02:00
Eugene Syromiatnikov 2048460346 include/openssl/x509_acert.h.in: add extern "C" linkage specification for C++
Fixes: dcee34c8f921 "Add RFC 5755 attribute certificate support"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed Apr 15 12:36:41 2026
(Merged from https://github.com/openssl/openssl/pull/30796)
2026-04-15 14:36:36 +02:00
Neil Horman 70cdba10fa Add some crypto atomic pointer ops
CRYPTO_atomic_load_ptr - load a pointer value with relaxed semantics
CRYPTO_atomic_store_ptr - store a pointer value with relaxed semantics
CRYPTO_atomic_cmp_exch_ptr - cmp/exch a pointer with relaxed or acq/rel
                             semantics

The addition of these functions enables us to better use atomics to
replace read/write locks where we are almost always doing reads

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Apr 14 08:29:30 2026
(Merged from https://github.com/openssl/openssl/pull/30670)
2026-04-14 10:29:28 +02:00
sftcd 53e349fae6 include C++ extern in ech.h
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon Apr 13 09:57:10 2026
(Merged from https://github.com/openssl/openssl/pull/30790)
2026-04-13 11:57:05 +02:00
Norbert Pocs 9e876e0922 Rename ossl_asn1_string_set_bits_left to something more expressive
Signed-off-by: Norbert Pocs <norbertp@openssl.org>

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon Apr 13 07:11:11 2026
(Merged from https://github.com/openssl/openssl/pull/30746)
2026-04-13 09:11:01 +02:00
Sunwoo Lee 275dab58f0 quic: remove unused scid from port_default_packet_handler
Remove the scid variable entirely from port_default_packet_handler()
  and all functions that accept it as a parameter. The scid was never
  used meaningfully — cur_remote_dcid is set later during the handshake.

  Remove scid parameter from:
    - port_bind_channel()
    - port_validate_token()
    - ossl_quic_channel_on_new_conn()
    - ossl_quic_bind_channel()
    - ch_on_new_conn_common()

  Remove the cur_remote_dcid = *peer_scid assignment in
  ch_on_new_conn_common() as it wrote dead data.

  CWE-457

  Reported-by: Sunwoo Lee <sunwoolee@kentech.ac.kr>

  CLA: trivial

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr  8 10:21:55 2026
(Merged from https://github.com/openssl/openssl/pull/30611)
2026-04-08 12:21:44 +02:00
slontis 70cda24a33 Deprecate EVP_CIPHER_CTX_get_num() and EVP_CIPHER_CTX_set_num().
Suggested to be added in OpenSSL 4.1.
Since engines have been removed, these are redundant functions.
End users should not generally be accessing this internal field.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr  8 10:02:58 2026
(Merged from https://github.com/openssl/openssl/pull/30335)
2026-04-08 12:02:56 +02:00
Arne Schwabe a44081572e Make ext argument of X509V3_EXT_print_fp const
Commit e75bd84ffc made the ext argument of 509V3_EXT_print const
but did not give 509V3_EXT_print_fp which is essentially is a wrapper
around X509V3_EXT_print the same treatment.

This commit aligns the two functions again.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr  8 09:15:11 2026
(Merged from https://github.com/openssl/openssl/pull/30572)
2026-04-08 11:15:01 +02:00
eclipse07077 3741076a34 Fix integer overflow in EVP_ENCODE_LENGTH and base64 encoding paths
The EVP_ENCODE_LENGTH macro performs all arithmetic in the type of
its argument. When the argument is int and exceeds approximately
1.6 billion, intermediate results overflow signed int, potentially
wrapping to a smaller positive value rather than a negative one.

In b64_write() (crypto/evp/bio_b64.c), this causes OPENSSL_malloc
to allocate a buffer smaller than the actual encoded output size.
EVP_EncodeUpdate then writes past the end of the undersized buffer.

Changes:
- Cast macro argument to size_t in EVP_ENCODE_LENGTH to prevent
  signed integer overflow
- Change encoded_length in b64_write() from int to size_t and add
  an explicit overflow sanity check before allocation
- Change return type of evp_encodeblock_int() and
  encode_base64_avx2() from int to size_t so that large encoded
  output lengths are not truncated
- Update EVP_EncodeUpdate() to use size_t for the encoder return
  value accumulator (j), consistent with the existing size_t total
- Add explicit (int) casts in EVP_EncodeBlock() and EVP_EncodeFinal()
  where the public API requires int return values

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 14:55:29 2026
(Merged from https://github.com/openssl/openssl/pull/30321)
2026-04-03 16:55:12 +02:00
Milan Broz 35b4cf28b4 Silence MINGW warning about INVALID_SOCKET
On Windows, SOCKET is defined as unsigned (UINT_PTR).

In OpenSSL, the socket abstraction uses int, see
discussion in https://github.com/openssl/openssl/issues/7282.

MINGW for some time uses a signed definition of INVALID_SOCKET,
then switched back to unsigned, see for example
https://sourceforge.net/p/mingw-w64/discussion/723797/thread/71522d10/
Currently, it is defined as unsigned, creating many warnings like

  warning: overflow in conversion from 'long long unsigned int' to 'int'
  changes value from '18446744073709551615' to '-1' [-Woverflow]
  *sock = INVALID_SOCKET;

As we use INVALID_SOCKET only in our code, we can safely silence
this warning just by redefining INVALID_SOCKET to signed
(version that is commented out in MINGW headers).

While this is only a workaround, it has been here for years and
allows focus on more important warnings.

Signed-off-by: Milan Broz <gmazyland@gmail.com>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Mar 31 00:22:27 2026
(Merged from https://github.com/openssl/openssl/pull/30616)
2026-03-31 02:21:33 +02:00
Milan Broz 5f084f8a99 Fix MINGW compilation
This patch fixes
  undefined reference to `ossl_BIO_snprintf_msvc'

Define it only if MSVC is used.

Signed-off-by: Milan Broz <gmazyland@gmail.com>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Mar 25 14:12:58 2026
(Merged from https://github.com/openssl/openssl/pull/30541)
2026-03-25 15:12:53 +01:00
Dr. David von Oheimb 525a4f1efb cmp_vfy.c,doc/,test/: when trying to use cached CMP message sender cert, no more check its revocation and chain
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28973)
2026-03-25 10:42:04 +01:00
Abhinav Agarwal d21db261c1 quic: fix off-by-one in QUIC_MAX_MAX_ACK_DELAY
Should be 2^14-1 (16383) per RFC 9000 s. 18.2, not 2^14 (16384).

Fixes: 35dc6c353b ("QUIC: Make more transport parameters configurable")
Signed-off-by: Abhinav Agarwal <abhinavagarwal1996@gmail.com>

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Mar 24 17:55:50 2026
(Merged from https://github.com/openssl/openssl/pull/30531)
2026-03-24 18:55:43 +01:00
Helen Zhang 0dd1c50fc0 Add IKEV2KDF implementation
In compliance with RFC7296 and SP800-135

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Mar 24 17:21:21 2026
(Merged from https://github.com/openssl/openssl/pull/30121)
2026-03-24 18:21:19 +01:00
Neil Horman 37eb7691ac Add extern key buffer setup for hash table
One thing @npajkovsky noted in our recent discussion about the internal
hash table was that its unfortunate that keys have to be sized for the
maximal use case in our current hashtable code.

We can avoid that.

Introduce a new init mechanism that allows for keys to initalized using
an external buffer that can be setup and marshalled independently of the
key itself.  This allows us to only allocate the amount of data needed
for the key, rather than a maximally sized buffer where appropriate and
adventageous.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Tue Mar 24 16:23:07 2026
(Merged from https://github.com/openssl/openssl/pull/30254)
2026-03-24 17:22:47 +01:00
Neil Horman 060193019a Add ability to extract computed hash from hashtable
One thing we can do to speed up hash table lookups is to cache/reuse
computed hash values when interrogating a hash table multiple times in
rapid succession.

We follow this pattern frequently when using hashtables:

value = lookup_hash(key)
if (value == NULL)
 value = new_value()
 insert_to_hash(key, value)

Note that we use the same key for the lookup and the insert.  So if we
had a way to preserve the value this key hashed to, we can avoid having
to do a second hash computation during the lookup.

These new macros give us that.  The HT_KEY structure now stores the
computed hash value in the key, which can be extracted and reused by the
caller with the HT_INIT_KEY_CACHED macro.  When set, the cached hash
value is used, rather than needing to recompute the hash for any
subsequent operations

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Tue Mar 24 16:23:05 2026
(Merged from https://github.com/openssl/openssl/pull/30254)
2026-03-24 17:22:47 +01:00
Tim Perry fe26a8fc90 Add CTLOG_STORE_add0_log() to add CTLOGs to a store programmatically
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Thu Mar 19 20:45:34 2026
(Merged from https://github.com/openssl/openssl/pull/30427)
2026-03-19 21:45:33 +01:00
Eugene Syromiatnikov 40f076965f include/openssl/macros.h: add missing #undef OPENSSL_NO_DEPRECATED_3_5
Complements: 0bba821881 "Deprecate all BIO_meth_get_*() functions"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Mar 17 17:12:18 2026
(Merged from https://github.com/openssl/openssl/pull/30400)
2026-03-17 13:12:10 -04:00
mcrmck a1420a699d Implement RFC 8701 GREASE for TLS ClientHello
Add client-side GREASE (Generate Random Extensions And Sustain
Extensibility) support per RFC 8701. When SSL_OP_GREASE is set,
the TLS client injects reserved 0x?A?A-pattern values into the
ClientHello to prevent ecosystem ossification caused by servers
that reject unknown values.

GREASE values are injected into:
- Cipher suites (prepended)
- Supported versions extension (prepended)
- Supported groups extension (prepended)
- Signature algorithms extension (appended)
- Key share extension (prepended, 1 zero byte)
- Two standalone extensions (one empty, one with 1 zero byte)

The implementation uses lazy-seeded random values that remain
consistent across HelloRetryRequest retransmissions. GREASE values
from server responses are rejected as illegal parameters.

Add -grease option to s_client to enable GREASE from the command line.

Closes #9660

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Mar 17 14:58:25 2026
(Merged from https://github.com/openssl/openssl/pull/30303)
2026-03-17 10:57:59 -04:00
Daniel Kubec 25c2f88caa x509: add EXFLAG_DUPLICATE and cheap O(1) extension duplicate check
In ossl_x509v3_cache_extensions(), introduce EXFLAG_DUPLICATE flag to
signal duplicate X.509 extensions. Add O(1) duplicate detection
using a bitset with minimal stack memory footprint, in compliance with
RFC 5280 Section 4.2.

Fixes #26325

Co-authored-by: Tomáš Mráz <tm@t8m.info>
Co-authored-by: David von Oheimb <DDvO@users.noreply.github.com>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Mar 17 13:43:13 2026
(Merged from https://github.com/openssl/openssl/pull/30233)
2026-03-17 09:43:00 -04:00
Nikolas Gauder 35dc6c353b QUIC: Make more transport parameters configurable
The following QUIC transport parameters are now configurable via
SSL_get_value_uint() / SSL_set_value_uint():

max_udp_payload_size
initial_max_data
initial_max_stream_data_{uni, bidi_local, bidi_remote}
initial_max_streams_{uni, bidi}
ack_delay_exponent
max_ack_delay
disable_active_migration
active_connection_id_limit

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Tue Mar 17 13:15:29 2026
(Merged from https://github.com/openssl/openssl/pull/29664)
2026-03-17 09:15:04 -04:00
Bob Beck 6cc30a0f2d Add Deprecation Macros for 4.1
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Mon Mar 16 11:28:52 2026
(Merged from https://github.com/openssl/openssl/pull/30399)
2026-03-16 11:28:34 +00:00
slontis 4a366f620c ML_DSA/ML_KEM: Add fromdata property query support.
This allows ML_KEM/ML_DSA keys to set a "properties" value
that is used to refetch the digests.
This may be used when doing an import using EVP_PKEY_fromdata().
Note that this is not used by EVP_PKEY_new_raw_private_key_ex() or
EVP_PKEY_new_raw_public_key_ex() since the propq used here is
associated with the keymanager (i.e. via EVP_PKEY_CTX_new_from_name())
not the propq associated with internal fetches used by the key to
fetch digest algorithms.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Mar 13 17:24:41 2026
(Merged from https://github.com/openssl/openssl/pull/30243)
2026-03-13 18:24:40 +01:00
openssl-machine c721580653 Copyright year updates
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Mar 10 14:37:54 2026
Release: yes
2026-03-10 14:37:52 +00:00
Eugene Syromiatnikov 81cc6cb97e Revert "Constify X509_find_by_subject"
This reverts commit 0da29907e7 "Constify X509_find_by_subject",
as it operates on a stack of X509 (not const X509) objects, and returns
a pointer to one of them.

Fixes: 0da29907e7 "Constify X509_find_by_subject",
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Mar  6 21:29:37 2026
(Merged from https://github.com/openssl/openssl/pull/30265)
2026-03-06 16:29:23 -05:00
Eugene Syromiatnikov e491465c49 Un-constify the return value of X509_find_by_issuer_and_serial()
This partially reverts commit 07ee3d5db8 "constify
X509_find_by_issuer_and_serial", as it operates on a stack of X509
(not const X509 objects), and returns a pointer to one.
The constification of PKCS7_signatureVerify argument is sensible
(as the argument is read-only inside the function) and is remained
in place.

Fixes: 07ee3d5db8 "constify X509_find_by_issuer_and_serial"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Mar  6 21:29:34 2026
(Merged from https://github.com/openssl/openssl/pull/30265)
2026-03-06 16:29:23 -05:00
Eugene Syromiatnikov 584e176a3c Un-constify X509_OBJECT_get0_X509 and X509_OBJECT_set1_X509
This partially reverts commit 367c54ef11 "Constify
X509_OBJECT_[get0|set1]_X509 and friends", as well as removes them from
the list added in c0f82d915f "Describe X509 constification and ASN1_STRING
changes".  Constification of X509_get_pubkey() arguments remains in place.

Resolves: https://github.com/openssl/project/issues/1892
Complements: 367c54ef11 "Constify X509_OBJECT_[get0|set1]_X509 and friends"
Complements: c0f82d915f "Describe X509 constification and ASN1_STRING changes"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Mar  6 18:36:10 2026
(Merged from https://github.com/openssl/openssl/pull/30276)
2026-03-06 13:36:02 -05:00
Eugene Syromiatnikov 5d066a2473 Partially revert "Constify X509_STORE_CTX functions invoving X509 *"
This reverts constification of the return value types
of X509_STORE_CTX_get_current_cert(), X509_STORE_CTX_get0_current_issuer(),
X509_STORE_CTX_get0_cert() functions, and arguments
of X509_STORE_CTX_set_cert() and X509_STORE_CTX_init() functions.
Constification of users of these functions, as well as
X509_STORE_CTX_get_issuer_fn and X509_STORE_CTX_check_issued_fn types,
remained in place.

Complements: e5b563366b "Constify X509_STORE_CTX functions invoving X509 *"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Mar  6 18:33:12 2026
(Merged from https://github.com/openssl/openssl/pull/30272)
2026-03-06 13:32:54 -05:00
Bob Beck 3298dadd88 Revert "Make X509_up_ref and X509_free take const X509 *"
This reverts commit ae8d50f211.

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

messing with free is a bridge too far

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Mar  6 17:50:22 2026
(Merged from https://github.com/openssl/openssl/pull/30273)
2026-03-06 12:50:00 -05:00
Tom Gautot 465fd32d33 OSSL_HTTP_REQ_CTX_nbio(): check for clear Content-Type mismatch
Fixes #29748

Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Mar  5 18:04:24 2026
(Merged from https://github.com/openssl/openssl/pull/29829)
2026-03-05 19:04:13 +01:00