Compare commits

...
Sign in to create a new pull request.

1809 commits

Author SHA1 Message Date
Brady Foster
971b8d060e Update SSL_CTX_set1_curves.pod for OpenSSL 3.5 additions
Some checks failed
Run-checker merge / run-checker (no-srp) (push) Failing after 7s
Run-checker merge / run-checker (no-ocsp) (push) Failing after 23s
Run-checker merge / run-checker (no-pinshared) (push) Failing after 22s
Run-checker merge / run-checker (no-shared) (push) Failing after 16s
Run-checker merge / run-checker (no-srtp) (push) Failing after 7s
Run-checker merge / run-checker (no-ts) (push) Failing after 9s
Run-checker merge / run-checker (no-ui) (push) Failing after 10s
Run-checker merge / jitter (push) Failing after 9s
Run-checker merge / threads_sanitizer_atomic_fallback (push) Failing after 6s
Compiler Zoo CI / gcc (gcc-14) (push) Has been cancelled
Compiler Zoo CI / gcc (gcc-10) (push) Has been cancelled
Compiler Zoo CI / gcc (gcc-12) (push) Has been cancelled
Compiler Zoo CI / gcc (gcc-13) (push) Has been cancelled
Compiler Zoo CI / gcc (gcc-9) (push) Has been cancelled
Compiler Zoo CI / clang (clang-11) (push) Has been cancelled
Documentation and Installability CI / out-of-readonly-source-and-install-macos (push) Has been cancelled
Compiler Zoo CI / gcc (gcc-11) (push) Has been cancelled
Compiler Zoo CI / clang (clang-12) (push) Has been cancelled
Compiler Zoo CI / clang (clang-13) (push) Has been cancelled
Fuzz-checker CI / fuzz-checker (map[cc:afl-clang-fast config:enable-fuzz-afl no-module install:afl++ name:AFL]) (push) Has been cancelled
Compiler Zoo CI / clang (clang-14) (push) Has been cancelled
Compiler Zoo CI / clang (clang-15) (push) Has been cancelled
Compiler Zoo CI / clang (clang-16) (push) Has been cancelled
Compiler Zoo CI / clang (clang-17) (push) Has been cancelled
Compiler Zoo CI / clang (clang-18) (push) Has been cancelled
Compiler Zoo CI / clang (clang-19) (push) Has been cancelled
Compiler Zoo CI / clang (clang-20) (push) Has been cancelled
Compiler Zoo CI / clang (clang-21) (push) Has been cancelled
Fuzz-checker CI / fuzz-checker (map[cc:clang-18 config:enable-fuzz-libfuzzer enable-asan enable-ubsan -fno-sanitize=function -fsanitize-coverage=trace-cmp -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION extra:enable-fips enable-lms enable-ec_nistp_64_gcc_128 -fno-sanitize=al… (push) Has been cancelled
Fuzz-checker CI / fuzz-checker (map[cc:clang-18 config:enable-fuzz-libfuzzer enable-asan enable-ubsan -fno-sanitize=function install:libfuzzer-18-dev libs:--with-fuzzer-lib=/usr/lib/llvm-18/lib/libFuzzer.a --with-fuzzer-include=/usr/include/clang/18/include/fuzzer linke… (push) Has been cancelled
Added documentation of the addition of group tuples in openSSL 3.5
in HISTORY section of SSL_CTX_set1_curves.pod.

CLA: trivial

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Fri Jul 24 13:13:26 2026
(Merged from https://github.com/openssl/openssl/pull/32007)
2026-07-24 15:13:02 +02:00
Mounir IDRASSI
5f48317d6d Restore empty raw PKCS#1 verify-recover behavior
EVP_PKEY_verify_recover() with RSA PKCS#1 v1.5 padding and no configured
signature digest rejected a valid signature whose recovered payload is
empty, instead of returning success with a recovered length of zero.

RSA_public_decrypt() returns -1 on error and otherwise the number of
recovered bytes, which may legitimately be zero for a raw PKCS#1 v1.5
signature that encodes an empty payload.  Pull request #28306 ("Make
error checks on RSA_public_decrypt() consistent") changed the error
check in the raw, no-digest verify-recover path from "ret < 0" to
"ret <= 0", so a valid zero recovered length was mistaken for an error.

Restore the "< 0" check in that branch only, leaving the digest-aware
PKCS#1, X9.31, PSS and ordinary verification paths untouched.

Add test_RSA_verify_recover_empty_payload, which performs a complete
zero-length raw PKCS#1 v1.5 sign-and-recover round trip through EVP and
fails on the unmodified implementation specifically at the
EVP_PKEY_verify_recover() call.  OpenSSL 3.0.13 recovers the same
signature and reports a zero-byte result.

The behavior regressed as a result of #28306.

Fixes #32000

Assisted-by: OpenCode:GLM-5.2

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Jakub Zelenka <jakub.zelenka@openssl.foundation>
MergeDate: Fri Jul 24 13:06:58 2026
(Merged from https://github.com/openssl/openssl/pull/32001)
2026-07-24 15:06:51 +02:00
Mounir IDRASSI
3e4f7e7720 Reject unknown TLS 1.3 ServerHello extensions
TLS 1.3 does not permit clients to ignore unknown extensions in ServerHello
or HelloRetryRequest. Add a validation pass for these messages so fully
unknown extension types fail early with unsupported_extension.

Keep the existing ignore behavior for other extension contexts and leave
TLS 1.2 ServerHello processing unchanged. Add TLSProxy coverage for the
TLS 1.3 ServerHello case.

Correct the unknown-extension path in tls_collect_extensions(). Collection
still runs before the new TLS 1.3 validation, and verify_extension()
returns success with thisex == NULL for fully unknown extension types.
The previous idx calculation used invalid pointer arithmetic on NULL in
that path. Map unknown extensions explicitly outside the built-in extension
range instead, preserving the existing ignore semantics while avoiding
undefined behavior.

Update the truncated HRR ECH corruption vector to keep testing malformed
ECH length after the new unknown-extension validation. The old 0xdddd bytes
were only padding to preserve the replacement length, but they now trigger
the unknown-extension check before the ECH parser. Use a known HRR cookie
extension as padding so the test still reaches the intended
SSL_R_LENGTH_MISMATCH path.

Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jul 23 15:55:09 2026
(Merged from https://github.com/openssl/openssl/pull/31086)
2026-07-23 17:55:07 +02:00
Christoph Müllner
d2c0db0d9d crypto: use void * in LoongArch SHA shim
The LoongArch SHA dispatch shim uses the same deprecated typed
interfaces as the RISC-V shim. Switch its entry points to void *
so it no longer depends on deprecated SHA context types.

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

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jul 23 15:43:31 2026
(Merged from https://github.com/openssl/openssl/pull/30763)
2026-07-23 17:43:21 +02:00
Christoph Müllner
4499e9abe1 crypto: use void * in RISC-V digest shims
The RISC-V MD5 and SHA dispatch files use low-level digest context
types that are hidden in no-deprecated builds. Switch their shim
entry points to void * so they no longer depend on deprecated typed
interfaces.

Update the local MD5 declaration to match the untyped shim
interface.

Fixes: openssl/openssl#29357

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

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jul 23 15:43:30 2026
(Merged from https://github.com/openssl/openssl/pull/30763)
2026-07-23 17:43:21 +02:00
Greensi7
10413cceb6 Add OSSL_ECHSTORE_read_echconfiglist fuzzer
Fuzz OSSL_ECHSTORE_read_echconfiglist with raw
fuzzer input in stage 1. Then fixup the starting
bytes to reach deeper code withotu relying only on
corpus. Fixup is done for binary encoding only (not base64).

Assisted-by: ChatGPT:gpt-5.5

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jul 23 13:57:54 2026
(Merged from https://github.com/openssl/openssl/pull/32021)
2026-07-23 15:57:53 +02:00
Nicky Mouha
0723430177 doc: document that HMAC_Update cannot be called after HMAC_Final
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Thu Jul 23 08:33:21 2026
(Merged from https://github.com/openssl/openssl/pull/31570)
2026-07-23 10:33:15 +02:00
codingsushi79
b80761945b Fix capitalization of 'Swiss Army knife' in README
CLA: trivial

Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Jul 23 08:30:57 2026
(Merged from https://github.com/openssl/openssl/pull/31871)
2026-07-23 10:30:51 +02:00
Mounir IDRASSI
f7112c925c docs: clarify EVP_PKEY context workflow and operation descriptions
Document that a generated key is returned separately from its generation
context and that a new key-bound context is needed for subsequent
operations. Correct the encrypt and decrypt initialization descriptions
and examples accordingly.

Correct two copy-and-paste errors in the verify-recover documentation:
describe its initializer as starting a verify-recover operation and refer
to EVP_PKEY_verify_recover() when discussing its input.

Fixes #31989

Assisted-by: Grok:Grok-4.5

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Thu Jul 23 08:29:24 2026
(Merged from https://github.com/openssl/openssl/pull/31995)
2026-07-23 10:28:42 +02:00
Alexander Nesterovskiy
e7a8d9c19e Added Nvidia/Olympus CPU dispatch for SHA3/EOR3 AES GCM on Vera CPU
CLA: trivial

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Thu Jul 23 08:26:09 2026
(Merged from https://github.com/openssl/openssl/pull/31191)
2026-07-23 10:26:05 +02:00
Neil Horman
05b241cb09 Fix missing NULL check in statem_clnt_construct_test
Fixes https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1695905

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jul 23 08:24:25 2026
(Merged from https://github.com/openssl/openssl/pull/31992)
2026-07-23 10:24:01 +02:00
Neil Horman
9375418a87 use safe_math on do_name_ex
Coverity caught some potential overflows in do_name_ex.  Seems unlikely
to occur, but lets just do all the adds under safe_math to ensure we
don't overflow our buffer length.

Fixes https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1695278

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jul 23 08:24:23 2026
(Merged from https://github.com/openssl/openssl/pull/31992)
2026-07-23 10:24:01 +02:00
Neil Horman
eac8ed4825 Add return check to OSSL_DECODER_up_ref
Coverity flagged a location where we didn't check this return code, fix
it up.

Fixes https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1696759

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jul 23 08:24:22 2026
(Merged from https://github.com/openssl/openssl/pull/31992)
2026-07-23 10:24:01 +02:00
Todd Short
ba2f3b557a errors: fix stale string overrides in openssl.txt for renamed SSL error codes
Commit b3d26e438a ("merge feature/removesslv3", PR #29338) renamed SSL3
error codes to TLS equivalents and updated the string descriptions in
crypto/ssl_err.c (e.g. from "ssl/tls alert bad certificate" to
"tls alert bad certificate"), but did not update the corresponding
strings in crypto/err/openssl.txt.

This caused a latent divergence: running mkerr.pl -rebuild would
regenerate ssl_err.c with the old openssl.txt strings, undoing the
intentional name cleanup. Similarly, adding any new SSL error code
triggers a full SSL regeneration that would revert the strings and
reorder entries to their correct alphabetical positions, producing
spurious changes unrelated to the new code.

Update openssl.txt to match the strings already in ssl_err.c, which
also happen to be the auto-generated strings derived from the reason
code names. Regenerate ssl_err.c and sslerr.h with the correct
alphabetical ordering so that future make update runs are idempotent:
adding and removing a new SSL error code now produces only the expected
changes to the generated files, with no side-effect reordering or
string reversions.

Fixes: b3d26e438a ("Rename SSL3 error codes to TLS equivalents")
Signed-off-by: Todd Short <todd.short@me.com>

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Jul 21 14:28:22 2026
(Merged from https://github.com/openssl/openssl/pull/31993)
2026-07-21 10:28:19 -04:00
Viktor Dukhovni
9f8231027b CHANGES.md updates
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jul 21 14:12:07 2026
(Merged from https://github.com/openssl/openssl/pull/31964)
2026-07-21 16:11:36 +02:00
Viktor Dukhovni
4abb70d327 PSK: Handle non-empty client sid_ctx
- Do not reject external PSKs when client-side sid_ctx is set, fixed
  by copying the sid_ctx into the pending session.

Tests added for this and also the server side sid_ctx issues.

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jul 21 14:12:06 2026
(Merged from https://github.com/openssl/openssl/pull/31964)
2026-07-21 16:11:36 +02:00
Viktor Dukhovni
ecd8d329f3 Fix TLS 1.3 PSKs with SSL_VERIFY_PEER and no sid_ctx.
A server with client certificate verification requested, but no
session ID context configured, wrongly rejected every TLS 1.3
PSK-based connection, whether a resumption ticket, or an external
PSK.  After a full non-PSK handshake the same server issued a
poison resumption PSK (session ticket) that led to handshake
failure if/when used.

The session ID context check exists to stop SSL acceptors with
distinct authentication policies that share a session cache from
resuming each other's sessions and trusting their authentication
results; it doesn't apply to a just-validated external PSK, so
the corresponding sessions are now exempted.  Ticket issuance is
also suppressed when it's already known that the ticket would lead
to a handshake failure with the same server's configuration.

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jul 21 14:12:04 2026
(Merged from https://github.com/openssl/openssl/pull/31964)
2026-07-21 16:11:36 +02:00
Norbert Pocs
4cef487f2a Guard against NULL data in empty ASN1_STRINGs
Since 28179061bf a zero-length ASN1_STRING has data == NULL in
fuzzing builds instead of a 1-byte allocation. Several call sites
did pointer arithmetic or memcpy on the data pointer before any
length check, which is undefined behaviour for NULL even with a
zero offset and aborts the fuzz targets under UBSan:

- asn1_string_canon: skip canonicalisation of empty values
- do_buf, do_hex_dump: return early on an empty buffer
- i2d_ocsp_nonce: skip the memcpy for an empty nonce

The loops at these sites were already no-ops for zero length, so
there is no behaviour change outside sanitizer builds.

Assisted-By: Claude:claude-fable-5

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

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Tue Jul 21 12:54:48 2026
(Merged from https://github.com/openssl/openssl/pull/31998)
2026-07-21 14:54:46 +02:00
Nikola Pajkovsky
63afe63914 quic: report SRTM entry match status via an output argument
Coverity (CID 1696969, CHECKED_RETURN) flagged the ignored return value of
ossl_quic_srtm_remove() in ch_enqueue_retire_conn_id(). The return value
could not be usefully checked because 0 was overloaded to mean both "no
matching entry" and a genuine internal failure (alloc_failed or an
lhash consistency error).

Give the return value a single meaning (1 on success, 0 on internal
error) and report whether a matching entry was found through a new
uint8_t *match output argument, which may be NULL if the caller does not
need it.

Resolved: https://scan5.scan.coverity.com/#/project-view/65138/10222?selectedIssue=1696969
Signed-off-by: Nikola Pajkovsky <nikola@pajkovsky.cz>

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Jul 21 09:24:45 2026
(Merged from https://github.com/openssl/openssl/pull/31974)
2026-07-21 11:24:37 +02:00
Andrew Dinh
fcba83dc4d Wire radix QUIC test framework clock to simulated time
script_17/18/19 (key update tests) rely on OP_SKIP_TIME to advance
simulated time so that TXKU cooldown/RTT-gated behaviour can be
exercised deterministically, but the framework never actually plumbed
that simulated clock into the QUIC channels under test -- OP_SKIP_TIME
only affected the terp's own bookkeeping, so real key updates only
ever occurred by chance regardless of how much time was "skipped".

Fix this by:

- Calling ossl_quic_set_override_now_cb() in hf_new_ssl() so each QUIC
  channel actually uses the framework's simulated clock, matching what
  the older quictestlib.c harness already did via fake_now_cb().
- Activating the server-side connection object in hf_accept_conn() so
  it gets ticked (SSL_handle_events()) like every other object, driving
  its internal key-update/timer processing forward.

Two correctness issues had to be addressed to make this clock
plumbing safe and deterministic:

- The clock handed to QUIC channels must be purely virtual (a fixed
  base time plus an explicit slip that only advances via
  radix_skip_time()/OP_SKIP_TIME), not real wall-clock time, or
  protocol-timing-sensitive assertions become flaky depending on how
  long real cryptographic work takes on a given machine (e.g. much
  slower on ASAN+UBSAN debug builds), occasionally triggering a
  spurious second TXKU before the first is confirmed. radix_process is
  a single static struct reused across every script in the suite, so
  time_slip must be reset in RADIX_PROCESS_init() -- otherwise a
  script would inherit the previous script's accumulated slip and see
  time jump forward all at once for a brand new connection. The
  virtual clock also needs a small, fixed per-tick advance
  (do_per_op(), mirroring the old harness's qtest_add_time(1) in its
  own connect-wait loop), since QUIC's internal timers need to
  observe time actually passing to make progress during a busy-wait
  such as hf_connect_wait spinning on SSL_connect().
- time_slip needs its own dedicated mutex (time_m) rather than being
  protected by the existing global mutex (gm): get_time() is now
  called by libssl/QUIC's internals (e.g. from within the reactor tick
  while holding QUIC's own locks), whereas gm is held by test code
  across calls into libssl (e.g. hf_clear() holds gm while calling
  SSL_free()). Sharing gm would take gm and QUIC's internal lock in
  opposite orders across those two paths, risking a real deadlock
  (confirmed via a ThreadSanitizer lock-order-inversion report).
- The terp's own script-execution watchdog (max_execution_time) needs
  its own now_cb (terp_now) based on real wall-clock time, so that
  OP_SKIP_TIME doesn't eat into its execution budget, and so it can
  still catch a genuinely stuck script independent of the virtual
  protocol clock. Some scripts also legitimately need a larger budget
  than the terp default on slow or heavily instrumented CI machines.

Assisted-by: Claude:claude-sonnet-5

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Tue Jul 21 09:22:53 2026
(Merged from https://github.com/openssl/openssl/pull/31889)
2026-07-21 11:22:31 +02:00
Andrew Dinh
08d3dd81b2 Port script_19 to radix test framework
Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Tue Jul 21 09:22:51 2026
(Merged from https://github.com/openssl/openssl/pull/31889)
2026-07-21 11:22:31 +02:00
Andrew Dinh
7c6adaee6b Port script_18 to radix test framework
Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Tue Jul 21 09:22:49 2026
(Merged from https://github.com/openssl/openssl/pull/31889)
2026-07-21 11:22:31 +02:00
Andrew Dinh
9b94348003 Port script_17 to radix test framework
Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Tue Jul 21 09:22:48 2026
(Merged from https://github.com/openssl/openssl/pull/31889)
2026-07-21 11:22:31 +02:00
Andrew Dinh
e528888bc0 Port script_16 to radix test framework
Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Tue Jul 21 09:22:46 2026
(Merged from https://github.com/openssl/openssl/pull/31889)
2026-07-21 11:22:31 +02:00
Andrew Dinh
b27fe1419c Port script_15 to radix test framework
Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Tue Jul 21 09:22:44 2026
(Merged from https://github.com/openssl/openssl/pull/31889)
2026-07-21 11:22:31 +02:00
Andrew Dinh
458bfef110 Fix clean target find/-prune precedence bug
The clean target's find command intended -prune to apply to the whole
-o chain of excluded submodule paths, but -prune only binds to the
immediately preceding -path, so only the last path (wycheproof) was
actually protected from recursion. Earlier
submodules (cloudflare-quiche, pkcs11-provider, etc.) were still
descended into, letting make clean delete vendored symlinks inside
them. Move -prune outside the parenthesized path list so it applies
whenever any excluded path matches.

Assisted-by: Claude:claude-sonnet-5
Fixes: 70741ee62a "Configurations/unix-Makefile.tmpl: make cleanup faster"

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Jul 21 09:21:37 2026
(Merged from https://github.com/openssl/openssl/pull/32006)
2026-07-21 11:21:31 +02:00
Andrew Dinh
db5b985369 Migrate QUIC_TSERVER script 13 and script 14 to radix
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Tue Jul 21 09:19:57 2026
(Merged from https://github.com/openssl/openssl/pull/31945)
2026-07-21 11:19:33 +02:00
Jakub Zelenka
a44ba221ab apps: test rsa -text option
The -text option of the rsa app was not exercised by any test. Add a
subtest that prints both a private and a public key in text form and,
after stripping the colon-separated hex formatting, verifies the printed
modulus and private exponent match the committed testrsa.pem keypair
rather than merely checking that the labels are present.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/31950)
2026-07-21 09:32:12 +10:00
Loganaden Velvindron
695eb4bd64 ml_kem: Add a check for shared_secret
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
MergeDate: Mon Jul 20 11:21:15 2026
(Merged from https://github.com/openssl/openssl/pull/31822)
2026-07-20 13:21:13 +02:00
Eugene Syromiatnikov
ef6f59329d demos: wire up echecho
Complements: 50580382ca "Documents initial agreed APIs for Encrypted Client Hello (ECH) and includes a minimal demo for some of those APIs."
Reported-by: Frederik Wedel-Heinen <frederik.wedel-heinen@dencrypt.dk>
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Mon Jul 20 11:19:04 2026
(Merged from https://github.com/openssl/openssl/pull/31751)
2026-07-20 13:18:33 +02:00
Eugene Syromiatnikov
2216d3b10f demos/sslecho/echecho.c: apply Windows-specific changes
Similar to the ones present in demos/sslecho/main.c.

Complements: 50580382ca "Documents initial agreed APIs for Encrypted Client Hello (ECH) and includes a minimal demo for some of those APIs."
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Mon Jul 20 11:19:03 2026
(Merged from https://github.com/openssl/openssl/pull/31751)
2026-07-20 13:18:33 +02:00
Eugene Syromiatnikov
87b0f363dc demos/sslecho/echecho.c: check return values of SSL_* calls
As otherwise it triggers -Werror=unused-result when built
with --strict-warnings.

Complements: 50580382ca "Documents initial agreed APIs for Encrypted Client Hello (ECH) and includes a minimal demo for some of those APIs."
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Mon Jul 20 11:19:01 2026
(Merged from https://github.com/openssl/openssl/pull/31751)
2026-07-20 13:18:33 +02:00
Eugene Syromiatnikov
7a4522bf26 demos/sslecho/echecho.c: use SSL_set1_ipaddr() instead of SSL_set1_host()
As the latter was deprecated in commit f584ae959c "Let's support
multiple names for certificate verification".

Complements: 50580382ca "Documents initial agreed APIs for Encrypted Client Hello (ECH) and includes a minimal demo for some of those APIs."
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Mon Jul 20 11:19:00 2026
(Merged from https://github.com/openssl/openssl/pull/31751)
2026-07-20 13:18:33 +02:00
Eugene Syromiatnikov
bf1f522f34 demos/sslecho/echecho.c: declare locally used functions as static
Otherwise it triggers -Werror=missing-prototypes when built
with --strict-warnings.

Complements: 50580382ca "Documents initial agreed APIs for Encrypted Client Hello (ECH) and includes a minimal demo for some of those APIs."
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Mon Jul 20 11:18:59 2026
(Merged from https://github.com/openssl/openssl/pull/31751)
2026-07-20 13:18:33 +02:00
Eugene Syromiatnikov
936a9ce283 demos/sslecho/echecho.c: use <stdbool.h>
...instead of defining it (incorrectly).

Complements: 50580382ca "Documents initial agreed APIs for Encrypted Client Hello (ECH) and includes a minimal demo for some of those APIs."
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Mon Jul 20 11:18:58 2026
(Merged from https://github.com/openssl/openssl/pull/31751)
2026-07-20 13:18:33 +02:00
Eugene Syromiatnikov
0e1176078f demos/sslecho/echecho.c: reflow overly long lines
Complements: 50580382ca "Documents initial agreed APIs for Encrypted Client Hello (ECH) and includes a minimal demo for some of those APIs."
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Mon Jul 20 11:18:57 2026
(Merged from https://github.com/openssl/openssl/pull/31751)
2026-07-20 13:18:33 +02:00
Eugene Syromiatnikov
913cd240c7 demos: add PKCS#12 reading and writing demos to the primary build system
For some reason, demos in the pkcs12 directory were omitted during
the initial conversion done in commit 2000281dad "Convert demos
to primary build system".  Rescind this omission.

Complements: 2000281dad "Convert demos to primary build system"
Reported-by: Frederik Wedel-Heinen <frederik.wedel-heinen@dencrypt.dk>
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Mon Jul 20 11:18:55 2026
(Merged from https://github.com/openssl/openssl/pull/31751)
2026-07-20 13:18:33 +02:00
Eugene Syromiatnikov
3227ca41ec demos/pkcs12/pkwrite.c: drop deprecated init calls
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Mon Jul 20 11:18:54 2026
(Merged from https://github.com/openssl/openssl/pull/31751)
2026-07-20 13:18:33 +02:00
Eugene Syromiatnikov
25a7067b3d demos/README.txt: mention quic-server-block.c and quic-server-non-block.c
Complements: dad45ea769 "Adds a new demo blocking QUIC server for use with the existing demo QUIC clients"
Complements: d9d4d84ceb "Add demo QUIC non-blocking server"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Mon Jul 20 11:18:53 2026
(Merged from https://github.com/openssl/openssl/pull/31751)
2026-07-20 13:18:33 +02:00
Eugene Syromiatnikov
8f8c42fa2d demos: wire up tls-server-block
The blocking TLS server demo code was added f4b4a185b5 "MVP demo TLS
server", which, while was applied after 2000281dad "Convert demos
to primary build system", was authored before, and hasn't been updated
accordingly.  Rescind that omission by add the relevant introes
to build.info.

Also, while at it, mention tls-server-block in demos/README.txt.

Complements: f4b4a185b5 "MVP demo TLS server"
Reported-by: Frederik Wedel-Heinen <frederik.wedel-heinen@dencrypt.dk>
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Mon Jul 20 11:18:52 2026
(Merged from https://github.com/openssl/openssl/pull/31751)
2026-07-20 13:18:33 +02:00
Eugene Syromiatnikov
940f4930c8 demos/guide/tls-server-block.c: check results of __owur API calls
Check results of SSL_CTX_set_session_id_context()
and SSL_CTX_set_timeout() calls, as these functions are marked
with __owur, leading to compilation error when compiled
with -Werror=unused-result.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Mon Jul 20 11:18:51 2026
(Merged from https://github.com/openssl/openssl/pull/31751)
2026-07-20 13:18:33 +02:00
Weidong Wang
8194b426f9 Add regression test for negative EVP_CIPHER_get_iv_length() in PKCS5_pbe2_set_scrypt
A malicious provider returning SIZE_MAX as IV length causes
evp_cipher_cache_constants() to store -1 via size_t->int truncation.
Without the ivlen > 0 guard, this leads to memcpy(iv[16], aiv, SIZE_MAX)
— a stack buffer overflow.

The test registers a fake provider with SIZE_MAX IV length, then calls
PKCS5_pbe2_set_scrypt() and asserts it returns NULL without crashing.

test for #30510

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
MergeDate: Mon Jul 20 11:15:18 2026
(Merged from https://github.com/openssl/openssl/pull/30615)
2026-07-20 13:15:11 +02:00
Frederik Wedel-Heinen
437e09afb1 Make sure we always check return of CRYPTO_UP_REF which can fail.
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Mon Jul 20 11:13:58 2026
(Merged from https://github.com/openssl/openssl/pull/31753)
2026-07-20 13:13:57 +02:00
John Claus
4f258c3f3c Fix DSA with SHA-384 / SHA-512 X.509 verification (issue openssl#30432)
Register dsa_with_SHA384 and dsa_with_SHA512 in obj_xref so signature verification resolves digest + DSA key type.

Add test_verify regression tests and PEM fixtures; add executable DSA cert generation in test/certs/setup.sh. CHANGES.md and NEWS.md entries for 4.0→4.1.

Address review: plan tests 215, remove CHANGES merge artifact, replace comment-only setup.sh notes with actual openssl commands.

Fixes openssl#30432

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon Jul 20 11:10:47 2026
(Merged from https://github.com/openssl/openssl/pull/30655)
2026-07-20 13:10:45 +02:00
Norbert Pocs
0345927a02 test_ocsp: bump test number
Signed-off-by: Norbert Pocs <norbertp@openssl.org>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon Jul 20 10:19:08 2026
(Merged from https://github.com/openssl/openssl/pull/32014)
2026-07-20 12:02:17 +02:00
Enji Cooper
1512b30732 INSTALL.md: document --manpage-format changes
This change documents the new Configure option, `--manpage-format`.

Address formatting issues and expound on the `Reconfigure` section.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 20 09:52:30 2026
(Merged from https://github.com/openssl/openssl/pull/28450)
2026-07-20 11:52:21 +02:00
Enji Cooper
5bbc49a5c9 Add mandoc output support for manpages
This change modifies the Makefile generator to support mandoc format
manpages, in lieu of \*roff format manpages.

After this commit the user has the ability of specifying the manpage
format to the `--manpage-format` flag. The 2 supported manpage formats
as of writing are "mdoc" and "roff" and the default remains the "roff"
format for legacy and portability reasons.

The mandoc format requires pod2mdoc to be installed, whereas the roff
output format requires pod2man to be installed. The former requires an
additional utility be installed, whereas the latter uses pod2man, a
utility that has been present with perl distributions for well over a
decade.

mandoc format support is being added as it is an easier/arguably more
structured manpage format to parse, making it easier for downstream
consumers like FreeBSD to implement OS-specific build support, as the
minimum dependencies for the OpenSSL build process are more involved
than the tools available for the FreeBSD OS bootstrapping process.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 20 09:52:29 2026
(Merged from https://github.com/openssl/openssl/pull/28450)
2026-07-20 11:52:21 +02:00
Mounir IDRASSI
a5b3f8863f Fix SM2 RISC-V64 crash from functions emitted into .rodata
The ecp_sm2p256-riscv64.pl generator switches to .section .rodata
to emit constant data (.Lpoly, .Lord, .Lpoly_div_2, .Lord_div_2), but
never switches back before emitting function code.

As a result, the function symbols defined by this file are assembled
into .rodata instead of executable .text. On systems enforcing NX for
.rodata, calling the RISC-V64 SM2 assembly faults immediately.

Fix this by adding .previous after the constant block, restoring the
initial .text section before function emission.

Verified with readelf: before the fix, .text is empty and the function
symbols are in .rodata; after the fix, constants remain in .rodata and
the function symbols are in executable .text.

Introduced in commit 05301b100f (PR #25918).

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Mon Jul 20 09:47:35 2026
(Merged from https://github.com/openssl/openssl/pull/31874)
2026-07-20 11:47:26 +02:00
Frederik Wedel-Heinen
f106d7632a Only verify software can build if it is not a documentation only PR.
Resolves: https://github.com/openssl/openssl/issues/29167

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Mon Jul 20 09:46:03 2026
(Merged from https://github.com/openssl/openssl/pull/30712)
2026-07-20 11:46:00 +02:00
Jakub Zelenka
6a1f43c5dd apps: add offline OCSP request/responder/verify round-trip test
Exercise the request-generation and built-in responder halves of the
ocsp app without any sockets: build a request, have the responder
answer it against the static index, then verify the self-generated
response.

This covers make_ocsp_response, lookup_serial, add_ocsp_cert,
add_ocsp_serial and the status-printing body of print_ocsp_summary
(GOOD and UNKNOWN), none of which were reached by the existing
-respin-only app tests.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Tim Hudson <tjh@openssl.org>
MergeDate: Mon Jul 20 09:29:35 2026
(Merged from https://github.com/openssl/openssl/pull/31834)
2026-07-20 11:29:31 +02:00
olszomal
27858603cb doc: clarify pkeyutl -rawin and -digest for no-prehash signatures
Complements: 5421423 "Flexible encoders for ML-DSA"

Signed-off-by: olszomal <Malgorzata.Olszowka@stunnel.org>

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
MergeDate: Mon Jul 20 09:13:08 2026
(Merged from https://github.com/openssl/openssl/pull/31478)
2026-07-20 11:13:03 +02:00
Jakub Zelenka
2e49fe4ad8 statem: test tls_construct_client_certificate
Exercise the certificate output functions under mfail with real key
material embedded in the test: an x509 chain over TLS 1.3 and an RPK over
TLS 1.2.  Add deterministic tests for the error branches mfail cannot
reach: an unknown certificate type, a failed write-key change, and
WPACKET failures writing the TLS 1.3 context.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon Jul 20 09:11:48 2026
(Merged from https://github.com/openssl/openssl/pull/31861)
2026-07-20 11:11:36 +02:00
Jakub Zelenka
7f850c3dbb statem: test tls_construct_end_of_early_data
Cover the success path (state advances to FINISHED_WRITING, empty body)
and the invalid-state error path.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon Jul 20 09:11:47 2026
(Merged from https://github.com/openssl/openssl/pull/31861)
2026-07-20 11:11:36 +02:00
Jakub Zelenka
3a38f542ad statem: generalize statem_clnt construct test helpers
Parameterize prime_ssl() by message type and extract a generic
finish_msg() so the scaffolding is reusable by other client construct
tests.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon Jul 20 09:11:45 2026
(Merged from https://github.com/openssl/openssl/pull/31861)
2026-07-20 11:11:36 +02:00
Jakub Zelenka
e0bf61917a apps: decode DTLSv1.2 records in s_client/s_server -msg output
The msg_cb message callback used by the -msg option only recognised
DTLSv1.0 among the DTLS versions, so DTLSv1.2 records were logged as
"Not TLS data or unknown version" instead of being decoded. Add
DTLS1_2_VERSION to the recognised version check and to the ssl_versions
lookup table, and wrap the now-overlong condition.

Add a test that runs s_client against s_server over TLSv1.2, TLSv1.3 and
DTLSv1.2, logging the protocol messages via -msg, and checks that every
record is decoded (no "Not TLS data or unknown version" lines).

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Mon Jul 20 09:09:07 2026
(Merged from https://github.com/openssl/openssl/pull/31994)
2026-07-20 11:08:51 +02:00
Nikola Pajkovsky
1865b55846 test: update provider Valgrind suppression
The internal provider test intentionally retains its configured provider
when OPENSSL_cleanup() is skipped under OSSL_USE_VALGRIND. The existing
suppression accounts for this state but no longer matches the provider
activation stack because provider_init() appears between
OSSL_provider_init() and provider_activate().

Add the missing frame so the provider context and its diagnostic strings
are correctly suppressed.

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

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Mon Jul 20 09:07:11 2026
(Merged from https://github.com/openssl/openssl/pull/31961)
2026-07-20 11:06:53 +02:00
Nikola Pajkovsky
29616c15e4 test: clean up thread-local key in QUIC radix tests
The QUIC radix test creates a new thread-local key for each script but
only clears the associated value during teardown. The key itself
is never deleted.

Delete the thread-local key after all child threads have joined and the
main-thread value has been cleared.

  1,536 bytes in 3 blocks are still reachable in loss record 873 of 915
     at 0x488D0B0: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-arm64-linux.so)
     by 0x49561CF: pthread_setspecific@@GLIBC_2.34 (in /usr/lib64/libc.so.6)
     by 0x5C0FD7: CRYPTO_THREAD_set_local (threads_pthread.c:1030)
     by 0x41132F: radix_thread_init (quic_bindings.c:570)
     by 0x4114F7: bindings_process_init (quic_bindings.c:604)
     by 0x422563: test_script (main.c:28)
     by 0x5152DF: run_tests (driver.c:518)
     by 0x517447: main (main.c:52)

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

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Mon Jul 20 09:07:10 2026
(Merged from https://github.com/openssl/openssl/pull/31961)
2026-07-20 11:06:53 +02:00
Nikola Pajkovsky
a20fa49828 test/p_ossltest: fix uninitialised bytes written in TLS1-AAD GCM mode
The test provider's fake AES-128-GCM cipher works by running the real
sub-cipher for its side effects and then copying the memdup'd input
back over the output buffer, so the "encrypted" record is really the
plaintext.

In a TLS record the buffer handed to the cipher reserves an
uninitialised 8-byte explicit IV at the front and a 16-byte auth tag
at the end for the cipher to fill. OPENSSL_memdup() duplicated those
uninitialised IV/tag regions, and the subsequent memcpy(out, inbuf, inl)
copied them into out. That output was then written to the socket,
triggering valgrind's "Syscall param write(buf) points to uninitialised
byte(s)":

    at sock_write (bss_sock.c:155)
    by bwrite_conv (bio_meth.c:79)
    by BIO_write (bio_lib.c:397)
    by statem_flush (statem.c:963)
    by ossl_statem_client_post_work (statem_clnt.c:881)
    ...

Track whether EVP_CTRL_AEAD_TLS1_AAD was set (recorded in
set_ctx_params) and, when encrypting a TLS record, copy only the
plaintext payload back, leaving the explicit IV and tag that the real
sub-cipher actually produced intact.

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

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Mon Jul 20 09:07:08 2026
(Merged from https://github.com/openssl/openssl/pull/31961)
2026-07-20 11:06:53 +02:00
Nikola Pajkovsky
d00cf645c1 test: include PID in valgrind log file names
Append the %p (process ID) placeholder to valgrind's --log-file in
both app() and test(). When a test spawns multiple processes sharing
the same result index, they previously wrote to the same log file and
clobbered each other's output. Using %p gives each process its own
log, so no valgrind findings are lost.

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

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Mon Jul 20 09:07:07 2026
(Merged from https://github.com/openssl/openssl/pull/31961)
2026-07-20 11:06:53 +02:00
Frederik Wedel-Heinen
7f58002be8 Removes unused functions and macros from ssl_local.h and recmethod_local.h
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Mon Jul 20 09:06:08 2026
(Merged from https://github.com/openssl/openssl/pull/31719)
2026-07-20 11:05:57 +02:00
Norbert Pocs
13bef2616f tests: Check the return value of BN_hex2bn()
Fixes coverity issues 1398635, 1696548, 1696549.

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

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Jul 20 09:04:13 2026
(Merged from https://github.com/openssl/openssl/pull/31943)
2026-07-20 11:04:11 +02:00
Viktor Dukhovni
5bf14bcaae Extend TLS group list parser test cases
The new edge case tests cover potential parser invariant violations
fixed in the prior commit.

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Mon Jul 20 07:12:31 2026
(Merged from https://github.com/openssl/openssl/pull/31926)
2026-07-20 09:12:19 +02:00
Viktor Dukhovni
5b445cd96a Fix removal of sole key exchange group in tuple
- Don't attempt to float its keyshare if any
- Include active tuple in memmove() that excises a newly empty closed tuple.

Add comments to clarify the logic.

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Mon Jul 20 07:12:30 2026
(Merged from https://github.com/openssl/openssl/pull/31926)
2026-07-20 09:12:19 +02:00
Jakub Zelenka
d4357db45c mkwraps: resolve system (libc) functions via compiler include paths
WRAP[] lists mix OpenSSL functions with libc/POSIX ones such as read()
or socket(), which mkwraps.pl reported as "declaration not found" since
it only searched the project's INCLUDE[] directories.

Fall back to the C compiler's default include search paths for functions
missing from the project headers.  They are queried lazily, only on such
a miss, so the all-OpenSSL case still does not walk /usr/include.  Parse
the glibc trailing attribute macros (__THROW, __wur, ...) and restrict
qualifier, and add --cc and --no-system.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Mon Jul 20 07:00:57 2026
(Merged from https://github.com/openssl/openssl/pull/31936)
2026-07-20 09:00:49 +02:00
Billy Brumley
4bf85819b7 [providers/implementations/ciphers] GCM-SIV: reject out-of-order update calls
For GCM-SIV:

1. AAD must precede the payload
2. the payload must be single shot

(2) was already happening, this change moves from a silent fail to
an explicit error message for multiple update calls on the payload.

For (1), this change unifies the logic for (2) one level up in the wrapper.
So the code previously allowed (1), and now errors out after this change.

Follow-up to #31906

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Mon Jul 20 06:56:04 2026
(Merged from https://github.com/openssl/openssl/pull/31940)
2026-07-20 08:55:44 +02:00
Jakub Zelenka
caf63500b6 apps: add dgst test coverage for -keyform option
The -keyform (OPT_KEYFORM) option of the dgst app was not exercised by
any test.  Add a subtest that converts the RSA test keys to DER and
then signs and verifies with -keyform DER, covering the option for both
the private and public key loading paths.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
MergeDate: Mon Jul 20 06:40:45 2026
(Merged from https://github.com/openssl/openssl/pull/31946)
2026-07-20 08:40:40 +02:00
Ondrej Moris
61b8506921 tests: reduce pkcs11-provider log test to failures
If pkcs11-provider external test fails, only output of failed tests
is printed.

Signed-off-by: Ondrej Moris <omoris@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Igor Ustinov <igus@openssl.foundation>
MergeDate: Mon Jul 20 06:29:41 2026
(Merged from https://github.com/openssl/openssl/pull/31947)
2026-07-20 08:29:37 +02:00
Jakub Zelenka
5eb81718bc apps: test dsa -text option
The -text option of the dsa app was not exercised by any test. Add a
subtest that prints both a private and a public key in text form and,
after stripping the colon-separated hex formatting, verifies the printed
private and public values match the committed testdsa.pem keypair rather
than merely checking that the labels are present.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
MergeDate: Mon Jul 20 06:26:08 2026
(Merged from https://github.com/openssl/openssl/pull/31949)
2026-07-20 08:26:03 +02:00
Bob Beck
ba569d08ed Add a patch disabling the pem_encoder test
This seems to have strange internal failures retrieving EC keys from
the kryoptic soft hsm. (based on reading the meson stuff this also
occurs on some linux distros and this is disabled there too)

The same test appears to work fine with RSA keys, but diagnosing
this is challenging with nothing int the voluminous output that
might say why it didn't work. So disable this for now

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Sat Jul 18 13:01:21 2026
(Merged from https://github.com/openssl/openssl/pull/31194)
2026-07-18 15:01:13 +02:00
Bob Beck
9044e5f425 Convert internal use of ASN1_STRING_set and ASN1_STRING_length
to use their non-deprecated replacements. For "pretty-printing"
applications and test code that use a length and require an int, size_t lengths
are simply cast to an int. For writes and protocol level things
size_t lengths are checked against INT_MAX and take the error
path if the returned value is too large to be used for a funciton
that takes an integer length.

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Sat Jul 18 13:01:19 2026
(Merged from https://github.com/openssl/openssl/pull/31194)
2026-07-18 15:01:13 +02:00
Bob Beck
0161fe45d1 Add a CHANGES.md entry
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Sat Jul 18 13:01:18 2026
(Merged from https://github.com/openssl/openssl/pull/31194)
2026-07-18 15:00:57 +02:00
Bob Beck
8d9fb09b9e pass length in cmp_msg stuff
ossl_cmp_sk_ASN1_UTF8STRING_push_str depended under the covers on
passing a -1 to have strlen magically called in the setter. Don't
depend on this and simply pass in the correct length

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Sat Jul 18 13:01:17 2026
(Merged from https://github.com/openssl/openssl/pull/31194)
2026-07-18 15:00:57 +02:00
Bob Beck
28179061bf Prepare a now opaque ASN1_STRING for the size_t rapture.
Now that ASN1_STRING is opaque, we can finally move away
from an int for the length internally. The remaining problematic
piece for this is that ASN1_STRING_length() returns an int
and is public API.

Therefore, we deprecate ASN1_STRING_length() and provide a
replacement ASN1_STRING_length_ex() that returns a size_t length.

We also provide setting functions that take size_t lengths,
they are ASN1_STRING_set_data() which takes a uint8_t data
pointer and a size_t length, and ASN1_STRING_set_string() which
takes a argument that must be a c string and will use strlen
to determine the length. (This replaces th previous arcane
behaviour of calling "strlen" on a magical input length value
of -1, which leads to bugs.)  We then deprecate ASN1_STRING_set().

ASN1_STRING_set_string() requires a valid C string argument that
may not be NULL - refer to the documentation.

Both new functions do not magically add 0 bytes on the end of
values, as ASN1_STRING has already been documented for a long
time to not depend on this behaviour.

Both new functions do not allow the setting of values on an
ASN1_BIT_STRING, as ASN1_BIT_STRING_set1 must be used for that.

Note that this does *NOT* yet change ASN1_STRING to use size_t
internally, this must wait until the integer-returning ASN1_STRING_length()
has been deprecated, and then removed in future major. Once
ASN1_STRING_length() has been removed then ASN1_STRING internally
can change to using a size_t for the length of the data.
(And the setters will no longer return an error if the provided
size_t length exceeds INT_MAX)

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Sat Jul 18 13:01:15 2026
(Merged from https://github.com/openssl/openssl/pull/31194)
2026-07-18 15:00:57 +02:00
Jakub Zelenka
d8bf6cdd48 test: don't depend on DTLS alert delivery in sslrecords test
The unknown-record-type tests (tests 5 and 6) inferred failure of a DTLS
connection from TLSProxy's socket-teardown timing ($proxy_start_success == 0).
This relied on the client's fatal alert reaching the peer before the client
closes its socket, which is a race: DTLS alerts are best-effort and are never
retransmitted (RFC 6347 section 4.2.7 / RFC 9147 section 5.10), and after the
s_client shutdown drain was skipped for datagram protocols the alert can be
lost during teardown, making the test flaky.

Verify instead what is actually under test: that the DTLS client rejected the
unrecognised record type, i.e. that s_client exited with a failure. This is a
deterministic, local decision that does not depend on the alert being observed
by the peer. Keep the alert observation as a best-effort diagnostic note.

Capture the s_client exit status in TLSProxy (previously discarded after
waitpid) and expose it via a new clientexit accessor.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Sat Jul 18 12:53:26 2026
(Merged from https://github.com/openssl/openssl/pull/31927)
2026-07-18 14:53:09 +02:00
Jakub Zelenka
49057cbe91 apps: test pkey -encopt option
The -encopt option of the pkey app was not exercised by any test; the
existing ML-DSA codec tests only used genpkey -encopt and pkey with
-provparam. Re-encode the seed-priv key into each supported PKCS#8
output format via 'pkey -encopt output_formats:<form>' and check the
result matches the reference for that form. A control compares against
the default (no -encopt) encoding so the match is attributed to -encopt
rather than the default behaviour.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Tim Hudson <tjh@openssl.org>
MergeDate: Fri Jul 17 08:51:40 2026
(Merged from https://github.com/openssl/openssl/pull/31951)
2026-07-17 10:51:33 +02:00
Jakub Zelenka
4ef7e3b3cd apps: test ec and ecparam -text options
The -text option was not exercised for the ec or ecparam apps. Add a
subtest to 15-test_ec.t that prints a private and a public EC key and,
after stripping the colon-separated hex formatting, verifies the printed
private and public values match the committed testec-p256.pem keypair as
well as the curve identification. Add a subtest to 15-test_ecparam.t
that prints named and explicit parameters, checking the named form emits
the expected curve OID and NIST name while the explicit form emits the
field parameters and no OID.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Tim Hudson <tjh@openssl.org>
MergeDate: Fri Jul 17 08:47:12 2026
(Merged from https://github.com/openssl/openssl/pull/31952)
2026-07-17 10:47:02 +02:00
Andrew Dinh
98a726d3ca Introduce OP_BIND() to QUIC RADIX test framework
RADIX framework keeps objects needed by test scripts
in two places:
  - hash table bound to radix process (`RP()->objs`), all
  objects are stored there
  - slot which is an array bound to radix thread (`RT()->slot[]`)

The `slot` is an array which is used to pass arguments
to RADIX ops. The typically script is doing something
like this:
```
   OP_SELECT_SSL(0, C); /* places 'C' object to slot 0 in thread */
   OP_FUNC(print_ssl);  /* calls print_ssl function, which prints object */
```
All objects are managed by RADIX framework, scripts have very
limited options to control object's lifetime. The only way for
scripts to let object go is to use `OP_UNBIND()`. The operation
removes the object from hastable (`RP()->objs`) and frees the
object afterwards. This is good enough as long a all tests
are running in single thread. Currently `OP_UNBIND()` is
required when test needs to accept/create more than one stream.
The test has two options. It can use unique name for each
stream it creates/accepts:
```
   OP_ACCEPT_STREAM_WAIT(C, C0, 0);
   OP_ACCEPT_STREAM_WAIT(C, C1, 0);
   OP_ACCEPT_STREAM_WAIT(C, C2, 0);
```
Or script may re-use the same variable for stream,
in that case `OP_UNBIND()` is needed:
```
   OP_ACCEPT_STREAM_WAIT(C, C0, 0);
   OP_UNBIND(C0);
   OP_ACCEPT_STREAM_WAIT(C, C0, 0);
   OP_UNBIND(C0);
   OP_ACCEPT_STREAM_WAIT(C, C0, 0);
   OP_UNBIND(C0);
```
Unfortunately `OP_UNBIND()` can not be used when test
uses more than one thread due to missing locking of `RP()->objs`.

Introducing a locking scheme seems to be bit invasive change,
The OP_BIND()  here hopes to be sufficient and good enough for now.

The idea is as follows:
  - `OP_BIND()` allows  script to insert empty object
  into `RP()->objs` OP_BIND() is supposed to run before
  script spawns thread(s). No manipulation of `RP()->objs`
  is allowed after threads are spawned, operations
  OP_BIND()/OP_UNBIND() are not thread safe.

  - Introduce `OP_F_REPLACE_STREAM` flag which tells
  `OP_ACCEPT_STREAM_WAIT()`/`OP_NEW_STREAM()` to re-use
   existing id for stream. This `_REPLACE_` flag requires
   read-only access to `RP()->objs` hash table.

  - change introduces a per radix object mutex so object can
  be updated safely w.r.t. RADIX thread which ticks SSL object
  bound in radix object.

The guideline for tests which require more then one thread
is as follows:
   - the first thread creates complete set of empty objects
   for all threads.

   - each test thread gets its own set of variables, so it
   can populate them later during test with SSL objects

   - objects are not supposed to be shared between threads

This is a snippet of script executed by main thread before
additional threads are spawned:

```
   ...
   OP_BIND(C1);  /* stream id for child */
   OP_BIND(S1);  /* stream id for parent */

   OP_SPAWN_THREAD(child);
   for (i = 0; i < 10; i++) {
      OP_NEW_STREAM(S, S1, OP_F_REPLACE_STREAM);
      OP_WRITE_B(S1, "foo");
      OP_CONCLUDE(S1);
   }
```
This snippet comes from child:
```
   for (i = 0; i < 10; i++) {
      OP_ACCEPT_STREAM_WAIT(C, C1, OP_F_REPLACE_STREAM);
      OP_READ_EXPECT_B(C1, "foo");
      OP_EXPECT_FIN(C1);
   }
```
As you can see parent and child don't use OP_BIND()/OP_UNBIND()
after child thread is spawned.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Fri Jul 17 08:02:04 2026
(Merged from https://github.com/openssl/openssl/pull/31821)
2026-07-17 10:01:58 +02:00
Andrew Dinh
4eab5e3bb2 Port script12
Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Fri Jul 17 08:02:03 2026
(Merged from https://github.com/openssl/openssl/pull/31821)
2026-07-17 10:01:26 +02:00
Andrew Dinh
c86b202ef4 Port script11
Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Fri Jul 17 08:02:02 2026
(Merged from https://github.com/openssl/openssl/pull/31821)
2026-07-17 10:01:26 +02:00
Andrew Dinh
e1febbd01a Port script10
Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Fri Jul 17 08:02:00 2026
(Merged from https://github.com/openssl/openssl/pull/31821)
2026-07-17 10:01:26 +02:00
Jakub Zelenka
e8a742176a rand: fix jitter seed macro logic
The seeding macro logic was mixed up and incompletely applied. The
macro logic was also cleaned up.

Co-authored-by: Paul Dale <pauli@openssl.org>

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Jul 17 04:47:07 2026
(Merged from https://github.com/openssl/openssl/pull/31970)
2026-07-17 06:46:51 +02:00
Neil Horman
cb9a902175 Fix dsaparams decoding from DER files
The tests addded in commit d8a7e8e uncovered an odd error case.

https://github.com/openssl/openssl/actions/runs/29303845665/job/86993085732

Is failing when attempting to read in a der file converting from a
corresponding PEM file containing DSA parameters.

Interestingly The problem was only occuring when:
1) The input was a DER file
and
2) Blake2 was not configured

Doing some tracing of the decoder operation showed that this is occuring
because the OSSL_STORE lookup used to find the proper decoder uses a
"first successful decode wins" approach, after which the loading code
checks to see if the decoded type matches the expected key type.

When decoding PEM, this isn't a problem, as the PEM armoring gives the
decoder a hint as to why type of data the input file is.

But with DER, there is no such hint, and we're at the mercy of whichever
decoder happens to decode the data correctly first.  Normally it works
just fine, but when features are disabled or enabled, the order in which
the decoders are attempted may change, affecting the outcome.  In this
particular case, disabling blake2 caused the DHX decoder to be attempted
first, which decodes the input der file without issue.  That in turn
caused the subsequent EVP_PKEY_is_a check to fail (as we were expecting
a DSA key), and so the test fails.

Fortunately, the code that the dsaparam applet uses to do this decode
provides a keytype hint, which we can use to guide the decode process.
keep the old store lookup method around in case anyone doesn't pass a
uri that is a file path or provide a keytype, but if we do both those
things, we can use OSSL_DECODER_CTX_new_for_pkey to specifically tell
the decoder that we want to decode the input data as the expected type
(in this case a DSA key).

Fixes #31944

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Tim Hudson <tjh@openssl.org>
MergeDate: Thu Jul 16 15:28:32 2026
(Merged from https://github.com/openssl/openssl/pull/31954)
2026-07-16 11:28:30 -04:00
Jakub Zelenka
96de7d164b rand: pre-fetch JITTER seed when jitter used
This fixes failing rand mfail test when jitter used

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jul 15 16:18:29 2026
(Merged from https://github.com/openssl/openssl/pull/31938)
2026-07-15 18:18:24 +02:00
Jakub Zelenka
385f12644c apps: cover the crl -gendelta, -key and -keyform options
The -gendelta, -key and -keyform options of the crl app were previously
untested. It adds a subtest that generates two CRLs with an incrementing
crlNumber and then uses -gendelta with -key to produce a delta CRL,
checking the result carries a Delta CRL Indicator. It also loads the
signing key from DER via -keyform DER, and checks that a mismatching
-keyform and a missing -key both make -gendelta fail.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jul 15 16:05:31 2026
(Merged from https://github.com/openssl/openssl/pull/31910)
2026-07-15 18:05:24 +02:00
Jakub Zelenka
e211f88c64 apps: test genpkey app cipher option
Add coverage for encrypting the generated private key with a cipher,
checking it can only be read back with the correct passphrase, and that
a cipher is rejected together with the -genparam option.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jul 15 16:03:37 2026
(Merged from https://github.com/openssl/openssl/pull/31893)
2026-07-15 18:03:32 +02:00
Jakub Zelenka
dca561d4cd Integrate mfail functionality to fuzz tests
Run the fuzz corpora under mfail in addition to the normal path, so the
existing inputs also exercise malloc-failure handling. The fuzz.pl harness
sizes the mfail runs to a time budget and, on a leak, bisects down to the
exact file and injection point. Adds a budgeted asan/ubsan CI job to run it.

Assisted-by: Claude:claude-opus-4-6

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jul 15 16:01:43 2026
(Merged from https://github.com/openssl/openssl/pull/30944)
2026-07-15 18:01:30 +02:00
Jakub Zelenka
c263ea553c Fix fuzz test to handle memory failures
It also fixes related memory leaks and removes extensive asserts that
should not be present in fuzzy tests.

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jul 15 16:01:42 2026
(Merged from https://github.com/openssl/openssl/pull/30944)
2026-07-15 18:01:30 +02:00
Jakub Zelenka
857afd02b2 test: add Windows unit tests setup and initial dgram test
This adds an initial setup for unit testing on Windows that allows
mocking of system functions using Detour library. This works only for
library functions and not object function like wrap so it is a bit
limited but it is still useful for BIO mocking.

An initial BIO bss_dgram test is added covering the Windows specific
parts.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Igor Ustinov <igus@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jul 15 16:00:35 2026
(Merged from https://github.com/openssl/openssl/pull/31915)
2026-07-15 18:00:29 +02:00
Richard Levitte
380d6afcb3 keccak1600x4-avx512vl: fix undefined symbols on macOS
The one-shot SHAKE x4 wrappers call the incremental absorb and squeeze
routines through call_internal(), which on non-Win64 emitted a call to
the public global symbol by its bare name.  These calls textually
precede the callees' .globl declarations, so x86_64-xlate.pl never
prepends the platform's leading underscore to the referenced symbol.

On ELF (Linux) that is harmless since symbols carry no leading
underscore, but on Mach-O (macOS) the call references the un-decorated
SHA3_shake*_x4_inc_*_avx512vl while the defined symbol is
_SHA3_shake*_x4_inc_*_avx512vl, leaving four undefined externals and
breaking the darwin64-x86_64 link of libcrypto:

  SHA3_shake128_x4_inc_absorb_avx512vl
  SHA3_shake256_x4_inc_absorb_avx512vl
  SHA3_shake128_x4_inc_squeeze_avx512vl
  SHA3_shake256_x4_inc_squeeze_avx512vl

Call the local .L_<name> entry label instead -- the same address as the
public symbol and the pattern the finalize calls already use -- so the
reference resolves locally and these internal routines cannot be
interposed.  The Win64 path is unchanged.

Fixes: https://github.com/openssl/openssl/issues/31941
Fixes: a248ec771e ("ML-DSA: Add AVX512VL SHAKE x4 multi-buffer integration")
Assisted-by: Pi:z-ai/glm-5.2

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Tue Jul 14 12:33:50 2026
(Merged from https://github.com/openssl/openssl/pull/31942)
2026-07-14 11:40:18 +02:00
Neil Horman
ac946a80d5 ugment p_ossltest with encoder/decoder/store algs
Create dummy encoder/decoder and store algs in p_ossltest.

They do nothing, except return algorithms on query.  This allows our
unit test 30-test_evp_list_noncache.t to exercise the refcounting of
these objects when the provider requests no caching

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Jul 14 05:21:38 2026
(Merged from https://github.com/openssl/openssl/pull/31844)
2026-07-14 07:20:58 +02:00
Neil Horman
f454c8fd5d Fix refcounting for ENCODER/DECODER/STORE methods without caching
https://github.com/openssl/openssl/pull/31782
Fixed method refcounting for EVP objects when the provider they are
fetched from requests no-caching, but I neglected to add simmilar
refcounting fixes for DECODERS/ENCODERS and STORE objects, who follow a
different fetch path (these use inner_[decoder|encoder|loader]_fetch
rather than inner_evp_generic_fetch.

They got missed because the p_ossltest provider that we use to test
these paths don't provide these objects, so the path never got
exercised.

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Jul 14 05:21:36 2026
(Merged from https://github.com/openssl/openssl/pull/31844)
2026-07-14 07:20:58 +02:00
Marcel Cornu
626ff8fd93 .github: add AVX512VL workflow using Intel SDE
Add a new CI workflow that runs AVX512 specific tests under Intel SDE
v10.8, since GitHub Actions runners do not currently have AVX512
hardware.
SDE emulates AVX512 instructions and spoofs CPUID so the AVX512 code
paths can be exercised.

Two jobs are included: linux (ubuntu-latest) and windows (windows-2022).
Each job builds OpenSSL with no-shared and enable-fips, then runs the
following tests under `sde64 -icx` (Icelake Server):

- ml_dsa_internal_test: exercises AVX512VL ML-DSA sampling
- sha3_x4_internal_test: exercises AVX512VL SHAKE x4 functions
- openssl fipsinstall: runs the full FIPS KAT suite (including ML-DSA
  and SHA3 self-tests) against the FIPS provider under emulation

Signed-off-by: Marcel Cornu <marcel.d.cornu@intel.com>

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Mon Jul 13 15:55:57 2026
(Merged from https://github.com/openssl/openssl/pull/31090)
2026-07-13 17:55:51 +02:00
Marcel Cornu
27caecd416 test: add SHAKE x4 internal cross-validation tests
Add a new `sha3_x4_internal_test` target and recipe to validate the
internal SHAKE x4 implementation against scalar SHA3 reference paths.

Cover SHAKE-128 and SHAKE-256 in one-shot and incremental modes, plus
multi-absorb and multi-squeeze cases across varied input and output
sizes. Tests are skipped when AVX512VL extensions are not available.

Signed-off-by: Marcel Cornu <marcel.d.cornu@intel.com>

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Mon Jul 13 15:55:55 2026
(Merged from https://github.com/openssl/openssl/pull/31090)
2026-07-13 17:55:51 +02:00
Marcel Cornu
a248ec771e ML-DSA: Add AVX512VL SHAKE x4 multi-buffer integration
Changes:
- Adds new SHAKE x4 API to perform 4 SHAKE operations in parallel when AVX512VL is supported.
- Adds AVX512VL Keccak x4 assembly module (keccak1600x4-avx512vl).
- Adds internal SHA3 x4 APIs/context in sha3.h and wrappers in sha3_x4.c modules.
- Adds runtime dispatch for ML-DSA sample operations with an OSSL_ML_DSA_SAMPLE_OPS vtable.
  Callers obtain the correct implementation via ossl_ml_dsa_sample_ops(), which returns
  either the generic scalar ops functions, or the AVX512VL multi-buffer ops depending
  on the build and CPU capabilities.
- Adds x86-64 multi-buffer function implementation into ml_dsa_sample_hw_x86_64.inc,
  included in ml_dsa_sample.c when KECCAK1600_ASM and x86_64 are defined.

Co-authored-by: Tomasz Kantecki <tomasz.kantecki@intel.com>
Signed-off-by: Marcel Cornu <marcel.d.cornu@intel.com>

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Mon Jul 13 15:55:54 2026
(Merged from https://github.com/openssl/openssl/pull/31090)
2026-07-13 17:55:51 +02:00
knut st. osmundsen
6736bd2cb6 Fix nasm version check for sm3 & sm4 perlasm files
Make the check correctly handle versions such as '3.00rc8'.
It was incorrectly expecting major.minor.patch.

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
MergeDate: Mon Jul 13 15:48:03 2026
(Merged from https://github.com/openssl/openssl/pull/31420)
2026-07-13 17:46:52 +02:00
Mounir IDRASSI
95f95b59dd poly1305: reject no-key update and NULL key params
Poly1305 permits EVP_MAC_init(ctx, NULL, 0, ...) as part of staged
initialization. If no key has been installed, update still dispatched
into the uninitialized Poly1305 state, which can crash on POLY1305_ASM
builds.

Guard update with the same key_set check used by final and report no key set.

Also reject an explicit OSSL_MAC_PARAM_KEY whose data pointer is NULL before
calling Poly1305_Init(), even when the supplied size is POLY1305_KEY_SIZE.

Fixes #31332

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
MergeDate: Mon Jul 13 15:44:48 2026
(Merged from https://github.com/openssl/openssl/pull/31382)
2026-07-13 17:43:51 +02:00
Jakub Zelenka
d6c49df039 apps: cover the x509 -sigopt and -vfyopt options
The -sigopt and -vfyopt options of the x509 app were previously
untested. It adds a subtest that signs a certificate from a CSR with
-sigopt rsa_padding_mode:pss and verifies the issued certificate uses
the rsassaPss signature algorithm, and that verifies an SM2 CSR whose
self-signature uses a non-default distinguishing id supplied via
-vfyopt. It also checks that an unknown -sigopt or -vfyopt makes the
command fail.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 13 15:41:57 2026
(Merged from https://github.com/openssl/openssl/pull/31908)
2026-07-13 17:41:52 +02:00
Billy Brumley
283f6bd6bf [test] check late AAD rejection across AEADs
A late AAD update (AAD supplied after the payload has started) must be
rejected, and reported the same way, for every AEAD. #31673 checked this
for ChaCha20-Poly1305 alone, so this change extends it to all AEADs.

test_evp_aead_late_aad covers both the encrypt and decrypt directions and
asserts ERR_LIB_PROV / PROV_R_UPDATE_CALL_OUT_OF_ORDER on the late update.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Mon Jul 13 15:40:39 2026
(Merged from https://github.com/openssl/openssl/pull/31906)
2026-07-13 17:40:37 +02:00
Jakub Zelenka
28071a8c01 apps: cover the req -pkeyopt option
The -pkeyopt option of the req app was previously untested. It adds a
subtest that generates an EC request with -pkeyopt
ec_paramgen_curve:P-384 and verifies the selected curve is used, and
that an unknown -pkeyopt value makes the command fail.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 13 15:36:42 2026
(Merged from https://github.com/openssl/openssl/pull/31905)
2026-07-13 17:36:38 +02:00
Jakub Zelenka
0321c2919c apps: test pkeyutl app -rev option
Add coverage for the -rev option of the pkeyutl app, checking that the
input buffer is reversed before the operation and that -rev is rejected
together with raw input.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 13 15:35:56 2026
(Merged from https://github.com/openssl/openssl/pull/31891)
2026-07-13 17:35:50 +02:00
Jakub Zelenka
d8a7e8eec7 apps: test dsaparam app DER output paths
Add coverage for the DER (ASN.1) output of the dsaparam app, exercising
both the parameter output (i2d_KeyParams_bio) and the -genkey private key
output (i2d_PrivateKey_bio).

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 13 15:32:33 2026
(Merged from https://github.com/openssl/openssl/pull/31888)
2026-07-13 17:32:28 +02:00
Jakub Zelenka
d1d74cf253 apps: test dsa app -modulus option
Add coverage for the -modulus option of the dsa app, checking the
public value is printed for both private and public key input.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 13 15:31:54 2026
(Merged from https://github.com/openssl/openssl/pull/31887)
2026-07-13 17:31:48 +02:00
Jakub Zelenka
59a8cf3d86 apps: add test coverage for dgst -list
Exercise the previously uncovered show_digests() path in dgst app by
adding a subtest that runs "openssl dgst -list". It checks the header
and that sha256 and sha512 are listed, without assuming the full set of
digests which depends on the build configuration.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 13 15:05:45 2026
(Merged from https://github.com/openssl/openssl/pull/31886)
2026-07-13 17:05:39 +02:00
Jakub Zelenka
2d3e267b2b x509: add ocsptest for the OCSP stapled-response verification path
Add test/ocsptest.c, exercising check_cert_ocsp_resp() in x509_vfy.c
through X509_verify_cert() with X509_V_FLAG_OCSP_RESP_CHECK and
responses attached via X509_STORE_CTX_set_ocsp_resp(). This path was
previously only covered indirectly through the TLS multi-stapling
tests in sslapitest.c.

The test builds signed OCSP responses at run time from a flat
root -> leaf PKI (the root is both the trust anchor and the authorized
responder), and covers the good, grace-period, non-successful status,
expired, no-response, and wrong-certificate cases, plus a mfail run
over the success path. The PKI is generated by the test-tools ocsptest
command.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 13 15:04:59 2026
(Merged from https://github.com/openssl/openssl/pull/31828)
2026-07-13 17:04:51 +02:00
David Foster
1de3ee397c Explain inconsistency in X25519 ladder copies
Fixes #31560

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 13 15:03:15 2026
(Merged from https://github.com/openssl/openssl/pull/31812)
2026-07-13 17:03:05 +02:00
Jakub Zelenka
dc70836ce1 apps: test rsa app -RSAPublicKey_in/-RSAPublicKey_out options
Cover the previously untested -RSAPublicKey_in and -RSAPublicKey_out
options of the rsa app, which select the PKCS#1 RSAPublicKey structure
rather than the SubjectPublicKeyInfo used by -pubin/-pubout. The new
subtest checks that the RSA PUBLIC KEY header is written, that the
encoding round-trips, and that it is interchangeable with the
SubjectPublicKeyInfo form.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 13 15:01:22 2026
(Merged from https://github.com/openssl/openssl/pull/31802)
2026-07-13 17:01:17 +02:00
Jakub Zelenka
2c47163573 apps: test ecparam app -param_enc option
Exercise the previously untested -param_enc option of the ecparam app
by round-tripping the secp384r1 fixtures between named_curve and
explicit encodings (compared byte for byte against the reference
files), and check that an invalid value is rejected.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 13 15:00:27 2026
(Merged from https://github.com/openssl/openssl/pull/31799)
2026-07-13 17:00:15 +02:00
Jakub Zelenka
804fc3ecd8 apps: test ec app -param_enc option
Exercise the previously untested -param_enc option of the ec app,
covering named_curve and explicit parameter encodings (compared
against checked-in reference encodings) as well as rejection of an
invalid value.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 13 15:00:25 2026
(Merged from https://github.com/openssl/openssl/pull/31799)
2026-07-13 17:00:15 +02:00
Jakub Zelenka
da37b2b656 apps: test pkey -ec_param_enc option
Exercise the previously untested -ec_param_enc option for pkey,
covering named_curve and explicit parameter encodings as well as
rejection of the option on a non-EC key.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 13 14:59:39 2026
(Merged from https://github.com/openssl/openssl/pull/31798)
2026-07-13 16:59:33 +02:00
Jakub Zelenka
cedff47f38 test: build the fake cipher provider as a loadable module
The fake cipher provider was only available in-process, linked into test
binaries via fake_cipher_start().  To exercise app success paths (e.g.
skeyutl -genkey) the openssl app needs to load it as a provider module the
same way it loads legacy.

Make test/fake_cipherprov.c dual-buildable: drop the testutil dependency so
the source links cleanly into a module, add an OSSL_provider_init entry point
under FAKE_CIPHER_AS_MODULE, and add a fake-cipher MODULES target in
test/build.info.  Also implement skeymgmt generate so opaque key generation
works, and cover the skeyutl -genkey success path in 20-test_skeyutl.t.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 13 14:58:53 2026
(Merged from https://github.com/openssl/openssl/pull/31781)
2026-07-13 16:58:43 +02:00
slontis
79373ca3bd FIPS: EC keygen - remove unnecessary self tests.
In FIPS mode EC keygen was doing 3 self tests.
ec_generate_key() was calling both ecdsa_keygen_pairwise_test() and
ecdsa_keygen_knownanswer_test(). The KAT did a key recomputation and
comparison with the generated key, as per Sp80056Ar3 section 5.6.2.1.4.
These tests covered both Keygen PCT for Key Agreement and Signatures.
ossl_ec_key_pairwise_check() was also being called from within ec_gen().
The advice from Atsec (lab) is that the sign/verify test within
ecdsa_keygen_pairwise_test() is sufficient according to the updated
rules in FIPS 140-3 IG 10.3.A Additional comment 1, Since the usage of
the generated key is unknown at the time of key generation.

Detected during testing of Jipher by Roshith Alankandy (Oracle).

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 13 14:47:00 2026
(Merged from https://github.com/openssl/openssl/pull/31761)
2026-07-13 16:46:54 +02:00
Timo Keller
6d9a698615 s390x: Fix montgomery_multiplication_vectorized
Introduce `reduce_twice_signed` that reduces from `(-2q,q)` to `[0,q)`.
Fix `montgomery_multiplication_vectorized` in `ml_dsa_ntt_vec128.c`
by calling `reduce_twice_signed` at the end of the computation ensuring
that the result is in `[0,q)` and not only in `(-2q,q)` or `(-q,q)`.
Do not call `reduce_once_signed` in `ossl_poly_ntt_mult_scalar_vec128`
and at the end of `ossl_ml_dsa_poly_ntt_inverse_vec128` anymore as it is
not necessary anymore after `reduce_twice_signed`.

Without this fix, keygen, sign or verify might fail or produce wrong
results.

Signed-off-by: Timo Keller <tkeller@linux.ibm.com>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Mon Jul 13 14:45:11 2026
(Merged from https://github.com/openssl/openssl/pull/31744)
2026-07-13 16:45:07 +02:00
Jakub Zelenka
58f032a042 cms: fix AuthEnvelopedData authAttrs tags and verify them as AEAD AAD
The CMS_AuthEnvelopedData ASN.1 template used the implicit tags and the
X509_ALGOR type copied from CMS_AuthenticatedData. Per RFC 5083 the authAttrs
and unauthAttrs fields are [1] and [2] (not [2] and [3]) and are SET OF
Attribute, so use X509_ATTRIBUTE with the correct tags, matching the
STACK_OF(X509_ATTRIBUTE) members already declared in the structure.

With the tags fixed, authEnvelopedData carrying authAttrs now parses, so the
authenticated attributes must also be fed to the content cipher as the AEAD
associated data required by RFC 5083 section 2.1. Encode their DER (with the
universal SET OF tag) for both encryption and decryption; without this the GCM
tag fails to verify against compliant senders such as BouncyCastle.

RFC 5083 also requires that plaintext is not released until its integrity has
been verified. The AEAD tag is only checked once all the ciphertext has been
processed, so buffer the decrypted content and forward it to the output BIO
only after that check succeeds; a tampered message then leaks nothing to -out.

Add an interop test using a BouncyCastle-generated AES-128-GCM message with
authenticated and unauthenticated attributes, plus a tampered copy that must
fail the tag check and leave -out empty.

Closes #31635
Closes #26101
Closes #31629

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 13 14:41:34 2026
(Merged from https://github.com/openssl/openssl/pull/31695)
2026-07-13 16:41:28 +02:00
Neil Horman
f1be99832f Remove the rio_notifier run_once routine
We do this odd thing in rio_notifier.  when we initalize it, we call a
run_once routine to call WSAStartup(), create a lock and init a
refcount.  The purpose of those last two items is to track the refcount
so that we record how many times we init that rio notifier.  when the
refcount reaches zero, we tear down the windows socket api by calling
WSA cleanup, destroy the lock and refcount, and then re-initzlize the
run_once gate.

That last step is sketchy.  Even though our implementations of run_once
allow doing so, we should never be re-initing those gates, as its going
to be very prone to races, and they are, well, run_once, so we should
only run them once.

It would be nice to get rid of that behavior, which we can fortunately
do.

https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-wsastartup

Indicates that WSAStartup is internally refcounted, so instead of just
calling it once and tracking when we need to correspondingly call
WSACleanup(), just call it every time we initalize an rio_notifier
object, and call WSACleanup when we tear it down.  The Winsock api will
take care of knowing when it actually needs to be cleaned up for us.  As
such we can eliminate the run_once routine, the refcount and the lock
entirely.

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon Jul 13 14:26:58 2026
(Merged from https://github.com/openssl/openssl/pull/31777)
2026-07-13 10:26:56 -04:00
Jakub Zelenka
e1386ecb2d test: drop no-cached-fetch mfail guards
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 13 09:43:51 2026
(Merged from https://github.com/openssl/openssl/pull/31780)
2026-07-13 11:43:40 +02:00
Jakub Zelenka
4b8fece0f1 mfail: add sampled and count-only modes to test driver
Sampled tests cap allocation-failure injection at a fixed number of
sampled points, running exhaustively when the allocation count is below
that.  Non-sampled tests fall back to counting only on non-cached-fetch
builds, where exhaustive injection is impractical.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 13 09:43:50 2026
(Merged from https://github.com/openssl/openssl/pull/31780)
2026-07-13 11:43:40 +02:00
Ondrej Moris
47ddf0095d Update pkcs11-provider submodule (5dcc876)
Signed-off-by: Ondrej Moris <omoris@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Igor Ustinov <igus@openssl.foundation>
MergeDate: Mon Jul 13 08:14:30 2026
(Merged from https://github.com/openssl/openssl/pull/31907)
2026-07-13 10:14:22 +02:00
Marc Gutman
d7e77b66ca Don't raise NOT_ENOUGH_DATA on a clean EOF at an object boundary
asn1_d2i_read_bio() reads one ASN.1 object at a time from a BIO.  Callers
commonly loop, decoding concatenated DER values until the call fails, and
rely on a failure with no queued error to recognise a clean end of input.
CPython's ssl module does this in _add_ca_certs() when loading the Windows
certificate store via SSLContext.load_verify_locations(cadata=...); it
re-raises any leftover ASN.1 error other than ASN1_R_HEADER_TOO_LONG as
fatal.

Commit 9eb6922c59 ("asn1: raise NOT_ENOUGH_DATA on header EOF") changed the
BIO_read() check from "i < 0" to "i <= 0", so a clean EOF (BIO_read()
returning 0, as an exhausted BIO_new_mem_buf does) on an object boundary now
raises ASN1_R_NOT_ENOUGH_DATA instead of failing with an empty error queue.
The rewrite in commit 35852da1d9 carried this behaviour forward.  As a
result Python 3 on Windows fails to initialise an SSLContext with:

    ssl.SSLError: [ASN1: NOT_ENOUGH_DATA] not enough data

Raise ASN1_R_NOT_ENOUGH_DATA only on an actual read error, on an EOF in the
middle of an object (some bytes already buffered), or on an EOF while still
inside an indefinite-length value awaiting its end-of-contents octets - all
of which are genuine truncation.  A clean EOF at a top-level object boundary
again fails without queuing an error, restoring the long-standing behaviour
that looping callers depend on.

Add regression tests covering the clean-EOF, truncated, indefinite-length
truncation and partial-header cases, and document the read behaviour in
ASN1_item_d2i_bio(3).

Fixes #31807

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Igor Ustinov <igus@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jul 13 08:05:03 2026
(Merged from https://github.com/openssl/openssl/pull/31818)
2026-07-13 10:04:34 +02:00
Bob Beck
914ba181ce Remove leftover _WIN32_WCE reference in ms/uplink.c
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Jul 10 17:39:41 2026
(Merged from https://github.com/openssl/openssl/pull/31913)
2026-07-10 13:39:24 -04:00
Bob Beck
10b5f9f897 Drop Windows-on-Itanium (VC-WIN64I) support.
Similar to Windows CE, Windows Itanium has not had a
toolchain to work on it since VS 2010, and Windows
server 2008 was the last thing that ran on it.

This does *not* change the other (linux, HPUX) targets
which have modern toolchain support, and likely even still
run these days.

While never letting go seems noble when you won't share
the door you're floating on, the time has come.

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Jul 10 17:39:39 2026
(Merged from https://github.com/openssl/openssl/pull/31913)
2026-07-10 13:39:24 -04:00
Mounir IDRASSI
7f4ac80224 test: cover empty directoryName name constraints
Add NAME_CONSTRAINTS_check() coverage for empty directoryName
subtrees in both excluded and permitted constraints.

The tests assert the existing results in ordinary builds and catch
the NULL memcmp() argument when run under UBSan.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
MergeDate: Fri Jul 10 15:51:03 2026
(Merged from https://github.com/openssl/openssl/pull/31814)
2026-07-10 17:50:55 +02:00
Mounir IDRASSI
fce540139a x509: avoid NULL memcmp argument in nc_dn()
An empty directoryName constraint has canon_enc == NULL and
canon_enclen == 0. nc_dn() must not pass that pointer to
memcmp(), even with a zero length.

Return X509_V_OK before comparing an empty base Name. This preserves
current match semantics and avoids UBSan-visible undefined behaviour.

Fixes #31687
Fixes #31688

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
MergeDate: Fri Jul 10 15:51:01 2026
(Merged from https://github.com/openssl/openssl/pull/31814)
2026-07-10 17:50:55 +02:00
Naveed Khan
b1393a0446 pkcs12: free PKCS7 elements on error in PKCS12_unpack_authsafes
Fixes: b536880c45 "Add library context and property query support into the PKCS12 API"

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Jul 10 15:48:37 2026
(Merged from https://github.com/openssl/openssl/pull/31862)
2026-07-10 17:48:31 +02:00
Jakub Zelenka
171e4e7eb6 rand: add mfail tests for generation and seeding
Add memory-failure injection coverage to rand_test for the full
RAND_bytes_ex/RAND_priv_bytes_ex stack on a fresh library context, the
SEED-SRC entropy acquisition and the CTR-DRBG operations with a
TEST-RAND parent.  The cipher fetches used by the DRBG setup are warmed
up outside the injection window so that the injection targets the RAND
machinery itself.

Assisted-by: Claude:claude-fable-5

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Fri Jul 10 15:47:16 2026
(Merged from https://github.com/openssl/openssl/pull/31885)
2026-07-10 17:47:09 +02:00
Jakub Zelenka
24d208262a test-rng: handle nonce length query in generate mode
The DRBG instantiation probes the parent nonce callback with a NULL
output buffer to obtain the nonce length before requesting the actual
nonce.  The generate mode branch of test_rng_nonce() wrote the bytes
without checking the output pointer, crashing when TEST-RAND with
generate=1 is used as a DRBG parent.  The entropy-buffer branch already
handles a NULL output correctly.

Assisted-by: Claude:claude-fable-5

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Fri Jul 10 15:47:15 2026
(Merged from https://github.com/openssl/openssl/pull/31885)
2026-07-10 17:47:09 +02:00
Tomas Mraz
3bf2aba5f5 Document the effect of SSL_VERIFY_FAIL_IF_NO_PEER_CERT on post-handshake auth
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Jul 10 15:45:39 2026
(Merged from https://github.com/openssl/openssl/pull/31876)
2026-07-10 17:45:28 +02:00
Daniel Kubec
4f17865ba4 NULL-pointer subtraction UB in tls_collect_extensions()
Fixed invalid-pointer-pair in the existing branch by ensuring thisex != NULL
before subtraction.

Fixes #31689

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Jul 10 15:40:21 2026
(Merged from https://github.com/openssl/openssl/pull/31875)
2026-07-10 17:40:09 +02:00
Bob Beck
a40f6f8bd6 Make the examples in SYTLE and DOCUMENTATON compliant.
Specifically bring them closer to the suggested naming conventions
and make them clang-format compliant.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Fri Jul 10 15:37:20 2026
(Merged from https://github.com/openssl/openssl/pull/29295)
2026-07-10 11:37:03 -04:00
Bob Beck
c17828595f Change the Doxygen doc requirement for non public functions
To be at the prototype site in the internal header file.

The major reason *Why* we would like to have Doxygen style comments
describing what internals do is so that they work with modern IDE's
since most common ones support them.

It's wonderful to be looking at an internal function, thinking "wtf is this",
and be able to hover over it and - boink - up comes the docs. This
typically only works (or works better) when the Doxygen comment is
at the prototype site, not if it is at the implementation site.

This also reinforces the requirement that "yes you do this for shared
functions but you don't need to for statics".

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Fri Jul 10 15:37:18 2026
(Merged from https://github.com/openssl/openssl/pull/29295)
2026-07-10 11:37:03 -04:00
Bob Beck
b3020646af Modernize and update STYLE.MD, add DOCUMENTATION.MD
So this repatriates DOCUMENTATION.MD from the web page to the
code base, and links both STYLE.MD and DOCUMENTATION.MD from
CONTRIBUTING.MD

It does a large rototilling of STYLE.MD to address many of the
outstanding concerns noted when I started this before clang-format
last year, and brings us roughly in line with the things that are
addressed in similar style guides for other projects.

Most of the changed or updated reccomendations reflect what we
currently have been doing, or have expressed as a desire to
move to in the future.

Most larger "OpenSSL-isms" I've tried to explicitly call out
to make this a more cohesive and useful guide for a new contributor

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Fri Jul 10 15:37:16 2026
(Merged from https://github.com/openssl/openssl/pull/29295)
2026-07-10 11:37:03 -04:00
Bob Beck
d8e49b85d0 Add a STYLE.md file and link it from CONTRIBUTING.md
This is effectively, the current coding style policy web page
changed to accomodate clang-format.  This is more or less the
same file I have had in the various clang-format sample PR's since
September.

It does include an additional sections on Integers and on
Return Values that are not in the original coding style
policy

It is changed from the September version in that it does not
have mention of keeping include files self contained. I believe
that is achievable and desirable, but I think should be done
as a separate change from this.

There were a number of issues brought up in discussion of this
file in the clang-format PR's. I recorded those in 818, 819,
820, 821, 822, 823, 824, 825, and 826, which we can
link in there to the appropriate section of the document.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Fri Jul 10 15:37:13 2026
(Merged from https://github.com/openssl/openssl/pull/29295)
2026-07-10 11:37:03 -04:00
Jakub Zelenka
9b182491fc quic: fix intermittent idle-test failure in tserver test
The thread-assisted idle test advances fake time in 10ms steps while the
connection is kept alive solely by the background assist thread sending
keepalive PINGs. The test stepped fake time without checking that a due
keepalive had actually been sent, so whether it went out before the
server's idle deadline lapsed depended on thread scheduling - hence the
intermittent failure.

Now, before each step, check the event timeout (next_deadline minus
fake-now): while a keepalive is still due to be sent it stays at zero, so we
wake the assist thread and re-check without advancing until it goes positive
(or the existing real-time watchdog fires). Only then do we step fake time.

The negotiated 30s idle timeout and 60s idle duration are unchanged, so the
keepalive is still required and still tested; only the race is removed.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Jul 10 15:33:45 2026
(Merged from https://github.com/openssl/openssl/pull/31746)
2026-07-10 17:33:40 +02:00
Tomas Mraz
1768a5a1be Avoid undefined behavior adding or subtracting two BN_zero() values
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Fri Jul 10 14:54:48 2026
(Merged from https://github.com/openssl/openssl/pull/31916)
2026-07-10 16:54:46 +02:00
Igor Ustinov
68c0861075 Fix a bug in BN_ucmp() when comparing constant-time BIGNUMs of different lengths
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Jul 10 12:08:43 2026
(Merged from https://github.com/openssl/openssl/pull/31717)
2026-07-10 08:08:36 -04:00
Mounir IDRASSI
09d12ef1d7 Allow MinGW-w64 builds to use BCryptGenRandom
MinGW-w64 has provided bcrypt headers and import libraries since
version 2.0, but OpenSSL only enabled the BCryptGenRandom seeding
path for supported MSVC builds. Enable the existing direct
BCryptGenRandom flow for MinGW-w64 when targeting Windows Vista or
newer, and link MinGW builds with bcrypt alongside the other Windows
import libraries.

Use __MINGW64_VERSION_MAJOR to detect MinGW-w64 because it is defined
by both the 32-bit and 64-bit MinGW-w64 toolchains.

Builds targeting older Windows versions keep the CryptoAPI fallback
because USE_BCRYPTGENRANDOM remains disabled when _WIN32_WINNT is
below 0x0600.

Fixes #13878

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Jul 10 12:05:09 2026
(Merged from https://github.com/openssl/openssl/pull/13882)
2026-07-10 08:05:02 -04:00
Bob Beck
b72ee09a45 Drop missed unneded GNUC>=2 check
Spotted by idrassi on review. thanks!

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Jul 10 11:47:21 2026
(Merged from https://github.com/openssl/openssl/pull/31677)
2026-07-10 07:47:13 -04:00
Bob Beck
aa2b1432b3 Simplify printf-attribute guards in bio.h.in and test/testutil/output.h.
Now that C99 is the base level, and we are no longer supporting old
GCC's, The ossl_bio__printf__ / ossl_test__printf__ indirection only existed
to pick the gnu_printf attribute over the printf attribute for MinGW's MS-CRT printf, but
MinGW is already excluded by the outer guard, so we can use the modern attribute
everywhere this code runs.

Spotted by idrassi on review, thanks!.

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Jul 10 11:47:19 2026
(Merged from https://github.com/openssl/openssl/pull/31677)
2026-07-10 07:47:13 -04:00
Bob Beck
a7241e862e We no longer need to test for GCC versions this old
The minimum gcc to compile our code appears to be version 9, and
we are now C99.

All these older checks become a tautology on anything that will
build a modern OpenSSL tree, so clean this up.

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Jul 10 11:47:17 2026
(Merged from https://github.com/openssl/openssl/pull/31677)
2026-07-10 07:47:13 -04:00
Bob Beck
e06fe98769 Drop Watcom C compiler support.
The only Watcom-specific code in the tree was a <tchar.h> _vsntprintf
mapping in crypto/cryptlib.c. There is no Watcom entry in Configurations/,
no CI job builds with Watcom, and the tree has had no other Watcom-aware
code in many years. The _vsntprintf symbol is supplied by <tchar.h>
on every supported Windows toolchain (MSVC, MinGW), so the conditional
fallback is dead.

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Jul 10 11:47:15 2026
(Merged from https://github.com/openssl/openssl/pull/31677)
2026-07-10 07:46:53 -04:00
Viktor Dukhovni
9d59af025a Improve TLS handling of EC point formats
Decouple the ec_point_formats extension from TLS 1.2 X.509
selection and acceptance.  Remove tls1_check_pkey_comp() and its
callers in tls1_check_cert_param() and tls1_check_chain(): TLS 1.3
disregards the extension already, and we can decode any point form
a peer might send, so refusing a compressed peer cert in TLS 1.2
because we didn't advertise compressed buys nothing.

The RFC 4492/8422 section 5.1.2 requirement that the peer's list
contain "uncompressed" used to be enforced in a final hook on the
client side only.  Move it to the two points where the negotiated
ciphersuite is known: the client's ServerHello parse hook, and the
server's ServerHello construct hook.  Both sites fire the alert
only when an ECC TLS 1.2 ciphersuite has been negotiated, so a
missing "uncompressed" is ignored under TLS 1.3 or a non-ECC
cipher.  The client- and server-side parse hooks now share one
function.

Drop the always-NULL ext.ecpointformats fields on SSL_CTX and SSL;
our own list is built directly inside the constructors.  The
peer's list continues to be stored verbatim, and is also exposed
through the SSL_get0_ec_point_formats() accessor (now documented).
New tests verify the four corners (ECC vs non-ECC ciphersuite, TLS
1.2 vs 1.3) plus that a compressed point form EC cert is usable on
both sides without any opt-in.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Fri Jul 10 09:21:30 2026
(Merged from https://github.com/openssl/openssl/pull/30940)
2026-07-10 11:21:28 +02:00
Viktor Dukhovni
d172868e53 EC: make the group the single source of the point conversion form
The point conversion form (compressed, uncompressed, or hybrid)
was kept both on the key and on the group, and the two could
disagree -- a key imported as compressed could re-encode as
uncompressed. The group is now the single source of truth:
encoding, parameter output, and the legacy lookup all read it from
the group, and decoding (PEM, DER, or raw parameters) records it
there, so the form round-trips faithfully.

Generated keys are always uncompressed; the point-format option at
key generation is now a documented no-op (it had had no effect for
several releases), and the unused form field on the keygen context
is dropped.  Imported keys still keep their form, and the
deprecated EC_KEY_get_conv_form()/EC_KEY_set_conv_form() still
work.

EVP_PKEY_fromdata() and openssl pkey -text now report the form a
loaded EC key actually has, and re-encoding via PEM or DER
preserves it.

Docs drop a stale note about a compile-time macro for compressed
points on binary curves, and the EC tests now exercise both the
affine and the compressed/hybrid binary formats unconditionally
(fixing a latent bug in the compressed/hybrid form tests that were
never exercised by CI).

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Fri Jul 10 09:21:29 2026
(Merged from https://github.com/openssl/openssl/pull/30940)
2026-07-10 11:21:28 +02:00
Jakub Zelenka
234845aaab Add BIO bio_sock2 test
Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jul  9 17:39:25 2026
(Merged from https://github.com/openssl/openssl/pull/30788)
2026-07-09 19:38:28 +02:00
Jakub Zelenka
207c40c97a Add BIO bio_sock test
Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jul  9 17:39:24 2026
(Merged from https://github.com/openssl/openssl/pull/30788)
2026-07-09 19:38:28 +02:00
Jakub Zelenka
bd07dda47d Add BIO bss_socket test
Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jul  9 17:39:22 2026
(Merged from https://github.com/openssl/openssl/pull/30788)
2026-07-09 19:38:28 +02:00
Jakub Zelenka
b05333b7e9 Add BIO bss_dgram test
Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jul  9 17:39:21 2026
(Merged from https://github.com/openssl/openssl/pull/30788)
2026-07-09 19:38:28 +02:00
Jakub Zelenka
b69282a759 Add BIO bss_acpt test
Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jul  9 17:39:20 2026
(Merged from https://github.com/openssl/openssl/pull/30788)
2026-07-09 19:38:28 +02:00
Jakub Zelenka
90afdb14ed Add BIO bss_conn test
Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jul  9 17:39:19 2026
(Merged from https://github.com/openssl/openssl/pull/30788)
2026-07-09 19:38:28 +02:00
Jakub Zelenka
bcbecdcaa5 Add BIO bio_addr test
Assisted-by: Claude:claude-opus-4-7

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jul  9 17:39:18 2026
(Merged from https://github.com/openssl/openssl/pull/30788)
2026-07-09 19:38:28 +02:00
Jakub Zelenka
82ccc1747f Add BIO bss_fd test
Assisted-by: Claude:claude-opus-4-7

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jul  9 17:39:17 2026
(Merged from https://github.com/openssl/openssl/pull/30788)
2026-07-09 19:38:28 +02:00
Jakub Zelenka
ac858acc91 Add mkwraps script for generting wraps and expectations
This is a helper script that can be used to provide a boilerplate code.

Assisted-by: Claude:claude-opus-4-7

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jul  9 17:39:15 2026
(Merged from https://github.com/openssl/openssl/pull/30788)
2026-07-09 19:38:28 +02:00
Jakub Zelenka
acd7679800 Add unit testing cmocka based framework
This adds the unit testing framework that extends the build so it can
be enabled and tests are built. It is executed as part of the test
using a recipe which executes all unit tests.

The documentation is added with more info about writing the unit tests.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jul  9 17:39:14 2026
(Merged from https://github.com/openssl/openssl/pull/30788)
2026-07-09 19:38:28 +02:00
Jakub Zelenka
bc79a23e6c Deprecate unit-test configure option and SSL_test_functions
The unit-test configure option exists only to expose the
SSL_test_functions() API allowing to overwrite ssl_init_wbio_buffer.
Instead of renaming it, deprecate the option and the SSL_test_functions()
function so both can be removed in OpenSSL 5.0.

Assisted-by: Claude:claude-fable-5

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jul  9 17:39:13 2026
(Merged from https://github.com/openssl/openssl/pull/30788)
2026-07-09 19:38:28 +02:00
Jakub Zelenka
6b6fc64711 Add WRAP build.info variable
This is used for adding per target --wrap ld flags for each listed
function.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jul  9 17:39:12 2026
(Merged from https://github.com/openssl/openssl/pull/30788)
2026-07-09 19:38:28 +02:00
Nikola Pajkovsky
38c7ace6c1 crypto/x509/x509_lu.c: check X509_OBJECT_up_ref_count() in x509_object_dup()
the return value of X509_OBJECT_up_ref_count() was ignored. If the
reference count increment fails, x509_object_dup() still returned a
duplicate X509_OBJECT whose ->data aliases the source X509/X509_CRL
without a reference actually having been taken. Freeing that duplicate
later drops a reference it never held, leading to a premature free and
use-after-free of the shared object.

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

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed Jul  8 18:20:10 2026
(Merged from https://github.com/openssl/openssl/pull/31811)
2026-07-08 20:20:01 +02:00
Mounir IDRASSI
a4ee6965a0 Reject AES-XTS operations without an IV
Commit 774525b38b moved AES-XTS to an implementation-specific cipher
function but did not carry over the generic iv_set guard. This allowed
AES-XTS operations initialized with a NULL IV to proceed.

Restore the missing iv_set check before processing input and add an
evp_extra_test regression covering both a valid-IV control and the
missing-IV failure case.

Fixes #31755

Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Jul  8 18:16:55 2026
(Merged from https://github.com/openssl/openssl/pull/31756)
2026-07-08 20:16:06 +02:00
Billy Brumley
a17cd7691a [test] exercise AEAD tag read rejection when actually present during decryption
Set a verify tag while decrypting (which must succeed) before
attempting the read, so the test asserts that a tag cannot be read
back while decrypting even when one is _actually_ present.

This isolates direction logic from tag present logic.

Follow-up to #31734

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Jul  8 18:06:40 2026
(Merged from https://github.com/openssl/openssl/pull/31826)
2026-07-08 20:06:30 +02:00
Dimitri Papadopoulos
0cb923d4ba Fix doubled semicolons as statement terminations
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Jul  8 18:03:29 2026
(Merged from https://github.com/openssl/openssl/pull/31877)
2026-07-08 20:03:06 +02:00
Jakub Zelenka
ea902d80b3 apps: cover the unencrypted key bag path in the pkcs12 test recipe
The NID_keyBag branch of dump_certs_pkeys_bag() was not exercised.
Export a file with -keypbe NONE and dump it, checking the key bag is
reported and its private key is output.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jul  8 18:02:22 2026
(Merged from https://github.com/openssl/openssl/pull/31665)
2026-07-08 20:02:18 +02:00
Matt Caswell
b24c43f9b8 Add regression test for remove_session_cb under lock
Install a remove_session_cb that calls SSL_CTX_flush_sessions_ex().
If the callback is invoked while ctx->lock is held, the nested
flush call deadlocks immediately.

The test covers the SSL_CTX_add_session() eviction path (adding a
second session to a size == 1 cache evicts the first, firing the
callback) and the SSL_CTX_flush_sessions_ex() path (SSL_CTX_free()
flushes the remaining session via flush_sessions_ex()).

Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Jul  8 17:58:48 2026
(Merged from https://github.com/openssl/openssl/pull/31540)
2026-07-08 19:58:40 +02:00
Matt Caswell
4be956b9cd Fix remove_session_cb called while holding ctx->lock
SSL_CTX_add_session() held ctx->lock while calling remove_session_lock()
with lck = 0, which still fired the remove_session_cb callback.
SSL_CTX_flush_sessions_ex() had the same problem: it called
remove_session_cb for each expired session while holding the lock.
Any callback that re-entered an OpenSSL API requiring the same lock
would deadlock.

Refactor remove_session_lock() into remove_session_locked() (caller
holds the lock) which returns the removed SSL_SESSION * instead of
calling the callback and freeing it internally.

SSL_CTX_remove_session() manages its own locking and invokes the
callback unconditionally after releasing the lock (preserving the
existing behaviour where the callback fires even when the session is
not in the internal cache, to allow external caches to be notified).

SSL_CTX_add_session() collects evicted sessions in a temporary
singly-linked list (via the now-NULL next pointer) and processes them
after CRYPTO_THREAD_unlock().

SSL_CTX_flush_sessions_ex() already deferred SSL_SESSION_free() to
after the lock via a STACK_OF(SSL_SESSION). The callback is now also
deferred: sessions are collected on the stack under the lock, then
the lock is released before iterating the stack to fire callbacks
and free each session.

Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Jul  8 17:58:47 2026
(Merged from https://github.com/openssl/openssl/pull/31540)
2026-07-08 19:58:40 +02:00
Urval
4d32206641 test: add all-alias BIGNUM coverage in file_sum
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Jul  8 17:56:40 2026
(Merged from https://github.com/openssl/openssl/pull/30893)
2026-07-08 19:56:39 +02:00
Steven WdV
4e2e6f4174 Allow getentropy for Emscripten
Usually Emscripten emulates `/dev/urandom`, but in some cases,
like with `-sNODERAWFS`, it doesn't. This means that on non-Unix platforms,
where `/dev/urandom` does not exist on the host, OpenSSL will fail to seed
its PRNG. This fixes that by instead using the POSIX function it
implements, like which was already done for WASI.

See https://github.com/emscripten-core/emscripten/issues/9628#issuecomment-4892658766 for more context.

CLA: trivial

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jul  8 17:50:39 2026
(Merged from https://github.com/openssl/openssl/pull/31882)

(cherry picked from commit dc219a0408)
2026-07-08 19:50:54 +02:00
Neil Horman
11889aa905 Suppress function pointer type validation in clang ubsan
We've been concerned about ubsan errors comming with more recent
versions of clang.  specifically versions of clang later than 17
generate hundreds of function pointer type validation errors, i.e.
assigning a function of type void (*)(TYPE *) to a function pointer of
type void (*)(void *).

Fixing these requires the creation of lots of thunk function that get
littered through the code base, and are generally unpleasant to carry.
A better fix requires siginficant code refactoring, and potentially
large changes to our ABI, which we can't support until the next major
release.

So, for now, just suppress those ubsan errors, so we can more properly
deal with the issue when we are able.

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Jul  8 16:01:12 2026
(Merged from https://github.com/openssl/openssl/pull/31837)
2026-07-08 12:01:04 -04:00
Jakub Zelenka
76e33ae38f property: replace property_memfail with in-tree mfail tests
The standalone property_memfail.c program is superseded by memory-failure
tests added directly to property_test.c using the MFAIL harness.  They
cover the same property store API surface under allocation failure
injection: ossl_method_store_new, ossl_method_store_add,
ossl_method_store_cache_set and the providerless ossl_method_store_cache_get
lookup, plus the method == NULL cache_set branch.

Unlike the old NO_CHECK-only program, the new tests run as checked mfail
tests, verifying both clean error propagation and the absence of reference
leaks on every failure path.  The old program also relied on a stale,
pre-lockless STORED_ALGORITHMS layout to poke the cache directly, which no
longer matches property.c.

Drop property_memfail.c along with its wiring in test/build.info and the
90-test_memfail.t recipe.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jul  8 13:05:16 2026
(Merged from https://github.com/openssl/openssl/pull/31880)
2026-07-08 15:05:01 +02:00
Tomas Mraz
801d701196 coveralls.yml: Disable the allocfail-tests
They are failing and thus the coveralls output is not produced.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Jul  8 12:20:03 2026
(Merged from https://github.com/openssl/openssl/pull/31878)
2026-07-08 14:19:57 +02:00
Mounir IDRASSI
f2924392d3 BIO_vprintf: fix off-by-one at 512-byte buffer boundary
BIO_vprintf() first formats into a 512-byte stack buffer. Since
vsnprintf() returns the required length excluding the NUL, a return
value of 512 means truncation. The old strict greater-than check
therefore wrote the truncated buffer for exactly 512-byte output.

Use >= for the realloc path and add boundary coverage for 511-, 512-
and 513-byte outputs.

Fixes: a29d157fdb "Replace homebrewed implementation of *printf*() functions with libc"

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul  8 11:24:31 2026
(Merged from https://github.com/openssl/openssl/pull/31842)
2026-07-08 13:24:19 +02:00
Frederik Wedel-Heinen
d9671f4526 Remove unused source files poly1305_ieee754.c and poly1305_base2_44.c
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul  8 11:16:22 2026
(Merged from https://github.com/openssl/openssl/pull/31737)
2026-07-08 13:15:52 +02:00
Milan Broz
f167d0d2e9 README.md: update web links to man pages
Add missing OpenSSL 4.0, remove EOL branches.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul  8 11:09:16 2026
(Merged from https://github.com/openssl/openssl/pull/31839)
2026-07-08 13:08:35 +02:00
Orgad Shaneh
69cafbc498 util/mkinstallvars.pl: Suppress more debug logs
Commit aa4b47483f "Fix util/mkinstallvars.pl to treat LIBDIR
and libdir correctly" added more logs while bc44134c32 "Configure:
Remove extensive debug output by default" was under review, so those
were missed.

Complements: bc44134c32 "Configure: Remove extensive debug output by default"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Jul  8 11:03:11 2026
(Merged from https://github.com/openssl/openssl/pull/31843)
2026-07-08 12:57:18 +02:00
Dimitri Papadopoulos
1860496d86 Fix typos
Found by typos[1].

[1] https://github.com/crate-ci/typos

CLA: trivial

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul  8 10:46:01 2026
(Merged from https://github.com/openssl/openssl/pull/31858)
2026-07-08 12:45:09 +02:00
Joe Orton
51584371a2 doc/man3/ASN1_INTEGER_get_int64.pod: fix a typo
CLA: trivial
Fixes: 6c5b6cb035 "ASN1 INTEGER refactor."

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul  8 10:18:11 2026
(Merged from https://github.com/openssl/openssl/pull/31815)
2026-07-08 12:17:43 +02:00
Dimitri Papadopoulos
917ebfca5c Eliminate unnecessary whitespace before a quoted newline
Found by running the checkpatch.pl Linux script to enforce coding style.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul  8 10:11:22 2026
(Merged from https://github.com/openssl/openssl/pull/31860)
2026-07-08 12:10:54 +02:00
Dimitri Papadopoulos
cddeed0734 Move const qualifier after static
Found by running the checkpatch.pl Linux script to enforce coding style.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul  8 10:11:20 2026
(Merged from https://github.com/openssl/openssl/pull/31860)
2026-07-08 12:10:36 +02:00
Dimitri Papadopoulos
7812b20ad5 Add parentheses around sizeof arguments
Found by running the checkpatch.pl Linux script to enforce coding style.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul  8 10:11:18 2026
(Merged from https://github.com/openssl/openssl/pull/31860)
2026-07-08 12:10:14 +02:00
Dimitri Papadopoulos
74e781dfec Eliminate unnecessary type casts of int constants
Found by running the checkpatch.pl Linux script to enforce coding style.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul  8 10:11:16 2026
(Merged from https://github.com/openssl/openssl/pull/31860)
2026-07-08 12:09:47 +02:00
Dimitri Papadopoulos
ae6de18171 Eliminate repeated semicolons at the end of statements
Found by running the checkpatch.pl Linux script to enforce coding style.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul  8 10:11:15 2026
(Merged from https://github.com/openssl/openssl/pull/31860)
2026-07-08 12:09:16 +02:00
Dimitri Papadopoulos
518d66e44d Remove parentheses around return arguments
Since return is an operator and not a function, parentheses
are not required.

Found by running the checkpatch.pl Linux script to enforce coding style.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul  8 10:11:13 2026
(Merged from https://github.com/openssl/openssl/pull/31860)
2026-07-08 12:08:25 +02:00
Dimitri Papadopoulos
df5f836f64 Eliminate/fix repeated word usage
Found by running the checkpatch.pl Linux script to enforce coding style.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul  8 10:11:11 2026
(Merged from https://github.com/openssl/openssl/pull/31860)
2026-07-08 12:07:53 +02:00
olszomal
8c7e3f217c apps/ocsp.c: guard index_changed() with OPENSSL_NO_POSIX_IO, not HTTP_DAEMON
Replace #ifdef HTTP_DAEMON with #ifndef OPENSSL_NO_POSIX_IO for code
that only requires POSIX {,f}stat(), improving portability.

Retain syslog() call only when HTTP_DAEMON is defined, use
BIO_printf(bio_err) otherwise.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul  8 09:47:43 2026
(Merged from https://github.com/openssl/openssl/pull/28172)
2026-07-08 11:42:37 +02:00
olszomal
d2a9af2144 apps: adjust stat usage to account for uplink
Call stat() instead of fstat() when the FILE pointer provided
by BIO_get_fp() is unavailable (as it may be the case in case of UPLINK
builds).

Signed-off-by: olszomal <Malgorzata.Olszowka@stunnel.org>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul  8 09:47:42 2026
(Merged from https://github.com/openssl/openssl/pull/28172)
2026-07-08 11:28:33 +02:00
olszomal
b5b34d32cb BIO: avoid returning internal FILE * with UPLINK-enabled builds on Windows
On Windows with UPLINK enabled, BIO_get_fp() may return a FILE * pointer
incompatible with the C runtime.  Ensure that it returns NULL instead,
preventing undefined behavior in applications.  Update the documentation
to include the missing return type for BIO_[gs]et_fp() and remove
the mention that BIO_get_fp() never returns 0, as it does so now
when NULL fp is returned.

Signed-off-by: olszomal <Malgorzata.Olszowka@stunnel.org>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul  8 09:47:40 2026
(Merged from https://github.com/openssl/openssl/pull/28172)
2026-07-08 11:28:03 +02:00
Ingo Franzki
a21fdfc89a Fix crash in EVP_MD_CTX_copy_ex on inconsistent context
EVP_MD_CTX_copy_ex() might crash on an NULL pointer access when an
inconsistent context is copied. This happens when a context is copied
where digest is set but algctx is NULL, i.e. due to an incomplete
initialization.

The copyctx shortcut for cases where the in and out contexts use the
exact same digest call the copyctx function attempting to copy
the algctx, but it does not check if algctx is NULL on the in or out
contexts.

Fix this by only taking the copyctx shortcut if algctx is non-NULL on
both, in and out. Otherwise use the full copy path which will only
duplicate the algctx if it is non-NULL.

Closes: https://github.com/openssl/openssl/issues/31831

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/31867)
2026-07-08 14:17:31 +10:00
Jakub Zelenka
46040a2988 quic: do not hard fail mfail test for old fips providers
This is because ML-KEM change from #31432 is not backported there.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Jul  7 16:36:07 2026
(Merged from https://github.com/openssl/openssl/pull/31870)
2026-07-07 12:36:02 -04:00
Nikola Pajkovsky
64f09bd826 crypto/x509/x509_lu.c: fix memory leak in obj_ht_foreach_object()
when sk_X509_OBJECT_push() fails after x509_object_dup() has already
allocated the duplicate, the dup is neither stored on the destination
stack nor freed: the error path only pop_free()s the stack the dup was
never pushed onto, so it is leaked.

Set env ASAN_OPTIONS in test explicitly to detect_leaks=1 to force
ASAN to fail the test. Otherwise, the test reports ok even with valid
leak.

Fixes: 08cecb4448 "Add X509_STORE_get1_objects"
Fixes: https://github.com/openssl/openssl/issues/31771
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Tue Jul  7 07:42:17 2026
(Merged from https://github.com/openssl/openssl/pull/31784)
2026-07-07 09:41:59 +02:00
Neil Horman
a89400969d Fix new statem_clnt_test when dtls is disabled
The new statem client tests added in comimt c36a9b4 assume that if
OPENSSL_NO_DTLS is not defined, that we have DTLS support, but we have
this odd setup in which we can have DTLS enabled, but DTLS1_2 disabled,
in which case the needed support isn't present, and the test fails.

why we have it setup that way, I'm not sure, but we should only run the
dtls tests if both DTLS and DTLS1_2 support is available.

Fixes #31851

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Mon Jul  6 09:42:44 2026
(Merged from https://github.com/openssl/openssl/pull/31582)
2026-07-06 10:42:17 +01:00
Jakub Zelenka
f31510e953 quic: add mfail test for handshake multi-packet processing
This tests handshake level phase using mfail covering SSL_do_handshake.
It is a test for #31323.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sat Jul  4 16:57:38 2026
(Merged from https://github.com/openssl/openssl/pull/31324)
2026-07-04 12:57:13 -04:00
Mounir IDRASSI
c65777dd3c Add stack test for thunked sorted lookup
Reviewed-by: Milan Broz <mbroz@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: Sat Jul  4 16:53:24 2026
(Merged from https://github.com/openssl/openssl/pull/30857)
2026-07-04 12:53:19 -04:00
Neil Horman
562d2a137a Remove CRYPTO_GET_REF
This function should never have existed.  Its a TOCTOU waiting to
happen.  Now that we've eliminated all internal uses, and given that its
an internal function, send it to a nice farm upstate, where it can run
and play with all the other functions that shouldn't have been.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Sat Jul  4 16:47:16 2026
(Merged from https://github.com/openssl/openssl/pull/31750)
2026-07-04 12:47:07 -04:00
Neil Horman
16be8273ad Replace use of CRYPTO_GET_REF in bio_lib
BIO_free_all makes use of CRYPTO_GET_REF to determine if there is
another user of a BIO chain at some artibrary point within the chain.

But CRYPTO_GET_REF is begging for a TOCTOU error, and so we're
deprecating it.

replace the use of GET_REF with an internal version of BIO_free that
returns the value of the resultant ref count, and use that instead, so
we are TOCTOU free

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Sat Jul  4 16:47:13 2026
(Merged from https://github.com/openssl/openssl/pull/31750)
2026-07-04 12:47:07 -04:00
Neil Horman
70fa179635 eliminate use of CRYPTO_GET_REF in sslapitest
CRYPTO_GET_REF is almost by definition a TOCTOU race, and we shouldn't
use it.

As part of the effort to deprecate it, eliminate its use from
sslapitest.

Avoid the use-after-free possibility by getting a session with
SSL_get1_session (which increments the refcount) and freeing it after
we're done with it.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Sat Jul  4 16:47:10 2026
(Merged from https://github.com/openssl/openssl/pull/31750)
2026-07-04 12:47:07 -04:00
Jakub Zelenka
f908737d58 apps: cover x509 DER key/cert input formats
The -keyform, -CAform and -CAkeyform options were not covered. Add a
test that self-signs a CSR with a DER-encoded key and signs a CSR with
a DER-encoded CA cert and CA key.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
MergeDate: Fri Jul  3 19:40:27 2026
(Merged from https://github.com/openssl/openssl/pull/31733)
2026-07-03 21:40:22 +02:00
Jakub Zelenka
7e2879e035 apps: test dsa app PVK output
Cover the previously untested PVK code paths of the dsa app: round-trip
the test key through the PVK encoding (mirroring the existing rsa PVK
test, and skipped unless rc4, legacy and pvkkdf are enabled), and check
that requesting PVK output for a public key input is rejected.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Jul  3 19:30:48 2026
(Merged from https://github.com/openssl/openssl/pull/31801)
2026-07-03 21:30:41 +02:00
Frederik Wedel-Heinen
3cd2f29124 Removes two unused macros: MAX_RESEED_INTERVAL and MAX_RESEED_TIME_INTERVAL.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Fri Jul  3 19:29:48 2026
(Merged from https://github.com/openssl/openssl/pull/31745)
2026-07-03 21:29:45 +02:00
Frederik Wedel-Heinen
be16738154 Remove internal-only DRBG_STATUS enum
Changed internal prov_drbg_st member variable from DRBG_STATUS
to int to reflect how it was actually used.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Fri Jul  3 19:29:47 2026
(Merged from https://github.com/openssl/openssl/pull/31745)
2026-07-03 21:28:43 +02:00
Jakub Zelenka
dd943486d7 apps: cover crl signature verification
The CRL signature verification path was not exercised. Add a test that
verifies a CRL signature against its issuer certificate supplied via
-CAfile, -CAstore and -CApath.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
MergeDate: Fri Jul  3 19:26:15 2026
(Merged from https://github.com/openssl/openssl/pull/31736)
2026-07-03 21:26:10 +02:00
Jakub Zelenka
c30329c854 apps: cover the req -set_serial option
The OPT_SET_SERIAL case in req_main() was not covered. Add a test that
generates a self-signed certificate with an explicit -set_serial value
and checks it, plus the error path when -set_serial is given twice.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Jul  3 19:25:05 2026
(Merged from https://github.com/openssl/openssl/pull/31730)
2026-07-03 21:24:58 +02:00
Jakub Zelenka
4b873a1d21 x509: add delta CRL success test
Exercise the previously uncovered X509_V_FLAG_USE_DELTAS path in
get_delta_sk(): a current delta CRL revoking kLeaf must be honored.
The base and delta CRLs are generated by `ossl-test-tools crltest delta`.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Jul  3 19:22:29 2026
(Merged from https://github.com/openssl/openssl/pull/31714)
2026-07-03 21:22:21 +02:00
Jakub Zelenka
a8db32eed7 apps: cover the CRL printing path in the pkcs7 test recipe
The crls != NULL block of pkcs7 -print_certs was not exercised.  Build
a PKCS#7 structure containing a CRL with crl2pkcs7 and check the CRL is
both printed and output in PEM form.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Fri Jul  3 19:21:11 2026
(Merged from https://github.com/openssl/openssl/pull/31666)
2026-07-03 21:21:04 +02:00
Niels Provos
e59165a1e3 crypto/x509: replace O(N^2) RFC 3779 canonicalisation merge with linear sweep
ASIdentifierChoice_canonize and IPAddressOrRanges_canonize previously
merged adjacent entries with an in-place loop that called
sk_..._delete() after each merge, making the merge O(N^2) due to the
per-merge stack shift.

Replace the merge with a single linear sweep using a write index
distinct from the read cursor: mergeable entries fold into the
previous output's upper bound in O(1), non-mergeable entries are slid
forward into the write slot, and the source slot is set to NULL so the
ASN.1 free machinery cannot double-free on a subsequent abort.
Canonicalisation is now O(N log N) overall, bounded by the existing
sort.

Mixed-state-on-error safety is provided by the caller's normal
teardown path: OPENSSL_sk_pop unlinks without freeing, OPENSSL_sk_set
replaces without freeing the displaced value, and
ossl_asn1_item_embed_free no-ops on NULL slots, so returning early on
an inner failure leaves the stack in a state that the choice's normal
free path handles cleanly.

New regression tests in test/v3ext.c at N=8192 cover the all-merge,
no-merge, interleaved (slide-forward), range-merge,
overlap-mid-sweep, and inverted-range-mid-sweep paths; the
mixed-state teardown invariant is exercised under ASan + UBSan.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Fri Jul  3 19:20:01 2026
(Merged from https://github.com/openssl/openssl/pull/31147)
2026-07-03 21:19:51 +02:00
Jakub Zelenka
ff6b868ddd ci: run full cross-compile tests on PRs with 'extended tests' label
Previously the cross-compile workflow only ran the EVP tests on pull
requests, with the full test suite done only for push events.  Allow the
full suite to run on a pull request when it has the 'extended tests'
label which is already used for extended tests.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Jul  3 14:39:38 2026
(Merged from https://github.com/openssl/openssl/pull/31705)
2026-07-03 16:39:32 +02:00
Neil Horman
cf82f5f78f Add test to exercise non-caching code paths
Use openssl list, which uses EVP_*_do_all_provided on non-caching
algorithms.  The do_all_provided path callbacks expect the algorithms
that are looked up to be saveable via up_ref, so this, when run under
asan, makes for a good test to ensure we don't trigger any use after
free situations when not caching algs.

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Thu Jul  2 14:24:17 2026
(Merged from https://github.com/openssl/openssl/pull/31782)
2026-07-02 10:24:10 -04:00
Neil Horman
a66d74c8c1 add support to p_ossltest for non-cacheable fetches
Add the ability to direct p_ossltest to request no caching so that we
can test the provider driver non-cache code path.

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Thu Jul  2 14:24:15 2026
(Merged from https://github.com/openssl/openssl/pull/31782)
2026-07-02 10:24:10 -04:00
Neil Horman
8c8a80b00b Extend refcounting on evp objects to provider requesed no-caching
We recently removed reference counting for EVP objects, but kept the
refcounting when we build with no-cached-fetch.

There is a corner case in which providers in builds that do caching may
still request non-caching by setting *no_cache = 1 in their query
operations.

OQS tripped over this here:
https://github.com/open-quantum-safe/oqs-provider/pull/787

When a provider requests no caching, we need to treat those algorithms
as though we are running in a no-cached-fetch build and still do ref
counting on them.

Teach our algorithms implementation to understand when a provider is
requesting non-caching, mark them as such and ref count only those.

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Thu Jul  2 14:24:13 2026
(Merged from https://github.com/openssl/openssl/pull/31782)
2026-07-02 10:24:10 -04:00
Evy Garden
a3b7e09114 Add -n option to openssl-rand to not output the trailing newline
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Thu Jul  2 10:59:26 2026
(Merged from https://github.com/openssl/openssl/pull/31795)
2026-07-02 12:59:24 +02:00
Eugene Syromiatnikov
7c9b263005 crypto/pem/pem_info.c: avoid switching on PEM_INFO_NONE
Coverity complains that the switch statements in PEM_X509_INFO_read_bio_ex()
switches on PEM_INFO_NONE, while the enclosing condition
(itype != PEM_INFO_NONE) explicitly rules it out.  Pacify it by changing
the switch case to default (not removing it to avoid triggering
-Werror=switch).

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1695453
Complements: 0e8f2844ed "fix function pointer type mismatch in PEM_X509_INFO_read_bio_ex"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Jul  2 07:26:24 2026
(Merged from https://github.com/openssl/openssl/pull/31792)
2026-07-02 09:26:18 +02:00
Eugene Syromiatnikov
862844ddf9 fuzz/provider.c: check evp##_up_ref return value in collect_##evp
Coverity has reported an unchecked result of an evp##_up_ref call
that is checked elsewhere.  Rewrite the collect routine to try to do
the up_ref first, and then call free if push doesn't succeed.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1695451
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1695454
Fixes: f3b988dc29 "Add provider fuzzer"

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Jul  2 07:26:22 2026
(Merged from https://github.com/openssl/openssl/pull/31792)
2026-07-02 09:26:18 +02:00
Eugene Syromiatnikov
a5b0c2ef9a test/evp_kdf_test.c: add checks or EVP_KDF_CTX_{,get0_,get1_}kdf()
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jul  2 07:24:24 2026
(Merged from https://github.com/openssl/openssl/pull/28954)
2026-07-02 09:24:15 +02:00
Leon Timmermans
b71c5cfeda Add EVP_KDF_CTX_get0_kdf and EVP_KDF_CTX_get1_kdf, deprecate EVP_KDF_CTX_kdf
Resolves: https://github.com/openssl/openssl/issues/28327

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jul  2 07:24:22 2026
(Merged from https://github.com/openssl/openssl/pull/28954)
2026-07-02 09:24:15 +02:00
Jakub Zelenka
7520345190 quic: add mfail test for a read with key update
This adds test for #31268 with using SSL_read for QUIC client and
forcing key update.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Thu Jul  2 07:21:14 2026
(Merged from https://github.com/openssl/openssl/pull/31272)
2026-07-02 09:21:08 +02:00
Neil Horman
8a072a3dab use evp_asym_cipher_free in evp_asym_cipher_from_algorithm
evp_asym_cipher_from_algorithm, in its error path frees the allocated
cipher with EVP_ASM_CIPHER_free, but thats a no-op now, and we actually want to
free it to avoid leaks, so we should use evp_asym_cipher_free (the internal
function that acutally does free the alg) instead.

Fixes https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1695449

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed Jul  1 15:32:25 2026
(Merged from https://github.com/openssl/openssl/pull/31748)
2026-07-01 11:32:12 -04:00
Neil Horman
4d50403e51 use evp_signature_free in evp_signature_from_algorithm
evp_signature_from_algorithm, in its error path frees the allocated sig
with EVP_SIGNATURE_free, but thats a no-op now, and we actually want to
free it to avoid leaks, so we should use evp_signature_free (the internal
function that acutally does free the alg) instead.

Fixes https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1695450

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed Jul  1 15:32:23 2026
(Merged from https://github.com/openssl/openssl/pull/31748)
2026-07-01 11:32:12 -04:00
Neil Horman
4c48ed7319 use evp_keymgmt_free in keymgmt_from_algorithm
keymgmt_from_algorithm, in its error path frees the allocated keymgmt
with EVP_KEYMGMT_free, but thats a no-op now, and we actually want to
free it to avoid leaks, so we should use evp_keymgmt_free (the internal
function that acutally does free the alg) instead.

Fixes https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1695452

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed Jul  1 15:32:21 2026
(Merged from https://github.com/openssl/openssl/pull/31748)
2026-07-01 11:32:12 -04:00
Neil Horman
e4551d81c3 use evp_keyexch_free in evp_keyexch_from_algorithm
evp_keyexch_from_algorithm, in its error path frees the allocated kem
with EVP_KEM_free, but thats a no-op now, and we actually want to
free it to avoid leaks, so we should use evp_keyexch_free (the internal
function that acutally does free the alg) instead.

Fixes https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1695455

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed Jul  1 15:32:18 2026
(Merged from https://github.com/openssl/openssl/pull/31748)
2026-07-01 11:30:51 -04:00
Neil Horman
8225d82f04 use evp_kem_free in evp_kem_from_algorithm
evp_kem_from_algorithm, in its error path frees the allocated kem
with EVP_KEM_free, but thats a no-op now, and we actually want to
free it to avoid leaks, so we should use evp_kem_free (the internal
function that acutally does free the alg) instead.

Fixes https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1695456

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed Jul  1 15:32:16 2026
(Merged from https://github.com/openssl/openssl/pull/31748)
2026-07-01 11:30:51 -04:00
Michał Trojnara
5d61a36a94 s_client: skip TCP shutdown drain for datagram protocols
The shutdown-side drain uses a TCP half-close and a fixed 500 ms
select() timeout to let peers consume buffered alerts before close.
Running it for DTLS/QUIC datagram connections causes an unnecessary
delay after the connection has otherwise completed.

Limit this workaround to non-DTLS, non-QUIC connections.

CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul  1 13:35:53 2026
(Merged from https://github.com/openssl/openssl/pull/31558)
2026-07-01 15:35:10 +02:00
Mounir IDRASSI
2229aad774 apps/s_server.c: fix SSL object leak on rpk_enable() failure
In www_body() and rev_body(), con = SSL_new(ctx) is called before
rpk_enable(con), but ownership of con is transferred to ssl_bio only
later by BIO_set_ssl(..., BIO_CLOSE). If rpk_enable() fails, the code
jumps to err: before that transfer without freeing con, leaking the SSL
object.

Add SSL_free(con) before goto err in both rpk_enable() failure paths,
matching the adjacent SSL_set_session_id_context() and BIO_new_socket()
error paths. sv_body() is unaffected because its err: block already
frees con.

The global rpk_files is not leaked. Its lifetime is managed
by s_server_main(), which frees it in the end cleanup block.

Resolves: https://github.com/openssl/openssl/issues/31769

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul  1 12:04:13 2026
(Merged from https://github.com/openssl/openssl/pull/31789)
2026-07-01 14:03:34 +02:00
Mounir IDRASSI
10c0927bb3 Suppress MSVC C4996 in applink.c
applink.c deliberately stores legacy CRT function pointers because
ms/uplink.h expects the old fopen and _open signatures. Keep the
table entries unchanged and suppress MSVC warning C4996 locally
around OPENSSL_Applink() instead of switching to fopen_s or
_sopen_s.

Fixes #8241

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul  1 09:17:39 2026
(Merged from https://github.com/openssl/openssl/pull/31765)
2026-07-01 11:17:36 +02:00
Milan Broz
8a57600f23 Use more recent default for _WIN32_WINNT
After the windows.h include optimization introduced in
commit 1eaf29ef6c, the _WIN32_WINNT default was changed, causing
performance regressions.

Currently, _WIN32_WINNT is defined as 0x0501, which means WinXP.

This causes the code to be compiled with WinXP-compatible code, notably
 - without USE_RWLOCK
 - using legacy thread implementation
 - legacy RNG seeding (no BCryptGenRandom)

This patch increases the requirement to 0x600 (Windows Vista).

Note that code running on WinXP cannot currently be compiled with
any default configuration, as supported compilers generate executables
for Windows Vista and above.

If we provide some way to support WinXP, it can be done by
redefining _WIN32_WINNT.

Resolves: https://github.com/openssl/project/issues/2010
Fixes: 1eaf29ef6c "Remove direct includes of windows.h where possible"

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed Jul  1 09:14:18 2026
(Merged from https://github.com/openssl/openssl/pull/31774)
2026-07-01 11:14:10 +02:00
Milan Broz
635ffe8bb9 Fix use of BCryptGenRandom
Current path for Windows RNG (for Vista and above) should
use BCryptGenRandom() function but the symbol is not included
in platform_symbols.

The issue was hidden before commit 1eaf29ef6c reordered
Windows header inclusion.

Moreover, a cast to ULONG is required for strict warnings build.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed Jul  1 09:14:17 2026
(Merged from https://github.com/openssl/openssl/pull/31774)
2026-07-01 11:14:10 +02:00
Ingo Franzki
e9351bcce6 s390x: Fix AES-XTS hardware acceleration in IBM z17
For the re-init case where only the IV is specified, but no key, the 'nap'
field must also be initialized.

Instead of setting the s390 specific fields in a special case block, call
ctx->hw->init() also in this case. It performs the necessary setup already
(when the KM function code was once set already).

Adjust the cipher_hw_aes_xts_s390x_initkey() function so that it can also
be called with a NULL key. It then only performs the IV setup as well as
setting up the 'nap'.

Closes: https://github.com/openssl/openssl/issues/31766
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>

Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Wed Jul  1 09:12:26 2026
(Merged from https://github.com/openssl/openssl/pull/31775)
2026-07-01 11:12:22 +02:00
Pauli
1be08a7791 demo: fix fips-version Makefile so it loads the FIPS provider correctly
Fixes #31760

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/31762)
2026-07-01 17:36:27 +10:00
Ingo Franzki
f0ca416976 s390x: Fix return code handling in HMAC_Init_ex()
When running on the s390x platform HMAC_Init_ex() calls s390x_HMAC_init()
to optionally allow hardware acceleration of the HMAC operation. In case
the hardware acceleration is not available, s390x_HMAC_init() returns -1
to indicate that. In this case the software path is continued.

The problem is that rv was set to -1 by s390x_HMAC_init() and stays at
this until the end of the function. In case the software path detects an
error it goes to the 'err' label which just returns rv as is, and thus
HMAC_Init_ex() now returns -1 instead of 0 (rv was initialized to 0 at
declaration).

The wrong return value might then be propagated through all layers, i.e.
to EVP_MAC_init() which also returns -1 in this case. However, EVP_MAC_init()
is defined as returning 1 on success, or 0 on error, i.e. a boolean kind of
return value.

Typically, callers will do something like 'if (!EVP_MAC_init(s....))' to
check for errors. A return value of -1 is non-zero, and thus it is treated
as successful return.

Fix this by setting rv back to 0 when s390x_HMAC_init() returned -1.

Fixes: 0499de5add "s390x: Add hardware acceleration for HMAC"
Resolves: https://github.com/openssl/openssl/issues/31706
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Tue Jun 30 20:49:52 2026
(Merged from https://github.com/openssl/openssl/pull/31723)
2026-06-30 22:48:43 +02:00
Frederik Wedel-Heinen
4402bc95fa Removes some stale SSLv3 support around the code and updated documentation to reflect removal.
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jun 30 11:04:18 2026
(Merged from https://github.com/openssl/openssl/pull/30824)
2026-06-30 13:04:17 +02:00
Bob Beck
ed25946495 Clean up the cpu id stuff by hoisting the append into a helper
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jun 30 11:02:52 2026
(Merged from https://github.com/openssl/openssl/pull/31646)
2026-06-30 13:02:49 +02:00
Jakub Zelenka
c5ae170e85 property: add cache provider-order regression test
When two providers cache the same nid and property query, the first one
to do so must own the providerless cache entry, so that a NULL-provider
lookup keeps resolving to that provider. This covers commit 9d476175d7.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun 30 11:01:57 2026
(Merged from https://github.com/openssl/openssl/pull/31738)
2026-06-30 13:01:49 +02:00
Daniel Kubec
a06203b3cb TEST: Add DTLS 1.2 coverage for Session ID verification
The DTLS 1.2 tests exercise the same verification logic and confirm that the
behavior matches the TLS 1.2 implementation. The tests pass as expected and
provide additional coverage for DTLS 1.2 without requiring any functional
changes.

Fixes #31250

Reviewed-by: Igor Ustinov <igus@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Tue Jun 30 11:00:55 2026
(Merged from https://github.com/openssl/openssl/pull/31389)
2026-06-30 13:00:49 +02:00
Bob Beck
5a55913f10 Don't attempt to check the security level on what signed our own certificate.
What matters to us is that the key *we* are using matches our desired
security level, as we may sign things with that key. As far as who
signed us, this could be signed by something we don't recognize at all,
and it is up to the peer to decide if the thing signing us matters to
it (i.e. if it recognizes the algorithm, decides it's strong enough,
or it even verifies the signature, as it might already trusts our key
due to pinning, TOFU, Prayer and Clean Living, or whatever.)

Obviously, we still check the security level on any signatures *we*
recieve to verify *from* a peer.

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jun 30 10:47:09 2026
(Merged from https://github.com/openssl/openssl/pull/31271)
2026-06-30 12:47:06 +02:00
Bob Beck
c25e1c4b78 SSL_OP_SECOP is dead code
Nothing set the "vfy" parameters in any of these functions to anything but 0.

Remove the parameter and stage things related to SSL_OP_SECOP to go away in the
future.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jun 30 10:47:07 2026
(Merged from https://github.com/openssl/openssl/pull/31271)
2026-06-30 12:47:03 +02:00
Bob Beck
bca4e46568 Clarify the comment in asn1.h.in for ASN1_VALUE
I've been down this road a few times and nhorman@ just hit it.

While technically true, most of our opaque pointers have internal
defninitions. Stop people going down the garden path by explaining
what this is

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jun 30 09:51:37 2026
(Merged from https://github.com/openssl/openssl/pull/31708)
2026-06-30 11:51:30 +02:00
Jakub Zelenka
f9dff99361 apps: cover the smime multiple -signer parsing path
The signerfile != NULL block in smime_main(), reached when more than one
-signer is given (including the case where a preceding -inkey leaves
keyfile != NULL), was not exercised: the existing multi-signer tests run
through the cms command, and the smime app was only ever run with a
single signer.  Add a two-signer test, with an explicit -inkey, to the
pkcs7 test set so it runs through smime when signing.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Tue Jun 30 08:57:47 2026
(Merged from https://github.com/openssl/openssl/pull/31675)
2026-06-30 10:57:34 +02:00
Jakub Zelenka
801c432b18 quic: add mfail test for RCIDM
This tests memory failures in remote connection ID manager code.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun 30 08:56:45 2026
(Merged from https://github.com/openssl/openssl/pull/31602)
2026-06-30 10:56:41 +02:00
Jakub Zelenka
1a80366668 quic: add mfail test for multi-packet RXE
Add a record layer test that executes qrx_process_pkt() under mfail
on a freshly created qrx whose rx_free freelist is empty. This
deterministically lands the qrx_ensure_free_rxe() call for the first
packet of a multi-packet datagram among the enumerated injection points
which is the precondition for triggering assert failure in
qrx_validate_hdr_early(). The test reuses rx_script_5's coalesced
Initial+Handshake+1-RTT datagram and only provides the Initial secret,
since the bug fires before any decryption is attempted.

Assisted-by: Claude:claude-opus-4-7

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun 30 08:56:00 2026
(Merged from https://github.com/openssl/openssl/pull/31331)
2026-06-30 10:55:57 +02:00
Jakub Zelenka
c36a9b463e statem: add direct tests for tls_construct_client_hello
Add a new test which calls tls_construct_client_hello() directly,
creating an SSL_CONNECTION enough to invoke the construct function
without making a full handshake, then verifies the produced
ClientHello structurally and by round-tripping it through the
server-side tls_process_client_hello().

The covered branches include TLS 1.3 (with and without middlebox
compat), TLS 1.2, DTLS, session resumption, HelloRetryRequest, the DTLS
cookie and client_random reuse paths, the deterministic error branches
(WPACKET overflow and no usable ciphers), and the ECH wrapper path
(happy path with server-side decryption, the TLS 1.2 version error, and
OOM). Out-of-memory branches are exercised with the mfail tests.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
MergeDate: Tue Jun 30 08:54:48 2026
(Merged from https://github.com/openssl/openssl/pull/31618)
2026-06-30 10:54:38 +02:00
Jakub Zelenka
7d4475bdf2 statem: fail handshake if there is memory failure in negotiate_dhe
Previously this just resulted in the skip of the group but such failure
should result in a proper error. This is not a big issue but it impacts
mfail tests so it would be good to fail.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
MergeDate: Tue Jun 30 08:54:47 2026
(Merged from https://github.com/openssl/openssl/pull/31618)
2026-06-30 10:54:38 +02:00
Neil Horman
f5a5e89044 ensure writes are syncronized on windows in CRYPTO_THREAD_run_once
We've tried to fix this properly using InitOnceExecuteOnce, but it
results in an ABI breakage, so we're doing it this way.

on windows, CRYPTO_THREAD_run_once, on weakly memory ordered systems,
may complete the write of the run once variable lock before some of the
writes made by the init callback routine complete.  The result is that
on a heavily multithreaded application, other therads may see the data
that was meant to be in an initalized state, as in some erroneous
in-between state, leading to errors.

Fix it by inserting a full memory barrier after we return from the init
callback, and prior to setting the run once variable to ONCE_DONE.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jun 30 08:51:16 2026
(Merged from https://github.com/openssl/openssl/pull/31713)
2026-06-30 10:51:14 +02:00
Mounir IDRASSI
b06d2b2c92 test: run RIO notifier smoke test everywhere
The RIO notifier smoke test is currently limited to
Windows targets in both the build metadata and the
test recipe.
The test exercises the notifier abstraction and can
run on other platforms as well, so this removes the
Windows-only guards.

The test remains conditional on QUIC being enabled.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Jun 30 08:49:54 2026
(Merged from https://github.com/openssl/openssl/pull/31494)
2026-06-30 10:49:50 +02:00
Andrew Dinh
e6220f6e31 Fix OP_READ_FAIL_WAIT macro definition
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jun 30 07:54:52 2026
(Merged from https://github.com/openssl/openssl/pull/31707)
2026-06-30 09:54:33 +02:00
Andrew Dinh
7f2003289a Port script_9
Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jun 30 07:54:51 2026
(Merged from https://github.com/openssl/openssl/pull/31707)
2026-06-30 09:54:33 +02:00
Andrew Dinh
783baebb17 Port script_8
Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jun 30 07:54:50 2026
(Merged from https://github.com/openssl/openssl/pull/31707)
2026-06-30 09:54:33 +02:00
Andrew Dinh
0f41f011f8 Port script_7
Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jun 30 07:54:48 2026
(Merged from https://github.com/openssl/openssl/pull/31707)
2026-06-30 09:54:33 +02:00
Andrew Dinh
1ca326f0e7 Port script_6
Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jun 30 07:54:47 2026
(Merged from https://github.com/openssl/openssl/pull/31707)
2026-06-30 09:54:33 +02:00
Andrew Dinh
6bb3799400 Port script_5
Also fixes a bug in the OP_STREAM_RESET macro

Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jun 30 07:54:46 2026
(Merged from https://github.com/openssl/openssl/pull/31707)
2026-06-30 09:54:33 +02:00
Billy Brumley
ea655177e0 [test] check tag abuse for AEAD ciphers
With AEAD ciphers, a tag is an input for decryption (the value to verify)
and an output of encryption (the generated value). Therefore:
- supplying a tag value while encrypting must fail
- reading a tag while decrypting must fail
- error codes should be consistent across all AEADs

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
MergeDate: Tue Jun 30 07:47:03 2026
(Merged from https://github.com/openssl/openssl/pull/31734)
2026-06-30 09:47:01 +02:00
Pauli
b00f7b6c30 demo: add program that shows how to query the FIPS provider version
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Simo Sorce <simo@redhat.com>
(Merged from https://github.com/openssl/openssl/pull/31654)
2026-06-29 08:03:09 +10:00
Nikola Pajkovsky
f32f8682ea providers/fips/fipsprov.c, test/p_test.c: remove c_gettable_params static global
c_gettable_params is never read anywhere in the files;  it was dead
storage.  Remove it.

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

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sun Jun 28 17:51:55 2026
(Merged from https://github.com/openssl/openssl/pull/31508)
2026-06-28 19:50:37 +02:00
Nikola Pajkovsky
f3447c3bc2 providers/baseprov.c: remove static globals
c_gettable_params is never read anywhere in the file;  it was dead
storage.  c_get_params is only consumed once, inside the same call
to ossl_default_provider_init(), to seed the provider context
via ossl_prov_ctx_set0_core_get_params().  It can therefore be a local
variable rather than file-scope state.

Drop the unused c_gettable_params static together with its dispatch
case, and scope c_get_params inside the init function.  The behavior
of the base provider is unchanged for single-threaded callers;
the concurrent-load race goes away because the shared mutable state
is gone.

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

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sun Jun 28 17:51:54 2026
(Merged from https://github.com/openssl/openssl/pull/31508)
2026-06-28 19:49:47 +02:00
Matt Van Horn
57f4bd9ab8 providers/defltprov.c: remove static globals from provider_init
The default provider stored two function pointers from the core
dispatch table (c_gettable_params, c_get_params) in file-scope statics,
written by ossl_default_provider_init() without any synchronization.
When OSSL_PROVIDER_load() is invoked from multiple threads concurrently,
TSAN reports a data race on both writes[1].

c_gettable_params is never read anywhere in the file; it was dead
storage.  c_get_params is only consumed once, inside the same call
to ossl_default_provider_init(), to seed the provider context
via ossl_prov_ctx_set0_core_get_params().  It can therefore be a local
variable rather than file-scope state.

Drop the unused c_gettable_params static together with its dispatch
case, and scope c_get_params inside the init function.  The behavior
of the default provider is unchanged for single-threaded callers;
the concurrent-load race goes away because the shared mutable state
is gone.

[1] https://github.com/openssl/openssl/issues/28935

CLA: trivial
Resolves: https://github.com/openssl/openssl/issues/28935

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sun Jun 28 17:51:52 2026
(Merged from https://github.com/openssl/openssl/pull/31508)
2026-06-28 19:48:08 +02:00
Jakub Zelenka
fc73636888 test/recipes/15-test_pkey.t: extend tests for openssl pkey -text and -text_pub
This slightly improves openssl pkey text coverage.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Sun Jun 28 17:42:46 2026
(Merged from https://github.com/openssl/openssl/pull/31521)
2026-06-28 19:41:43 +02:00
Eugene Syromiatnikov
ab612a9baf test/asn1_string_test.c: allocate tmpstring properly in asn1_string_new_not_owned_test
Since tmpstring's ownership is transferred to tmp in ASN1_STRING_set0(),
it should be allocated using OPENSSL_strdup() and not strdup()
(as it will be freed with OPENSSL_free() in ASN1_STRING_clear_free()).
Also, don't try to free tmpstring on error, as at no point there is a jump
to err when tmpstring is allocated and not owned by tmp.

Reported by Coverity, issue 1695274.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1695274
Fixes: 68c0321e90 "Provide ASN1_STRING_new_not_owned()"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sun Jun 28 16:22:28 2026
(Merged from https://github.com/openssl/openssl/pull/31667)
2026-06-28 18:22:20 +02:00
Simo Sorce
e60d940b29 Expand AES mode macro into explicit functions
This removes the PROV_CIPHER_HW_aes_mode macro and replaces it with explicitly
written function definitions for each AES mode (ECB, CBC, CFB128, CFB8, CFB1,
OFB128, CTR).

Expanding macro-generated functions improves overall code readability, allows
code navigation tools to properly index the function signatures, and provides
clearer stack traces during debugging.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Sat Jun 27 09:06:05 2026
(Merged from https://github.com/openssl/openssl/pull/31472)
2026-06-27 11:04:36 +02:00
Simo Sorce
48a3219050 Prefix internal AES-GCM functions with ossl_
The `aes_gcm_hw_initkey` and `generic_aes_gcm_cipher_update` functions are
shared across multiple hardware-specific provider implementations but lacked
the internal `ossl_` prefix. They have been renamed to
`ossl_aes_gcm_hw_initkey` and `ossl_generic_aes_gcm_cipher_update`
respectively to follow OpenSSL naming conventions and prevent potential
namespace collisions.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Sat Jun 27 09:06:03 2026
(Merged from https://github.com/openssl/openssl/pull/31472)
2026-06-27 11:04:36 +02:00
Simo Sorce
f7e4eb281d Consolidate SPARC T4 AES implementations
Move SPARC T4-specific AES hardware implementations (GCM, CCM, and XTS) from
individual mode-specific files into a single unified file
(cipher_aes_hw_t4.c). This consolidates the architecture-specific logic to
improve code organization and maintainability.

Additionally, this change removes the unused `keybits` parameter from several
SPARC T4 hardware initialization routines to clean up the internal API.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Sat Jun 27 09:06:01 2026
(Merged from https://github.com/openssl/openssl/pull/31472)
2026-06-27 11:04:36 +02:00
Simo Sorce
b0bda138a6 Consolidate s390x AES hardware implementations
Move the s390x hardware-accelerated AES mode implementations (GCM, CCM, and
XTS) from their respective files into a single `cipher_aes_hw_s390x.c` file.
Centralizing the platform-specific logic simplifies the code structure and
improves maintainability.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Sat Jun 27 09:05:58 2026
(Merged from https://github.com/openssl/openssl/pull/31472)
2026-06-27 11:04:36 +02:00
Simo Sorce
10dcad1311 Extract Zvkned key length check to helper
A new helper function, zvkned_key_schedule_supported, is introduced to
centralize the verification of 128-bit and 256-bit key lengths.

This replaces multiple duplicated, hardcoded checks across the RISC-V AES
implementations to improve code readability and maintainability. It also
ensures consistent check handling for XTS mode by correctly evaluating half
the key length.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Sat Jun 27 09:05:56 2026
(Merged from https://github.com/openssl/openssl/pull/31472)
2026-06-27 11:04:36 +02:00
Simo Sorce
aa23e0cd7a Consolidate RISC-V 64 AES hardware code
Merge the RISC-V 64 hardware-accelerated AES mode implementations (GCM, CCM,
and XTS) into a single file (`cipher_aes_hw_rv64i.c`). This removes the need
for separate files for GCM and CCM, and extracts RV64-specific XTS code from
the generic XTS hardware file, improving code organization.

Additionally, remove the unused `keybits` parameter from the RV64 AES hardware
retrieval functions.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Sat Jun 27 09:05:54 2026
(Merged from https://github.com/openssl/openssl/pull/31472)
2026-06-27 11:04:36 +02:00
Simo Sorce
f537454de0 Consolidate RV32I AES hardware implementations
Move the RISC-V 32-bit hardware-accelerated AES implementations for GCM, CCM,
and XTS modes into a single file (`cipher_aes_hw_rv32i.c`). This removes the
need for separate files (`cipher_aes_gcm_hw_rv32i.c` and
`cipher_aes_ccm_hw_rv32i.c`) and simplifies the build process. Additionally,
unused `keybits` parameters are removed from the provider hardware
initialization functions to clean up the code.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Sat Jun 27 09:05:52 2026
(Merged from https://github.com/openssl/openssl/pull/31472)
2026-06-27 11:04:36 +02:00
Simo Sorce
d1004c62ac Consolidate ARMv8 AES hardware implementations
Move the ARMv8-specific hardware implementations for AES GCM into a single
consolidated file (`cipher_aes_hw_armv8.c`). This groups architecture-specific
optimizations together to improve code organization and maintainability.

Additionally, remove the unused `keybits` parameter from the ARMv8 provider
functions to simplify the function signatures.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Sat Jun 27 09:05:50 2026
(Merged from https://github.com/openssl/openssl/pull/31472)
2026-06-27 11:04:36 +02:00
Simo Sorce
16234b9073 Consolidate AESNI hardware implementations
Move the AES-NI specific hardware implementations for GCM, CCM, and XTS modes
from individual mode files into a single consolidated file
(`cipher_aes_hw_aesni.c`). This groups architecture-specific optimizations
together, improving code organization and maintainability.

As part of this refactoring, the unused `keybits` parameter was removed from
several AES-NI provider functions, and necessary XTS initialization and
context copy functions were exported for shared use.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Sat Jun 27 09:05:48 2026
(Merged from https://github.com/openssl/openssl/pull/31472)
2026-06-27 11:04:36 +02:00
Simo Sorce
774525b38b Migrate s390x AES-XTS to standard HW interface
Move the s390x-specific AES-XTS implementation from `cipher_aes_xts_s390x.inc`
to `cipher_aes_xts_hw.c`, adapting it to use the standard `PROV_CIPHER_HW`
dispatch structure.

This refactoring removes standalone initialization wrappers and integrates the
s390x hardware backend more cleanly with the generic AES-XTS provider code. It
also reduces code duplication by relying on the generic layer for common
validations (such as the maximum blocks per data unit limit) before invoking
the hardware-specific stream cipher.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Sat Jun 27 09:05:46 2026
(Merged from https://github.com/openssl/openssl/pull/31472)
2026-06-27 11:04:36 +02:00
Simo Sorce
5339c5219f Refactor AES XTS hardware key initialization
Replace complex AES XTS initialization and hardware selection macros
(`XTS_SET_KEY_FN`, `PROV_CIPHER_HW_declare_xts`, and
`PROV_CIPHER_HW_select_xts`) with standard C functions.

Architecture-specific initializers, particularly for RISC-V, are consolidated
to evaluate CPU capabilities within dedicated initialization functions rather
than relying on macro expansion. This refactoring improves overall code
readability, maintainability, and simplifies debugging by eliminating opaque
multi-statement macros.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Sat Jun 27 09:05:44 2026
(Merged from https://github.com/openssl/openssl/pull/31472)
2026-06-27 11:04:36 +02:00
Simo Sorce
e9cf01be98 Convert AES CCM .inc files to separate .c files
The hardware-specific AES CCM implementations were previously included
directly as `.inc` files into `cipher_aes_ccm_hw.c`. This commit renames them
to standalone `.c` files and updates the build configuration, improving
modularity by treating them as separate compilation units.

Additionally, the `AES_HW_CCM_SET_KEY_FN` macro is replaced with a new
`ossl_cipher_set_ccm_aes_initkey` helper function. This reduces code
duplication, removes unsafe macro logic, and introduces proper error handling
during provider key initialization.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Sat Jun 27 09:05:42 2026
(Merged from https://github.com/openssl/openssl/pull/31472)
2026-06-27 11:04:36 +02:00
Simo Sorce
62663738b0 Refactor AES hardware cipher implementations
Replace architecture-specific `.inc` files with standalone `.c` files for AES
ciphers and consolidate CFB mode logic into these new modules.

This eliminates the direct inclusion of source files and compiles each
hardware implementation as a separate translation unit.

This refactoring simplifies code organization and remove macro
complexity that makes it hard to understand what is implemented and
where enhancing maintainability.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Sat Jun 27 09:05:40 2026
(Merged from https://github.com/openssl/openssl/pull/31472)
2026-06-27 11:04:36 +02:00
Simo Sorce
e1c0726f48 Replace GCM_HW_SET_KEY_CTR_FN with a function
The `GCM_HW_SET_KEY_CTR_FN` macro has been removed and replaced with a proper
function, `aes_gcm_hw_initkey`, for AES GCM hardware implementations. For ARIA
GCM, the macro expansion was manually inlined.

This refactoring eliminates a multi-line macro to improve debuggability and
type safety. Crucially, the new function checks the return value of the
underlying key setup routines, ensuring that key initialization failures are
now correctly caught and propagated instead of being ignored.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Sat Jun 27 09:05:38 2026
(Merged from https://github.com/openssl/openssl/pull/31472)
2026-06-27 11:04:36 +02:00
Simo Sorce
87efbd9528 Untangle rats nest of .inc files for AES_GCM
These files have no reason not to be just regular .c files.
Additionally apply formatting fixes which were not done on .inc files

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Sat Jun 27 09:05:35 2026
(Merged from https://github.com/openssl/openssl/pull/31472)
2026-06-27 11:04:36 +02:00
Norbert Pocs
5a47730f01 crypto/LPdir_wince.c: remove dead source file
After removal of Win CE support in commit c60fddbbcf "Drop Windows CE
support.", this file is no longer used.  Remove it.

Complements: c60fddbbcf "Drop Windows CE support."
Reported-by: Nikola Pajkovsky <nikolap@openssl.org>
Signed-off-by: Norbert Pocs <norbertp@openssl.org>

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Jun 26 17:36:16 2026
(Merged from https://github.com/openssl/openssl/pull/31718)
2026-06-26 19:35:50 +02:00
Andrew Dinh
353248330e Update CI to validate erroring on non-existent test selection
Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Jun 26 16:40:25 2026
(Merged from https://github.com/openssl/openssl/pull/31639)
2026-06-26 18:38:44 +02:00
Andrew Dinh
f0d8e14c0e test/run_tests.pl: return error if running a non-existent test
Resolves: https://github.com/openssl/openssl/issues/15510
Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Jun 26 16:40:23 2026
(Merged from https://github.com/openssl/openssl/pull/31639)
2026-06-26 18:38:15 +02:00
dannyward630
1111694d86 doc/man7/EVP_KDF-SNMPKDF.pod: fix password parameter documentation
Document the SNMPKDF "pass" parameter with OSSL_KDF_PARAM_PASSWORD,
matching the implementation and other KDF documentation.  Also, fix
the nearby grammar.

Resolves: https://github.com/openssl/openssl/issues/31543
Fixes: 1b035166bd "Add SNMPKDF implementation"
CLA: trivial

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Fri Jun 26 16:29:54 2026
(Merged from https://github.com/openssl/openssl/pull/31592)
2026-06-26 18:28:51 +02:00
007bsd
8be7309f34 crypto/x509/v3_ncons.c: fix scheme buffer leak in nc_uri() for schemeless URIs
OSSL_parse_url() allocates a 1-byte empty-string buffer for the scheme
even when the URI has no scheme.  The empty-scheme error branch freed
uri_copy and jumped to end: which only frees host, leaving scheme
unfreed.  Add OPENSSL_free(scheme) before the goto.

Assisted-by: Claude:claude-sonnet-4-6
CLA: trivial
Fixes: e599893a9f "x509: allow SAN URIs to contain userinfo"

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Jun 26 15:26:09 2026
(Merged from https://github.com/openssl/openssl/pull/31678)
2026-06-26 17:25:26 +02:00
007bsd
1f5a44a66d crypto/x509/pcy_cache.c: fix ext_pcons leak in policy_cache_new()
Two early-return paths in policy_cache_new() bypass the just_cleanup:
label and leak the POLICY_CONSTRAINTS object ext_pcons: (1) when
certificatePolicies is absent but policyConstraints is present, and
(2) when policy_cache_create() returns <= 0.  Free ext_pcons before
each early return.

Assisted-by: Claude:claude-sonnet-4-6
CLA: trivial
Fixes: 4acc3e907d "Initial support for certificate policy checking and evaluation."

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Jun 26 15:26:07 2026
(Merged from https://github.com/openssl/openssl/pull/31678)
2026-06-26 17:24:19 +02:00
Neil Horman
1f1ce7cad3 Fix up property test
Because the duplicate test expects the cache get operation to take
a reference count (which we no longer do), we need to not count it down
before checking the resulting ref count

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 25 21:26:17 2026
(Merged from https://github.com/openssl/openssl/pull/31143)
2026-06-25 17:25:43 -04:00
Neil Horman
4a8052bb8b delay method store free in context_deinit_objs
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 25 21:26:15 2026
(Merged from https://github.com/openssl/openssl/pull/31143)
2026-06-25 17:25:43 -04:00
Neil Horman
2d71463446 Makle STORE_LOADER not do ref counting
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 25 21:26:13 2026
(Merged from https://github.com/openssl/openssl/pull/31143)
2026-06-25 17:25:43 -04:00
Neil Horman
7933e2ca6e make OSSL_DECODER no do ref counting
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 25 21:26:11 2026
(Merged from https://github.com/openssl/openssl/pull/31143)
2026-06-25 17:25:43 -04:00
Neil Horman
2480844a11 Make OSSL_ENCODER not do ref counting
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 25 21:26:09 2026
(Merged from https://github.com/openssl/openssl/pull/31143)
2026-06-25 17:25:43 -04:00
Neil Horman
7dfc6344d8 make EVP_RAND not do ref counting
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 25 21:26:07 2026
(Merged from https://github.com/openssl/openssl/pull/31143)
2026-06-25 17:25:43 -04:00
Neil Horman
47e9e36946 Make EVP_KEYEXCH not do ref counting
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 25 21:26:05 2026
(Merged from https://github.com/openssl/openssl/pull/31143)
2026-06-25 17:25:43 -04:00
Neil Horman
32f23d770e Make EVP_KEYMGMT not do ref counting
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 25 21:26:04 2026
(Merged from https://github.com/openssl/openssl/pull/31143)
2026-06-25 17:25:43 -04:00
Neil Horman
a3ba2f0575 Make EVP_ASYM_CIPHER not do ref counting
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 25 21:26:02 2026
(Merged from https://github.com/openssl/openssl/pull/31143)
2026-06-25 17:25:43 -04:00
Neil Horman
d3cb703b35 Make EVP_SIGNATURE not do ref counting
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 25 21:26:00 2026
(Merged from https://github.com/openssl/openssl/pull/31143)
2026-06-25 17:25:43 -04:00
Neil Horman
4971f4830c make EVP_KEM not do refcounting
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 25 21:25:57 2026
(Merged from https://github.com/openssl/openssl/pull/31143)
2026-06-25 17:25:43 -04:00
Neil Horman
e2f82554ee Make EVP_KDF not do ref counting
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 25 21:25:55 2026
(Merged from https://github.com/openssl/openssl/pull/31143)
2026-06-25 17:25:43 -04:00
Neil Horman
e8bc71e666 Make EVP_MAC not do refcounting
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 25 21:25:53 2026
(Merged from https://github.com/openssl/openssl/pull/31143)
2026-06-25 17:25:43 -04:00
Neil Horman
ae23b9ae02 Make SKEYMGMT not do ref counting
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 25 21:25:51 2026
(Merged from https://github.com/openssl/openssl/pull/31143)
2026-06-25 17:25:43 -04:00
Neil Horman
d031b650a1 Make EVP_CIPHERS not need to take reference counts
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 25 21:25:49 2026
(Merged from https://github.com/openssl/openssl/pull/31143)
2026-06-25 17:25:05 -04:00
Neil Horman
6d94352026 Make EVP_MD's not need to take reference counts
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 25 21:25:47 2026
(Merged from https://github.com/openssl/openssl/pull/31143)
2026-06-25 17:25:05 -04:00
Neil Horman
b34958b877 Don't take reference counts on cache lookups
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 25 21:25:45 2026
(Merged from https://github.com/openssl/openssl/pull/31143)
2026-06-25 17:25:05 -04:00
Jakub Zelenka
dbeea0f418 apps: cover the kdf -cipher option in the test recipe
The -cipher option was not covered.  Add KRB5KDF test cases that
exercise it, both via -cipher and the equivalent -kdfopt cipher: form.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 25 17:01:33 2026
(Merged from https://github.com/openssl/openssl/pull/31651)
2026-06-25 19:01:21 +02:00
Jakub Zelenka
259a14a27f apps: fix Ed25519 typo in pkeyutl recipe subtest names
Two subtest descriptions read "Ed2559" instead of "Ed25519".

Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 25 17:00:37 2026
(Merged from https://github.com/openssl/openssl/pull/31644)
2026-06-25 19:00:28 +02:00
Jakub Zelenka
ff1dcf6a75 apps: cover pkeyutl oneshot buffer path with empty file input
The non-mmap buffer fallback in do_raw_keyop() for oneshot (only_nomd)
keys was never exercised on Unix, since any file with non-zero size
takes the mmap path and returns before reaching it. Signing and
verifying an empty file gives filesize 0, which skips the mmap block
(guarded by filesize > 0) and falls through to the buffer switch,
covering both the SIGN and VERIFY arms.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 25 17:00:36 2026
(Merged from https://github.com/openssl/openssl/pull/31644)
2026-06-25 19:00:28 +02:00
rootvector2
f9e7cb8cd4 lms: free previous encoded public key in ossl_lms_pubkey_decode
ossl_lms_pubkey_decode() only freed pkey->encoded when the new public key
had a different length, so re-decoding a same-length key on the documented
repeated-call path overwrote the old buffer without freeing it. Always free
the existing buffer first.

Also clear pkey->encodedlen on the error path so a failed decode leaves the
key in a consistent state instead of keeping a stale length.

CLA: trivial

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 25 16:58:46 2026
(Merged from https://github.com/openssl/openssl/pull/31345)
2026-06-25 18:58:41 +02:00
Tomas Mraz
fe44705758 25-test_verify_store.t: Add missing capture for bare run()
We want to add the printed out pubkey and not
just 1. Also add a comment clarifying intention of this
exercise.

Fixes 77c979faf4

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Thu Jun 25 16:44:51 2026
(Merged from https://github.com/openssl/openssl/pull/31700)
2026-06-25 18:43:40 +02:00
dannyward630
da7eadb593 Mention removed ERR macros in changelog
Update the existing 4.0.0 changelog entry for the ERR state cleanup to list the removed ERR_FLAG_MARK, ERR_FLAG_CLEAR, and ERR_NUM_ERRORS macros.

Fixes #31056

CLA: trivial

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 25 16:37:57 2026
(Merged from https://github.com/openssl/openssl/pull/31598)
2026-06-25 18:37:50 +02:00
Nikola Pajkovsky
c392d3052f x_all.c: avoid mismatched d2i/i2d function pointer casts
the d2i_*/i2d_* fp and bio wrappers for RSA_PUBKEY, the DSA and EC key
types, and the EVP_PKEY Private/PUBKEY converters passed their
type-specific functions to ASN1_{d2i,i2d}_{fp,bio}, which invoke them
through the generic d2i_of_void / i2d_of_void / void *(*)(void) pointer
types.

Add file-local thunks with the exact generic signatures that forward to
the concrete functions, and pass those instead of cast pointers. This
removes the mismatched calls while keeping the public API unchanged.

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Thu Jun 25 12:13:01 2026
(Merged from https://github.com/openssl/openssl/pull/31523)
2026-06-25 08:12:29 -04:00
Nikola Pajkovsky
ad47ffd79a avoid d2i_of_void asn1 callbacks in GENERAL_NAME_dup
use IMPLEMENT_ASN1_DUP_FUNCTION(GENERAL_NAME) so duplication goes
through ASN1_item_dup() instead of calling ASN1_dup() with cast
i2d/d2i function pointers. This avoids UBSan function type errors
while preserving the public GENERAL_NAME_dup() API.

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Thu Jun 25 12:12:59 2026
(Merged from https://github.com/openssl/openssl/pull/31523)
2026-06-25 08:12:29 -04:00
Nikola Pajkovsky
f6efce32a0 avoid mismatched d2i callbacks in PEM readers
decode PEM payloads through the generated typed d2i_* functions in the
PEM read macros instead of routing them through the d2i_of_void
callback path. This avoids UBSan function type mismatch reports while
preserving the public PEM reader APIs.

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Thu Jun 25 12:12:57 2026
(Merged from https://github.com/openssl/openssl/pull/31523)
2026-06-25 08:12:29 -04:00
Nikola Pajkovsky
ba15a13ffe decode_der2key: wrap key-free callbacks to avoid function pointer casts
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Thu Jun 25 12:12:55 2026
(Merged from https://github.com/openssl/openssl/pull/31523)
2026-06-25 08:12:29 -04:00
Nikola Pajkovsky
0e8f2844ed fix function pointer type mismatch in PEM_X509_INFO_read_bio_ex
PEM_X509_INFO_read_bio_ex stored d2i_X509, d2i_X509_AUX, d2i_X509_CRL
or d2i_AutoPrivateKey -- each with a distinct, type-specific signature
returning X509*, X509_CRL* or EVP_PKEY* -- in a single d2i_of_void*
variable and dispatched through it:

    d2i = (D2I_OF(void))d2i_X509;
    ...
    d2i(pp, &p, len)

Replace the function-pointer dispatch with an enum tag
(pem_info_type) and a switch that calls each typed d2i_* directly
with the correctly type.

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Thu Jun 25 12:12:53 2026
(Merged from https://github.com/openssl/openssl/pull/31523)
2026-06-25 08:12:29 -04:00
Nikola Pajkovsky
b3003ff1ec fix function pointer type mismatch in OCSP_REQUEST/RESPONSE bio macros
d2i_OCSP_REQUEST/d2i_OCSP_RESPONSE are declared with type-specific
signatures returning OCSP_REQUEST*/OCSP_RESPONSE*, but the
d2i_OCSP_{REQUEST,RESPONSE}_bio macros routed them through
ASN1_d2i_bio_of -> ASN1_d2i_bio, which calls them via a
d2i_of_void* pointer:

    void *(*)(void **, const unsigned char **, long)

The analogous i2d_OCSP_{REQUEST,RESPONSE}_bio macros did the same
through ASN1_i2d_bio_of -> ASN1_i2d_bio with i2d_of_void*.

Rewrite the macros to dispatch through
ASN1_item_d2i_bio/ASN1_item_i2d_bio with ASN1_ITEM_rptr(OCSP_*)
directly. This eliminates the function-pointer cast entirely; both old
and new paths bottom out in the same ASN1_item_d2i_ex / ASN1_item_i2d
call, so behavior is identical.

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Thu Jun 25 12:12:50 2026
(Merged from https://github.com/openssl/openssl/pull/31523)
2026-06-25 08:12:29 -04:00
Nikola Pajkovsky
a1e4bd14e5 preserve stack thunks across sk_TYPE_dup
ensure typed stack duplicates keep their compare, copy, and free thunks so
later operations do not call typed callbacks through erased void * function
pointer signatures.

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Thu Jun 25 12:12:48 2026
(Merged from https://github.com/openssl/openssl/pull/31523)
2026-06-25 08:12:29 -04:00
Nikola Pajkovsky
30db55ac33 util: set thunks for sk_${nametype}_new(_reserve)
call OPENSSL_sk_set_thunks for sk_${nametype}_new and
sk_${nametype}_new_reserve, and wrap the long generated stack
constructor and deep-copy macros across multiple lines so the nested
thunk setup is easier to read and maintain.

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Thu Jun 25 12:12:46 2026
(Merged from https://github.com/openssl/openssl/pull/31523)
2026-06-25 08:12:29 -04:00
Bob Beck
c60fddbbcf Drop Windows CE support.
Windows CE has been out of mainstream support since 2018
and will not have a modern toolchain capable of compiling
a modern OpenSSL.

The vc_wince_info Perl helper, the crypto/LPdir_wince.c
directory backend, and a long tail of _WIN32_WCE
 / OPENSSL_SYS_WINCE guards across the Windows code paths
get removed.

Spotted by idrassi.

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 25 07:27:18 2026
(Merged from https://github.com/openssl/openssl/pull/31601)
2026-06-25 09:26:55 +02:00
Jakub Zelenka
bb68815067 apps: cover the pkcs8 -inform/-outform DER options
Only PEM input/output was exercised.  Add a subtest that round trips a
key through DER, for both unencrypted and encrypted PKCS#8.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Thu Jun 25 07:24:30 2026
(Merged from https://github.com/openssl/openssl/pull/31653)
2026-06-25 09:24:26 +02:00
Eugene Syromiatnikov
7d810b0df2 CONTRIBUTING.md: tweak wording with regards to ML tooling usage
ML tools do not satisfy the authorship requirement, so they are merely
used, and not "create" on their own.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
MergeDate: Thu Jun 25 07:22:26 2026
(Merged from https://github.com/openssl/openssl/pull/31643)
2026-06-25 09:22:23 +02:00
Eugene Syromiatnikov
a51f1834c0 crypto/ctype.c: fix off-by-one OOB in ossl_toascii()/ossl_fromascii()
Incorrect check for the upper bound allowed the value of 256 to slip
through, which could lead to OOB read one element beyound the end
of the os_toascii/os_toebcdic arrays.  Fix that by changing
the comparison with 256 from strictly great to great-or-equal.

Found by cppcheck.

Fixes: a1df06b363 "This has been added to avoid the situation where some host ctype.h functions return true for characters > 127.  I.e. they are allowing extended ASCII characters through which then cause problems.  E.g. marking superscript '2' as a number then causes the common (ch - '0') conversion to number to fail miserably.  Likewise letters with diacritical marks can also cause problems."
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
MergeDate: Thu Jun 25 07:19:30 2026
(Merged from https://github.com/openssl/openssl/pull/31661)
2026-06-25 09:19:25 +02:00
Eugene Syromiatnikov
ea7dbd4fee rec_layer_s3.c: prevent max_early_data overflow in ossl_early_data_count_ok()
Apply change similar to the one made in d41a922519 "tls_common.c: prevent
max_early_data overflow in rlayer_early_data_count_ok()"
to ossl_early_data_count_ok(), that has similar logic in it
(as rlayer_early_data_count_ok() has been copied
from ossl_early_data_count_ok() in 9dd90232d5 "Move early data counting
out of the SSL object and into the record layer").

Complements: d41a922519 "tls_common.c: prevent max_early_data overflow in rlayer_early_data_count_ok()"
Fixes: 70ef40a05e "Check max_early_data against the amount of early data we actually receive"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
MergeDate: Thu Jun 25 07:13:07 2026
(Merged from https://github.com/openssl/openssl/pull/31628)
2026-06-25 09:12:50 +02:00
Jakub Zelenka
df3a538aff apps: add error-path test recipe for skeyutl
Cover the help, option-parsing and error paths of the skeyutl command.
The successful -genkey path is not exercised as no built-in provider
implements opaque symmetric key generation yet.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Thu Jun 25 07:10:05 2026
(Merged from https://github.com/openssl/openssl/pull/31648)
2026-06-25 09:09:58 +02:00
Jakub Zelenka
5fb218a35c quic: add mfail tests for QUIC SRTM
This cover various function for SRTM.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 25 07:06:31 2026
(Merged from https://github.com/openssl/openssl/pull/31593)
2026-06-25 09:06:27 +02:00
Dmitry Misharov
93a2b9be5e remove make-release.yml, it will be executed on OpenSSL Jenkins instance
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Thu Jun 25 07:04:01 2026
(Merged from https://github.com/openssl/openssl/pull/31674)
2026-06-25 09:03:57 +02:00
Daniel Kubec
fc972e592e AEAD: reject late AAD in ChaCha20-Poly1305 after plaintext update
Align behavior with AES GCM, which already rejects this misuse with a hard
error, by tracking whether plaintext processing has started and returning an
error if AAD is supplied afterwards.

Fixes #31188

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Thu Jun 25 07:01:44 2026
(Merged from https://github.com/openssl/openssl/pull/31673)
2026-06-25 09:01:39 +02:00
Nikola Pajkovsky
d681e8b6bf crypto/armcap.c: reformat MIDR CPU-model conditionals for readability
break long chain of MIDR_IS_CPU_MODEL() alternatives packed onto a
single line, which was effectively unreadable and impossible to review
or diff one model at a time.

move the OPENSSL_armcap_P feature-flag test to the front of the
expression so the guard is obvious before the model list. This is a
formatting-only change.

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

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Thu Jun 25 06:10:45 2026
(Merged from https://github.com/openssl/openssl/pull/31664)
2026-06-25 08:10:38 +02:00
Jakub Zelenka
26516294b5 apps: cover the ec -conv_form option in the test recipe
The -conv_form option was not covered.  Add a subtest that checks a
valid form changes the public key encoding and that an invalid form
is rejected.  The DER encodings are also compared against committed
reference files, as they are deterministic for testec-p256.pem.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 25 06:08:38 2026
(Merged from https://github.com/openssl/openssl/pull/31652)
2026-06-25 08:08:32 +02:00
Viktor Dukhovni
2fabd5d274 Once initialised, ML-DSA keys should be immutable
ML-DSA keys should become immutable once key material has been added.
This is already the case for at least ML-KEM keys, and should generally
be the case across all key types.

- Added the requisite check in the key management provider ml_dsa_import()
  function.
- Also, consolidated the ML-KEM checks in ml_kem_import().  These were
  previously partly in ml_kem_key_fromdata().

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Jun 25 02:03:35 2026
(Merged from https://github.com/openssl/openssl/pull/30421)
2026-06-25 12:03:26 +10:00
Kirill Ermoshin
8d7bec32e6 Remove aliases for IANA-GOST2012-GOST8912-GOST8912
"gost2012_256/512" sigalgs aliases of IANA-GOST2012-GOST8912-GOST8912 equals
to sigalgs of LEAGACY-GOST2012-GOST8912-GOST8912 so we can't distinguish
between them for the legacy algorithm

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jun 24 15:07:04 2026
(Merged from https://github.com/openssl/openssl/pull/31562)
2026-06-24 17:06:49 +02:00
Kirill Ermoshin
3e4955cce9 Fix typo of 512 gost sigalg name from bcff020
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jun 24 15:07:02 2026
(Merged from https://github.com/openssl/openssl/pull/31562)
2026-06-24 17:06:49 +02:00
Eugene Syromiatnikov
029d629db2 include/internal/hashtable.h: avoid OOB read in ossl_ht_strcase()
Avoid accessing src[len] by swapping the check order and bound check
the iterator variable before the access.

Found by cppcheck.

Fixes: cc4ea5e000 "Introduce new internal hashtable implementation"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Jun 24 13:09:25 2026
(Merged from https://github.com/openssl/openssl/pull/31663)
2026-06-24 15:09:20 +02:00
Tomas Mraz
c80ce10841 Always ignore the contents of the legacy record version
As per RFC8446 this value must be ignored.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
MergeDate: Wed Jun 24 13:06:55 2026
(Merged from https://github.com/openssl/openssl/pull/31662)
2026-06-24 15:06:43 +02:00
Bob Beck
1a65972ad0 Add documentation for NAME_CONSTRAINTS_check
We document which names and name constraints will be evaluated
as well as the limits that will be placed on the evauluation on
a per certificate basis.

We call out in the BUGS section that the RFC 5280 requires a byte
per byte match of name constraints unless the higher level protocol
has defines a different matching method for wildcards. This
"deferall of specification" and corresponding lack of specification
by upper level protocols means that across implementations encountering
the default behaviour is to be expected, and that therefore relying
on excluded names to constrain signers in a PKI from signing wildcards
is ill advised.

This is then cross referenced in the documentation for X509_verify_cert
and the maximum possible comparisons which can be forces in a certificate
validtion noted in the BUGS section of X509_verify_cert.

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Jun 24 13:03:54 2026
(Merged from https://github.com/openssl/openssl/pull/31334)
2026-06-24 15:03:52 +02:00
Mounir IDRASSI
54aef373f3 Reject HelloRequest in TLS 1.3
TLS 1.3 reserves handshake message type 0 and must not silently
ignore HelloRequest records. The legacy client-side HelloRequest skip
path in tls_get_message_header() could run before the TLS 1.3 state
machine had a chance to reject the message, so a zero-length
HelloRequest injected after ClientHello was discarded instead of
triggering unexpected_message.

Restrict the skip to cases where TLS 1.3 is no longer possible.
Before ServerHello selects a version, s->version is the configured
maximum; after ServerHello or during renegotiation, it is the
negotiated version. Skip only when that value is below TLS 1.3,
preserving the existing TLS 1.2-and-below behavior.

Add TLSProxy regression tests covering rejection while TLS 1.3 is
possible and the preserved TLS 1.2 skip after ServerHello.

Fixes #31531

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jun 24 13:01:12 2026
(Merged from https://github.com/openssl/openssl/pull/31577)
2026-06-24 15:01:06 +02:00
Bernd Edlinger
25b37961f7 Prevent integer overflow in ASN1_mbstring_ncopy
This prevents a theoretically possible integer overflow
in OPENSSL_malloc(outlen + 1) at the end of ASN1_mbstring_ncopy,
when outlen is exactly INT_MAX.
That affects conversions from MBSTRING_ASC to MBSTRING_UTF8
and MBSTRING_UTF8 to MBSTRING_ASC,
because a terminating zero has to be added to the result.
And also conversions MBSTRING_BMP to MBSTRING_UTF8
in cases when UTF8 characters 0x800..0xFFFF are encoded
as 3-byte UTF8-characters and the resulting UTF8-string
is exactly INT_MAX in size.

Fixes: 97f6b621f7 ("Reject oversized inputs in ASN1_mbstring_ncopy()")

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jun 24 12:49:08 2026
(Merged from https://github.com/openssl/openssl/pull/31527)
2026-06-24 14:49:06 +02:00
Billy Brumley
a933605a62 [test] various zero-length message positive and negative tests for AEAD ciphers
A zero-length AEAD message driven through the one-shot EVP_Cipher() interface
must agree with the streaming EVP_CipherFinal_ex() path. This checks:
- an empty message yields the same tag via both interfaces
- the true tag passes verification on decrypt
- the modified tag fails verification on decrypt

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Jun 24 12:47:11 2026
(Merged from https://github.com/openssl/openssl/pull/31555)
2026-06-24 14:47:06 +02:00
Alicja Kario
1cfec91eb6 test/evp_extra_test.c: add test case for CVE-2026-42770
Signed-off-by: Alicja Kario <hkario@redhat.com>

Reviewed-by: Igor Ustinov <igus@openssl.foundation>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Wed Jun 24 11:56:27 2026
(Merged from https://github.com/openssl/openssl/pull/31548)
2026-06-24 13:43:14 +02:00
dannyward630
773400d366 crypto/ec/curve448/eddsa.c: document Ed448 property query parameter
Document the propq argument in the Ed448 key generation, signing,
and verification helper comments.

CLA: trivial

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jun 24 11:00:00 2026
(Merged from https://github.com/openssl/openssl/pull/31599)
2026-06-24 12:59:40 +02:00
Mounir IDRASSI
b44fd71741 pkcs7: Fix negative index handling in PKCS7_get_issuer_and_serial()
Reject negative indices before looking up the recipient info stack
entry.  This makes negative out-of-range indices match the existing
behavior for too-large positive indices and avoids dereferencing
a NULL recipient info.

Add a regression test for the negative index case.

Resolves: https://github.com/openssl/openssl/issues/30910

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
MergeDate: Wed Jun 24 09:10:22 2026
(Merged from https://github.com/openssl/openssl/pull/30914)
2026-06-24 11:09:49 +02:00
Randall S. Becker
77c979faf4 Fix unqualified reference to openssl in 25-test_verify_store.t
This problem resulted in the wrong location of openssl being used
for one step in subtest 7.  The error condition is hidden if openssl
appears in the PATH.

Resolves: https://github.com/openssl/openssl/issues/31496
Fixes: 3638ffc380 "Refactor cache_objects() loop and object type handling"
Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Wed Jun 24 08:47:58 2026
(Merged from https://github.com/openssl/openssl/pull/31647)
2026-06-24 10:46:31 +02:00
Haiyang Huang
24137d12a2 quic: reject ACK of an unsent packet number
ossl_ackm_on_rx_ack_frame() stored ack_ranges[0].end into
largest_acked_pkt[pkt_space] without checking it against the highest
packet number actually sent in that space. Because largest_acked_pkt
only ever increases and drives loss detection, an ACK acknowledging a
packet number that was never sent (up to 2**62 - 1) pins the value and
causes every in-flight and subsequently-sent packet to be declared lost,
permanently corrupting loss detection for the connection.

RFC 9000 s. 13.1 recommends treating an acknowledgment for a packet the
endpoint did not send as a connection error of type PROTOCOL_VIOLATION,
where it can be detected.

Reject any ACK whose largest acknowledged packet number exceeds the
highest packet number sent in that space; the bound, highest_sent, is
already tracked. The depacketiser raises PROTOCOL_VIOLATION when the ACK
manager rejects the frame.

Update the QUIC tests for the new behaviour: cases 7 and 8 now assert
rejection, case 14 covers the 2**62 - 1 boundary, two pre-existing
fixtures that acknowledged one packet past the highest sent are
corrected, and the "fictional PN" script now expects a PROTOCOL_VIOLATION
close.

Fixes: fa4e92a70a "QUIC ACK Manager, Statistics Manager and Congestion Control API"
Assisted-by: Claude:claude-opus-4.6

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Tue Jun 23 16:36:27 2026
(Merged from https://github.com/openssl/openssl/pull/31582)
2026-06-23 18:36:04 +02:00
Carlo Deutschmann
a226dc3520 Avoid NULL dereference if RSA_PSS_PARAMS_dup() fails in ossl_rsa_dup()
RSA_PSS_PARAMS_dup() can return NULL on failure (e.g. memory
allocation failure). The subsequent code dereferenced dupkey->pss
unconditionally when checking dupkey->pss->maskGenAlgorithm, which
would result in a NULL pointer dereference.

Check the return value and jump to the error handling instead, which
properly frees the partially constructed key.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Tue Jun 23 16:32:24 2026
(Merged from https://github.com/openssl/openssl/pull/31619)
2026-06-23 18:32:17 +02:00
Eugene Syromiatnikov
67bddd0f33 apps/lib/s_cb.c: actualise signature_tls13_scheme_list
Update signature_tls13_scheme_list array in accordance with the current
state of the "TLS SignatureScheme" table at [1];  leave TLS 1.2 GOST
definitions be for now.

Note: these are used only for debugging output when -security_debug
option is provided to s_client/s_server commands.

[1] https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-signaturescheme

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Jun 23 16:30:02 2026
(Merged from https://github.com/openssl/openssl/pull/31248)
2026-06-23 18:29:44 +02:00
Eugene Syromiatnikov
4a08aa1346 Add TLS 1.3 SignatureScheme definitions for SLH-DSA
In accordance with [1].

[1] https://datatracker.ietf.org/doc/html/draft-reddy-tls-slhdsa-02

Resolves: https://github.com/openssl/project/issues/1945
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Jun 23 16:30:01 2026
(Merged from https://github.com/openssl/openssl/pull/31248)
2026-06-23 18:29:43 +02:00
Eugene Syromiatnikov
31274b3d30 ssl/t1_trce.c: use macros from tlssigalgs.h, reorder accordingly
The macro definitions for the SignatureScheme values and names
are available "include/internal/tlssigalgs.h" (contrary to what comment
says), use them and also order the items in the order they are present
in the header file.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Jun 23 16:29:59 2026
(Merged from https://github.com/openssl/openssl/pull/31248)
2026-06-23 18:29:43 +02:00
007bsd
8d0f837db8 Fix key2ms_newctx() pointer type mismatch in MSBLOB/PVK key encoder
key2ms_newctx() returned struct key2ms_ctx_st *, but is registered
as OSSL_FUNC_ENCODER_NEWCTX and called through OSSL_FUNC_encoder_newctx_fn
(void *(*)(void *)), which is a case of undefined behavior, flagged
by -fsanitize=function.  Same class as [1], missed there.

Give it the correct signature and add the self-check forward
declaration, as key2ms_freectx() already has.

[1] https://github.com/openssl/openssl/pull/31078

CLA: trivial
Fixes: 0cc0164d19 "PROV: Add MSBLOB and PVK encoders"

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Jun 23 14:45:54 2026
(Merged from https://github.com/openssl/openssl/pull/31189)
2026-06-23 16:43:49 +02:00
Jakub Zelenka
8ccf576564 quic: add mfail test for QUIC SRT generator
This slightly improves its coverage.

Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Tue Jun 23 14:01:21 2026
(Merged from https://github.com/openssl/openssl/pull/31589)
2026-06-23 16:01:15 +02:00
Jakub Zelenka
43ce59231e Add mfail test for SSL_new() with ctx QUIC client method
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Tue Jun 23 13:16:52 2026
(Merged from https://github.com/openssl/openssl/pull/31249)
2026-06-23 15:16:45 +02:00
Alexandr Nedvedicky
7045b8fde5 This change should allow us to move QUIC test scripts from
quic_multistream test to radix without dealing with conflict+rebase.

the idea is there will be one PR for each script, so more people
will be able to submit those PRs without rsiking a conflicts around
the scripts array. This should allow for smoot reciew/git push
flow.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jun 23 12:21:25 2026
(Merged from https://github.com/openssl/openssl/pull/31547)
2026-06-23 08:21:23 -04:00
Frederik Wedel-Heinen
60a174cd6c ssl/record: remove remnants of SSLv2-specific code
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Jun 23 07:09:07 2026
(Merged from https://github.com/openssl/openssl/pull/31627)
2026-06-23 09:08:35 +02:00
Bob Beck
bf41baa2bf doc/man3/ASN1_aux_cb.pod: correct return code documentation for the callbacks
Attempt to make the documentation match the code.

Not attempting to change what the code does at this point, it's
all very random, and since it's been there, it is effectively established
public API now.

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Jun 22 11:56:58 2026
(Merged from https://github.com/openssl/openssl/pull/31549)
2026-06-22 13:54:39 +02:00
Jon Ericson
f23329efa0 CONTRIBUTING.md: add the AI declaration policy
References: https://github.com/openssl/general-policies/pull/85

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Jun 22 10:36:52 2026
(Merged from https://github.com/openssl/openssl/pull/31604)
2026-06-22 12:35:38 +02:00
Abel Tom
206ec55fec crypto/pkcs7/pk7_lib.c: fix return value in PKCS7_set_digest()
Return 0 when the passed object to PKCS7_set_digest() is not of type PKCS7
digest.

Fixes: c5a5546389 "Add support for digested data PKCS#7 type."
Resolves: https://github.com/openssl/openssl/issues/31551

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
MergeDate: Mon Jun 22 08:17:32 2026
(Merged from https://github.com/openssl/openssl/pull/31559)
2026-06-22 10:16:13 +02:00
Bob Beck
b593fb151e Fix OSSL_ATOMICS_LOCKLESS detection for Windows toolchains
The check referenced USE_INTERLOCKEDOR64, but the macro defined above
for MSVC (with the right architecture/version) and 64-bit MinGW is
OSSL_USE_INTERLOCKEDOR64.  As a result, OSSL_ATOMICS_LOCKLESS was
never defined on Windows, even though those toolchains do provide
lockless atomics.

Reported-by: Mounir IDRASSI <mounir.idrassi@idrix.fr>
Fixes: 26c5742393 "Use the actually correct define for solaris and gcc"

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Jun 22 07:22:31 2026
(Merged from https://github.com/openssl/openssl/pull/31600)
2026-06-22 09:14:04 +02:00
Abel Tom
d41a922519 tls_common.c: prevent max_early_data overflow in rlayer_early_data_count_ok()
Make the local max_early_data variable uint64_t so an overflow
cannot occur if the max_early_data field in the record layer struct
has the maximum value: UNT32_MAX (0xFFFFFFFF).

Resolves: https://github.com/openssl/openssl/issues/31533

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
MergeDate: Sun Jun 21 23:50:02 2026
(Merged from https://github.com/openssl/openssl/pull/31538)
2026-06-22 01:48:56 +02:00
Nikola Pajkovsky
39f46844c6 asn1: centralize aux const-callback dispatch to avoid function pointer cast
Replace the per-call-site `(ASN1_aux_const_cb *)aux->asn1_cb` cast in
ASN1_item_ex_i2d() and asn1_item_print_ctx() with a shared helper,
ossl_asn1_aux_const_cb(), which invokes the legacy non-const callback
through its real type. This avoids the UBSAN function-pointer-type
mismatch while preserving backward compatibility.

Fixes: https://github.com/openssl/project/issues/1970
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sun Jun 21 23:38:12 2026
(Merged from https://github.com/openssl/openssl/pull/31541)
2026-06-22 01:37:13 +02:00
Carlo Deutschmann
7a5476687e Fix spelling mistakes in documentation
Correct a number of typos found in the man pages:
 * doc/man3/SSL_CTX_set1_curves.pod:        attenion   -> attention
 * doc/man3/CMS_EncryptedData_decrypt.pod:  decypted   -> decrypted
 * doc/man3/X509_get_default_cert_file.pod: delimeter  -> delimiter
 * doc/man3/SSL_CTX_set_msg_callback.pod:   diagostic  -> diagnostic
 * doc/man7/openssl-core_dispatch.h.pod:    dipatch    -> dispatch
 * doc/man3/BIO_s_datagram.pod:             hecause    -> because
 * doc/man3/ASN1_aux_cb.pod:                auxiliarly -> auxiliary

CLA: trivial
Fixes: 3d9d1ce529 "Add documentation for newly added ASN1 functions"
Fixes: 408622b73a "BIO_s_dgram: add documentation and hazard warnings"
Fixes: e2f6960fc5 "CMS: Export CMS_EnvelopedData and add CMS_EnvelopedData_decrypt()"
Fixes: 9efd7e9e98 "Fix group tuple handling in DEFAULT expansion"
Fixes: bfcf1356f9 "Update the msg_callback documentation"
Fixes: 606e0426a1 "Add support for loading root CAs from Windows crypto API"
Fixes: 329b2a2cde "DOCS: add openssl-core_numbers.h(7)"

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sun Jun 21 22:50:14 2026
(Merged from https://github.com/openssl/openssl/pull/31596)
2026-06-22 00:47:34 +02:00
Shmael13
b298b44466 demos/http3: fix missing NUL terminator on h3ssl->url
In the HTTP/3 demo server's :path handler, when the path value does not
begin with '/', the value is copied into the fixed-size url[MAXURL]
buffer with memcpy(h3ssl->url, vvalue.base, len) and no terminator is
written. len is capped at MAXURL, so a :path value of MAXURL or more
bytes fills the entire buffer, overwriting the zeroes from the preceding
memset and leaving url without a NUL terminator. The buffer is later
used as a C string by strcat() and strcmp() when building the file name,
resulting in a heap out-of-bounds read and a possible overflow of the
filename[PATH_MAX] buffer. This is reachable from a client-supplied
:path header.

Cap the length at MAXURL - 1 so that the trailing byte zeroed by the
memset always remains, guaranteeing url is NUL-terminated in every
branch. The '/'-prefixed branches are unaffected as they already write
an explicit terminator within the smaller bound.

Fixes #31516

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sun Jun 21 16:19:08 2026
(Merged from https://github.com/openssl/openssl/pull/31520)
2026-06-21 12:19:00 -04:00
Jakub Zelenka
bb3d8b9c52 apps: test pkeyutl -derive peer key setup
This tests currently uncovered setup_peer function and some failure
scenarios in it.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sun Jun 21 16:04:59 2026
(Merged from https://github.com/openssl/openssl/pull/31518)
2026-06-21 12:04:53 -04:00
sunnyqeen
66c36af077 Fix unix Makefile template to avoid command line too long error on windows
On cygwin/msys systems that run on Windows, command line length is limited. using response file instead of putting objects on the command line will avoid this error

CLA: trivial

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sun Jun 21 15:56:08 2026
(Merged from https://github.com/openssl/openssl/pull/23077)
2026-06-21 11:55:57 -04:00
Ingo Franzki
1a1d088d2a s390x: Don't ignore errors from s390x_mod_exp_hw() and s390x_crt()
Currently errors from s390x_mod_exp_hw() and s390x_crt() are silently
ignored and the software path is used as fallback.

Change this to only take the software path if s390x_mod_exp_hw() and
s390x_crt() returns 0 to indicate that it does not support the RSA
acceleration. In case of errors, return them to the caller. Errors could
be memory allocation failures or errors during BIGNUM calls. Those should
not be ignored, but reported as failure.

Note that it can happen that the ioctl's fail, but this is not to be
reported as error. Those are situations where for example no suitable
crypto adapter is available, or the file descriptor has been closed
by a sandbox. Those situations disable the RSA acceleration for further
RSA requests, but the current operation should still be performed via the
software fallback. For cases where the RSA key size is too large for
acceleration, the operation must also be performed via the software
fallback, and not reported as an error.

This also fixes failures of the test_rsa_pkcs1_mfail test case that found
the memory allocation failures that got ignored.

Resolves: https://github.com/openssl/openssl/issues/31480
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sun Jun 21 14:19:54 2026
(Merged from https://github.com/openssl/openssl/pull/31482)
2026-06-21 16:19:38 +02:00
Ingo Franzki
036db3a8ef s390x: Don't ignore errors from s390x_HMAC_init()
Currently errors from s390x_HMAC_init() are silently ignored and the software
path is used as fallback.

Change this to only take the software path if s390x_HMAC_init() returns -1
to indicate that it does not support the HMAC acceleration. In case of
errors, return them to the caller. Errors could be memory allocation
failures or errors during digest operations. Those should not be ignored,
but reported as failure.

This also fixes failures of the test_rsa_pkcs1_mfail test case that found
the memory allocation failures that got ignored.

References: https://github.com/openssl/openssl/issues/31480
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sun Jun 21 14:19:53 2026
(Merged from https://github.com/openssl/openssl/pull/31482)
2026-06-21 16:19:12 +02:00
Loganaden Velvindron
4d9e2a5797 ssl/quic/quic_ackm.c: fix use after free for apkt in ackm_on_pkts_acked()
Store in_flight flag in a local variable for later use, as apkt->on_acked()
may free apkt.

Fixes: 427a02ad0a "QUIC ACKM: Don't record non-inflight packets in CC"
Signed-off-by: Loganaden Velvindron <logan@cyberstorm.mu>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Sun Jun 21 13:55:08 2026
(Merged from https://github.com/openssl/openssl/pull/31447)
2026-06-21 15:55:04 +02:00
Tomas Mraz
1eaf29ef6c Remove direct includes of windows.h where possible
It should be included via e_os.h instead.

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sat Jun 20 11:00:42 2026
(Merged from https://github.com/openssl/openssl/pull/31587)
2026-06-20 07:00:32 -04:00
Jakub Zelenka
695fef3ec3 pkcs11-provider: enable tls test
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Simo Sorce <simo@redhat.com>
MergeDate: Thu Jun 18 18:02:35 2026
(Merged from https://github.com/openssl/openssl/pull/31568)
2026-06-18 14:02:13 -04:00
Jakub Zelenka
9d476175d7 property: do not overwrite the NULL-provider cache entry on set
ossl_method_store_cache_set inserts two entries per method: one keyed
on (nid, prop_query, prov) and one keyed on (nid, prop_query) with a
NULL provider, used to match "any provider" lookups.

Previously the set path always replaced the NULL-provider entry. When a
second provider cached the same nid, its method became the result for
"any provider" lookups, even though an earlier provider was already
cached. A shared nid could then resolve to the wrong provider: a
certificate's SPKI would decode through that provider's keymgmt and
X509_check_private_key would fail with a key value mismatch.

Only insert the NULL-provider entry when one does not already exist, so
the first provider to cache the nid owns it, matching the order
ossl_method_store_fetch would select.

Assisted-by: Claude:claude-opus-4-8

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Simo Sorce <simo@redhat.com>
MergeDate: Thu Jun 18 18:02:32 2026
(Merged from https://github.com/openssl/openssl/pull/31568)
2026-06-18 14:02:13 -04:00
Neil Horman
3989ab04c6 fix type casting in ossl_cmp_mock_srv_set1 functions
newer versions of clang trigger ubsan warnings on the following
functions:
ossl_cmp_mock_srv_set1_refCert
ossl_cmp_mock_srv_set1_chainOut
ossl_cmp_mock_srv_set1_certOut
ossl_cmp_mock_srv_set1_newWithNew
ossl_cmp_mock_srv_set1_newWithOld
ossl_cmp_mock_srv_set1_oldWithNew
ossl_cmp_mock_srv_set1_caPubsOut

Due to the fact that the respective function prototypes don't match the
callback function pointer prototypes (the former use concrete strucuture
types while the latter uses a void pointer).

Fix it by bifurcating setup_cert[s] (the call-in fuctions) to have
variants that accept the expected type and corresponding callback
signature so that the above functions can be used without thunking

Fixes openssl/project#1969

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 18 14:03:41 2026
(Merged from https://github.com/openssl/openssl/pull/31526)
2026-06-18 10:03:37 -04:00
Andrew Dinh
711cde149e Remove duplicate TLS_MD_SERVER_WRITE_KEY_CONST macro defines
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Thu Jun 18 13:16:38 2026
(Merged from https://github.com/openssl/openssl/pull/31515)
2026-06-18 15:16:33 +02:00
Eugene Syromiatnikov
eae29e3bc0 CHANGES.md, NEWS.md: update for 4.0.1
4.0.1 CHANGES.md includes the following:
 * CVE-2026-7383, CVE-2026-9076, CVE-2026-34180, CVE-2026-34181,
   CVE-2026-34182, CVE-2026-34183, CVE-2026-35188, CVE-2026-42764,
   CVE-2026-42765, CVE-2026-42766, CVE-2026-42767, CVE-2026-42768,
   CVE-2026-42769, CVE-2026-42770, CVE-2026-42771, CVE-2026-45445,
   CVE-2026-45446, CVE-2026-45447
 * https://github.com/openssl/openssl/pull/30626
   "TLSv1.3: Fix server not sending NewSessionTicket after ciphersuite mismatch"
 * https://github.com/openssl/openssl/pull/30904
   "pkey(1) missing setup for interactive pass prompt"
 * https://github.com/openssl/openssl/pull/31058
   "Validate that a PSK identity is at least one byte long"
 * https://github.com/openssl/openssl/pull/31146
   "ktls: Fix invalid memory access on retry with moving write buffer"
 * https://github.com/openssl/openssl/pull/31413
   "apps/s_client.c: read one byte less to avoid triggerring overflow
   protection"

4.0.1 NEWS.md includes the following:
 * CVE-2026-7383, CVE-2026-9076, CVE-2026-34180, CVE-2026-34181,
   CVE-2026-34182, CVE-2026-34183, CVE-2026-35188, CVE-2026-42764,
   CVE-2026-42765, CVE-2026-42766, CVE-2026-42767, CVE-2026-42768,
   CVE-2026-42769, CVE-2026-42770, CVE-2026-42771, CVE-2026-45445,
   CVE-2026-45446, CVE-2026-45447
 * https://github.com/openssl/openssl/pull/30904
   "pkey(1) missing setup for interactive pass prompt"
 * https://github.com/openssl/openssl/pull/31413
   "apps/s_client.c: read one byte less to avoid triggerring overflow
   protection"

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 18 13:13:58 2026
(Merged from https://github.com/openssl/openssl/pull/31509)
2026-06-18 15:13:12 +02:00
Matt Caswell
75f59968b8 Fix intermittent failure in check_pc_flood radix test
check_flood_stats read the path challenge/response counters immediately
after the client's write returned, but the flood is delivered over a
real socket and processed by the connection's assist thread
asynchronously. Spin until the counters reach their expected values,
the same way check_rejected already does, instead of failing on the
first observation.

Observed failure:
https://github.com/openssl/openssl/actions/runs/27669771673/job/81831310551?pr=31538

Assisted-by: Claude:claude-sonnet-4-6

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Thu Jun 18 13:07:27 2026
(Merged from https://github.com/openssl/openssl/pull/31561)
2026-06-18 15:07:16 +02:00
Eugene Syromiatnikov
7bc76aea25 doc/man3/EVP_PKEY_get_size.pod: add man for the security categories table
Commit 73188a01bd "doc: document EVP_PKEY_get_security_category function"
has added security level definitions as a table, that has been implemented
raw via "=begin" POD directives;  while the formatting for "html"
and "text" (that is not even generated by the build system)
has been provided, "man" (arguably, the most relevant one)
has been omitted, surprisingly.  Rescind that omission by providing
the respective table formatting for man.

Complements: 73188a01bd "doc: document EVP_PKEY_get_security_category function"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Thu Jun 18 12:35:47 2026
(Merged from https://github.com/openssl/openssl/pull/31410)
2026-06-18 14:35:42 +02:00
Jakub Zelenka
30619a98f9 Add indirect CRL path validation tests
This covers currently uncovered check_crl_path and check_crl_chain
in x509_vfy.c. The mfail test tests the happy path and all memory
failures in it. In addition 3 error scenarios are tested.

Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 18 12:31:56 2026
(Merged from https://github.com/openssl/openssl/pull/31244)
2026-06-18 14:31:44 +02:00
Abel Tom
5a85e4152d Enforce RFC 8446 ticket lifetime limit for TLS 1.3 client
Add client-side validation to check if session ticket lifetime
hints exceeds 7 days in TLS1.3 connections and caps it to the
maximum value of 7 days(604800 seconds).

Modified `CHANGES.md` with the description of updated change.

Resolves: #30808

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 18 12:25:33 2026
(Merged from https://github.com/openssl/openssl/pull/31174)
2026-06-18 14:25:09 +02:00
zhoulu
a81b4d920b Further improve the decryption performance of AES-128-CBC on the RISC-V architecture
The decryption performance of AES-128-CBC is improved by 6% to 15%, with the main optimizations as follows:
1.The block processing mode is adjusted to single-block loop + 4-block loop + 8-block loop.
2.The backup of ciphertext using vmv_v_v for XOR operations is replaced with reloading using vle32_v.
3.Key loading and decryption computation are interleaved in a loop.

Hardware simulation environment verification data:
| Decrypt Test |  Baseline   | Optimized  | Improvement ratio |
| ------------ | --------------- | ------------- | ----------------- |
| 16 bytes     | 14357.22k       | 15271.90k     | 6%                |
| 64 bytes     | 29176.38k       | 33592.29k     | 15%               |
| 256 bytes    | 38664.19k       | 42968.09k     | 11%               |
| 1024 bytes   | 40308.09k       | 43875.04k     | 9%                |
| 8192 bytes   | 42811.39k       | 46032.08k     | 8%                |
| 16384 bytes  | 42809.28k       | 46110.04k     | 8%                |

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 18 12:22:19 2026
(Merged from https://github.com/openssl/openssl/pull/31116)
2026-06-18 14:21:37 +02:00
Eugene Syromiatnikov
1199f3bacf .github/workflows/run-checker-daily.yml: remove no-atexit configuration check
The configuration option has no effect.  Remove it from the test matrix.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jun 18 12:20:37 2026
(Merged from https://github.com/openssl/openssl/pull/30767)
2026-06-18 14:20:26 +02:00
Eugene Syromiatnikov
bd6bb9d3f7 Configurations/50-nonstop.conf: remove 'atexit' from disable maps
Since there is no atexit() handler installation after [1],
the associated configuratoin option (that was initially introduced
to support the configurations in question[2]) has no effect
and can be removed from NonStop configurations.

[1] https://github.com/openssl/openssl/pull/29385
[2] 99fb31c167 "Add atexit configuration option to using atexit() in libcrypto at build-time."

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jun 18 12:20:36 2026
(Merged from https://github.com/openssl/openssl/pull/30767)
2026-06-18 14:20:26 +02:00
Eugene Syromiatnikov
478e78829a Configure, INSTALL.md: make atexit deprecated disablable
As the atexit handler was removed in [1], no-atexit configuration option
has no effect, make that explicit by disallowing enabling atexit, and
update the documentation accordingly.

[1] https://github.com/openssl/openssl/pull/29385

References: https://github.com/openssl/openssl/issues/30742

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jun 18 12:20:34 2026
(Merged from https://github.com/openssl/openssl/pull/30767)
2026-06-18 14:20:26 +02:00
Eugene Syromiatnikov
5cdfaabe10 .github/workflows/backport.yml: show diff on cherry-pick failure
Having the diff available right away in the CI run logs aids evaluation
of severity of the merge conflicts.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jun 18 12:17:42 2026
(Merged from https://github.com/openssl/openssl/pull/31506)
2026-06-18 14:17:16 +02:00
Dimitri John Ledkov
f2e41a24f6 fips: Bring back FIPS_mode() as a define
Old OpenSSL had a FIPS_mode() function. AWS-LC-FIPS and BoringSSL-FIPS
still have the FIPS_mode() API. RHEL-derived systems also still provide
FIPS_mode() as a define in up-to-date OpenSSL. And feedback from
multiple large commercial software vendors is that there is a lot of
code out there that still has FIPS_mode() sprinkled all over the place.

Add `FIPS_mode()` as a convenience define to
`EVP_default_properties_is_fips_enabled(NULL)` which is a short-hand
to check if `fips=yes` property is currently enabled on the default
library context.

It is a hint of intent, but not a proof. If you are looking to
validate whether the default configuration is using a validated module,
many additional checks are needed; please consult the security policy
of the module you are using. We heavily discourage using this macro.

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu Jun 18 11:58:15 2026
(Merged from https://github.com/openssl/openssl/pull/30339)
2026-06-18 07:58:10 -04:00
Viktor Dukhovni
6a95dcf9aa Clear unused seed when expanded key is chosen
The transient "seedbuf" value should not persist in keys that that are
loaded from the "expanded" form when "prefer_seed = no".

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Thu Jun 18 08:02:39 2026
(Merged from https://github.com/openssl/openssl/pull/31252)
2026-06-18 18:02:15 +10:00
Viktor Dukhovni
4749c84433 LMS, DH: harden empty fromdata
EVP_PKEY_fromdata for the LMS keymgmt accepted an OSSL_PARAM[] that
omits OSSL_PKEY_PARAM_PUB_KEY, returning success with an LMS_KEY
whose lms_params and ots_params remain NULL.  Without even basic
algorithm parameters (derived from the key content) the key is
malformed.

EVP_PKEY_fromdata for DH/DHX accepts an empty array and yields a
DH with NULL params.p / params.g.  Several DH check entry points
(DH_check, DH_check_params, DH_check_pub_key) then read
dh->params.p / .g via BN_num_bits or BN_is_odd before any NULL
check.  Add defensive guards at the top of each that report
failure via *ret without dereferencing NULL; the existing
return-1-with-flags contract is preserved.

A new test_fromdata in endecode_test drives every supported
keymgmt with an empty OSSL_PARAM[] for both EVP_PKEY_PUBLIC_KEY
and EVP_PKEY_KEYPAIR selections, and tests that any returned key
is sufficiently well behaved.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Thu Jun 18 08:02:33 2026
(Merged from https://github.com/openssl/openssl/pull/31252)
2026-06-18 18:02:15 +10:00
Viktor Dukhovni
796fbbfe40 Fix EVP_PKEY_dup() for ML-KEM keys
ossl_ml_kem_key_dup() left the (PUB|PRIV) selection case
unhandled, so EVP_PKEY_dup() silently returned NULL for
ML-KEM-512/768/1024.  add_storage() also zeroed the duplicated
rho_pkhash, leaving the dup unequal to the original.

Add a parameterised dup sweep to test/endecode_test.c covering
every supported public-key algorithm in three shapes: full
keypair, public-only, and embryonic (parameters-only).

While here, stop endecode_test from silently passing when key
generation fails: setup_tests() now returns its accumulated
status, MAKE_*KEYS no longer short-circuits, and each
ADD_TEST_SUITE is now conditional on keygen success.  Guard the
explicit-EC-curve tests with OPENSSL_NO_EC_EXPLICIT_CURVES.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Thu Jun 18 08:02:28 2026
(Merged from https://github.com/openssl/openssl/pull/31252)
2026-06-18 18:02:15 +10:00
Alexandr Nedvedicky
a0244db469 Add OpenBSD runner
https://github.com/vmactions/openbsd-vm

currently only amd64 is supported. it's useful
to test regressions of .rodata sections in
perlasm files.

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Wed Jun 17 16:27:10 2026
(Merged from https://github.com/openssl/openssl/pull/28735)
2026-06-17 18:27:07 +02:00
Mounir IDRASSI
6ecdedbc65 Fix s_client Sieve STARTTLS response parsing
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Jun 17 16:22:20 2026
(Merged from https://github.com/openssl/openssl/pull/31468)
2026-06-17 18:22:12 +02:00
Neil Horman
43e1e98a26 restore "oldest wins" behavior in method store
We expressly define EVP_*fetch apis as not guaranteeing which provider
and algorithm is sourced from.  However, its likely that some users have
some inadvertent reliance on getting the same provider for a non
provider specific (and non property specific) fetch.  While thats
generally bad practice (since we don't guarantee it), its particularly
hard to provide that behavior in the new cache infrastructure, so lets
save everyone some trouble by not changing that behavior needlessly.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jun 17 14:38:43 2026
(Merged from https://github.com/openssl/openssl/pull/31487)
2026-06-17 16:38:37 +02:00
Neil Horman
1a564e530b make ossl_method_store use cmp_exch_ptr when cleaning archive
from the conversation here:
https://github.com/openssl/openssl/pull/31018#discussion_r3386832056

@mattcaswell noted that while cleaning QUERY items and moving them to
the archive list, we do an atomic load of a QUERY's next pointer to
another shared query's next pointer.  While its not been observed, it
may be possible for the clean operation to move an element to the
archive while a concurrent thread is prepending to the list, the result
being that the active (cache_list) list has a head pointer whos next
pointer points into the archive list.

The result of this would be subsequent lookups fail to find anything not
archived in the cache, and need to go through the slow
ossl_method_construct path again to slowly rebuild the cache.  Thats not
catastrophic, but its definately a bug that will result in additional
memory allocations, along with entries that never get used again, and
possible memory leaks.

Switch the load_ptr call to be an atomic cmp_exch_ptr call to ensure
that the node being visited isn't mutated concurrently by both a thread
doing a clean and a list insert.  This ensures that only one thread wins
the update, while the other restarts their operation.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jun 17 14:38:41 2026
(Merged from https://github.com/openssl/openssl/pull/31487)
2026-06-17 16:38:37 +02:00
Neil Horman
e1b32a0201 convert ossl method store cache to do full prop_query comparison
As noted in this conversation:
https://github.com/openssl/openssl/pull/31018#discussion_r3386478127

While unlikely, it is possible that a single provider may provide an
algorithm for the same <name,operation_id,provider> tuple, differing
only by property query string.  If, somehow the property strings for
those two algorithms hash to the same value, the property cache may
return the wrong algorithm.

This was mitigated prior to the introduction of the atomic link list
implementation by having the internal hash table do a collision check,
in which the full property string (along with the nid and provider
pointer) were compared byte-for-byte.

Fix this by re-introducing the same comparison.  We already do a
comparison check on the exact nid value and provider pointer, so we now
store the property query for each QUERY and compare it to the query
string requsted using strcmp.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jun 17 14:38:39 2026
(Merged from https://github.com/openssl/openssl/pull/31487)
2026-06-17 16:38:28 +02:00
Tomas Mraz
f3f163243a Revert "convert CRYPTO_THREAD_run_once to use InitOnceExecuteOnce api"
This reverts commit d053fe41a4.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Jun 17 12:14:58 2026
(Merged from https://github.com/openssl/openssl/pull/31539)
2026-06-17 14:14:51 +02:00
OpenSSL Machine
5a3723e254 Reject delta CRLs as complete CRL candidates
get_crl_score() is used when selecting a complete/base CRL. Its delta CRL rejection was chained after the extended CRL and IDP reason handling, so it could be skipped when extended CRL support was disabled, or when an IDP onlySomeReasons branch was taken.

As a result, a CRL with a Delta CRL Indicator could be scored as a complete/base CRL candidate. Since a delta CRL contains only changes relative to a base CRL, this could cause a previously revoked certificate to be accepted as valid when only the delta CRL is presented to the verifier.

Reject CRLs with base_crl_number unconditionally in get_crl_score() before IDP reason filtering. Delta CRLs are still considered by get_delta_sk() after a complete CRL is selected and check_delta_base() confirms compatibility.

Add verify recipe coverage for a delta CRL being rejected as a complete CRL, and for a delta CRL with IssuingDistributionPoint.onlySomeReasons being rejected under -extended_crl.

Reported-by: jujerpig (GitHub issue #31040)

Fixes #31040

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jun 17 08:53:02 2026
(Merged from https://github.com/openssl/openssl/pull/31044)
2026-06-17 10:52:51 +02:00
Frederik Wedel-Heinen
f5b21d0acb Removes unused args for new record layers.
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jun 16 07:14:13 2026
(Merged from https://github.com/openssl/openssl/pull/31490)
2026-06-16 09:14:03 +02:00
Jakub Zelenka
a5497ceaec pkcs11-provider: update to latest version
This fixes accidental version update in e2bd9f8c28 which is causing CI
failure for pkcs11-provider tests.

It needs to add xxd package that is used in the new hkdf test.

Fixes: e2bd9f8c28 "ml_kem: return an error on catastrophic failure in decap"

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Mon Jun 15 20:23:25 2026
(Merged from https://github.com/openssl/openssl/pull/31522)
2026-06-15 22:22:31 +02:00
Andrew Dinh
145aea4777 Use %zu for printing size_t values
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Mon Jun 15 19:24:43 2026
(Merged from https://github.com/openssl/openssl/pull/31454)
2026-06-15 15:24:36 -04:00
Neil Horman
df877a36ae Remove duplicate defines in tls1.h
TLS1_TXT_PSK_WITH_AES_128_GCM_SHA256 "PSK-AES128-GCM-SHA256"
TLS1_TXT_PSK_WITH_AES_256_GCM_SHA384 "PSK-AES256-GCM-SHA384"

Were defined twice identically in tls1.h

Remove the duplicate definition

Fixes #31484

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Mon Jun 15 16:10:01 2026
(Merged from https://github.com/openssl/openssl/pull/31493)
2026-06-15 12:09:56 -04:00
Tomas Mraz
edbd014e78 Fix no-psk build
Fixes ab6f5e915b

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
MergeDate: Mon Jun 15 14:46:44 2026
(Merged from https://github.com/openssl/openssl/pull/31507)
2026-06-15 16:46:40 +02:00
Bob Beck
2dab2a53c9 Fix BIO_write on file BIOs to report partial writes.
This makes it have the same behaviour as it does on all other
BIOs.

Due to a longstanding workaround that should no longer be needed
a partial write of the data (before a write error or end of file)
was reported as no data being written out.

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun 15 14:42:25 2026
(Merged from https://github.com/openssl/openssl/pull/31434)
2026-06-15 16:42:19 +02:00
Alexandr Nedvedicky
8776ba0fb3 Port script_2 from test/quic_multistream.c to test/radix/quic_tests.c
The multistream tests use so-called t-server to test QUIC connection
and stream functionality. With introduction of QUIC SSL listener
object and QUIC TLS server method, using t-server is no longer
necessary (and welcomed). All multisttream tests should be
ported to QUIC radix test infratructure.

Co-authored-by: Matt Caswell <matt@openssl.foundation>

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
MergeDate: Mon Jun 15 14:38:19 2026
(Merged from https://github.com/openssl/openssl/pull/30935)
2026-06-15 16:37:40 +02:00
John Claus
6fa85ab6ab apps/dgst: avoid EXIT_* helper returns and format changes
Return plain status codes from helper paths instead of EXIT_* and apply formatting updates to keep style consistent.

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Mon Jun 15 14:32:31 2026
(Merged from https://github.com/openssl/openssl/pull/30563)
2026-06-15 16:32:25 +02:00
XZ-X
e4e5c0538e apps/lib/apps.c: free retdb before return on OPENSSL_strdup() failure
Fixes: c7d5ea2670 "Prepare to detect index changes in OCSP responder."

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Mon Jun 15 14:29:23 2026
(Merged from https://github.com/openssl/openssl/pull/24981)
2026-06-15 16:29:18 +02:00
Daniel Kubec
3fe91b11d2 DOC: document ticket suppression for SSL_OP_NO_TICKET and SSL_SESS_CACHE_OFF
Complements: e5a1892 "TLS1.3: Disable tickets when SSL_OP_NO_TICKET and SSL_SESS_CACHE_OFF are set."

Co-authored-by: Andrew Dinh <andrewd@openssl.org>

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun 15 14:13:25 2026
(Merged from https://github.com/openssl/openssl/pull/31335)
2026-06-15 16:12:55 +02:00
Jakub Zelenka
e2bd9f8c28 ml_kem: return an error on catastrophic failure in decap
ML-KEM decapsulation applies implicit rejection by copying the failure
key into the shared secret when the FO re-encryption check fails. This
is correct for a syntactically valid but incorrect ciphertext, and must
stay constant-time and ciphertext-dependent.

However, the same path was also taken when hash_kr() or encrypt_cpa()
failed outright, for example on a memory allocation failure inside
EVP_DigestInit_ex(). In that case decap() copied the failure key and
still returned success, so the caller derived a wrong shared secret with
no error reported. For QUIC this produces a handshake that cannot
converge: the derived keys diverge from the peer, packets fail to
decrypt, and the connection stalls until it times out, with no
diagnostic pointing at the real cause.

These primitive failures are not dependent on the ciphertext, so
reporting them as a hard error does not create a chosen-ciphertext
oracle and does not weaken the constant-time implicit rejection that
happens later via CRYPTO_memcmp() and constant_time_select_8(). Treat
them the same way the existing kdf() failure is already treated, by
raising an error and returning 0.

Also fix the comment, which referred to hash_g() where the code actually
calls hash_kr().

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun 15 13:58:32 2026
(Merged from https://github.com/openssl/openssl/pull/31432)
2026-06-15 15:58:27 +02:00
Jakub Zelenka
c9808c5c4c apps: test pkeyutl -pkeyopt_passin
This increases test coverage of pkeyutl as the -pkeyopt_passin is not
currently covered at all.

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun 15 13:57:20 2026
(Merged from https://github.com/openssl/openssl/pull/31418)
2026-06-15 15:57:13 +02:00
Jakub Zelenka
af1f72fc5d test: add pkey -ec_conv_form coverage
Cover the previously untested EC point conversion form path for
uncompressed, compressed and hybrid output, as well as the non-EC key
rejection. Verified by the leading octet of the encoded point in the
SubjectPublicKeyInfo.

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun 15 13:54:50 2026
(Merged from https://github.com/openssl/openssl/pull/31370)
2026-06-15 15:54:44 +02:00
Jakub Zelenka
0644d02934 Fix duplicate CAstore option in s_time app
This fixes regression introduced in d260311c53

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun 15 13:53:40 2026
(Merged from https://github.com/openssl/openssl/pull/31192)
2026-06-15 15:53:26 +02:00
Jakub Zelenka
07cd21512f Test s_time with new -testmode option
Adds -testmode to s_time, mirroring the option in openssl speed.
It bypasses the -time window and runs a minimal number of iterations
(1 for new connections, 2 for session reuse).

Adds test_stime covering the new, reuse, and TLSv1.2/TLSv1.3 paths.

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun 15 13:53:39 2026
(Merged from https://github.com/openssl/openssl/pull/31192)
2026-06-15 15:53:26 +02:00
Tomas Mraz
5f88502043 windows_comp.yml: windows-latest image uses VS-2026 now
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Mon Jun 15 08:16:26 2026
(Merged from https://github.com/openssl/openssl/pull/31505)
2026-06-15 09:56:57 +02:00
Tomas Mraz
7c765bb602 test: Invert bad TEST() condition calls
False result of a TEST_xxx() call should always indicate
erroneous condition.

Fix such calls. Also fix some calls which
treated TEST_xxx() result as non-boolean.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Mon Jun 15 07:38:52 2026
(Merged from https://github.com/openssl/openssl/pull/31457)
2026-06-15 09:38:43 +02:00
Alexandr Nedvedicky
461b688628 Fix use-after-free issue in radix test framework for QUIC.
The test for client_hello and new_pending connection should
be using its own dedicated SSL context. The thing is we should
not be arming (and testing) those callbacks for every listener
the RADIX test framework creates.

This changeset moves the test from test/radix/quic_ops.c
to test/radix/quic_tests.c. The test uses check_ctx_cbks
RADIX script now.

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun 15 07:29:02 2026
(Merged from https://github.com/openssl/openssl/pull/31421)
2026-06-15 09:29:01 +02:00
Milan Broz
164c156750 ci: Switch to VS 2026 for windows-2025 image
GitHub no longer supports Visual Studio 2022 on windows-2025
image, switch to VS 2026.

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun 15 07:23:17 2026
(Merged from https://github.com/openssl/openssl/pull/31497)
2026-06-14 20:09:52 +02:00
Norbert Pocs
305643e95f aes_core.c: Fix staircase formatting issue
Continuation of https://github.com/openssl/openssl/pull/31350

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

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Fri Jun 12 19:25:02 2026
(Merged from https://github.com/openssl/openssl/pull/31446)
2026-06-12 15:24:52 -04:00
Mounir IDRASSI
c82a466566 test: add Windows RIO notifier smoke test
Add a Windows-only RIO notifier test that exercises initialization,
signalling, unsignalling, and cleanup without test-only hooks.

The RIO WSA lifecycle fix itself landed via #31339. This keeps the
remaining PR focused on coverage and removes the stale ssl_init.c include
for the deleted WSA cleanup path.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Fri Jun 12 13:54:17 2026
(Merged from https://github.com/openssl/openssl/pull/30918)
2026-06-12 09:54:10 -04:00
Eugene Syromiatnikov
c586165856 crypto/ec/curve448/eddsa.c: make dom_s constant static in hash_init_with_dom()
Otherwise it is allocated on stack and initialised on each call.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Jun 12 13:11:50 2026
(Merged from https://github.com/openssl/openssl/pull/31362)
2026-06-12 15:11:36 +02:00
Eugene Syromiatnikov
7665cb196b curve448: make locally-used functions static and remove unused ones
ossl_c448_ed448_derive_public_key(), ossl_c448_ed448_sign(),
and ossl_c448_ed448_verify() are only called from within the compilation
unit, while ossl_c448_ed448_convert_private_key_to_x448(),
ossl_c448_ed448_sign_prehash() and ossl_c448_ed448_verify_prehash()
are not used anywhere, seemingly.  Make the former static (removing
them from the header, removing the ossl_ prefix, and moving
the descriptions to the definitions) and remove the latter.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Jun 12 13:11:48 2026
(Merged from https://github.com/openssl/openssl/pull/31362)
2026-06-12 15:11:36 +02:00
Bob Beck
afd25111f1 Revert "Add indirect CRL path validation tests"
This reverts commit 35c1d7b16d.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Thu Jun 11 17:27:42 2026
(Merged from https://github.com/openssl/openssl/pull/31459)
2026-06-11 10:50:34 -06:00
Dmitry Misharov
5e488cb4f1 ci: Verify jom/NASM downloads and fall back to upstream on forks
Move the OpenSSL-hosted jom and NASM downloads under the /ci-deps/
path and verify them against SHA256 sums recorded in
.github/ci-deps.json before installing. Forks, which can't reach the
mirror reliably, download from the upstream Qt and NASM locations
instead.

Affected workflows: windows.yml, windows_comp.yml, os-zoo.yml

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Thu Jun 11 16:17:03 2026
(Merged from https://github.com/openssl/openssl/pull/30957)
2026-06-11 18:16:56 +02:00
Dmitry Misharov
628b1de776 ci: Download jom and NASM from OpenSSL-hosted mirror
Chocolatey-hosted packages for jom and NASM occasionally become
unavailable, causing CI failures on Windows builds. Host these
tools on our own infrastructure to eliminate this external
dependency.

Affected workflows: windows.yml, windows_comp.yml, os-zoo.yml

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Thu Jun 11 16:17:01 2026
(Merged from https://github.com/openssl/openssl/pull/30957)
2026-06-11 18:16:56 +02:00
David Foster
1a824261ef Add constant-time validation for CRYPTO_memcmp
Add test/crypto_memcmp_test.c which provides functional coverage for
CRYPTO_memcmp under regular builds and constant-time coverage under
enable-ct-validation builds.

The added constant-time coverage checks:
- there are no data dependent branches or memory accesses,
  on x86_64 and aarch64 architectures

The added constant-time coverage does NOT check:
- there are no data-dependent variable-time instructions, such as
  instructions NOT on the x86 Data Operand Independent Timing list
  or NOT on the ARM Data-Independent Timing list
- any architectures beyond x86_64 and aarch64

New CONSTTIME_SECRET annotations live only in the test rather than in
the generic C version of CRYPTO_memcmp so that both the C and
assembler versions of CRYPTO_memcmp are constant-time covered.

CRYPTO_memcmp directly backs CPython's secrets.compare_digest() and
hmac.compare_digest(), so a timing leak in it is high impact, yet it had
essentially no direct test coverage.

References #15076.

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

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Thu Jun 11 16:11:58 2026
(Merged from https://github.com/openssl/openssl/pull/31398)
2026-06-11 18:11:57 +02:00
Jon Spillett
6c90156f3e Fix up mismatched error reason codes
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 11 16:06:41 2026
(Merged from https://github.com/openssl/openssl/pull/31390)
2026-06-11 18:06:34 +02:00
slontis
ee9d1e532c FIPS: Make keygen PCT failures recoverable
Key generation pairwise consistency tests (PCT) no longer cause the
FIPS provider to enter a non recoverable error state.

Originally I considered that the pairwise tests should never fail, so a
failure was considered as a fatal error. Unfortunately this is not true,
since the RSA pairwise test was changed to call
rsa_ossl_public_encrypt(). This function can return -1 based on the
values of n and e, resulting in a DOS for bad inputs.
Under NIST FIPS 186-5, the public exponent (e) must be an odd positive
integer greater than (e > 65536) and less than 2^256. The OpenSSL code
however returns an error if e > 2^64 when n > 3072.
(This check was added to prevent a CVE DOS).

While FIPS 140-3 mandates that a module must transition into an error
state upon self-test failures, a PCT is classified as a conditional
self-test, not a pre-operational self-test
(like an integrity test or a Known Answer Test)
The cryptographic module is only required to immediately discard the
faulty key pair and output a local error. The module is allowed to
immediately attempt generating a new key pair using fresh entropy,
without needing a full system reboot or module reset.

Detected by Oracle during Jipher testing.

Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Jun 11 16:03:42 2026
(Merged from https://github.com/openssl/openssl/pull/31359)
2026-06-11 18:01:55 +02:00
Jakub Zelenka
c86db77e70 rsa: add pkcs1 and oaep mfail tests
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 11 16:00:17 2026
(Merged from https://github.com/openssl/openssl/pull/31356)
2026-06-11 17:59:54 +02:00
Jakub Zelenka
d318587d8f evp: add test_set_get_raw_keys_mfail to evp extra tests
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 11 16:00:16 2026
(Merged from https://github.com/openssl/openssl/pull/31356)
2026-06-11 17:59:54 +02:00
Jakub Zelenka
770bc1b024 mfail: add hard failure return code for failing even for NO_CHECK
The hard failure return code is meant for NO_CHECK variants to fail if
there is some failure that should never happen and likely signal a bug.

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 11 16:00:15 2026
(Merged from https://github.com/openssl/openssl/pull/31356)
2026-06-11 17:59:53 +02:00
Jakub Zelenka
930906e98b mfail: do not count allocations for no file when checked
This skips some debug and error allocations that cannot be handled

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 11 16:00:14 2026
(Merged from https://github.com/openssl/openssl/pull/31356)
2026-06-11 17:59:53 +02:00
Jakub Zelenka
6a3c9527ce mfail: add all tests iterable variants
It adds ADD_MFAIL_ALL_TESTS and ADD_MFAIL_ALL_NO_CHECK_TESTS that work
in similar way as ADD_ALL_TESTS but with mfail testing.

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 11 16:00:12 2026
(Merged from https://github.com/openssl/openssl/pull/31356)
2026-06-11 17:59:53 +02:00
Jakub Zelenka
35c1d7b16d Add indirect CRL path validation tests
This covers currently uncovered check_crl_path and check_crl_chain
in x509_vfy.c. The mfail test tests the happy path and all memory
failures in it. In addition 3 error scenarios are tested.

Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 11 15:58:37 2026
(Merged from https://github.com/openssl/openssl/pull/31244)
2026-06-11 17:58:24 +02:00
Jakub Zelenka
ab6f5e915b Add apps test for external PSK callbacks
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 11 15:52:36 2026
(Merged from https://github.com/openssl/openssl/pull/31190)
2026-06-11 17:52:30 +02:00
Frederik Wedel-Heinen
ba4605d63e Move common macro definitions to internal/common.h and fix comments.
Fixes #2480

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jun 11 15:51:32 2026
(Merged from https://github.com/openssl/openssl/pull/30019)
2026-06-11 17:51:31 +02:00
Igor Ustinov
11df4e2ae0 Fix potential NULL dereference in OSSL_CRMF_ENCRYPTEDVALUE_decrypt()
Check that 'parameter' != NULL before dereferencing in
OSSL_CRMF_ENCRYPTEDVALUE_decrypt().

Fixes CVE-2026-42767

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 20:38:27 2026
2026-06-11 17:08:41 +02:00
Igor Ustinov
463b444cb1 Test for CVE-2026-45447 (UAF in PKCS7_verify)
The test data were created with a tool developed by
Thai Duong <thai@calif.io>.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 20:22:52 2026
2026-06-11 17:08:41 +02:00
Igor Ustinov
f4129fbe3c Fix possible use-after-free in OpenSSL PKCS7_verify()
Fixes CVE-2026-45447

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 20:22:50 2026
2026-06-11 17:08:41 +02:00
Dmitry Belyavskiy
609bcb2486 Fix handling of empty-ciphertext messages in AES-GCM-SIV and AES-SIV
AES-GCM-SIV: EVP_DecryptFinal_ex Accepts All-Zero Tag for Empty-Ciphertext
Messages.

AES-SIV: EVP_DecryptUpdate_ex Accepts All-Zero Tag for Empty-Ciphertext
Messages on context reuse.

Fixes CVE-2026-45446

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 20:12:25 2026
2026-06-11 17:08:41 +02:00
Viktor Dukhovni
f87f0b6a8e Apply the buffered IV on the AES-OCB EVP_Cipher() path
aes_ocb_cipher(), the OCB provider's OSSL_FUNC_CIPHER_CIPHER slot,
processed input without flushing the buffered IV into the OCB
context.  Effective nonce was 0 regardless of the caller's IV;
EVP_*Final_ex() then emitted a tag depending only on (key, iv).
This gave (key, nonce) reuse and single-query universal forgery on
the EVP_Cipher() path.

Apply update_iv() at the head of aes_ocb_cipher() to mirror the
streaming handler.  The matching GCM one-shot does this already.

Add a cross-driver round-trip test for AES-{GCM,CCM,OCB} and
ChaCha20-Poly1305 in test/evp_extra_test.c.  Each cipher is
exercised with and without AAD; the no-AAD case is needed because
any prior EVP_CipherUpdate(NULL, aad, ...) routes through the
streaming handler and applies the IV itself, masking the bug.

Fixes CVE-2026-45445

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 20:02:00 2026
2026-06-11 17:08:41 +02:00
Bob Beck
5f489043b6 Add further unit tests for e-mail validation
Ensure we correctly catch misformed things.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 19:59:29 2026
2026-06-11 17:08:41 +02:00
Bob Beck
b3a555a0a7 Fix length miscalculation in validate_email
We incorrectly used the length of the domain part for the local part
when validating e-mail for X509_VERIFY_PARAM_set1_email().

Fixes CVE-2026-42771

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 19:59:28 2026
2026-06-11 17:08:41 +02:00
Norbert Pocs
0f3fab2ecc Match the local q DHX parameter against the peer's q
As FFC/DH peer public key validation uses the peer's q value instead
of checking against the local q, we must also check that these
q values match when setting the peer's public key.

Fixes CVE-2026-42770

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

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 19:56:27 2026
2026-06-11 17:08:41 +02:00
Bob Beck
c2765d53c2 Use the correct issuer when validating rootCAKeyUpdate
This correctly uses the existing root, and not the same certificate
as the root of the chain to validate.

While we are here, we also turn on self signed certificate signature
checking as this case is actually bringing in trust anchors as
self signed certs, and fix a possible NULL deref.

Fixes CVE-2026-42769

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 19:54:01 2026
2026-06-11 17:08:41 +02:00
Dmitry Belyavskiy
d5030cdf32 Enforce implicit rejection for CMS/PKCS#7 decryption
Drop the disablement of the implicit rejection for RSA PKCS#1 v1.5
decryption.

Fixes CVE-2026-42768

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Alicja Kario <hkario@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 19:49:19 2026
2026-06-11 17:08:41 +02:00
Igor Ustinov
f04d65692d Test for CVE-2026-42766
The script make_missing_kdf_der.py was developed by Mayank Jangid
and Kushal Khemka.

Co-Authored-by: Mayank Jangid <mayank.jangid.moon@gmail.com>
Co-Authored-by: Kushal Khemka <kushalkhemka559@gmail.com>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 18:57:53 2026
2026-06-11 17:08:41 +02:00
Igor Ustinov
74245170b5 Fix potential NULL dereference processing CMS PasswordRecipientInfo
Avoid NULL dereferencing when keyDerivationAlgorithm is absent
in CMS PasswordRecipientInfo.

Fixes CVE-2026-42766

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 18:57:52 2026
2026-06-11 17:08:41 +02:00
Daniel Kubec
a9af344229 Fix NULL Dereference in Certificate Verification with OCSP Checking
When performing OCSP response checking for certificates in the verification
chain, the code always tries to access the next certificate as the issuer.
There is a check for a self-signed certificate. However with the partial
chain verification enabled when the chain does not have a self-signed trusted
anchor, the issuer will be NULL for the last certificate in the chain. A NULL
pointer dereference then happens.

This issue affects only applications which enable both OCSP verification
of the certificate chain (X509_V_FLAG_OCSP_RESP_CHECK_ALL) and partial
chain verification (X509_V_FLAG_PARTIAL_CHAIN) in the certificate
verification. Both flags are disabled by default. For that reason, we have
assigned Low severity to the issue.

Fixes CVE-2026-42765

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 18:55:29 2026
2026-06-11 17:08:41 +02:00
Alexandr Nedvedicky
5097ec4dae Fix NULL dereference in QUIC address validation
QUIC server crashes when address validation (RFC 9000, Section 8.1)
is disabled and client sends initial packet with invalid token.

Issue reported and fix submitted by Sunwoo Lee (KENTECH),
Hyuk Lim (KENTECH) and Seunghyun Yoon (KENTECH)

Fixes CVE-2026-42764

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 14:50:48 2026
2026-06-11 17:08:41 +02:00
Daniel Kubec
58633b658f Fix Double-free When Checking OCSP Stapled Response
If OCSP stapling is enabled and the TLS client connects to a malicious server,
a crafted OCSP stapled response can trigger a double free in the TLS client
when the stapled response is checked.

The OCSP stapling is not enabled by default. Reliable code execution
through a double-free is technically complex and highly environment-dependent
but the Denial of Service impact is straightforward to achieve, warranting
Moderate severity.

Fixes CVE-2026-35188

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 14:44:58 2026
2026-06-11 17:08:41 +02:00
Alexandr Nedvedicky
68ef88913e Add test for path challenge flood mitigation
client injects 16 path challenge frames. Those are received
by server. Only one challenge frame of 16 received triggers
path challenge response. Remaining challenge frames are
discrded/ignored.

Test introduces two counters to channel object:
  - path_challenge_rx which is bumped for every patch challenge
  frame received

  - path_response_tx which is bumped for every path response
  frame transmitted

Succesuful test verifies server receives 16 path challenge frames,
but sends just one path response frmae as response.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 14:35:21 2026
2026-06-11 17:08:41 +02:00
Alexandr Nedvedicky
9bedb61319 QUIC stack must limit the number of PATH_CHALLENGE frames processed in RX
Currently local QUIC stack allocates PATH_RESPONSE frame for every
PATH_CHALLENGE frame it receives in single packet from its remote peer.
The memory with PATH_RESPONSE frame is released after local QUIC stack
receives an ACK which confirms reception of PATH_RESPONSE by remote peer.
This gives remote peer too much control over memory resources local
QUIC stack may consume.

Quoting RFC 9000 section 9.2.1:
	...an endpoint SHOULD NOT send multiple
	PATH_CHALLENGE frames in a single packet.

Limiting the number of PATCH_CHALLENGE frames to 1 per QUIC packet received
helps to reduce heap memory overhead required to process PATH_CHALLENGE
frame.

Currently QUIC ACKM (ACK-manager) keeps all frames in retransmission
buffer until ACK is received. It can be changed such frames which
don't need to be ACKed don't need to be kept in retrans buffer,
those can be released right after transmission.

Fixes CVE-2026-34183

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 14:35:20 2026
2026-06-11 17:08:41 +02:00
Neil Horman
d49444fa98 Add tests for CVE-2026-34182
Test to ensure that for a given CMS message:

1) We do not allow the creation of a CMS message containing
   AuthEnvelopedData with a non-AEAD cipher.
2) We do not accept a message containing AuthEnvelopedData with a
   non-AEAD cipher specified in the AlgorithmIdentifier.
3) We do not allow tag lengths less that 4 bytes.

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 14:27:03 2026
2026-06-11 17:08:41 +02:00
Neil Horman
206faade8b Reject potentially forged encrypted CMS AuthEnvelopedData messages
1. Adjust ossl_cms_EncryptedContent_init_bio to not accept non-AEAD
ciphers.

If a forged CMS message with AuthEnvelopedData is received with
a non-AEAD cipher specified, we silently accept that and decrypt
the message, skipping any authentication, which violates RFC 5083.

We also add checks to ensure we fail if we try to encrypt
AuthEnvelopedData without using an AEAD cipher.

2. Ensure that tag lengths on cms AEAD data is the recommended size.

RFC 5084 recommends that mac tags be at least 12 bytes for AES-GCM
and 4 bytes for AES-CCM on AuthEnvelopedData. As this code is not
algorith-specific we add a check for a minimal size and just use the
lower limit which is sufficient to prevent this attack.

Without this check, its possible to set the tag length to 1 and within
256 guesses, forge a CMS message.

Fixes CVE-2026-34182

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 14:27:02 2026
2026-06-11 17:08:41 +02:00
Alicja Kario
5a0230b6cc pkcs12: verify that the pbmac1 key length is safe
Short mac keys (as short as 1 byte) can be used to probe the
system under attack to accept a PKCS#12 file created by an attacker
even if the attacker doesn't know the password used for MAC protection.

Fixes CVE-2026-34181

(also update the reference to the PBMAC1 PKCS#12 RFC)

Signed-off-by: Alicja Kario <hkario@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 14:18:59 2026
2026-06-11 17:08:41 +02:00
Viktor Dukhovni
fcb2380604 Avoid length truncation in ASN1_STRING_set
The ASN1_STRING_set() function takes an `int` length, make sure the
argument is not inadvertently truncated when it is called from
asn1_ex_c2i().

Fixes CVE-2026-34180

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 14:13:56 2026
2026-06-11 17:08:41 +02:00
Nikola Pajkovsky
2f789ca4f2 cms: kek_unwrap_key: test for fix out-of-bounds read in check-byte validation
added EnvelopedData blob with a PasswordRecipientInfo using
id-alg-PWRI-KEK and an AES-128-CFB key encryption cipher. CFB's 1-byte
effective block size let the inlen >= 2 * blocklen guard in
kek_unwrap_key() accept a wrapped key shorter than the seven octets
the check-byte test reads from tmp[1..6]; the encryptedKey OCTET
STRING here is only two bytes.

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

Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 14:06:38 2026
2026-06-11 17:08:41 +02:00
Nikola Pajkovsky
51d1800e95 cms: kek_unwrap_key: Fix out-of-bounds read in check-byte validation
the check-byte test in kek_unwrap_key() reads tmp[1] through tmp[6]
unconditionally, so the decrypted buffer must hold at least seven
octets. The pre-decryption size check enforces inlen >= 2 * blocklen,
which yields the required seven octets only when blocklen >= 4. For
a KEK cipher with a smaller block size, inlen can be as small as
2 * blocklen and the check-byte read overruns the inlen-sized tmp
allocation.

Reject blocklen < 4 in the early sanity check. All block ciphers
appropriate for CMS PasswordRecipientInfo key wrapping have a block
size of at least 8 octets (DES/3DES = 8, AES = 16), so this only
forbids ciphers that would not be valid KEK choices anyway, and the
existing inlen >= 2 * blocklen check then guarantees the seven-octet
lower bound the check-byte test relies on.

Fixes CVE-2026-9076

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

Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 14:06:36 2026
2026-06-11 17:08:41 +02:00
Viktor Dukhovni
97f6b621f7 Reject oversized inputs in ASN1_mbstring_ncopy()
In ASN1_mbstring_ncopy() the destination size for BMPSTRING and
UNIVERSALSTRING output was computed by a signed left shift on an
int:

    outlen = nchar << 1;        /* MBSTRING_BMP  */
    outlen = nchar << 2;        /* MBSTRING_UNIV */

For nchar large enough the result is not representable in int.  In
the worst case (nchar == 0x40000000) nchar << 2 wraps to zero,
OPENSSL_malloc(1) is called, and traverse_string() then writes
4*nchar bytes into the one-byte allocation: a heap buffer
overflow.  The MBSTRING_UTF8 path computes outlen by summing
per-character byte counts in out_utf8(), and that sum can overflow
the same int under similarly large inputs.

Neither path is reachable from code that processes X.509
certificates through the DIRSTRING_TYPE mask used by
ASN1_STRING_set_by_NID(): UNIVERSALSTRING is absent from that
mask, and the UTF-8 sum requires inputs on the order of half a
gigabyte.  Reaching them needs an application that calls
ASN1_mbstring_copy()/ASN1_mbstring_ncopy() directly, or registers
a custom NID via ASN1_STRING_TABLE_add(), with an oversized
attacker-controlled input.

Add range checks before each shift and in out_utf8(), raising
ASN1_R_STRING_TOO_LONG at the point of detection.  Move the
existing ASN1_R_INVALID_UTF8STRING raise into out_utf8() too so
the two failure modes report distinct codes; the MBSTRING_UTF8
caller is left with cleanup only and now frees dest on error,
matching the BMP/UNIV branches.

Fixes CVE-2026-7383

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Jun  8 14:02:18 2026
2026-06-11 17:08:41 +02:00
Dr. David von Oheimb
cb005ceaaf CMP: Optionally accept missing or non-matching transactionID or recipNonce values
This is done for error messages received if OSSL_CMP_OPT_NONMATCHED_ERROR_NONCES
is set or the respective -nonmatched_error_nonces CLI option is given.

Can be helpful when the server (or other peer) cannot provide a proper error message header,
for instance if was unable to parse the ASN.1 encoding of a request message.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 11 14:56:49 2026
(Merged from https://github.com/openssl/openssl/pull/29043)
2026-06-11 16:56:35 +02:00
Dr. David von Oheimb
cdad6573ef add HISTORY and CHANGES.md entry for OSSL_CMP_OPT_PERMIT_TA_IN_EXTRACERTS_FOR_IR introduced in 4.0
Complements: 21722fe554 "OSSL_CMP_OPT_PERMIT_TA_IN_EXTRACERTS_FOR_IR: use new TA(s) for whole transaction (also pkiconf); update doc"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 11 14:56:47 2026
(Merged from https://github.com/openssl/openssl/pull/29043)
2026-06-11 16:56:35 +02:00
Dr. David von Oheimb
7faa8a467b OSSL_CMP_CTX_new.pod: fix HISTORY entry for OSSL_CMP_CTX_get0_geninfo_ITAVs() and OSSL_CMP_OPT_NO_CACHE_EXTRACERTS
Complements 8d9c8b3ff "CMP doc: add missing text on OSSL_CMP_OPT_NO_CACHE_EXTRACERTS to OSSL_CMP_CTX_new.pod and ossl_cmp_msg_check_update.pod"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jun 11 14:56:46 2026
(Merged from https://github.com/openssl/openssl/pull/29043)
2026-06-11 16:56:34 +02:00
Steve Grubb
c9a89ac815 doc: document SSL_set_*_state SSL argument
SSL_set_connect_state() and SSL_set_accept_state() have no return value to
report argument errors, but their documentation did not state the precondition
for the SSL argument. Passing NULL, or a pointer that is not a valid
SSL object, is a programmer error rather than a recoverable API error.
Document that the ssl argument must point to a valid SSL object and
must not be NULL.

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Thu Jun 11 09:04:23 2026
(Merged from https://github.com/openssl/openssl/pull/31435)
2026-06-11 11:03:44 +02:00
kovan
7ca122e0de doc: document deprecated engine configure options
Document that no-engine, no-static-engine, and no-dynamic-engine
configure options are deprecated and do nothing. These options are
retained for backwards compatibility only.

Fixes #27473

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

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
MergeDate: Thu Jun 11 09:02:08 2026
(Merged from https://github.com/openssl/openssl/pull/29839)
2026-06-11 11:02:07 +02:00
rootvector2
24e69ac1db uni2utf8: reject negative length like uni2asc
Reviewed-by: Alicja Kario <hkario@redhat.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jun 11 08:56:39 2026
(Merged from https://github.com/openssl/openssl/pull/31378)
2026-06-11 10:56:32 +02:00
Viktor Dukhovni
7a441852a2 x509: check inner/outer signatureAlgorithm match in X509_CRL_verify
RFC 5280 section 5.1.1.2 requires the signatureAlgorithm in the outer
CertificateList wrapper to be identical to the signature field inside
the signed TBSCertList.  def_crl_verify() did not enforce this, unlike
X509_verify() and X509_ACERT_verify() which both carry an X509_ALGOR_cmp
guard.

Add the same guard to def_crl_verify().  A mismatch raises
X509_R_CRL_SIGNATURE_ALGORITHM_MISMATCH.  No known attack results from
the missing check; this is a conformance and hardening fix only.

Add a regression test: a CRL with a valid RSA-SHA256 signature over a
TBSCertList whose inner signatureAlgorithm claims ecdsaWithSHA256 is
now rejected.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jun 11 08:45:41 2026
(Merged from https://github.com/openssl/openssl/pull/31213)
2026-06-11 10:45:35 +02:00
Neil Horman
d053fe41a4 convert CRYPTO_THREAD_run_once to use InitOnceExecuteOnce api
Issue #22059 reported a race condition in CRYPTO_THREAD_run_once on
windows platforms.  The most correct fix for this is to convert the
windows run_once implementation to use the Win32 InitOnceRunOnce
interface.  Doing so requires at least Windows Vista/Windows Server 2008
to be available, and because WinXP hasn't built since 3.0 released, it
seems sensible to bump our minimal NT version to be 0x600 (Vista/2008)

Also, while we're at it, this change caught a bad programming practice
in the rio_notifier code, which attempts to reset the once variable
during shutdown.  The windows static initalizer macro for this api is
constructed such that attempting to do so causes a build break.  Since
once variables are not meant to be reset (since they are only triggered
once), remove that reset code to avoid the breakage.

Note that this problem was independently found and fixed in #30198.
We're taking the fix from this pr (as they are effectively identical),
and using that PR to add some much needed tests to the rio code.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Wed Jun 10 19:44:19 2026
(Merged from https://github.com/openssl/openssl/pull/31339)
2026-06-10 15:46:53 -04:00
Norbert Pocs
38e1580fa6 Fix parentheses in bn_cp_64 macro
Signed-off-by: Norbert Pocs <norbertp@openssl.org>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jun 10 13:24:46 2026
(Merged from https://github.com/openssl/openssl/pull/31386)
2026-06-10 15:24:43 +02:00
Norbert Pocs
dfe25851fb Fix macro staircase formatting issue
When the macro contains a comma (',') as a trailer character, then
clang-format doesn't get the correct formatting

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jun 10 13:24:44 2026
(Merged from https://github.com/openssl/openssl/pull/31386)
2026-06-10 15:24:43 +02:00
Jakub Zelenka
13970e2a54 build: make enable-asan work for VC targets
Configure assumed GCC/Clang sanitizer spellings, so enable-asan was a
no-op on MSVC. Emit /fsanitize=address instead of -fsanitize=address
on VC targets.

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Wed Jun 10 12:53:11 2026
(Merged from https://github.com/openssl/openssl/pull/31366)
2026-06-10 14:53:06 +02:00
Eugene Syromiatnikov
96fddf6b9c Consistenly zeroize public parameters based on OPENSSL_PEDANTIC_ZEROIZATION
Commit fa338aa7cd "fips: zeroization of public security parameters (PSPs)"[1]
introduced zeroization of public security params, which then[2] switched
its usage to OPENSSL_PEDANTIC_ZEROIZATION; however, zeroization has
implemented inconsistently, leaving out public security parameter
updates.  Consistently use newly introduced wrappers,
ossl_public_bn_free and ossl_public_param_free, for freeing such
parameters, and use them for FFC and RSA.

[1] https://github.com/openssl/openssl/pull/24355
[2] https://github.com/openssl/openssl/pull/26068

Complements: fa338aa7cd "fips: zeroization of public security parameters (PSPs)"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Jun 10 12:52:14 2026
(Merged from https://github.com/openssl/openssl/pull/31157)
2026-06-10 14:52:07 +02:00
Andrew Dinh
d1c4d144b9 Remove crypto/aes/aes_x86core.c because it's dead code
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed Jun 10 12:43:39 2026
(Merged from https://github.com/openssl/openssl/pull/31424)
2026-06-10 14:43:33 +02:00
Bob Beck
b2a133ed77 Let's attempt to make real documentation for X509_verify_cert
I am doing this because I have need to add information that really does
belong here, and the current stuff is less documentation than more or
less some hand waving about how it works without any details

So to summarize the changes:

1) This documents the current way that X509_verify_cert goes about
building and verifying a chain, identifying the relevant flags that
can affect how this happens today, and cross references the correct page
to find the rest of the exhaustive list of verification flags and what they do.

2) This documents the verification callback and how it can be used
to affect the verification outcome, This includes warning potential
users of the callback of what returning values from it means,
the common ways to end up unintentionaly doing things you did not expect
with the callback, and that it depends upon internals and should not be
relied upon.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Jun 10 11:33:13 2026
(Merged from https://github.com/openssl/openssl/pull/31314)
2026-06-10 13:33:12 +02:00
Nikolas Gauder
6537100304 quic: Add MFAIL coverage for stream map allocation and token caching
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Jun 10 11:23:38 2026
(Merged from https://github.com/openssl/openssl/pull/31333)
2026-06-10 13:23:29 +02:00
Nikolas Gauder
c8d08d783a quic: add lhash insert error checks
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Jun 10 11:23:37 2026
(Merged from https://github.com/openssl/openssl/pull/31333)
2026-06-10 13:23:29 +02:00
sucloudflare
6a56b9c326 crypto/evp: align exchange.c cleanup with kem/sig/asymcipher pattern
Commit a21f77d added explicit null assignments after EVP_KEYMGMT_free()
calls at the err:, legacy:, and success exit paths in kem.c,
asymcipher.c and signature.c.

The identical exit paths in evp_keyexch_init() (crypto/evp/exchange.c)
were not updated at the same time, leaving exchange.c as the only
outlier in the family without these null assignments.

This patch brings exchange.c into consistency with its sibling files
by adding exchange = NULL and tmp_keymgmt = NULL after each free at
the exit paths, matching the established pattern from a21f77d.

No functional change intended.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jun 10 11:20:19 2026
(Merged from https://github.com/openssl/openssl/pull/31394)
2026-06-10 13:20:09 +02:00
kovan
84a851906d doc: document OSSL_PKEY_PARAM_BITS meaning for each key type
The EVP_PKEY_get_bits() documentation states that "the definition
of cryptographic length is specific to the key cryptosystem" but
doesn't explain what this means for each key type.

Add a detailed list explaining what "bits" represents for RSA, DSA,
DH, EC, X25519, X448, Ed25519, Ed448, ML-DSA, SLH-DSA, and ML-KEM
key types to help users understand the return value.

Fixes #28337

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

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed Jun 10 11:15:17 2026
(Merged from https://github.com/openssl/openssl/pull/29790)
2026-06-10 13:15:12 +02:00
rootvector2
d2b48f060d pvkfmt: check keylen before copying the BLOBHEADER
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Jun 10 11:12:39 2026
(Merged from https://github.com/openssl/openssl/pull/31352)
2026-06-10 13:12:31 +02:00
Timo Keller
24486294f7 Vectorize (inverse) NTT in ML-DSA
The vectorization is implemented using vector extensions (of gcc/clang)
and will work on any architecture with 128 bit vector registers that has
the builtin `vec_mulh` for the high part of a multiplication.

Enable this for s390x.

The speed-up factor on z17 is around 2--3.4.

Signed-off-by: Timo Keller <tkeller@linux.ibm.com>

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Wed Jun 10 09:25:58 2026
(Merged from https://github.com/openssl/openssl/pull/30812)
2026-06-10 11:25:56 +02:00
Nikola Pajkovsky
9fca1b9c2e ghash-armv4.pl: add missing alignment for gcm_gmult_4bit
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Wed Jun 10 07:51:21 2026
(Merged from https://github.com/openssl/openssl/pull/31327)
2026-06-10 09:51:13 +02:00
Nikola Pajkovsky
6f57dda57d sha512-armv4: add missing function alignment
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Wed Jun 10 07:51:20 2026
(Merged from https://github.com/openssl/openssl/pull/31327)
2026-06-10 09:51:13 +02:00
Nikola Pajkovsky
0ae9d50dd8 armv4cpuid.pl: add missing function alignment
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Wed Jun 10 07:51:19 2026
(Merged from https://github.com/openssl/openssl/pull/31327)
2026-06-10 09:51:13 +02:00
Nikola Pajkovsky
871298d8d2 aes-sha1-armv8.pl: add missing function alignment
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Wed Jun 10 07:51:17 2026
(Merged from https://github.com/openssl/openssl/pull/31327)
2026-06-10 09:51:13 +02:00
Dr. David von Oheimb
bbe7916279 cmp_client_test.c: fix partly too generous total_timeout limit for IR session with polling
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed Jun 10 06:46:36 2026
(Merged from https://github.com/openssl/openssl/pull/31111)
2026-06-10 08:46:29 +02:00
Dr. David von Oheimb
b6eb715075 cmp_vfy.c: prevent needless and confusing duplication of diagnostic output on failure validating CMP messages
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jun 10 06:39:00 2026
(Merged from https://github.com/openssl/openssl/pull/28986)
2026-06-10 08:38:47 +02:00
Dr. David von Oheimb
0a6b6664a4 cmp_vfy.c: small fixes on content and layout of diagnostics on failure validating signature-based protection of CMP messages
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jun 10 06:38:59 2026
(Merged from https://github.com/openssl/openssl/pull/28986)
2026-06-10 08:38:47 +02:00
Dr. David von Oheimb
1a2e75520b make sure BIO_set_ssl() transfers ownership of ssl only on success; document this
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jun 10 06:27:04 2026
(Merged from https://github.com/openssl/openssl/pull/27357)
2026-06-10 08:26:54 +02:00
Dr. David von Oheimb
33544336cb http_lib.c: add check that host_end is not past authority_end
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jun 10 06:27:03 2026
(Merged from https://github.com/openssl/openssl/pull/27357)
2026-06-10 08:26:54 +02:00
Dr. David von Oheimb
673a2cfba5 OSSL_HTTP_REQ_CTX.pod: tweak description of 'expect_asn1' parameter of OSSL_HTTP_REQ_CTX_set_expected()
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jun 10 06:27:02 2026
(Merged from https://github.com/openssl/openssl/pull/27357)
2026-06-10 08:26:54 +02:00
Dr. David von Oheimb
2a34692e5e apps/cmp.c: fix use of SSL_set_tlsext_host_name() for SNI and X509_VERIFY_PARAM_set1_host()
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jun 10 06:27:00 2026
(Merged from https://github.com/openssl/openssl/pull/27357)
2026-06-10 08:26:54 +02:00
Dr. David von Oheimb
f55922e8b2 http_lib.c: fix parsing 'scheme' part in OSSL_parse_url()
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jun 10 06:26:59 2026
(Merged from https://github.com/openssl/openssl/pull/27357)
2026-06-10 08:26:47 +02:00
Dr. David von Oheimb
edec017c06 SSL_CTX_set_tlsext_servername_callback.pod: improve doc of SSL_set_tlsext_host_name(); update format
Add recommendation to use it for TLS clients, together with X509_VERIFY_PARAM_{set1,add1}_host()

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jun 10 06:26:57 2026
(Merged from https://github.com/openssl/openssl/pull/27357)
2026-06-10 08:26:46 +02:00
Neil Horman
5191045371 Disable tls test in pkcs11 provider
The head of the tree is broken due to a combined inability for openssl
and the provider to allow for duplication of MD contexts on an in flight
session

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun  9 18:17:32 2026
(Merged from https://github.com/openssl/openssl/pull/31018)
2026-06-09 14:17:00 -04:00
Neil Horman
4ed8916026 update pkcs11 submodule
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun  9 18:17:30 2026
(Merged from https://github.com/openssl/openssl/pull/31018)
2026-06-09 14:17:00 -04:00
Neil Horman
1c81e499a8 clean up the code a bit
Remove some vestigual code from the property cache and name things
appropriately

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun  9 18:17:28 2026
(Merged from https://github.com/openssl/openssl/pull/31018)
2026-06-09 14:17:00 -04:00
Neil Horman
6daa86082e Opportunistiaclly move archived items to a separate list
if a provider is unloaded and reloaded to a context, all its algorithms
get archived, making them un-look-up-able.  While this is good, having
all those effectively dead entries in the list slows down the linear
traversal in the lookup path, so periodically, while we have the write
lock held, migrate those entries to a separate archive list so that they
don't imact the normal hot path.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun  9 18:17:26 2026
(Merged from https://github.com/openssl/openssl/pull/31018)
2026-06-09 14:02:45 -04:00
Neil Horman
431f786ee6 Fix caching of EVP methods when NO_CACHED_FETCH is asserted
noticed during the debugging of this that, even though we may have
no-cached-fetch configured, we still put things in the method store,
which is wrong.

Don't cache things when we say we're not caching things

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun  9 18:17:24 2026
(Merged from https://github.com/openssl/openssl/pull/31018)
2026-06-09 14:02:45 -04:00
Neil Horman
c1ad1773f5 correct property_test
The duplicate property test has to change because we now archive QUERYs
instead of removing them immediately (i.e. we don't drop the ref count
until the store is freed).

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun  9 18:17:21 2026
(Merged from https://github.com/openssl/openssl/pull/31018)
2026-06-09 14:02:45 -04:00
Neil Horman
8f9f0d2da0 Fix persniketyness in tsan
TSAN seems to be having a problem with atomic_load_ptr and
atomic_store_ptr.  Both are, by default, __ATOMIC_RELAXED operations.

According to the tsan docs, it flags these operations as a race because,
while they are indivisible, they create no happens-before constraint,
meaning they can be reordered.

An exemplar race that is reported is:

WARNING: ThreadSanitizer: data race (pid=2139404)
  Read of size 4 at 0x723400002308 by thread T39:
    #0 EVP_MD_up_ref crypto/evp/digest.c:995 (threadstest+0x45032d) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #1 evp_md_up_ref crypto/evp/digest.c:974 (threadstest+0x450242) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #2 ossl_method_up_ref crypto/property/property.c:201 (threadstest+0x4b7a55) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #3 ossl_method_store_cache_get_locked crypto/property/property.c:941 (threadstest+0x4b9922) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #4 ossl_method_store_cache_get crypto/property/property.c:974 (threadstest+0x4b9a47) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #5 inner_evp_generic_fetch crypto/evp/evp_fetch.c:314 (threadstest+0x458186) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #6 evp_generic_fetch crypto/evp/evp_fetch.c:404 (threadstest+0x4586dc) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #7 EVP_MD_fetch crypto/evp/digest.c:985 (threadstest+0x4502d7) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #8 derive_kdk crypto/rsa/rsa_ossl.c:472 (threadstest+0x4cf738) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #9 rsa_ossl_private_decrypt crypto/rsa/rsa_ossl.c:646 (threadstest+0x4d0174) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #10 RSA_private_decrypt crypto/rsa/rsa_crpt.c:48 (threadstest+0x4c6971) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #11 rsa_decrypt providers/implementations/asymciphers/rsa_enc.c:321 (threadstest+0x51cab7) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #12 EVP_PKEY_decrypt crypto/evp/asymcipher.c:280 (threadstest+0x44a9ca) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #13 thread_shared_evp_pkey test/threadstest.c:966 (threadstest+0x404be7) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #14 thread_run test/threadstest.h:67 (threadstest+0x40132d) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)

  Previous write of size 8 at 0x723400002308 by main thread (mutexes: write M0):
    #0 memset <null> (libtsan.so.2+0x4c1eb) (BuildId: 40906101a3a1e1f1ececafafda314aee009d688a)
    #1 CRYPTO_zalloc crypto/mem.c:228 (threadstest+0x48679d) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #2 evp_md_new crypto/evp/digest.c:758 (threadstest+0x44f35e) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #3 evp_md_from_algorithm crypto/evp/digest.c:839 (threadstest+0x44f885) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #4 construct_evp_method crypto/evp/evp_fetch.c:230 (threadstest+0x457ec9) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #5 ossl_method_construct_this crypto/core_fetch.c:110 (threadstest+0x4801bf) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #6 algorithm_do_map crypto/core_algorithm.c:77 (threadstest+0x47f7a3) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #7 algorithm_do_this crypto/core_algorithm.c:122 (threadstest+0x47f987) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #8 ossl_provider_doall_activated crypto/provider_core.c:1609 (threadstest+0x49a42a) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #9 ossl_algorithm_do_all crypto/core_algorithm.c:164 (threadstest+0x47fb14) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #10 ossl_method_construct crypto/core_fetch.c:157 (threadstest+0x4803d0) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #11 inner_evp_generic_fetch crypto/evp/evp_fetch.c:333 (threadstest+0x4583a2) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #12 evp_generic_fetch crypto/evp/evp_fetch.c:404 (threadstest+0x4586dc) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #13 EVP_MD_fetch crypto/evp/digest.c:985 (threadstest+0x4502d7) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #14 derive_kdk crypto/rsa/rsa_ossl.c:472 (threadstest+0x4cf738) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #15 rsa_ossl_private_decrypt crypto/rsa/rsa_ossl.c:646 (threadstest+0x4d0174) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #16 RSA_private_decrypt crypto/rsa/rsa_crpt.c:48 (threadstest+0x4c6971) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #17 rsa_decrypt providers/implementations/asymciphers/rsa_enc.c:321 (threadstest+0x51cab7) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)
    #18 EVP_PKEY_decrypt crypto/evp/asymcipher.c:280 (threadstest+0x44a9ca) (BuildId: f34377d95e3c1d13ab9aa3204d2f1f7840d1c84a)

What tsan is saying here is that the memset in evp_md_new may get
re-ordered such that the contents of the EVP_MD may still be getting
zeroed at the time we have (a) found the EVP_MD in the method store
cache, and (b) attempted to do an up_ref on it.

This is plainly impossible, especially given that, in order to reach the
method store cache, it must be places in the method store algorithm
sparse array, which still requires the taking of the method store write
lock.  But for some reason tsan fails to see the memory fence that
creates.

It seems the simplest solution to correct this is, if we are running
under tsan, use __ATOMIC_ACQUIRE and __ATOMIC_RELEASE on
CRYPTO_atomic_[load|store]_ptr to make sure tsan sees the proper memory
ordering.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun  9 18:17:19 2026
(Merged from https://github.com/openssl/openssl/pull/31018)
2026-06-09 14:02:45 -04:00
Neil Horman
8b19d36ed9 improve sharding of cache_lists
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun  9 18:17:17 2026
(Merged from https://github.com/openssl/openssl/pull/31018)
2026-06-09 14:02:45 -04:00
Neil Horman
e8b562dbc0 clean out lru list and write lock
We don't need either anymore

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun  9 18:17:14 2026
(Merged from https://github.com/openssl/openssl/pull/31018)
2026-06-09 14:02:45 -04:00
Neil Horman
79cd5c9bdc remove read lock from method store cache lookup
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun  9 18:17:12 2026
(Merged from https://github.com/openssl/openssl/pull/31018)
2026-06-09 14:02:45 -04:00
Neil Horman
b84faffb27 fully replace hash table with linked list
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun  9 18:17:10 2026
(Merged from https://github.com/openssl/openssl/pull/31018)
2026-06-09 14:02:45 -04:00
Neil Horman
4d80958db6 add atomic list removal to property cache
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun  9 18:17:08 2026
(Merged from https://github.com/openssl/openssl/pull/31018)
2026-06-09 14:02:45 -04:00
Neil Horman
d31591fc04 Add atomic list inserted to method store cache
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun  9 18:17:05 2026
(Merged from https://github.com/openssl/openssl/pull/31018)
2026-06-09 14:02:45 -04:00
Neil Horman
6ca0a15d98 remove ossl_method_store cache culling
Theres no point in thrashing the cache like this, it just gives us more
opportunities to dirty the cpu cache by taking the write lock

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun  9 18:17:03 2026
(Merged from https://github.com/openssl/openssl/pull/31018)
2026-06-09 14:02:45 -04:00
Neil Horman
15abb53c06 Fix missing dependency on ml_kem_keymgmt.c
ml_kem_keymgmt.c includes der_wrap.h, which is a generated file, but
doesn't include a depdency in its build.info file, meaning that if the
dependencies aren't run in the right order, ml_kem_keymgmt.c gets
compiled before der_wrap.h is generated, leading to a build break.

Fix it by including the needed dependency.

Fixes #31379

Reviewed-by: Alicja Kario <hkario@redhat.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Jun  9 17:49:28 2026
(Merged from https://github.com/openssl/openssl/pull/31385)
2026-06-09 13:49:22 -04:00
Neil Horman
fb5e8bed5d Provide independent lock failure signal on cmp_exch_ptr
Our CRYPTO atomic api has a somewhat consistent problem in that its
possible in the case where locking fails to return an error while the
actual operation (store_int, store_ptr, etc), actually succeded.
cmp_exch is somewhat special here in that we may really need to know
independently if the function failed due to lock failure and if the
exchange occured (so we can know the output value of *expect).  Add a
separate parameter to allow callers to be informed of these statuses
independently.

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jun  9 17:46:07 2026
(Merged from https://github.com/openssl/openssl/pull/31319)
2026-06-09 13:46:05 -04:00
Eugene Syromiatnikov
037ed10312 apps/s_client.c: read one byte less to avoid triggerring overflow protection
Commit e0e276b50a "Fix a one byte buffer overflow in s_client" added
a check for the buffer size before adding a terminating \0, which led
to full reads of BUFSIZZ resulting in session termination.  Avoid that
by requesting one byte less.

Co-Autherd-by: Tomas Mraz <tomas@openssl.foundation>
Resolves: https://github.com/openssl/openssl/issues/30925
Fixes: e0e276b50a "Fix a one byte buffer overflow in s_client"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 09:12:53 2026
(Merged from https://github.com/openssl/openssl/pull/31413)
2026-06-08 11:12:46 +02:00
Minh Vu
c920796adf quic: cleanse derived IV on setup failure
el_build_keyslot() derives the QUIC IV before the success path stores
*out_iv_len. If a later step fails, the error cleanup currently uses
*out_iv_len and ends up cleansing zero bytes.

Cleanse the caller buffer using the local iv_len instead so the
derived IV is cleared on all post-derivation failure paths.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 08:53:50 2026
(Merged from https://github.com/openssl/openssl/pull/31346)
2026-06-08 10:53:46 +02:00
Dmitry Misharov
b99b3566e2 add fingerprint of the new PGP key
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 08:27:39 2026
(Merged from https://github.com/openssl/openssl/pull/31353)
2026-06-08 10:27:38 +02:00
Matt Caswell
0d6164b9f0 Check custom extensions are handled correct with 3rd party QUIC
We have some code to handle the case where we have custom 3rd party
extension and 3rd party QUIC. Test that this doesn't cause any problems.

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 07:51:56 2026
(Merged from https://github.com/openssl/openssl/pull/31238)
2026-06-08 09:51:46 +02:00
Matt Caswell
ff08a2c6d1 There is no need to call custom_ext_copy_old_cb after reallocing dst->meths
In custom_exts_copy_conn we realloc'd the dst->meths buffer, and then
called `custom_ext_copy_old_cb` to transfer ownership of the all style
API wrapper allocations to the newly realloc'd buffer. But this makes
no sense. The buffer is realloc'd, and the old buffer is no longer freed,
so ownership of the old style API wrapper allocations transfer as well.
This is actually a use-after-free (we can no longer access the old buffer
once its been realloc'd), and also causes a leak. We just delete this
code.

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 07:51:55 2026
(Merged from https://github.com/openssl/openssl/pull/31238)
2026-06-08 09:51:46 +02:00
Matt Caswell
efff9b8278 Reapply "Preserve connection custom extensions in SSL_set_SSL_CTX()"
This reverts commit 7836b7d5b6.

Fixes #31193

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Jun  8 07:51:54 2026
(Merged from https://github.com/openssl/openssl/pull/31238)
2026-06-08 09:51:46 +02:00
007bsd
d099e33e57 aes_wrap: prevent crash on update without a key
EVP_CipherInit_ex2 with a NULL key followed by EVP_CipherUpdate
on AES-WRAP/WRAP-PAD/WRAP-INV ciphers dereferenced an uninitialised
function pointer because aes_wrap_init installs ctx->block only
when a key is supplied. aes_wrap_cipher_internal had no guard
before dispatching.

Track key state in ctx->key_set, matching OCB/CCM/GCM/Poly1305,
and refuse update if no key has been installed.

Added a regression test covering AES-256-WRAP, AES-256-WRAP-PAD
and AES-256-WRAP-INV.

CLA: trivial

Fixes: ca392b2943 "Add aes_wrap cipher to providers"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jun  3 11:52:05 2026
(Merged from https://github.com/openssl/openssl/pull/31292)
2026-06-03 13:51:57 +02:00
kovan
14d4dedc2a doc: Clarify SSL_CERT_DIR uses semicolon separator on Windows
The documentation for SSL_CERT_DIR stated that directories are
colon-separated, but on Windows the separator is semicolon.

Updated:
- openssl-rehash.pod.in: Added note about semicolon separator on Windows
- openssl-env.pod: Added note about multiple directories and Windows separator

Fixes: #27698

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 Jun  3 11:44:35 2026
(Merged from https://github.com/openssl/openssl/pull/29894)
2026-06-03 13:44:30 +02:00
Bob Beck
68c0321e90 Provide ASN1_STRING_new_not_owned()
This function provides the ability to construct an ASN1_STRING
containing data that is not owned by the constructed ASN1_STRING. The
resulting ASN1_STRING, when freed, will not free the data, and it is
the caller's resposibility to ensure that the data lives past the
lifetime of any returned ASN1_STRING.

Why? you may ask? Many places where ->data and ->length were used
directly in the past before the opaquification of ASN1_STRING were
for this purpose, whether used for actual static data, or to turn
bytes created by and in control of the caller into an ASN1_STRING
for temporary use as an input. This function makes this easier
to do without making copies.

The function deliberately does not allow the creation of a BIT_STRING
as this would require also always providing unused bits, which is
annoying and unnecessary for almost all potential use cases.

For: https://github.com/openssl/openssl/issues/29861
For: https://github.com/openssl/openssl/issues/30162

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Wed Jun  3 11:42:49 2026
(Merged from https://github.com/openssl/openssl/pull/30964)
2026-06-03 13:41:32 +02:00
rootvector2
46b5165d44 quic: avoid one-byte over-read of conn close reason in copy_tcause
For a remote CONNECTION_CLOSE, src->reason points straight into the
received packet and holds exactly reason_len bytes with no guaranteed
trailing byte. copy_tcause() did OPENSSL_memdup(src->reason, l + 1),
reading one byte past the source. The +1 is only needed to make room
for the NUL written at r[l], so allocate l + 1 but copy only the l
valid bytes.

Fixes: 40c8c756c8 "QUIC APL/CHANNEL: Wire up connection closure reason"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
MergeDate: Wed Jun  3 11:39:47 2026
(Merged from https://github.com/openssl/openssl/pull/31349)
2026-06-03 13:39:43 +02:00
Teddy Engel
d056bc0118 Remove unused crl_dir setting from config files
The crl_dir setting in CA_default section is not used anywhere. Remove
it from the example config and test configs, update the VMSify-conf.pl
path conversion script to no longer reference it, and regenerate
openssl-vms.cnf.

Fixes #31103

CLA: trivial

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
MergeDate: Wed Jun  3 11:37:02 2026
(Merged from https://github.com/openssl/openssl/pull/31215)
2026-06-03 13:36:56 +02:00
Jakub Zelenka
4dcf6d276d statem: fix missing fatal if valid_flags mfail in process cert req
It is a contract of tls process functions to trigger fatal error if they
fail. This is not being done in checking result of s->s3.tmp.valid_flags
allocation. If this happens, it triggers alert in read_state_machine()
for READ_STATE_BODY state that calls this process function. It calls
check_fatal() if MSG_PROCESS_ERROR is returned and the assert in it
fails because no error is triggered.

The fix just adds the fatal and also uses MSG_PROCESS_ERROR macro as
return value instead of hard coded 0.

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
MergeDate: Wed Jun  3 11:33:33 2026
(Merged from https://github.com/openssl/openssl/pull/31338)
2026-06-03 13:33:29 +02:00
Abel Tom
c97318e35e crypto/hpke/hpke_util: Fixes redundant mdname is valid check.
Removed the redundant `mdname` is not NULL check.

Fixes #31299

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Wed Jun  3 11:30:09 2026
(Merged from https://github.com/openssl/openssl/pull/31321)
2026-06-03 13:30:02 +02:00
Norbert Pocs
d23670f3af Fix broken hex data by reformatting
The clang format broke some data in hexadecimal format.  To make the tool
obedient, the trailing comma needs to be removed, then it interpretes
the data differently and therefore does not reformat it.  The format can
then be changed to the correct form.

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

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

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jun  3 07:46:14 2026
(Merged from https://github.com/openssl/openssl/pull/31350)
2026-06-03 09:46:03 +02:00
rootvector2
78dd798232 rsa_sig: reject short buffers in raw verify_recover
The md==NULL path of rsa_verify_recover passed the caller buffer to
RSA_public_decrypt without checking routsize, while the X9.31 and PKCS#1
paths already reject undersized output buffers. RSA_public_decrypt writes
up to RSA_size() bytes, so a short rout overflows. Validate routsize
against RSA_size() before the call.

Fixes: 6f4b766315 "PROV: add RSA signature implementation"

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
MergeDate: Tue Jun  2 11:55:00 2026
(Merged from https://github.com/openssl/openssl/pull/31340)
2026-06-02 13:54:53 +02:00
Cristian Yxen
e29a7e027c doc: Add a missing comma in -traditional option explanation.
CLA: trivial

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
MergeDate: Tue Jun  2 11:48:05 2026
(Merged from https://github.com/openssl/openssl/pull/31342)
2026-06-02 13:48:01 +02:00
Anton Moryakov
d4c900174c test: fix unreachable code in test_kdf_pbkdf2_large_output in evp_kdf_test.c
The condition `if (sizeof(len) > 32)` was intended to set `len` to
SIZE_MAX on platforms where size_t can hold values larger than 32 bits.
However, sizeof() returns the size in bytes, not bits. Since sizeof(size_t)
is typically 4 or 8 bytes on all current platforms, the condition was
always false, leaving len at 0 and skipping the large-output test.

This commit fixes the check by comparing SIZE_MAX directly against
0xFFFFFFFFU, which correctly detects whether size_t can represent
values exceeding 32-bit range. This ensures the test properly validates
PBKDF2 behavior when requested output length is excessively large.

Fixes: 1cae59d14b "Make KDFs fail if requesting a zero-length key."
Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
MergeDate: Tue Jun  2 11:10:23 2026
(Merged from https://github.com/openssl/openssl/pull/31344)
2026-06-02 13:09:59 +02:00
Ingo Franzki
0a396bdd1c s390x: Selectively re-format s390xcap.c
The clang formatter made some code places unreadable.  Selectively revert
the formatting to how it was before the re-formatting, and mark those places
with '/* clang-format off */' so that it does not get reformatted again.

While at it, change it to use designated initializers allowed with C-99.

No functional change intended.

Resolves: https://github.com/openssl/openssl/issues/31247
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Jun  1 07:49:58 2026
(Merged from https://github.com/openssl/openssl/pull/31263)
2026-06-01 09:49:19 +02:00
007bsd
07485b844a poly1305: prevent crash on final without a key
EVP_MAC_init with a NULL key followed by EVP_MAC_final on a
Poly1305 context crashed with a NULL function-pointer dispatch
because poly1305_init accepted the no-key case as success, and
poly1305_final had no guard before dispatching through the
uninitialised Poly1305 state.

Add a key_set field to struct poly1305_data_st (matching
OCB/CCM/GCM), set it in poly1305_setkey, and refuse init and
final if no key has been installed.

Added a regression test asserting EVP_MAC_init with a NULL key
returns 0.

##### Checklist
- [ ] documentation is added or updated
- [x] tests are added or updated

CLA: trivial

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Jun  1 07:35:02 2026
(Merged from https://github.com/openssl/openssl/pull/31298)
2026-06-01 09:34:47 +02:00
Jakub Zelenka
b084b6ebbf quic: fix keyslot cctx leak by not checking EL state in teardown
el_teardown_keyslot() decided whether to free a keyslot by calling
ossl_qrl_enc_level_set_has_keyslot() against the EL's current state.
On error paths the state does not yet match the slots that were
provisioned, so the check returned 0 and the cctx and iv were leaked.

The fix drops the state check and rely on the existing cctx != NULL
check which is sufficient for all callers of el_teardown_keyslot().

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Mon Jun  1 07:32:33 2026
(Merged from https://github.com/openssl/openssl/pull/31323)
2026-06-01 09:32:30 +02:00
Ilya Maximets
a6c06fa699 ktls: Fix invalid memory access on retry with moving write buffer
kTLS write is using application buffer always without a memory copy.
And it completely ignores SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER as a
result.  If the user frees or re-uses the original buffer and retries
the send on SSL_ERROR_WANT_WRITE, the code will read and send the data
from the original already freed buffer sending whatever happens to be
in that memory now and corrupting the message, potentially crashing
the application as well.

Fix by making a copy if we can't send the whole thing right away and
the moving write buffer is configured.

This preserves the zero-copy semantics for the happy path and avoids
the invalid memory access and data corruption when retry is necessary.
The copy is done in the common code as it is hard to preserve the
zero-copy behavior otherwise.

Test is added that reproduces the issue.  It may be possible to modify
the existing kTLS test to conditionally enable the modes and do the
BIO swap, but it feels like the issue deserves a separate one.

The test doesn't rely on any specific cypher or TLS version, so only
one combination is checked, but it should be enough.

There is no TLS_BUFFER_set_len() and the original kTLS code never
sets it, so not setting it on the copy either for now.

Fixes: 50ec750567 "ssl: Linux TLS Tx Offload"
Fixes #21202

Assisted-by: claude-opus-4.6

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Jun  1 07:29:13 2026
(Merged from https://github.com/openssl/openssl/pull/31146)
2026-06-01 09:29:12 +02:00
Herman Semenoff
b069590724 ssl: avoid integer overflow by casting sum terms to size_t and not the result
Avoid possible integer overflow:  instead of casting the sum to size_t,
each operand of the sum is cast to size_t before addition to avoid int
overflow.

Signed-off-by: Herman Semenoff <GermanAizek@yandex.ru>

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Jun  1 07:24:21 2026
(Merged from https://github.com/openssl/openssl/pull/30972)
2026-06-01 09:21:24 +02:00
Herman Semenoff
4d3d952b6e crypto, ssl: fix printf formats according to param types
inttypes.h is also used for more accurate compatibility with all
platforms, as it is the more correct choice according to C standard.

Signed-off-by: Herman Semenoff <GermanAizek@yandex.ru>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Jun  1 06:58:24 2026
(Merged from https://github.com/openssl/openssl/pull/30969)
2026-06-01 08:58:00 +02:00
Herman Semenoff
0642e44723 apps: fix printf formats according to param types
inttypes.h is also used for more accurate compatibility with all
platforms, as it is the more correct choice according to C standard.

Signed-off-by: Herman Semenoff <GermanAizek@yandex.ru>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Jun  1 06:58:23 2026
(Merged from https://github.com/openssl/openssl/pull/30969)
2026-06-01 08:57:22 +02:00
Dr. David von Oheimb
b91dfe382f ossl_store.pod: add reference to the 'org.openssl.winstore' scheme
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Jun  1 04:57:22 2026
(Merged from https://github.com/openssl/openssl/pull/25683)
2026-06-01 06:57:07 +02:00
Dr. David von Oheimb
8fe6f240d6 SSL_CTX_set1_verify_cert_store.pod: extend list of SEE ALSO references
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Jun  1 04:57:19 2026
(Merged from https://github.com/openssl/openssl/pull/25683)
2026-06-01 06:57:07 +02:00
Dr. David von Oheimb
2b5a525b6d doc/man3/*.pod: fix doc cert_store vs. chain_store/verify_store and PEM format
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Jun  1 04:57:17 2026
(Merged from https://github.com/openssl/openssl/pull/25683)
2026-06-01 06:57:07 +02:00
Dr. David von Oheimb
d260311c53 apps/*.c,doc/man1/*.pod.in: fix doc and error output of cert_store vs. chain_store/verify_store and PEM format
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Jun  1 04:57:15 2026
(Merged from https://github.com/openssl/openssl/pull/25683)
2026-06-01 06:57:07 +02:00
Dr. David von Oheimb
fc06875716 openssl-rehash.pod.in: fix details of the general description how input files are handled
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Jun  1 04:57:12 2026
(Merged from https://github.com/openssl/openssl/pull/25683)
2026-06-01 06:57:07 +02:00
Dr. David von Oheimb
86c4c6b3c4 apps/rehash.c: reading cert/CRL from PEM file gets no more confused by any included private keys
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Jun  1 04:57:09 2026
(Merged from https://github.com/openssl/openssl/pull/25683)
2026-06-01 06:57:07 +02:00
rootvector2
a21f77dbc9 crypto/evp: fix double free of tmp_keymgmt in sig/kem/asym init
Commit ecb4757b37 "crypto/evp/m_sigver.c: fix potential double free
on error path in do_sigver_init" has fixed double-free of tmp_keymgmt
in do_sigver_init() by setting it to NULL after EVP_KEYMGMT_free() call;
the same issue present in evp_kem_init(), evp_pkey_asym_cipher_init(),
and evp_pkey_signature_init().  Address it similarly, by setting
the pointers to NULL after *_free() calls.

Complements: ecb4757b37 "crypto/evp/m_sigver.c: fix potential double free on error path in do_sigver_init"
Fixes: 839ffdd11c "EVP: Allow a fallback for operations that work with an EVP_PKEY"
CLA: trivial

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sun May 31 11:03:15 2026
(Merged from https://github.com/openssl/openssl/pull/31312)
2026-05-31 12:55:17 +02:00
Jakub Zelenka
31d61a1ceb quic: fix handling of the first rxe mfail in qrx_process_pkt
When qrx_ensure_free_rxe() fails at the start of qrx_process_pkt() the
function returned 0 without advancing the PACKET cursor and, for the
first packet in the datagram, without setting first_dcid. The
qrx_process_datagram() loop then re-entered qrx_process_pkt() for the
same bytes with pkt_idx >= 1 and the sentinel first_dcid (id_len = 255),
tripping the assertion in qrx_validate_hdr_early() that asserts
first_dcid->id_len to be lower than QUIC_MAX_CONN_ID_LEN.

The fix goes to malformed label instead. The header has not been decoded
at this point so eop is NULL, which makes the malformed path discard the
rest of the datagram. This is because without an RXE we can process
neither this packet nor any that follow it. This also advances the
cursor and, when the failure is on the first packet, avoids leaving
first_dcid unset for the next iteration. It is consistent with the
other allocation-failure site in the function, which already routes
through malformed.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Fri May 29 14:08:56 2026
(Merged from https://github.com/openssl/openssl/pull/31316)
2026-05-29 16:08:16 +02:00
Wolfgang Beck
0c11947183 test/stack_test.c: Change structure SS typedef into TST_SS
The original name of the structure SS collides with a define set in
a Solaris system header.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri May 29 07:56:28 2026
(Merged from https://github.com/openssl/openssl/pull/31224)
2026-05-29 09:55:16 +02:00
yangxuqing
dd59758d07 slh_dsa: Remove redundant cleanup to prevent double free
Since SLH_DSA_KEY is allocated with OPENSSL_zalloc, its members are
NULL-initialized. Removing the redundant slh_dsa_key_hash_cleanup()
inside the err path of slh_dsa_key_hash_init() prevents the
double free while allowing the outer ossl_slh_dsa_key_free() to
safely handle the cleanup.

CLA: trivial

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri May 29 07:45:46 2026
(Merged from https://github.com/openssl/openssl/pull/31274)
2026-05-29 09:45:35 +02:00
Richard Levitte
d3b4e88f2d Refactor BN_mod() and BN_nnmod() arguments to match documentation
The documentation has this signature for that function:

    int BN_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
    int BN_nnmod(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);

The implementation, however, had this signature:

    #define BN_mod(rem, m, d, ctx) BN_div(NULL, (rem), (m), (d), (ctx))
    int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx);

That pattern alone trips up anyone who associates 'm' with modulus, and
and finds themselves using BN_nnmod() incorrectly.

This change modifies the argument names to match documentation.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Igor Ustinov <igus@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri May 29 07:25:31 2026
(Merged from https://github.com/openssl/openssl/pull/31304)
2026-05-29 09:25:27 +02:00
Jakub Zelenka
50fa6d38b3 quic: delay el keyslot teardown after creation in setup
There is an issue for key update in TX path if any of the operation
fails during keyslot setup (e.g. due to memory failure), the cctx stays
set to NULL which results in failed assertion in qtx_encrypt_into_txe.

The fix splits the build and installation steps in
ossl_qrl_enc_level_set_key_update so the cctx teardown is done only
after the build is successful. The install is then non fallible so it
cannot end up with empty cctx.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri May 29 07:18:36 2026
(Merged from https://github.com/openssl/openssl/pull/31268)
2026-05-29 09:18:29 +02:00
Daniel Kubec
06deb63cbb Fixes: 8b6a8a42af "Add a CHANGES.md entry"
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Thu May 28 14:30:56 2026
(Merged from https://github.com/openssl/openssl/pull/31301)
2026-05-28 16:30:53 +02:00
Nikola Pajkovsky
94fbc0254f crypto/aes/asm/asm-sha{1,256}-armv8.pl: add missing function alignment
clang-22 reported missing alignment on MacOS:

    ld: warning: arm64 function not 4-byte aligned: _asm_sha1_hmac_aescbc_dec from libcrypto.a(libcrypto-lib-aes-sha1-armv8.o)
    ld: warning: arm64 function not 4-byte aligned: _asm_sha256_hmac_aescbc_dec from libcrypto.a(libcrypto-lib-aes-sha256-armv8.o)

Add ".align 4" directives to the affected functions.

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Thu May 28 08:31:59 2026
(Merged from https://github.com/openssl/openssl/pull/31284)
2026-05-28 10:19:38 +02:00
Eugene Syromiatnikov
081901267a doc/man7/ossl-guide-migration.pod: reword DESCRIPTION section a bit
Update the wording in the DESCRIPTION section, so it is no longer implied
that OpenSSL 3.0 is something new.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Igor Ustinov <igus@openssl.foundation>
MergeDate: Thu May 28 07:36:05 2026
(Merged from https://github.com/openssl/openssl/pull/31265)
2026-05-28 09:35:59 +02:00
Jakub Zelenka
75e504782d Split mfail output into counting and injection subtests
Counting now always runs and is always checked, including when
hooks are not installed or skip-all is set. Only injection is
skipped in those cases.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Thu May 28 07:33:05 2026
(Merged from https://github.com/openssl/openssl/pull/31219)
2026-05-28 09:32:57 +02:00
Nikola Pajkovsky
91a934ff02 quic: make ch_cleanup() idempotent and simplify channel error path
ch_init() calls ch_cleanup() on its own failure, after which
port_make_channel() may still call ossl_quic_channel_free() (which calls
ch_cleanup() again). The second call double-freed fields such as
ch->qlog_title.

To handle this, ch_cleanup() now NULLs every owned pointer after its
free and clears the have_statm / have_qsm flags after their destructors,
making it safe to invoke twice on the same channel.

With ch_cleanup() idempotent, port_make_channel() no longer needs the
ch_cleaned flag and the bare OPENSSL_free(ch) branch: the error path
unconditionally calls ossl_quic_channel_free() regardless of whether
ch_init() succeeded, partially initialized the channel, or already ran
ch_cleanup() on itself.

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu May 28 07:26:22 2026
(Merged from https://github.com/openssl/openssl/pull/31177)
2026-05-28 09:26:13 +02:00
Daniel Kubec
4e8593e7eb TLS: Verify session ID to prevent incorrect session resumption
When a TLS 1.2 session is resumed via an external server-side cache
SSL_CTX_sess_set_get_cb(), the session ID stored in an SSL_SESSION is assigned
by the server at the end of the original full handshake and never modified
afterwards. The client-supplied session ID in ClientHello is copied verbatim
from the session the client cached after that same handshake. If both sides
behaved correctly, the two values are guaranteed to be identical.

This commit adds an explicit comparison inside ssl_get_prev_session() between
the session ID the client offered in ClientHello and the session ID embedded in
the SSL_SESSION returned by the external cache. If they do not match, the cached
session is released and ssl_get_prev_session() returns as a cache miss, forcing
a full handshake. Catching the mismatch here ensures the server never sends a
ServerHello that claims resumption of a session ID it cannot legitimately echo.

A mismatch unambiguously indicates one of the following:

 - a corrupt cache entry
 - an external cache implementation that returned the wrong session
 - an active tampering attempt

In all three cases refusing resumption and falling back to a full handshake is
the correct response.

Signed-off-by: Daniel Kubec <kubec@openssl.foundation>

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed May 27 12:36:49 2026
(Merged from https://github.com/openssl/openssl/pull/30517)
2026-05-27 14:36:11 +02:00
Mayank Jangid
a31d5fe8f7 test: skip verify_recover regression for FIPS
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed May 27 11:46:44 2026
(Merged from https://github.com/openssl/openssl/pull/30917)
2026-05-27 13:46:03 +02:00
Mayank Jangid
318b46e66e test: use 2048-bit RSA key for FIPS verify_recover regression
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed May 27 11:46:43 2026
(Merged from https://github.com/openssl/openssl/pull/30917)
2026-05-27 13:46:03 +02:00
Mayank Jangid
2d076cf98d test: add explicit FIPS verify_recover regression
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed May 27 11:46:42 2026
(Merged from https://github.com/openssl/openssl/pull/30917)
2026-05-27 13:46:03 +02:00
Mayank Jangid
62fa2eec5c test: skip verify_recover regression with old FIPS providers
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed May 27 11:46:41 2026
(Merged from https://github.com/openssl/openssl/pull/30917)
2026-05-27 13:46:03 +02:00
Mayank Jangid
ca519ad1d5 rsa_sig: reject short buffers in verify_recover
The RSA PKCS#1 verify-recover provider path did not validate routsize
before passing the caller buffer to ossl_rsa_verify().

The X9.31 verify-recover path already rejects undersized output buffers,
but the PKCS#1 path could proceed with too little output space and rely
on the lower layer to write the recovered digest.

Check the expected digest size before calling ossl_rsa_verify() and
return PROV_R_OUTPUT_BUFFER_TOO_SMALL when the caller-provided buffer is
too small.

Add a regression test that covers both successful recovery with a
properly sized buffer and failure with a 1-byte output buffer, while
also checking that the short buffer is left unchanged.

Co-authored-by: Kushal <72255307+Kushalkhemka@users.noreply.github.com>
Co-authored-by: Mayank <175295782+mayank-jangid-moon@users.noreply.github.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed May 27 11:46:40 2026
(Merged from https://github.com/openssl/openssl/pull/30917)
2026-05-27 13:46:03 +02:00
Bob Beck
1e6dbc7340 Convert use of artisinally made hand crafted integer types
to use the stdint.h ones.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed May 27 09:09:41 2026
(Merged from https://github.com/openssl/openssl/pull/31254)
2026-05-27 11:08:08 +02:00
Bob Beck
02b955279c use stdint in modes.h
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed May 27 09:09:41 2026
(Merged from https://github.com/openssl/openssl/pull/31254)
2026-05-27 11:08:08 +02:00
olszomal
1a55cfecca doc: match provider-asym_cipher(7) prototypes with core_dispatch.h
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed May 27 07:17:21 2026
(Merged from https://github.com/openssl/openssl/pull/31289)
2026-05-27 09:17:17 +02:00
olszomal
a419b61d53 doc: remove outdated signature_dupctx usage note
EVP_PKEY_CTX_dup() may use the provider signature dupctx callback
via EVP_DigestSignFinal() and EVP_DigestVerifyFinal().

Complements: 864b89ce49 "Move EVP_PKEY algorithm implementations into a union"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed May 27 07:06:01 2026
(Merged from https://github.com/openssl/openssl/pull/31290)
2026-05-27 09:05:50 +02:00
Daiki Ueno
41b3e51d52 doc: clarify resumption semantics with -anti_replay in s_server
Signed-off-by: Daiki Ueno <dueno@redhat.com>

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed May 27 07:01:39 2026
(Merged from https://github.com/openssl/openssl/pull/31291)
2026-05-27 09:01:36 +02:00
yangxuqing
ecb4757b37 crypto/evp/m_sigver.c: fix potential double free on error path in do_sigver_init
In do_sigver_init(), if the for loop proceeds to its second iteration
(iter = 2), the results from the first iteration (signature and
tmp_keymgmt) are explicitly freed at the beginning of the loop.
However, the pointers are not set to NULL after being freed.

If an error occurs subsequently during this second iteration (for
example, if evp_signature_fetch_from_prov() returns NULL, triggering a
goto notsupported), the control flow jumps to the generic cleanup block
at the end of the function. This cleanup block calls
EVP_KEYMGMT_free(tmp_keymgmt) again on the dangling pointer, resulting
in a double free.

This commit resolves the issue by explicitly nullifying these pointers
immediately after they are freed at the start of the loop iteration.

(Note: This issue was discussed with the OpenSSL Security Team, who
classified it as a regular bug due to lack of attacker control and
requested a public PR.)

Fixes: 839ffdd11c "EVP: Allow a fallback for operations that work with an EVP_PKEY"
CLA: trivial

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue May 26 15:28:15 2026
(Merged from https://github.com/openssl/openssl/pull/31276)
2026-05-26 17:27:02 +02:00
Daniel Kubec
d73ad5615c test/tls13tickettest.c: check SSL_TICKET_NO_DECRYPT path in tls_parse_ctos_psk()
Add a test that rotates ticket keys so that the previously issued ticket
can no longer be decrypted:  if session resumption fails
due to a NO_DECRYPT, it is expected to fall back to a full handshake,
and a new session ticket is issued.

Complements: 6115286fae "TLSv1.3: reissue session ticket after full handshake on ciphersuite mismatch"
References: https://github.com/openssl/openssl/pull/30626

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue May 26 15:20:59 2026
(Merged from https://github.com/openssl/openssl/pull/31223)
2026-05-26 17:20:47 +02:00
Eugene Syromiatnikov
700e962aa0 crypto/cmp/cmp_genm.c: avoid strcat() in get_genm_itav()
There is no need to use strcat() there, as it concatenates into a string
that is used in a format string anyway.  Put the literal prefix
into the format string and avoid literal string copying.

Fixes: d477484d33 "CMP: add support for genm/genp messages with id-it-caCerts"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
MergeDate: Tue May 26 14:54:19 2026
(Merged from https://github.com/openssl/openssl/pull/31230)
2026-05-26 16:54:12 +02:00
Daniel Kubec
be27d28c61 CHANGES.md: mention tickets disabling on set SSL_OP_NO_TICKET|SSL_SESS_CACHE_OFF
Complements: e5a18924e2 "TLS1.3: Disable tickets when SSL_OP_NO_TICKET and SSL_SESS_CACHE_OFF are set."

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Tue May 26 14:40:46 2026
(Merged from https://github.com/openssl/openssl/pull/31288)
2026-05-26 16:39:08 +02:00
Andrew Dinh
43b3a7b97d util: add acvp-test util
Add a Python script acvp-test to the util/ directory, that tests
an OpenSSL binary against the NIST ACVTS demo server.  acvp-test util
supports most major algorithms, including PQC algorithms added in 3.5.

Usage:

    $ ./acvp-test.py --help
    usage: acvp-test.py [-h] [--algorithm ALGO] [--direction {encrypt,decrypt}
    [{encrypt,decrypt} ...]] [--key-len BITS [BITS ...]] [--production]
    [--save-vectors]

    Test an OpenSSL binary against the NIST ACVTS demo server.

    options:
      -h, --help            show this help message and exit
      --algorithm ALGO      Algorithm to test (default: ACVP-AES-CBC)
      --direction {encrypt,decrypt} [{encrypt,decrypt} ...]
                            Direction(s) for symmetric algorithms (default: both)
      --key-len BITS [BITS ...]
                            Key length(s) in bits for symmetric algorithms (default: all)
      --production          Run as a production validation (default: sample/demo mode)
      --save-vectors        Save downloaded vector sets to vectors_vsNNN.json

    Supported algorithms: ACVP-AES-CBC, ACVP-AES-CTR, ACVP-AES-ECB,
    HMAC-SHA2-256, HMAC-SHA2-384, HMAC-SHA2-512, ML-DSA-keyGen, ML-DSA-sigGen,
    ML-DSA-sigVer, ML-KEM-keyGen, SHA2-256, SHA2-384, SHA2-512, SHA3-256,
    SHA3-384, SHA3-512, SLH-DSA-keyGen, SLH-DSA-sigGen, SLH-DSA-sigVer

Example:

    $ ./acvts_openssl_test.py --algorithm ML-KEM-keyGen --save-vectors
    [*] Algorithm : ML-KEM-keyGen
    [*] Capability: {"algorithm": "ML-KEM", "mode": "keyGen", "revision": "FIPS203", "parameterSets": ["ML-KEM-512", "ML-KEM-768", "ML-KEM-1024"]}
    [*] Binary    : {OPENSSL_INSTALL_PATH}/bin/openssl
    [*] Sample    : True
    [+] Logged in  sizeConstraint=-1
    [+] Session 724608 created  vectorSets=['3824260']
      [~] VS 3824260 not ready, waiting 30s...
    [+] Downloaded VS 3824260
    [+] Saved vectors → vectors_vs3824260.json
    [+] Running OpenSSL for VS 3824260...
    [+] Uploaded results for VS 3824260
      [~] VS 3824260 grading, waiting 30s...
      [~] VS 3824260 grading, waiting 30s...
      [~] VS 3824260 grading done
    [PASS] VS 3824260  disposition=passed  failed_tcs=0
    [*] Sample session — skipping certify (not allowed for sample sessions)

Resolves: https://github.com/openssl/project/issues/1941
References: https://github.com/openssl/project/issues/994
References: https://github.com/openssl/project/issues/998
References: https://github.com/openssl/project/issues/1935

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue May 26 14:33:33 2026
(Merged from https://github.com/openssl/openssl/pull/31045)
2026-05-26 16:28:30 +02:00
Andrew Dinh
b57aef71b3 test/quicapitest.c: add test to check inner SSL
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue May 26 14:12:49 2026
(Merged from https://github.com/openssl/openssl/pull/31257)
2026-05-26 16:12:32 +02:00
Andrew Dinh
76a95bae2e quic_impl.c: pass correct SSL to ossl_ssl_connection_new_int in ossl_quic_new_from_listener
In ossl_quic_new_from_listener(), the call to ossl_ssl_connection_new_int()
was passing NULL for the user_ssl parameter.  NULL causes s->user_ssl
to be set to the inner TLS ssl object, so the inner SSL object points
to itself rather than to the outer QUIC connection object.

The fix passes &qc->obj.ssl instead of NULL.  Afterwards,
ossl_quic_obj_init() will initialize &qc->obj.ssl in place.

Resolves: https://github.com/openssl/project/issues/989
Fixes: 0b15147a37 "Implement SSL_new_from_listener()"

Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue May 26 14:12:45 2026
(Merged from https://github.com/openssl/openssl/pull/31257)
2026-05-26 16:12:17 +02:00
kovan
d60fad179e doc: add SSL/SSL_CTX thread safety section to openssl-threads
Add explicit documentation about thread safety of SSL and SSL_CTX
objects, clarifying that:
- SSL_CTX can be shared among threads but should be treated as
  read-only after creating SSL objects or sharing across threads
- SSL connection objects should only be used by one thread at a time
- Each thread handling TLS connections should create its own SSL object

Fixes #23446

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 13bce9ed63)

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
MergeDate: Tue May 26 13:19:35 2026
(Merged from https://github.com/openssl/openssl/pull/29847)
2026-05-26 13:58:35 +01:00
Kim Brose
825c317012 doc/man1/openssl-format-options.pod: fix example EB for RFC 7468 compliance
The encapsulation boundaries as given in the example should comply
to the referenced RFC 7468, as well as match other places in openssl.

Fixes: 777182a0c7 "Document the -inform, etc., in openssl.pod"
CLA: trivial

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Tue May 26 11:54:49 2026
(Merged from https://github.com/openssl/openssl/pull/31282)
2026-05-26 13:52:21 +02:00
yangxuqing
82befaf246 providers: Nullify BIO pointer after free to prevent double free
In providers/implementations/storemgmt/file_store_any2obj.c, if the
control flow reaches the err label after BIO_free(in) is called, a
double free will occur in the generic cleanup block.

Currently, the only path to this specific err jump is if
BUF_MEM_grow(mem, len) fails. As noted by the OpenSSL Security Team,
this failure is currently impossible because the buffer is being
shrunk (max_len >= len).

However, as requested by the security team via email, this commit
explicitly nullifies the in pointer after the first free to
future-proof the function and prevent a double free in case the
semantics of BUF_MEM_grow() or the surrounding logic change in
the future.

Fixes: 1b0f21f055 "Implementing store support for EVP_SKEY"
CLA: trivial

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue May 26 10:14:50 2026
(Merged from https://github.com/openssl/openssl/pull/31275)
2026-05-26 12:14:29 +02:00
Jakub Zelenka
04cf7eb7b9 ssl/quic/quic_ackm.c: fix unhandled memory failure in tx pkt history map insert
This can cause error when freeing txpim as it can be still in use so the
assert in it fails.

Fixes: fa4e92a70a "QUIC ACK Manager, Statistics Manager and Congestion Control API"

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue May 26 09:59:05 2026
(Merged from https://github.com/openssl/openssl/pull/31258)
2026-05-26 11:58:41 +02:00
Ahmed Rabea
7f98abc730 crypto/dso/dso_win32.c: fix win32_joiner buffer sizing for dir-only paths
win32_joiner() always emits a trailing '\' when file_split->dir
is present, even if file_split->file is NULL. The previous length
calculation only reserved that byte when file_split->file was also
non-NULL, which could cause a one-byte overflow.

Resolves: https://github.com/openssl/openssl/issues/31260
Fixes: cbecb3ac37 "There's an ongoing project to bring some kind of path selection mechanism to the ENGINE framework.  This means there there are going to be new functionality for the DSO part, and ultimately some way of merging two file specifications together.
CLA: trivial

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 May 26 09:36:02 2026
(Merged from https://github.com/openssl/openssl/pull/31266)
2026-05-26 11:34:50 +02:00
Bob Beck
3a1aea4ff3 Document OSSL_BEGIN_ALLOW_DEPRECATED OSSL_END_ALLOW_DEPRECATED
As these are public by necessity, we may as well allow folks
to use them to selectively disable deprecation warnings if they
wish to temporarily use deprecated functions in limited locations
in their code.

Complements: 4036f4b0e3 "Add new public API for checking certificate times."

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue May 26 09:22:58 2026
(Merged from https://github.com/openssl/openssl/pull/31270)
2026-05-26 11:22:56 +02:00
Eugene Syromiatnikov
77614b61b1 crypto/objects/obj_dat.c: return strlcpy result in OBJ_obj2txt()
strlcpy() (and OPENSSL_strlcpy() after it) returns the length
of the input string as a result, don't throw it away just to calculate
it once again on return.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
MergeDate: Tue May 26 08:58:27 2026
(Merged from https://github.com/openssl/openssl/pull/31226)
2026-05-26 10:57:56 +02:00
mat
afaa70c1a6 test: add regression test for ciphersuite_cb() with empty list elements
Cover the three cases where CONF_parse_list() produces a NULL/empty
element: leading separator, trailing separator, and consecutive
separators (double colon).  Before the fix these would crash via a
NULL memcpy inside ciphersuite_cb().

Each case also verifies via SSL_CTX_get_ciphers() that the valid
ciphersuite(s) in the same string were actually applied, not just
that the call returned without crashing.

Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue May 26 08:56:53 2026
(Merged from https://github.com/openssl/openssl/pull/31023)
2026-05-26 10:56:32 +02:00
mat
dbf949c4b2 ssl: guard ciphersuite_cb() against NULL elem from CONF_parse_list
CONF_parse_list() invokes its callback with elem=NULL and len=0 for
empty list elements (e.g. consecutive separators like "A::B").
ciphersuite_cb() passed elem directly to memcpy() without checking for
NULL, triggering undefined behaviour on any input containing an empty
ciphersuite token.

Skip empty elements early by returning 1 before any pointer dereference.

Fixes #30919

Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue May 26 08:56:52 2026
(Merged from https://github.com/openssl/openssl/pull/31023)
2026-05-26 10:56:32 +02:00
Bob Beck
e5029e3ed2 Make IPAddressFamily_cmp safe for 0 length objects with NULL data.
Found while adjusting the fuzzer to test for the requirement to
add NUL bytes on the end of ASN1 Strings. If we end up with a 0
length object here we can end up in a crash with memcmp.

This makes this cmp function test comparison like our others
that are 0 length object safe.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue May 26 08:51:35 2026
(Merged from https://github.com/openssl/openssl/pull/31201)
2026-05-26 10:51:27 +02:00
Adriano Sela Aviles
ffe6b8d693 Add Ed25519 certificates Support for DTLS 1.2
Resolves: https://github.com/openssl/openssl/issues/20122
Signed-off-by: Adriano Sela Aviles <adriano.selaviles@gmail.com>

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue May 26 08:34:42 2026
(Merged from https://github.com/openssl/openssl/pull/30007)
2026-05-26 10:33:48 +02:00
Michael Richardson
83ef5622a6 d2i_* docs: clarify how reuse is used, and how to set libctx and propq
Also removed BUGS section

Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Thu May 21 09:14:32 2026
(Merged from https://github.com/openssl/openssl/pull/28456)
2026-05-21 11:13:07 +02:00
Jakub Zelenka
fad1c77059 Add mfail test for ossl_ht_free
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu May 21 09:09:37 2026
(Merged from https://github.com/openssl/openssl/pull/31237)
2026-05-21 11:09:28 +02:00
Jakub Zelenka
f99ffceb4b Optimize hashtable without rcu freeing
It is not necessary to flush table for hash tables without rcu.

This is follow up to https://github.com/openssl/openssl/pull/31163

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu May 21 09:09:36 2026
(Merged from https://github.com/openssl/openssl/pull/31237)
2026-05-21 11:09:28 +02:00
Jakub Zelenka
37575a2519 Ignore memfail test binaries
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu May 21 09:05:24 2026
(Merged from https://github.com/openssl/openssl/pull/31221)
2026-05-21 11:05:19 +02:00
Dmitry Belyavskiy
ea75fbb18c Remove copy/paste remnants from ancient times
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu May 21 09:03:28 2026
(Merged from https://github.com/openssl/openssl/pull/31216)
2026-05-21 11:03:22 +02:00
Nikola Pajkovsky
70741ee62a Configurations/unix-Makefile.tmpl: make cleanup faster
Walk the source tree once instead of thrice when removing generated
dependency files, object files, and symlinks;  avoid descending into
submodules.

Co-Authored-by: Eugene Syromiatnikov <esyr@openssl.org>
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu May 21 09:02:44 2026
(Merged from https://github.com/openssl/openssl/pull/31212)
2026-05-21 11:02:37 +02:00
Jakub Zelenka
9674d08e18 Fix null derefs in ossl_quic_new_listener on mfail
This is caused incorrect err cleanup of mutex even if ql does not exist
(allocation failed).

It also fixes missing freeing of ports that result in assertion failure
because engine port list is not empty.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu May 21 08:52:14 2026
(Merged from https://github.com/openssl/openssl/pull/31112)
2026-05-21 10:52:05 +02:00
Bob Beck
06486c1281 fix cmp mock server to not depend on NUL bytes in ASN1_STRING
ASN1_STRING is documented that the behavior of NUL byte addition
should not be depended upon.

The mock server calls strcmp on the bare data from an ASN1_STRING.
This only works if the data is NUL terminated.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
MergeDate: Wed May 20 16:01:47 2026
(Merged from https://github.com/openssl/openssl/pull/31202)
2026-05-20 11:57:48 -04:00
Nikola Pajkovsky
b1389437f5 stack: use a copy thunk for typed stack deep copies
typed safestack wrappers pass type-specific copy callbacks such as
TYPE *(*)(const TYPE *) to OPENSSL_sk_deep_copy().  The generic stack code
then called those callbacks through OPENSSL_sk_copyfunc,
void *(*)(const void *), which is an incompatible function pointer type and
triggers UBSan.

Add an OPENSSL_sk_copyfunc_thunk and store it on typed stacks, mirroring the
existing compare/free thunk pattern.  Generated safestack helpers now install
a per-type copy thunk when constructing a stack, and internal_copy() uses that
thunk when deep-copying typed stacks.  This preserves the generic stack API
while ensuring typed copy callbacks are invoked through their real signature.

Fixes: https://github.com/openssl/project/issues/1951
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed May 20 15:53:45 2026
(Merged from https://github.com/openssl/openssl/pull/31151)
2026-05-20 11:53:32 -04:00
Nikola Pajkovsky
74edd30c9f stack: use free thunk when deep copy cleanup fails
internal_copy() used the generic OPENSSL_sk_freefunc directly when a deep
copy failed after copying some elements.  For typed stacks, callers pass
type-specific free callbacks that have been cast to OPENSSL_sk_freefunc, so
calling them through the generic function pointer type is undefined behavior.

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

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed May 20 15:53:43 2026
(Merged from https://github.com/openssl/openssl/pull/31151)
2026-05-20 11:53:32 -04:00
Nikola Pajkovsky
0b555646d0 stack: sk_<t1>_new_null() constructor is missing the OPENSSL_sk_set_cmp_thunks()
crypto/bsearch.c:33:17: runtime error: call to function int_compare through pointer to incorrect function type 'int (*)(const void *, const void *)'
/home/npajkovsky/openssl/openssl/test/stack_test.c:46: note: int_compare defined here

Fixes: https://github.com/openssl/project/issues/1950
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed May 20 15:53:41 2026
(Merged from https://github.com/openssl/openssl/pull/31151)
2026-05-20 11:53:32 -04:00
Nikola Pajkovsky
c84affae0b evp: avoid function-pointer-type UB in EVP_*_do_all_provided
evp_generic_do_all() invokes its callback through a fixed pointer type
of the form "void (*)(void *method, void *arg)". The public
EVP_*_do_all_provided() wrappers were handing it user callbacks of type
for example:

   void (*)(EVP_MD *, void *)

cast to that generic shape:

    evp_generic_do_all(..., (void (*)(void *, void *))fn, arg, ...);

Calling a function through a pointer whose type does not match the
function's actual definition is undefined behavior in C and is flagged
by UBSan's -fsanitize=function.

Introduce a per-type thunk generated by EVP_DO_ALL_PROVIDED_THUNK that
has the exact signature evp_generic_do_all() expects. The thunk
receives the user's typed callback and arg in a small on-stack struct
and forwards them with the correct types, so every indirect call now
matches the pointee's real prototype.
No functional change intended.

Fixes: https://github.com/openssl/project/issues/1949
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed May 20 15:53:38 2026
(Merged from https://github.com/openssl/openssl/pull/31151)
2026-05-20 11:53:32 -04:00
Nikola Pajkovsky
0c0c4e8c64 skeymgmt_meth: avoid function-pointer-type UB
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed May 20 15:53:36 2026
(Merged from https://github.com/openssl/openssl/pull/31151)
2026-05-20 11:53:24 -04:00
Daniel Kubec
e5a18924e2 TLS1.3: Disable tickets when SSL_OP_NO_TICKET and SSL_SESS_CACHE_OFF are set.
Do not issue TLS 1.3 session tickets if the server has explicitly disabled
them via SSL_OP_NO_TICKET and also disabled the session cache with
SSL_SESS_CACHE_OFF. Together, these settings clearly indicate an intent to
suppress session resumption; sending NewSessionTicket messages in this case
would be wasteful and misleading.

From the server’s perspective, a client that does not advertise
psk_key_exchange_modes in TLS 1.3, or that sends it with RFC 9149 parameters
such as new_session_count = 0 or resumption_count = 0, is effectively
signaling no interest in session tickets or resumption.

RFC 8446 section 4.2.9: Servers MUST NOT select a key exchange mode that is
not listed by the client. This extension also restricts the modes for use
with PSK resumption. Servers SHOULD NOT send NewSessionTicket with tickets
that are not compatible with the advertised modes; however, if a server does
so, the impact will just be that the client's attempts at resumption fail.

Fixes #8077

Signed-off-by: Daniel Kubec <kubec@openssl.foundation>

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed May 20 15:42:00 2026
(Merged from https://github.com/openssl/openssl/pull/30639)
2026-05-20 17:41:40 +02:00
Weidong Wang
e6f5ed33f1 Add test for SSL_SESSION leak on ticket abort in tls_parse_ctos_psk()
Add test_ticket_abort_session_leak() to verify that returning
SSL_TICKET_RETURN_ABORT from the decrypt ticket callback during TLS 1.3
resumption does not leak the SSL_SESSION allocated by tls_decrypt_ticket().
This exercises the error path fixed in commit 96f424c439.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed May 20 14:38:04 2026
(Merged from https://github.com/openssl/openssl/pull/30464)
2026-05-20 10:37:56 -04:00
Weidong Wang
df29f02425 Fix SSL_SESSION leak in tls_parse_ctos_psk() on ticket error paths
Two early 'return 0' statements bypass the err: label cleanup that
calls SSL_SESSION_free(sess). When tls_decrypt_ticket() allocates an
SSL_SESSION but the decrypt_ticket_cb returns ABORT, the session is
leaked. Replace 'return 0' with 'goto err' so the existing cleanup
handles it.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed May 20 14:38:01 2026
(Merged from https://github.com/openssl/openssl/pull/30464)
2026-05-20 10:37:56 -04:00
Nikola Pajkovsky
7194354488 fix UB in priority_queue
clang-22 reports UB during test make test V=0 TESTS=test_priority_queue

ssl/priority_queue.c:159:13: runtime error: call to function size_t_compare through pointer to incorrect function type 'int (*)(const void *, const void *)'
/home/npajkovsky/openssl/openssl/test/priority_queue_test.c:28: note: size_t_compare defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ssl/priority_queue.c:159:13

Fixes: https://github.com/openssl/project/issues/1953
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue May 19 10:43:59 2026
(Merged from https://github.com/openssl/openssl/pull/31209)
2026-05-19 12:43:54 +02:00
Eugene Syromiatnikov
14306ff118 Configure: update $apitable with the recent versions
Fill $apitable with all the major.minor.0 versions up to the current one
in development.  Note that while 3.5 hasn't had any APIs deprecated,
it still makes sense to support passing it as an "API level".

Resolves: https://github.com/openssl/openssl/issues/31196
Reported-by: Oliver Roberts <oliver@futaura.co.uk>
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Tue May 19 09:33:49 2026
(Merged from https://github.com/openssl/openssl/pull/31198)
2026-05-19 11:33:43 +02:00
Moryakhin Stas
bc848990fa Fix app param memory cleaning
Fixes #31149

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon May 18 11:12:39 2026
(Merged from https://github.com/openssl/openssl/pull/31170)
2026-05-18 13:12:27 +02:00
Eugene Syromiatnikov
bdd9d9630b ssl/d1_lib.c: remove g_probable_mtu array
Its last actual user was removed in 1620a2e49c "Fix dtls_query_mtu
so that it will always either complete with an mtu that is at least
the minimum or it will fail.", and the only remaining user,
dtls1_link_min_mtu(), just returns its last element unconditionally.
Remove g_probable_mtu and convert dtls1_link_min_mtu into a static const
containing the value.

Complements: 1620a2e49c "Fix dtls_query_mtu so that it will always either complete with an mtu that is at least the minimum or it will fail."
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Mon May 18 11:09:52 2026
(Merged from https://github.com/openssl/openssl/pull/31175)
2026-05-18 13:09:46 +02:00
Abel Tom
413eff874d OBJ_bsearch_ex_(): Fix const qualifier warning with CHARSET_EBCDIC
Fixes #31161

When building with CHARSET_EBCDIC defined,the compiler warns about
discarding the 'const' qualifier when assigning from base_[i * size]
to the non-const pointer p1:

`warning: assignment discards 'const' qualifier from pointer target type`

Change p1 from 'char *' to 'const char *' to maintain const-correctness
since the data being pointed to should not be modified through this
pointer.

Additionally, remove the unused variables l and h that were left over
from a previous implementation of the fallback linear search. These
variables served no purpose and only generated unused variable warnings.

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon May 18 11:07:53 2026
(Merged from https://github.com/openssl/openssl/pull/31173)
2026-05-18 13:07:01 +02:00
Bob Beck
2b5d69caca Deprecate UTF8_putc/getc() and use uint32_t for unicode
Unicode codepoints fit in 32 bits so we can use uint32_t
instead of unsigned long.

Also use OPENSSL_load_XX_be instead of manual shifting.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Mon May 18 11:02:37 2026
(Merged from https://github.com/openssl/openssl/pull/30967)
2026-05-18 13:00:12 +02:00
Jakub Zelenka
80f97a9072 Fix UAF if QUIC channel init fails
This happens because port does not get reset on the first freeing in
channel block so when it is being freed again in ossl_quic_new, it
tries to access item in port.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon May 18 10:50:23 2026
(Merged from https://github.com/openssl/openssl/pull/31109)
2026-05-18 12:50:17 +02:00
Norbert Pocs
b3bfc7bf55 Use valid DH peer pubkey in the KAT tests
Co-authored-by: Viktor Dukhovni <viktor@openssl.org>
Signed-off-by: Norbert Pocs <norbertp@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon May 18 07:34:16 2026
(Merged from https://github.com/openssl/openssl/pull/31171)
2026-05-18 09:34:04 +02:00
Kit Dallege
e3673581f9 doc: Add documentation for DTLS MTU functions
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Mon May 18 07:33:03 2026
(Merged from https://github.com/openssl/openssl/pull/29901)
2026-05-18 09:32:59 +02:00
Eugene Syromiatnikov
9a6af0f614 test/mem_alloc_test.c: fix my_malloc/my_realloc behaviour on size == 0
That puts them more in line with CRYPTO_malloc() and CRYPTO_realloc()
behaviour, whose behaviour for the requested size of 0 is well-documented
and not "implementation-defined", as POSIX allows.

Fixes: d090695101 "test: add a sanity test for memory allocation functions"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon May 18 07:30:49 2026
(Merged from https://github.com/openssl/openssl/pull/31158)
2026-05-18 09:30:43 +02:00
Eugene Syromiatnikov
95acbe6b4e test/mem_alloc_test.c: increase alloc size for triggering OOM malloc failure
While half of the address space is enough to make malloc() fail on
kernels of the same bitness, 32-bit compat can have enough to accommodate
such a request, and even three fourth of the address space.  Bump
the requested size closer to the type's upper limit.

Fixes: d090695101 "test: add a sanity test for memory allocation functions"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon May 18 07:30:48 2026
(Merged from https://github.com/openssl/openssl/pull/31158)
2026-05-18 09:30:43 +02:00
Adraca
1e5d536b05 Harden SSL_set_session_ticket_ext and add docs
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon May 18 07:27:55 2026
(Merged from https://github.com/openssl/openssl/pull/31022)
2026-05-18 09:27:54 +02:00
Jakub Zelenka
783388e3c6 Extend and separate mfail test framework
Separate the mfail framework so it can be used beyond testutil.
Specifically, this is a step toward using it in fuzzing.

This change also improves the way mfail tests are executed. It first
counts the number of allocations and then iterates through them.

This has a couple of advantages:
- It allows removal of MFAIL_SLOW_TEST by identifying slow tests based
  on the number of allocations.
- It allows non-failing tests to be ignored.

In addition, it adds a new environment variable to print a backtrace on
memory failure.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon May 18 07:23:52 2026
(Merged from https://github.com/openssl/openssl/pull/31144)
2026-05-18 09:23:43 +02:00
Norbert Pocs
bf4f348471 Move curve448 intrinsic headers to .inc
They are included only to one header.

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon May 18 07:03:50 2026
(Merged from https://github.com/openssl/openssl/pull/31153)
2026-05-18 09:03:29 +02:00
Norbert Pocs
7a3a7df9d0 Tell clang-tidy which header exports timeval struct
IWYU pragma: export, tells IWYU tools that the timeval struct is
imported from this header file instead of including <sys/time.h>
everywhere.

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon May 18 07:03:49 2026
(Merged from https://github.com/openssl/openssl/pull/31153)
2026-05-18 09:03:29 +02:00
Norbert Pocs
c662dfbc63 providers/implementation: Generate header includes for .inc files
Make these headers self contained even as they are .inc files. This
approach makes it a lot easier to achieve self contained files and
protects from include reorders. (where the .inc can get above the
dependent headers)

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon May 18 07:03:48 2026
(Merged from https://github.com/openssl/openssl/pull/31153)
2026-05-18 09:03:29 +02:00
Norbert Pocs
4dce5bc2ee a_strnid: put includes together
clang-tidy calculates where to place the headers to be added. The
maximum is the latest include present in the file.  Therefore the
algorithm sometimes addes the includes wrongly in the middle of the
file.

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon May 18 07:03:47 2026
(Merged from https://github.com/openssl/openssl/pull/31153)
2026-05-18 09:03:29 +02:00
007bsd
012cc567d0 Fix function pointer type mismatch when freeing ECX keys
ossl_ecx_key_free is declared as void(ECX_KEY *) but registered
directly in the X25519/X448/Ed25519/Ed448 keymgmt OSSL_DISPATCH
tables for OSSL_FUNC_KEYMGMT_FREE, which is invoked through a
void(*)(void *) pointer in evp_keymgmt_freedata. Calling a function
through a pointer to an incompatible function type is undefined
behavior and is reported by UndefinedBehaviorSanitizer on every
ECX key free:

    crypto/evp/keymgmt_meth.c:392:5: runtime error: call to function
      ossl_ecx_key_free through pointer to incorrect function type
      'void (*)(void *)'
    crypto/ec/ecx_key.c:65: note: ossl_ecx_key_free defined here

All four algorithms share the same MAKE_KEYMGMT_FUNCTIONS dispatch
macro, so they hit the same UB; UBSan just deduplicates the report
on the first call.

Mirror the wrapper pattern used by ml_kem_free_key, ml_dsa_free_key,
slh_dsa_free_key, dsa_freedata, ec_freedata, and lms_free_key: add
a small static ecx_free_key with the correct OSSL_FUNC_keymgmt_free_fn
signature that forwards to ossl_ecx_key_free, and register the
wrapper in the dispatch macro. The existing direct callers of
ossl_ecx_key_free in ecx_kmgmt.c are unchanged since they pass a
typed ECX_KEY *.

CLA: trivial

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu May 14 09:31:58 2026
(Merged from https://github.com/openssl/openssl/pull/31078)
2026-05-14 11:31:27 +02:00
007bsd
1a1f568798 Fix function pointer type mismatch when freeing ML-KEM keys
ossl_ml_kem_key_free is declared as void(ML_KEM_KEY *) but registered
directly in the ML-KEM keymgmt OSSL_DISPATCH table for
OSSL_FUNC_KEYMGMT_FREE, which is invoked through a void(*)(void *)
pointer in evp_keymgmt_freedata. Calling a function through a pointer
to an incompatible function type is undefined behavior and is
reported by UndefinedBehaviorSanitizer on every ML-KEM key free:

    crypto/evp/keymgmt_meth.c:392:5: runtime error: call to function
      ossl_ml_kem_key_free through pointer to incorrect function type
      'void (*)(void *)'
    crypto/ml_kem/ml_kem.c:1751: note: ossl_ml_kem_key_free defined here

Mirror the wrapper pattern used by ml_dsa_free_key, slh_dsa_free_key,
dsa_freedata, ec_freedata, and lms_free_key: add a small static
ml_kem_free_key with the correct OSSL_FUNC_keymgmt_free_fn signature
that forwards to ossl_ml_kem_key_free, and register the wrapper in
the dispatch table. The existing direct callers of
ossl_ml_kem_key_free in ml_kem_kmgmt.c are unchanged since they pass
a typed ML_KEM_KEY *.

CLA: trivial

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu May 14 09:31:57 2026
(Merged from https://github.com/openssl/openssl/pull/31078)
2026-05-14 11:31:27 +02:00
Tomas Mraz
af87fcd259 Use CRYPTO_memcmp() when comparing the private keys
ML-DSA and SLH-DSA used regular memcmp, use CRYPTO_memcmp()
just in case.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
MergeDate: Thu May 14 09:29:14 2026
(Merged from https://github.com/openssl/openssl/pull/31155)
2026-05-14 11:29:09 +02:00
Jakub Zelenka
15bf86e1f7 Fix memleak in hashtable free if flush fails
This happens because free_oldmd is not run when flush fails

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu May 14 09:26:11 2026
(Merged from https://github.com/openssl/openssl/pull/31163)
2026-05-14 11:26:03 +02:00
Eugene Syromiatnikov
6bad7fb0ae doc/man7/EVP_CIPHER-DES.pod: remove trailing whitespace
Remove trailing whitespace to address the following find-doc-nits
warnings:

    WARNING: line containing nothing but whitespace in paragraph at line 65 in file doc/man7/EVP_CIPHER-DES.pod
    WARNING: line containing nothing but whitespace in paragraph at line 69 in file doc/man7/EVP_CIPHER-DES.pod

Fixes: 5ff19a7297 "docs: Document required output buffer length in EVP_CIPHER-DES"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
MergeDate: Thu May 14 09:24:31 2026
(Merged from https://github.com/openssl/openssl/pull/31141)
2026-05-14 11:24:25 +02:00
Matt Caswell
7836b7d5b6 Revert "Preserve connection custom extensions in SSL_set_SSL_CTX()"
This reverts commit 403ba31a02.

PR #27706 (that this PR reverts) was intended to fix nginx/nginx#711

The problem was that when calling SSL_set_SSL_CTX() from an SNI callback
when using a QUIC object, the QUIC custom extensions were not being
handled correctly. The fix attempted to resolve this to make sure that
they were correctly being copied.

However, in reality there was a bug in the SNI callback code that meant when
we called it from a QUIC connection we were passing the *inner* TLS
object instead of the real QUIC one. The *inner* TLS object should be
entirely internal and not exposed to user callbacks. This bug was fixed in
dc84829cc5.

Once the above fix was in place `SSL_set_SSL_CTX()` immediately fails when
called with a QUIC object via the SNI callback. This was always the
intended behaviour - its use with a QUIC object was blocked since the very
beginning - but the fact that we passed the inner TLS object by mistake
circumvented the check when it was invoked from the SNI callback.

The fix in dc84829cc5 actually landed *before* the commit that this PR
reverts. So, in reality the nginx bug was already "fixed" by the time
that PR #27706 was merged (fixed in the sense that the invocation of
`SSL_set_SSL_CTX()` fails gracefully). The code that it introduced can not
be reached (and never could be) because calling `SSL_set_SSL_CTX()` is
explicitly blocked when using a QUIC object. Therefore we should remove
this dead code.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed May 13 16:23:24 2026
(Merged from https://github.com/openssl/openssl/pull/31159)
2026-05-13 18:23:16 +02:00
Tomas Mraz
5b2abf8f9c test/ffc_internal_test.c: The ffc_params_copy_mfail test needs DSA enabled
Instead of having disabled with no-dh, we need to disable it
with no-dsa.

Fixes: df53ee4fa0 "Add mfail test for ossl_ffc_params_copy"

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed May 13 09:46:34 2026
(Merged from https://github.com/openssl/openssl/pull/31168)
2026-05-13 11:46:14 +02:00
Matt Caswell
be02e62560 Add a note in the docs about the new PSK alert behaviour
We now fail with the same alert as if the binder failed to verify.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed May 13 07:38:34 2026
(Merged from https://github.com/openssl/openssl/pull/31026)
2026-05-13 09:38:10 +02:00
Matt Caswell
17bd94fbd6 Add a test for bad PSK in a PSK only server
Check that we fail with a decrypt_alert in the same way as a binder
validation failure

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed May 13 07:38:33 2026
(Merged from https://github.com/openssl/openssl/pull/31026)
2026-05-13 09:38:10 +02:00
Matt Caswell
0f607c776c Treat an unknown PSK identity the same way as a binder validation failure
Doing things this way removes the possibility of an attacker probing for
valid PSK identities as described in Appendix E.6 of RFC8446. This only
make a difference in a PSK only server configuration. The signal will still
exist if the server can fallback to a full handshake.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed May 13 07:38:32 2026
(Merged from https://github.com/openssl/openssl/pull/31026)
2026-05-13 09:38:10 +02:00
Daniel Kubec
68518d5dc2 CRL: Refactoring and tests for extensions, entries, and serial number duplicates
Refactoring and added tests for extensions, entries, and serial number
duplicates. The tests intentionally reflect the current behavior and existing
error states, which are not always clearly distinguished (e.g., duplicate
extensions vs. parsing errors). This serves as a baseline; follow-up work may
improve error handling or explicitly mark some cases as wontfix.

Signed-off-by: Daniel Kubec <kubec@openssl.foundation>

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Wed May 13 07:36:49 2026
(Merged from https://github.com/openssl/openssl/pull/30349)
2026-05-13 09:36:38 +02:00
Abel Tom
35f91b9e00 Fixes #30979: Added BN_CTX_end before free in sm2_sign and sm2_crypt.
Added `BN_CTX_end` call before `BN_CTX_free` to keep the pattern
consistent with functions like `sm2_sig_verify`, `sm2_sig_gen`,
for instance.

Added missing `BN_CTX_start()` and `BN_CTX_end()` calls in
`ossl_sm2_compute_z_digest`. Fixed formatting.

Fixes: 3d328a445c "Add SM2 signature and ECIES schemes"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Wed May 13 07:24:17 2026
(Merged from https://github.com/openssl/openssl/pull/31069)
2026-05-13 09:24:09 +02:00
Norbert Pocs
e24c53980f Fix circular dependency between macros.h and opensslconf.h
Signed-off-by: Norbert Pocs <norbertp@openssl.org>

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Wed May 13 07:22:27 2026
(Merged from https://github.com/openssl/openssl/pull/31142)
2026-05-13 09:22:23 +02:00
huanghuihui0904
f9a24a30e9 apps/lib/tlssrp_depr.c: fix leak of vb in set_up_srp_verifier_file()
set_up_srp_verifier_file() allocates srp_callback_parm->vb via SRP_VBASE_new().
If SRP_VBASE_init() fails, vb must be freed before returning.

Additionally, add SRP_VBASE_free() to the end: cleanup path in s_server.c so
that vb is also freed on normal program exit.

Solves https://github.com/openssl/openssl/issues/30362
Fixes #30362

Signed-off-by: huanghuihui0904 <625173@qq.com>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Wed May 13 07:20:48 2026
(Merged from https://github.com/openssl/openssl/pull/30434)
2026-05-13 09:20:47 +02:00
Nikola Pajkovsky
de68b193a5 quic: fix incoming port cleanup on failure
port_make_channel() builds an incoming QUIC channel in stages: allocate
the channel, create the user SSL and inner TLS objects, optionally copy
qlog state, then initialise the channel. Under the mfail allocator,
failures in the middle of that sequence could leave ownership split
between the partially-created channel and the user SSL, leaking
allocations from ossl_quic_channel_alloc().

Make port_new_handshake_layer() return the created user SSL to
port_make_channel() and detach the borrowed channel before cleaning up
its own failures. port_make_channel() now owns the error path: it
detaches any created user SSL from the channel, frees the channel exactly
once according to whether channel initialisation already ran cleanup, and
then frees the user SSL.

Also make QUIC stream map cleanup tolerate a NULL map during partial
channel cleanup, and add a focused mfail regression test for
ossl_quic_port_create_incoming().

Fixes: https://github.com/openssl/openssl/issues/31014
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue May 12 12:01:04 2026
(Merged from https://github.com/openssl/openssl/pull/31038)
2026-05-12 08:00:59 -04:00
Nikola Pajkovsky
51e7447e9e quic: check lh_QUIC_STREAM_new() return value in stream_map_init
ossl_quic_stream_map_init() did not check whether lh_QUIC_STREAM_new()
succeeded. On allocation failure qsm->map would be NULL and subsequent
operations on the stream map would dereference it.

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue May 12 12:01:02 2026
(Merged from https://github.com/openssl/openssl/pull/31038)
2026-05-12 08:00:54 -04:00
Milan Broz
854def489a test: add test for IV reuse in AEAD providers
After EVP_EncryptFinal, AEAD providers (GCM, OCB, Chacha20-Poly1305)
transition to IV_STATE_FINISHED to prevent IV reuse.

No encryption should be possible in such state.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue May 12 05:14:10 2026
(Merged from https://github.com/openssl/openssl/pull/31104)
2026-05-12 07:13:44 +02:00
Milan Broz
78f60e095d chacha_poly: Use IV_STATE guard to prevent IV reuse
If IV was set for Chacha20-Poly1305, code should not
allow reusing IV after calling CipherFinal.

Use iv_state (as used in GCM or OCB mode) to prevent that.

Thanks to Alex Gaynor for reporting the issue.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue May 12 05:14:09 2026
(Merged from https://github.com/openssl/openssl/pull/31104)
2026-05-12 07:13:44 +02:00
Bob Beck
96012a62aa Deprecate the ASN1_BIT_STRING name related funcitons.
These seem to have been from something long long ago
that nothing uses anymore. It seems like this is just something
we should not be doing in this way.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Mon May 11 09:23:13 2026
(Merged from https://github.com/openssl/openssl/pull/30853)
2026-05-11 11:23:12 +02:00
Harry Betts
2f3704f3b6 Fix OOB read in EC_GROUP_new_from_params() with zero-length generator
When OSSL_PKEY_PARAM_EC_GENERATOR is provided as an octet string of
length 0, buf[0] is read before validating data_size, causing a
heap-buffer-overflow detectable under ASan.

Reject zero-length generator octet strings before the dereference.

CLA: trivial
Resolves: https://github.com/openssl/openssl/issues/31125
Fixes: c0f39ded68 "Add Explicit EC parameter support to providers."

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Mon May 11 08:34:15 2026
(Merged from https://github.com/openssl/openssl/pull/31128)
2026-05-11 10:32:09 +02:00
Jakub Zelenka
658181faa8 Add various MFAIL tests to excercise ht insert
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon May 11 08:21:56 2026
(Merged from https://github.com/openssl/openssl/pull/31092)
2026-05-11 10:21:48 +02:00
Jakub Zelenka
8e1da4a4d6 Fix ignored call in ossl_rcu_call when cb item alloc fails
Currently when allocation of cb item fails, the actual cb function is
not called. The is used just in hashtable when the cb function frees
the old item which result in memory leak.

To fix this, the allocation needs to be separated and happen before the
assign operation is done.

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon May 11 08:21:55 2026
(Merged from https://github.com/openssl/openssl/pull/31092)
2026-05-11 10:21:48 +02:00
Jakub Zelenka
8ee58cad2f Add mfail test for new BIO dgram mem
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon May 11 08:09:16 2026
(Merged from https://github.com/openssl/openssl/pull/31121)
2026-05-11 10:09:13 +02:00
Jakub Zelenka
07cd5562d2 Fix BIO dgram pair memleak in dgram_mem_init
The created pair was not freed if ring buf init failed.

Fixes: 3a857b9532 "Implement BIO_s_dgram_mem() reusing the BIO_s_dgram_pair() code"

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon May 11 08:09:14 2026
(Merged from https://github.com/openssl/openssl/pull/31121)
2026-05-11 10:07:06 +02:00
OpenSSL Machine
4c62468c95 Reject CR/LF in HTTP request components
Reject CR and LF characters before serializing request lines and HTTP
headers. This prevents malformed URL or caller supplied components
from altering the generated HTTP request.

Resolves: https://github.com/openssl/openssl/issues/31099

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
MergeDate: Mon May 11 07:44:19 2026
(Merged from https://github.com/openssl/openssl/pull/31100)
2026-05-11 09:42:58 +02:00
Jakub Zelenka
df53ee4fa0 Add mfail test for ossl_ffc_params_copy
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon May 11 07:21:47 2026
(Merged from https://github.com/openssl/openssl/pull/31098)
2026-05-11 09:21:44 +02:00
Jakub Zelenka
a887f93cc7 Fix memleak in ossl_ffc_params_copy if alloc fails
If allocation fails in ossl_ffc_params_copy, then the params that were
previously allocated are not freed. This results in a memory leak.

Fixes: dc8de3e6f1 "Modify DSA and DH keys to use a shared FFC_PARAMS struct"

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon May 11 07:21:45 2026
(Merged from https://github.com/openssl/openssl/pull/31098)
2026-05-11 09:21:10 +02:00
Harry Betts
5f3ee04088 openssl-s_client.pod.in: remove mention of empty -alpn handling
The functionality was removed in e78253f2d0 "Ignore empty ALPN
elements in CLI args".

CLA: trivial
Complements: e78253f2d0 "Ignore empty ALPN elements in CLI args"
Resolves: https://github.com/openssl/openssl/issues/31088

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon May 11 07:01:42 2026
(Merged from https://github.com/openssl/openssl/pull/31119)
2026-05-11 08:57:18 +02:00
Bob Beck
c9d87ccc50 Correct ASN1_STRING_set() behaviour to match the documentation
ASN1_STRING_set() has never promised to call strlen() for other
negative values.  Other values here likely indicate an error,
such as an integer overflow.  Call strlen() only if the length
provided is -1.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Mon May 11 00:34:25 2026
(Merged from https://github.com/openssl/openssl/pull/31113)
2026-05-11 02:32:20 +02:00
Eugene Syromiatnikov
0a91e12cb9 crypto/evp/evp_lib.c: call va_end() in EVP_PKEY_Q_keygen() on error
Instead of returning NULL immediately, jump to the cleanup at the end
of the function.  Reported by Coverity.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1593754
Fixes: 18472994f0 "The EVP_PKEY_Q_keygen function now explicitly handles NULL curve name"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon May 11 00:28:25 2026
(Merged from https://github.com/openssl/openssl/pull/31107)
2026-05-11 02:28:10 +02:00
Alexandr Nedvedicky
6000ce9245 quic_channel.c: fix potential memory leak on failure in ossl_quic_channel_alloc
Add missing OPENSSL_free() in error path.

Fixes: 35dc6c353b "QUIC: Make more transport parameters configurable"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Mon May 11 00:23:13 2026
(Merged from https://github.com/openssl/openssl/pull/30754)
2026-05-11 02:19:16 +02:00
Bob Beck
c7c8dea229 Deprecate the X509_check_{email,host,ip,ip_asc} family of functions
Our own documentation for quite some time has indicated
that you should call X509_verify_cert() instead of using these.
Actually deprecate them and make apps not use the now deprecated
functions.

Resolves: https://github.com/openssl/project/issues/1899
References: https://github.com/openssl/project/issues/1897

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Mon May 11 00:08:33 2026
(Merged from https://github.com/openssl/openssl/pull/30403)
2026-05-11 02:05:22 +02:00
Zoey Chapell
0c44aedbed doc: clarify algorithm discovery in openssl-genpkey.pod.in
Add a reference to 'openssl list -public-key-algorithms' in the
-algorithm description to improve discoverability and long term
consistency. Documentation only change.

Add clarification for how to select the naming output in the correct spot.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Sun May 10 23:59:03 2026
(Merged from https://github.com/openssl/openssl/pull/30556)
2026-05-11 01:56:18 +02:00
kovan
1671d567cb doc: clarify -dateopt rfc_822 date format
The rfc_822 date output format uses an asctime-style month-first form.

It does not match RFC 822, RFC 2822, or RFC 5322.

Document the day/month ordering, RFC 822 year length, GMT timezone, and affected commands.

Resolves: https://github.com/openssl/openssl/issues/22223

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
MergeDate: Sun May 10 23:52:21 2026
(Merged from https://github.com/openssl/openssl/pull/29851)
2026-05-11 01:51:59 +02:00
Norbert Pocs
4124d15069 Move *_arch.h to include/arch
Move all the architecture specific header files under a single directory
in include/

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

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sun May 10 09:53:34 2026
(Merged from https://github.com/openssl/openssl/pull/30751)
2026-05-10 11:53:33 +02:00
Alexandr Nedvedicky
61665ed185 Make test/quic_fc_test.c clang-format friendly
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri May  8 16:25:01 2026
(Merged from https://github.com/openssl/openssl/pull/31095)
2026-05-08 12:24:58 -04:00
Bob Beck
d53d793771 EVP_CIPHER_CTX_get_iv_length can not return a negative value
but it can return 0.  Remove dead code and handle this
correctly - memcpy of 0 bytes from NULL is UB.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri May  8 12:15:17 2026
(Merged from https://github.com/openssl/openssl/pull/30609)
2026-05-08 08:15:08 -04:00
Milan Broz
a3d87506b7 ui_openssl.c: remove unreachable _WIN32
noecho_fgets() is enclosed by

  #if defined(OPENSSL_SYS_MSDOS) && !defined(_WIN32)

The inner #if  defined(_WIN32) is unreachable

  #if defined(_WIN32)
          i = _getch();
  #else
          i = getch();
  #endif

Remove it.

Verified by cross compilation under DJGPP which is AFAIK the only
MSDOS/non-WIN32 environment we can use.

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu May  7 20:11:18 2026
(Merged from https://github.com/openssl/openssl/pull/31076)
2026-05-07 16:10:50 -04:00
Milan Broz
8488abc84a bn_nist.c: remove unreachable BN_BITS2 == 64
The block in BN_nist_mod_224() is gated by

  #if defined(NIST_INT64) && BN_BITS2 != 64

so the #if

  #if BN_BITS2 == 64
          rp[7] = carry;
  #endif

is unreachable. Remove it.

The code is actualy relic of an earlier design where the NIST_INT64
accumulator path was meant 64-bit too.

Disabling 64-bit path above with BN_BITS2 != 64 resulted in
#if BN_BITS2 == 64 was left unreachable

The outer condition is correct, it is meant to be 32bit only,
otherwise it would need to introduce load_u32/store_lo32 as in other
functions to avoid clang strict-aliasing optimizer issues.

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu May  7 20:11:12 2026
(Merged from https://github.com/openssl/openssl/pull/31076)
2026-05-07 16:10:50 -04:00
Milan Broz
b391338239 async_posix.h: remove unreachable OPENSSL_SYS_TANDEM
The top-level #if requires !defined(OPENSSL_SYS_TANDEM):

  #if defined(OPENSSL_SYS_UNIX)                                 \
      && defined(OPENSSL_THREADS) && !defined(OPENSSL_NO_ASYNC) \
      && !defined(__ANDROID__) && !defined(__OpenBSD__)         \
      && !defined(OPENSSL_SYS_TANDEM)

so the nested

  #if defined(OPENSSL_SYS_TANDEM)
  #include <tdmsig.h>
  #else
  #include <ucontext.h>
  #endif

can never select the OPENSSL_SYS_TANDEM condition.

According to discussion on the issue 31074, removal of the second
(unreachable) condition is the way to go.

Fixes #31074

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu May  7 20:11:08 2026
(Merged from https://github.com/openssl/openssl/pull/31076)
2026-05-07 16:10:46 -04:00
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
Matt Caswell
399ac55fc7 Validate that a PSK identity is at least one byte long
RFC8446 requires that a PSK identity is at least one byte in length. We
should validate this.

Fixes #31007

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Sun May  3 13:46:21 2026
(Merged from https://github.com/openssl/openssl/pull/31058)
2026-05-03 15:46:14 +02:00
Pascal Ernster
c164a4c51c Fix: Typo "configdata.pem" -> "configdata.pm"
CLA: trivial
Fixes: ddf1847dc8 "unified build scheme: add and document the "unified" driving engine"

Signed-off-by: Pascal Ernster <git@hardfalcon.net>

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sun May  3 13:42:56 2026
(Merged from https://github.com/openssl/openssl/pull/31064)
2026-05-03 15:42:51 +02:00
Joshua Rogers
5ff19a7297 docs: Document required output buffer length in EVP_CIPHER-DES
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
MergeDate: Sun May  3 13:41:54 2026
(Merged from https://github.com/openssl/openssl/pull/30651)
2026-05-03 15:41:40 +02:00
Eugene Syromiatnikov
3ecae5960a ssl/record/methods/tls_common.c: call BIO_free_all() on rl->bio in tls_int_free
Since it is free'd using this call in tls_set1_bio().

Complements: 435feadaf4 "Fix record layer leak when swapping chained transport BIO"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Sat May  2 18:10:42 2026
(Merged from https://github.com/openssl/openssl/pull/31011)
2026-05-02 20:10:36 +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
83ef843d92 Guard memcmp for ub in X509_vpm.c
Techincally unnecessary, since this thing won't let you add NULL
data to it, but this is harmless and then obviously following
the correct paradigm.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sat May  2 18:05:04 2026
(Merged from https://github.com/openssl/openssl/pull/31049)
2026-05-02 20:04:57 +02:00
Jakub Zelenka
e72d897197 Fix memory leak in asn_mime multi_split
The bpart is not freed if BIO_write or BIO_puts fails. It also makes the
error handling of that case consistent with other parts freeing the
bpart.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri May  1 13:06:32 2026
(Merged from https://github.com/openssl/openssl/pull/31033)
2026-05-01 09:06:24 -04:00
Jakub Zelenka
d3fc4ad5aa Check wrlmethod existence before sending alert
If there is a memory failure during record wrlmethod allocation, then
the alert is attemted but it crashes because wrlmethod is NULL.

Found using memfail integration to fuzz tests: GH-30944

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Fri May  1 12:09:11 2026
(Merged from https://github.com/openssl/openssl/pull/31017)
2026-05-01 08:09:03 -04:00
Bob Beck
9967215e5c Touch the perl miasma in self defense.
The symbol presence test fails for NO_DEPRECATED
builds  if you use modern CPP practices for definitions.

This is the result of my accepting that doing so will be as PTSD
inducing as walking into my parents bedroom at an inopportune
time, and fixing it. Better me who has less time left to live
with the mental trauma than a younger developer.

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Fri May  1 11:01:46 2026
(Merged from https://github.com/openssl/openssl/pull/31016)
2026-05-01 13:01:36 +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
Milan Broz
da2fa6d621 Do not compile AVX2 code if AVX2 intrinsics is not supported
Old and exotic compilers do not support AVX2 instrinsic.
Add guard for Clang, GCC >= 8 and MSVC >= 2019.

Fixes: #30958

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Apr 30 11:44:32 2026
(Merged from https://github.com/openssl/openssl/pull/31020)
2026-04-30 13:44:15 +02:00
Milan Broz
f57143fdf8 Use ossl_inline instead of inline in enc_b64_avx2.c
This supports older compilers too.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Apr 30 11:44:31 2026
(Merged from https://github.com/openssl/openssl/pull/31020)
2026-04-30 13:44:15 +02:00
Milan Broz
39ce9160c8 ci: Enable MINGW63/32 builkd matrix with strict warnings
And also enable demos to 64bit cover compilation of these.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Apr 30 11:42:36 2026
(Merged from https://github.com/openssl/openssl/pull/30941)
2026-04-30 13:41:57 +02:00
Milan Broz
1068048e40 Fix ignoring return value in RCU witn MINGW 32bit
For code that uses NO_INTERLOCKEDOR64 (Win32 32bit),
there is a warning in RCU code
    error: ignoring return value of 'CRYPTO_THREAD_write_lock'
    declared with attribute 'warn_unused_result' [-Werror=unused-result]

As the function cannot fail on that platform (and error
path would need some reverts leading to impossible dereference later),
just use trick to silence the warning.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Apr 30 11:42:34 2026
(Merged from https://github.com/openssl/openssl/pull/30941)
2026-04-30 13:41:57 +02:00
Milan Broz
26a269fe00 Fix DSO symbol test with MINGW64 and pedantic warnings
GetProcAddress() cannot be simple cast to void* (SD_SYM)
under strict warnigs, as it produces this
 error: ISO C forbids conversion of function pointer to
 object pointer type [-Werror=pedantic]

Use common trick with cast to (uintptr_t).

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Apr 30 11:42:33 2026
(Merged from https://github.com/openssl/openssl/pull/30941)
2026-04-30 13:41:57 +02:00
Milan Broz
428bdb9c60 Use INVALID_SOCKET in SSLEcho demo
On Windows, SOCKET type is unsigned.

All comparison with negative value produces signed/unsigned
warnings, moreover the code is incorrect in error path.

Use INVALID_SOCKET define that should work on all
platforms to detect error.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Apr 30 11:42:31 2026
(Merged from https://github.com/openssl/openssl/pull/30941)
2026-04-30 13:41:57 +02:00
Milan Broz
a842afd126 Remove unused warnx from QUIC demos
It only produces missing prototype warnings.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Apr 30 11:42:30 2026
(Merged from https://github.com/openssl/openssl/pull/30941)
2026-04-30 13:41:57 +02:00
Milan Broz
5aeea6f929 Remove redefined progname from QUIC demos
The global progname is already defined above.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Apr 30 11:42:28 2026
(Merged from https://github.com/openssl/openssl/pull/30941)
2026-04-30 13:41:57 +02:00
Milan Broz
acd4969546 Remove unused ossl_crypto_mem_barrier in old Windows threads
This function is unused and only causes missing prototype
warning.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Apr 30 11:42:26 2026
(Merged from https://github.com/openssl/openssl/pull/30941)
2026-04-30 13:41:56 +02:00
Milan Broz
fc81846450 Fix rand_deprecated build if OPENSSL_API_COMPAT is not defined
Add test for OPENSSL_NO_DEPRECATED_1_1_0 (that covers symbols
for these ancient functions).

With strict warnings it break build with
  'OPENSSL_API_COMPAT' is not defined, evaluates to '0' [-Werror=undef]

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Apr 30 11:42:25 2026
(Merged from https://github.com/openssl/openssl/pull/30941)
2026-04-30 13:41:56 +02:00
Milan Broz
4fe2859c85 Define WINAPI_PARTITION_SYSTEM for older Windows headers
Some older Windows and MING64 environments does not have
WINAPI_PARTITION_SYSTEM defined.

This breaks build with strict warnings.

Add empty definition if this happens.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Apr 30 11:42:23 2026
(Merged from https://github.com/openssl/openssl/pull/30941)
2026-04-30 13:41:56 +02:00
Milan Broz
1c548f9295 Fix warning for incompatible function cast
With pedantic option (strict warnings) and MINGW64,
the GetProcAddress() cannot be simply casted, as it leads to
 error: cast between incompatible function types from 'FARPROC' ...

Introduce local macro that will wrap all such calls
and silence benign warnings.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Apr 30 11:42:21 2026
(Merged from https://github.com/openssl/openssl/pull/30941)
2026-04-30 13:41:56 +02:00
Milan Broz
237916a30d Fix signed/unsigned comparison under MINGW64
SOCKET is unsigned on Windows, these is no need to cast
parameter. INVALID_SOCKET test should work on all platforms.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Apr 30 11:42:20 2026
(Merged from https://github.com/openssl/openssl/pull/30941)
2026-04-30 13:41:56 +02:00
Milan Broz
d59b644e3c Fix missing prototype for win32_utf8argv under MINGW64
With strict warnings build fails on missing win32_utf8argv()
function definition.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Apr 30 11:42:18 2026
(Merged from https://github.com/openssl/openssl/pull/30941)
2026-04-30 13:41:56 +02:00
Hasebur Sinha
5199c5b98a Use accessors for ASN1_STRING internally in PKCS7
To make data structures opaque, replaced direct member access (->data,
->length) with the equivalent ASN1_STRING accessor functions in the
PKCS7 module.

Fixes #29861

CLA: trivial

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Thu Apr 30 07:19:58 2026
(Merged from https://github.com/openssl/openssl/pull/30896)
2026-04-30 07:19:57 +00:00
Herman Semenoff
0f799ae3b2 crypto: fix possible integer overflow using cast size_t
Signed-off-by: Herman Semenoff <GermanAizek@yandex.ru>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Thu Apr 30 07:13:07 2026
(Merged from https://github.com/openssl/openssl/pull/30973)
2026-04-30 07:13:03 +00:00
Eugene Syromiatnikov
0e771632ef util: remove find-doc-nits -o option and missing*111.txt files
It seems that find-doc-nits -o option, that "count[s] symbols added
since 1.1.1 as new", has little use by now (it is not used in any
find-doc-nits invocations, so can only be used manually), and presence
of missing*111.txt files (and especially entries there) only creates
confusion these days.  Remove the option and the associated files.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Thu Apr 30 07:02:41 2026
(Merged from https://github.com/openssl/openssl/pull/30978)
2026-04-30 07:02:33 +00:00
Eugene Syromiatnikov
603b06c1c4 test/recipes/90-test_memfail.t: fix off-by-one error in skip counts
Fixes: 2d6d0831d2 "add a memfail test for x509 operations"
Fixes: 437cde84a7 "add a handshake memory failure test"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Apr 30 06:59:09 2026
(Merged from https://github.com/openssl/openssl/pull/30991)
2026-04-30 06:58:48 +00:00
Eugene Syromiatnikov
379d7be40d test/recipes/90-test_memfail.t: print OPENSSL_MALLOC_FAILURES on failure
So it's easier to reproduce the failure.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Apr 30 06:59:08 2026
(Merged from https://github.com/openssl/openssl/pull/30991)
2026-04-30 06:58:48 +00:00
Eugene Syromiatnikov
486404334c test/{handshake-,load_key_certs_crls_,x509_}memfail.c: count allocs properly
Memory allocation failure testing (and counting) is done both for malloc
and realloc calls, so the sum of those ought to be reported.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Apr 30 06:59:07 2026
(Merged from https://github.com/openssl/openssl/pull/30991)
2026-04-30 06:58:48 +00:00
Eugene Syromiatnikov
b3dea427c4 crypto/mem.c: perform the fail check right after counting calls
Otherwise the counting done by shouldfail() does not account for calls
that are diverted to non-standard implementation and zero-sized
allocations, making it diverge from the sum of malloc_count
and realloc_count.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Apr 30 06:59:07 2026
(Merged from https://github.com/openssl/openssl/pull/30991)
2026-04-30 06:58:48 +00:00
Eugene Syromiatnikov
371c722b41 test/recipes/90-test_memfail.t: disable mfail before doing count runs
mfail allocator hooks installation affect memory allocation counts,
so it should be disabled for both "count" and "run" test calls.

Fixes: 3cff7c2181 "Add memory allocation failure testing framework"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Apr 30 06:59:06 2026
(Merged from https://github.com/openssl/openssl/pull/30991)
2026-04-30 06:58:48 +00:00
Milan Broz
ece45f05e8 Replace one missing snprint with BIO_snprintf
Older compilers like MSVC 2013 do not support it.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Apr 30 06:49:22 2026
(Merged from https://github.com/openssl/openssl/pull/31019)
2026-04-30 06:49:18 +00:00
andrei2308
e905da2c20 Update description of OSSL_HTTP_adapt_proxy()
Clarify the behavior of OSSL_HTTP_adapt_proxy() regarding proxy determination and exclusion lists.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
MergeDate: Wed Apr 29 15:25:34 2026
(Merged from https://github.com/openssl/openssl/pull/30848)
2026-04-29 17:25:22 +02:00
andrei2308
d54ce3ee46 Add test for empty proxy server adaptation
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
MergeDate: Wed Apr 29 15:25:33 2026
(Merged from https://github.com/openssl/openssl/pull/30848)
2026-04-29 17:25:22 +02:00
andrei2308
c9fdd8a28a Add check for empty server host in http_lib.c
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
MergeDate: Wed Apr 29 15:25:32 2026
(Merged from https://github.com/openssl/openssl/pull/30848)
2026-04-29 17:25:22 +02:00
Helen Zhang
dfcbc4a2d7 change EVP_MD_size() return value from size_t to int.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Apr 29 15:14:20 2026
(Merged from https://github.com/openssl/openssl/pull/30803)
2026-04-29 17:14:15 +02:00
Eugene Syromiatnikov
f33bb236fc ssl/quic/quic_record_tx.c: refactor qtx->cons obtaining
As currently implemented, the only txe passed to qtx_reserve_txe()
(and, subsequently, to qtx_resize_txe()) is qtx->cons one, so the check
"if (qtx->cons == txe)" is superfluous, and, more so, would lead
to a memory leak if it weren't the case, as was spotted by Coverity.
Moreover, the set of qtx_alloc_txe(), qtx_ensure_free_txe(),
qtx_ensure_cons(), qtx_resize_txe(), and qtx_reserve_txe() functions,
while being written in a relatively generic way, is actually called
from a single call site in ossl_qtx_write_pkt(), and contains several
duplicating checks and unnecessary logic (like, adding a newly allocated
TXE to the free list, only to remove it from there right away
in qtx_ensure_cons(), the only its user), so just merge the whole
aforementioned set of functions (except qtx_alloc_txe()) in a single
function, qtx_get_cons_txe().

Resolves: https://scan5.scan.coverity.com/#/project-view/63999/10222?selectedIssue=1691460
Complements: 16892155e1 "quic: fix NULL txl dereference in qtx_resize_txe"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Apr 29 15:12:14 2026
(Merged from https://github.com/openssl/openssl/pull/30783)
2026-04-29 17:11:44 +02:00
Milan Broz
95b31c0335 Workaround Uplink compilation for MINGW 32bit
The uplink code breaks compilation with strict warnings
for MINGW (only for 32-bit).
  error: ISO C forbids conversion of object pointer
  to function pointer type [-Werror=pedantic]
or
  error: ISO C forbids assignment between function pointer
  and 'void *' [-Werror=pedantic]

and some other missing declarations and prototypes.

As uplink.h is included in cryptlib.h and used in BIO
code, using a pragma to disable warnings would touch
to much code.

With (uintptr_t) cast, it silences cast warnings with gcc.

For the rest of the code, just disable warnings, as this
code would need to be rewritten and heavily retested
on older systems.
NOTE: applink.c is INCLUDED from uplink.h.

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Apr 28 16:02:22 2026
(Merged from https://github.com/openssl/openssl/pull/30963)
2026-04-28 18:02:08 +02:00
Milan Broz
2072517dc0 Fix always false comparison in asn1/a_strex.c
On 32bit platforms, some compilers like clang
produce this warning
   error: result of comparison 'unsigned long' > 4294967295
   is always false [-Werror,-Wtautological-type-limit-compare]
   70 |     if (c > 0xffffffffL)

Just compare it to UNICODE_MAX here.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Apr 28 16:01:04 2026
(Merged from https://github.com/openssl/openssl/pull/30962)
2026-04-28 18:00:53 +02:00
Alexandr Nedvedicky
8fa8acf036 test: move 'Simple single-stream test' from quic_multstream to quic-radix
unlike multistream test, which uses t-server, the radix tests
use regular SSL objects, thus radix tests execute production code.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Tue Apr 28 12:35:42 2026
(Merged from https://github.com/openssl/openssl/pull/30913)
2026-04-28 14:34:12 +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
slontis
87b2a6a7ff FIPS: Add HMAC key size compliance check to the MAC legacy bridge.
The hmac fips provider implementation used by the EVP_MAC API handles key
size checks, but it only does the test for the internal case.
Previously HMAC was implemented using EVP_DigestSign related functions,
and these are implemented using a mac_legacy_sig bridge, because of this
the MAC is external. For external cases the caller is responsible for
doing any key checks, so a FIPS indicator has been added.

Reported-by: https://github.com/taha2samy
Fixes: #30012

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Apr 28 07:13:24 2026
(Merged from https://github.com/openssl/openssl/pull/30150)
2026-04-28 07:13:23 +00:00
herbenderbler
435feadaf4 Fix record layer leak when swapping chained transport BIO
tls_set1_bio() freed only the top BIO (BIO_free). Use BIO_free_all so
a pushed transport chain is released when the record layer replaces
its BIO.

Add test_ssl_set_wbio_chain_no_leak in sslapitest (stacked BIO chain
via SSL_set0_wbio) per reviewer feedback on GH openssl#30483. Drop the
Perl s_client reconnect recipe and CHANGES entry (internal leak only).

Fixes #30458

Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Tue Apr 28 06:39:25 2026
(Merged from https://github.com/openssl/openssl/pull/30483)
2026-04-28 06:39:18 +00:00
Mounir IDRASSI
31286c0351 Add property method cache failure tests
Add coverage for duplicate property cache insertion and
allocation-failure handling in the property method cache.

The memfail exerciser covers cache set, providerless cache deletion,
providerless cache rebuild, and cleanup of method references when
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:10 +00: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
huanghuihui0904
b0912c27fd ssl/quic/quic_port.c: fix leak in port_make_channel()
Free pre-existing ch->qlog_title before OPENSSL_strdup to avoid
leaking the value allocated in ossl_quic_channel_alloc(). Use
ossl_quic_channel_free() on strdup failure to ensure proper cleanup.

Solves https://github.com/openssl/openssl/issues/30440

Fixes #30440

Signed-off-by: huanghuihui0904 <625173@qq.com>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Mon Apr 27 07:21:11 2026
(Merged from https://github.com/openssl/openssl/pull/30441)
2026-04-27 07:21:04 +00:00
Wolfgang Beck
82124a204a Add icx compiler version support in perl asm scripts
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Mon Apr 27 06:44:52 2026
(Merged from https://github.com/openssl/openssl/pull/30313)
2026-04-27 06:44:12 +00:00
Michael Richardson
40577e1355 move contents of HACKING.md to a doc/HOWTO
reference list of files and removed -Werror from instructions on adding
functions rename HACKING.md to HOWTO.md.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Mon Apr 27 06:14:57 2026
(Merged from https://github.com/openssl/openssl/pull/18003)
2026-04-27 06:14:19 +00:00
Ingo Franzki
9d9943f031 Increase the query cache insert grow retry
On s390x, the distribution of the query cache hash values is different
compared to other architectures, probably because of endianess and pointer
alignment being different (the hash key contains pointer values and integers).
This leads to the fact that ossl_ht_cache_QUERY_insert() is not always able to
add a query during the FIPS selftests, and thus ossl_ht_cache_QUERY_insert()
returns -1 is such cases.

Increase the number of retries inside ossl_ht_insert() to at least the
number elements per neighborhood plus 1. With this it is able to grow the
hash table enough so that the queries used during the FIPS selftest can
all be added to the hash table, even on s390x.

There is still no guarantee that the number of retries is enough for all
possible queries. It can still happen that certain queries can't be added to
the cache, even on other architectures. This does not really hurt, such
queries will just not be cached and are freshly fetched again the next time.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon Apr 27 05:56:53 2026
(Merged from https://github.com/openssl/openssl/pull/30903)
2026-04-27 05:56:44 +00:00
Mounir IDRASSI
82d4bd5e97 crypto/hashtable/hashtable.c: fix hashtable grow cleanup for aligned allocation
Update grow_hashtable cleanup to free the neighborhood allocation
through newmd->neighborhood_ptr_to_free instead of newmd->neighborhoods.

Fixes: cc4ea5e000 "Introduce new internal hashtable implementation"

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sun Apr 26 14:26:08 2026
(Merged from https://github.com/openssl/openssl/pull/30859)
2026-04-26 16:25:24 +02:00
Viktor Dukhovni
7e57092596 Handle NULL-buffer size probe in ossl_param_build_set_bn_pad()
ossl_param_build_set_bn_pad() is reached by two distinct caller
populations.  When an OSSL_PARAM_BLD template is supplied
(bld != NULL), the template allocates backing storage internally and
no caller-side sizing is required.  When an explicit OSSL_PARAM[]
array is supplied (bld == NULL), the caller follows the standard
OSSL_PARAM size-probe contract: invoke the primitive once with
p->data == NULL to learn the required size via p->return_size, then
allocate a buffer of that size and invoke again with the real
storage.

The bld == NULL branch did not honour the size-probe contract: with
p->data == NULL and a non-zero sz it fell through to
OSSL_PARAM_set_BN() and raised CRYPTO_R_TOO_SMALL_BUFFER, so callers
could never discover the required size.

The defect has been latent across several releases.  This primitive
is the *padded* BN setter: it emits a fixed-width encoding regardless
of the BN's actual magnitude, which is needed for the private key --
a minimal encoding would leak its bit-length through timing or
allocation side channels.  In practice the private key is the only
provider parameter that reaches this primitive.  Callers that want
private-key material have historically done so through
EVP_PKEY_todata() and its OSSL_PARAM_BLD template path, where the
bug is invisible.  EVP_PKEY_get_params() callers exist but have not
previously needed the private-key BN.  Any caller that does request
it on the explicit-params path -- whether by name or as part of
iterating a provider's full gettable list -- now sees the probe
behave as it does elsewhere.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Sun Apr 26 13:35:32 2026
(Merged from https://github.com/openssl/openssl/pull/30942)
2026-04-26 15:35:31 +02: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
Eugene Syromiatnikov
78f65b1e09 CHANGES.md, NEWS.md: updates for 4.0.0 final release
NEWS.md is amended to include the following PRs:
 * https://github.com/openssl/openssl/pull/28305
   "Replace homebrewed implementation of *printf*() functions with libc"
 * https://github.com/openssl/openssl/pull/29299
   "Remove support for custom EVP_CIPHERs"
 * https://github.com/openssl/openssl/pull/29366
   "Remove support for custom EVP_MDs"
 * https://github.com/openssl/openssl/pull/29384
   "Remove support for custom EVP_PKEY_METHODs"
 * https://github.com/openssl/openssl/pull/30128
   "Removes fixed version TLS methods."
 * https://github.com/openssl/openssl/pull/29405
   "Remove support EVP_PKEY_ASN1_METHODs from the public API"

Overall, CHANGES.md includes the following:
 * https://github.com/openssl/openssl/pull/8136
   "Remove spurious '00:' printing RSA/DSA/DH/EC key material with leading bit
   set in unsigned BN"
 * https://github.com/openssl/openssl/pull/17495
   "4.0: `X509_ALGOR_set_md()`: Add return value to indicate success or failure"
 * https://github.com/openssl/openssl/pull/18229
   "public API: Remove needless `const` from scalar types"
 * https://github.com/openssl/openssl/pull/22304
   "4.0: crypto/{CMS,PKCS7,OCSP,TS,X509}: constify cert list parameters"
 * https://github.com/openssl/openssl/pull/24551
   "Enable RFC 7919 FFDHE groups for TLS 1.2 server"
 * https://github.com/openssl/openssl/pull/24738
   "add ech-api.md"
 * https://github.com/openssl/openssl/pull/25193
   "ECH build artefacts and a bit of code"
 * https://github.com/openssl/openssl/pull/25420
   "ECH CLI implementation"
 * https://github.com/openssl/openssl/pull/25663
   "ECH external APIs"
 * https://github.com/openssl/openssl/pull/25991
   "preserve data constness when getting issuer name's and subject's hash"
 * https://github.com/openssl/openssl/pull/26011
   "ECH client side"
 * https://github.com/openssl/openssl/pull/27397
   "create SSL_listen_ex api"
 * https://github.com/openssl/openssl/pull/27431
   "fips: Enforce lower bounds checks for password protected files when using
   FIPS providers, by default"
 * https://github.com/openssl/openssl/pull/27540
   "ECH client sending mulitple key shares"
 * https://github.com/openssl/openssl/pull/27561
   "ECH both sides now"
 * https://github.com/openssl/openssl/pull/27776
   "Introduce the PACKET_msg_start() function"
 * https://github.com/openssl/openssl/pull/28033
   "Constify further X509 functions; remove OSSL_FUTURE_CONST"
 * https://github.com/openssl/openssl/pull/28041
   "Remove support for SSLv2 Client Hello"
 * https://github.com/openssl/openssl/pull/28108
   "Add a way to cleanse params arrays"
 * https://github.com/openssl/openssl/pull/28160
   "New options for reading MAC key from environment variable, file and standard
   input were added."
 * https://github.com/openssl/openssl/pull/28270
   "s_client and s_server command line options for ECH (plus some wndows
   CI fixes)"
 * https://github.com/openssl/openssl/pull/28278
   "Implementing store support for EVP_SKEY"
 * https://github.com/openssl/openssl/pull/28305
   "Replace homebrewed implementation of *printf*() functions with libc"
 * https://github.com/openssl/openssl/pull/28432
   "Add support for CSHAKE."
 * https://github.com/openssl/openssl/pull/28445
   "Updated s_server's verify_return_error option to enable peer verification"
 * https://github.com/openssl/openssl/pull/28535
   "Print PowerPC CPUINFO"
 * https://github.com/openssl/openssl/pull/28623
   "Combining time validation with comparison return values considered harmful"
 * https://github.com/openssl/openssl/pull/28837
   "Add support to serialize/deserialize digest state for export/import"
 * https://github.com/openssl/openssl/pull/29018
   "CRL: Validate Certificate Issuer extension with IDP Indirect=TRUE"
 * https://github.com/openssl/openssl/pull/29057
   "Avoid empty AKID/SKID extensions in CSRs and certs"
 * https://github.com/openssl/openssl/pull/29107
   "CRL: Enforce proper handling of ASN1_TIME validation results"
 * https://github.com/openssl/openssl/pull/29116
   "info: Print CPUINFO for SPARCv9 processors"
 * https://github.com/openssl/openssl/pull/29152
   "Add new public API for checking certificate times."
 * https://github.com/openssl/openssl/pull/29187
   "Remove the ASN1_STRING_FLAG_X509_TIME flag"
 * https://github.com/openssl/openssl/pull/29195
   "Add SNMPKDF implementation"
 * https://github.com/openssl/openssl/pull/29200
   "Add tests and documentation and fix some issues resulting"
 * https://github.com/openssl/openssl/pull/29206
   "Per-key encoding formats for ML-KEM and ML-DSA"
 * https://github.com/openssl/openssl/pull/29222
   "Implementation of Deferred FIPS Self-Tests"
 * https://github.com/openssl/openssl/pull/29223
   "ML-DSA: Add a digest that can calculate external mu."
 * https://github.com/openssl/openssl/pull/29230
   "doc/man3: Add OPENSSL_ppccap.pod
 * https://github.com/openssl/openssl/pull/29266
   "make PEM hexdump width a multiple of 8 bytes"
 * https://github.com/openssl/openssl/pull/29299
   "Remove support for custom EVP_CIPHERs"
 * https://github.com/openssl/openssl/pull/29305
   "Feature/engineremoval"
 * https://github.com/openssl/openssl/pull/29311
   "Documentation for BIO flags and related functions"
 * https://github.com/openssl/openssl/pull/29338
   "merge feature/removesslv3"
 * https://github.com/openssl/openssl/pull/29366
   "Remove support for custom EVP_MDs"
 * https://github.com/openssl/openssl/pull/29380
   "Remove crypto-mdebug-backtrace option from config"
 * https://github.com/openssl/openssl/pull/29381
   " Added LMS support for OpenSSL commandline signature verification using
   pkeyutl."
 * https://github.com/openssl/openssl/pull/29384
   "Remove support for custom EVP_PKEY_METHODs"
 * https://github.com/openssl/openssl/pull/29385
   "Atexit.final draft.cleanup"
 * https://github.com/openssl/openssl/pull/29387
   "Add ASN1_BIT_STRING_get_length()"
 * https://github.com/openssl/openssl/pull/29405
   "Remove support EVP_PKEY_ASN1_METHODs from the public API"
 * https://github.com/openssl/openssl/pull/29427
   "Remove the c_rehash script"
 * https://github.com/openssl/openssl/pull/29428
   "Constify return value of X509_get_X509_PUBKEY()"
 * https://github.com/openssl/openssl/pull/29435
   "Add SRTP KDF"
 * https://github.com/openssl/openssl/pull/29445
   "Remove BIO_f_reliable() as it is broken"
 * https://github.com/openssl/openssl/pull/29465
   "Constify X509_get_ext() and friends.."
 * https://github.com/openssl/openssl/pull/29468
   "constify  X509_NAME."
 * https://github.com/openssl/openssl/pull/29488
   "Constify the X509_STORE_CTX argument to the lookup_certs functions."
 * https://github.com/openssl/openssl/pull/29576
   "KDF: Add configuration options to disable many of the KDF algorithms."
 * https://github.com/openssl/openssl/pull/29612
   "Support multiple names for certificate verification"
 * https://github.com/openssl/openssl/pull/29635
   "SSL_CTX_is_server() was added"
 * https://github.com/openssl/openssl/pull/29639
   "Disabling explicit EC curves encoding"
 * https://github.com/openssl/openssl/pull/29640
   "add thunking for compare function to OPENSSL_STACK"
 * https://github.com/openssl/openssl/pull/29646
   "Added SSL_CTX_get0_alpn_protos() and SSL_get0_alpn_protos()"
 * https://github.com/openssl/openssl/pull/29653
   "Drop darwin-i386(-cc) targets from Configurations"
 * https://github.com/openssl/openssl/pull/29658
   "Disable support of weak elliptic curves in TLS by default"
 * https://github.com/openssl/openssl/pull/29672
   "Drop darwin-ppc{,64} targets"
 * https://github.com/openssl/openssl/pull/29721
   "Make OPENSSL_cleanup() G A"
 * https://github.com/openssl/openssl/pull/29813
   "Make X509_ATTRIBUTE accessor functions const-correct"
 * https://github.com/openssl/openssl/pull/29862
   "Make ASN1_STRING opaque"
 * https://github.com/openssl/openssl/pull/29874
   "Take OPENSSL_atexit() for a walk behind the barn."
 * https://github.com/openssl/openssl/pull/29926
   "Provide ASN1_BIT_STRING_set1()"
 * https://github.com/openssl/openssl/pull/29953
   "Support for RFC8998 `sm2sig_sm3`, `curveSM2` and its ML-KEM-768 hybrid."
 * https://github.com/openssl/openssl/pull/29971
   "X509: apply AKID verification checks when X509_V_FLAG_X509_STRICT is set"
 * https://github.com/openssl/openssl/pull/29982
   "Improved reporting of shared and peer sigalgs"
 * https://github.com/openssl/openssl/pull/29991
   "Fix of SSL_get_error() so that it no longer depends on the state
   of the error stack"
 * https://github.com/openssl/openssl/pull/29995
   "Add abilty to use static vcruntime"
 * https://github.com/openssl/openssl/pull/30005
   "Make ERR_STATE opaque and remove related deprecated functions"
 * https://github.com/openssl/openssl/pull/30011
   "Deprecate ASN1_OBJECT_new()."
 * https://github.com/openssl/openssl/pull/30020
   "Const correct time parameter for X509_cmp_time(), X509_time_adj()
   and X509_time_adj_ex()."
 * https://github.com/openssl/openssl/pull/30024
   "CRL: reject malformed CRL Number and CRL Delta Indicator"
 * https://github.com/openssl/openssl/pull/30028
   "Add TLS 1.3 SM ciphersuites"
 * https://github.com/openssl/openssl/pull/30031
   "Mostly deprecated is slightly not deprecated...."
 * https://github.com/openssl/openssl/pull/30033
   "Remove the &quot;msie-hack&quot; option from openssl ca"
 * https://github.com/openssl/openssl/pull/30034
   "Use the appropriate libctx when executing CMS_SignerInfo_verify"
 * https://github.com/openssl/openssl/pull/30035
   "Constify X509_verify"
 * https://github.com/openssl/openssl/pull/30036
   "Constify more X509 arguments and return values"
 * https://github.com/openssl/openssl/pull/30044
   "Added BIO_set_send_flags() function to set flags passed to send(),
   sendto(), and sendmsg()"
 * https://github.com/openssl/openssl/pull/30048
   "change from I-D to RFC 9849 and resolve TODO(ECH) cases"
 * https://github.com/openssl/openssl/pull/30053
   "Constify NAME_CONSTRAINTS_check and NAME_CONSTRAINTS_check_CN"
 * https://github.com/openssl/openssl/pull/30054
   "Consity X509_add_cert and X509_self_signed"
 * https://github.com/openssl/openssl/pull/30055
   "Constify various functions that were non const due to extension cache"
 * https://github.com/openssl/openssl/pull/30056
   "Constify X509_build_chain"
 * https://github.com/openssl/openssl/pull/30058
   "Constify X509_chain_check_suiteb"
 * https://github.com/openssl/openssl/pull/30067
   "Constify X509_check_issued and friends"
 * https://github.com/openssl/openssl/pull/30071
   "constify X509_check_trust, X509_TRUST_add"
 * https://github.com/openssl/openssl/pull/30072
   "Constify X509_to_X509_REQ and X509_REQ_to_X509"
 * https://github.com/openssl/openssl/pull/30073
   "Constify X509_print_fp and X509_print_ex_fp"
 * https://github.com/openssl/openssl/pull/30074
   "Constify X509_STORE_add_cert()"
 * https://github.com/openssl/openssl/pull/30076
   "Constify X509_STORE_CTX functions invoving X509 *"
 * https://github.com/openssl/openssl/pull/30079
   "Constify X509_CRL_get0_by_cert"
 * https://github.com/openssl/openssl/pull/30080
   "Constify X509v3_asid_validate_resource_set
   and X509v3_addr_validate_resource_set"
 * https://github.com/openssl/openssl/pull/30082
   "Constify X509_REQ_get1_email, X509_get1_email and X509_get1_ocsp."
 * https://github.com/openssl/openssl/pull/30084
   "Constify X509_issuer_and_serial_hash"
 * https://github.com/openssl/openssl/pull/30089
   "Added -expected-rpks s_client/server option"
 * https://github.com/openssl/openssl/pull/30090
   "Constify X509_CRL_get0_by_cert"
 * https://github.com/openssl/openssl/pull/30092
   "constify X509_find_by_issuer_and_serial"
 * https://github.com/openssl/openssl/pull/30096
   "Constify X509_find_by_subject"
 * https://github.com/openssl/openssl/pull/30098
   "Add a changes entry for the x509 time function changes"
 * https://github.com/openssl/openssl/pull/30113
   "Add keyshare floating"
 * https://github.com/openssl/openssl/pull/30117
   "Constify X509_OBJECT_[get0|set1]_X509 and friends"
 * https://github.com/openssl/openssl/pull/30127
   "Constify a bunch of seldom used X509 functions. "
 * https://github.com/openssl/openssl/pull/30128
   "Removes fixed version TLS methods."
 * https://github.com/openssl/openssl/pull/30140
   "Ensure TLS 1.3 ciphersuites are actually for TLS 1.3"
 * https://github.com/openssl/openssl/pull/30171
   "CRL: Reject CRLs with malformed Issuing Distribution Point"
 * https://github.com/openssl/openssl/pull/30200
   "Remove remnant SSL_FIPS flag"
 * https://github.com/openssl/openssl/pull/30229
   "X509 returned by X509_REQ_to_X509() should not be (const ...)"
 * https://github.com/openssl/openssl/pull/30235
   "Make X509_up_ref and X509_free take const X509 *"
 * https://github.com/openssl/openssl/pull/30249
   "x509: remove erroneous critical extension enforcement"
 * https://github.com/openssl/openssl/pull/30252
   "Some more X509 extension add/del polish"
 * https://github.com/openssl/openssl/pull/30263
   "Restrict the number of keyshares/groups/sigalgs a server is willing
   to accept"
 * https://github.com/openssl/openssl/pull/30265
   "Unconstify X509_find_by_issuer_and_serial() and X509_find_by_subject()"
 * https://github.com/openssl/openssl/pull/30272
   "Partially revert &quot;Constify X509_STORE_CTX functions invoving X509
   *&quot;"
 * https://github.com/openssl/openssl/pull/30273
   "Revert &quot;Make X509_up_ref and X509_free take const X509 *&quot;"
 * https://github.com/openssl/openssl/pull/30276
   "Un-constify X509_OBJECT_get0_X509 and X509_OBJECT_set1_X509"

The changes associated with these PRs are already mentioned in 3.6.x changes:
 * https://github.com/openssl/openssl/pull/28760
   "Improve the CPUINFO display for RISC-V"
 * https://github.com/openssl/openssl/pull/28797
   "Fix regression when X509_V_FLAG_CRL_CHECK_ALL is set"
 * https://github.com/openssl/openssl/pull/28955
   "Fix for TLS handshake issue with GnuTLS #28902"
 * https://github.com/openssl/openssl/pull/29155
   "fix(x509.c): fixed -checkend return values"
 * https://github.com/openssl/openssl/pull/29214
   "s390x: Check and fail on invalid malformed ECDSA signatures"
 * https://github.com/openssl/openssl/pull/29242
   "Clang format head"
 * https://github.com/openssl/openssl/pull/29251
   "Fix change of behavior of the single stapled OCSP response API"
 * https://github.com/openssl/openssl/pull/30204
   "Fix detection of plaintext HTTP over TLS"
 * https://github.com/openssl/openssl/pull/30384
   "Fix #19891 CONNECT request for IPv6 targets in OSSL_HTTP_proxy_connect"
 * https://github.com/openssl/openssl/pull/30557
   "re-constructorize the cpuid stuff, but fix riscv to not depend
   on BIO_snprintf."

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Original-PR: https://github.com/openssl/openssl/pull/30817)
Original-Commit: 8fba5d0d9c "CHANGES.md, NEWS.md: updates for 4.0.0 final release"

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Sun Apr 26 13:17:07 2026
(Merged from https://github.com/openssl/openssl/pull/30847)
2026-04-26 15:16:53 +02:00
Samaresh Kumar Singh
b9ab1f3c01 Use EVP_MD_fetch() instead of EVP_get_digestbynid() in X509/TLS paths
EVP_get_digestbynid() only searches the legacy built-in digest table and
cannot resolve provider-only digests, which breaks X509 signature info
computation, GOST TLS handshakes, and OCSP cert ID matching when the
digest is loaded exclusively through a provider. Switch the three affected
sites to use EVP_MD_fetch() (with the appropriate libctx/propq).
x509_sig_info_init() gains libctx/propq parameters propagated
from the X509 struct by its caller.

Resolves: https://github.com/openssl/openssl/issues/30604

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sun Apr 26 13:13:14 2026
(Merged from https://github.com/openssl/openssl/pull/30888)
2026-04-26 15:07:30 +02:00
Joe Orton
11d9ea4ae4 doc/man3/SSL_set1_host.pod: fix Deprecated Functions heading formatting
CLA: trivial
Fixes: f584ae959c "Let's support multiple names for certificate verification"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Richard Levitte <levitte@openssl.org>
MergeDate: Sun Apr 26 12:59:31 2026
(Merged from https://github.com/openssl/openssl/pull/30834)
2026-04-26 14:58:39 +02:00
Abdirahim Musse
646aae648e aix: disable sendmmsg/recvmmsg
AIX header files don't properly expose sendmmsg/recvmmsg function
declarations. Disable these functions to avoid implicit declaration
errors with clang 16+.

This issue was discovered when building Node.js with clang.

CLA: trivial
Fixes: 52cd2a49c5 "Enable send-/recvmmsg for AIX >= 7.2 and disable SUPPORT_LOCAL_ADDR."
References: https://github.com/nodejs/node/pull/62656
Resolves: https://github.com/openssl/openssl/issues/30806

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sun Apr 26 12:02:58 2026
(Merged from https://github.com/openssl/openssl/pull/30832)
2026-04-26 13:58:56 +02:00
Christoph Müllner
4a0c2ac709 .github: add AArch64 extension cross-compile workflow
This patch adds an AArch64-specific extension cross-compile workflow.
This is inspired by the existing RISC-V extension cross-compile
workflow and applies the same matrix-driven approach to AArch64.

References: https://github.com/openssl/openssl/issues/29269
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Dmitry Misharov <dmitry@openssl.org>
MergeDate: Sun Apr 26 11:53:08 2026
(Merged from https://github.com/openssl/openssl/pull/30764)
2026-04-26 13:52:49 +02:00
Neil Horman
ebd5ea8ce5 Make win32_pathbyaddr more reliable
A user has reported that win32_pathbyaddr can be unreliable in
multithreaded environments. See:

https://learn.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot

Specifically they have observed the following behavior, as noted in the
above article:

When taking snapshots that include heaps and modules for a process other than
the current process, the CreateToolhelp32Snapshot function can fail or return
incorrect information for a variety of reasons. For example, if the loader data
table in the target process is corrupted or not initialized, or if the module
list changes during the function call as a result of DLLs being loaded or
unloaded, the function might fail with ERROR_BAD_LENGTH or other error code.
Ensure that the target process was not started in a suspended state, and try
calling the function again. If the function fails with ERROR_BAD_LENGTH when
called with TH32CS_SNAPMODULE or TH32CS_SNAPMODULE32, call the function again
until it succeeds.

This behavior necessitates calling DSO_pathbyaddr mutiple times to get a
succesful return code.

win32_pathbyaddr can be made more reliable, avoiding the need for multiple calls
by using alternate windows apis that are not/less succeptible to these transient
errors in multithreaded environments.

refactor win32_pathbyaddr here to implement that increased reliability.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sun Apr 26 11:48:58 2026
(Merged from https://github.com/openssl/openssl/pull/30705)
2026-04-26 13:48:56 +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
Sebastian Andrzej Siewior
33958827f7 apps: Move PATH_MAX define out of the win32 block
The PATH_MAX define is needed on HURD which is now skipped since it is
winthin the _WIN32 block.

Move the PATH_MAX check+define outside of the _WIN32 block.

Fixes: a2e5848d9d "s_client and s_server options for ECH"
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Sun Apr 26 11:35:52 2026
(Merged from https://github.com/openssl/openssl/pull/30520)
2026-04-26 13:35:27 +02:00
Weidong Wang
aeea7dfaff Fix double-free in mlx_kem_dup() default case
Null mkey/xkey immediately after OPENSSL_memdup() so that any failure
path (including propq strdup) can safely call mlx_kem_key_free() without
risking a double-free on the source key's material. Use key->* rather
than ret->* for source-state checks to make ownership explicit.

Test that mlx_kem_dup() with partial key selection (e.g.
EVP_PKEY_PUBLIC_KEY) does not corrupt the original key's mkey/xkey
sub-objects.  Covers X25519MLKEM768, SecP256r1MLKEM768,
and SecP384r1MLKEM1024.

Fixes: 4b1c73d2dd "ML-KEM hybrids for TLS"

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Sun Apr 26 11:14:12 2026
(Merged from https://github.com/openssl/openssl/pull/30511)
2026-04-26 13:11:28 +02:00
Frederik Wedel-Heinen
7fb28b9cd0 Removes SSLv2 support in TLSProxy.
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Fri Apr 24 20:11:08 2026
(Merged from https://github.com/openssl/openssl/pull/30916)
2026-04-24 20:10:59 +00:00
Daniel Sands
35852da1d9 Add intelligence to asn1_d2i_read_bio for reading entire header without blocking for extra data
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/30401)
2026-04-24 16:27:09 +02:00
ndossche
674c23d265 Fix error check for EVP_CTRL_AEAD_GET_TAG
"< 0" is definitely wrong as it can return 0 on error.
Change the checks that are not of the form "== 1" or "!= 1" to "<= 0".

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Apr 24 11:29:50 2026
(Merged from https://github.com/openssl/openssl/pull/30923)
2026-04-24 11:29:45 +00: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
Jakub Zelenka
3cff7c2181 Add memory allocation failure testing framework
Introduce ADD_MFAIL_TEST for exhaustive testing of allocation failure
handling in individual functions. The framework repeatedly calls the
test function, each time failing one allocation later within the
section bracketed by mfail_start() and mfail_end(), verifying that
every failure path returns 0 without crashing or leaking.

Custom allocators are installed once at startup via
CRYPTO_set_mem_functions(). When not armed, they pass through to
malloc/realloc/free. Installation can be disabled by setting
OPENSSL_TEST_MFAIL_DISABLE for tests that need the default allocator
(e.g. those using OPENSSL_MALLOC_FAILURES).

Additional environment variables control test execution:
OPENSSL_TEST_MFAIL_SKIP_ALL, OPENSSL_TEST_MFAIL_SKIP_SLOW,
OPENSSL_TEST_MFAIL_POINT, and OPENSSL_TEST_MFAIL_START.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Thu Apr 23 20:23:34 2026
(Merged from https://github.com/openssl/openssl/pull/30871)
2026-04-23 20:22:45 +00:00
Dmitry Belyavskiy
5e32b3e3fa Document semantic changes for EVP_get_*by* functions
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/30646)
2026-04-23 16:16:50 +02:00
Viktor Dukhovni
6c0b89aa87 Drop redundant/confusing NULL check
- The pointer cannot be NULL, and test only confuses static analysers.

- Incidentally, undo clang auto-format of  displayed tables in the same file.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Apr 23 14:03:40 2026
(Merged from https://github.com/openssl/openssl/pull/30829)
2026-04-24 00:03:29 +10:00
Viktor Dukhovni
a2079b82ba Drop value barrier from ML-DSA reduce_once
This mirrors the corresponding code in ML-KEM and works under
the same conditions/assumptions.  Also adjusted related
functions with unnecessary 2-layers of constant_time selects
where one suffices (now also matching BoringSSL).

Intentionally uses the constant time instrumentation PR as its
merge-base, so to be merged after than has baked in for a few
days and shows working CT tests in daily CI runs.

Sample before/after performance pairs and percent throughput
increases for one X86_64 CPU:

              keygens/s    sign/s  verify/s
    ML-DSA-44   18728.3    6061.2   23251.6
    ML-DSA-44   21077.2    7392.4   27244.3
    ML-DSA-44     12.5%     22.0%     17.2%

    ML-DSA-65   10084.3    3603.0   13988.6
    ML-DSA-65   11197.9    4549.7   16208.4
    ML-DSA-65     11.0%     26.3%     15.9%

    ML-DSA-87    7184.8    2917.3    8141.0
    ML-DSA-87    8132.4    3693.7    9430.7
    ML-DSA-87     13.2%     26.6%     15.8%

and here's the same for an Apple silicon M2:

              keygens/s    sign/s  verify/s
    ML-DSA-44   17235.7    3099.3   15744.5
    ML-DSA-44   21855.2    4907.6   22849.0
    ML-DSA-44     26.8%     58.3%     45.1%

    ML-DSA-65    9165.8    1908.5   10058.3
    ML-DSA-65   11262.7    3069.6   14348.1
    ML-DSA-65     22.9%     60.8%     42.6%

    ML-DSA-87    6596.1    1563.6    6330.8
    ML-DSA-87    8404.9    2584.6    8767.6
    ML-DSA-87     27.4%     65.3%     38.5%

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Apr 23 13:55:05 2026
(Merged from https://github.com/openssl/openssl/pull/30864)
2026-04-23 23:54:56 +10:00
Milan Broz
20298d388b ci: Add MSYS2-MINGW64 build
MINGW64 with MSYS2 environment is a supported platfrom
but not covered in CI.

This patch adds trivial rebuild test (but avoid 3rd party
scripts), with the same restrictions as MINGW64.

Tests and strict warnings need to be fixed later.

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

Reviewed-by: Dmitry Misharov <dmitry@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Thu Apr 23 12:12:36 2026
(Merged from https://github.com/openssl/openssl/pull/30906)
2026-04-23 14:12:28 +02:00
Joshua Rogers
6e9f47be2e docs: Fix and add documentation about AES-WRAP-PAD ciphers out parameter
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Apr 22 08:13:31 2026
(Merged from https://github.com/openssl/openssl/pull/30653)
2026-04-22 10:13:27 +02:00
legin hpesoj
515f9a4ed1 doc: correct X509v3_get_ext_by_NID.pod to reflect CRL/REVOKED extension behavior
The man page previously stated that X509_CRL_delete_ext() and
X509_REVOKED_add_ext() are 'otherwise identical to the X509v3 functions,'
which is inaccurate. These routines use X509v3_delete_extension(), not
X509v3_delete_ext(), following the changes in #30350 and #30518.
Update the documentation to accurately describe this difference.

CLA: trivial

Signed-off-by: legin hpesoj <ncj2394@rit.edu>

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Apr 22 08:10:46 2026
(Merged from https://github.com/openssl/openssl/pull/30677)
2026-04-22 10:10:33 +02: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
Mounir IDRASSI
9e0d3c0698 Reject empty TLS 1.3 HRR cookie
RFC 8446 defines the Cookie extension as containing a non-empty cookie
vector. The client-side HRR parser accepted a zero-length cookie
because PACKET_memdup() treats an empty packet as success, which
deferred failure until later in the handshake.

Reject an empty cookie during HRR parsing with decode_error and add a
regression test.

Fixes #30868
Fixes: cfef5027bf "Add basic TLSv1.3 cookie support"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Wed Apr 22 07:50:25 2026
(Merged from https://github.com/openssl/openssl/pull/30892)
2026-04-22 09:50:17 +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
Viktor Dukhovni
9406cf1a82 pkey(1) missing setup for interactive pass prompt
The changes in #29324 neglected some setup needed for interactive
password prompting, leading to a segfaul when pkey(1) is asked to
encrypt, but not given an explicit `-pass` argument.

The required plumbing is added.

Fixes: #30889

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Apr 22 07:04:47 2026
(Merged from https://github.com/openssl/openssl/pull/30904)
2026-04-22 09:04:41 +02:00
herbenderbler
9ac29bc857 Fix memory leak in load_key_certs_crls() when add/push fails
When X509_add_cert() or sk_X509_CRL_push() failed, the cert or CRL from
OSSL_STORE was not freed. Free on failure to avoid a leak.

Fix 90-test_memfail.t parsing of count output so the memfail suite runs
correctly: parse 'skip: N count M' with a regex (handles '# ' prefix),
return (0,0) if the count file cannot be opened, and skip with a clear
message when total malloc count is 0 instead of planning 0 tests.

Apply clang-format to test/load_key_certs_crls_memfail.c.

- apps/lib/apps.c: free cert/CRL on add/push failure
- test/build.info: add load_key_certs_crls_memfail (allocfail-tests)
- test/load_key_certs_crls_memfail.c: regression test for issue #30364
- test/recipes/90-test_memfail.t: fix get_count_info parsing and plan

Issue #30364

Fixes: 6d382c74b3 "Use OSSL_STORE for load_{,pub}key() and load_cert() in apps/lib/apps.c"
Fixes: d7fcee3b3b "OSSL_HTTP_parse_url(): add optional port number return parameter and strengthen documentation"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Apr 21 08:50:18 2026
(Merged from https://github.com/openssl/openssl/pull/30428)
2026-04-21 10:50:02 +02:00
Eugene Syromiatnikov
087bddcda9 apps/enc.c: typo fix in -k option description
Add missing closing parenthesis.

Fixes: de89ca9347 "apps/enc.c: Moved -pass, -k, -kfile to encryption options"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Apr 20 10:18:05 2026
(Merged from https://github.com/openssl/openssl/pull/30813)
2026-04-20 12:17:59 +02:00
Dimitri John Ledkov
fda518293a fips: mark X448MLKEM1024 as non-approved
The [FIPS 140-3I.G.](https://csrc.nist.gov/csrc/media/Projects/cryptographic-module-validation-program/documents/fips%20140-3/FIPS%20140-3%20IG.pdf)
Section D.S Key Encapsulation Mechanisms have been substantially
update on April 9, 2026.

It now explicitely lists that hybrid mechanisms must be fixed
combinations with both portions being in boundary, and the intent
should be to use them with an approved combiner such as HKDF as part
of a protocol. With the combinations from the
https://datatracker.ietf.org/doc/draft-ietf-tls-ecdhe-mlkem
explicitely mentioned that they can reach appoved or allowed claims.

Note that consensus for TLS group for X448MLKEM1024 failed to reach on
the [pqc forum](https://mailarchive.ietf.org/arch/browse/tls/?gbt=1&index=YIHJrbWVPdXIr8q57nsEUUmuaIo) and is not part of the
https://datatracker.ietf.org/doc/draft-ietf-tls-ecdhe-mlkem. And there
are no other protocols defined that use this hybrid with an approved
combiner.

Also on https://test.openquantumsafe.org/ there is x448_mlkem768 but
no X448MLKEM1024.

To avoid any confusion, it is best to mark this hybrid as non-approved
going forward. It is likely also worthfile to deprecate X448MLKEM1024
altogether.

Fixes: https://github.com/openssl/openssl/pull/26220

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Mon Apr 20 10:08:09 2026
(Merged from https://github.com/openssl/openssl/pull/30856)
2026-04-20 12:07:45 +02:00
Milan Broz
8449ecf09a ci: Add MINGW64 build
MINGW64 is supported platfrom but not covered in CI.

This patch adds trivial rebuild test, for now without strict
warnings (need to be fixed later).

Fixes: https://github.com/openssl/project/issues/1911
Signed-off-by: Milan Broz <gmazyland@gmail.com>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Mon Apr 20 10:04:58 2026
(Merged from https://github.com/openssl/openssl/pull/30860)
2026-04-20 12:04:52 +02:00
Liu-ErMeng
fe196783f7 sock_read: check ret==0 before BIO_sock_should_retry()
POSIX states errno is only valid when the return value indicates an
error.  recv() sets errno only on -1; when it returns 0 (peer closed)
errno is unspecified.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Apr 20 09:59:27 2026
(Merged from https://github.com/openssl/openssl/pull/30877)
2026-04-20 11:59:13 +02:00
Eugene Syromiatnikov
12969dd832 .github/workflows: remove openssl-3.2 and openssl-3.3 from CI jobs
These branches are EOL, so there is no need to keep running CI jobs
for them.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Mon Apr 20 09:57:54 2026
(Merged from https://github.com/openssl/openssl/pull/30881)
2026-04-20 11:57:46 +02:00
Daniel Gustafsson
4b8ddae690 Fix prototype typo in X509_NAME_get_index_by_NID
s/cont/const/

Fixes: b0f2107b44 "Constify X509_NAME"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Mon Apr 20 07:54:23 2026
(Merged from https://github.com/openssl/openssl/pull/30865)
2026-04-20 09:54:11 +02:00
Alexandr Nedvedicky
f023662d1b Make QUIC radix tests friendly to clang-format
this is yet another small fallout from clang-format
style change. This time for radix tests.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr 17 10:50:07 2026
(Merged from https://github.com/openssl/openssl/pull/30844)
2026-04-17 12:50:05 +02:00
Jan Damborsky
9ae5b6522d Fixes AES optimisations for Fujitsu M10 cause SEGV #29085
Fixes off-by-one error in AES optimisations for Fujitsu Sparc CPUs.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Apr 17 10:46:01 2026
(Merged from https://github.com/openssl/openssl/pull/30814)
2026-04-17 12:45:55 +02:00
Norbert Pocs
db0fe094a8 ASN1_BIT_STRING_name_print check BIO_* RVs
Signed-off-by: Norbert Pocs <norbertp@openssl.org>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Fri Apr 17 10:44:19 2026
(Merged from https://github.com/openssl/openssl/pull/30691)
2026-04-17 12:44:12 +02:00
Matt Caswell
935246a7c9 Grow the init_buf incrementally as we receive data
Instead of growing the init_buf buffer immediately to the full size of the
expected message, we grow it incrementally as we receive the data. This
prevents abuse where the remote peer claims a very large message size, but
then doesn't send it.

This change is as a result of a security issue reported to the
openssl-security team by Okta Red Team. The openssl-security
team have decided to handle this as a "bug or hardening" only fix.

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr 17 10:08:34 2026
(Merged from https://github.com/openssl/openssl/pull/30792)
2026-04-17 11:08:15 +01:00
Tomas Mraz
04623f1df5 ossl_curve448_scalar_halve(): Fix -ansi build
Move statement after declarations.
Fixes 4247fb98de

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Apr 17 06:15:24 2026
(Merged from https://github.com/openssl/openssl/pull/30872)

(cherry picked from commit e812720ddc)
2026-04-17 08:16:34 +02:00
Alexandr Nedvedicky
6983b5c36d port_default_packet_handler() should not attempt to parse QUIC packet
header when destination connection id is not present. To save CPU cycles.

Issue has been noticed and kindly reported by Dan Carpenter via
openssl-users@ mailing list.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Thu Apr 16 22:59:33 2026
(Merged from https://github.com/openssl/openssl/pull/30795)
2026-04-16 18:58:04 -04:00
Tomas Mraz
faa5318c65 ossl_err_get_state_int(): Avoid saving the last sys error if not needed
In calls like ERR_set_mark(), ERR_clear_last_mark() and
others, there is no point in saving the last sys error.

It can be potentially expensive (on Windows).

Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu Apr 16 18:12:49 2026
(Merged from https://github.com/openssl/openssl/pull/30179)
2026-04-16 14:12:41 -04:00
Viktor Dukhovni
d8f1579884 Fix off-by-one in "groups list" parser
When parsing the configured TLS supported groups list reallocating of the list
of "tuples" happened one element too late.  The current tuple count is the
number of "closed" (completed) tuples, the currently active tuple occupies
one more slot, so we need space for `tuple count + 1` elements.

This is only an issue while parsing configurations (not attacker controlled),
and only if the group list somehow manages to contain 32 or distinct elements
(each in its own tuple, and even though OpenSSL does not implement that many
groups in typical builds).

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Apr 16 17:17:38 2026
(Merged from https://github.com/openssl/openssl/pull/30838)
2026-04-16 19:17:30 +02:00
Matt Caswell
350adfe3f9 Add a test for too many PSKs
We test that even if we add too many PSKs we still handle the
ClientHello correctly.

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Apr 16 17:07:38 2026
(Merged from https://github.com/openssl/openssl/pull/30761)
2026-04-16 19:07:36 +02:00
Matt Caswell
adb83a4678 Limit the number of PSKs we accept
To prevent attacks where an unauthenticated client sends us a large
number of PSKs, we place a limit on the number we are prepared to
accept.

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Apr 16 17:07:37 2026
(Merged from https://github.com/openssl/openssl/pull/30761)
2026-04-16 19:07:31 +02:00
Christoph Müllner
d5a952bfe2 riscv: weaken capscheck for rv64gc_v_zvkned_hwprobe entry
QEMU 8.2.2 (ubuntu-latest) does not report ZVKNED via hwprobe
despite zvkned=true being set in QEMU_CPU, so the _V_ZVKNED
assertion would fail in CI for a reason unrelated to OpenSSL.

Weaken the check to _V, which QEMU 8.2.2 does report correctly.
The ZVKNED assertion can be restored once the CI moves to a QEMU
version with full Zvk* hwprobe coverage.

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:43 2026
(Merged from https://github.com/openssl/openssl/pull/30713)
2026-04-16 19:03:19 +02:00
Christoph Müllner
3c141216b1 riscv: add capscheck assertion to hwprobe CI entries
The two hwprobe-based matrix entries exercise hwprobe_to_cap() but
previously contained no assertion to verify that expected extensions
were actually detected; tests pass regardless of which code path is
taken because both the optimised and fallback paths produce correct
output.

Add an optional capscheck field to the matrix schema.  When set, a
new "check detected capabilities" step runs
"openssl info -cpusettings" and asserts the output matches the
given extended regular expression.

Set capscheck for the two hwprobe entries:
- rv64gc_novector_hwprobe: assert "_ZBB" is present.
  With the IS_IN_DEPEND_VECTOR bug, scalar extensions are gated on
  VECTOR_CAPABLE (false when V is absent), so ZBB is not detected
  and the assertion fails.
- rv64gc_v_zvkned_hwprobe: assert "_V_ZVKNED" is present.

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:42 2026
(Merged from https://github.com/openssl/openssl/pull/30713)
2026-04-16 19:03:19 +02:00
Christoph Müllner
a6130eb4c1 riscv: add hwprobe-based CI entries for capability detection
All existing RISC-V cross-compile matrix entries set OPENSSL_riscvcap,
which causes OPENSSL_cpuid_setup() to call parse_env() and skip the
hwprobe_to_cap() code path entirely.  That path has never been exercised
by CI, leaving bugs in it undetectable.

Add two matrix entries that omit opensslcapsname so OPENSSL_riscvcap is
not set and hwprobe_to_cap() is called:

- rv64gc_novector_hwprobe: rv64 with ZBB/ZBC/ZBS/ZBKB, V disabled.
  AT_HWCAP V bit is clear (VECTOR_CAPABLE=false).  Exercises the
  scalar-extension detection branch of hwprobe_to_cap().

- rv64gc_v_zvkned_hwprobe: rv64 with V (vlen=128) and ZVKNED.
  AT_HWCAP V bit is set (VECTOR_CAPABLE=true).  Exercises the
  vector-extension detection branch and the IS_IN_DEPEND_VECTOR
  guard that gates Zvk* extensions on V availability.

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:41 2026
(Merged from https://github.com/openssl/openssl/pull/30713)
2026-04-16 19:03:19 +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
Daniel Kubec
004e9255e4 EAP-FAST: echo Session ID on PAC-based session resumption
Ensure that when a ClientHello includes both a Session ID and a PAC-Opaque
in the SessionTicket extension, the server echoes the same Session ID in
the ServerHello if the session is resumed based on the PAC-Opaque.

Fixes #29095

Signed-off-by: Daniel Kubec <kubec@openssl.foundation>
Co-authored-by: Matt Caswell <matt@openssl.foundation>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Apr 16 17:01:03 2026
(Merged from https://github.com/openssl/openssl/pull/30695)
2026-04-16 19:00:56 +02:00
Dr. David von Oheimb
fc8f51d95f 25-test_verify.t: improve variable and test name, add relative {file:,}D:cert test for Windows
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Apr 16 16:52:57 2026
(Merged from https://github.com/openssl/openssl/pull/27554)
2026-04-16 18:52:55 +02:00
Dr. David von Oheimb
7c6d726834 Factor out ossl_file_stat() from file_store.c:file_open()
It is also simplified and generalized.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Apr 16 16:52:56 2026
(Merged from https://github.com/openssl/openssl/pull/27554)
2026-04-16 18:52:25 +02:00
Matt Caswell
91ce06e984 Clarify the set_session_id_context functions
Clarify when they can be used, and introduce some warnings about using
them too late in the handshake. In particular using them in the server
name callback is too late.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Apr 16 16:46:26 2026
(Merged from https://github.com/openssl/openssl/pull/30797)
2026-04-16 18:46:18 +02:00
Lukas Gerlach
3e8e5cb67f Fix constant-time violation in ossl_curve448_scalar_halve
Add a value barrier to the mask variable in ossl_curve448_scalar_halve()
to prevent LLVM SimpleLoopUnswitchPass from introducing a
secret-dependent branch.

When compiled with Clang >= 17 at -O3, the mask which is static during
the loop (derived from the secret scalar LSB) is used by SimpleLoopUnswitchPass
to clone the loop body into two versions guarded by a branch on the secret bit.
This produces a side-channel that leaks nonce parity.

The value barrier forces the compiler to treat the mask as opaque,
preventing loop unswitching while maintaining identical performance.

A portable value_barrier_c448 macro is added to word.h to select the
appropriate barrier width (32 or 64 bit) based on C448_WORD_BITS.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Apr 16 16:43:22 2026
(Merged from https://github.com/openssl/openssl/pull/30845)
2026-04-16 18:43:04 +02:00
openssl-machine
fcc8edbd98 Forward port release update commit to master branch
Bring NEWS.md/CHANGES.md into line with updates on the 4.0 branch

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Apr 16 16:27:47 2026
(Merged from https://github.com/openssl/openssl/pull/30830)
2026-04-16 18:27:35 +02:00
Daniel Kubec
6115286fae TLSv1.3: reissue session ticket after full handshake on ciphersuite mismatch
When session resumption falls back to a full handshake due to a ciphersuite
mismatch, ensure a new session ticket is issued with the newly negotiated
ciphersuite.

Fixes #18549

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Thu Apr 16 11:27:51 2026
(Merged from https://github.com/openssl/openssl/pull/30626)
2026-04-16 13:27:41 +02:00
Gellért Peresztegi-Nagy
f60c9d1448 ssl: Fix ssl_do_config to clean up errors on success with ERR_set_mark
ssl_do_config() could leave stale errors on the error stack even on
success, so that later error checking operations could mistakenly
surface these errors. Use ERR_set_mark()/ERR_pop_to_mark() to cleanly
discard errors when the function succeeds or when system config errors
are non-fatal.

Fixes #30760

Co-authored-by: Brandon Allard <brandon@redpanda.com>

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Thu Apr 16 11:24:56 2026
(Merged from https://github.com/openssl/openssl/pull/30765)
2026-04-16 13:24:48 +02:00
Eugene Syromiatnikov
8d8367dbd8 ossl-guide-migration.pod: tfixes in TLS fixed ver meth deprecation desc
Change duplicating names of the suggested function names from TLS_* to DTLS_*
ones and fix the case of "API".

Co-Authored-by: Frederik Wedel-Heinen <frederik.wedel-heinen@dencrypt.dk>
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
MergeDate: Thu Apr 16 11:19:19 2026
(Merged from https://github.com/openssl/openssl/pull/30819)
2026-04-16 13:18:51 +02:00
jlg1061
41fed10fea Add regression tests to test/evp_extra_test.c that dynamically
discover all provided ciphers with non-zero IV length and verify
correct multi-step initialization semantics.

The EVP API permits key and IV to be supplied in separate
`EVP_CipherInit_ex()` calls (e.g. key-only followed by IV-only).
A recent bug (PR #29934, ASCON-AEAD128) demonstrated that a
provider may silently ignore a key-only init, resulting in reuse
of a previously loaded key during a subsequent IV-only init.

To prevent similar regressions, this change introduces three
generic tests that automatically cover all IV-taking ciphers:

Verifies that:
- `init(key) → init(iv)`
- `init(iv) → init(key)`

produce identical ciphertext (and authentication tag for AEAD
ciphers) compared to single-call `init(key, iv)`.

Primes a context with `key1/iv1`, then re-initializes via
`init(key2) → init(iv2)` and verifies the output matches a fresh
`encrypt(key2, iv2)` operation, ensuring that no previously stored
key is reused.

Encrypts using single-call initialization and then decrypts using
multi-step initialization, verifying plaintext recovery. For AEAD
ciphers, this also exercises tag verification through the
multi-step path.

Ciphers are discovered using `EVP_CIPHER_do_all_provided()`,
requiring no maintenance when new IV-taking ciphers are added.
SIV mode is skipped due to its synthetic IV semantics. CCM mode
handling includes required length declarations.

This provides broad regression coverage for the provider
implementations that support multi-step EVP initialization.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Apr 16 07:08:17 2026
(Merged from https://github.com/openssl/openssl/pull/30141)
2026-04-16 09:09:38 +02:00
Tomas Mraz
6fcba2a133 Fix broken sslapitest with old FIPS providers
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Apr 16 06:34:31 2026
(Merged from https://github.com/openssl/openssl/pull/30858)
2026-04-16 07:47:01 +02:00
Eugene Syromiatnikov
552fe15da5 test/quicapitest.c: restore array formatting butchered by clang-format
Shut off clang-format, as it is incapable of formatting arrays properly,
and just mangles everything instead.  Also, while at it, drop the trailing
commas from TPARAM_CHECK_* definitions, as they are pretty confusing.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Apr 15 12:45:37 2026
(Merged from https://github.com/openssl/openssl/pull/30580)
2026-04-15 14:44:59 +02:00
Eugene Syromiatnikov
a8396e1445 run-checker-ci.yml, run-checker-merge: add -DOPENSSL_USE_IPV6=0
Add -DOPENSSL_USE_IPV6=0 to run-checker-ci.yml and move no-ui
to run-checker-merge.

References: https://github.com/openssl/openssl/issues/30574
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Apr 15 12:45:34 2026
(Merged from https://github.com/openssl/openssl/pull/30580)
2026-04-15 14:44:59 +02:00
Eugene Syromiatnikov
3768e9a3e3 Avoid creating TLSProxy on IPv6 loopback address is IPv6 is disabled
Add a parameter to TLSProxy::Proxy->new()
and TLSProxy::Proxy->new_dtls() that indicates IPv6 usage preference
and pass have_IPv6() to it, so IPv6 usage is avoided when it is disabled.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Apr 15 12:45:33 2026
(Merged from https://github.com/openssl/openssl/pull/30580)
2026-04-15 14:44:58 +02:00
Eugene Syromiatnikov
6e6e0d89a2 test/quicapitest.c: skip test_quic_peer_addr_v6() if IPv6 is disabled
Define and add the test only if OPENSSL_USE_IPV6 is set to 1.

Resolves: https://github.com/openssl/openssl/issues/30574
Fixes: beec4e146a "Add SSL_get_peer_addr() function to query peer address for QUIC"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Apr 15 12:45:31 2026
(Merged from https://github.com/openssl/openssl/pull/30580)
2026-04-15 14:44:58 +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
kovan
41e564fc07 doc: clarify -hex option behavior in openssl prime
The -hex option description was ambiguous about its exact behavior.
Clarify that:
- With -generate: outputs the prime in hex instead of decimal
- When checking: interprets input as hex instead of decimal
- Output when checking is always hex regardless of this option

Fixes #19208

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

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Apr 15 12:33:18 2026
(Merged from https://github.com/openssl/openssl/pull/29913)
2026-04-15 14:33:16 +02:00
Eugene Syromiatnikov
c26f408ea9 .github/workflows/coveralls.yml: move the master branch to the top of the matrix
So its config options can be copied into a newly created branch more naturally.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Apr 15 12:30:38 2026
(Merged from https://github.com/openssl/openssl/pull/30785)
2026-04-15 14:30:15 +02:00
Eugene Syromiatnikov
4ba813d147 .github/workflows/coveralls.yml: enable allocafil tests on openssl-4.0
This really should have been done when the branch was added, but better
late than never.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Apr 15 12:30:37 2026
(Merged from https://github.com/openssl/openssl/pull/30785)
2026-04-15 14:30:15 +02:00
Eugene Syromiatnikov
2594e71d49 .github/workflows/coveralls.yml: add enable-lms to openssl-3.6 and openssl-4.0 configs
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Apr 15 12:30:35 2026
(Merged from https://github.com/openssl/openssl/pull/30785)
2026-04-15 14:30:15 +02:00
Eugene Syromiatnikov
7a58ad887e .github/workflows/coveralls.yml: drop no-afalgeng from openssl-4.0 config
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Apr 15 12:30:34 2026
(Merged from https://github.com/openssl/openssl/pull/30785)
2026-04-15 14:30:15 +02:00
Eugene Syromiatnikov
0af8e79236 .github/workflows/coveralls.yml: drop EOL branches from the run matrix
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Apr 15 12:30:33 2026
(Merged from https://github.com/openssl/openssl/pull/30785)
2026-04-15 14:30:15 +02:00
Norbert Pocs
9e26ae32a7 Document ASN1_BIT_STRING functions
Signed-off-by: Norbert Pocs <norbertp@openssl.org>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Apr 15 12:25:45 2026
(Merged from https://github.com/openssl/openssl/pull/30690)
2026-04-15 14:25:44 +02:00
Taavi Eomäe
cada1613f3 Update S/MIME tool documentation
CLA: trivial

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Wed Apr 15 12:19:04 2026
(Merged from https://github.com/openssl/openssl/pull/30583)
2026-04-15 14:19:01 +02:00
Josh Auler
8e5f3a2418 doc: clarify -CAfile and -verifyCAfile semantics in s_server
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Wed Apr 15 12:11:34 2026
(Merged from https://github.com/openssl/openssl/pull/30405)
2026-04-15 14:11:11 +02:00
kovan
ba2f616aa9 doc: Clarify that BN_CTX must not be NULL for BN arithmetic functions
The documentation for BN_add and related functions did not explicitly
state that the ctx parameter cannot be NULL. Users may assume NULL is
acceptable since some other OpenSSL functions allow it, but passing
NULL to functions like BN_mod_add() or BN_mod() causes a crash.

Update the documentation to explicitly state that ctx must not be NULL.

Fixes #12092

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

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Apr 15 11:47:59 2026
(Merged from https://github.com/openssl/openssl/pull/29773)
2026-04-15 13:47:58 +02:00
Alexandr Nedvedicky
f4079c804f Fix memory leak in ossl_uint_set_insert()
There is a missing call to OPENSSL_free() in the branch
where existing sets are merged to new range. There is
no evidence/POC OpenSSL poject is aware of the leak can
be triggered by QUIC protocol operation.

The issue has been kindly reported by Abhinav Agarwal (@abhinavagarwal07)

Fixes: c5ca718003 "uint_set: convert uint_set to use the list data type"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr 15 11:28:41 2026
(Merged from https://github.com/openssl/openssl/pull/30718)
2026-04-15 13:28:19 +02:00
Christoph Müllner
de841a4003 riscv: fix missing VLEN >= 128 guard in AES-GCM dispatch
ossl_prov_aes_hw_gcm() returned &rv64i_zvkned_gcm when
RISCV_HAS_ZVKNED() was true but RISCV_HAS_ZVKB()/RISCV_HAS_ZVKG()
were false, without checking riscv_vlen() >= 128. All Zvkned
instructions require VLEN >= 128; on VLEN=64 hardware this would
cause illegal-instruction traps.

All other Zvk* dispatch sites already guard on riscv_vlen() >= 128.
Hoist the check to the outer if (RISCV_HAS_ZVKNED()) condition to
cover both return paths uniformly.

Fixes: d056e90ee5 "riscv: Provide vector crypto implementation of AES-GCM mode."
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Apr 15 11:24:50 2026
(Merged from https://github.com/openssl/openssl/pull/30714)
2026-04-15 13:24:41 +02:00
Joshua Rogers
c629d597bc ecp_s390x_nistp.c: reorder nullptr checks
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr 15 11:01:22 2026
(Merged from https://github.com/openssl/openssl/pull/30648)
2026-04-15 13:00:58 +02:00
Joshua Rogers
db3178f420 ecp_s390x_nistp.c: Reject negative digest length to prevent size_t underflow
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr 15 11:01:20 2026
(Merged from https://github.com/openssl/openssl/pull/30648)
2026-04-15 13:00:57 +02:00
Jon Ericson
c4a2476efa ossl-guide-migration: Fix ASN1_STRING_ functions formatting
keep bold and move to an unordered list

Co-authored-by: Tomáš Mráz <tm@t8m.info>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Wed Apr 15 10:54:01 2026
(Merged from https://github.com/openssl/openssl/pull/30629)
2026-04-15 12:53:00 +02:00
Jon Ericson
ad19186015 ossl-guide-migration: delete duplicate entry
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Wed Apr 15 10:54:00 2026
(Merged from https://github.com/openssl/openssl/pull/30629)
2026-04-15 12:52:26 +02:00
Jon Ericson
6e9a4f9353 ossl-guide-migration: Format function names correctly
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Wed Apr 15 10:53:59 2026
(Merged from https://github.com/openssl/openssl/pull/30629)
2026-04-15 12:51:25 +02:00
Sunwoo Lee
00df8afc01 quic: fix channel leak when ossl_quic_provide_initial_secret fails
In port_bind_channel(), when ossl_quic_provide_initial_secret()
  fails, the function returns without freeing the QUIC_CHANNEL
  that was just created by port_make_channel(). The caller sees
  new_ch == NULL and cannot free it, leaking the channel and all
  its sub-allocations (QRX, QTX, TXP, ACKM).

  Add ossl_quic_channel_free(ch) before the early return, matching
  the cleanup pattern already used by the other error paths in the
  same function (lines 864, 873).

  CWE-401

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

  CLA: trivial

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr 15 10:44:51 2026
(Merged from https://github.com/openssl/openssl/pull/30612)
2026-04-15 12:44:29 +02:00
Eugene Syromiatnikov
9ca063ad84 Work around "Use of uninitialized value..." in mkinstallvars.pl
Avoid "Use of uninitialized value in concatenation (.) or string
at util/mkinstallvars.pl line 139." message by supplying COMMENT
in the mkinstallvars.pl call exporters/build.info.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Apr 14 08:54:11 2026
(Merged from https://github.com/openssl/openssl/pull/30768)
2026-04-14 10:54:05 +02:00
Eugene Syromiatnikov
0a2101e52b NOTES-NONSTOP.md: remove the "Linking and Loading Considerations" section
Since the atexit() handler setup was removed in [1], the section content
is no longer relevant;  remove it.

[1] https://github.com/openssl/openssl/pull/29385

References: https://github.com/openssl/openssl/issues/30742
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Tue Apr 14 08:50:36 2026
(Merged from https://github.com/openssl/openssl/pull/30776)
2026-04-14 10:50:31 +02:00
Eugene Syromiatnikov
b632e79f0c INSTALL.md: mention that no-atexit has no effect
Since the atexit() handler was removed in [1], no-atexit configuration
option has no effect, so update the documentation accordingly.

[1] https://github.com/openssl/openssl/pull/29385

References: https://github.com/openssl/openssl/pull/30742
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Tue Apr 14 08:50:35 2026
(Merged from https://github.com/openssl/openssl/pull/30776)
2026-04-14 10:50:31 +02:00
Neil Horman
bdfac7bb66 Add docs for new atomic apis
Documents CRYPTO_atomic_load_ptr(), CRYPTO_atomic_store_ptr() and
CRYPTO_atomic_cmp_exch_ptr()

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Apr 14 08:29:33 2026
(Merged from https://github.com/openssl/openssl/pull/30670)
2026-04-14 10:29:28 +02:00
Neil Horman
403660257b Run make update
Adds CRYPTO_atomic_load_ptr, CRYPTO_atomic_store_ptr and
CRYPTO_atomic_cmp_exch_ptr

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Apr 14 08:29:32 2026
(Merged from https://github.com/openssl/openssl/pull/30670)
2026-04-14 10:29:28 +02:00
Neil Horman
91072b2039 convert rand_meth_lock to atomics
Using our previously created atomic ops, we can (almost) eliminate the
use of the rand_meth_lock.  This lock guards reads/write on the
RAND_default_meth global variable, which is generally written only once
during a process lifetime.  By replacing the lock with an atomic read
for reads, and an atomic compare and exchange or atomic store for
writes, we can significantly improve the execution time of
RAND_get_rand_method, which is called every time a process calls
RAND_bytes_ex()

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Apr 14 08:29:31 2026
(Merged from https://github.com/openssl/openssl/pull/30670)
2026-04-14 10:29:28 +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
Danny Tsen
91f7d4e76e ppc64le: Optimized MLKEM NTT, supports p8 (ISA 2.07) and above architectures.
Optimized MKEM NTT implementation for ppc64le for ISA 2.07 and above architectures.

Supporting files include,
asm/mlkem_ntt_ppc64le.S: supports NTT.
asm/mlkem_intt_ppc64le.S: supports inverse NTT.
asm/mlkem_ppc_macros_asm.S: PPC64LE macros.

Modified build.info to support ppc64le assembly implementation.
Added new definitions of MLKEM_NTT_ASM for NTT and inverse NTT for
optimized assembly implementation.

This is the initial archtecture specific implementation so can be mdified
to adapt to a new build structures.

Baseline speed test:
                               keygen    encaps    decaps keygens/s  encaps/s  decaps/s
                 ML-KEM-512 0.000037s 0.000030s 0.000046s   26744.7   33529.5   21875.6
                 ML-KEM-768 0.000059s 0.000043s 0.000066s   16836.6   23118.8   15198.3
                ML-KEM-1024 0.000088s 0.000060s 0.000089s   11406.2   16749.7   11265.8

Optimized:
                               keygen    encaps    decaps keygens/s  encaps/s  decaps/s
                 ML-KEM-512 0.000023s 0.000015s 0.000022s   42789.9   65006.8   46064.6
                 ML-KEM-768 0.000038s 0.000023s 0.000032s   25983.3   43731.1   31254.7
                ML-KEM-1024 0.000060s 0.000033s 0.000045s   16662.7   30708.2   22034.6

The optimized code runs around 1.9 times faster than the original C implementation.

Tested-by: Eugene Syromiatnikov <esyr@openssl.org>
Signed-off-by: Danny Tsen <dtsen@us.ibm.com>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Apr 14 08:23:42 2026
(Merged from https://github.com/openssl/openssl/pull/30709)
2026-04-14 10:23:40 +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
Brenda So
ebb51594d1 Skip parsing OCSP status_request when no status call is registered
When no ext.status_cb is set, the server will not produce a stapled
OCSP response. This patch returns early from tls_parse_ctos_status_request
before parsing the extension body to save memory.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Mon Apr 13 09:40:08 2026
(Merged from https://github.com/openssl/openssl/pull/30630)
2026-04-13 11:40:06 +02:00
Tomas Mraz
123262134a We now have ml-dsa asm, add it to fips-checksums
We also add other PQC algorithm directories that might
appear in future so they are picked-up by the script
once they appear. This requires checking whether the
directory exists.

Also update the fips sources and checksums.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Mon Apr 13 09:35:17 2026
(Merged from https://github.com/openssl/openssl/pull/30502)
2026-04-13 11:35:11 +02:00
F. R. Da Silva
98ed49849e apps : enforce command-line parameter checking.
Improve 'verify' option help messages.

integer value parsing formats are:
- 'n' is any integer
- 'N' is a non-negative integer (i.e. value >= 0)
- 'p' is a positive integer (i.e. value > 0)

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Mon Apr 13 09:30:22 2026
(Merged from https://github.com/openssl/openssl/pull/30476)
2026-04-13 11:30:19 +02:00
Filipe R. Da Silva
871e10f17a apps: remove atoi() calls.
Related to #8216

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Mon Apr 13 09:30:21 2026
(Merged from https://github.com/openssl/openssl/pull/30476)
2026-04-13 11:29:19 +02:00
Viktor Dukhovni
f45bb99670 Precompute some helper objects in each SSL_CTX
Instead of repeated fetching, precompute the below per the library
context and properties of the SSL_CTX and use them for the lifetime of
the SSL_CTX.

    - HMAC algorithm handle (session ticket HMAC)
    - SHA2-256 algorithm handle (session ticket HMAC)
    - AES_256-CBC algorithm handle (session ticket en/decryption)
    - TLS1 PRF (when TLS <= 1.2 is supported)

The "sha1" and "md5" handles are no longer used, and those fields are
removed.

The `SSL_HMAC` objects used internally are now stack allocated, and the
associated "new" and "free" functions are now called "construct" and
"destruct" respectively.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon Apr 13 09:03:45 2026
(Merged from https://github.com/openssl/openssl/pull/30696)
2026-04-13 11:03:43 +02:00
Matt Caswell
b4cd09b7eb Fix no-dtls1_2 test failure
Fix a failure with no-dtls1_2 introduced by the test in #30503

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Apr 13 08:59:03 2026
(Merged from https://github.com/openssl/openssl/pull/30704)
2026-04-13 10:58:52 +02:00
Milan Broz
bdebaa496c ci: Use jom to parallize Windows builds
The jom version in choco install is obsolete,
but it works fine for CI.

Users should use jom 1.1.7 or more recent.

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Mon Apr 13 08:46:21 2026
(Merged from https://github.com/openssl/openssl/pull/30703)
2026-04-13 10:45:52 +02:00
Milan Broz
be67880c1e Windows: Use /Z7 compiler flag to enable parallel builds
MSVC compilation on Windows cannot be reliably parallelized
with tools like jom (an nmake replacement) due to contention
on shared .pdb files used for debug info. Writes to a shared
.pdb must be serialized.

The /FS compiler flag serializes concurrent compiler writes,
but does not resolve contention when the compiler and linker
access the same .pdb file. With shared .pdb files (e.g. app.pdb),
the makefile does not prevent races between the linker and
compilation of multiple targets.

This can be resolved either by restructuring the makefile
to introduce sentinel dependencies that serialize the conflicting
steps, or by eliminating the shared .pdb entirely.

This patch takes the latter approach: it replaces /Zi with /Z7,
which embeds debug info directly into each .obj file and avoids
any shared-file contention. /Z7 is supported by all MSVC versions.

The linker-generated .pdb is unaffected.

Side effects: object files are slightly larger, and all .pdb files
are now named after their target — the shared app.pdb, ossl_static.pdb,
and dso.pdb no longer exist.

With this change, jom can be used to parallelize the build.

Fixes: #9931

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Mon Apr 13 08:46:20 2026
(Merged from https://github.com/openssl/openssl/pull/30703)
2026-04-13 10:45:52 +02:00
Tomas Mraz
0463cbf185 OSSL_PARAM_BLD_push_octet_*(): Allow NULL buffer with 0 bsize
Fixes #30728

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Mon Apr 13 07:47:44 2026
(Merged from https://github.com/openssl/openssl/pull/30730)
2026-04-13 09:47:42 +02:00
Norbert Pocs
35b0829a6a Remove duplicate function asn1_bit_string_set_unused_bits
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:12 2026
(Merged from https://github.com/openssl/openssl/pull/30746)
2026-04-13 09:11:01 +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
Nikolas Gauder
16892155e1 quic: fix NULL txl dereference in qtx_resize_txe
Fixes: 1957148384 "QUIC Record Layer (Refactor and TX Side)"

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sat Apr 11 20:55:10 2026
(Merged from https://github.com/openssl/openssl/pull/30474)
2026-04-11 22:55:09 +02:00
Samaresh Kumar Singh
4d487eb1ac style: fix clang-format issues in chacha_internal_test.c
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Sat Apr 11 20:06:07 2026
(Merged from https://github.com/openssl/openssl/pull/30587)
2026-04-11 22:05:58 +02:00
Samaresh Kumar Singh
831f9b7f38 test/chacha: added ELFv2 ABI FPR preservation check for POWER10 8x path
On POWER10, ChaCha20_ctr32_vsx_8x is activated for buffers over 255
bytes and uses vxxlor to alias FPR14-FPR25 as temporary storage. Add a
test to chacha_internal_test that pins known values in f14-f25 via
inline asm, calls through ChaCha20_ctr32 with a 512-byte buffer to
trigger the 8x path, and verifies the registers still hold their
original values. The test is gated on PPC_BRD31 (POWER10 capability
flag) so it is skipped silently on older hardware.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Sat Apr 11 20:06:05 2026
(Merged from https://github.com/openssl/openssl/pull/30587)
2026-04-11 22:05:47 +02:00
Samaresh Kumar Singh
3d1b8389cb chacha/asm: save f17 in 8x prologue for contiguous f14-f25 range
f17 is not directly clobbered by any vxxlor in this function, but
saving the full contiguous range f14-f25 is cleaner and avoids any
future ambiguity if the code is modified. Adjust all subsequent FPR
slot offsets and the VMX base offset accordingly, and update the frame
size comment.

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Sat Apr 11 20:06:04 2026
(Merged from https://github.com/openssl/openssl/pull/30587)
2026-04-11 22:05:39 +02:00
Samaresh Kumar Singh
9f52ccf371 chacha/asm: fix ELFv2 ABI violation in ChaCha20_ctr32_vsx_8x
The 8-block POWER10 ChaCha20 path uses vxxlor to spill VMX values into
VSR0-VSR26, which aliases FPR0-FPR26. FPR14-FPR31 are callee-saved per
the ELFv2 ABI, but the function was never saving or restoring them,
silently corrupting 11 FPRs (12 on big-endian) across any call with a
buffer larger than 255 bytes. VMX registers v20-v23, also
callee-saved, had the same problem.

Fix by increasing the frame size to accommodate save slots for
FPR14-FPR25 (and FPR26 on BE) and VMX v20-v23, and adding the
corresponding stfd/lfd and stvx/lvx pairs in the prologue and
epilogue. The VRSAVE save offset is updated to a fixed expression so
it stays clear of the new save area.

Fix for the bug #30584

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Sat Apr 11 20:06:02 2026
(Merged from https://github.com/openssl/openssl/pull/30587)
2026-04-11 22:05:30 +02:00
Ethan
0267e86f76 doc: updates no-pinshared description
The current documentation heavily references the now removed
`atexit()` handlers. This updates the description to better reflect
it's current utility (removal of `-Wl,-znodelete` linker flags on
Linux and Hurd).

Fixes #30586

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Sat Apr 11 19:44:00 2026
(Merged from https://github.com/openssl/openssl/pull/30606)
2026-04-11 21:43:34 +02:00
Igor Ustinov
514cd6ec82 Setting statem.error_state more carefully
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Sat Apr 11 19:31:39 2026
(Merged from https://github.com/openssl/openssl/pull/30647)
2026-04-11 21:31:33 +02:00
Viktor Dukhovni
535d515118 SSL_use_cert_and_key NPE with provided keys
SSL_use_cert_and_key(3) dereferenced a NULL SSL_CTX pointer
via ssl_cert_lookup_by_pkey() when the private key type was
not one of the builtin ones, but was provider-based.

Bug introduced in Postfix 3.2 (commit ee58915cfd).

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sat Apr 11 19:04:12 2026
(Merged from https://github.com/openssl/openssl/pull/30683)
2026-04-11 21:03:25 +02:00
Eugene Syromiatnikov
43377bb06e CHANGES.md, NEWS.md: update for 3.6.2
3.6.2 CHANGES.md includes the following:
 * CVE-2026-2673, CVE-2026-28386, CVE-2026-28387, CVE-2026-28388,
   CVE-2026-28389, CVE-2026-28390, CVE-2026-31789, CVE-2026-31790
 * https://github.com/openssl/openssl/pull/30384
   "Fix #19891 CONNECT request for IPv6 targets in OSSL_HTTP_proxy_connect"
 * https://github.com/openssl/openssl/pull/30411
   "Fix detection of plaintext HTTP over TLS (3.6/3.5 backport)"
 * https://github.com/openssl/openssl/pull/30557
   "re-constructorize the cpuid stuff, but fix riscv to not depend
   on BIO_snprintf."

3.6.2 NEWS.md includes the following:
 * CVE-2026-2673, CVE-2026-28386, CVE-2026-28387, CVE-2026-28388,
   CVE-2026-28389, CVE-2026-28390, CVE-2026-31789, CVE-2026-31790

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Sat Apr 11 18:51:42 2026
(Merged from https://github.com/openssl/openssl/pull/30720)
2026-04-11 20:51:23 +02:00
sftcd
96c76dc72b curl ECH+QUIC fix
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Sat Apr 11 18:29:37 2026
(Merged from https://github.com/openssl/openssl/pull/30727)
2026-04-11 20:29:36 +02:00
Matt Caswell
c56d37defe Fix off-by-one s_client overflows
There are one byte buffer overflows possible in s_client's handling
of STARTTLS in various protocols. If a server's response fills the entire
buffer (16k) then we attempt to add a NUL terminator one byte off the end
of the buffer.

This was reported by Igor Morgenstern from AISLE to openssl-security and
assessed by the security team as "bug or hardening only".

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Sat Apr 11 16:16:24 2026
(Merged from https://github.com/openssl/openssl/pull/30731)
2026-04-11 18:15:14 +02:00
Sashan
561a86e783 Update apps/lib/s_cb.c
Co-authored-by: Bob Beck <beck@obtuse.com>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr 10 12:22:48 2026
(Merged from https://github.com/openssl/openssl/pull/30596)
2026-04-10 14:22:43 +02:00
Sashan
bed493cb49 Update apps/lib/s_cb.c
Co-authored-by: Bob Beck <beck@obtuse.com>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr 10 12:22:46 2026
(Merged from https://github.com/openssl/openssl/pull/30596)
2026-04-10 14:22:43 +02:00
Alexandr Nedvedicky
69755d2a10 fix BIO_vsnprintf() with NULL string arg crash on Solaris 10
Issue was kindly reported and fixes suggested by @rainerjung

Fixes #30402

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr 10 12:22:44 2026
(Merged from https://github.com/openssl/openssl/pull/30596)
2026-04-10 14:22:43 +02:00
Jun Aruga
72d5e8dcd2 Improve PBKDF2 password strength too weak error message with arguments
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Apr  8 10:34:20 2026
(Merged from https://github.com/openssl/openssl/pull/30628)
2026-04-08 12:34:09 +02:00
Joshua Rogers
e249566980 evp_skey_test.c: Add test for EVP_SKEY_to_provider cross-provider transfer
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Wed Apr  8 10:27:04 2026
(Merged from https://github.com/openssl/openssl/pull/30650)
2026-04-08 12:27:01 +02:00
Joshua Rogers
eaef6b20c7 evp_skey_test.c: Add test for EVP_SKEY_to_provider same-provider path
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Wed Apr  8 10:27:03 2026
(Merged from https://github.com/openssl/openssl/pull/30650)
2026-04-08 12:27:01 +02:00
Joshua Rogers
e1156ee77b s_lib.c: Fix refcount leak in EVP_SKEY_to_provider
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Wed Apr  8 10:27:02 2026
(Merged from https://github.com/openssl/openssl/pull/30650)
2026-04-08 12:26:20 +02:00
Eugene Syromiatnikov
ef079ec822 OPENSSL_secure_malloc.pod: mention CRYPTO_secure_actual_size()
Add mentions to NAME, SYNOPSIS, and RETURN VALUES, and provide a short
description (that it is identical to its OPENSSL_* counterpart)
to DESCRIPTION.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr  8 10:23:57 2026
(Merged from https://github.com/openssl/openssl/pull/30623)
2026-04-08 12:23:48 +02:00
Eugene Syromiatnikov
fb6c9d8620 OPENSSL_malloc.pod: mention CRYPTO_memdup()
Add its mentions to NAME, SYNOPSIS, and RETURN VALUES sections.
Also, while at it, put OPENSSL_{str,strn,mem}dup() with the other
OPENSSL_* interfaces, and add mentions of OPENSSL_str{,n}dup()
to RETURN VALUES.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr  8 10:23:55 2026
(Merged from https://github.com/openssl/openssl/pull/30623)
2026-04-08 12:23:48 +02:00
Eugene Syromiatnikov
56358abb5a OPENSSL_malloc.pod: mention CRYPTO_aligned_alloc{,_array}() in RETURN VALUES
Addition of those has been originally overlooked.

Complements: cc4ea5e000 "Introduce new internal hashtable implementation"
Complements: fa9b7b930e "Add array memory allocation routines"
Complements: 14a24fd14f "doc/man3/OPENSSL_malloc.pod: explicitly document freeptr value on failures"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr  8 10:23:55 2026
(Merged from https://github.com/openssl/openssl/pull/30623)
2026-04-08 12:23:48 +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
Jun Aruga
8d2a17d4e0 crypto/pkcs12/p12_add.c: Restore ERR_set_mark and ERR_pop_to_mark
The commit <2ea6e785f5> removed the
ERR_set_mark and ERR_pop_to_mark calls before and after the EVP_CIPHER_fetch
call in several files.

However, in PKCS12_pack_p7encdata_ex, crypto/pkcs12/p12_add.c, there is a valid
case that EVP_CIPHER_fetch returns NULL, raising an error, and calls
PKCS5_pbe_set_ex. The case is such as PBE-SHA1-3DES.

PKCS12_pack_p7encdata_ex, crypto/pkcs12/p12_add.c:
```
...
    pbe_ciph = EVP_CIPHER_fetch(ctx, OBJ_nid2sn(pbe_nid), propq);

    if (pbe_ciph != NULL) {
        pbe = PKCS5_pbe2_set_iv_ex(pbe_ciph, iter, salt, saltlen, NULL, -1, ctx);
    } else {
        pbe = PKCS5_pbe_set_ex(pbe_nid, iter, salt, saltlen, ctx);
    }
...
```

So, we need to restore ERR_set_mark and ERR_pop_to_mark calls before and after
the EVP_CIPHER_fetch call for this case.

A reproducer is below.

```
$ openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -nodes \
  -subj "/CN=Test" 2> /dev/null
$ openssl pkcs12 \
    -export -in cert.pem -inkey key.pem -out test.p12 -passout pass: \
    -keypbe PBE-SHA1-3DES -certpbe PBE-SHA1-3DES
40276EC7677F0000:error:0308010C:digital envelope routines:inner_evp_generic_fetch:unsupported:crypto/evp/evp_fetch.c:376:Global default library context, Algorithm (PBE-SHA1-3DES : 0), Properties (<null>)
$ echo $?
0
```

80-test_pkcs12.t: Add test_pkcs12_passcerts_legacy_outerr2_empty test to test
this change.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Wed Apr  8 10:09:07 2026
(Merged from https://github.com/openssl/openssl/pull/30607)
2026-04-08 12:08:16 +02:00
Eugene Syromiatnikov
854ea3aa93 quic_channel.c: avoid clipping in ack_delay_exponent/disable_active_migration setters
Avoid clipping of the provided values in setters due to type casting
by checking the values agains the type-specific maximum beforehand.

Fixes: 35dc6c353b "QUIC: Make more transport parameters configurable"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr  8 10:05:27 2026
(Merged from https://github.com/openssl/openssl/pull/30485)
2026-04-08 12:05:17 +02:00
Eugene Syromiatnikov
78ced6c88a quic_channel.c: avoid integer overflow in ossl_quic_channel_set_max_data_request
Check that DEFAULT_CONN_RXFC_MAX_WND_MUL * max_data multiplication
will not overflow uint64_t data type before performing it.

Fixes: 35dc6c353b "QUIC: Make more transport parameters configurable"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr  8 10:05:26 2026
(Merged from https://github.com/openssl/openssl/pull/30485)
2026-04-08 12:05:17 +02:00
Eugene Syromiatnikov
cfd4dca5c9 quic_channel.c: check the setters return values
...and call them before updating QUIC_CHANNEL parameters.
Unchecked return value has been initially reported by Coverity
for ossl_quic_rxfc_init() call in ossl_quic_channel_set_max_data_request(),
but also seems to be relevant for ossl_quic_channel_set_max_streams_request()
and ossl_quic_channel_set_ack_delay_exponent_request().

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1689768
Fixes: 35dc6c353b "QUIC: Make more transport parameters configurable"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr  8 10:05:25 2026
(Merged from https://github.com/openssl/openssl/pull/30485)
2026-04-08 12:05:16 +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
Eugene Syromiatnikov
5de59e4272 NEWS.md: Update 3.6.0 release date
Original-Commit: 7b371d80d9 "Prepare for release of 3.6.0"

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr  8 10:00:08 2026
(Merged from https://github.com/openssl/openssl/pull/30686)
2026-04-08 11:59:56 +02:00
Eugene Syromiatnikov
148f29855c CHANGES.md: move SSL_{add,set}1_{dnsname,ipaddr} entry to 4.0 section
Also reword it to match the style of other entries.

Complements: cb1645e83b "Add a changes entry"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr  8 10:00:06 2026
(Merged from https://github.com/openssl/openssl/pull/30686)
2026-04-08 11:59:56 +02:00
Eugene Syromiatnikov
4c189a0954 CHANGES.md: move SSL_CTX_is_server() entry to the 4.0 section
Also reword it to match the style of other entries.

Complements: ca20e54e86 "SSL_CTX_is_server() was added."
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr  8 10:00:05 2026
(Merged from https://github.com/openssl/openssl/pull/30686)
2026-04-08 11:59: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
Tomas Mraz
e55107126a Fix documentation of SSL_ech_get1_status() return values
Also do minor formatting cleanups on the man page.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Apr  8 09:13:38 2026
(Merged from https://github.com/openssl/openssl/pull/30673)
2026-04-08 11:13:03 +02:00
sftcd
3f22aab4f9 ECH: conformance test changes for echspec test tool
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr  8 08:59:20 2026
(Merged from https://github.com/openssl/openssl/pull/30419)
2026-04-08 10:59:18 +02:00
sftcd
7952bc4b8a ECH: Conformance test changes in response to AISLE review
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr  8 08:59:19 2026
(Merged from https://github.com/openssl/openssl/pull/30419)
2026-04-08 10:59:01 +02:00
Tomas Mraz
7b5ece69de 80-test_cms.t: Accept success in malformed RSA decryption
The decryption of the malformed encrypted message might succeed
with some probability. We accept that as the testcase tries to
trigger a crash which does not happen.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Apr  7 07:16:44 2026
2026-04-06 22:09:24 +02:00
Nikola Pajkovsky
4c92661c45 rsa_kem: test RSA_public_encrypt() result in RSASVE
RSA_public_encrypt() returns the number of bytes written on success and
-1 on failure.

Add regression coverage in evp_extra_test using custom low-level RSA
methods to exercise the provider/legacy boundary. The new tests verify
that encapsulation fails when RSA_public_encrypt() returns:

  * -1, which is the documented failure result, and
  * a short positive length, which is also invalid for RSASVE with
    RSA_NO_PADDING because the ciphertext must be exactly nlen bytes.

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

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Apr  6 19:45:39 2026
2026-04-06 21:45:08 +02:00
Nikola Pajkovsky
89dde74b69 rsa_kem: validate RSA_public_encrypt() result in RSASVE
RSA_public_encrypt() returns the number of bytes written on success and
-1 on failure. With the existing `if (ret)` check, a provider-side RSA KEM
encapsulation can incorrectly succeed when the underlying RSA public
encrypt operation fails. In that case the code reports success, returns
lengths as if encapsulation completed normally, and leaves the freshly
generated secret available instead of discarding it.

Tighten the success condition so RSASVE only succeeds when
RSA_public_encrypt() returns a positive value equal to the modulus-sized
output expected for RSA_NO_PADDING. Any other return value is treated as
failure, and the generated secret is cleansed before returning.

Fixes CVE-2026-31790
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Apr  6 19:45:38 2026
2026-04-06 21:44:55 +02:00
Igor Ustinov
3244aa4b9d Avoid possible buffer overflow in buf2hex conversion
Fixes CVE-2026-31789

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Apr  6 19:39:23 2026
2026-04-06 21:39:07 +02:00
Daniel Kubec
dd3544845e Added test for CVE-2026-28388
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Apr  6 19:27:17 2026
2026-04-06 21:26:43 +02:00
Daniel Kubec
d6ad8595e8 Fix NULL Dereference When Delta CRL Lacks CRL Number Extension
Fixes CVE-2026-28388

Co-authored-by: Igor Morgenstern <igor.morgenstern@aisle.com>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Apr  6 19:27:16 2026
2026-04-06 21:26:13 +02:00
Daniel Kubec
7464ccdd43 Out-of-bounds read in AES-CFB-128 on X86-64 with AVX-512 support
The partial-block pre-processing code in ossl_aes_cfb128_vaes_enc and
ossl_aes_cfb128_vaes_dec unconditionally loads 16 bytes from the input buffer
using unmasked vmovdqu8 instructions, even when fewer bytes are valid.
This can read 1–15 bytes beyond the provided buffer. The post-processing code
in the same file correctly uses masked loads to avoid this issue.

Fixes CVE-2026-28386

Co-Authored-by: Stanislav Fort <stanislav.fort@aisle.com>
Co-Authored-by: Pavel Kohout <pavel.kohout@aisle.com>
Co-Authored-by: Alex Gaynor <gaynor@anthropic.com>

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon Apr  6 19:16:26 2026
2026-04-06 21:15:28 +02:00
Neil Horman
02986569b8 Add test for CMS decryption with RSA keys
Ensure we don't encounter a segfault when decrypting CMS messages with
malformed EnvelopedData when using RSA-OAEP.

Co-authored-by: Tomas Mraz <tomas@openssl.foundation>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Mon Apr  6 18:58:32 2026
2026-04-06 20:57:35 +02:00
Neil Horman
b388240d34 Fix NULL deref in rsa_cms_decrypt
Very simmilar to CVE-2026-28389, ensure that if we are missing
parameters in RSA-OAEP SourceFunc in CMS KeyTransportRecipientInfo,
we don't segfault when decrypting.

Co-authored-by: Tomas Mraz <tomas@openssl.foundation>

Fixes CVE-2026-28390

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Mon Apr  6 18:58:30 2026
2026-04-06 20:57:35 +02:00
Neil Horman
6e257effe0 Test for DH/ECDH CMS KARI processing NULL pointer dereference
Test to ensure that, if we attempt to decrypt a CMS message with a
missing parameter field of KeyEncryptionAlgorithmIdentifier
we fail, rather than segfault.

Co-authored-by: Tomas Mraz <tomas@openssl.foundation>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Mon Apr  6 18:58:29 2026
2026-04-06 20:57:35 +02:00
Neil Horman
dea5c521a6 Fix NULL deref in [ec]dh_cms_set_shared_info
Multiple independent reports indicated a SIGSEGV was possible in CMS
processing when a crafted CMS EnvelopedData message using A Key
Agreement Recipient Info field.  If the
KeyEncryptionAlgorithmIdentifier omits the optional parameter field, the
referenced functions above will attempt to dereference the
alg->parameter data prior to checking if the parameter field is NULL.

Confirmed to resolve the issues using the reproducers provided in the
security reports.

Co-authored-by: Tomas Mraz <tomas@openssl.foundation>

Fixes CVE-2026-28389

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Mon Apr  6 18:58:28 2026
2026-04-06 20:57:35 +02:00
Tomas Mraz
8782e9a7dd .github/workflows/windows.yml: Fix typo breaking the Windows CI
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sat Apr  4 06:28:16 2026
(Merged from https://github.com/openssl/openssl/pull/30674)
2026-04-03 18:04:21 +02:00
kovan
c7b2832632 doc: document PKCS12 password prompting for certificates
Document that commands reading certificates from PKCS#12 files may
prompt for a password. The existing documentation only mentioned
password prompting for private keys.

Fixes #21292

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

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 15:52:28 2026
(Merged from https://github.com/openssl/openssl/pull/29918)
2026-04-03 17:52:27 +02:00
Tomas Mraz
35868991d1 evp_test.c: Check error stack for new errors and not stale ones
The error stack might have stale entries but
we are interested only in those coming from the
EVP call being tested.

Fixes #30454

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Fri Apr  3 15:49:52 2026
(Merged from https://github.com/openssl/openssl/pull/30669)
2026-04-03 17:49:47 +02:00
Matt Caswell
d711845efb Fix a CHANGES.md entry added to the wrong section
This fixes the CHANGES.md entry added via #30225 which erroneously added
the entry in the "Changes between 3.6 and 4.0" section instead of the
"Changes between 4.0 and 4.1" section

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 15:48:20 2026
(Merged from https://github.com/openssl/openssl/pull/30668)
2026-04-03 17:48:12 +02:00
Abhinav Agarwal
1d2d303770 quic: fix NULL deref in ossl_quic_new_from_listener()
ossl_quic_port_create_outgoing() can return NULL under memory pressure.
The result was used immediately by ossl_quic_channel_set_msg_callback()
without a NULL check, causing a crash on the SSL_new_from_listener()
API path.

The correct pattern already exists in create_channel() (same file): check
the return value and raise a non-normal error before jumping to cleanup.
Apply the same pattern here.

Fixes: 0b15147a37 ("Implement SSL_new_from_listener()")
Signed-off-by: Abhinav Agarwal <abhinavagarwal1996@gmail.com>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 15:46:54 2026
(Merged from https://github.com/openssl/openssl/pull/30667)
2026-04-03 17:46:48 +02:00
Milan Broz
aab7adf85a ci: Fix CYGWIN build
The build should run with -j4 option, but this option
was never propagated to run command (lost in Powershell).

Just set bash as shell here. This speedups CYGWIN CI build
significantly.

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

Reviewed-by: Dmitry Misharov <dmitry@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 15:45:11 2026
(Merged from https://github.com/openssl/openssl/pull/30661)
2026-04-03 17:45:03 +02:00
Eugene Syromiatnikov
f32ae93f1e util/platform_symbols/windows-symbols.txt: add __stdio_common_vsnprintf_s
Apparently, it has not been caught after a29d157fdb "Replace homebrewed
implementation of *printf*() functions with libc" due to non-working symbol
checks.

Fixes: a29d157fdb "Replace homebrewed implementation of *printf*() functions with libc"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 15:42:24 2026
(Merged from https://github.com/openssl/openssl/pull/30635)
2026-04-03 17:41:40 +02:00
Eugene Syromiatnikov
c2948db961 Update Windows CI workflow to supply correct DLLs to checkplatformsyms.pl
The check was broken in several ways, which was concealed by the fact
that checkplatformsyms.pl returned success in many cases before:
  * Hard-coded file name suffixes (-3-x64) meant that the check
    was not performed on OpenSSL 4.0+ and never for 32-bit builds.
  * dumpbin also wasn't in PATH in some configurations, which also led
    to skipped checks.
Fix that by supplying proper file names based on OpenSSL major version
and ABI, add missing VCVars calls and working dir setups.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 15:42:23 2026
(Merged from https://github.com/openssl/openssl/pull/30635)
2026-04-03 17:41:40 +02:00
Eugene Syromiatnikov
f007284b91 .github/workflows/windows_comp.yml: drop platform symbol usage check
It has never worked, as an attempt to make it work leads to this error:

    Symbol ZSTD_compressStream2 not in the allowed platform symbols list
    Symbol ZSTD_CStreamInSize not in the allowed platform symbols list
    Symbol ZSTD_initCStream not in the allowed platform symbols list
    Symbol ZSTD_freeCStream not in the allowed platform symbols list
    Symbol ZSTD_endStream not in the allowed platform symbols list
    Symbol ZSTD_freeDStream not in the allowed platform symbols list
    Symbol ZSTD_initDStream not in the allowed platform symbols list
    Symbol ZSTD_decompressStream not in the allowed platform symbols list
    Symbol ZSTD_getErrorName not in the allowed platform symbols list
    Symbol ZSTD_DStreamInSize not in the allowed platform symbols list
    Symbol ZSTD_decompress not in the allowed platform symbols list
    Symbol ZSTD_flushStream not in the allowed platform symbols list
    Symbol ZSTD_isError not in the allowed platform symbols list
    Symbol ZSTD_createCStream_advanced not in the allowed platform symbols list
    Symbol ZSTD_createDStream_advanced not in the allowed platform symbols list
    Symbol ZSTD_compress not in the allowed platform symbols list

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 15:42:22 2026
(Merged from https://github.com/openssl/openssl/pull/30635)
2026-04-03 17:41:40 +02:00
Eugene Syromiatnikov
9648c51014 util/checkplatformsyms.pl: do not hard-code "libcrypto-3-x64" library name
Ideally, it should probably passed to the script as a parameter,
but, in the meantime, follow the relaxed attitude of the Unix
counterpart and match against any version and all expected arch
suffixes.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 15:42:21 2026
(Merged from https://github.com/openssl/openssl/pull/30635)
2026-04-03 17:41:40 +02:00
Eugene Syromiatnikov
794fe02e50 util/checkplatformsyms.pl: update the Unix symbol filtering
Replace the grep|grep|awk|sed|sort|uniq abomination with a simple
and elegant awk script.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 15:42:20 2026
(Merged from https://github.com/openssl/openssl/pull/30635)
2026-04-03 17:41:40 +02:00
Eugene Syromiatnikov
127245bb2d util/checkplatformsyms.pl: do not exit after the first symbol
If there are several offending symbols, using the checker becomes quite
tedious.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 15:42:18 2026
(Merged from https://github.com/openssl/openssl/pull/30635)
2026-04-03 17:41:40 +02:00
Eugene Syromiatnikov
2753b08a66 util/checkplatformsyms.pl: handle command exit code
Error out if the executed command (dumpbin/objdump) hasn't been
successful.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 15:42:17 2026
(Merged from https://github.com/openssl/openssl/pull/30635)
2026-04-03 17:41:40 +02:00
Eugene Syromiatnikov
b19b0e22fb util/checkplatformsyms.pl: syntax nit fix
Address the following complaint:

    \2 better written as $2 at ../util/checkplatformsyms.pl line 39.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 15:42:16 2026
(Merged from https://github.com/openssl/openssl/pull/30635)
2026-04-03 17:41:40 +02:00
Eugene Syromiatnikov
b2b97b5ddb util/checkplatformsyms.pl: check that supplied files exist
Otherwise their absense is seemingly ignored, which leads to overlooked
symbol additions.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 15:42:15 2026
(Merged from https://github.com/openssl/openssl/pull/30635)
2026-04-03 17:41:40 +02:00
slontis
78e2e71be1 Doc: "ML-DSA external mu" clarify security categories
Clarify which digest algorithms correspond to the 3
security categories for ML-DSA key types.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 15:40:25 2026
(Merged from https://github.com/openssl/openssl/pull/30632)
2026-04-03 17:39:18 +02:00
Eugene Syromiatnikov
6830f62813 crypto/err/err_all.c: load SM2 error strings
The function ossl_err_load_SM2_strings() exists, but wasn't called
in ossl_err_load_crypto_strings().  Rescind this omission.

Fixes: 3d328a445c "Add SM2 signature and ECIES schemes"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 15:32:47 2026
(Merged from https://github.com/openssl/openssl/pull/30625)
2026-04-03 17:32:38 +02:00
Igor Ustinov
1b97a9ae19 evp_decodeblock_int(): Bugfix of padding check
The padding check didn't take into account that by this point the f pointer
had already shifted by 4 positions. Luckily, the original f[2] and f[3]
were saved in c and d .

This code is not reachable in normal operation, but that is not a reason
not to fix it.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 15:31:13 2026
(Merged from https://github.com/openssl/openssl/pull/30618)
2026-04-03 17:29:18 +02:00
Drokovar Dmitriy
9ac50d2d7b EVP_MD_CTX_gettable_params(): Add NULL check before dereference
Found by Linux Verification Center (linuxtesting.org) with SVACE.

CLA:trivial

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Apr  3 15:24:39 2026
(Merged from https://github.com/openssl/openssl/pull/30589)
2026-04-03 17:23:52 +02:00
Koda Reef
6c92deff75 Add INT_MAX bounds check to d2i_ASN1_UINTEGER before (int)len cast
d2i_ASN1_UINTEGER uses (int)len for OPENSSL_malloc, memcpy, and
ASN1_STRING_set0 where len is a long. On LP64 platforms (long is
64-bit, int is 32-bit), values exceeding INT_MAX are silently
truncated, causing undersized allocation and heap buffer overflow.

The sibling function ossl_c2i_ASN1_BIT_STRING in a_bitstr.c already
has this guard (line 92: if (len > INT_MAX)). This adds the same
check to d2i_ASN1_UINTEGER for consistency.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Fri Apr  3 15:22:30 2026
(Merged from https://github.com/openssl/openssl/pull/30532)
2026-04-03 17:21:53 +02:00
Stacey Zheng
6f5b5acd65 Updated broken documentation links in various files
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Apr  3 15:18:46 2026
(Merged from https://github.com/openssl/openssl/pull/30516)
2026-04-03 17:17:33 +02:00
Emmalee Carpenter
3f907b6524 Update manuals and demos to consider OSSL_PARAM_clear_free() vs OSSL_PARAM_free()
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Apr  3 15:14:25 2026
(Merged from https://github.com/openssl/openssl/pull/30506)
2026-04-03 17:08:58 +02:00
Matt Caswell
33cb1807a0 Add a test for an early DTLS CCS with extra data on the last record
We move the DTLS CCS early, and then add extra trailing data on the
last record before the epoch change. We expect to see an unexpected
message error.

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 15:06:52 2026
(Merged from https://github.com/openssl/openssl/pull/30503)
2026-04-03 17:06:49 +02:00
Matt Caswell
f3dbf6aa79 Fix a Use-After-Free bug in the DTLS code
The newly added #30225 introduced a UAF bug in the master branch found
by the dtlsserver fuzzer. If a CCS arrives early and there is trailing
data left in the current record at the point that we change epoch then
the buffer holding the trailing data is freed as part of setting up the
new record layer, but we still have dangling references into that buffer
causing the UAF.

Fixes #30487

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Apr  3 15:06:50 2026
(Merged from https://github.com/openssl/openssl/pull/30503)
2026-04-03 17:06:44 +02:00
huanghuihui0904
c3d24d9121 crypto/x509/pcy_tree.c: fix leak of tree in X509_policy_check()
When init_ret indicates both X509_PCY_TREE_EXPLICIT and X509_PCY_TREE_EMPTY,
the function returns without freeing the initialized policy tree.
Free the tree before returning, consistent with the earlier TREE_EMPTY branch.

Also defer *ptree = tree assignment and free the tree when user policies
are empty to avoid returning invalid memory.

Fixes #30435

Signed-off-by: huanghuihui0904 <625173@qq.com>

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Apr  3 15:03:37 2026
(Merged from https://github.com/openssl/openssl/pull/30436)
2026-04-03 17:02:53 +02:00
Herman Malik
eef0729ff9 doc: clarify X509_STORE thread safety and lifetime contract
Improve the description of X509_STORE_lock() in X509_STORE_new.pod to
emphasize it acquires an exclusive write lock.

Add a NOTES section to X509_STORE_new.pod covering which operations are
internally thread-safe and which are not, as well as documentation on
lifetime management and reference counting.

Add a NOTES section to X509_STORE_CTX_get_by_subject.pod explaining
that the store's internal lock is released before the found object's
reference count is incremented, so the caller must ensure the store
outlives the lookup.

Clarify the reference counting and the caller's responsibilities.
Remove internal details for conciseness.

Related to #30310

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Apr  3 15:00:55 2026
(Merged from https://github.com/openssl/openssl/pull/30382)
2026-04-03 17:00:08 +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
Bob Beck
681b19bc7b Revert "Make cpuid_setup non-constructor"
This reverts commit 1d770fc6a9.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Apr  2 07:18:05 2026
(Merged from https://github.com/openssl/openssl/pull/30557)
2026-04-02 09:17:47 +02:00
Bob Beck
636dc882a6 Make riscv cpucap not use BIO_snprintf
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Apr  2 07:18:03 2026
(Merged from https://github.com/openssl/openssl/pull/30557)
2026-04-02 09:17:47 +02:00
Weidong Wang
370954f1bb Add test for NULL uri handling in OSSL_STORE_delete()
Verify that passing NULL as the uri parameter to OSSL_STORE_delete()
returns 0 rather than crashing with a NULL pointer dereference.

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: Thu Apr  2 07:14:09 2026
(Merged from https://github.com/openssl/openssl/pull/30512)
2026-04-02 09:14:06 +02:00
Weidong Wang
c85884a4b2 Fix NULL pointer dereference in OSSL_STORE_delete()
Add a NULL check for the uri parameter before passing it to
OPENSSL_strlcpy(), matching the guard already present in
OSSL_STORE_open_ex().

Fixes: 0a8807b4a8 "Store: API for deletion"

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: Thu Apr  2 07:14:08 2026
(Merged from https://github.com/openssl/openssl/pull/30512)
2026-04-02 09:13:49 +02:00
Arne Schwabe
e181adbe4a Fix names of X509_V_ERR_ERROR_IN_CERT_* constants in man page
The names of the X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD and
X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD in the man page have
the first _ERR_ spelt out as _ERROR_ instead.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Wed Apr  1 17:06:53 2026
(Merged from https://github.com/openssl/openssl/pull/30643)

(cherry picked from commit e39a6de5c8)
2026-04-01 19:07:19 +02:00
Eugene Syromiatnikov
18097ee961 apps/lib/apps.c: use fstat on an opened fd in app_mmap_file()
Coverity has rightfully complained that using stat() before opening file
leads to TOCTOU issues, refactor the code to open the file first and
then perform stat checks on the opened file descriptor.  It is still far
from foolproof, as the file is not locked, and stat() is used elsewhere,
but at least it seems to be a step in the right direction.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1690686
Fixes: 80b7e49c27 "Use mmap for pkeyutl -rawin and dgst one-shot input"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Apr  1 12:46:08 2026
(Merged from https://github.com/openssl/openssl/pull/30624)
2026-04-01 08:46:01 -04:00
openssl-machine
2172e0c098 Fix loongarch64 build and clean up include paths
Fixes #30418

Add ../crypto to INCLUDE[p_ossltest].
Remove useless .. from various INCLUDE[] - this was necessary when e_os.h was
placed in the SRCDIR root.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Mar 31 15:51:53 2026
(Merged from https://github.com/openssl/openssl/pull/30536)
2026-03-31 11:51:32 -04:00
Eugene Syromiatnikov
2088e9013f util/platform_symbols/windows-symbols.txt: add _get_osfhandle
Its usage is introduced in commit b238d36c50 "Fix certificate read
from stdin on Windows".

Fixes: b238d36c50 "Fix certificate read from stdin on Windows"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Mar 31 11:55:26 2026
(Merged from https://github.com/openssl/openssl/pull/30634)
2026-03-31 13:55:10 +02:00
Eugene Syromiatnikov
8ca772ddb7 util/platform_symbols/windows-symbols.txt: sort in lexicographical order
Sort using "LC_ALL=C sort -u".

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Mar 31 11:55:25 2026
(Merged from https://github.com/openssl/openssl/pull/30634)
2026-03-31 13:55:09 +02:00
Bob Beck
d02f02e0a7 Don't eat a NULL if a queryfile is not provided
Fixes: 18cd23df8a "Remove "noise" comments from TS files."

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Mar 31 09:51:38 2026
(Merged from https://github.com/openssl/openssl/pull/30608)
2026-03-31 11:47:38 +02:00
Viktor Dukhovni
febac4fbf3 Refactor ML-KEM decap, also cleanse failure_key
Pedantically cleanse the typically unused decap failure_key's stack
copy.

When actually used, it is copied into the caller's shared secret result,
perhaps to be cleansed there after use, or not, that's the callers
business.

While at it, slightly refactor the internal decap() implementation to
consolidate all the data to be cleansed into a single buffer, but now
avoid copying the public key hash, instead, when computing "K || r" as
"G(m || h)" include "h" via a separate EVP_DigestUpdate() call.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Tue Mar 31 05:19:40 2026
(Merged from https://github.com/openssl/openssl/pull/30598)
2026-03-31 16:20:37 +11:00
Collin Funk
22a3bf628d Fix -Wdiscarded-qualifiers warnings shown when glibc-2.43 is used
When building with glibc-2.43 there is the following warning:

    crypto/x509/x509_vpm.c: In function 'validate_email_name':
    crypto/x509/x509_vpm.c:317:13: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
      317 |     if ((at = memchr(name, '@', len)) == NULL)
          |             ^

This is due to a change described in the NEWS file of glibc-2.43:

    * For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
      strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return
      pointers into their input arrays now have definitions as macros that
      return a pointer to a const-qualified type when the input argument is
      a pointer to a const-qualified type.

Systems using this recent glibc version will likely also be using GCC 15
or later which default to `-std=gnu23`, meaning that this warning will
show up without modifying `CFLAGS`.

We can make these pointers const since we never write to them.

Complements: f584ae959c "Let's support multiple names for certificate verification"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Mar 31 02:38:14 2026
(Merged from https://github.com/openssl/openssl/pull/30613)
2026-03-31 04:37:59 +02:00
Pranavjeet-Naidu
d29c165122 Add negative length validation in EVP_EncryptUpdate and EVP_DecryptUpdate
Added input length validation checks to prevent potential security issues
when negative values are passed to EVP_EncryptUpdate and EVP_DecryptUpdate.
These functions cast inl (int) to size_t without validation, which could lead
to unexpectedly large buffer allocation attempts or unintended behavior with
negative inputs.

Validation is performed early in both functions to ensure only valid,
non-negative lengths are processed. Error is reported via EVP_R_INVALID_LENGTH.

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

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Mar 31 02:10:52 2026
(Merged from https://github.com/openssl/openssl/pull/30560)
2026-03-31 04:10:39 +02:00
Tomas Mraz
ba21ee3795 Configurations/10-main.conf: minimum NASM version needs to be 2.09 on Windows
Otherwise some assembler code might be miscompiled.

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

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Mar 31 01:47:41 2026
(Merged from https://github.com/openssl/openssl/pull/30576)
2026-03-31 03:46:43 +02:00
Milan Broz
b238d36c50 Fix certificate read from stdin on Windows
On Windows, reading certificate from stdin could fail like

    > type cert.der| openssl.exe x509 -inform DER -outform PEM
    Could not find or decode certificate from <stdin>

The decoder already tries to insert BIO_f_readbuffer
in this case, unfortunately it depends on undefined behavior
of ftell() on Windows.

Fix it by adding check for non-seekable input case
to BIO file control.

Note, the added testcase tests binary input certificate,
but does not trigger this issue explicitly.

Fixes: https://github.com/openssl/openssl/issues/19508
Signed-off-by: Milan Broz <gmazyland@gmail.com>

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Mar 31 01:38:21 2026
(Merged from https://github.com/openssl/openssl/pull/30559)
2026-03-31 03:36:58 +02:00
Milan Broz
b0380fa933 Remove superfluous volatile for RCU on Windows
When compiling on the MINGW platform, there are many warnings like this:

  warning: passing argument 1 of 'CRYPTO_atomic_add64' discards 'volatile'
  qualifier from pointer target type [-Wdiscarded-qualifiers]
  CRYPTO_atomic_add64(&lock->qp_group[qp_idx].users, (uint64_t)1, &tmp64,
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The warning actually shows several issues with volatile in struct rcu_qp:

 - all handling functions using it do not use the volatile modifier,
   so that the compiler can treat this pointer as non-volatile already
   (Posix pthread variant does not use volatile here at all.)

 - thread safety is already guaranteed by using locks
   (NO_INTERLOCKEDOR64) or Interlocked*64 Win32 API functions.

 - the volatile removal modifier should always be explicit

In short, I think the volatile in struct rcu_qp on Windows
has no additional value and can be removed.

This also fixes the warnings mentioned above :-)

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

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Mar 31 01:25:56 2026
(Merged from https://github.com/openssl/openssl/pull/30602)
2026-03-31 03:25:50 +02:00
kovan
44e453d0f9 doc: fix -signcert grouping in CA.pl documentation
The -signcert option was incorrectly grouped with -sign and -xsign at
line 109, which implied they were equivalent. However, -signcert is
different: it expects a self-signed certificate (not a certificate
request) in newreq.pem, and converts it to a request before signing.

This is correctly documented in its own separate section at line 123,
which states "-signcert is the same as -sign except it expects a self
signed certificate".

Remove -signcert from the -sign/-xsign grouping to eliminate the
contradiction.

Resolves: https://github.com/openssl/openssl/issues/29165
Fixes: 022696cab0 "Allow CA.pl script user to pass extra arguments to openssl command"
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Mar 31 01:10:50 2026
(Merged from https://github.com/openssl/openssl/pull/29794)
2026-03-31 03:10:48 +02:00
Arne Schwabe
dfe7d500ef Document X509V3_EXT_print API const change in manual page
Commit e75bd84ffc made the ext argument of 509V3_EXT_print const
but did not update the man page to match the implementation.

Complements: e75bd84ffc "Constify X509_get_ext() and friends.."
Signed-off-by: Arne Schwabe <arne@rfc2549.org>

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Mar 31 01:01:51 2026
(Merged from https://github.com/openssl/openssl/pull/30595)
2026-03-31 03:01:42 +02:00
Eugene Syromiatnikov
0d5553fff4 X509_EXTENSION_set_object.pod, X509v3_get_ext_by_NID.pod: add missing const
Update the documentation to include that added const qualifiers
to the arguments of X509_EXTENSION_get_object(), X509_EXTENSION_get_data(),
and X509v3_add_ext().

References: https://github.com/openssl/openssl/pull/30595
Complements: e75bd84ffc "Constify X509_get_ext() and friends.."
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Tue Mar 31 00:47:35 2026
(Merged from https://github.com/openssl/openssl/pull/30601)
2026-03-31 02:47:24 +02:00
Eugene Syromiatnikov
46f75c732b ikev2kdf.c: expand missing secret check in kdf_ikev2kdf_derive()
The seemingly impossible (and erroneous) case of (secret == NULL &&
secret_len != 0) is not accounted for in sanity checks, which provoked
Coverity to report potential NULL dereference in ikev2_check_secret_and_pad()
afterwards.  Placate it by expanding the check to cover that improbable
situation and echo the seedkey check from the previous case.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1690439
Complements: 0dd1c50fc0 "Add IKEV2KDF implementation"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Mar 31 00:33:22 2026
(Merged from https://github.com/openssl/openssl/pull/30566)
2026-03-31 02:32:58 +02:00
Eugene Syromiatnikov
b9cd3ae9af crypto/property/property.c: avoid NULL dereference in impl_cache_free()
Dereference elem only after checking it for NULL.  Reported by Coverity,
CID 1690442.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1690442
Fixes: 95ac190979 "convert ALGORITHM cache to use internal hashtable"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Mar 31 00:33:21 2026
(Merged from https://github.com/openssl/openssl/pull/30566)
2026-03-31 02:32:58 +02:00
Milan Broz
1e1ea715a6 Use OPENSSL_assert for Windows RCU for missing lock
If NO_INTERLOCKEDOR64 is define, Windows RCU code must
use thread locks.

The lock *must* be provided in that case otherwise it is
an internal code error, not a runtime error.
Use OPENSSL_assert here.

This also fixes several unititialized variable warnings
as analyzer no longer see this impossible paths in code.

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Mar 31 00:28:20 2026
(Merged from https://github.com/openssl/openssl/pull/30619)
2026-03-31 02:27:53 +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
b904ea574d Define static set_cloexec() only when really used
Statically defined set_cloexec helper is used only
if RIO_NOTIFIER_METHOD_SOCKET is set (for non-Windows branch)
and if RIO_NOTIFIER_METHOD_SOCKETPAIR is set
(always).

This avoids unused code 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:26 2026
(Merged from https://github.com/openssl/openssl/pull/30616)
2026-03-31 02:21:33 +02:00
Milan Broz
8979944f90 Make ssl dir const in get_windows_default_path
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:24 2026
(Merged from https://github.com/openssl/openssl/pull/30616)
2026-03-31 02:21:33 +02:00
Alyssa Sfravara
9eed284d49 Change !BN_copy() to BN_copy() == NULL
Per the coding style guide, Chapter 15, "Expressions"[1]:

    Do not use implicit checks for numbers (not) being 0 or pointers
    (not) being NULL.

Change occurrences of "!BN_copy(a, b)" checks to "BN_copy() == NULL"
to align with the coding style guide.

[1] https://www.openssl.org/policies/technical/coding-style.html#expressions

Resolves: https://github.com/openssl/openssl/issues/30565
CLA: trivial

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Tue Mar 31 00:10:41 2026
(Merged from https://github.com/openssl/openssl/pull/30573)
2026-03-31 02:07:19 +02:00
Orgad Shaneh
bc44134c32 Configure: Remove extensive debug output by default
These debug logs were added in 6e0fd246e7 (#24687), probably for
debugging the script, but they remained active by default.

Change them to appear only if OPENSSL_MKINSTALLVARS_DEBUG env var
is set.

References: 6e0fd246e7 "Give util/mkinstallvars.pl more fine grained control over var dependencies"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Tue Mar 31 00:03:14 2026
(Merged from https://github.com/openssl/openssl/pull/29083)
2026-03-31 02:02:33 +02:00
K1
b8df87aca7 Fixed missing subjectAltName when issuing a cert with mkcert.sh genee
Just add %s to make subjectAltName appear before [alts].

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Mar 27 16:53:28 2026
(Merged from https://github.com/openssl/openssl/pull/30585)
2026-03-27 17:53:17 +01:00
openssl-machine
41f81d304c Update ordinals from 4.0.0-beta1
This is a partial forward-port of commit 3c4194022c "make update"
from the openssl-4.0 branch, that includes updates to util/libcrypto.num
and util/libssl.num files.

References: 3c4194022c "make update"

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Mar 27 16:52:22 2026
(Merged from https://github.com/openssl/openssl/pull/30555)
2026-03-27 17:52:06 +01:00
Abhinav Agarwal
e6e01f00aa quic: add missing return 0 after raise_protocol_error for NEW_CONN_ID
Every other frame type handler in depack_process_frames() returns 0
after calling ossl_quic_channel_raise_protocol_error(), but the
NEW_CONN_ID case falls through to depack_do_frame_new_conn_id().

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Mar 27 16:48:44 2026
(Merged from https://github.com/openssl/openssl/pull/30550)
2026-03-27 17:48:36 +01:00
Igor Ustinov
d5ad0b89b1 Add NULL checks for the arguments in OSSL_PARAM_BLD_push_*() functions
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Mar 27 16:46:48 2026
(Merged from https://github.com/openssl/openssl/pull/30542)
2026-03-27 17:46:40 +01:00
openssl-machine
2036e99743 CMS_verify(): Fix leak of tmpin in an error path
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Mar 27 16:43:44 2026
(Merged from https://github.com/openssl/openssl/pull/30535)
2026-03-27 17:43:21 +01:00
William Faber
0d8454ed32 Doc: clarify AAD out1 semantics in EVP_EncryptInit
Fixes #29761

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Mar 27 16:40:23 2026
(Merged from https://github.com/openssl/openssl/pull/30533)
2026-03-27 17:40:12 +01:00
Chris Baudouin, Jr.
2e976c3a38 Adds NULL checks for EVP_MD_CTX_get_pkey_ctx() return values
Guard against potential NULL pointer dereferences when
EVP_MD_CTX_get_pkey_ctx() is called and its result is used
without validation. Store the return value in a local variable,
check for NULL before passing it to subsequent functions, and
remove redundant repeated calls.

Fixes #27735

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Mar 27 16:39:04 2026
(Merged from https://github.com/openssl/openssl/pull/30522)
2026-03-27 17:38:28 +01:00
Amaan Qureshi
189cf6f0b8 s390x: set minimum architecture level to z10
The keccak1600 perlasm file (`keccak1600-s390x.pl`) emits `cijne`, a
z10 compare-immediate-and-branch instruction, without declaring a
minimum architecture level. GCC defaults to `-march=z900` on s390x,
causing assembler errors when building with the default toolchain
flags:

    keccak1600-s390x.S:399: Error: Unrecognized opcode: `cijne'

z900 has been out of service since 2014, the Linux kernel requires
z196 minimum, and clang already defaults to z10 on s390x. A
`.machine "z10"` GAS directive in the generated assembly resolves the
error by declaring the architecture level the file already requires.

Ref: #27323

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Mar 27 16:32:22 2026
(Merged from https://github.com/openssl/openssl/pull/30507)
2026-03-27 17:32:03 +01:00
Jun Aruga
c194e75a28 Improve bad FFC parameters error messages with L, N arguments
Improve the finite field cryptography (FFC) messages with L, N arguments.

Fixes #17108

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Mar 27 16:29:59 2026
(Merged from https://github.com/openssl/openssl/pull/30493)
2026-03-27 17:29:51 +01:00
herbenderbler
80b7e49c27 Use mmap for pkeyutl -rawin and dgst one-shot input
When using openssl pkeyutl -rawin or openssl dgst for one-shot sign/verify
(e.g. Ed25519, Ed448), file input is now read via mmap() on Unix where
supported, avoiding a full buffer allocation and copy. Large files are
supported without doubling memory use; on failure of the mmap path we
do not fall back to the buffer path.

- Add app_mmap_file() in apps/lib/apps.c: stat/open/mmap/close, tri-state
  return (1 mapped, 0 size zero, -1 error). Parameter err_bio avoids
  shadowing global bio_err (-Wshadow).
- apps/pkeyutl.c and apps/dgst.c: use app_mmap_file(); single exit for
  mmap path in pkeyutl; dgst includes apps.h first for _FILE_OFFSET_BITS;
  do_fp_oneshot_sign returns EXIT_SUCCESS/EXIT_FAILURE like do_fp(); no
  fallback when mmap attempted but fails.
- pkeyutl mmap/buffer path: pass filesize to EVP_DigestVerify and
  EVP_DigestSign (review suggestion, avoids casting buf_len).
- Error messages: per-file messages for stat/size (dgst, pkeyutl); CHANGES.md
  "Unix-like" and "16 MB" (documentation style).
- Centralize _FILE_OFFSET_BITS and mmap includes in apps/include/apps.h.
- Tests: pkeyutl/dgst oneshot from file, no-fallback regression tests;
  use srctop_dir for test paths; stderr patterns for mmap errors.
- Docs: man pages and CHANGES.md.

CI fixes: return failure from dgst one-shot sign when mmap fails; treat
non-regular paths as mmap errors in app_mmap_file() and pkeyutl; reject
directories before mmap.

Addresses review feedback from DDvO, npajkovsky, and vdukhovni (PR #30429).

Fixes #11677

Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>
Co-authored-by: David von Oheimb <DDvO@users.noreply.github.com>

Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Mar 27 16:25:33 2026
(Merged from https://github.com/openssl/openssl/pull/30429)
2026-03-27 17:25:31 +01:00
Zoey Chapell
b31d15ba6a doc: Clarify wording in PKCS5_PBE_keyivgen.pod
Resolves #12519 by adding to the DESCRIPTION section. Documentation only change.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Mar 27 16:17:02 2026
(Merged from https://github.com/openssl/openssl/pull/29984)
2026-03-27 17:17:01 +01:00
Weidong Wang
3e903838e3 Fix missing EVP_CIPHER_get_iv_length() guard in PKCS5_pbe2_set_scrypt
Store the return value of EVP_CIPHER_get_iv_length() in a local variable
and guard with (ivlen > 0) before passing to memcpy/RAND_bytes, matching
the pattern already used in p5_pbev2.c. Without this, a negative return
value (-1) is implicitly converted to SIZE_MAX when cast to size_t,
causing a stack buffer overflow on iv[EVP_MAX_IV_LENGTH].

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Mar 27 16:14:09 2026
(Merged from https://github.com/openssl/openssl/pull/30510)
2026-03-27 17:13:25 +01:00
slontis
e858e11088 Remove bioprinttest
Bioprinttest is redundant since internally it just calls c library
functions such as vsnprintf. This was a slow test.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri Mar 27 07:17:04 2026
(Merged from https://github.com/openssl/openssl/pull/30561)
2026-03-27 08:17:01 +01:00
Dr. David von Oheimb
5f447011a4 CMS/PKCS#7 doc: Fix inconsistencies and missing detail w.r.t. smimesign and smimeencrypt purposes
* Fix inconsistent doc (so far using purpose names smime_sign and smime_encrypt) vs. implementation
* Add the info that "smimesign" is the default purpose here.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Fri Mar 27 06:25:20 2026
(Merged from https://github.com/openssl/openssl/pull/18914)
2026-03-27 07:25:17 +01:00
Dr. David von Oheimb
72e7e90c12 CMS/PKCS#7: Add missing verification method "smime_encrypt" in crypto/x509/x509_vpm.c and doc
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Fri Mar 27 06:25:19 2026
(Merged from https://github.com/openssl/openssl/pull/18914)
2026-03-27 07:25:17 +01:00
Dr. David von Oheimb
0a5316e465 cmp_client_test.c: disable KUR_bad_pkiConf_protection
This is a workaround for an issue that lead to fuzz-checker CI failures;
the preliminary solution is to disable the inessential test case
test_exec_KUR_bad_pkiConf_protection.

References: https://github.com/openssl/openssl/pull/28973
Fixes: 525a4f1efb "cmp_vfy.c,doc/,test/: when trying to use cached CMP message sender cert, no more check its revocation and chain"

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Thu Mar 26 15:55:34 2026
(Merged from https://github.com/openssl/openssl/pull/30567)
2026-03-26 16:55:17 +01:00
Richard Levitte
3bc23e1d24 Slight enhancement of commentary for exported configurations
There's a misunderstanding regarding the use of .pc and .cmake files
found in the top of the build tree vs in its 'exporters' subdirectory.

Some added commentary, especially in the files being produced, might
help clarify their uses.

Resolves: https://github.com/openssl/openssl/issues/28803

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Mar 26 15:19:09 2026
(Merged from https://github.com/openssl/openssl/pull/28858)
2026-03-26 16:14:26 +01:00
Billy Brumley
1ca2924749 [crypto/ec] optimize fetching affine coordinates when Z is one
Check the z_is_one flag and early exit if it's set.

This saves an expensive field inversion in some cases,
especially when just loading a key and reading it back.

In fact sometimes it saves two expensive field inversions,
because sometimes the first call is only for retrieving the size.

Fixes #29719

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Mar 26 13:58:10 2026
(Merged from https://github.com/openssl/openssl/pull/30530)
2026-03-26 14:58:09 +01: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
94c36852d2 cmp_vfy.c: on error trying to use cached CMP message sender cert, make sure to print diagnostics
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
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
Dr. David von Oheimb
8d9c8b3ff1 CMP doc: add missing text on OSSL_CMP_OPT_NO_CACHE_EXTRACERTS to OSSL_CMP_CTX_new.pod and ossl_cmp_msg_check_update.pod
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
Dr. David von Oheimb
713beaf046 crypto/cmp/: generalize info/debug messages and code comments from mentioning 'server' to 'sender'
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
Dr. David von Oheimb
3c15377ab8 apps/cmp.c: minor code refactoring on -no_cache_extracerts, tweak mock server error message
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
Dr. David von Oheimb
7d926166de cmp_vfy.c: fix crash on attempting to use invalidated sender cert on producing diagnostic information
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:03 +01:00
Dr. David von Oheimb
3f8940a6a1 apps/cmp.c: make sure that CMP mock server respects -ignore_keyusage and -no_cache_extracerts
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:03 +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
Eugene Syromiatnikov
fae68066ec crypto/idea/i_ofb64.c: mask the num value after negativity check
Commit 5ba9029bc7 "Mask *num on entry in deprecated low-level OFB/CFB
implementations" introduced masking of the user-supplied num value
in several functions, which rendered the exiting *num negativity check
introduced in 1634b2df9f "enc: fix coverity 1451499, 1451501, 1451506,
1451507, 1351511, 1451514, 1451517, 1451523, 1451526m 1451528, 1451539,
1451441, 1451549, 1451568 & 1451572: improper use of negative value"
ineffectual.  While commit b73a574325 "crypto/idea/i_cfb64.c:
condition 'n < 0' can never be met after doing 'n = n & 0x07'"
has addressed the issue in crypto/idea/i_cfb64.c:IDEA_cfb64_encrypt(),
this commit addresses the same issue
in crypto/idea/i_ofb64.c:IDEA_ofb64_encrypt() in similar fashion,
by postponing the masking after the negativity check.

The issue has initially reported by Coverity, ID 1689815.

Resolves: https://scan5.scan.coverity.com/#/project-view/62622/10222?selectedIssue=1689815
Fixes: 5ba9029bc7 "Mask *num on entry in deprecated low-level OFB/CFB implementations"
References: b73a574325 "crypto/idea/i_cfb64.c: condition 'n < 0' can never be met after doing 'n = n & 0x07'"
Co-Authored-by: Alexandr Nedvedicky <sashan@openssl.org>
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Mar 24 17:52:35 2026
(Merged from https://github.com/openssl/openssl/pull/30528)
2026-03-24 18:52:23 +01:00
Norbert Pocs
4a4578aefb Simplify ossl_namemap_name2num with ossl_namemap_name2num_n
The two functions do the same; there is no reason to maintain duplicit
code.

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

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Mar 24 17:47:58 2026
(Merged from https://github.com/openssl/openssl/pull/30524)
2026-03-24 18:47:53 +01:00
Aditya Patil
fff9955fa0 threadstest: Check the return value of two memory allocations
Add a NULL check with OPENSSL_assert() before dereferencing the allocated pointer.

Fixes #30017

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Mar 24 17:44:44 2026
(Merged from https://github.com/openssl/openssl/pull/30509)
2026-03-24 18:43:52 +01:00
easonysliu
cd20f1af1c conf: guard NULL group in NCONF_get_string() error path
NCONF_get_string() passes the group parameter directly to
ERR_raise_data() with a %s format specifier.  The CONF API
explicitly allows group to be NULL (meaning "default section"),
and multiple internal callers use this, such as conf_diagnostics()
and CONF_modules_load().

When the lookup fails and the error path is reached, passing NULL
to %s is undefined behavior per the C standard.  On Linux/glibc
it happens to print "(null)", but on platforms like Solaris 10 it
crashes in strlen() inside vsnprintf().

This was exposed after commit #28305 replaced the custom _dopr()
(which had an explicit NULL-to-"<NULL>" guard in fmtstr()) with
the platform's native vsnprintf().

Guard the NULL by using an empty string in the format argument.

Fixes #30402

CLA: trivial

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Tue Mar 24 17:39:02 2026
(Merged from https://github.com/openssl/openssl/pull/30484)
2026-03-24 18:38:32 +01:00
Liu-ErMeng
97e9561471 Fix vpsm4_ex-armv8.pl implementation bug
Load .Lsbox_magic base once via adrp+add and use plain immediate offsets for q loads,
avoiding potential low-12-bit truncation issues with #:lo12:symbol+offset.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Tue Mar 24 17:36:51 2026
(Merged from https://github.com/openssl/openssl/pull/30410)
2026-03-24 18:36:44 +01:00
huanghuihui0904
6f01df42cd apps/cmp.c: fix leak of out_trusted in setup_verification_ctx()
setup_verification_ctx() allocates out_trusted via load_trusted() and passes
it to OSSL_CMP_CTX_set_certConf_cb_arg(). Since the argument is not consumed,
it must be freed on failure. The fix is to free out_trusted if
OSSL_CMP_CTX_set_certConf_cb_arg() fails.

Fixes #30377

Signed-off-by: huanghuihui0904 <625173@qq.com>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Tue Mar 24 17:34:49 2026
(Merged from https://github.com/openssl/openssl/pull/30392)
2026-03-24 18:34:19 +01:00
Peter Zhang
b721a59fef Fix CONNECT request for IPv6 targets in OSSL_HTTP_proxy_connect
When server contains a bare IPv6 address, OSSL_HTTP_proxy_connect() must
wrap it in square brackets for the CONNECT request line (e.g.,
CONNECT [::1]:443 HTTP/1.0).  Also handle the case where the server
string already includes brackets (as returned by OSSL_HTTP_parse_url).

Fixes: 29f178bddf ("Generalize the HTTP client so far implemented mostly in crypto/ocsp/ocsp_ht.c")

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Tue Mar 24 17:32:06 2026
(Merged from https://github.com/openssl/openssl/pull/30384)
2026-03-24 18:31:58 +01:00
Dr. David von Oheimb
232279db68 Some more X509 extension add/del polish and fixups
Making better use of X509v3_delete_extension().

This includes two minor bugfixes:
The enc.modified flag was not set on deleting extensions in
X509_REQ and X509_CRL structures.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Tue Mar 24 17:29:09 2026
(Merged from https://github.com/openssl/openssl/pull/30350)
2026-03-24 18:28:10 +01:00
Marcel Merkle
6a5fea7ec5 Add more details to the certification path building documentation
Added more details about the certification path building algorithm,
especially about the behavior in case of incomplete chains in the trust
store.

Fixes #29681

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Tue Mar 24 17:24:15 2026
(Merged from https://github.com/openssl/openssl/pull/30317)
2026-03-24 18:23:38 +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
Dr. David von Oheimb
7703de2772 cmp_ctx_set_md(): on error, provide name of unsupported algorithm
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Mar 24 17:06:58 2026
(Merged from https://github.com/openssl/openssl/pull/29074)
2026-03-24 18:06:54 +01:00
Dr. David von Oheimb
fcd0c3ffab OSSL_CMP_CTX_{set,get}_option(): improve error diagnostics
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Mar 24 17:06:57 2026
(Merged from https://github.com/openssl/openssl/pull/29074)
2026-03-24 18:06:45 +01:00
Dr. David von Oheimb
92b45f0fb6 OSSL_CMP_get1_rootCaKeyUpdate(): warn if genp contains oldWithNew certificate but not oldWithOld
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Mar 24 17:06:56 2026
(Merged from https://github.com/openssl/openssl/pull/29074)
2026-03-24 18:06:45 +01:00
Dr. David von Oheimb
01027c984d CMP get_genm_itav(): suppress misleading error message on GENP with rejection
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Mar 24 17:06:55 2026
(Merged from https://github.com/openssl/openssl/pull/29074)
2026-03-24 18:06:45 +01:00
Milan Broz
15755c047d Fix oids_to_c.pm to not print warnings on Windows.
The oids_to_pm with Strawberry Perl often prints these errors:
  Use of uninitialized value in join or string at Strawberry/perl/lib/re.pm line 47.

This is caused by use re 'debugcolor' in the perl module.

As Windows does not have proper termcap database and colors
also do not work in cmd shell, let's just use non-colored
'debug' version.

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

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Mar 24 17:04:23 2026
(Merged from https://github.com/openssl/openssl/pull/30521)
2026-03-24 18:04:16 +01:00
Milan Broz
c1630bfa1d test: Fix test_rand to check output length (and run silently)
When running tests on Windows, the last test command in test_rand
is mixed with test output.

  perl.exe ..\..\util\wrap.pl ..\..\apps\openssl.exe rand
  -hex 2K => 0[14:11:00] 05-test_rand.t ......

As there is also missing actual check for output length,
fix both problems by adding simple check for expected length.

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

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Mar 24 17:04:22 2026
(Merged from https://github.com/openssl/openssl/pull/30521)
2026-03-24 18:04:16 +01:00
Neil Horman
3c6c533c71 Fixup property test to have enough of a real provider struct
Now that ossl_method_store_cache_[set|get] query the provider name, we
need to make our property test account for that, by defining the
property query to be identical to what the internal definiton is.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Tue Mar 24 16:23:11 2026
(Merged from https://github.com/openssl/openssl/pull/30254)
2026-03-24 17:23:03 +01:00
Neil Horman
95ac190979 convert ALGORITHM cache to use internal hashtable
Lets improve our property query lookup performance.

Currently our property query lookup performance could be better.  It
suffers from three major drawbacks,

1) The hashtable itself could be faster.  our internal hashtable
implementation is generally quicker than our LHASH implementation

2) The lookup case a specific provider (i.e. when we do a cache lookup with
prov != NULL requires some signficant iteration over hash buckets with
LHASH, as we iterate over all entries that match the same query looking
for a matching provider pointer)

3) Stochastic flush is..not great.  When we reach cache size limitations
   (currently 512 entries spread over 4 shards), we randomly flush about
   50% of the cache, which requires an iteration over the entire hash
   table)

Lets address all of these

1) Is pretty straight forward.  Replacing the LHASH hashtable with our
   internal hash table is pretty easy, and lets us take advantage of the
   hash computation caching introduced earlier.

2) With (1) we can do direct lookups of specific provider, by including
   the provider name in the hash key.  Provider agnostic (i.e. provider
   == NULL) lookups are now handled by adding an extra hash entry for
   each nid with the key being _only_ the property query.  Prior entries
   for the same key get evicted, so a lookup for prop_query = X, prov =
   NULL returns the last QUERY that was added for that query string
   against a particular nid.

3) I've never fully understood why we do random early discard of queries
   when we reach capacity.  It seems easier and more efficient to just
   discard a single entry to keep us under our size limits.  Especially
   given that the sharding reduces the likelyhood that we need to flush
   in any given shard.  This also prevents us from needing to traverse
   the entire hash table, as we can just discard a single QUERY and
   abort the loop early.

In addition to the above we can also:

1) Migrate the QUERY hashtable from the ALGORITHM struct to the
   STORED_ALGORITHMS struct.  Currently we create a hash table per
   ALGORITHM, and we have potentially hundreds of algorithms.  While
   this makes for really fast lookups, each QUERY cache only having a
   few entries, its a huge waste of memory, consolidating all of the
   nids to a single sharded STORED_ALGORITHMS struct saves a bunch of
   memory and is still faster than what we have currently.

2) Add an lru-like linked list to QUERY entries.  This serves two
   purposes.  Its not quite lru/lfu, but it allows us to more quickly do
   an in-order traversal of a hash table on every node, and detect when
   a QUERY has been looked up since the last query table update.  By
   detecting this, we can bias ourselves on cull operations toward
   eliminating those entries which have not been referenced frequently.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Tue Mar 24 16:23:09 2026
(Merged from https://github.com/openssl/openssl/pull/30254)
2026-03-24 17:23:03 +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
Viktor Dukhovni
5efde2afed Fix DSA sig dupctx pointer aliasing
Same aliasing issue as with ECDSA in

    https://github.com/openssl/openssl/pull/30479

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Tue Mar 24 15:45:34 2026
(Merged from https://github.com/openssl/openssl/pull/30529)
2026-03-25 02:45:26 +11:00
Eugene Syromiatnikov
d395153746 CHANGES.md: remove duplicating "Added support for RFC 8701 GREASE..." entry
A cleanup after merge conflict resolution in a1420a699d "Implement RFC 8701
GREASE for TLS ClientHello".

Fixes: a1420a699d "Implement RFC 8701 GREASE for TLS ClientHello".
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>
MergeDate: Sun Mar 22 01:03:54 2026
(Merged from https://github.com/openssl/openssl/pull/30505)
2026-03-22 02:03:52 +01:00
Deven Dighe
efbcbc3612 crypto/threads_win.c: type casted destination of InterlockedExchange{,64} calls
Explicitly cast dst argument of InterlockedExchange{,64} calls
in CRYPTO_atomic_store{,_int}() to LONG{64,} volatile *, respectively,
to work around incompatible pointer type errors on 64-bit MinGW builds.

Initially Reported by Splediferous.

[esyr: massaged the commit message a bit]

CLA: trivial
Resolves: https://github.com/openssl/openssl/issues/30451
Fixes: cc7195da30 "Make FIPS self test state access atomic"
Fixes: 7e45ac6891 "Add CRYPTO_atomic_store api"

add cast to LONG volatile * for InterlockedExchange

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sun Mar 22 00:56:36 2026
(Merged from https://github.com/openssl/openssl/pull/30504)
2026-03-22 01:50:59 +01:00
Jakub Jelen
8fce20d0e1 doc/man1/openssl-pkeyutl.pod.in: Fix typo in manual page
CLA: trivial
Fixes: 2f9e152d86 "Add SLH_DSA signature verification."
Signed-off-by: Jakub Jelen <jjelen@redhat.com>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Sun Mar 22 00:29:35 2026
(Merged from https://github.com/openssl/openssl/pull/30515)
2026-03-22 01:29:17 +01:00
slontis
a24fbf403a SLH-DSA: Fix Integer overflow in msg_encode leading to buffer overflow
Reported by Zehua Qiao and me@snkth.com

An encode message buffer M = 00 || CXT_LEN || CTX || MSG was being
allocated followed by memcpy's into the buffer for CTX and MSG.
If len(MSG) was close to size_t the allocated buffer would be
overwritten.

The fix uses WPACKET to perform the message encoding M = 00 || CXT_LEN || CTX || MSG

Although ML_DSA does a similiar operation, SLH-DSA has to buffer the
encoding because the encoded message is processed multiple times for
PRF_MSG and H_MSG. FOr ML_DSA the encoded message can just be hashed.

Fixes: 2f9e152d86 "Add SLH_DSA signature verification."

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sun Mar 22 00:15:47 2026
(Merged from https://github.com/openssl/openssl/pull/30477)
2026-03-22 01:15:46 +01:00
Alexandr Nedvedicky
b73a574325 crypto/idea/i_cfb64.c: condition 'n < 0' can never be met after doing 'n = n & 0x07'
Resolves: https://scan5.scan.coverity.com/#/project-view/62622/10222?selectedIssue=1689816
Fixes: 5ba9029bc7 "Mask *num on entry in deprecated low-level OFB/CFB implementations"

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sat Mar 21 23:50:41 2026
(Merged from https://github.com/openssl/openssl/pull/30500)
2026-03-22 00:50:27 +01:00
huanghuihui0904
bbeade53dd ssl/statem/statem_dtls.c: fix leak in dtls1_buffer_message()
pqueue_insert() may fail, but its return value was not checked. This could leak the allocated pitem and handshake fragment. Free them when insertion fails, using pitem_free() for proper cleanup.

Solves https://github.com/openssl/openssl/issues/30442

Fixes #30442

Signed-off-by: huanghuihui0904 <625173@qq.com>

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sat Mar 21 23:11:54 2026
(Merged from https://github.com/openssl/openssl/pull/30443)
2026-03-22 00:11:42 +01:00
Weidong Wang
84347b9494 Fix OCSP_BASICRESP memory leak in ossl_get_ocsp_response()
In ossl_get_ocsp_response(), the OCSP_BASICRESP allocated by
OCSP_response_get1_basic() is never freed when the OCSP response
contains zero SingleResponse entries.

The allocation and guard were combined in a single && expression,
so when OCSP_resp_get0(bs, 0) returns NULL, short-circuit evaluation
skips the block containing OCSP_BASICRESP_free(bs), leaking bs on
every handshake with such a response.

Fix by splitting the allocation out of the condition and adding an
else branch that frees bs when the SingleResponse check fails.

Fixes: b1b4b154fd "Add support for TLS 1.3 OCSP multi-stapling for server certs"

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sat Mar 21 22:23:27 2026
(Merged from https://github.com/openssl/openssl/pull/30463)
2026-03-21 23:23:14 +01:00
1seal
355ea2ba25 test: add regression tests for unauthorized OCSP response signers
extend test_tlsext_status_type() with a handshake that serves a
leaf-signed stapled OCSP response and verifies the connection fails
when X509_V_FLAG_OCSP_RESP_CHECK is enabled.

generalize ocsp_server_cb_single() to use configurable signer
cert/key instead of hardcoded paths so the same callback serves
both authorized and unauthorized signer test cases.

add a test_ocsp() subtest covering the -issuer CLI option with
an untrusted issuer hint.

Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sat Mar 21 20:58:29 2026
(Merged from https://github.com/openssl/openssl/pull/30323)
2026-03-21 21:58:26 +01:00
1seal
8a630915c0 x509: remove OCSP_TRUSTOTHER from stapled response and issuer fallback paths
check_cert_ocsp_resp() verified stapled OCSP responses with
OCSP_TRUSTOTHER while passing the peer-provided chain (ctx->chain),
which allowed certificates from that chain to be treated as trusted
OCSP responder signers.

similarly, the ocsp CLI issuer fallback path unconditionally used
OCSP_TRUSTOTHER, making certificates given via -issuer implicitly
trusted regardless of verify_flags.

remove OCSP_TRUSTOTHER from both paths so that responder authorization
is validated against the trust store.

Fixes: c6724060e2 "RT2206: Add -issuer flag to ocsp command"
Fixes: b1b4b154fd "Add support for TLS 1.3 OCSP multi-stapling for server certs"

Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sat Mar 21 20:58:27 2026
(Merged from https://github.com/openssl/openssl/pull/30323)
2026-03-21 21:58:21 +01:00
Jaeho Nam
c7620840bf x509: fix bug in timeSpecification printing
Fix i2r_OSSL_DAY_TIME() to check dt->second before decoding the
optional seconds field. Add a regression certificate and x509 recipe
coverage for the periodic timeSpecification case with no seconds.

Resolves: https://github.com/openssl/openssl/issues/30424
Fixes: 70b17e5a00 "feat: support the timeSpecification X.509v3 extension"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Fri Mar 20 18:47:04 2026
(Merged from https://github.com/openssl/openssl/pull/30425)
2026-03-20 19:46:29 +01:00
Viktor Dukhovni
6cdcfd7106 Fix ECDSA sig CTX dup "sig" aliasing, error paths
- The context "sig" field ended up shared by both contexts
  after a dup, leading to a later double-free.

Reported by Stanislav Fort and Pavel Kohout of Aisle Research.

- Rare error paths could lead to a memory leak or to use-after-free
  and/or double-free.

Reported by Kenaz Wang.

Fixes: edd3b7a309 "Add ECDSA to providers"
Fixes: f68ba38e18 "Refactor OpenSSL 'ECDSA' EVP_SIGNATURE to also include ECDSA+hash composites"

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Mar 20 18:15:48 2026
(Merged from https://github.com/openssl/openssl/pull/30479)
2026-03-20 19:15:22 +01:00
Daniel Cuthbert
d8ea426e09 ech: fix off-by-one in hpke_decrypt_encch extensions length bounds check
The bounds check before reading the two-byte extensions length field uses
extsoffset + 1 instead of extsoffset + 2:

    if ((extsoffset + 1) > clearlen) { goto paderr; }
    extslen = clear[extsoffset] * 256 + clear[extsoffset + 1];

When extsoffset == clearlen - 1 the check passes, but the second read
clear[extsoffset + 1] is clear[clearlen], which is one byte beyond
the decrypted plaintext.  The allocation is OPENSSL_malloc(cipherlen)
where cipherlen = clearlen + AEAD_overhead, so the address is valid,
but the byte is uninitialised after OSSL_HPKE_open returns.

Using Valgrind confirmed an uninitialised-value read at this location
via the full server handshake path:

    hpke_decrypt_encch (ech_internal.c)
    ossl_ech_early_decrypt
    tls_process_client_hello
    state_machine
    SSL_do_handshake

The subsequent ch_len > clearlen check (line 1875) acts as a safety net
and prevents the stale byte from being used further, so the practical
impact is a forced decode error rather than memory disclosure.
Nevertheless, the read itself is incorrect and should be fixed.

Fix: change the guard to extsoffset + 2 so that both bytes
of the extensions length field are confirmed to be within the decrypted
buffer before either is read.

This issue was identified through AI-assisted structural analysis
(RAPTOR) using CodeQL database tooling (AST analysis, control flow
verification, dominator tree analysis) against the OpenSSL master
branch.  The off-by-one was confirmed via AST inspection showing
GT(Add(extsoffset, 1), clearlen) instead of the expected
GT(Add(extsoffset, 2), clearlen).

Found by myself @danielcuthbert and validated
by Benjamin Rodes - Microsoft @bdrodes.

CLA: trivial
Fixes: 6c3edd4f3a "Add server-side handling of Encrypted Client Hello"

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Mar 20 18:07:01 2026
(Merged from https://github.com/openssl/openssl/pull/30472)
2026-03-20 19:04:09 +01:00
slontis
232f17f065 Fix windows build failure for arm64ec
The new b64 encoder code uses __m256 which is not currently supported in ARM64EC code,
since it does not natively support x64-specific instruction sets like AVX.
Disable the fast AVX path if arm64EC is used.

Fixes: https://github.com/openssl/openssl/issues/30361
Complements: 3a69b19028 "Added AVX2 encoding + scalar improvements"

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Mar 20 17:55:30 2026
(Merged from https://github.com/openssl/openssl/pull/30406)
2026-03-20 18:54:55 +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
herbenderbler
10b0340fec Remove unused vpaes_ecb_decrypt from ARMv8 vpaes assembly
vpaes_ecb_decrypt in vpaes-armv8.pl was never referenced.  It also
contained a bug: the single-block path called _vpaes_encrypt_core
instead of _vpaes_decrypt_core.  Delete the dead function.

Resolves: https://github.com/openssl/openssl/issues/30341
CLA: trivial

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Thu Mar 19 20:36:27 2026
(Merged from https://github.com/openssl/openssl/pull/30423)
2026-03-19 21:35:55 +01:00
Abhinav Agarwal
b2aa6a1c67 quic: fix NULL pointer dereference in ossl_uint_set_remove()
In the range-splitting path, create_set_item() can return NULL under
memory pressure. The result was passed directly to
ossl_list_uint_set_insert_after() without a NULL check, causing an
immediate crash. This path is reachable during normal QUIC ACK
processing under memory exhaustion.

Check the allocation result before insertion and return 0 on failure.

Fixes: c5ca718003 "uint_set: convert uint_set to use the list data type"

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Mar 19 19:24:09 2026
(Merged from https://github.com/openssl/openssl/pull/30490)
2026-03-19 20:23:45 +01:00
Frederik Wedel-Heinen
6732586dde Removes unused config_inited value in init.c
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Mar 19 10:44:17 2026
(Merged from https://github.com/openssl/openssl/pull/30420)
2026-03-19 11:44:01 +01:00
sftcd
dc449562f4 ECH: chunk-size bug fix and non-regression changes
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Thu Mar 19 10:35:56 2026
(Merged from https://github.com/openssl/openssl/pull/30417)
2026-03-19 11:35:54 +01:00
David McFarland
5ea5f42e06 Disable DLL detach handlers on cygwin
This patch is from cygwin, and was originally added in:

https://cygwin.com/cgit/cygwin-packages/openssl/commit/?id=da80cc438622f6b1801fb3fbb06818c3ee070495

In cygwin, it's not safe to call into libc from
DLL_THREAD/PROCESS_DETACH, and it results in crashes.

CLA: trivial

Co-authored-By: Achim Gratz <Achim.Gratz@Stromeko.DE>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Mar 19 10:02:05 2026
(Merged from https://github.com/openssl/openssl/pull/29321)
2026-03-19 11:01:30 +01:00
Frederik Wedel-Heinen
e0658b5421 Adds documentation of X509V3_EXT_print and X509V3_EXT_print_fp.
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu Mar 19 09:20:07 2026
(Merged from https://github.com/openssl/openssl/pull/29996)
2026-03-19 10:20:05 +01:00
Milan Broz
303c3e0cb3 test: Do not fail if packet cannot be extended in QUIC multistream test
In some specific timings, the qtest_fault_resize_plain_packet function
returns failure as there is not enough space in allocated buffer.

There is no way to recover in this situation, let print
information and keep the test finish instead of failure
in TEST_error() call.

This patch fixes test runs on Windows where I can reproduce
this quite reliably.

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Mar 19 09:17:59 2026
(Merged from https://github.com/openssl/openssl/pull/30461)
2026-03-19 10:17:40 +01:00
Milan Broz
962d4b6b62 test: Increase timeout for QUIC multistream test
I can regularly hit timeout on Windows for QUIC multistream test.
While increasing is not the best solution, it eliminates many
failures during testing. This timeout only applies in specific
situation, so run time should not be actually used often.

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Mar 19 09:17:57 2026
(Merged from https://github.com/openssl/openssl/pull/30461)
2026-03-19 10:17:40 +01:00
Sashan
84e522ddb6 Update ssl/quic/quic_srtm.c
Co-authored-by: Matt Caswell <matt@openssl.foundation>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Mar 18 17:26:47 2026
(Merged from https://github.com/openssl/openssl/pull/30371)
2026-03-18 13:26:42 -04:00
Alexandr Nedvedicky
f65bcab102 QUIC stack must disable hash table contraction before doing
lh_TYPE_doall(lh, lh_TYPE_delete). Not doing so may dereference
dead memory when traversing to next item in hash table.

One has to call lh_TYPE_set_down_load(lh, 0) to disable hash
table contraction when table is being destroyed during the
_doall() traversal.

call lh_TYPE_set_down_load(lh, 0) before doing
lh_TYPE_daall() with lh_TYPE_delete(). This disables

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Mar 18 17:26:44 2026
(Merged from https://github.com/openssl/openssl/pull/30371)
2026-03-18 13:26:42 -04:00
Tomas Mraz
8911fedcda ca.c: Partially revert incorrect simplification of string check
Fixes 25c2ada89
Fixes Coverity 1688667

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Mar 18 13:32:01 2026
(Merged from https://github.com/openssl/openssl/pull/30460)
2026-03-18 09:31:30 -04:00
slontis
05ac679039 SLH_DSA: signing operation incorrectly returned 1 on failure.
Initially Reported by Zehua qiao

Fixes #30414

A block copy bug incorrectly set ret = 1 straight after assigning
ret.

Setting the *sig_len has been delayed to the err path in case
WPACKET_finish fails.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Mar 18 07:19:54 2026
(Merged from https://github.com/openssl/openssl/pull/30438)
2026-03-18 08:19:48 +01:00
frostb1ten
5ba9029bc7 Mask *num on entry in deprecated low-level OFB/CFB implementations
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Mar 18 07:11:44 2026
(Merged from https://github.com/openssl/openssl/pull/30447)
2026-03-18 08:11:31 +01:00
Scott
f56a9fa69d Fix incorrect error return in ppc_aes_gcm_cipher_update decrypt path
ppc_aes_gcm_cipher_update() returns 1 on success and 0 on failure.
The decrypt pre-alignment path (line 122) incorrectly returned -1
instead of 0 when CRYPTO_gcm128_decrypt() failed.

Since the caller checks `if (!hw->cipherupdate(...))`, and !(-1)
evaluates to 0 (false) in C, the error was silently swallowed and
GCM processing continued with potentially corrupt state.

The encrypt path at line 98 correctly returns 0. This was likely a
copy-paste error when the decrypt path was added.

Fixes #30380

CLA: trivial

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Mar 18 07:03:41 2026
(Merged from https://github.com/openssl/openssl/pull/30452)
2026-03-18 08:03:32 +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
Weidong Wang
4b8968753c pkcs7: fix NULL contents dereference in PKCS7_stream
Reviewed-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:01:56 2026
(Merged from https://github.com/openssl/openssl/pull/30351)
2026-03-17 13:00:47 -04:00
Weidong Wang
70837aa238 pkcs7: fix NULL contents dereference in PKCS7_dataFinal
Reviewed-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:01:53 2026
(Merged from https://github.com/openssl/openssl/pull/30351)
2026-03-17 13:00:47 -04:00
Weidong Wang
b43e441550 pkcs7: fix NULL contents dereference in PKCS7_ctrl
Reviewed-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:01:49 2026
(Merged from https://github.com/openssl/openssl/pull/30351)
2026-03-17 13:00:47 -04:00
Dmitry Misharov
e63856ee6a OpenSSH interop tests job refactoring
* split openssh interop tests job into more steps
* remove openssl build step, it's built in setup_ci.sh

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Mar 17 16:57:05 2026
(Merged from https://github.com/openssl/openssl/pull/30445)
2026-03-17 17:57:00 +01:00
Stefan Berger
2590497f7c openssl-cms.pod.in: Mention Ed448 signing with signed attributes in BUGS section
In the BUGS section mention that signing wtih an Ed448 key is not supported
when using signed-data with signed attributes due to missing support for
id-shake256-len.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Mar 17 16:20:27 2026
(Merged from https://github.com/openssl/openssl/pull/30312)
2026-03-17 12:20:06 -04:00
Stefan Berger
919fd9db25 cms: Make sha512 the required hash for CMS with signedAttributes
RFC 8419 requires that, when using an Ed25519 key for CMS signed-data with
signed attributes, SHA512 must be used. Modify the entry in the key2data
table to reflect this giving the user not other choice for a hash.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Mar 17 16:20:24 2026
(Merged from https://github.com/openssl/openssl/pull/30312)
2026-03-17 12:20:06 -04:00
Stefan Berger
5041f15320 man: Mention Ed448 for CMS with signed attributes is not supported
Mention that Ed448 keys cannot currently be used for CMS with
signed attributes since RFC 8419 requires id-shake256-len be used,
which is not currently supported by OpenSSL.

Resolves: 30291
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Mar 17 16:20:20 2026
(Merged from https://github.com/openssl/openssl/pull/30312)
2026-03-17 12:20:06 -04:00
Viktor Dukhovni
deba49ff0a Avoid premature short-circuit in check_email
- Also harden check_hosts() to handle NULL `vpm->hosts`,
  currently checked by the caller.

- Also harden check_ips() to handle NULL `vpm->ips`,
  currently checked by the caller.

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Mar 17 15:35:16 2026
(Merged from https://github.com/openssl/openssl/pull/30444)

(cherry picked from commit 6f9a0f3bcd)
2026-03-17 16:35:31 +01: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
sftcd
0083444eb9 test-change: remove ec-point-formats from test vectors
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Tue Mar 17 11:54:06 2026
(Merged from https://github.com/openssl/openssl/pull/30416)
2026-03-17 11:53:54 +00:00
Tomas Mraz
b63e740293 Configure: Re-add srtpkdf disablable
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Mar 17 11:16:00 2026
(Merged from https://github.com/openssl/openssl/pull/30446)
2026-03-17 12:15:54 +01:00
Tomas Mraz
3b1c7fcdba ECDH and ECDSA cannot be really disabled standalone
We should not pretend it can.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Mar 17 11:15:59 2026
(Merged from https://github.com/openssl/openssl/pull/30446)
2026-03-17 12:15:54 +01:00
Tomas Mraz
6cf011385f Revert "fix: disable of ECDH and ECDSA algorithms"
This reverts commit b60869717d.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Mar 17 11:15:57 2026
(Merged from https://github.com/openssl/openssl/pull/30446)
2026-03-17 12:15:44 +01:00
Scott
e443447588 Fix integer truncation in ppc_aes_gcm_crypt
The assembly functions ppc_aes_gcm_encrypt and ppc_aes_gcm_decrypt
return size_t, but their return values were stored in int variables,
causing truncation on PPC64 where size_t is 64-bit. This could lead
to incorrect results when processing inputs larger than 2GB via
EVP_Cipher() which accepts unsigned int lengths.

Change the types of s and ndone from int to size_t to match the
function return type and the return type of ppc_aes_gcm_crypt itself.

Tested on POWER8 S824 (ppc64le) — all EVP and cipher tests pass,
AES-128-GCM benchmarks at 2.94 GB/s with hardware acceleration.

CLA: trivial

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Mar 17 09:44:33 2026
(Merged from https://github.com/openssl/openssl/pull/30437)
2026-03-17 10:44:18 +01:00
Paz David
e1eb88118a BIO: Fix typo in BIO_pop documentation
Corrected "is is" to "it is" in the BIO_pop() description to
improve documentation clarity.

CLA: trivial

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Mon Mar 16 11:30:42 2026
(Merged from https://github.com/openssl/openssl/pull/30404)
2026-03-16 11:30:19 +00: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
Bob Beck
25c2ada896 Clean up asn1/ca.c
Collapse a bunch of type calls down to a local variable

Fixes: 29974

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Mar 16 11:27:08 2026
(Merged from https://github.com/openssl/openssl/pull/30397)
2026-03-16 11:26:47 +00:00
Norbert Pocs
00dcd4527d docs: Fix SSL_CERT_DIR env var
Complements: dfdbc113ee "Partially revert #18070 (Add support for Windows CA certificate store)"

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

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Mon Mar 16 11:24:06 2026
(Merged from https://github.com/openssl/openssl/pull/30390)
2026-03-16 11:23:36 +00:00
herbenderbler
e730ce940d Enforce mandatory cipher get_params at dispatch parse
Reject provider ciphers that lack get_params when unpacking the dispatch
table in evp_cipher_from_algorithm(), failing with
EVP_R_INVALID_PROVIDER_FUNCTIONS instead of later with
EVP_R_CACHE_CONSTANTS_FAILED.

Revert the optional-functions sentence in provider-cipher.pod to "All
other functions are optional." so the doc does not imply only
get_params, newctx, and freectx are required; a consistent
encrypt/decrypt set is also required as described in the prior paragraph.

Move test_cipher_no_getparams from evp_skey_test.c to evp_fetch_prov_test.c
and add fake_cipherprov.c to the evp_fetch_prov_test build.

Drop the redundant newctx/freectx/get_params line from the
evp_cipher_from_algorithm() comment.

Fixes #19110

Made-with: Cursor

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Mon Mar 16 11:22:05 2026
(Merged from https://github.com/openssl/openssl/pull/30383)
2026-03-16 11:21:48 +00:00
YZL0v3ZZ
b4a964f6c1 apps/cmp_mock_srv: fix resource leak in process_genm()
If pushing the generated rsp ITAV object into the out stack fails,
the error path frees the stack container but permanently abandons
the newly allocated rsp object.

Explicitly free the rsp structure if it exists and was not pushed
successfully to prevent this memory leak.

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Mon Mar 16 11:16:02 2026
(Merged from https://github.com/openssl/openssl/pull/30374)
2026-03-16 11:17:18 +00:00
Weidong Wang
ab9f1b22a5 pkcs12: fix PKCS12_set_pbmac1_pbkdf2 error-path leaks
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Mar 16 11:12:12 2026
(Merged from https://github.com/openssl/openssl/pull/30347)
2026-03-16 12:12:06 +01:00
tlhc
0152e4f9f7 dtls: buffer early CCS to handle UDP reorder
Cache early-arriving CCS in dtls1_state_st and replay it when the
handshake reaches the expected state. Clear the flag in
dtls1_clear_received_buffer().

Add dtls_ccs_reorder_test covering client/server reorder, resumption and mutual TLS.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Mon Mar 16 11:01:55 2026
(Merged from https://github.com/openssl/openssl/pull/30225)
2026-03-16 11:01:37 +00:00
Eugene Syromiatnikov
b327b9478a doc/man3/BIO_read.pod: clarify BIO_puts() semantics a bit
Mention that it doesn't write the terminating NUL byte (akin
to the way fputs(3) is documented[1][2]), and that it does not append
'\n', like puts(3) does.

[1] https://pubs.opengroup.org/onlinepubs/9699919799.2008edition/functions/fputs.html
[2] https://www.man7.org/linux/man-pages/man3/fputs.3.html

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Mar 16 10:54:51 2026
(Merged from https://github.com/openssl/openssl/pull/29680)
2026-03-16 10:54:22 +00:00
Neil Horman
43b03f25b9 Ensure that BIO_eof only returns 1, 0 or a negative value
Recently we uncovered the fact that some platforms (nonstop) return a
non-one positive value from feof to indicate end of file.  This is in
compliance with posix standards, but we had some code that assumed 1
would always be the returned value for an EOF condition, causing various
failures.

Fix it by converting BIO_eof to only return 0 or 1 to reflect the EOF
state (or in the windows case -EINVAL if an invalid stream was passed

Fixes #30348

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Sun Mar 15 19:22:41 2026
(Merged from https://github.com/openssl/openssl/pull/30395)
2026-03-15 15:22:38 -04:00
Stas Mors
297dcb966c Digests Algorithm find from name
Add finding object and sn from EVP_MD::type_name(in the base case EVP_MD::type == 0 and seacrhing can failed)

Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/30206)
2026-03-13 20:06:35 +01:00
Stas Mors
e6c4b93dfc Change EVP_get_digestbynid to EVP_MD_fetch in a_verify and cms_sd
Exchange EVP_get_digestbynid to EVP_MD_fetch for correct getting nid from provider

Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/30206)
2026-03-13 20:06:35 +01:00
Milan Broz
cefa8bb0ac Optimize Windows RCU thread signalling.
With the pthread variant, a thread truly wakes up after
the pthread_mutex_unlock call, even if pthread_cond_signal
is called before.

This is not true for the Windows variant. The thread is
woken up in WakeConditionVariable but goes back to sleep.
Reordering (signalling thread after unlocking) should save
some time during transitions and should be safe in this context.

The speedup is visible on lhash_test, running on many CPUs
(on 32 cores, a speedup from 1:40 to 1:05 minutes on test hw).

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

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Mar 13 17:25:49 2026
(Merged from https://github.com/openssl/openssl/pull/30388)
2026-03-13 18:25:29 +01:00
Milan Broz
5f8fad0647 Align Windows RCU implementation to the pthread variant
Unlike the pthread variant, Windows RCU uses broadcast instead
of targeted signal calls in some places, unnecessarily increasing
the number of used cycles.

The retire_qp should wake up only one thread to proceed, not
all of them.  For update_qp, that signals the thread after
increasing writers_alloced, signalling all threads does not make
sense either.

The speedup is significant on lhash_test, running on many CPUs
(on 32 cores, a speedup from 6:20 to 1:40 minutes on test hw).

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

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Mar 13 17:25:47 2026
(Merged from https://github.com/openssl/openssl/pull/30388)
2026-03-13 18:25:29 +01: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
fengpengbo
ed002f9958 Add optimized Montgomery squaring for RV64GC
This PR adds an RV64GC-optimized Montgomery squaring assembly, ported from the ARMv8 __bn_sqr8x_mont algorithm, complementing the earlier multiplication optimization (#28012).

Performance Improvement

| Test Item  | Baseline (C)  | ASM Optimized  | Improvement  |
| ---------- | ------------- | -------------- | ------------ |
| sign/s     | 208           | 220            | 5.77%        |
| verify/s   | 7190          | 7956.6         | 10.66%       |
| encr./s    | 6638          | 7156.0         | 7.8%         |
| decr./s    | 203           | 216            | 6.4 %        |

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Mar 13 17:21:14 2026
(Merged from https://github.com/openssl/openssl/pull/29440)
2026-03-13 18:21:13 +01:00
Zenithal
fdee5cf246 riscv: aes: fix checks on null keys
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Mar 13 17:15:37 2026
(Merged from https://github.com/openssl/openssl/pull/30333)
2026-03-13 18:15:28 +01:00
Paul Louvel
8c547ec7e1 feat: Disabled features are generated during configure automatically
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Mar 13 15:50:43 2026
(Merged from https://github.com/openssl/openssl/pull/30212)
2026-03-13 16:52:12 +01:00
Paul Louvel
e9e6f72640 Added all the disabled algos/protocols into the output of list -disabled
Also separate algorithms and protocols in list -disabled
and display message in case of no disabled features.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Mar 13 15:50:41 2026
(Merged from https://github.com/openssl/openssl/pull/30212)
2026-03-13 16:52:12 +01:00
Paul Louvel
b60869717d fix: disable of ECDH and ECDSA algorithms
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Mar 13 15:50:40 2026
(Merged from https://github.com/openssl/openssl/pull/30212)
2026-03-13 16:52:11 +01:00
Paul Louvel
6c1fead890 fix: added missing conditional macro when disabling the SipHash algorithm
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Mar 13 15:50:39 2026
(Merged from https://github.com/openssl/openssl/pull/30212)
2026-03-13 16:52:11 +01:00
huanghuihui0904
8c141a2cff crypto/evp/exchange.c: fix memory leak in EVP_PKEY_derive_SKEY()
When mgmt == NULL, EVP_PKEY_derive_SKEY() fetches an EVP_SKEYMGMT into skeymgmt. Some early returns in the fallback derive path do not free this object, causing a leak. Route these paths through shared cleanup so skeymgmt is freed.

Resolves: https://github.com/openssl/openssl/issues/30378
Fixes #30378

Signed-off-by: huanghuihui0904 <625173@qq.com>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/30389)
2026-03-13 11:37:15 -04:00
Josh Auler
b7b38d8505 Add WSL build instructions to NOTES-WINDOWS.md
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/30386)
2026-03-13 11:31:06 -04:00
YZL0v3ZZ
d286240daa Fix memory leak in get_str_from_file()
If BIO_gets encounters an empty file or read error, the function
returns NULL without freeing the dynamically allocated heap block (buf).

Safely clear and free the allocated buffer before returning NULL on
the error path. Since get_str_from_file() may handle cryptographic
keys, OPENSSL_clear_free() is used to prevent leaking sensitive data.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/30373)
2026-03-13 11:25:07 -04:00
Matt Caswell
bd3c723105 Add a test to confirm that we get the expected error with HTTP
If we send HTTP directly over a TLS connection then we expect to receive
the SSL_R_HTTP_REQUEST error. So we add a test to confirm that we do.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Mar 13 15:12:44 2026
(Merged from https://github.com/openssl/openssl/pull/30204)
2026-03-13 15:11:59 +00:00
Matt Caswell
69d0f3febe Defer the check that the record fits in our buffer
Previously we confirmed that the record we received from the peer
actually fits in our buffer before validating the record header. However,
this interferes with the checks that the "any" method does for accidental
use of HTTP because the record length will be wrong in this case. To solve
this we simply defer the check until after the record header has been
validated.

Fixes #30196

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Mar 13 15:12:41 2026
(Merged from https://github.com/openssl/openssl/pull/30204)
2026-03-13 15:11:59 +00:00
Matt Caswell
a57ac5d324 Remove further remnants of SSLv2 ClientHello handling
We recently removed support for SSLv2 ClientHello messages - but some
remnants were still remaining in the record layer. We remove those too.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Mar 13 15:12:39 2026
(Merged from https://github.com/openssl/openssl/pull/30204)
2026-03-13 15:11:59 +00:00
YZL0v3ZZ
0d2874b37a Fix resource leak in crls_http_cb()
When the function fails to push the second CRL to the stack, it
incorrectly uses sk_X509_CRL_free() instead of sk_X509_CRL_pop_free().
This destroys the stack container but orphans previously pushed
X509_CRL objects.

Replace it with sk_X509_CRL_pop_free passing X509_CRL_free as the
cleanup routine to ensure deep deallocation of any pushed items.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/30372)
2026-03-13 11:05:32 -04:00
Zhiguo Zhou
ee9e0f6d8f bn: Save/restore non-volatile registers in RSAZ AVX-IFMA code for Win64
The Windows x64 calling convention requires that registers %rsi, %rdi,
and %xmm6 through %xmm15 be preserved by the callee. This patch updates
the RSAZ-2K, 3K, and 4K AVX-IFMA assembly routines to correctly push/pop
%rsi/%rdi and save/restore the non-volatile XMM registers to the stack
when building for Win64.

This ensures ABI compliance and prevents potential data corruption or
crashes in callers that rely on these registers being preserved across
function calls.

Functions updated:
- ossl_rsaz_amm52x20_x1_avxifma256
- ossl_rsaz_amm52x20_x2_avxifma256
- ossl_extract_multiplier_2x20_win5_avx
- ossl_extract_multiplier_2x30_win5_avx
- ossl_extract_multiplier_2x40_win5_avx

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Mar 13 12:15:10 2026
(Merged from https://github.com/openssl/openssl/pull/30280)
2026-03-13 13:15:03 +01:00
slontis
f0de2ebb56 Fix uninitialized variables in rsaz-3k-avxifma & rsaz-4k-avxifma
assembler.

This looks like a block copy bug, the 2k file uses both fields but the
3k & 4K variants only pass acc0_0 to functions.

Reported and proposed fix supplied by pyca (@reaperhulk and @alex).

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Mar 13 08:48:11 2026
(Merged from https://github.com/openssl/openssl/pull/30061)
2026-03-13 09:48:06 +01:00
nkraetzschmar
3d2b2f01f0 ml-kem: wipe full seed buffer in ml_kem_gen_cleanup
The gen ctx stores seed material in uint8_t seedbuf[ML_KEM_SEED_BYTES],
where ML_KEM_SEED_BYTES = ML_KEM_RANDOM_BYTES * 2.
When cleanup runs and gctx->seed != NULL, it wiped ML_KEM_RANDOM_BYTES
so clearing only half of the seed buffer.

This change wipes the entire buffer instead.

CLA: trivial

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Mar 13 08:42:00 2026
(Merged from https://github.com/openssl/openssl/pull/30355)
2026-03-13 09:41:53 +01:00
Joseph Paul
3c0dae181d ossl_bsearch: Fix possible integer overflow bug
Adding the high and low limits might cause the classic binary
search overflow bug. Probably not a concern but its one less
thing to worry about.

CLA: trivial

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Mar 13 08:35:30 2026
(Merged from https://github.com/openssl/openssl/pull/30342)
2026-03-13 09:35:23 +01:00
slontis
af006a0470 Doc: Add additional information to the contributing page.
Updates for new users related to PR's.
Although some of this info is in other places, a new user should
not need to look at 'commiter' related docs.

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
MergeDate: Fri Mar 13 08:28:19 2026
(Merged from https://github.com/openssl/openssl/pull/30336)
2026-03-13 09:28:17 +01:00
kovan
4b5b5868b8 doc: Fix X509_NAME_print documentation to reflect actual behavior
The documentation claimed that X509_NAME_print() would indent each line
by obase characters and wrap lines exceeding 80 characters. However, the
implementation has never actually used obase for any purpose since the
line-wrapping code was removed in 2007 as unreachable.

Update the documentation to state that obase is ignored and the function
outputs on a single line.

Fixes #18004

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

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Mar 13 08:21:51 2026
(Merged from https://github.com/openssl/openssl/pull/29900)
2026-03-13 09:21:20 +01:00
Brittany Morris
c5eb906736 apps: unload provider on app_provider_load() failure
CLA: trivial

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Mar 13 08:10:06 2026
(Merged from https://github.com/openssl/openssl/pull/30314)
2026-03-13 09:09:38 +01:00
Joshua Rogers
3b8e522ae2 Remove static int from .bss
Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu Mar 12 18:22:02 2026
(Merged from https://github.com/openssl/openssl/pull/28909)
2026-03-12 14:19:15 -04:00
Joshua Rogers
435b6510a3 NonStop: reset hpns_connect_attempt at call start and on success
Ensure the NonStop fallback state does not leak across calls by clearing hpns_connect_attempt at the beginning of RAND_query_egd_bytes and after a successful connect. No impact on other platforms.

Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu Mar 12 18:22:00 2026
(Merged from https://github.com/openssl/openssl/pull/28909)
2026-03-12 14:17:44 -04:00
Alexandr Nedvedicky
6d621e6729 QUIC LCID hash table collapse on Windows/32-bit due to SipHash digest size misuse
Some checks failed
GitHub CI / no-shared-macos (push) Has been cancelled
GitHub CI / out-of-readonly-source-and-install-macos (push) Has been cancelled
Compiler Zoo CI / gcc (gcc-10) (push) Has been cancelled
Compiler Zoo CI / gcc (gcc-11) (push) Has been cancelled
Compiler Zoo CI / gcc (gcc-12) (push) Has been cancelled
Compiler Zoo CI / gcc (gcc-13) (push) Has been cancelled
Compiler Zoo CI / gcc (gcc-14) (push) Has been cancelled
Compiler Zoo CI / gcc (gcc-9) (push) Has been cancelled
Compiler Zoo CI / clang (clang-11) (push) Has been cancelled
Compiler Zoo CI / clang (clang-12) (push) Has been cancelled
Compiler Zoo CI / clang (clang-13) (push) Has been cancelled
Compiler Zoo CI / clang (clang-14) (push) Has been cancelled
Compiler Zoo CI / clang (clang-15) (push) Has been cancelled
Compiler Zoo CI / clang (clang-16) (push) Has been cancelled
Compiler Zoo CI / clang (clang-17) (push) Has been cancelled
Compiler Zoo CI / clang (clang-18) (push) Has been cancelled
Compiler Zoo CI / clang (clang-19) (push) Has been cancelled
Compiler Zoo CI / clang (clang-20) (push) Has been cancelled
Compiler Zoo CI / clang (clang-21) (push) Has been cancelled
Fuzz-checker CI / fuzz-checker (map[cc:afl-clang-fast config:enable-fuzz-afl no-module install:afl++ name:AFL]) (push) Has been cancelled
Fuzz-checker CI / fuzz-checker (map[cc:clang-18 config:enable-fuzz-libfuzzer enable-asan enable-ubsan -fno-sanitize=function -fsanitize-coverage=trace-cmp -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION extra:enable-fips enable-lms enable-ec_nistp_64_gcc_128 -fno-sanitize=al… (push) Has been cancelled
Fuzz-checker CI / fuzz-checker (map[cc:clang-18 config:enable-fuzz-libfuzzer enable-asan enable-ubsan -fno-sanitize=function install:libfuzzer-18-dev libs:--with-fuzzer-lib=/usr/lib/llvm-18/lib/libFuzzer.a --with-fuzzer-include=/usr/include/clang/18/include/fuzzer linke… (push) Has been cancelled
Windows GitHub CI / shared (map[arch:amd64 config:enable-lms enable-fips no-thread-pool no-quic os:windows-2025 vcvars:C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat]) (push) Has been cancelled
Windows GitHub CI / shared (map[arch:amd64 config:enable-lms enable-fips os:windows-2022 vcvars:C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat]) (push) Has been cancelled
Windows GitHub CI / shared (map[arch:x86 config:no-fips enable-lms os:windows-2022 vcvars:C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat]) (push) Has been cancelled
Windows GitHub CI / plain (push) Has been cancelled
Windows GitHub CI / minimal (push) Has been cancelled
Windows GitHub CI / cygwin (windows-2022, map[arch:win64 config:-DCMAKE_C_COMPILER=gcc --strict-warnings enable-demos no-fips]) (push) Has been cancelled
Windows Compression GitHub CI / zstd (push) Has been cancelled
Windows Compression GitHub CI / brotli (push) Has been cancelled
Using sizeof(unsigned long) as SipHash digest size; SipHash supports
only 8 or 16 bytes. On platforms where sizeof(unsigned long) == 4,
the call fails, and lcid_hash returns the zero-initialized value,
degrading the hash table into list.

The issue was kindly reported and fix provided by Stanislav Fort at Aisle Research.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu Mar 12 18:04:10 2026
(Merged from https://github.com/openssl/openssl/pull/29814)
2026-03-12 14:04:07 -04:00
Joshua Rogers
e6aabdfb45 rand_egd: harden EGD I/O and bounds; defer fdopen until post connect
Tighten RAND_query_egd_bytes and fix edge cases:

* Reject nonpositive request sizes to avoid wrap when storing the
  length byte in tempbuf[1].
* Treat server length byte as untrusted; bound by the requested size
  and by sizeof(tempbuf) to avoid overrunning caller or stack buffers.
* Defer fdopen until after a successful connect. On HPE NonStop
  (OPENSSL_SYS_TANDEM) the connect retry path may swap the socket fd;
  creating the FILE* early could leave a stale stream pointing at a
  closed descriptor, causing EBADF or short I/O, and leaking the new
  socket. Creating the stream after connect avoids this.
* Initialize fd to -1 and close the raw fd when fdopen fails; ensure
  we close either FILE* or the raw fd on all error paths.
* Remove unused code.

Behavior is unchanged on platforms that do not swap fds during connect.
On TANDEM it prevents stale I/O and descriptor leaks. Overall this
improves robustness and bounds checking for EGD interactions.

Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu Mar 12 17:58:21 2026
(Merged from https://github.com/openssl/openssl/pull/28905)
2026-03-12 13:58:12 -04:00
Matt Caswell
440ac348bf Fix a one byte buffer overflow in s_client
The buffer used to process user commands when using advanced mode ("-adv")
can overflow the buffer by one byte if the the read buffer is exactly
BUFSIZZ bytes in length (16k). When processing the buffer we add a NUL
terminator to the buffer, so if the buffer is already full then we
overwrite by one byte when we add the NUL terminator.

This does not represent a security issue because this is entirely local
and would be "self-inflicted", i.e. not under attacker control.

This issue was reported to use by Igor Morgenstern from AISLE.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Mar 12 17:56:37 2026
(Merged from https://github.com/openssl/openssl/pull/30376)
2026-03-12 18:56:23 +01:00
Bernd Edlinger
0a72e6ae74 Fix error handling in SSL_CTX_add_session
An out-of-memory error in lh_SSL_SESSION_insert
could trigger various use-after-free errors.

Fixes #28632

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu Mar 12 17:51:38 2026
(Merged from https://github.com/openssl/openssl/pull/28636)
2026-03-12 13:51:33 -04:00
dann frazier
4adb40393c doc/man3/OPENSSL_malloc: clarify OPENSSL_clear_free() w/ NULL
It wasn't explicitly clear that it was safe to call OPENSSL_clear_free()
with a NULL because, as worded, it sounded like it may call
OPENSSL_cleanse() on NULL before calling OPENSSL_free().

CLA: trivial

Signed-off-by: dann frazier <dann.frazier@chainguard.dev>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu Mar 12 17:43:51 2026
(Merged from https://github.com/openssl/openssl/pull/28127)
2026-03-12 13:43:44 -04:00
OwenSanzas
134342e194 Fix stack buffer over-read in DES OFB/CFB64 via unchecked num parameter
The `num` parameter in DES OFB64/CFB64 functions tracks the byte offset
within an 8-byte DES block, so valid values are 0-7. However, neither
the EVP set_params path nor the low-level DES functions validated this
bound, allowing an out-of-range `num` to cause a stack buffer over-read
when used as an array index into the 8-byte keystream buffer.

Fix at two levels:
1. Provider layer: reject num >= blocksize in
   ossl_cipher_common_set_ctx_params() before it reaches the cipher.
2. Low-level DES: mask `*num` with `& 0x07` on entry to
   DES_ofb64_encrypt, DES_ede3_ofb64_encrypt, DES_cfb64_encrypt,
   and DES_ede3_cfb64_encrypt, consistent with how `n` is already
   masked at the end of these functions before being written back.

Fixes #30284

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Mar 12 14:24:12 2026
(Merged from https://github.com/openssl/openssl/pull/30332)
2026-03-12 15:24:03 +01:00
Alexandr Nedvedicky
22be3f1b8e fix NULL pointer dereference when pass1 is NULL
Resolves: https://scan5.scan.coverity.com/#/project-view/62622/10222?selectedIssue=1684201
Complements: #adc8e4abd9 Fix Memory leak in app_passwd

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Mar 12 11:32:05 2026
(Merged from https://github.com/openssl/openssl/pull/30365)
2026-03-12 12:29:59 +01:00
slontis
a65de3d6bc PKCS12: Document that the range for key length when using PBMAC1 is (1..64).
Fixes #30246

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Mar 12 10:47:32 2026
(Merged from https://github.com/openssl/openssl/pull/30279)
2026-03-12 11:47:27 +01:00
slontis
b1295c90bc PKCS12: Avoid bypassing the provider when doing HMAC operations.
pkcs12_gen_mac() now used EVP_MAC instead of direct HMAC_ calls.

PBMAC1_PBKDF2_HMAC() added additional data to raised parsing errors.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Mar 12 10:47:31 2026
(Merged from https://github.com/openssl/openssl/pull/30279)
2026-03-12 11:47:27 +01:00
slontis
a191c2de80 PKCS12 app fix
Do not call PKCS12_verify_mac() twice if the UTF8 password matches the mac
password.

In the case of an error in the verify path do not print
"Mac verify error: invalid password?" if there is already an error on the
error stack. An error means something failed in PKCS12_verify_mac(),
If only the password was wrong it does not raise an error.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Mar 12 10:47:29 2026
(Merged from https://github.com/openssl/openssl/pull/30279)
2026-03-12 11:47:13 +01:00
rezhboyu
85bb26e3a2 refactor: remove redundant p/q retrieval in ossl_rsa_fromdata
The p and q parameters were being retrieved into local BIGNUM variables

but never actually used. This change removes the excess retrieval to improve maintainability, following the discussion in PR #30298.

Resolves #30340

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Thu Mar 12 10:32:24 2026
(Merged from https://github.com/openssl/openssl/pull/30353)
2026-03-12 11:32:14 +01:00
Tomas Mraz
2bbc53c983 Add openssl-4.0 branch to various CI jobs
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Mar 12 09:30:32 2026
(Merged from https://github.com/openssl/openssl/pull/30354)
2026-03-12 10:30:26 +01:00
Hamzah M. Yamani
a5057a18aa asn1: use ASN1_STRING accessors in crypto/cmp, crypto/ct, crypto/sm2, crypto/ts
Replace direct ASN1_STRING struct member access (->data, ->length) with
public accessor functions ASN1_STRING_get0_data() and ASN1_STRING_length()
in consumer code across four subsystems.

Also fix i2d_SCT_LIST() in crypto/ct/ct_oct.c to heap-allocate
ASN1_OCTET_STRING via ASN1_OCTET_STRING_new() and ASN1_STRING_set0()
rather than stack-allocating it, since the struct is now opaque.

Removes #include <crypto/asn1.h> from all modified files except
crypto/cmp/cmp_protect.c, which retains it for ossl_X509_ALGOR_from_nid().

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Mar 12 08:53:07 2026
(Merged from https://github.com/openssl/openssl/pull/30223)
2026-03-12 09:52:47 +01:00
Pablo Rodríguez
3930acb0d7 add an initial space to format a command in openssl-cms.pod.in
CLA: trivial

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Mar 12 08:42:31 2026
(Merged from https://github.com/openssl/openssl/pull/30274)
2026-03-12 09:42:27 +01:00
Eugene Syromiatnikov
99bd787fee doc/man3/X509_STORE_set_verify_cb_func.pod: mention callback constification
Update the signatures for X509_STORE_CTX_get_issuer_fn
and X509_STORE_CTX_check_issued_fn.

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: Neil Horman <nhorman@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Mar 12 08:38:24 2026
(Merged from https://github.com/openssl/openssl/pull/30271)
2026-03-12 09:37:59 +01:00
kovan
64fa118611 doc: add return value documentation for EVP_CIPHER params functions
Document the return values for EVP_CIPHER_get_params(),
EVP_CIPHER_CTX_get_params() and EVP_CIPHER_CTX_set_params().
These functions return a positive value for success and 0 or a
negative value for failure, since provider callbacks return int.

Fixes #29725

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

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Mar 11 21:03:58 2026
(Merged from https://github.com/openssl/openssl/pull/29915)
2026-03-11 17:03:55 -04:00
OwenSanzas
30e3a7aa86 Fix clang-format: remove leading space from err label
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
MergeDate: Wed Mar 11 20:58:54 2026
(Merged from https://github.com/openssl/openssl/pull/30331)
2026-03-11 16:58:36 -04:00
OwenSanzas
8835a9ce79 Remove unnecessary comments and extra blank line
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
MergeDate: Wed Mar 11 20:58:51 2026
(Merged from https://github.com/openssl/openssl/pull/30331)
2026-03-11 16:58:36 -04:00
OwenSanzas
707da1e0f3 Remove unnecessary caps in key/iv initialization loops
Drop the `&& i < 16` and `&& i < 8` guards that were carried over from
the original fixed-size arrays. The loops now fill the entire
heap-allocated buffer, with values wrapping naturally via unsigned char.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
MergeDate: Wed Mar 11 20:58:49 2026
(Merged from https://github.com/openssl/openssl/pull/30331)
2026-03-11 16:58:36 -04:00
OwenSanzas
b13f6b9ebb Refactor do_evp_cipher error paths to use goto err
Initialize key, iv, and ctx to NULL at declaration and consolidate
all cleanup into a single err label, as suggested by @npajkovsky.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
MergeDate: Wed Mar 11 20:58:47 2026
(Merged from https://github.com/openssl/openssl/pull/30331)
2026-03-11 16:58:36 -04:00
OwenSanzas
94e563f98c fuzz/provider.c: fix API call order in do_evp_cipher and do_evp_md
Both do_evp_cipher() and do_evp_md() call the parameter-setting
function (EVP_CIPHER_CTX_set_params / EVP_MD_CTX_set_params) before
initializing the algorithm context (EVP_EncryptInit_ex2 /
EVP_DigestInit_ex2). Since the context has no algorithm associated
at that point, set_params always returns 0 and the function
early-returns, making the cipher and digest paths dead code (~20%
of all fuzzer inputs).

Fix by swapping the call order so the context is initialized first.

Additionally, heap-allocate key/iv buffers sized to the cipher's
actual key and IV length, since some ciphers (e.g. DES-EDE3-OFB)
require buffers larger than the previous fixed 16/8-byte arrays.

Fixes #30281

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
MergeDate: Wed Mar 11 20:58:44 2026
(Merged from https://github.com/openssl/openssl/pull/30331)
2026-03-11 16:58:36 -04:00
Marcel Cornu
fc585a277b ML-DSA: Add Win64 SEH unwind support to AVX2 NTT functions
Add ntt_se_handler and .pdata/.xdata sections for the three AVX2 NTT
functions.

Signed-off-by: Marcel Cornu <marcel.d.cornu@intel.com>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Mar 11 15:47:52 2026
(Merged from https://github.com/openssl/openssl/pull/30160)
2026-03-11 11:47:25 -04:00
Marcel Cornu
ba92905c74 ML-DSA: Preserve non-volatile XMM registers on Windows
AVX2 NTT functions clobber YMM6-YMM15. This commit preserves
the lower halves of XMM6-XMM15 required by the Windows x64 ABI.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Mar 11 15:47:49 2026
(Merged from https://github.com/openssl/openssl/pull/30160)
2026-03-11 11:47:25 -04:00
Tomasz Kantecki
198776f61f ML-DSA: optimize one vmovshdup from the NTT multiply operation
It applies to 7 out of 8 levels in NTT and NTT^-1.
It helps eliminate some zeta shuffles in NTT level 6 and NTT^-1 level 1.
Added small optimization in data shuffling between the levels.

Signed-off-by: Tomasz Kantecki <tomasz.kantecki@intel.com>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Mar 11 15:47:46 2026
(Merged from https://github.com/openssl/openssl/pull/30160)
2026-03-11 11:47:25 -04:00
Marcel Cornu
3b3680c639 ML-DSA: Refactor to use function pointers for AVX2/scalar NTT
Replace inline AVX2 capability checks with function pointers that are
initialized once at startup using CRYPTO_THREAD_run_once.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Mar 11 15:47:43 2026
(Merged from https://github.com/openssl/openssl/pull/30160)
2026-03-11 11:47:25 -04:00
Tomasz Kantecki
3c07701bf5 Add AVX2 optimized assembly for ML-DSA NTT
This commit introduces AVX2-vectorized assembly implementations of the
Number Theoretic Transform (NTT) operations used in ML-DSA (FIPS 204).
These optimizations improve performance of ML-DSA key generation,
signing, and verification operations on x86_64 platforms
with AVX2 support.

The implementation adds the following functions:
- ml_dsa_poly_ntt_avx2: Forward NTT transformation
- ml_dsa_poly_ntt_inverse_avx2: Inverse NTT transformation
- ml_dsa_poly_ntt_mult_avx2: NTT-domain polynomial multiplication

Key implementation details:
- Uses YMM registers to process 8 32-bit coefficients in parallel
- Employs Montgomery reduction for modular arithmetic
- Implements NTT butterfly operations across multiple transform levels
- Includes dedicated zeta table for INTT to reduce cycles
- Runtime capability check via ml_dsa_ntt_avx2_capable() using
  OPENSSL_ia32cap_P to detect AVX2 support

The C code in ml_dsa_ntt.c is updated to dispatch to AVX2
implementations
at runtime when available, with automatic fallback to the portable C
implementation on platforms without AVX2 support.

Build system changes:
- Added GENERATE rule for ml_dsa_ntt-x86_64.s from Perl assembly
- Conditional assembly inclusion based on target architecture
- Works with both libcrypto and FIPS provider builds

Co-authored-by: Marcel Cornu <marcel.d.cornu@intel.com>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Mar 11 15:47:40 2026
(Merged from https://github.com/openssl/openssl/pull/30160)
2026-03-11 11:47:24 -04:00
Simo Sorce
b5a69ec5a7 Refactor FIPS parameter and indicator handling
Consolidate FIPS indicators and self-test parameters into a single
structure managed by `fipsparams.pm`. Replace individual accessor
functions with a generic `ossl_fips_config` function that retrieves
values by name. This removes repetitive boilerplate code and
simplifies parameter access within the FIPS provider.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/30213)
2026-03-11 15:55:27 +01:00
Simo Sorce
c6c992b954 Generate FIPS parameter handling with Perl
Replace the C preprocessor macros used for FIPS indicators and self-test
parameters with a Perl-based code generation approach. This introduces
`util/perl/OpenSSL/fipsparams.pm` and `providers/fips/fipsparams.inc.in`
to generate the boilerplate code, simplifying `fipsprov.c` and reducing
macro complexity.

Co-authored-by: Gemini <gemini@google.com>
Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/30213)
2026-03-11 15:55:19 +01:00
WANG Xuerui
fc403c7bfe LoongArch: Accelerate SHA-512 message scheduling with LSX
Detect and use LSX (128-bit SIMD) to accelerate the message scheduling
stage of SHA-512. The main compression round is not amenable to SIMD
optimizations because horizontal data dependencies are very heavy.

In the current approach, 8 vector registers are used to store the 16
active message schedule array elements, with each 128-bit register fully
utilized holding 2 64-bit element each. Thankfully this means the data
dependency between x[n] and x[n-2] for rounds >= 16 (0-based) is
completely side-stepped, and with no computational power wasted.

Performance numbers on Loongson 3C6000 (LA664 uarch) @ 2.2GHz:

Before:

```
version: 3.6.0-dev
built on: Sun Aug  3 10:22:36 2025 UTC
options: bn(64,64)
compiler: gcc -fPIC -pthread -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DNDEBUG
CPUINFO: N/A
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
sha512           27701.14k   109625.41k   206773.00k   311351.64k   367442.71k   371401.72k
```

After:

```
version: 3.6.0-dev
built on: Sun Aug  3 10:22:36 2025 UTC
options: bn(64,64)
compiler: gcc -fPIC -pthread -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DNDEBUG
CPUINFO: N/A
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
sha512           33440.93k   132238.88k   272890.18k   429715.11k   518770.04k   526172.98k
```

Which is an improvement of between 20.63% (for 64B inputs; 20.72% for
16B which is very close) and 41.67% (for 16KiB inputs). This is much
larger an improvement than for SHA-256.

A similar attempt at utilizing LASX is also done, with 4 256-bit XRs
being used to store 4 64-bit elements each, and with the sigma1
computation unrolled twice; performance actually dropped by -12.56%
(64B; -12.59% for 16B) to -22.31% (16KiB) (!!). This large drop is most
likely due to the fact that LASX is incapable of efficiently
transferring data across the higher and lower 128-bit halves -- 3 cycles
latency for every instruction capable of doing so. Specifically, with
the unrolled sigma1 computation, one needs to swap halves and zero the
other unused half, and do this twice; and re-aligning "1234" and "9abc"
parts also requires two such moves, such as moving x[4] from m4567[0] to
m1234[3]. So, ultimately I decided to remove LASX from the patchset.

Signed-off-by: WANG Xuerui <git@xen0n.name>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Mar 11 13:56:17 2026
(Merged from https://github.com/openssl/openssl/pull/28192)
2026-03-11 09:55:48 -04:00
WANG Xuerui
6b0ed85d42 LoongArch: Accelerate SHA-256 message scheduling with LSX
Detect and use LSX (128-bit SIMD) to accelerate the message scheduling
stage of SHA-256. The main compression round is not amenable to SIMD
optimizations because horizontal data dependencies are very heavy.

Due to data dependencies between x[n] and x[n-2] for rounds >= 16
(0-based), at most 2 SIMD lanes can be efficiently utilized, which
unfortunately means half of space is wasted with LSX (128-bit = 4 32-bit
lanes), and LASX (256-bit, 8 32-bit lanes) is meaningless. In the
current approach, 8 vector registers are used to store the 16 active
message schedule array elements; only vr[0] and vr[2] are meaningful for
each VR.

Performance numbers on Loongson 3C6000 (LA664 uarch) @ 2.2GHz:

Before:

```
version: 3.6.0-dev
built on: Sun Aug  3 10:22:36 2025 UTC
options: bn(64,64)
compiler: gcc -fPIC -pthread -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DNDEBUG
CPUINFO: N/A
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
sha256           32676.25k    87543.16k   168349.71k   218342.74k   240099.57k   241639.34k
```

After:

```
version: 3.6.0-dev
built on: Sun Aug  3 10:22:36 2025 UTC
options: bn(64,64)
compiler: gcc -fPIC -pthread -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DNDEBUG
CPUINFO: N/A
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
sha256           37180.32k   104604.94k   206861.06k   276741.65k   306465.73k   308863.06k
```

Which is an improvement of between 13.78% (for 16B inputs) and 27.82%
(for 16KiB inputs).

I have also experimented with a denser storage of message elements, with
4 VRs each storing 4 elements, but performance dropped by 0.25% (16B) to
2.42% (16KiB) because sigma1 must be computed twice with this storage
layout: once on x[14..15], once on the fresh x[16..17].

Signed-off-by: WANG Xuerui <git@xen0n.name>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Mar 11 13:56:15 2026
(Merged from https://github.com/openssl/openssl/pull/28192)
2026-03-11 09:55:48 -04:00
WANG Xuerui
579b2bd132 LoongArch: Evaluate immediate operand values in perlasm
To make the emitted assembly easier to read. No functional change.

Signed-off-by: WANG Xuerui <git@xen0n.name>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Mar 11 13:56:12 2026
(Merged from https://github.com/openssl/openssl/pull/28192)
2026-03-11 09:55:48 -04:00
WANG Xuerui
93d9f1d4a5 LoongArch: Loop-ify generation of SHA256 and SHA512 rounds
De-duplicate the rounds to make the code shorter. No functional change.

Signed-off-by: WANG Xuerui <git@xen0n.name>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Mar 11 13:56:09 2026
(Merged from https://github.com/openssl/openssl/pull/28192)
2026-03-11 09:55:48 -04:00
WANG Xuerui
c347238e68 LoongArch: Use ABI names for perlasm scripts
ABI names (e.g. "$t0" instead of "$r12") on LoongArch are always
supported by mainline binutils and LLVM IAS, so use them for better
readability. No functional change.

Signed-off-by: WANG Xuerui <git@xen0n.name>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Mar 11 13:56:06 2026
(Merged from https://github.com/openssl/openssl/pull/28192)
2026-03-11 09:55:48 -04:00
WANG Xuerui
2114378be6 LoongArch: Strip excess whitespace from SHA256 and SHA512 perlasm output
No functional change.

Signed-off-by: WANG Xuerui <git@xen0n.name>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Mar 11 13:56:03 2026
(Merged from https://github.com/openssl/openssl/pull/28192)
2026-03-11 09:55:47 -04:00
Dr. David von Oheimb
03c94a2a5e 25-test_req.t: add test cases for X509 v1 vs. v3
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Mar 11 11:22:37 2026
(Merged from https://github.com/openssl/openssl/pull/28373)
2026-03-11 12:22:28 +01:00
Dr. David von Oheimb
c955a435e6 ossl_x509_likely_issued(): fix self-signature check in case issuer equals subject
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Mar 11 11:22:35 2026
(Merged from https://github.com/openssl/openssl/pull/28373)
2026-03-11 12:22:28 +01:00
Dr. David von Oheimb
9a188b5eff 25-test_req.t: add test cases pointing out that we won't fix #19095
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Mar 11 11:22:34 2026
(Merged from https://github.com/openssl/openssl/pull/28373)
2026-03-11 12:22:27 +01:00
Dr. David von Oheimb
54f4703a05 v3_purp.c: refactor to improve code commenting of ossl_x509v3_cache_extensions() and X509_check_akid()
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Mar 11 11:22:32 2026
(Merged from https://github.com/openssl/openssl/pull/28373)
2026-03-11 12:22:27 +01:00
Dr. David von Oheimb
258b63ede1 openssl-verification-options.pod: clarify when a certificate is considered (supposedly) self-signed
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Mar 11 11:22:31 2026
(Merged from https://github.com/openssl/openssl/pull/28373)
2026-03-11 12:22:27 +01:00
Dr. David von Oheimb
39c0fe5984 X509_check_issued.pod: add doc of X509_check_akid(), complete X509_check_issued()
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Mar 11 11:22:30 2026
(Merged from https://github.com/openssl/openssl/pull/28373)
2026-03-11 12:22:27 +01:00
1seal
7aedbb34d0 Fix OSSL_parse_url userinfo scan past authority
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed Mar 11 10:22:54 2026
(Merged from https://github.com/openssl/openssl/pull/30319)
2026-03-11 11:22:46 +01:00
Pauli
77f1718f6f safe_math: documentation example fix
The example was for an older version of the code which used triadic
macros to define the functions.  The code was simplified making these
dyadic but the example was skipped.  This fixes the example.

Fixes: cccfc66828 "doc: document the internal integer overflow helpers"
References: b037e3637a "header: add integer overflow helper functions"

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Mar 11 10:19:05 2026
(Merged from https://github.com/openssl/openssl/pull/30266)
2026-03-11 11:18:45 +01:00
Neil Horman
0ed06337e3 Fix use after free in quic_connection freeing if up ref fails
Issue https://github.com/openssl/openssl/issues/3030

Found a use after free case in ossl_quic_accept_connection in the event
that we fail to up_ref the associated quic listener object.

If we fail to take the up ref on the listener object in this function,
we free the SSL object, which calls into
SSL_free->ossl_quic_free->qc_cleanup, which because we have an
associated listener, we free the mutex for, and then get a use-afer-free
when we try to unlock that mutex shortly thereafter.

We really need to fix 3 problems here:

1) The use after free.  Handle this bt ensuring that the listener is
   assigned first.

2) A deadlock, since we already hold the associated mutex, we need to
   defer the free operation until after we unlock the mutex.

3) Don't drop the refcount on the listener object in ossl_quic_cleanup
   (since we failed to up-ref it here).  Handle this by adding a flag to
   indicate up-ref failure in the quic-connection object.

Problem was confirmed by synthetically failing the up ref in local
testing, and this patch was confirmed to fix the issue.

Also, we need  to adjust some of the tests in quicapitest here, as
several tests just assume that SSL_accept_connection will return a
non-null value.

Fixes #30307

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Mar 11 09:22:35 2026
(Merged from https://github.com/openssl/openssl/pull/30311)
2026-03-11 10:22:33 +01:00
kovan
923e582c47 doc: clarify that SSL_CTX/SSL can hold multiple key/cert pairs
Improve the NOTES section of SSL_CTX_use_certificate(3) to make it
clearer that:

- The certificate store is specific to each SSL_CTX or SSL object,
  not a global store
- Multiple key/certificate pairs of different types can be loaded
- This enables offering different certificate types (RSA, ECDSA, etc.)
  on a single TLS server socket
- OpenSSL automatically selects the appropriate certificate during
  the TLS handshake based on cipher suite and signature algorithms
- Loading multiple pairs is done by calling the loading functions
  multiple times

This helps TLS server developers understand that their configuration
should allow multiple key/cert pairs per context.

Fixes #28425

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

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Wed Mar 11 03:20:37 2026
(Merged from https://github.com/openssl/openssl/pull/29786)
2026-03-11 14:20:32 +11:00
Milan Broz
2cf43bb1e4 tests: fix configutl test on Windows
In Windows makefile, "del /Q /S /F test\*.exp" command is called.
Due to use of /S switch and old filenames compatibility
magic, it deletes also all *.expected files.
This make subsequent run of configtest to fail.

As this is the only test using these names (and cryptic
workarounds in makefile are unreadable), let's just
rename expected files to *-exp.out suffix.

Also fix two alien tabs in script.

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

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

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Mar 10 19:42:26 2026
(Merged from https://github.com/openssl/openssl/pull/30324)
2026-03-10 20:42:20 +01:00
Weidong Wang
99ba983e28 Fix memory leak in EC_GROUP_copy()
We must free pre_comp before its overwrite.

Fixes: 3aef36ffef "Add CRYPTO_EX_DATA; remove EC_EXTRA_DATA"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Mar 10 19:04:33 2026
(Merged from https://github.com/openssl/openssl/pull/30320)
2026-03-10 20:03:49 +01:00
Nikola Pajkovsky
b0ba5c81e4 namemap: handle NULL names in name2num lookups
Make ossl_namemap_name2num() return 0 when `name` is NULL, so callers can
use a single lookup path without local NULL guards.

Fixes: aec9e7fe16 ("Allow core_namemap to limit hashtable key sizes")
Resolves: https://scan5.scan.coverity.com/#/project-view/65138/10222?selectedIssue=1683247
Resolves: https://scan5.scan.coverity.com/#/project-view/65138/10222?selectedIssue=1683248
Resolves: https://scan5.scan.coverity.com/#/project-view/65138/10222?selectedIssue=1683249
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Mar 10 18:29:00 2026
(Merged from https://github.com/openssl/openssl/pull/30286)
2026-03-10 14:28:51 -04:00
Daniel Van Geest
28c271365a cms: Fix no-signed-attributes for unknown hashless algorithms
Fix CMS signing without signed-attributes for unknown (provider-supplied)
algorithms with don't operate on a digest (e.g. Falcon).

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Mar 10 18:25:39 2026
(Merged from https://github.com/openssl/openssl/pull/30287)
2026-03-10 14:25:32 -04:00
Uni
fc63b0fedb Handle merged stderr: add 'Failed reading from' pattern
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Tue Mar 10 18:22:20 2026
(Merged from https://github.com/openssl/openssl/pull/30289)
2026-03-10 14:22:06 -04:00
Uni
dc20d355b5 Fix intermittent hang in 82-test_ech_client_server.t
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Tue Mar 10 18:22:17 2026
(Merged from https://github.com/openssl/openssl/pull/30289)
2026-03-10 14:22:06 -04:00
Neil Horman
a743be6d2d Ensure entries in the neighborhood struct are 8 byte aligned
This struct is accessed via atomics, which on some platforms require 8
byte alignment.  Generally compilers provide that alignment, since the
first element of the struct is a uint64_t, but it appears that not all
do.

Force the alignment to be correct

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Mar 10 18:16:34 2026
(Merged from https://github.com/openssl/openssl/pull/30293)
2026-03-10 14:16:30 -04:00
huanghuihui0904
adc8e4abd9 Fix Memory leak in app_passwd
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Mar 10 17:42:48 2026
(Merged from https://github.com/openssl/openssl/pull/30325)
2026-03-10 13:42:27 -04:00
Uni
0d5a73eb38 Fix memory leak of p and q in ossl_rsa_fromdata error path
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Mar 10 15:52:35 2026
(Merged from https://github.com/openssl/openssl/pull/30298)
2026-03-10 11:52:26 -04:00
Pauli
2c39003b2a Change free call to secure free call.
Freeing secure memory using OPENSSL_free causes badness.  Use the proper
free call instead.

Fixes #30302

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Mar 10 15:08:36 2026
(Merged from https://github.com/openssl/openssl/pull/30305)
2026-03-10 11:08:29 -04:00
openssl-machine
d315ac4389 Prepare for 4.1
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Mar 10 14:39:56 2026
Release: yes
2026-03-10 14:39:55 +00:00
openssl-machine
f9b983b6c1 make update
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Mar 10 14:39:41 2026
Release: yes
2026-03-10 14:39:40 +00: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
8f23518654 CHANGES.md, NEWS.md: picking up changes from 3.6.1
Since it has been released before 4.0.0-alpha1.

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: Tue Mar 10 13:39:37 2026
(Merged from https://github.com/openssl/openssl/pull/30338)
2026-03-10 13:13:44 +01:00
Eugene Syromiatnikov
63b300a5b9 CHANGES.md, NEWS.md: update the URL format for CVE URLs
The URLs have changed from [1] to [2].

[1] https://www.openssl.org/news/vulnerabilities.html
[2] https://openssl-library.org/news/vulnerabilities/

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: Tue Mar 10 13:39:35 2026
(Merged from https://github.com/openssl/openssl/pull/30338)
2026-03-10 11:45:08 +01:00
Eugene Syromiatnikov
047eac85de CHANGES.md: additional tfixes, ffixes, and wfixes
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: Tue Mar 10 13:39:32 2026
(Merged from https://github.com/openssl/openssl/pull/30338)
2026-03-10 11:45:08 +01:00
Eugene Syromiatnikov
4e0961e223 NEWS.md: update
Include various items from CHANGES.md, remove items pertaining
OPENSSL_sk_set_cmp_thunks() and crypto-mdebug-backtrace, split into new
features and significant/incompatible changes.
Also, while at it, added the leader to the 3.6.0 news entry.

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: Tue Mar 10 13:39:28 2026
(Merged from https://github.com/openssl/openssl/pull/30338)
2026-03-10 11:36:24 +01:00
Eugene Syromiatnikov
35d09a5f94 Move the FIPS PKCS5_PBKDF2_HMAC limits description from NEWS.md to CHANGES.md
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: Tue Mar 10 13:39:25 2026
(Merged from https://github.com/openssl/openssl/pull/30338)
2026-03-10 11:20:13 +01:00
Eugene Syromiatnikov
47f2c0a27b CHANGES.md: reorder entries
Reorder entries, following general
additions-changes-deprecations-removals order.

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: Tue Mar 10 13:39:22 2026
(Merged from https://github.com/openssl/openssl/pull/30338)
2026-03-10 11:20:13 +01:00
Eugene Syromiatnikov
7324a87796 CHANGES.md, NEWS.md: wfixes, tfixes, ffixes
An attempt has been made to harmonise the language and style
of the changelog and news records a bit.

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: Tue Mar 10 13:39:20 2026
(Merged from https://github.com/openssl/openssl/pull/30338)
2026-03-10 11:20:13 +01:00
Eugene Syromiatnikov
52a4fbee5a CHANGES.md: add links to the mentioned RFCs
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: Tue Mar 10 13:39:17 2026
(Merged from https://github.com/openssl/openssl/pull/30338)
2026-03-10 11:20:13 +01:00
Eugene Syromiatnikov
9805c7bd06 CHANGES.md: add spaces to RFC 8998 mentions
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: Tue Mar 10 13:39:14 2026
(Merged from https://github.com/openssl/openssl/pull/30338)
2026-03-10 11:20:13 +01:00
Eugene Syromiatnikov
fb3b82bd54 CHANGES.md, NEWS.md: sort links in lexicographical order
A specific order makes link addition more consistent moving forward.
The links were sorted with "LC_ALL=C sort -V" command, "sort"
is from GNU coreutils.

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: Tue Mar 10 13:39:11 2026
(Merged from https://github.com/openssl/openssl/pull/30338)
2026-03-10 11:19:27 +01: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
Wo'O Ideafarm
45a8663b07 document the new build option "enable-static-vcruntime"
I placed these new notes prominently based upon how important I think that they are for applications developers targeting Windows platforms.  With this new option, contributed (but not documented) by @nhorman in Commit 9431cc2, standalone executable applications can be distributed that do not require an installer and do not require modification of the target computer.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Mar 6 1:50:49 2026
(Merged from https://github.com/openssl/openssl/pull/30064)
2026-03-06 13:53:00 -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
240b973624 doc/man7/ossl-guide-migration.pod: remove mentions of X509_STORE_CTX funcs
Remove mentions of un-constified X509_STORE_CTX_get_current_cert,
X509_STORE_CTX_get0_cert, X509_STORE_CTX_get0_current_issuer,
X509_STORE_CTX_init, X509_STORE_CTX_set_cert for the list of constified
functions.

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:15 2026
(Merged from https://github.com/openssl/openssl/pull/30272)
2026-03-06 13:32:54 -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
Matt Caswell
dc8a9299bd Add a CHANGES.md entry for the max key_shares/supported groups/sig algs
We now restrict the max number of key_shares/supported groups/sig algs
that we will pay attention to as a server.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Mar  6 10:33:04 2026
(Merged from https://github.com/openssl/openssl/pull/30263)
2026-03-06 10:32:21 +00:00
Matt Caswell
16ef3355a7 Add a test for a large number of key shares
Test that we correctly ignore large numbers of key shares. Similarly we
do the same for a large number of supported groups.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Mar  6 10:33:04 2026
(Merged from https://github.com/openssl/openssl/pull/30263)
2026-03-06 10:32:21 +00:00
Matt Caswell
68dd2e0025 Add a test for a large number of sigalgs
Test that we correctly ignore large numbers of sigalgs

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Mar  6 10:33:04 2026
(Merged from https://github.com/openssl/openssl/pull/30263)
2026-03-06 10:32:21 +00:00
Matt Caswell
447426a06c Restrict the number of supported groups/sig algs
We restrict the number of supported groups and sig algs that the server
is willing to accept from the client to 128 (for both). Any more than
this are simply ignored. This number is significantly more than the total
amount of current codepoints assigned by IANA for these extensions.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Mar  6 10:33:03 2026
(Merged from https://github.com/openssl/openssl/pull/30263)
2026-03-06 10:32:21 +00:00
Matt Caswell
c577864b9b Restrict the number of keyshares a server is willing to accept
A client that sends an excessive number of keyshares to the server can
cause us to check that the groups are both in the client and server lists,
which is expensive. In reality there should be no reason to send a large
number of keyshares, so we restrict this to a sensible number (16). Any
more than this are simply ignored.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Mar  6 10:33:03 2026
(Merged from https://github.com/openssl/openssl/pull/30263)
2026-03-06 10:32:21 +00: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
slontis
e78e141f22 CSHAKE: Fix memory leak related to propq.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Mar  5 17:41:05 2026
(Merged from https://github.com/openssl/openssl/pull/30261)
2026-03-05 18:40:59 +01:00
Viktor Dukhovni
bde5f49e9a Some more X509 extension add/del polish
- In various structures with optional X.509 extensions, deallocate and
  NULL out the extensions pointer when the extensions become empty after
  an extension is deleted.  This uses a new X509v3_delete_extension()
  helper function.  Added corresponding docs.

- Do the same in X509V3_EXT_add_nconf_sk() if after processing all
  the pending updates the stack becomes empty.

- Handle resulting NULL stack in X509V3_EXT_REQ_add_nconf() and
  update_req_extensions().

- Improved testing of certificate SKID/AKID addition and implicit
  removal via "none" value.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
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 17:40:10 2026
(Merged from https://github.com/openssl/openssl/pull/30252)
2026-03-05 18:39:54 +01:00
Milan Broz
a0415a345b windows-makefile: make clean target less noisy
Using del on files that are not present creates many warning
messages. Let's wrap them in "if exists" check to make
them silent if not present.

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

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Mar  5 17:37:20 2026
(Merged from https://github.com/openssl/openssl/pull/30222)
2026-03-05 18:37:14 +01:00
Norbert Pocs
6f24d9c30f SSL_CONF_cmd.pod: Fix TSL typo
Signed-off-by: Norbert Pocs <norbertp@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Mar  5 17:19:00 2026
(Merged from https://github.com/openssl/openssl/pull/30264)
2026-03-05 18:18:30 +01:00
Jon Ericson
68866edc0c fix project spelling and capitalization
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Thu Mar  5 16:35:20 2026
(Merged from https://github.com/openssl/openssl/pull/30259)
2026-03-05 16:34:56 +00:00
Daniel Kubec
d145b767ef x509: remove erroneous critical extension enforcement
Critical extension enforcement (introduced in #8a639b9) is incorrect. These
checks were intended as CA requirements to prevent misinterpretation by
verifiers that don't support certain extensions. However, since we do support
these extensions, we have no requirement for them to be marked critical,
enforcing that is a mistake.

As noted in: #30233 (comment)

Co-authored-by: David von Oheimb <david.von.oheimb@siemens.com>

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 14:22:07 2026
(Merged from https://github.com/openssl/openssl/pull/30249)
2026-03-05 15:21:57 +01:00
Igor Ustinov
1bc4ad1be9 Proxy.pm: Redirect s_server’s output to stderr
Under some circumstances, the test script's output was mixed with
s_server's, resulting in a false negative. To avoid this,
redirect s_server’s output to stderr.

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Mar  5 14:03:32 2026
(Merged from https://github.com/openssl/openssl/pull/30230)
2026-03-05 15:02:43 +01:00
Igor Ustinov
b9da8a5844 SSL_get_error(): Check the error stack only in MSG_FLOW_ERROR state
We need to avoid looking at the error stack unless we are in
error state.

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Mar  5 14:03:30 2026
(Merged from https://github.com/openssl/openssl/pull/30230)
2026-03-05 15:01:47 +01:00
Igor Ustinov
ebb188f0d0 Ensure fatal errors from the record layer put the state machine into err
We fix a problem with the record layer handling code where a fatal error
in the record layer that does not have an alert code associated with it
caused us to not transition the state machine into the error state. If we
have a fatal error we should always do that.

This patch was developed by Matt Caswell <matt@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Mar  5 14:03:27 2026
(Merged from https://github.com/openssl/openssl/pull/30230)
2026-03-05 15:01:15 +01:00
Alexandr Nedvedicky
8b5cd6a682 dane_match_cert() should X509_free() on ->mcert instead
of OPENSSL_free()

Fixes: 170b735820 "DANE support for X509_verify_cert()"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu Mar  5 12:37:17 2026
(Merged from https://github.com/openssl/openssl/pull/30250)
2026-03-05 07:37:06 -05:00
Viktor Dukhovni
8a82e3a754 Deuglify ML-KEM code after reformat
Fix up format of NTT tables, which format nicely when the values
are converted to 12-bit hex.

Also slightly clean up the code for better readability.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Wed Mar  4 17:46:54 2026
(Merged from https://github.com/openssl/openssl/pull/30245)
2026-03-04 18:45:33 +01:00
Dimitri John Ledkov
66ab2db185 fips: Align PKCS5_PBKDF2_HMAC defaults with EVP_KDF-PBKDF2
EVP_KDF-PBKDF2 has provider-dependent runtime behaviour w.r.t. lower
bounds checks. The default provider does not enforce them, but can opt
into them. The fips provider does enforce them, but can opt out.

The same is not true for the PKCS5_PBKDF2_HMAC, which always opts out
of the lower bound checks.

This leads to unexpected behaviour without user consent, they may
expect in error that when using FIPS provider the lower bound checks
will be enforced by default.

There are two popular tools for ACVP testing:
- 9ee15db6e6/app/app_kdf.c (L411)
- e1c094ae3a/backends/backend_openssl_common.c (L1836)

One of them creates params and then calls the one-shot EVP_KDF_derive
api, whilst the other calls the PKCS5_PBKDF2_HMAC convenience
wrapper. For the same ACVP test vectors the two produce different
results: with and without lower bounds checks.

But it seems like PKCS5_PBKDF2_HMAC is popular, as it outnumbers
EVP_KDF_derive 8x when doing a global code search on github
(anecdotal, as results are skewed by the number of forks). This thus
comes down to the expectations end users have. And it feels like, at
least for this API, the FIPS 140-3 users expectation would be for the
lower bound checks to be enforced.

Modify the PKCS5_PBKDF2_HMAC wrapper around EVP_KDF_derive to not set
PKCS5 parameter, such that the provider implicit default is used
instead. Thus no change for default provider users, and FIPS
enforcement by default in the FIPS case like it always has done when
calling via EVP_KDF_derive.

Test fixes:

Tests with too short salt would fail with fips provider.

Add test that FIPS provider rejects invalid salt length.

test/certs: Re-encrypt leaf-encrypted.key with a longer salt.

This way test cases can work with a FIPS provider

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Mar  4 17:25:55 2026
(Merged from https://github.com/openssl/openssl/pull/27431)
2026-03-04 18:24:45 +01:00
Dimitri John Ledkov
d40bfaca75 fips: Skip testing RFC 9579 good files as they use short salt & password
The RFC 9579 good files are always tested with the default provider.

The RFC 9579 good files use too short salt, and too short password
that a sticrly compliant FIPS provider with lower bounds enforcement
should no longer able to open.

If checking positive files is desired, these could be regenerated with
longer salt and password, but not too sure if it is worth it.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Mar  4 17:25:53 2026
(Merged from https://github.com/openssl/openssl/pull/27431)
2026-03-04 18:24:45 +01:00
Frederik Wedel-Heinen
875a791ad2 CHANGES.md: Fix 'extention' and 'insenstive' typos
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Mar  4 17:18:51 2026
(Merged from https://github.com/openssl/openssl/pull/30227)
2026-03-04 18:18:43 +01:00
Frederik Wedel-Heinen
aafd5dcdfd Adds missing definitions to deprecation.pod
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Mar  4 17:12:51 2026
(Merged from https://github.com/openssl/openssl/pull/30216)
2026-03-04 18:12:50 +01:00
sftcd
2cc9014111 ECH: Add back code needed for correct ECH backend confirmation
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Mar  4 17:11:17 2026
(Merged from https://github.com/openssl/openssl/pull/30214)
2026-03-04 18:11:15 +01:00
Samuel Sapalski
78e812c9a1 FIPS: Disable time/request based reseeding for ECDSA KAT DRBG
The ECDSA KAT_Signature selftest can fail if the system time changes
after KAT DRBG initialization, this may trigger a time-based reseed
and break KAT determinism.

Disable time-based reseeding for the KAT DRBG to avoid spurious
selftest failures during e.g. fipsinstall.

In order to make this fix future proof we disable request based
reseeding as well to guarantee determinism during the selftest.

Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Mar  4 16:55:09 2026
(Merged from https://github.com/openssl/openssl/pull/29633)
2026-03-04 17:54:52 +01:00
Bob Beck
ae8d50f211 Make X509_up_ref and X509_free take const X509 *
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Mar  4 16:43:39 2026
(Merged from https://github.com/openssl/openssl/pull/30235)
2026-03-04 17:43:26 +01:00
Beat Bolli
fa293c4d62 remove OPENSSL_BUILDING_OPENSSL from the config
Commit 262cda1cda ("Remove some safestack things that are no longer
needed", 2020-09-03) removed the last usage on this macro.  Remove it in
the configuration as well.

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Mar  4 10:21:38 2026
(Merged from https://github.com/openssl/openssl/pull/30199)
2026-03-04 11:21:07 +01:00
Beat Bolli
b97177bf7b remove OPENSSL_USE_NODELETE from the config
Commits 31659fe326 (Introduce OPENSSL_ATEXIT_CLEANUP env. variable.,
2025-11-24) and 994413f995 (Update NEWS.md, 2025-12-15) removed the last
uses of this macro. Remove it in the configuration as well.

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Mar  4 10:21:36 2026
(Merged from https://github.com/openssl/openssl/pull/30199)
2026-03-04 11:21:07 +01:00
zhoulu
9d46f7f415 Code Comment Correction
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Mar  4 09:59:09 2026
(Merged from https://github.com/openssl/openssl/pull/30194)
2026-03-04 10:59:03 +01:00
sftcd
3885f81304 ech test retry-configs unavailable if server finished corrupted
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Wed Mar  4 09:34:09 2026
(Merged from https://github.com/openssl/openssl/pull/30242)
2026-03-04 09:33:49 +00:00
Frederik Wedel-Heinen
51b0bd6097 SSL_get_shared_ciphers(): Return NUL-terminated buffer for no shared ciphers
Also validate the input buffer and length properly.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Mar  4 09:30:18 2026
(Merged from https://github.com/openssl/openssl/pull/28859)
2026-03-04 10:30:16 +01:00
Neil Horman
69fb9335ee Fix bad length computation in HT_COPY_RAW_KEY_CASE
The new HT_KEY_COPY_RAW fails to account for copy lengths that exceed
the size of the configured buffer in a key, leading to stack overruns on
read.

Rectify that by claming the COPY macro to limit copies to the size of
the buffer

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Mar  4 07:04:07 2026
(Merged from https://github.com/openssl/openssl/pull/30257)
2026-03-04 08:04:05 +01:00
Alexandr Nedvedicky
70e71ac2ae X509 returned by X509_REQ_to_X509() should not be (const ...)
Fixes: 37436ba697 "Constify X509_to_X509_REQ and X509_REQ_to_X509"

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Mar  3 18:26:24 2026
(Merged from https://github.com/openssl/openssl/pull/30229)
2026-03-03 19:26:19 +01:00
Igor Ustinov
2b5bb6148f openssl-verify.pod.in: Add clarification about the parameters order
Fixes #16732

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Mar  3 15:15:33 2026
(Merged from https://github.com/openssl/openssl/pull/30172)
2026-03-03 16:15:31 +01:00
Eugene Syromiatnikov
9e7849122b doc/man7/ossl-removed-api.pod: mention OPENSSL_atexit in the NAME section
Complements: ca52fe62e7 "Remove OPENSSL_atexit();"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Mar  3 14:57:53 2026
(Merged from https://github.com/openssl/openssl/pull/30218)
2026-03-03 15:57:39 +01:00
Frederik Wedel-Heinen
f297e96f66 Adds fixed version tls methods to ossl-removed-api.pod
Fixes #30161

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Mar  3 14:57:52 2026
(Merged from https://github.com/openssl/openssl/pull/30218)
2026-03-03 15:57:39 +01:00
Neil Horman
aec9e7fe16 Allow core_namemap to limit hashtable key sizes
Now that we can dynamically size keys for our hashtable, take advantage
of that in core_namemap.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Mar  3 13:23:03 2026
(Merged from https://github.com/openssl/openssl/pull/30211)
2026-03-03 08:22:57 -05:00
Neil Horman
938c59fa2c Add support for dynamic key sizing in hashtable
Currently our internal hashtable suffers from a performance issue, as
discussed here:
https://github.com/openssl/openssl/pull/30188

The hashtable requires that keys be defined at build time, and moreover,
be defined to support the maximum possible key length you might try to
insert to a given hash table, even if they actual key you are using is
shorter.

As a result, that hashtable hash function (typically ossl_fnv1a_hash,
but any hash function really) receives a buffer that is specified as the
maximal length of the build-time defined key, which often means hashing
of many 0 bytes for byte elements in the key that may never have been
used.  This causes performance problems as we are always hashing the
maximum number of elements, even if they key is truly only a few bytes
long.

Lets give users an opportunity to improve on that.

Keys are defined to be a struct, so that users can access individual
field names within the key, but under the covers its all just one
contiguous uint8_t buf.  We can implement macros that allow users to,
instead of setting individual field names, just copy needed data into
the raw buffer, keeping track of how many bytes have been used as we go.

The result of using these macros is that the hash function, while it
will receive a buffer that is still maximally sized for that particular
key, gets a length value that only represents the number of bytes used
while writing the key value.

This results in the hash function having to do much less work, giving us
a significant opportunistic speedup.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Mar  3 13:23:00 2026
(Merged from https://github.com/openssl/openssl/pull/30211)
2026-03-03 08:22:57 -05:00
Neil Horman
71c29249c7 fix implementation json naming in quic interop tests
upstream test harness project renamed its implementations.json file to
implementations_quic.json.  We need to do the same in our CI file

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Mar  3 11:37:49 2026
(Merged from https://github.com/openssl/openssl/pull/30248)
2026-03-03 04:59:08 -05:00
Tomas Mraz
e09a74e5d1 Indicate EOF on fatal error in file or winstore
If decoders setup fails, this is a fatal error.
We indicate EOF from the store as otherwise the store
users will loop indefinitely.

Fixes #28667

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon Mar  2 19:38:43 2026
(Merged from https://github.com/openssl/openssl/pull/30170)
2026-03-02 20:38:38 +01:00
slontis
5e63272329 FIPS: Change EC_GROUP_check() so that it fails for explicit curves.
Reported by Luigino Camastra (Aisle Research).

Explicit curves returned a NID of NID_undef (which has a value of 0)
which resulted in the check >= 0 passing.
Changing the result to > addresses the issue.
Note that this is a NON issue in master since explicit curves are
now disabled by default. Note also that for any EC operation that
tries to use a loaded EC key, checks that the curve and security
strength are valid.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Mar  2 19:37:04 2026
(Merged from https://github.com/openssl/openssl/pull/30138)
2026-03-02 20:36:56 +01:00
Alexandr Nedvedicky
2a15001582 ossl_lms_key_to_text(): Fix NULL pointer dereference of key argument
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1682024
Complements: 3d82b990d1 Added LMS support for OpenSSL commandline signature verification using pkeyutl.

Reviewed-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: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Mon Mar  2 19:33:33 2026
(Merged from https://github.com/openssl/openssl/pull/30215)
2026-03-02 20:33:01 +01:00
Viktor Dukhovni
c55fda746a Polish AKID/SKID handling and related docs
- Drop empty requestExtensions CSR attributes

  While `attributes` is a required CSR field, its `requestExtensions`
  attribute is optional, and should be avoided if empty.

- Detail documentation of req extension section selection

- Fixed req CI test case naming nits

- Refer to config(5) for meaning of "variable"

- In code comments, note possibility of fewer extensions after adding
  an ignored empty extension while deleting a previous value.

- Mention new "nonss" AKID qualifier in CHANGES

- I x509_config(5) Clarify AKID issuer as fallback (unless ":always")

- In stock config file, comment proxy cert issuer SKID expectation.

- Clarify comment on empty SKID/AKID vs. prior value

- Use B<default> not C<default> for unnamed section

- Polish (mostly CSR) extension handling

  * In update_req_extensions() drop extraneous duplicate
    X509at_delete_attr() call.
  * Consolidate empty SKID/AKID detection in new
    ossl_ignored_x509_extension().
  * Handle empty SKID/AKID also in X509V3_add1_i2d().
  * In test_drop_empty_csr_keyids() exercise the full NCONF extension
    management stack, using X509_REQ_get_attr_count() to check that
    after "subjectKeyIdentifier = none" not an even an empty extension
    set remains as a CSR attribute (X509_REQ_get_extensions() always
    returns at least an empty stack because NULL signals an error).

Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Mon Mar  2 17:04:22 2026
(Merged from https://github.com/openssl/openssl/pull/30217)
2026-03-02 12:04:10 -05:00
Igor Ustinov
337d5c6e0b Make the openssl-ciphers(1) manual page up to date
There are multiple changes - updated ciphers to more current ones,
also better documentation for COMPLEMENTOFDEFAULT.

Fixes #6653

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Mar  2 15:56:39 2026
(Merged from https://github.com/openssl/openssl/pull/30153)
2026-03-02 16:55:24 +01:00
Alexandr Nedvedicky
d6db530411 Coverity complains X509_REQ_set_subject_name() return value
is ignored.

Resolves: https://scan5.scan.coverity.com/#/project-view/62622/10222?selectedIssue=1201538

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Mon Mar  2 13:03:03 2026
(Merged from https://github.com/openssl/openssl/pull/30193)
2026-03-02 08:02:56 -05:00
Alexandr Nedvedicky
6e22081cbd copy_email() may leak memory when asked to move data
instead of copy

Resolves: https://scan5.scan.coverity.com/#/project-view/62622/10222?selectedIssue=1681722

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Mon Mar  2 12:51:48 2026
(Merged from https://github.com/openssl/openssl/pull/30192)
2026-03-02 07:51:39 -05:00
slontis
65c8fdc6c6 SHAKE - Fix 390x CI problems for SLH-DSA
Fixes #30039

In order to fix this, the ossl_sha3_ related functions have been
renamed so that ossl_sha3_XXX() functions are the high level
functions that contain calls to platform specific methods.
ossl_sha3_XXX_default() etc are the 'general' platform methods.

All of the state checking has been moved out of the platform specific
methods. The sha3 provider dispatch functions now share the
ossl_sha3_XXX() calls.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Mar  2 11:58:44 2026
(Merged from https://github.com/openssl/openssl/pull/30104)
2026-03-02 12:58:42 +01:00
sftcd
b39fc8395a adds test of ECH fail then using retry configs
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Mon Mar  2 09:58:58 2026
(Merged from https://github.com/openssl/openssl/pull/30155)
2026-03-02 09:58:35 +00:00
sftcd
7428975d3f add check before releaseing retry-configs
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Mon Mar  2 09:55:44 2026
(Merged from https://github.com/openssl/openssl/pull/30175)
2026-03-02 09:55:27 +00:00
kovan
ce101e19ab doc: document provider/library context cleanup order requirement
Document that providers must be unloaded with OSSL_PROVIDER_unload()
before their associated library context is freed with OSSL_LIB_CTX_free().
Calling OSSL_PROVIDER_unload() after the library context has been freed
results in undefined behavior (heap-use-after-free).

The warning is added to both OSSL_PROVIDER(3) and OSSL_LIB_CTX(3) man pages
to ensure users encounter it regardless of which documentation they consult.

Fixes #27522

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Sun Mar  1 19:03:43 2026
(Merged from https://github.com/openssl/openssl/pull/29785)
2026-03-01 14:03:39 -05:00
Neil Horman
3bd54e7b2c Document PKCS7_dataVerify
Its older, and generally replaced by PKCS7_verify, but its not
deprecated, so we should document it.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Sun Mar  1 14:18:17 2026
(Merged from https://github.com/openssl/openssl/pull/30158)
2026-03-01 09:18:11 -05:00
Neil Horman
3719143af6 Fix return values on PKCS7_dataVerfiy
PKCS7_dataVerify returns 1 on success or 0 on failure, just like
PKCS7_verify.

except, if everything else goes right, it returns the value of
PKCS7_signatureVerify, which may be -1, which seems wrong.

Instead, check the retun of PKCS7_signatureVerify within this function
for an error, and make PKCS7_dataVerify return 0 in the event
signatureVerify fails.

This brings us into line with PKCS7_verify behavior

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Sun Mar  1 14:18:14 2026
(Merged from https://github.com/openssl/openssl/pull/30158)
2026-03-01 09:18:01 -05:00
Viktor Dukhovni
cc360d1fa1 Fix doc name of ML-DSA-MU
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Sun Mar  1 02:42:17 2026
(Merged from https://github.com/openssl/openssl/pull/30157)
2026-03-01 13:42:03 +11:00
Viktor Dukhovni
16e5d81a61 Replace built-in AKID/SKID with configs
Add tests for suppression of skid/akid via explicit "none"
values and per-keyword "nonss" qualifiers and update docs.

Signing of X509 certs and X509_REQ CSRs rejects empty AKID/SKID
extensions, document and test this behaviour.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sat Feb 28 15:22:53 2026
(Merged from https://github.com/openssl/openssl/pull/29057)
2026-03-01 02:22:41 +11:00
Viktor Dukhovni
84419e373a Improved handling of AKID/SKID extensions in CSRs and certs
With the advent of the new AKID and SKID value syntax:

    - subjectKeyIdentifier = none
    - authorityKeyIdentifier = none

the resulting extensions are not directly suppressed, instead they
are parsed respectively as an empty OCTET STRING or an empty SEQUENCE.

There was new code in "apps/" to then drop the extension when signing
certificates, but this did not address applications that sign
certificates via the API, nor did it avoid adding these in CSRs.

We now drop these specific empty extensions from both certificates and
CSRs as part of X509v3_add_ext(), with the parsed extension never added
to the extension stack.

This means that in the "apps" the default "hash" or "keyid, issuer"
values must now be created first, with config settings and command-line
options applied after replacing the default as requested (including
"none" to suppress the extensions if desired).

If somehow an application manages to construct a TBS cert or CSR with a
pending empty SKID or AKID extension, an error is raised and the TBS is
not signed.

When no SKID is present in a self-signed cert, attempts to
force an AKID keyid need to fail, rather than produce an AKID
that will never match.

Similarly, when issuer cert == subject cert (same object in memory), but
the issuer key is not the subject key (forced signing key), there is no
way to infer the unknown issuer's name or serial number, so, with
"issuer:always" we must fail, rather than record the subject's own
issuer name and serial.

New "keyid:nonss" and "issuer:nonss" syntax is now supported, which
allows either part of the AKID to be conditional on the certificate not
being self-signed.  In the case if "issuer:nonss" this is also
conditional on there being no non-empty issuer keyid.  To force
inclusion of issuer+serial in the AKID use "issuer:always".

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sat Feb 28 15:22:47 2026
(Merged from https://github.com/openssl/openssl/pull/29057)
2026-03-01 02:17:57 +11:00
Frederik Wedel-Heinen
b678c18c9e Fallback implementation of tsan_add now returns value before addition to be consistent with other definitions
Fixes #28410

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Sat Feb 28 14:10:25 2026
(Merged from https://github.com/openssl/openssl/pull/30180)
2026-02-28 09:10:22 -05:00
Pauli
c6a5fb50d7 Add a note about commit message titles being 50-70 character in length
Requested by @levitte in #30075

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sat Feb 28 14:04:35 2026
(Merged from https://github.com/openssl/openssl/pull/30148)
2026-02-28 09:04:32 -05:00
Igor Ustinov
341054d4e4 Fixes Coverity issue CID 1681693
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sat Feb 28 13:23:47 2026
(Merged from https://github.com/openssl/openssl/pull/30189)
2026-02-28 08:23:41 -05:00
Pauli
4c4f7b6734 Add CHANGES entry noting the removal of the SSL_TXT_FIPS option
The option was a remnant of the FIPS canister and wasn't used anywhere.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/30200)
2026-02-28 11:47:39 +01:00
Pauli
f5070fede4 Remove SSL_TXT_FIPS
This refers to an option that is no longer supported or available.
The option is a remnant of the old FIPS canister from OpenSSL 1.0.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/30200)
2026-02-28 11:47:39 +01:00
Pauli
52bd241f19 Remove remnant SSL_FIPS flag
This flag was used to support the old FIPS canister and isn't used or
needed anymore.  It's only set in the data structures and never queried
so it's removal is low impact.

Fixes #30156

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/30200)
2026-02-28 11:47:39 +01:00
Viktor Dukhovni
3acf8e9a1a Added -expected-rpks s_client/server option
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Sat Feb 28 09:17:23 2026
(Merged from https://github.com/openssl/openssl/pull/30089)
2026-02-28 20:14:40 +11:00
Viktor Dukhovni
2357b35ff7 Ensure TLS 1.3 ciphersuites are actually for TLS 1.3
- Also suppress duplicate ciphersuites
- Also ignore case in both TLS 1.3 and TLS 1.2 ciphers

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Sat Feb 28 09:11:33 2026
(Merged from https://github.com/openssl/openssl/pull/30140)
2026-02-28 20:09:29 +11:00
Daniel Kubec
8a6dffc063 CRL: Reject CRLs with malformed Issuing Distribution Point
CRLs with a malformed Issuing Distribution Point are now rejected.
ASN.1 parsing errors from the IDP extension are propagated instead
of being suppressed.

Fixes #27251

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 27 20:06:59 2026
(Merged from https://github.com/openssl/openssl/pull/30171)
2026-02-27 15:06:50 -05:00
Bob Beck
74be610db3 Add alternate ordering for ossl-guide-migration
Add alternate wordings for ossl-guide-migration so that its a bit easier
to find.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Fri Feb 27 18:45:50 2026
(Merged from https://github.com/openssl/openssl/pull/30165)
2026-02-27 13:14:50 -05:00
Bob Beck
c0f82d915f Describe X509 constification and ASN1_STRING changes
In a CHANGES.md entry and in ossl-guide-migration, to
cover the constification of the X509 related functions and
the change to ASN1_STRING to be opaque.

Fixes: #30060

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Fri Feb 27 18:45:47 2026
(Merged from https://github.com/openssl/openssl/pull/30165)
2026-02-27 13:11:25 -05:00
slontis
14371f36cc Added HSS/LMS OID id-alg-hss-lms-hashsig
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Fri Feb 27 14:40:27 2026
(Merged from https://github.com/openssl/openssl/pull/29381)
2026-02-27 14:39:57 +00:00
slontis
a324e506cb Added additional TRACE information to Decoders.
This outputs the description field which is easier to understand than a
pointer.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Fri Feb 27 14:40:27 2026
(Merged from https://github.com/openssl/openssl/pull/29381)
2026-02-27 14:39:57 +00:00
slontis
07933f8e3a Added LMS SubjectPublicInfo related encoders and decoders.
Added a description to all encoder and decoder fields.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Fri Feb 27 14:40:27 2026
(Merged from https://github.com/openssl/openssl/pull/29381)
2026-02-27 14:39:57 +00:00
slontis
3d82b990d1 Added LMS support for OpenSSL commandline signature verification using pkeyutl.
Added LMS 'SubjectPublicKeyInfo' encoder/decoder support.
Modified LMS keymanager and signature code to work with pkey and
pkeyutl.

Test data for public keys and signatures were generated by modifying
BouncyCastle code tests.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Fri Feb 27 14:40:27 2026
(Merged from https://github.com/openssl/openssl/pull/29381)
2026-02-27 14:39:57 +00:00
Tomas Mraz
fc15338f90 ossl_x509v3_cache_extensions(): Fix regression of no-rfc3779 build
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Fri Feb 27 10:43:43 2026
(Merged from https://github.com/openssl/openssl/pull/30202)
2026-02-27 11:37:15 +01:00
Richard Levitte
b7a42c6a3c crypto/bio/bio_print.c: maintain consistent MSVC feature macro guards
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Feb 26 17:12:02 2026
(Merged from https://github.com/openssl/openssl/pull/30177)
2026-02-26 18:11:07 +01:00
Alexandr Nedvedicky
89e9bd3fa6 Fix potential use after free in buffer_from_bytes()
Fix coverity issue 1681707

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Feb 26 15:05:37 2026
(Merged from https://github.com/openssl/openssl/pull/30169)
2026-02-26 10:05:12 -05:00
Neil Horman
792a760ac2 Constify X509_check_issued and friends
Constify this funcitons X509 parameter, as it generally doesn't modify
the structure, save for the caching information that it computes.

Note: As the caching opertions in ossl_x509v3_cache_extensions modify
X509 data all over the place, this change centralizes those updates,
which is something of an increase in complexity, but it does allow us to
reduce the critical section of the write lock there which (hopefully)
will make other accesses that take that lock a bit faster.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Feb 26 14:58:30 2026
(Merged from https://github.com/openssl/openssl/pull/30067)
2026-02-26 09:58:27 -05:00
William Faber
3fdeb5dc8e Fix clean target to remove test-runs directory
Fixes: #29931

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
MergeDate: Thu Feb 26 14:26:16 2026
(Merged from https://github.com/openssl/openssl/pull/30100)
2026-02-26 14:47:31 +01:00
Neil Horman
5971d32cfb Remove dead code in ossl_ech_copy_inner2outer
Theres an additional NULL check in this function that can never be NULL
at the point at which it is checked.  Remove it

Fixes https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1681461

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Wed Feb 25 15:32:54 2026
(Merged from https://github.com/openssl/openssl/pull/30147)
2026-02-25 10:32:51 -05:00
Neil Horman
07ee3d5db8 constify X509_find_by_issuer_and_serial
Constify the return value of X509_find_by_issuer_and_serial, and fix up
the callers to handle it properly (affects two pkcs7 functions)

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Feb 25 15:05:11 2026
(Merged from https://github.com/openssl/openssl/pull/30092)
2026-02-25 10:05:03 -05:00
Tomas Mraz
58d88a34ff test_sigalgs_available(): Add missing FALLTHROUGH annotation
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Feb 25 14:23:45 2026
(Merged from https://github.com/openssl/openssl/pull/30174)
2026-02-25 14:54:03 +01:00
Daniel Kubec
d9461c0d26 Improved reporting of shared and peer sigalgs
The existing SSL_get_sigalgs() and SSL_get_shared_sigalgs() are not a
good fit for TLS 1.3, because signature schemes are no longer generally
combinations of separate digest and signing algorithms encoded in the
two byte codepoint.

The new SSL_get0_sigalg() and SSL_get0_shared_sigalg() functions just
report the signature scheme name and codepoint.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:30:16 2026
(Merged from https://github.com/openssl/openssl/pull/29982)
2026-02-25 12:30:14 +01:00
Eugene Syromiatnikov
226438fcb5 ssl/ech/ech_store.c: use OPENSSL_malloc_array() in ech_decode_one_entry()
Use OPENSSL_malloc_array() for ee->suites array allocation, as it is more
semantically sound and performs a size overflow check.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:20:15 2026
(Merged from https://github.com/openssl/openssl/pull/30146)
2026-02-25 12:19:46 +01:00
Eugene Syromiatnikov
26e8ece04f ssl/ech/ech_store.c: do not raise errors on allocation failures
The default CRYPTO_malloc() implementation (with OPENSSL_malloc()
and OPENSSL_zalloc() being wrappers for it) raises an error
on allocation, and both OPENSSL_strdup() and OPENSSL_memdup() use
CRYPTO_malloc() internally for memory allocation, so there is no need
to explicitly raise an error on an allocation failure;  remove these.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:20:14 2026
(Merged from https://github.com/openssl/openssl/pull/30146)
2026-02-25 12:19:43 +01:00
Weixie Cui
b09086cb36 evp_kem_init(): Fix copy paste bug when checking decapsulate_init
CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:13:36 2026
(Merged from https://github.com/openssl/openssl/pull/30144)
2026-02-25 12:12:36 +01:00
Eugene Syromiatnikov
f6c9ce7e67 test/ech_test.c: avoid memory leaks in ech_api_basic_calls()
rinner and router should be freed after successful SSL_ech_get1_status()
calls.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681465
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681466
Fixes: 5e5a76fc2c "Add tests and documentation and fix a couple of issues identified by added tests"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:58 2026
(Merged from https://github.com/openssl/openssl/pull/30139)
2026-02-25 12:10:24 +01:00
Eugene Syromiatnikov
2f4ef4a912 test/ech_corrupt_test.c: avoid memory leak in tls_corrupt_write()
corrupt_or_copy() may return 0 while still setting returning the allocated
memory in copy, avoid leaking it by always calling OPENSSL_free() on it.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681460
Fixes: 5e5a76fc2c "Add tests and documentation and fix a couple of issues identified by added tests"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:57 2026
(Merged from https://github.com/openssl/openssl/pull/30139)
2026-02-25 12:10:24 +01:00
Eugene Syromiatnikov
e531a13df4 ssl/statem/statem_srvr.c: avoid WPACKET momory leak in tls_process_client_hello
Call WPACKET_cleanup() in case of a WPACKET_* call error after
successfull WPACKET_init_static_len() before return.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681448
Fixes: 6c3edd4f3a "Add server-side handling of Encrypted Client Hello"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:56 2026
(Merged from https://github.com/openssl/openssl/pull/30139)
2026-02-25 12:10:24 +01:00
Eugene Syromiatnikov
30208ddb67 ssl/statem/extensions_srvr.c: free empty rcfgs in tls_construct_stoc_ech()
Free rcfgs before return when rcfgslen is 0, mostly to placate
Coverity, as it is expected to be NULL with the majority of realloc()
implementations.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681463
Complements: 6c3edd4f3a "Add server-side handling of Encrypted Client Hello"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:55 2026
(Merged from https://github.com/openssl/openssl/pull/30139)
2026-02-25 12:10:24 +01:00
Eugene Syromiatnikov
869506ded6 ssl/statem/extensions_clnt.c: superfluous NULL check in tls_construct_ctos_psk()
Remove superfluous NULL check of s->session in tls_construct_ctos_psk(),
as it is assumed to be non-NULL elsewhere.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681450
Fixes: ade10c5dbf "ECH client side"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:54 2026
(Merged from https://github.com/openssl/openssl/pull/30139)
2026-02-25 12:10:24 +01:00
Eugene Syromiatnikov
3a5fa572be ssl/ech/ech_store.c: avoid NULL dereference in ech_decode_one_entry()
Do not jump to the err label on rent NULL check failure (where
it is dereferenced) and rather return immediately.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681462
Fixes: 4af71a7738 "ECH CLI implementation"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:52 2026
(Merged from https://github.com/openssl/openssl/pull/30139)
2026-02-25 12:10:24 +01:00
Eugene Syromiatnikov
bbd93b02c4 ssl/ech/ech_store.c: avoid uninitialised WPACKET use in OSSL_ECHSTORE_new_config
Do not call WPACKET_cleanup() in case of WPACKET_init() failure
and earlier errors.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681459
Fixes: 4af71a7738 "ECH CLI implementation"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:51 2026
(Merged from https://github.com/openssl/openssl/pull/30139)
2026-02-25 12:10:24 +01:00
Eugene Syromiatnikov
5366d8c942 ssl/ech/ech_store.c: avoid memory leak on error path in OSSL_ECHSTORE_new
Free the newly allocated OSSL_ECHSTORE in case of propq duplication
failure before return.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681457
Fixes: 7debe0ddef "ECH external APIs"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:50 2026
(Merged from https://github.com/openssl/openssl/pull/30139)
2026-02-25 12:10:24 +01:00
Eugene Syromiatnikov
3a0a16fa27 ssl/ech/ech_internal.c: avoid memory leak on ech_decode_inbound_ech() error path
Free allocated tmpenc in case of subsequent PACKET_copy_bytes() failure.

Reolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681456
Fixes: 6c3edd4f3a "Add server-side handling of Encrypted Client Hello"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:49 2026
(Merged from https://github.com/openssl/openssl/pull/30139)
2026-02-25 12:10:24 +01:00
Eugene Syromiatnikov
9fe7bf3882 ssl/ech/ech_internal.c: avoid NULL dereference in ossl_ech_get_ch_offsets
Do not call SSLfatal with s that can potentially be NULL.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681455
Fixes: 6c3edd4f3a "Add server-side handling of Encrypted Client Hello"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:47 2026
(Merged from https://github.com/openssl/openssl/pull/30139)
2026-02-25 12:10:24 +01:00
Eugene Syromiatnikov
054027e1ba ssl/ech/ech_internal.c: avoid truncating time_t value in ossl_ech_status_print
Avoid casting time_t (that is almost universally 64-bit nowadays)
to (32-bit) int and cast it to long long instead.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681453
Fixes: ade10c5dbf "ECH client side"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:46 2026
(Merged from https://github.com/openssl/openssl/pull/30139)
2026-02-25 12:10:24 +01:00
Eugene Syromiatnikov
fe26c12b08 ssl/ech/ech_store.c: check WPACKET_get_total_written return value
Check the return value of check WPACKET_get_total_written() call
in OSSL_ECHSTORE_new_config() and OSSL_ECHSTORE_write_pem(),
and error out on failure.

References: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681451
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:45 2026
(Merged from https://github.com/openssl/openssl/pull/30139)
2026-02-25 12:10:24 +01:00
Eugene Syromiatnikov
3dc9834fb0 ssl/ech/ech_internal.c: avoid memory leak in ossl_ech_get_retry_configs()
Free the temporarily allocated memory before returning on failed size
overflow check.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681458
Fixes: 0bdae603e8 "ossl_ech_get_retry_configs(): Check for integer overflow"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:43 2026
(Merged from https://github.com/openssl/openssl/pull/30139)
2026-02-25 12:10:24 +01:00
Eugene Syromiatnikov
3e08902de4 ssl/ech/ech_internal.c: check WPACKET_get_total_written in ossl_ech_send_grease
Check the result of WPACKET_get_total_written() calls
in ossl_ech_send_grease(), as is done elsewhere.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681451
Fixes: ade10c5dbf "ECH client side"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:42 2026
(Merged from https://github.com/openssl/openssl/pull/30139)
2026-02-25 12:10:24 +01:00
Eugene Syromiatnikov
8abd64ab61 ssl/ech/ech_internal.c: avoid superfluous extval check in ossl_ech_early_decrypt
Remove superfluous extval NULL check on success path, as it cannot
be NULL, and is already dereferenced earlier.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681447
Fixes: 6c3edd4f3a "Add server-side handling of Encrypted Client Hello"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:41 2026
(Merged from https://github.com/openssl/openssl/pull/30139)
2026-02-25 12:10:24 +01:00
Eugene Syromiatnikov
2bd2451da2 apps/s_server.c: call OPENSSL_DIR_end after directory traversal in ech_load_dir
While it is not documented, OPENSSL_DIR_end() is to be called at the end
of directory traversal to free the context and avoid leaking memory.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681464
Fixes: a2e5848d9d "s_client and s_server options for ECH"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:39 2026
(Merged from https://github.com/openssl/openssl/pull/30139)
2026-02-25 12:10:23 +01:00
Eugene Syromiatnikov
08f6739dfa apps/s_server.c: free ECH storage in ech_load_dir() on return
The ECH storage is to be freed on both error and success paths,
as it is copied by SSL_CTX_set1_echstore().

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681454
Fixes: a2e5848d9d "s_client and s_server options for ECH"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:38 2026
(Merged from https://github.com/openssl/openssl/pull/30139)
2026-02-25 12:10:23 +01:00
Eugene Syromiatnikov
3770f02f93 apps/ech.c: free the resources on option help printing
Avoid leaking resources when jumping to opthelp by executing the same
freeing routines.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681452
Fixes: 4af71a7738 "ECH CLI implementation"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:37 2026
(Merged from https://github.com/openssl/openssl/pull/30139)
2026-02-25 12:10:23 +01:00
Viktor Dukhovni
e6a9a6e998 Simplify and expand default group list
With keyshare floating, we no longer need CPP conditions to get the
right keyshare prediction defaults.

Also add "curveSM2" near the end of the list, after the stronger ECX and
EC groups, but before FFDHE.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:08:17 2026
(Merged from https://github.com/openssl/openssl/pull/30113)
2026-02-25 22:06:57 +11:00
Viktor Dukhovni
52cf530a0f Add keyshare floating
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:08:10 2026
(Merged from https://github.com/openssl/openssl/pull/30113)
2026-02-25 22:06:57 +11:00
Viktor Dukhovni
9efd7e9e98 Fix group tuple handling in DEFAULT expansion
Also fine-tune docs and add tests.

Fixes: #30109
Fixes: CVE-2026-2673

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:08:03 2026
(Merged from https://github.com/openssl/openssl/pull/30113)
2026-02-25 22:06:57 +11:00
Rudi Heitbaum
2af8d3b640 Fix const qualifiers from strchr where discarded
This patch fixes several const qualifiers byu adding where required.

    warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

Since glibc-2.43 and ISO C23, the functions bsearch, memchr, strchr,
strpbrk, strrchr, strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr
that return pointers into their input arrays now have definitions as
macros that return a pointer to a const-qualified type when the input
argument is a pointer to a const-qualified type.

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Feb 25 11:04:09 2026
(Merged from https://github.com/openssl/openssl/pull/30136)
2026-02-25 12:03:57 +01:00
slontis
0c537b55b3 FIPS self tests: fix config options when -no-bulk is used
Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Feb 25 11:02:07 2026
(Merged from https://github.com/openssl/openssl/pull/30103)
2026-02-25 12:02:00 +01:00
Richard Levitte
72830bbec3 doc: enumerate and describe known reserved property names
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Feb 25 11:00:15 2026
(Merged from https://github.com/openssl/openssl/pull/30083)
2026-02-25 11:59:56 +01:00
Frederik Wedel-Heinen
3b3804c569 Deprecate ASN1_OBJECT_new().
Fixes #16862

Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Feb 25 10:37:27 2026
(Merged from https://github.com/openssl/openssl/pull/30011)
2026-02-25 11:37:25 +01:00
kovan
7226f3cfce doc: fix algorithm and key type names in EVP_PKEY-SLH-DSA
The DESCRIPTION section had inconsistent naming - some algorithm names
incorrectly had the "EVP_PKEY-" prefix while others did not.

Rewrote the section to clearly separate:
- Algorithm names (e.g., SLH-DSA-SHA2-128s) using hyphens
- Key type identifiers (e.g., EVP_PKEY_SLH_DSA_SHA2_128S) using underscores

This matches the format used in EVP_PKEY-ML-DSA(7) and allows the names
to be used correctly in code.

Fixes #29329

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

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Wed Feb 25 10:26:59 2026
(Merged from https://github.com/openssl/openssl/pull/29788)
2026-02-25 11:26:25 +01:00
Bob Beck
e3a71531b6 Patch the krb5 build for X509_STORE_CTX constification
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Feb 25 10:24:17 2026
(Merged from https://github.com/openssl/openssl/pull/30076)
2026-02-25 11:23:24 +01:00
Bob Beck
e5b563366b Constify X509_STORE_CTX functions invoving X509 *
X509_STORE_CTX *ctx, const X509 *x);
X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, const X509 *x);
int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *trust_store, const X509 *target, STACK_OF(X509) *untrusted);
const X509 *X509_STORE_CTX_get0_cert(const X509_STORE_CTX *ctx);
const X509 *X509_STORE_CTX_get_current_cert(const X509_STORE_CTX *ctx);
const X509 *X509_STORE_CTX_get0_current_issuer(const X509_STORE_CTX *ctx);
void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, const X509 *target);

For #30052

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Feb 25 10:24:15 2026
(Merged from https://github.com/openssl/openssl/pull/30076)
2026-02-25 11:22:57 +01:00
Bob Beck
fdc8414e2a Constify X509_build_chain()
For https://github.com/openssl/openssl/issues/30052

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Feb 25 10:18:49 2026
(Merged from https://github.com/openssl/openssl/pull/30056)
2026-02-25 11:17:50 +01:00
Bob Beck
56f000a224 Patch the pkcs11 provider
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 10:15:08 2026
(Merged from https://github.com/openssl/openssl/pull/29862)
2026-02-25 11:14:55 +01:00
Bob Beck
63dc68f48a Patch rpki-client-portable to handle bit string changes
We also disable warnings for now ro avoid realloc warning

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 10:15:06 2026
(Merged from https://github.com/openssl/openssl/pull/29862)
2026-02-25 11:14:55 +01:00
Bob Beck
151086b4ad Update rpki-client test to use current release instead of an old one
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 10:15:04 2026
(Merged from https://github.com/openssl/openssl/pull/29862)
2026-02-25 11:14:55 +01:00
Bob Beck
5e3d9cf01b krb5 external test: Add patch to use accessors for ASN1_STRING
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 10:15:02 2026
(Merged from https://github.com/openssl/openssl/pull/29862)
2026-02-25 11:14:15 +01:00
Bob Beck
13a431d77b Skip the oqsprovider test temporarily because it is currently broken
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 10:15:00 2026
(Merged from https://github.com/openssl/openssl/pull/29862)
2026-02-25 11:13:16 +01:00
Bob Beck
8bc41a897e Update oqs-provider to current, which support opaque asn1 strings
This then however breaks for other reasons

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 10:14:58 2026
(Merged from https://github.com/openssl/openssl/pull/29862)
2026-02-25 11:13:16 +01:00
Bob Beck
46dbd7faa0 Make ASN1_STRING opaque
This laudable goal, should it land, will be followed
with an issue raised to eat our own dogfood and find
every file with <crypto/asn1.h> added to it in this
commit, and change to the appropriate accessors,
which should be possible in most places we aren't
actually implementing things that change the values

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 10:14:57 2026
(Merged from https://github.com/openssl/openssl/pull/29862)
2026-02-25 11:12:51 +01:00
Bob Beck
96a4910762 Patch krb5 build in external tests
The build is otherwise erroring out with -Werror

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed Feb 25 09:58:37 2026
(Merged from https://github.com/openssl/openssl/pull/29468)
2026-02-25 10:56:17 +01:00
Bob Beck
b0f2107b44 Constify X509_NAME
There are still a few casts away from const where things do not actually
end up mutating the object, we'll deal with that later.

Part of #28654 and #29117
Fixes openssl/project#1781

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed Feb 25 09:58:35 2026
(Merged from https://github.com/openssl/openssl/pull/29468)
2026-02-25 10:56:17 +01:00
Chris Baudouin, Jr.
55b87dd7f4 Removes trailing whitespace from generated pkg-config .pc files
Fixes #29993

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Feb 25 09:53:18 2026
(Merged from https://github.com/openssl/openssl/pull/30087)
2026-02-25 10:53:13 +01:00
Tomas Mraz
3297773b04 OSSL_HPKE_CTX_new.pod: Correct the valid AEAD names for HPKE
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Wed Feb 25 08:15:23 2026
(Merged from https://github.com/openssl/openssl/pull/30152)
2026-02-25 09:15:13 +01:00
Tomas Mraz
67badef7bc ech_test.c: Fix the test with disabled CHACHA20-POLY1305
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Wed Feb 25 08:15:21 2026
(Merged from https://github.com/openssl/openssl/pull/30152)
2026-02-25 09:15:13 +01:00
Frederik Wedel-Heinen
9a46c4c595 Removes fixed version TLS methods.
Fixes #28343

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Feb 24 21:19:39 2026
(Merged from https://github.com/openssl/openssl/pull/30128)
2026-02-24 16:19:35 -05:00
Bob Beck
922a1f1bb2 Constify X509_get_pubkey_parameters
Another internal-use undocumented public api that should be a
candidate for deprecation.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Feb 24 19:33:07 2026
(Merged from https://github.com/openssl/openssl/pull/30127)
2026-02-24 14:32:28 -05:00
Bob Beck
fa9d8afa04 Constify X509_get_signature_info
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Feb 24 19:33:04 2026
(Merged from https://github.com/openssl/openssl/pull/30127)
2026-02-24 14:30:14 -05:00
Bob Beck
3d17e411d7 Constify X509_get0_trust_*
These are undocumented and look to have only one internal use.
They should probably be deprecated with an eye to moving them
internal, but that's for later.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Feb 24 19:33:01 2026
(Merged from https://github.com/openssl/openssl/pull/30127)
2026-02-24 14:30:14 -05:00
Bob Beck
ce77331750 Constify X509_check[host, email, ip, ip_asc]
For #30052
For #30095

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Feb 24 19:32:57 2026
(Merged from https://github.com/openssl/openssl/pull/30127)
2026-02-24 14:30:11 -05:00
Neil Horman
367c54ef11 Constify X509_OBJECT_[get0|set1]_X509 and friends
cascades to constifying X509_get_pubkey() as well

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Feb 24 19:16:50 2026
(Merged from https://github.com/openssl/openssl/pull/30117)
2026-02-24 14:16:43 -05:00
Bob Beck
c8e34c64bc Remove implicit truncation behaviour in ossl_i2c_ASN1_BIT_STRING
and make ASN1_BIT_STRING_set_bit compute the unused bits of the
BIT_STRING.

The implicit trunction behaviour allows you to set a value without
keeping the unused bits consistent, using ASN1_STRING_set, and then
have it magically "fixed" to account for the unused bits in the last
octet on output.

As it turns out, after much searching, nothing is using this behavior,

As we now have the new ASN1_BIT_STRING_set1 to set the entire value
and keep the unused bits correct, we make ASN1_BIT_STRING_set_bit
also do the same. Now that both the setters change the object
correctly we remove the implicit trunctation in ossl_i2x_ASN1_BIT_STRING
and make the provided BIT_STRING argument const.

See discussion in https://github.com/openssl/openssl/issues/29185
and in https://github.com/openssl/openssl/issues/29117

For https://github.com/openssl/openssl/issues/29117

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Feb 24 19:11:26 2026
(Merged from https://github.com/openssl/openssl/pull/29711)
2026-02-24 14:10:42 -05:00
Bob Beck
6ae64a6c4c Patch the kerbeos5 tests
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Feb 24 18:53:27 2026
(Merged from https://github.com/openssl/openssl/pull/29465)
2026-02-24 13:53:17 -05:00
Bob Beck
e75bd84ffc Constify X509_get_ext() and friends..
These all took const, but returned non const, they should return const.

This then triggers constifying of a whole class of get_ext() functions.

Part of #28654 and #29117
Fixes: openssl/project#1779

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Feb 24 18:53:25 2026
(Merged from https://github.com/openssl/openssl/pull/29465)
2026-02-24 13:53:17 -05:00
Bob Beck
1c4a2cc8e7 Constify more X509 arguments and return values
X509_get0_distinguishing_id
X509_keyid_get0
X509_alias_get0
X509_CRL_get0_by_cert
X509_issuer_name_hash
X509_issuer_name_hash_old
X509_subject_name_hash_old

are all const corrected

And PKCS12_add_localkeyid
as a result

X509_getm_notBefore
X509_getm_notAfter=

are const "corrected" by making their argument non-const

Reviewed-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 Feb 24 16:32:45 2026
(Merged from https://github.com/openssl/openssl/pull/30036)
2026-02-24 11:32:35 -05:00
Neil Horman
1dcde44702 Add a ci job to validate our suppression file is up to date nightly
Now that we have a suppression file, lets make sure we keep it up to
date.  Run a nightly job in CI that runs all our tests under valgrind
with our current suppression file, and fail if any new errors are
generated so that we can either address them or add them to the
suppression file

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Feb 24 15:11:19 2026
(Merged from https://github.com/openssl/openssl/pull/30003)
2026-02-24 10:11:11 -05:00
Neil Horman
0ace7b7bcf Fix a legitimate leak in v2i_issuer_sign_tool
Valgrind found a legitimate leak that, somehow asan missed.

v2i_issuer_sign_tool, when creating a new issuer sign tool,
automatically creates the member utf8 asn1 string objects for us.

However, based on configuration, this function will also create its own
utf8 asn1 strings, which overwrite those initial allocations, creating a
leak.

We don't need to create those strings at all in this fuction, just make
sure the ISSUER_SIGN_TOOL_new function did it for us, by checking them
all for NULL

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Feb 24 15:11:16 2026
(Merged from https://github.com/openssl/openssl/pull/30003)
2026-02-24 10:11:11 -05:00
Neil Horman
c6bbba0b28 Add missing valgrind supressions
Running valgrind in CI triggered a few errors that local testing missed,
add those to the suppression file

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Feb 24 15:11:14 2026
(Merged from https://github.com/openssl/openssl/pull/30003)
2026-02-24 10:11:11 -05:00
Bob Beck
ccc6935c18 Correct man page args to be consistant
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:05:25 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
3922b1f5b0 Correct synopsis for SSL_set1_ipaddr
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:05:22 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
15b11a1108 Revert "Update doc/man3/SSL_set1_host.pod"
This reverts commit 8101ce1e36.

This bikeshed also broke the docs

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:05:20 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
518b6ab081 Fix being hoist on my own petard by my kind Irish friend.
(Use the now non-deprecated function)

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:05:18 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
f25ebc9814 Correct rename of variable that went one bikeshed too far
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:05:15 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
4676ea7616 Update CHANGES.md
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:05:13 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
308bac4e4a Update CHANGES.md
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:05:10 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
ca13f11b6d Update CHANGES.md
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:05:08 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
5e31efdce7 Update CHANGES.md
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:05:05 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
5bcbf65d1c Update doc/man3/X509_VERIFY_PARAM_set_flags.pod
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:05:03 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
8edf240b36 Update doc/man3/X509_VERIFY_PARAM_set_flags.pod
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:05:01 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
2839ed39b7 Update ssl/ssl_lib.c
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:58 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
29a9e79dc7 Update doc/man3/X509_VERIFY_PARAM_set_flags.pod
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:55 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
e593c39923 Update doc/man3/X509_VERIFY_PARAM_set_flags.pod
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:53 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
b5dbe1054c Update doc/man3/SSL_set1_host.pod
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:50 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
cb1645e83b Add a changes entry
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:47 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
4553c792c3 Fix misplaced check spotted by vitkor
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:45 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
c2ac33593b Fix up bug found by nhorman on review. Thanks!
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:42 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
ce4faf05e0 Update doc/man3/SSL_set1_host.pod
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:40 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
89bb36f06f Update doc/man3/SSL_set1_host.pod
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:37 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
27c995fe4b Update crypto/x509/x509_vpm.c
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:35 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
22b02d9478 Update doc/man3/SSL_set1_host.pod
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:32 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
2bfe3208f7 Update crypto/x509/x509_vpm.c
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:30 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
74fdd739c7 Update doc/man3/SSL_set1_host.pod
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:28 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
cde3c0b5e4 Update doc/man3/SSL_set1_host.pod
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:25 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
b1bce1a228 Update doc/man3/SSL_set1_host.pod
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:22 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
a16da68872 Add a test for using a leading . for verification of a domain name
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:20 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
84a6c9bd28 Allow for a leading . for wildcard like matches
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:17 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
8b09d0b5c8 Ensure we use the correct '@' in an email and raise an error when we fail
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:15 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
87337dde3c Address Viktor's review around label checks
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:12 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
166caf6a83 Mention ASCII vs Non ASCII localparts
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:10 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
99429c8452 derp
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:07 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
de14306d8a Update doc/man3/SSL_set1_host.pod
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:04 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
7352f44d73 Update doc/man3/X509_VERIFY_PARAM_set_flags.pod
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:02 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
52f00ebe74 Update doc/man3/SSL_set1_host.pod
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:04:00 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
401e9f23cc Update doc/man3/SSL_set1_host.pod
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:03:57 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
54c4a4b69f Update doc/man3/X509_VERIFY_PARAM_set_flags.pod
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:03:54 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
6b4f80338c Update doc/man3/X509_VERIFY_PARAM_set_flags.pod
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:03:52 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
a26131ee9c Update doc/man3/X509_VERIFY_PARAM_set_flags.pod
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:03:49 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
be38e5611d Update crypto/x509/v3_utl.c
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:03:47 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
0b43f11e0e Update crypto/x509/v3_utl.c
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:03:44 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Bob Beck
f584ae959c Let's support multiple names for certificate verification
This adds the functionality to VERIFY_PARAM to separately add multiple
ip's and email addresses for verification purposes.

We then mark the unfortunate SSL_add1_host API which unfortunately
aquired a confusing "maybe add an IP address" behaviour as deprecated.

We replace this with SSL_set1_<dnsname, email, ip, ip_asc> and
SSL_add1_<dnsname, email, ip, ip_asc> to set the things in the SSL
corresponding to the VERIFY_PARAM funcitons.

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Tue Feb 24 14:03:42 2026
(Merged from https://github.com/openssl/openssl/pull/29612)
2026-02-24 09:03:39 -05:00
Neil Horman
dbc2e10272 Ensure we don't leak heap in ossl_rcu_lock_free
BSD, when initializing a pthread_cond_t or pthread_mutex_t may allocate
additional heap.  If we don't call pthread_[cond|mutex]_destroy on them,
those allocations leak.

clean that up here.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Feb 24 12:52:59 2026
(Merged from https://github.com/openssl/openssl/pull/30094)
2026-02-24 07:52:55 -05:00
Neil Horman
0da29907e7 Constify X509_find_by_subject
Transitively, this also requires the constification of OCSP_resp_get0_signer

Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Feb 24 12:45:57 2026
(Merged from https://github.com/openssl/openssl/pull/30096)
2026-02-24 07:45:48 -05:00
Alexander Komarov
43fc670831 Added Nvidia/Olympus CPU dispatch to enable optimal SHA3/EOR3 on Vera CPU
CLA: Trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/30129)
2026-02-24 13:42:42 +01:00
Pauli
4f735758bd Update documentation with guidelines for commit and PR messages
The CONTRIBUTING.md and PULL_REQUEST_TEMPLATE.md files have been updated
to include guidelines on what makes a desirable commit message and
PR description.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/30075)
2026-02-24 11:07:49 +11:00
Bob Beck
946b4ca7fb Constify X509_STORE_add_cert()
For #30050

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon Feb 23 22:45:42 2026
(Merged from https://github.com/openssl/openssl/pull/30074)
2026-02-23 17:45:35 -05:00
Bob Beck
34340878d0 Constify various functions that were non const due to extension cache
for https://github.com/openssl/openssl/issues/30052

This is a blatent cheat. While I can get pretty close to getting
around cheating by cacheing extensions as X509 objects are created it's
too fragile at the moment. In a future with a better not-copying all
the things X509, we would endeavour to not need this.

In the meantime, in the interest of getting the public API ready to
do that, we instead make a blatent cheat in the internal function of

int ossl_x509v3_cache_extensions(const X509 *x);

Which in a future world we can work to make go away.

And then the public API all changes to const.

long X509_get_pathlen(const X509 *x);
int X509_check_ca(const X509 *x);
int X509_check_purpose(const X509 *x, int id, int ca);
long X509_get_proxy_pathlen(const X509 *x);
uint32_t X509_get_extension_flags(const X509 *x);
uint32_t X509_get_key_usage(const X509 *x);
uint32_t X509_get_extended_key_usage(const X509 *x);
onst ASN1_OCTET_STRING *X509_get0_subject_key_id(const X509 *x);
const ASN1_OCTET_STRING *X509_get0_authority_key_id(const X509 *x);
const GENERAL_NAMES *X509_get0_authority_issuer(const X509 *x);
const ASN1_INTEGER *X509_get0_authority_serial(const X509 *x);

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Mon Feb 23 16:34:29 2026
(Merged from https://github.com/openssl/openssl/pull/30055)
2026-02-23 11:34:16 -05:00
Richard Levitte
3954813cb5 Fix the uses of X509_check_certificate_times
The "error" parameter to 'X509_check_certificate_times' gets an X509 error
value, which isn't a OpenSSL ERR reason code.  Unfortunately, this was
conflated.

This restores the behaviour in the places of conflation to something
similar enough to what was done before 'X509_check_certificate_times'
was implemented.

Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Mon Feb 23 15:43:21 2026
(Merged from https://github.com/openssl/openssl/pull/30088)
2026-02-23 10:43:13 -05:00
Denis Pronin
c8c8fcc9fc preserve data constness when getting issuer name's and subject's hash
CLA:trivial

Signed-off-by: Denis Pronin <dannftk@yandex.ru>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Mon Feb 23 13:13:33 2026
(Merged from https://github.com/openssl/openssl/pull/25991)
2026-02-23 08:13:26 -05:00
Igor Ustinov
9c32abf541 Added BIO_set_send_flags() function to set flags passed to send(), sendto(), and sendmsg().
The main intention is to allow setting the MSG_NOSIGNAL flag to avoid
a crash on receiving the SIGPIPE signal.

Fixes #16399

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/30044)
2026-02-23 09:00:26 +01:00
Dr. David von Oheimb
5cbf8ce894 OSSL_CRMF_MSG_centralkeygen_requested(): change confusing paramter name 'p10cr' to 'p10'
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29073)
2026-02-23 08:04:24 +01:00
Dr. David von Oheimb
eed2a1f276 cmp_ctx.c OSSL_CMP_CTX_new(): update and/or comment the default PBM parameters chosen
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29073)
2026-02-23 08:04:24 +01:00
Bob Beck
3be1254911 Correct the instructions for how to run the krb5 external test.
What is there is a trap. I fell into it. I was sad.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sun Feb 22 21:47:54 2026
(Merged from https://github.com/openssl/openssl/pull/30122)
2026-02-22 16:47:49 -05:00
Angel Yankov
1f8b10bf67 Constify X509_CRL_get0_by_cert
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sun Feb 22 17:57:56 2026
(Merged from https://github.com/openssl/openssl/pull/30079)
2026-02-22 12:57:49 -05:00
Neil Horman
104ec0dae0 Constify X509_CRL_get0_by_cert
Update the X509 parameter to be const

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Sun Feb 22 17:55:12 2026
(Merged from https://github.com/openssl/openssl/pull/30090)
2026-02-22 12:55:06 -05:00
Bob Beck
76f8005e34 Return the correct error message in ossl_X509_print_ex_brief
X509_verify_cert_times returns a verify error code,
so X509_verify_cert_error_string() must be used to
convert it to text.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
MergeDate: Sun Feb 22 17:52:13 2026
(Merged from https://github.com/openssl/openssl/pull/30097)
2026-02-22 12:52:06 -05:00
Bob Beck
78758540fc Add a changes entry for the x509 time function changes
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sun Feb 22 17:49:25 2026
(Merged from https://github.com/openssl/openssl/pull/30098)
2026-02-22 12:49:10 -05:00
Neil Horman
13ee7ea997 Fix broken strict-warnings build in sskdf and x963kdf
when configuring with:

./Configure no-sskdf --strict-warnings

The build breaks as sskdf_new is defined but not used (as the same sskdf
file is used to implement x963kdf with a different new dispatch
function).  i.e. we will build the file when sskdf is disabled but
x963kdf is enabled, omitting any use of sskdf_new

Easy fix, just gate the inclusion of sskdf_new on #ifndef
OPENSSL_NO_SSKDF.

Do the same for X963KDF, which has the same problem (thank you for
pointing that out @t8m)

Fixes #30105

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Sun Feb 22 17:46:00 2026
(Merged from https://github.com/openssl/openssl/pull/30106)
2026-02-22 12:45:57 -05:00
Bob Beck
b132345927 Constify X509_chain_check_suiteb
For https://github.com/openssl/openssl/issues/30052

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sun Feb 22 17:37:38 2026
(Merged from https://github.com/openssl/openssl/pull/30058)
2026-02-22 12:37:31 -05:00
Dr. David von Oheimb
1c34275e61 X509V3_set_nconf(): Improve error handling using this function, mostly in apps/
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16998)
2026-02-21 14:59:44 +01:00
Dr. David von Oheimb
c7f2651a64 X509V3_set_ctx(): Improve error handling using this function, mostly in apps/
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16998)
2026-02-21 14:59:44 +01:00
Viktor Dukhovni
db28160ce9 CHANGE log additions
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
MergeDate: Sat Feb 21 13:26:53 2026
(Merged from https://github.com/openssl/openssl/pull/29953)
2026-02-22 00:24:47 +11:00
Viktor Dukhovni
5cefb82fc7 Refactor openssl-speed(1)
- Adding support for "curveSM2" ECDH
- Integrating EdDSA and SM2 signature support into existing ECDSA code.

This removes ~500 lines of duplicated code.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
MergeDate: Sat Feb 21 13:26:44 2026
(Merged from https://github.com/openssl/openssl/pull/29953)
2026-02-22 00:24:21 +11:00
Viktor Dukhovni
5093d72a7d New SSL tests for SM2 cert and key exchange
Also some additional tests for other MLKEM hybrids.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
MergeDate: Sat Feb 21 13:26:36 2026
(Merged from https://github.com/openssl/openssl/pull/29953)
2026-02-22 00:24:21 +11:00
Milan Broz
1079919338 Add curveSM2 and curveSM2MLKEM768 TLS test.
This extends sslapi test for SM2-based key exchange.

Also add comments for #endif to clearly mark disabled code blocks.

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

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Sat Feb 21 13:26:27 2026
(Merged from https://github.com/openssl/openssl/pull/29953)
2026-02-22 00:24:21 +11:00
Viktor Dukhovni
913e1d4bcd Document ECDH over SM2 key exchange.
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
MergeDate: Sat Feb 21 13:26:15 2026
(Merged from https://github.com/openssl/openssl/pull/29953)
2026-02-22 00:24:21 +11:00
Viktor Dukhovni
a1689251bb Support for RFC8998 curveSM2 + hybrid
This adds support for the "sm2sig_sm3" TLS 1.3 signature algorithm, the
"curveSM2" key exchange group (ECDH over SM2) and the associated
post-quantum/traditional (PQ/T) hybrid "curveSM2MLKEM768" key exchange.

The default key agreement group list is expanded to add two additional
PQ groups, immediately after X25519MLKEM768.  These are the P-256-based
SecP256r1MLKEM768 and the SM2-based curveSMMLKEM768.  Neither of the new
groups is a default client keyshare group, these would only come into
play after a server HRR, if for some reason X25519MLKEM768 is not
supported by the server, X25519 is not then the server's most
preferred group, and the server supports and prefers one of these
of X25519.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
MergeDate: Sat Feb 21 13:26:07 2026
(Merged from https://github.com/openssl/openssl/pull/29953)
2026-02-22 00:24:20 +11:00
Viktor Dukhovni
76844082bd Use algorithm name macros instead of literals
In the default and FIPS provider dispatch tables use corresponding
macros instead of string literals.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
MergeDate: Sat Feb 21 13:25:57 2026
(Merged from https://github.com/openssl/openssl/pull/29953)
2026-02-22 00:24:20 +11:00
Viktor Dukhovni
9cd631544b Pass tls-version to cert sign/verify algorithms
Most signature algorithms will ignore this parameter, but for SM2 this
makes it possible to set the RFC8998 distinguished identifier.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
MergeDate: Sat Feb 21 13:25:47 2026
(Merged from https://github.com/openssl/openssl/pull/29953)
2026-02-22 00:24:20 +11:00
Viktor Dukhovni
1409546f57 New SM2 "tls-version" signature parameter
When the version is TLS 1.3, this sets the SM2 distinguished identifier to
the RFC8998 specified value: "TLSv1.3+GM+Cipher+Suite".

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
MergeDate: Sat Feb 21 13:25:39 2026
(Merged from https://github.com/openssl/openssl/pull/29953)
2026-02-22 00:24:20 +11:00
Viktor Dukhovni
522ee714fd Implement default SM2 distinguished identifier
This is needed for certificate verification to work correctly.
Removed unnecessary explicit instances of the distid in most tests, and
documentation.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
MergeDate: Sat Feb 21 13:25:30 2026
(Merged from https://github.com/openssl/openssl/pull/29953)
2026-02-22 00:24:20 +11:00
Viktor Dukhovni
917d286c40 SM2 digest sign/verify context initialisation fix
SM digest sign/verify context initialisation needs to set the
"compute_z_digest" flag earlier, before calling sm2sig_signature_init(),
to process the provided parameters, because otherwise attempts to set
the "distinguished identifier" will erroneously fail.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
MergeDate: Sat Feb 21 13:25:19 2026
(Merged from https://github.com/openssl/openssl/pull/29953)
2026-02-22 00:24:20 +11:00
Viktor Dukhovni
946391aa5a New decoder generator returns matched field count
It can be useful to know how many parameters matched a decoded field,
(or at least whether that number is non-zero).

Tne new `produce_param_decoder_with_count` generator produces code that
updates a count output variable.

In particular, an RSA parameter handler did not handle requests for only
unexpected parameter as gracefully as one might want.  It can now
return early when none of the provided parameters are relevant.

[ The number reported is a count of matching parameter values, not a
  count of the resulting decoded fields, so if a parameter key occurs
  more than once, the count can be larger than the number of fields
  actually set. ]

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
MergeDate: Sat Feb 21 13:25:11 2026
(Merged from https://github.com/openssl/openssl/pull/29953)
2026-02-22 00:24:20 +11:00
Neil Horman
79c0985255 Constify X509_print_fp and X509_print_ex_fp
Make the X509 argument to both functions const, as we don't modify the
object at all in these functions.

Again, these functions, while public, appear undocumented, and so I'm
omitting any HISTORY notes

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Fri Feb 20 21:26:47 2026
(Merged from https://github.com/openssl/openssl/pull/30073)
2026-02-20 16:25:26 -05:00
Milan Broz
06cff36e64 Constify X509_REQ_get1_email, X509_get1_email and X509_get1_ocsp.
Functions seem not documented, but exported.

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

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Feb 20 17:07:41 2026
(Merged from https://github.com/openssl/openssl/pull/30082)
2026-02-20 12:07:34 -05:00
Dmitry Belyavskiy
2a21345036 Removing some more EVP_get_smtbysmth calls
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Simo Sorce <simo@redhat.com>
(Merged from https://github.com/openssl/openssl/pull/30026)
2026-02-20 18:05:14 +01:00
sftcd
6fb07d7062 require manual build for external ECH tests
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Fri Feb 20 14:16:40 2026
(Merged from https://github.com/openssl/openssl/pull/30059)
2026-02-20 16:40:25 +00:00
Tomas Mraz
22c0515669 ECH: Remove whitespace at EOL or EOF
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Fri Feb 20 10:11:21 2026
(Merged from https://github.com/openssl/openssl/pull/30066)
2026-02-20 16:40:25 +00:00
Tomas Mraz
dba0ecd3bf ECH: Use BIO_puts when appropriate
And also a few additional code cleanups.

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Fri Feb 20 10:11:20 2026
(Merged from https://github.com/openssl/openssl/pull/30066)
2026-02-20 16:40:25 +00:00
sftcd
2230c67f94 ECH: change from I-D to RFC 9849 and resolve TODO(ECH) cases
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Feb 19 09:22:37 2026
(Merged from https://github.com/openssl/openssl/pull/30048)
2026-02-20 16:40:25 +00:00
sftcd
b320fa34e4 ECH: avoid pointer aliasing in tls_construct_ctos_psk()
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Feb 19 09:20:46 2026
(Merged from https://github.com/openssl/openssl/pull/30051)
2026-02-20 16:40:25 +00:00
sftcd
0e8559b78a ech_check_format(): Fix potential out of bounds read
strspn() is called on likely non-NUL-terminated BIO buffer.
Copy it and add NUL-termination before calling the function.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Feb 19 09:17:54 2026
(Merged from https://github.com/openssl/openssl/pull/30050)
2026-02-20 16:40:25 +00:00
sftcd
5e5a76fc2c Add tests and documentation and fix a couple of issues identified by added tests
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Mon Feb 16 15:41:15 2026
(Merged from https://github.com/openssl/openssl/pull/29200)
2026-02-20 16:40:25 +00:00
sftcd
0bdae603e8 ossl_ech_get_retry_configs(): Check for integer overflow
Fixes DEF-02-010

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Wed Feb 11 17:19:16 2026
(Merged from https://github.com/openssl/openssl/pull/29593)
2026-02-20 16:40:25 +00:00
sftcd
706e5f4a48 tls_process_server_hello(): With retry config validate the outer hostname
Call SSL_set1_host() to apply the outer hostname to the certificate
validation.

Fixes DEF-02-009

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Wed Feb 11 17:19:14 2026
(Merged from https://github.com/openssl/openssl/pull/29593)
2026-02-20 16:40:25 +00:00
sftcd
f45c7fe0dd ech_test.c: Add test for trying ECH with TLSv1.2
Fixes DEF-02-006

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Wed Feb 11 17:19:13 2026
(Merged from https://github.com/openssl/openssl/pull/29593)
2026-02-20 16:40:25 +00:00
sftcd
acda536f5e ssl_choose_server_version(): With ECH check if connection is TLSv1.3
Fixes DEF-02-005

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Wed Feb 11 17:19:11 2026
(Merged from https://github.com/openssl/openssl/pull/29593)
2026-02-20 16:40:25 +00:00
sftcd
c7e7b78917 Document that SSL_OP_ECH_TRIALDECRYPT can cause DoS in some circumstances
Fixes DEF-02-002

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Wed Feb 11 17:19:10 2026
(Merged from https://github.com/openssl/openssl/pull/29593)
2026-02-20 16:40:25 +00:00
sftcd
5308da8059 ech_read_priv_echconfiglist(): Pass encodedlen to BIO_new_mem_buf()
Fixes DEF-02-001

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Wed Feb 11 17:19:08 2026
(Merged from https://github.com/openssl/openssl/pull/29593)
2026-02-20 16:40:25 +00:00
Tomas Mraz
df8f3cc534 ECH: Properly apply libctx and propq from SSL_CTX
And further minor refactoring.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Thu Jan  8 09:59:56 2026
(Merged from https://github.com/openssl/openssl/pull/29439)
2026-02-20 16:40:25 +00:00
sftcd
a2e5848d9d s_client and s_server options for ECH
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28270)
2026-02-20 16:40:25 +00:00
sftcd
a732ff7aa2 Fix a client-auth bug introduced by ECH code
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28555)
2026-02-20 16:40:25 +00:00
Tomas Mraz
676b8d84d9 ech_store.c: Fix casts and avoid leaks on error return
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28611)
2026-02-20 16:40:25 +00:00
Tomas Mraz
5003be692c ech_ssl_apis.c: Check some invalid argument passing
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28611)
2026-02-20 16:40:25 +00:00
Tomas Mraz
19a1ff18e4 Fix warnings about casts in ECH code
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28611)
2026-02-20 16:40:25 +00:00
sftcd
6c3edd4f3a Add server-side handling of Encrypted Client Hello
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27561)
2026-02-20 16:40:25 +00:00
Matt Caswell
2dd92b4bbf Add a test for the new PACKET_msg_start() function
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27776)
2026-02-20 16:40:25 +00:00
Matt Caswell
d63a368183 Introduce the PACKET_msg_start() function
This gives us the start of the buffer in use for the PACKET.

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

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27776)
2026-02-20 16:40:25 +00:00
sftcd
4e8a850294 ECH client support for sending multiple key shares
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27540)
2026-02-20 16:40:25 +00:00
sftcd
5170ccab6c ECH client side transcript refactor
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26011)
2026-02-20 16:40:25 +00:00
sftcd
ade10c5dbf ECH client side
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26011)
2026-02-20 16:40:25 +00:00
sftcd
7debe0ddef ECH external APIs
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25663)
2026-02-20 16:40:25 +00:00
sftcd
4af71a7738 ECH CLI implementation
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25420)
2026-02-20 16:40:25 +00:00
Stephen Farrell
80efca5392 ECH build artefacts and a bit of code
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25193)
2026-02-20 16:40:25 +00:00
Stephen Farrell
50580382ca Documents initial agreed APIs for Encrypted Client Hello (ECH)
and includes a minimal demo for some of those APIs.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24738)
2026-02-20 16:40:24 +00:00
Stephen Farrell
bb1783de94 add ech-api.md
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24738)
2026-02-20 16:40:24 +00:00
Frederik Wedel-Heinen
d2ed55548d Const correct time parameter for X509_cmp_time(), X509_time_adj() and X509_time_adj_ex().
Fixes #21371

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Feb 20 16:36:52 2026
(Merged from https://github.com/openssl/openssl/pull/30020)
2026-02-20 11:36:37 -05:00
Neil Horman
37436ba697 Constify X509_to_X509_REQ and X509_REQ_to_X509
Modify both functions to accept and return a const X509, respectively.

Again, neither of these functions appear documented, so omitting the
HISTORY updates here, though we should look into why they are missing
docs.

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Fri Feb 20 16:27:15 2026
(Merged from https://github.com/openssl/openssl/pull/30072)
2026-02-20 11:27:13 -05:00
Daniel Kubec
9c1d0e772d CRL: reject malformed CRL Number and CRL Delta Indicator
Previously, a malformed ASN.1 INTEGER in the CRL Number or Delta CRL Indicator
extension would cause a parse error but the CRL would not be explicitly
rejected. Existing code discards the error and continues, accepting a CRL it
cannot fully parse, unlike other libraries and implementations that reject the
CRL outright.

Malformed encoding suggests a corrupt or tampered CRL, data that cannot be
parsed cannot be trusted. Reject the CRL outright if either extension cannot be
decoded, regardless of whether the extension is marked critical. This prevents
silent soft-fail behavior where revoked certificates could pass validation
unchecked.

Fixes #27374

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Feb 20 16:24:44 2026
(Merged from https://github.com/openssl/openssl/pull/30024)
2026-02-20 11:24:35 -05:00
Milan Broz
4d9d413635 Constify X509_issuer_and_serial_hash
Signed-off-by: Milan Broz <gmazyland@gmail.com>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Fri Feb 20 16:22:12 2026
(Merged from https://github.com/openssl/openssl/pull/30084)
2026-02-20 11:22:06 -05:00
Neil Horman
8ace465709 Consity X509_add_cert and X509_self_signed
As part of the effort to not allow mutable X509 objects where they
aren't needed, constify the cert parameter for these two functions

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Fri Feb 20 13:33:04 2026
(Merged from https://github.com/openssl/openssl/pull/30054)
2026-02-20 08:32:56 -05:00
Milan Broz
d70df6cd88 Constify X509v3_asid_validate_resource_set and X509v3_addr_validate_resource_set
These functions are exported, but undocumented.

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

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Fri Feb 20 13:06:58 2026
(Merged from https://github.com/openssl/openssl/pull/30080)
2026-02-20 08:06:50 -05:00
Neil Horman
513fc30d85 constify X509_check_trust, X509_TRUST_add
Turn the X509 parameters to X509_check_trust and X509_TRUST_add into
consts.

Interesting side notes: X509_TRUST_add and some others that we're
modified as a result of this pr, are listed as public functions, but
have no documentation for them, and make doc-nits doesn't complain about
it.  Unsure as to why, but we should probably look at that eventually

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Fri Feb 20 13:04:04 2026
(Merged from https://github.com/openssl/openssl/pull/30071)
2026-02-20 08:03:53 -05:00
Dimitri John Ledkov
776a460454 Revert "fips-jitter: Force use jitter entropy in the FIPS 3.0.9 provider callback"
This reverts commit aa5f1b4cf5.

Whilst this is still useful with pre-3.2 providers, it is actually unlikely to be deployed. And there are now openssl fips providers getting validated with statically linked jitterentropy source already.

See background info at:
- https://github.com/openssl/openssl/pull/25930

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

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Fri Feb 20 11:15:25 2026
(Merged from https://github.com/openssl/openssl/pull/29641)
2026-02-20 12:15:16 +01:00
Milan Broz
f5408861fa Add CHANGES.md entry for SM-based cipher suites.
Signed-off-by: Milan Broz <gmazyland@gmail.com>

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu Feb 19 15:11:25 2026
(Merged from https://github.com/openssl/openssl/pull/30028)
2026-02-19 10:11:05 -05:00
Milan Broz
c1b79d33fc Add tests for TLS1.3 TLS_SM4_GCM_SM3 and TLS_SM4_CCM_SM3
Signed-off-by: Milan Broz <gmazyland@gmail.com>

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu Feb 19 15:11:20 2026
(Merged from https://github.com/openssl/openssl/pull/30028)
2026-02-19 10:11:05 -05:00
Milan Broz
f4cfdbd85c Add TLS1.3 ciphersuites from RFC8998
This adds TLS_SM4_GCM_SM3 and TLS_SM4_CCM_SM3
as defined in RFC 8998.

Fixes openssl/project#1871

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

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu Feb 19 15:11:15 2026
(Merged from https://github.com/openssl/openssl/pull/30028)
2026-02-19 10:11:05 -05:00
Neil Horman
702f1a7f83 Constify NAME_CONSTRAINTS_check and NAME_CONSTRAINTS_check_CN
As part of our effort to not allow mutable x509 objects where they
aren't needed, constify the parameters to these two functions

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Feb 19 13:08:11 2026
(Merged from https://github.com/openssl/openssl/pull/30053)
2026-02-19 08:08:04 -05:00
Josh Auler
a825afc19a Added NULL Pointer check to the print_keyspec function
The function print_keyspec in apps/cmp.c previously dereferenced the 'alg' pointer
without checking if it was NULL:

    if (paramtype == V_ASN1_UNDEF || alg->parameter == NULL) {

In certain situations, the 'alg' pointer could be NULL, which may result in a null
pointer dereference.

This commit adds an explicit null check for 'alg' before dereferencing 'alg->parameter'
to ensure safe handling:

    if (alg == NULL) {
        BIO_puts(mem, "Key algorithm: <absent>\n");
        break;
    }

This prevents potential crashes when print_keyspec is called with a NULL algorithm
pointer, improving the robustness of the CMP application.

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Thu Feb 19 12:56:01 2026
(Merged from https://github.com/openssl/openssl/pull/30046)
2026-02-19 13:55:30 +01:00
Norbert Pocs
12c2442303 Fix coverity issue 1681421
Check the return value of ASN1_parse_dump

Fixes: 6b167313f4 "Attribute certificate printing functions"

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

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Feb 19 12:21:38 2026
(Merged from https://github.com/openssl/openssl/pull/30065)
2026-02-19 13:21:17 +01:00
Michael Baentsch
e21c61b204 SSL_CONF_cmd.pod: Add PQC algs to recommended TLS 1.3 groups
Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>

Reviewed-by: Alicja Kario <hkario@redhat.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Feb 19 10:14:06 2026
(Merged from https://github.com/openssl/openssl/pull/28076)
2026-02-19 11:13:30 +01:00
Bob Beck
f0ec2581c4 Remove the "msie-hack" option from openssl ca
This has been documented as a deprecated option for
a long time, as we are not even certain this does what
was originally intended anymore, as it has no tests and
it's time of usefulness has long since past.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Feb 19 10:09:33 2026
(Merged from https://github.com/openssl/openssl/pull/30033)
2026-02-19 11:09:31 +01:00
Neil Horman
619a0fe718 Fix unit tests when run under fuzz builds
PR https://github.com/openssl/openssl/pull/30045

Fixed an oss-fuzz failure that occured because we feed random data into
the pkcs12 kdf, which sometimes results in a huge iteration count, that
leads to timeouts in oss-fuzz.

The fix was to simply limit the number of iterations that we go through
during derivation.  This breaks the kdf of course, but it doesn't really
matter during fuzzing, because we don't expect random input data to
produce reasonable results, so no harm, no foul.

except.

We also, in our CI, build our fuzzer tests and run them through our
regular CI unit tests, during which we both provide valid data, and
expect valid results, and pr 30045 breaks that expectation.

The conventional wisdom is to simply skip unit tests that break under
these sorts of conditions (we do this for things like
70-test_quic_record.t already).

however, the tests that broke here are 25_test_x509, 30_test_evp,
80_test_pkcs12, and 90_test_store_cases.  It seems like we would want to
keep testing those unless we absolutely have to skip them.

So instead, lets indicate that we are running the unit tests with an
environment variable, and check that variable when we have an
UNSAFE_FOR_PRODUCTION build, skiping the iteration clamp in pkcs12kdf if
it is.  This allows us to continue running these unit tests, while still
getting the oss-fuzz runs to pass.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Feb 19 08:49:56 2026
(Merged from https://github.com/openssl/openssl/pull/30070)
2026-02-19 09:49:54 +01:00
Simo Sorce
9102fb8fa5 Annotate benign race in FIPS deferred self test
Move TSAN definitions to threads_common.h to make them available
globally and introduce the ANNOTATE_BENIGN_RACE macro.

Apply this annotation to the state check in ossl_deferred_self_test()
to suppress a benign race warning from ThreadSanitizer, as the race
is intentional and accepted to avoid cpu contention.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/30009)
2026-02-19 15:47:35 +11:00
Simo Sorce
91bdbe1983 Relax unnecessary atomic reads in FIPS provider
Replace calls to ossl_get_self_test_state() with direct access to
st_all_tests[].state in the FIPS self-test code.

Atomic reads are unnecessary in functions like FIPS_kat_deferred()
and SELF_TEST_kats_execute() because they are executed with the
relevant lock already held.

For ossl_deferred_self_test(), removing the atomic read avoids
contention. The common case is that tests are already passed. If a
race occurs, the function safely falls back to the locked path in
FIPS_kat_deferred() which re-verifies the state.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/30009)
2026-02-19 15:47:35 +11:00
Simo Sorce
cc7195da30 Make FIPS self test state access atomic
Direct access to the FIPS self-test state array caused race conditions in
multi-threaded environments when checking or updating test status.

Introduce atomic accessor functions `ossl_get_self_test_state` and
`ossl_set_self_test_state`, backed by a global lock, to ensure thread-safe
state transitions. Replace all direct structure accesses with these new
functions.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/30009)
2026-02-19 15:47:35 +11:00
Simo Sorce
9a15137096 Fix race in FIPS on-demand self test
The on-demand self-tests could race with deferred tests executing
concurrently in another thread.

Pass the FIPS global state to SELF_TEST_post() to allow locking
around the critical section where module integrity is checked and
test states are modified. This ensures thread safety when resetting
and executing tests.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/30009)
2026-02-19 15:47:35 +11:00
Gleb Smirnoff
e003d87f8a SSL_sendfile: make it more like bio/bss_sock.c:sock_write()
First, use BIO_sock_should_retry().

Second, clear BIO retry flags.  Otherwise after an SSL_sendfile that
failed, no matter how many succeded after, the flags would still be up.

Fixes: #29742

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Feb 18 23:31:24 2026
(Merged from https://github.com/openssl/openssl/pull/29744)
2026-02-18 18:31:05 -05:00
Gleb Smirnoff
ed7fd18cb7 sockets: list EBUSY as a retryable socket error code.
This is a documented error code for sendfile(2) in FreeBSD.  Being on a
conservative side embrace into ifdef for now.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Feb 18 23:31:21 2026
(Merged from https://github.com/openssl/openssl/pull/29744)
2026-02-18 18:31:05 -05:00
Gleb Smirnoff
63325050ba SSL_sendfile: let ktls_sendfile() pass more data up to SSL_sendfile()
Before this change ktls_sendfile() is basically 1:1 wrapper around Linux
sendfile(2).  FreeBSD sendfile(2) API is richer than Linux, and reducing
it down to Linux API loses meaningful data.  Instead, make ktls_sendfile()
more like FreeBSD sendfile(2) and adopt Linux version to that.

With this change we will be raising BIO_should_retry() flag after a short
write due to lack of buffer space in a non-blocking socket on FreeBSD.
That will allow an application to tell a short write due to lack of buffer
space from a short write due to end of file.  Before this change, the only
way to tell between these two kinds of short writes was to immediately
retry the operation.

This change allows to cut nearly in half the number of sendfile(2)
syscalls when sending a large file over a non-blocking socket on FreeBSD.

Fixes: #29742

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Feb 18 23:31:18 2026
(Merged from https://github.com/openssl/openssl/pull/29744)
2026-02-18 18:31:05 -05:00
Daniel Kubec
c1a3d080ad X509: apply AKID verification checks when X509_V_FLAG_X509_STRICT is set
- Raise X509_V_ERR_MISSING_AUTHORITY_KEY_IDENTIFIER when AKID is not present.
- Raise X509_V_ERR_EMPTY_AUTHORITY_KEY_IDENTIFIER when AKID has no attributes.
- Raise X509_V_ERR_AKID_ISSUER_SERIAL_NOT_PAIRED when authorityCertIssuer
  and authorityCertSerialNumber fields are not paired.

RFC 5280 section 4.2.1.1: The authorityCertIssuer and authorityCertSerialNumber
fields are paired and MUST either both be present or both be absent.

- Issuer without serial is ambiguous, and serial without issuer is meaningless,
  leading to unresolvable and misleading issuer identification.

Fixes #27114
Fixes #27360
Fixes #20027

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 18 18:17:03 2026
(Merged from https://github.com/openssl/openssl/pull/29971)
2026-02-18 19:16:11 +01:00
Neil Horman
02a6545ded limit number of iterations for fuzzer in pkcs12kdf
OSS-FUZZ tripped over a timeout:
https://issues.oss-fuzz.com/issues/477959320

It occurs because the pkcs12 data the fuzzer feeds into the mac
verification routine requests a large number of iterations (I think gdb
read it as 15346721 or some such), which causes very long processing
times while verifying the mac.  This is something of an artificial
problem unique to the fuzzer, as the fuzzer contains a 60 second timeout
on any single test iteration.

Fix it by limiting the iteration count to 100 only when running the
fuzzer tests.

Fixes openssl/srt#89

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Feb 18 18:07:05 2026
(Merged from https://github.com/openssl/openssl/pull/30045)
2026-02-18 13:06:55 -05:00
Igor Ustinov
cac8bcef45 Bugfix of bn_sqr_mont procedure on SPARC sun4v
The fix for sparcv9-mont.pl came from Andy Polyakov (@dot-asm)

Fixes #15587

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Feb 18 18:02:33 2026
(Merged from https://github.com/openssl/openssl/pull/29948)
2026-02-18 13:02:24 -05:00
Nikola Pajkovsky
8226861d13 srtpkdf: check libctx null before use
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Wed Feb 18 16:34:05 2026
(Merged from https://github.com/openssl/openssl/pull/30040)
2026-02-18 11:33:54 -05:00
Nikola Pajkovsky
6f13c02b7f srtpkdf: cipher is written twice with the same value
Resolves: https://scan5.scan.coverity.com/#/project-view/65138/10222?selectedIssue=1681392
Fixes: 5b310281af ("SRTP: Fixup settable input limits and test them.")
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Wed Feb 18 16:34:01 2026
(Merged from https://github.com/openssl/openssl/pull/30040)
2026-02-18 11:33:54 -05:00
Neil Horman
79be685126 Use the appropriate libctx when executing CMS_SignerInfo_verify
@beldmit found some odd fips behavior when running cms tests after
attempting to remove the EVP_get_digestbyname call from the find routine
in cms when doing certificate signer validation.

It was occuring because the cms app, being an applet in openssl uses the
app libctx to load all the provided configuration, which implies the
fips and base providers are loaded to that ctx.  However, in the find
routine (part of cms), it only ever fetches algorithms from the default
libctx, leading to failed lookups, and consequently, CMS errors.

Fix it by using the appropriate libctx, which in this case can be
fetched from the SignerInfo data, which initializes its libctx member to
the app libctx in all cases.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Wed Feb 18 16:28:44 2026
(Merged from https://github.com/openssl/openssl/pull/30034)
2026-02-18 11:28:41 -05:00
Milan Broz
e5ff85fd77 Use defined TLS cipher suite names in SSL trace
This should use #define strings instead of duplication.
Not everything is defined, though.

Fixes openssl/project#1875

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

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

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Wed Feb 18 16:01:18 2026
(Merged from https://github.com/openssl/openssl/pull/30042)
2026-02-18 17:01:11 +01:00
Bernd Edlinger
59cdf92d38 Alternate fix for CVE-2025-69419
This affects the function OPENSSL_uni2utf8
which caused heap buffer overflow when certain
unicode characters are converted.
The current fix is incomplete and does only prevent the
crash by making OPENSSL_uni2utf8 return a NULL pointer.
But with this change the OPENSSL_uni2utf8 will return the
correct utf8 string instead of a NULL pointer.
Additionally we add a simple test case that demonstrates
the original CVE.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 18 15:46:35 2026
(Merged from https://github.com/openssl/openssl/pull/29997)
2026-02-18 16:46:12 +01:00
Igor Ustinov
7b5ddfb157 SSL_get_error(): Do not depend on the state of the error stack
We check in relevant functions (SSL_handshake(), SSL_read(), etc.) whether
a new error has been pushed onto the error stack, and if so, memorise this
fact in the SSL structure. After that SSL_get_error() uses this memorised
information instead of checking the error stack itself.

Fixes #11889
Fixes openssl/project#1715

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 18 15:27:38 2026
(Merged from https://github.com/openssl/openssl/pull/29991)
2026-02-18 16:26:26 +01:00
Bob Beck
e5321113a0 Constify X509_verify
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Wed Feb 18 14:56:08 2026
(Merged from https://github.com/openssl/openssl/pull/30035)
2026-02-18 15:55:51 +01:00
giorgiopapini
5869303daa Move typedef 'RSA_OEAP_PARAMS' to openssl/types.h
This avoids redefinition of the type.

CLA: trivial

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 18 13:09:26 2026
(Merged from https://github.com/openssl/openssl/pull/29994)
2026-02-18 14:08:10 +01:00
Bob Beck
0eecb6c084 Deprecate X509_NAME_get_text_by NID and X509_NAME_get_text_by_OBJ
As they were already documented as "should be considered deprecated".

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 18 13:06:18 2026
(Merged from https://github.com/openssl/openssl/pull/30031)
2026-02-18 14:06:10 +01:00
Neil Horman
20c86e271b don't include the asm code for ppc aes-gcm on big endian
Its dead code on that platform since we don't use it

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
MergeDate: Tue Feb 17 14:11:49 2026
(Merged from https://github.com/openssl/openssl/pull/29968)
2026-02-17 09:11:43 -05:00
Neil Horman
b02b04fbad don't use asm accelerated path on big endian power9
https://github.com/openssl/openssl/issues/29845

Found that our hardware accelerated path doesn't work on big endian
systems, so make sure that we only use it when little endian is defined

We also noted that PPC_AES_GCM_CAPABLE gets defined to zero when the
capabilities register notes that the hardware isn't capable of the
needed instructions, but that still includes the asm path as
PPC_AES_GCM_CAPABLE is still defined.

Fix both issues

Fixes #29845

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
MergeDate: Tue Feb 17 14:11:46 2026
(Merged from https://github.com/openssl/openssl/pull/29968)
2026-02-17 09:11:43 -05:00
Frederik Wedel-Heinen
713eb194a8 Remove remaining RAND_DRBG.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Feb 17 14:09:07 2026
(Merged from https://github.com/openssl/openssl/pull/29782)
2026-02-17 09:09:01 -05:00
Neil Horman
9431cc20be Add abilty to use static vcruntime
Add a config option to selectively enable disable static vcruntime
linkage (default disabled, implying dynamic vcruntime linkage)

Fixes #12210

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Feb 17 09:43:37 2026
(Merged from https://github.com/openssl/openssl/pull/29995)
2026-02-17 10:43:35 +01:00
Tomas Mraz
bfd7c10f57 X509V3_EXT_print(): Return only 0 or 1 as the callers expect
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
MergeDate: Tue Feb 17 09:17:37 2026
(Merged from https://github.com/openssl/openssl/pull/29981)
2026-02-17 10:17:29 +01:00
slontis
9f01bfa158 SLH-DSA speed up hash calculations.
SLH-DSA spends a significant amount of time performing large
numbers of hash calculations. Initially this was done using
EVP layer calls. The overhead is significant when there are thousands
of calls. To reduce this overhead the lower level sha functions for
KECCAK1600_CTX, SHA256_CTX and SHA512_CTX are accessed directly.

Profiling showed that a significant amount of time is spent in
"WOTS+ Public key generation" (FIPS 205 Section 5.1 Algorithm 6) so
this was inlined for shake and sha2 (See slh_wots_pk_gen_sha2()).

In FIPS 205 Section 11 there is a list of Hash functions.
Many of these functions use a pattern of
Trunc(n)(SHA256(PK.Seed || toByte(0, 64-n) || ....)
Because this operation is done many times, this prehashed
value is calculated once and stored into a low level SHA256_CTX or
KECCAK1600_CTX.
This can then be block copied to stack based KECCAK1600_CTX or
SHA256_CTX that we can then perform low level SHA functions on.
The md_len field is written to directly before the SHA final() to
control the length of the output (which avoids performing a memcpy).

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28941)
2026-02-17 12:20:04 +11:00
slontis
d66c748300 SHA256: Document SHA256_CTX, HASH_UPDATE() and HASH_FINAL()
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28941)
2026-02-17 12:16:50 +11:00
slontis
4ac943b70a SHA512 : Change SHA512_Final() so that it handles 192 bits.
SLH-DSA uses SHA-512 truncated to n when (n = 24 or 32).

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28941)
2026-02-17 12:16:50 +11:00
slontis
2d3bd088b3 SHA3 - Move the buffered absorb function into sha3.c
This code was sitting inside the sha3 provider where it could not be
called directly.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28941)
2026-02-17 12:16:50 +11:00
slontis
5b310281af SRTP: Fixup settable input limits and test them.
Reported by https://github.com/1seal

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/30001)
2026-02-16 17:22:37 +11:00
slontis
1c1078b4a3 Doc: SRTP updates to reflect the limits on settable parameters
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/30001)
2026-02-16 17:22:29 +11:00
Aayush
3eeae570e0 Clarify SSL_CERT_DIR list separator on Windows
Fixes #27698
OpenSSL uses `;` as the path delimiter on Windows.
Update the manpage to state this explicitly instead of implying
`:` everywhere.

CLA: trivial

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Sat Feb 14 23:54:32 2026
(Merged from https://github.com/openssl/openssl/pull/27844)
2026-02-14 18:54:05 -05:00
Tomas Mraz
5c14539427 Make ERR_STATE opaque and remove related deprecated functions
ERR_get_state(), ERR_remove_state() and ERR_remove_thread_state()
and useless SYS_F_ macros are removed.

Fixes #4654

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sat Feb 14 23:07:56 2026
(Merged from https://github.com/openssl/openssl/pull/30005)
2026-02-13 17:11:07 +01:00
Alexandr Nedvedicky
eb962a78b5 remove all atexit() tests in shlibloadtest
The shlibloadtest used atexit() handler to verify
library pinning works as expected. The libcrypto
no longer arms atexit handler which also used to
fire upon shlib unload. We can not use the atexit
mechansim to test shared library pinning.

If the shlibload test does not crash on exit, then
library pinning must work.

Fixes openssl/project#1869

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 13 15:15:04 2026
(Merged from https://github.com/openssl/openssl/pull/29987)
2026-02-13 16:15:03 +01:00
Norbert Pocs
d2f54e1b40 windows: Remove redundant include
The functions malloc, realloc and free are included from stdlib,
therefore no need for redundant malloc.h include.

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 13 15:13:13 2026
(Merged from https://github.com/openssl/openssl/pull/29989)
2026-02-13 16:13:04 +01:00
kovan
ab021a41c9 doc: fix NAME section formatting in EVP_SIGNATURE documentation
Ensure consistent formatting in NAME sections across all EVP_SIGNATURE
documentation pages. The algorithm name should be bold (B<ALG>) rather
than EVP_PKEY, following the pattern:
"- The EVP_PKEY B<ALG> signature implementation"

Fixes #29328

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

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 13 15:09:54 2026
(Merged from https://github.com/openssl/openssl/pull/29789)
2026-02-13 16:09:45 +01:00
Philip Prindeville
7b6c638dd5 Cleanup of printing in apps
Don't use BIO_printf() where BIO_puts() will do.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 13 15:05:38 2026
(Merged from https://github.com/openssl/openssl/pull/29677)
2026-02-13 16:05:36 +01:00
kovan
38991b3c0e fix: update remaining 3.5.0 references to 3.6.0 in README-FIPS.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Fri Feb 13 14:55:20 2026
(Merged from https://github.com/openssl/openssl/pull/29884)
2026-02-13 15:55:07 +01:00
kovan
e948be9a6b doc: add OpenSSL 3.6 to README documentation links
Update README.md to include OpenSSL 3.6 in the documentation links.
Update README-FIPS.md examples to use 3.6.0 as the latest release.

Fixes #29876

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

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Fri Feb 13 14:55:19 2026
(Merged from https://github.com/openssl/openssl/pull/29884)
2026-02-13 15:55:07 +01:00
kovan
4792d33a54 doc: clarify -cipher option syntax in man pages
Users reading the documentation for the -<cipher> option often
misunderstand the syntax. The notation "B<-I<cipher>>" renders as
"-cipher" with "cipher" in italics, leading users to think they
should type "-cipher aes-128-cbc" when the correct usage is
"-aes-128-cbc" (the cipher name directly as the option).

Update the documentation in openssl-genpkey, openssl-enc, and
openssl-pkey to explicitly state that the cipher name is prepended
with a hyphen and used directly as the option, not as an argument
to a "-cipher" flag.

Also add a reference to "openssl list -cipher-algorithms" to help
users discover available ciphers, and fix a typo in openssl-pkey
("and and" -> "and").

Fixes #26089

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

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Fri Feb 13 14:52:00 2026
(Merged from https://github.com/openssl/openssl/pull/29843)
2026-02-13 15:51:52 +01:00
kovan
865489d524 doc: rename .pod.in files that don't use templating to .pod
These man page source files only used the output_do_not_edit_headers()
template function, which just generates a comment. Since they don't
use any meaningful templating, rename them from .pod.in to .pod and
remove the template line and build.info generation rules.

Files renamed:
- openssl-asn1parse.pod.in -> openssl-asn1parse.pod
- openssl-cmds.pod.in -> openssl-cmds.pod
- openssl-fipsinstall.pod.in -> openssl-fipsinstall.pod
- openssl-info.pod.in -> openssl-info.pod
- openssl-sess_id.pod.in -> openssl-sess_id.pod
- openssl-version.pod.in -> openssl-version.pod
- openssl-configutl and openssl-errstr .pod.in

Fixes #27760

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

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Fri Feb 13 14:50:16 2026
(Merged from https://github.com/openssl/openssl/pull/29838)
2026-02-13 15:49:29 +01:00
kovan
4cf52a2fed doc: add CHANGES.md entry for const-correct X509_ATTRIBUTE functions
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
MergeDate: Fri Feb 13 14:46:30 2026
(Merged from https://github.com/openssl/openssl/pull/29813)
2026-02-13 15:45:37 +01:00
John Smith
d24535c973 Propagate const-correctness to PKCS7, CMS, and X509 attribute functions
Following the const-correctness changes to X509_ATTRIBUTE accessor
functions, update all dependent functions to also return const pointers:

PKCS7 functions:
- PKCS7_get_attribute: returns const ASN1_TYPE *
- PKCS7_get_signed_attribute: returns const ASN1_TYPE *
- PKCS7_digest_from_attributes: returns const ASN1_OCTET_STRING *

X509 functions:
- X509at_get0_data_by_OBJ: returns const void *

CMS functions:
- CMS_signed_get0_data_by_OBJ: returns const void *
- CMS_unsigned_get0_data_by_OBJ: returns const void *

Update all callers to use const-qualified pointers for return values.

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

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
MergeDate: Fri Feb 13 14:46:28 2026
(Merged from https://github.com/openssl/openssl/pull/29813)
2026-02-13 15:45:37 +01:00
kovan
0c841cd5aa Make X509_ATTRIBUTE accessor functions const-correct
The X509_ATTRIBUTE accessor functions were not const-correct, preventing
callers from usefully interacting with a const X509_ATTRIBUTE pointer.

Update the following functions to accept const X509_ATTRIBUTE * and
return const pointers where appropriate:

- X509_ATTRIBUTE_get0_object: returns const ASN1_OBJECT *
- X509_ATTRIBUTE_get0_type: returns const ASN1_TYPE *
- X509_ATTRIBUTE_get0_data: returns const void *

Also update dependent PKCS12 functions:
- PKCS12_get_attr_gen: returns const ASN1_TYPE *
- PKCS12_get_attr: returns const ASN1_TYPE * (deprecated)
- PKCS8_get_attr: returns const ASN1_TYPE *

Update all callers to use const pointers for the return values.

Fixes #29811

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

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
MergeDate: Fri Feb 13 14:46:26 2026
(Merged from https://github.com/openssl/openssl/pull/29813)
2026-02-13 15:45:37 +01:00
Zijie Zhao
4eb8a222c9 Add test for EVP_KEYMGMT leak in evp_pkey_signature_init() error paths
Verify that calling EVP_PKEY_sign_init_ex2() with a mismatched
key/signature algorithm (RSA key with ECDSA signature) does not leak
EVP_KEYMGMT references. The test repeats the operation 100 times so
that ASAN can detect accumulating leaks.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Feb 13 14:42:40 2026
(Merged from https://github.com/openssl/openssl/pull/29810)
2026-02-13 15:42:25 +01:00
kovan
e133f84ee9 doc: note that PBKDF2 does not support XOF digests
PBKDF2 uses HMAC internally, which does not support eXtendable Output
Function (XOF) digests such as SHAKE128 or SHAKE256. Document this
limitation to prevent user confusion when attempting to use XOF
digests with PBKDF2.

Fixes #22877

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

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 13 14:39:07 2026
(Merged from https://github.com/openssl/openssl/pull/29792)
2026-02-13 15:39:05 +01:00
kovan
6d646a94af doc: clarify SSL_SESSION ownership in PSK use session callback
Document that when the psk_use_session callback is invoked multiple times
and wishes to return the same SSL_SESSION pointer, it must call
SSL_SESSION_up_ref() first since ownership is transferred on each call.
This prevents use-after-free errors from incorrect callback implementations.

Fixes #28267

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 13 14:36:50 2026
(Merged from https://github.com/openssl/openssl/pull/29771)
2026-02-13 15:36:36 +01:00
krk
b2499af529 Interleave load/compute stages in AVX2 base64 encoder
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Feb 13 14:31:45 2026
(Merged from https://github.com/openssl/openssl/pull/29858)
2026-02-13 15:31:35 +01:00
krk
f49db10161 Add software prefetch to AVX2 base64 encoder hot loop
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Feb 13 14:31:43 2026
(Merged from https://github.com/openssl/openssl/pull/29858)
2026-02-13 15:30:58 +01:00
Simo Sorce
c5f9e88fa6 Add support for deferred FIPS self-tests
Add a new -defer_tests option to openssl fipsinstall and a corresponding
defer-tests configuration parameter for the FIPS provider.

This allows the execution of self-tests to be postponed until the
first time an algorithm is used, instead of running all tests
during module initialization. This reduces startup time.

Update the self-test framework to handle the new SELF_TEST_STATE_DEFER
state, ensuring deferred tests are skipped at load and run on demand.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29222)
2026-02-13 10:53:50 +01:00
Simo Sorce
7f788e575a fips: Reorder self-tests by complexity
Reorganize the FIPS self-tests to group them by complexity.

The new order groups tests so that more complex ones are executed before
less complex one when all tests are run on_demand, improving the odds
that lower level tests are implicitly executed as part of higher level
tests and therefore reducing the amount of time spent running redundant
tests.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29222)
2026-02-13 10:53:41 +01:00
Simo Sorce
ca0ebe300c Relax PBKDF2 iteration check for FIPS self-test
FIPS 140-3 IG 10.3.A.8 requires known-answer tests for KDFs. Some of these
tests for PBKDF2 use a low iteration count (e.g., 2) which is below the normal
security threshold and would otherwise fail.

This change checks if a PBKDF2 self-test is in progress and, if so, lowers the
minimum accepted iteration count to 2. This allows the required self-tests to
pass while maintaining the security check for normal operations.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29222)
2026-02-13 10:53:41 +01:00
Simo Sorce
a8036eb1e8 Refactor FIPS self-test dependencies and states
Introduce `SELF_TEST_STATE_IMPLICIT` to handle recursive self-test calls
when an algorithm is used by another algorithm's self-test (e.g., KDF
using HMAC). This prevents unnecessarily running tests when they are
effectively covered by a parent test.

Refactor `SELF_TEST_kats` and `SELF_TEST_kats_execute` to unify
execution logic, dependency resolution, and RNG setup. Remove the
`deferred` flag from test definitions in favor of dynamic state
evaluation. Explicitly add a dependency for AES-128-ECB on AES-256-GCM.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29222)
2026-02-13 10:53:41 +01:00
Simo Sorce
ead11ab950 Add an ID to the self test structure
Add a self test id to the self test definition structure. This is used as a
sanity check to ensure that a test's enum ID matches its index in the
`st_all_tests` array.

This helps prevent programming errors when adding, removing, or reordering
tests in the future, improving the robustness of the self-test mechanism.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29222)
2026-02-13 10:53:41 +01:00
Simo Sorce
53fecfc80b Refactor FIPS integrity check to use KAT framework
The FIPS module integrity check (HMAC-SHA256) is refactored to use the
generic Known Answer Test (KAT) framework instead of a standalone
function.

- Remove `integrity_self_test` and use `ST_ID_MAC_HMAC` with
  `SELF_TEST_kats_single`.
- Add `self_test_mac` to `self_test_kats.c` to support MAC tests.
- Move HMAC test data to `self_test_data.c`.
- Rename the self-test type from "KAT_Integrity" to "KAT_Mac".
- Ensure on-demand tests reset state so they can be repeated.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29222)
2026-02-13 10:53:41 +01:00
Simo Sorce
4024071950 Switch FIPS self tests to deferred execution
Update the FIPS module to run self-tests on demand (deferred) rather
than on module load. Change the test definitions in self_test_data.c
from SELF_TEST_ONLOAD to SELF_TEST_DEFERRED.

Add calls to ossl_deferred_self_test() in the newctx functions for
ciphers, digests, signatures, KDFs, KEMs and DRBGs to trigger execution
upon first instantiation. Introduce CIPHER_PROV_CHECK and
DIGEST_PROV_CHECK macros in common headers to facilitate these checks.
Define dependencies for composite tests to ensure prerequisite tests
run when needed.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29222)
2026-02-13 10:53:41 +01:00
Simo Sorce
380aafd865 Move deferred self-test lock to FIPS_GLOBAL
The lock for the deferred FIPS self-tests was previously a static
global variable, initialized with CRYPTO_ONCE. This is problematic
when multiple library contexts are used in a single application.

This change moves the lock into the FIPS_GLOBAL structure, making it
per-library-context. The lock is now initialized when the FIPS
provider is initialized and freed when its context is torn down.
This improves encapsulation and avoids global state.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29222)
2026-02-13 10:53:40 +01:00
Simo Sorce
0afbd6bfb3 Add dependency handling for FIPS self-tests
Some FIPS Known Answer Tests (KATs) rely on other cryptographic algorithms
that also have their own KATs. This change introduces a formal mechanism to
ensure these dependencies are met before a test is run.

A `depends_on` field is added to the self-test definition to declare
prerequisites. A new recursive function, `FIPS_kat_deferred_execute`,
traverses this dependency chain, executing any required tests first.

This new logic also prevents tests from being run multiple times if they are a
dependency for several other tests. The `FIPS_kat_deferred` function is
updated to use this new dependency-aware execution function.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29222)
2026-02-13 10:53:40 +01:00
Simo Sorce
66549b5eff Refactor FIPS self-tests to use ID-based lookup
Consolidate separate self-test data arrays into a single `st_all_tests`
array indexed by a new `self_test_id_t` enumeration.

This replaces string-based algorithm lookups with direct array indexing
for running self-tests, simplifying the code and state management. The
`FIPS_DEFERRED_TEST` structure and `self_test_data.h` file are removed,
and the FIPS provider and implementations are updated to use the new
ID-based API.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29222)
2026-02-13 10:53:40 +01:00
Simo Sorce
8c63835c8c Initialize DRBG for single FIPS KATs
The SELF_TEST_kats_single() function runs an individual FIPS Known Answer Test
(KAT) on demand. These tests require a deterministic random bit generator
(DRBG) to be properly initialized to function correctly.

This change ensures a dedicated DRBG is set up for the single test run. The
existing private RNG is saved before the test and restored afterward,
isolating the test's random context from the rest of the library.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29222)
2026-02-13 10:53:40 +01:00
Simo Sorce
c684325ca0 Unify FIPS self-test KAT data structures
Refactor the FIPS self-test Known Answer Test (KAT) data definitions to use a
single, unified structure.

A new generic `ST_DEFINITION` struct is introduced to replace the various
algorithm-specific `ST_KAT_*` structs. This new struct contains fields common
to all tests and uses a union to hold the parameters specific to each test
category (cipher, digest, KEM, etc.).

A helper `ST_BUFFER` struct is also added to combine data pointers and their
lengths, simplifying data handling. This refactoring makes the self-test
framework more consistent, easier to maintain, and more extensible.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29222)
2026-02-13 10:53:40 +01:00
Simo Sorce
32f6ec6de5 docs: Simplify FIPS deferred test equivalency
This commit refines the design for FIPS deferred self-tests by simplifying how
test equivalencies are handled.

The explicit `also_satisfies` list has been removed from the design. Instead
of manually listing which tests are satisfied by another, the new approach
relies on implicit discovery. When a high-level self-test runs, it records all
the underlying cryptographic algorithms that are invoked during its execution.

Upon successful completion of the high-level test, the tests for all recorded
algorithms are automatically marked as passed. This approach is more direct,
less error-prone, and removes the complex logic associated with the previous
explicit dependency lists.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29222)
2026-02-13 10:53:40 +01:00
Simo Sorce
3bf8414dc5 Comment out currently unused data
This causes linters to blow up

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29222)
2026-02-13 10:53:40 +01:00
Simo Sorce
0e86806197 Move FIPS self-test data into a separate .c file
The Known Answer Test (KAT) data, previously in `self_test_data.inc`, is moved
into its own compilation unit, `self_test_data.c`. This separates the large
data definitions from the test execution logic.

This refactoring improves code organization and modularity. A new header,
`self_test_data.h`, is added to declare the data arrays for external linkage.
The shared data structure definitions are moved to `self_test.h` to be
accessible by both the test logic and the data files.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29222)
2026-02-13 10:53:40 +01:00
Simo Sorce
48dd58fa24 Keep kdfs together in .gitignore
Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29222)
2026-02-13 10:53:40 +01:00
Simo Sorce
05b08d4ac8 Fix style of FIPS srtp self-test data arrays
Fix sloppy style that will break clang style detector later once
we rename the .inc file back to be a regular .c file.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29222)
2026-02-13 10:53:40 +01:00
Simo Sorce
efc6a0d1f9 Fix style for ECDSA test vector
Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29222)
2026-02-13 10:53:40 +01:00
Matt Caswell
c13e46f204 Add a newdata_ex function which takes params and use it
The keymgmt->newdata function does not accept params. We introduce a
newdata_ex function that does, and we use that instead as a thread local
to pass legacy objects to the default provider

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 13 07:58:28 2026
(Merged from https://github.com/openssl/openssl/pull/29960)
2026-02-13 08:58:13 +01:00
Matt Caswell
ee63f4d955 Extend the low level method testing with ex_data
Make sure that when we use ex_data on a low level object that also
works when used with a provider.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 13 07:58:27 2026
(Merged from https://github.com/openssl/openssl/pull/29960)
2026-02-13 08:57:58 +01:00
Matt Caswell
a4105f7882 Pass low level DH objects to the default provider
As we did for RSA objects we do the same for DH objects.

Fixes #29942

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 13 07:58:25 2026
(Merged from https://github.com/openssl/openssl/pull/29960)
2026-02-13 08:57:58 +01:00
Matt Caswell
6c990c7bf4 Pass low level EC_KEY objects to the default provider
As we did for RSA objects we do the same for EC_KEY objects.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 13 07:58:24 2026
(Merged from https://github.com/openssl/openssl/pull/29960)
2026-02-13 08:57:58 +01:00
Matt Caswell
cec26b39c3 Pass low level DSA objects to the default provider
As we did for RSA objects we do the same for DSA objects.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 13 07:58:23 2026
(Merged from https://github.com/openssl/openssl/pull/29960)
2026-02-13 08:57:58 +01:00
Matt Caswell
3db19c56ae Pass low level RSA objects to the default provider
If a low level RSA object has been assigned a custom RSA_METHOD and is
then assigned to an EVP_PKEY object, then we still want the default
provider to use that RSA_METHOD. To ensure this occurs we pass the low
level object across the provider boundary. We can only get away with this
because it is the default provider.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 13 07:58:21 2026
(Merged from https://github.com/openssl/openssl/pull/29960)
2026-02-13 08:57:58 +01:00
Matt Caswell
f0ecb93fc1 Fix no-deprecated builds
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 13 07:58:20 2026
(Merged from https://github.com/openssl/openssl/pull/29960)
2026-02-13 08:57:58 +01:00
Matt Caswell
cb9b2bcc0c Extend the tests we have for low level RSA/DSA methods to cover DH
We want to test that if we use a custom DH_METHOD, then it still works
even when we use a provider.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 13 07:58:18 2026
(Merged from https://github.com/openssl/openssl/pull/29960)
2026-02-13 08:57:58 +01:00
Matt Caswell
2854cea108 Extend the tests we have for low level RSA/DSA methods to cover EC
We want to test that if we use a custom EC_KEY_METHOD, then it still works
even when we use a provider.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 13 07:58:17 2026
(Merged from https://github.com/openssl/openssl/pull/29960)
2026-02-13 08:57:58 +01:00
Matt Caswell
1984eab678 Extend the test we have for a low level RSA method to cover DSA
We want to test that if we use a custom DSA_METHOD, then it still works
even when we use a provider.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 13 07:58:16 2026
(Merged from https://github.com/openssl/openssl/pull/29960)
2026-02-13 08:57:58 +01:00
Matt Caswell
de962b7466 Add a test for using a low level method with a provider
We need to test that if you set a custom RSA_METHOD (or similar) on a
low level object (e.g. RSA) then it will be used even in a provider.

This test case was inspired by the reproducer given in #29702

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 13 07:58:14 2026
(Merged from https://github.com/openssl/openssl/pull/29960)
2026-02-13 08:57:57 +01:00
Theo Buehler
74d47c8e66 Provide ASN1_BIT_STRING_set1()
Mostly work by @botovq with tests adapted to openssl by
@bob-beck

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Feb 12 20:41:13 2026
(Merged from https://github.com/openssl/openssl/pull/29926)
2026-02-12 15:41:09 -05:00
Dmitry Belyavskiy
2ea6e785f5 EVP_get_digestbynid/EVP_get_cipherbynid turns into...
a wrapper around EVP_MD_fetch/EVP_CIPHER_fetch when engines are not
supported anymore. Let's remove the fallbacks that don't do anything
useful

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Thu Feb 12 18:22:57 2026
(Merged from https://github.com/openssl/openssl/pull/29969)
2026-02-12 13:22:52 -05:00
kovan
039baf390e doc: fix RSA_set_method return value documentation
The documentation incorrectly stated that RSA_set_method() returns
a pointer to the old RSA_METHOD. In fact, it returns int (1 for success).
The SYNOPSIS correctly shows 'int RSA_set_method(...)' but the
RETURN VALUES section was wrong.

Fixes #13884

CLA: trivial

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

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Feb 12 15:18:38 2026
(Merged from https://github.com/openssl/openssl/pull/29916)
2026-02-12 16:18:24 +01:00
Igor Ustinov
be42447469 Fix the converters between the old and new BIO_read functions to handle
end-of-file state properly.

Related to openssl/project#1745

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Thu Feb 12 08:34:31 2026
(Merged from https://github.com/openssl/openssl/pull/29290)
2026-02-12 09:34:25 +01:00
Daniel Kubec
86105fbf26 Fixed formatting and text alignment in CHANGES.md
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Feb 11 22:35:08 2026
(Merged from https://github.com/openssl/openssl/pull/29978)
2026-02-11 17:35:01 -05:00
kovan
f92ed8f003 doc: document SSL_set_client_CA_list NULL behavior
Document that passing NULL to SSL_set_client_CA_list() does not clear
the CA list; instead, the SSL_CTX's setting is used. Also note that
passing an empty stack created with sk_X509_NAME_new_null() clears the
per-connection client CA list, but during the handshake the generic CA
list (set via SSL_CTX_set0_CA_list()) may still be used as a fallback.

Fixes #10795

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Wed Feb 11 20:02:47 2026
(Merged from https://github.com/openssl/openssl/pull/29917)
2026-02-11 15:02:43 -05:00
Alexandr Nedvedicky
7b8f9b1c1c Update NOTES-VALGRIND.md to document valgrind compaints on reachable
memory blocks

Co-authored-by: Matt Caswell <matt@openssl.org>
Co-authored-by: Tomáš Mráz <tm@t8m.info>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 11 19:40:10 2026
(Merged from https://github.com/openssl/openssl/pull/29966)
2026-02-11 14:40:48 -05:00
Bob Beck
ca52fe62e7 Remove OPENSSL_atexit();
OSSLINAPPL (OpenSSL Is Not A Public Portability Layer)

I blame @nhorman and @sashan, who made me update the adjacent
documentation, and it was sitting there like an unloved and
ignored chronically ill pet with no hope for any future
quality of life.

Since this really does not need an alternative API or a
deprecation stragegy, we can simply remove it. Anyone
who was using this can use libc atexit() if they must.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
MergeDate: Wed Feb 11 17:37:33 2026
(Merged from https://github.com/openssl/openssl/pull/29874)
2026-02-11 12:37:28 -05:00
Eugene Syromiatnikov
a7b0d678ab Apply clang-format to the source tree
Ensure that all the source files are formatted with the current
.clang-format configuration, to avoid spurious clang-format checker
errors when arbitrary files are touched.

Complements: 1b0f21f055 "Implementing store support for EVP_SKEY"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Wed Feb 11 07:35:04 2026
(Merged from https://github.com/openssl/openssl/pull/29852)
2026-02-11 08:34:52 +01:00
Sahana Prasad
75da49bf6b cleanup: Use 32 bits instead of 40 bits to perform AND operation in aes implementation.
Fixes https://github.com/openssl/openssl/issues/29963

Signed-off-by: Sahana Prasad <sahana@redhat.com>

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Feb 11 07:29:17 2026
(Merged from https://github.com/openssl/openssl/pull/29964)
2026-02-11 08:29:02 +01:00
Bob Beck
bf39120c27 Allow testing the valgrind suppression file in CI
Skip the OPENSSL_cleanup() call from the openssl app and in tests
when OSSL_USE_VALGRIND environment variable is set.

This can be used in the CI to test the valgrind suppressions.

Builds upon https://github.com/openssl/openssl/pull/29573

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Feb 10 14:00:54 2026
(Merged from https://github.com/openssl/openssl/pull/29575)
2026-02-10 15:00:52 +01:00
Neil Horman
69b0330a45 Fix buffer overrung in SRTPKDF
our fuzzer caught this:
https://github.com/openssl/openssl/actions/runs/21625445341/job/62324333796

Overnight.

We're getting a heap buffer overrun in the SRTP KDF.

Its caused by the fact that the fuzzer will occasionally generate salt
parameters that are very small, which passes the
OSSL_PARAM_get_octet_string function, but isn't long enough to be a
valid salt.  Because of this, when we actually do the key derivation,
the SRTPKDF function assumes the salt is long enough and blindly
attempts to copy KDF_SRTP_SALT_LEN (14) bytes from the fetched parameter
into a local buffer, resulting in an overrun.

Fix it by checking the parameter length in the ctx_set_params method for
SRTPKDF, and if the octet string value is less than the required amount,
return an error to fail the ctx_set_params call.

While we're at it, based on review suggestions, also check that the
provided key parameter matches the requested cipher's expected key
length

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29938)
2026-02-10 10:20:59 +11:00
Stanislav Zidek
0a99c3e9df interop tests: update
* simplified specfile
* newer tests
* update to Fedora-43

Signed-off-by: Stanislav Zidek <szidek@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Feb  9 10:00:14 2026
(Merged from https://github.com/openssl/openssl/pull/29559)
2026-02-09 11:00:12 +01:00
Praveen Palaniswamy
f541dede63 Document EC_curve_nist2nid and EC_curve_nid2nist functions
Add documentation for EC_curve_nist2nid() and EC_curve_nid2nist()
functions which were previously undocumented. These functions convert
between OpenSSL NIDs and NIST standardized curve names (e.g., "P-256",
"P-384", "P-521" for prime field curves and "B-163", "K-233", etc.
for binary field curves).

The documentation includes:
 - Function prototypes in the SYNOPSIS section
 - Detailed descriptions explaining the purpose and behavior
 - Examples of NIST curve names
 - Return value documentation

Fixes #29180

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Mon Feb  9 09:59:04 2026
(Merged from https://github.com/openssl/openssl/pull/29341)
2026-02-09 10:58:36 +01:00
Tejaswi Devarakonda
8f7f7f8124 OSSL_PARAM_print_to_bio should be excluded from FIPS_MODULE
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Feb  9 09:55:48 2026
(Merged from https://github.com/openssl/openssl/pull/29937)
2026-02-09 10:55:35 +01:00
Nikola Pajkovsky
aad0ceda38 config: use -path instead of -wholename
-wholename is mostly alias to -path, and -path is more
portable. E.g. -wholename does not exist on NetBSD.

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

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Feb  9 09:53:10 2026
(Merged from https://github.com/openssl/openssl/pull/29944)
2026-02-09 10:53:03 +01:00
Viktor Dukhovni
fb0a105e25 Fix cross-version compatibility in RFC7919 changes
- Older versions of, e.g., the FIPS provider report the minimum
  TLS version of the FFDHE groups as TLS 1.3, but we now need to
  support these in TLS 1.2.

- Older OpenSSL runtimes may not be prepared to support the FFDHE groups
  in TLS 1.2.

Therefore, instead of changing the default and FIPS providers to
advertise these groups as TLS 1.2 compatible, leave the capabilities
unchanged, and instead adjust the min(d)tls value when processing the
provider's capabilities in the new runtime.

This ensures cross-compatibility with everything except previous master
branch dev snapshots, but that's not a concern.

Fixes: #29958

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Feb  9 08:53:54 2026
(Merged from https://github.com/openssl/openssl/pull/29962)
2026-02-09 09:53:18 +01:00
Dr. David von Oheimb
5cc7ae3e4a cmp_client_test.c: add print_errors_PKIStatusInfo() and use it for all CMP test executions
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28985)
2026-02-08 20:39:25 +01:00
Dr. David von Oheimb
1b04da5bb2 cmp_client_test.c: add separator output between the two execute_exec_GENM_ses_test_single() in execute_exec_GENM_ses_test()
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28985)
2026-02-08 20:39:25 +01:00
Dr. David von Oheimb
0314cc64f6 cmp_client_test.c: speed up polling tests by reducing checkAfter times
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28985)
2026-02-08 20:39:25 +01:00
Neil Horman
c38481a844 wrap use of cmp_thunk for STACK_OF up in a macro
Based on suggestion from pauli here:
https://github.com/openssl/openssl/pull/29640#discussion_r2692068679

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Sat Feb  7 18:11:22 2026
(Merged from https://github.com/openssl/openssl/pull/29640)
2026-02-07 13:11:08 -05:00
Neil Horman
cfa5eb176b Add NEWS/CHANGES for new OPENSSL_sk_set_cmp_thunks() api
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Sat Feb  7 18:11:19 2026
(Merged from https://github.com/openssl/openssl/pull/29640)
2026-02-07 13:11:08 -05:00
Neil Horman
cca14ca046 Add docs for OPENSSL_sk_set_cmp_thunks()
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Sat Feb  7 18:11:16 2026
(Merged from https://github.com/openssl/openssl/pull/29640)
2026-02-07 13:11:08 -05:00
Neil Horman
e94e75d23e add a compare thunk function to the STACK of macros
Now that ossl_bsearch is capable of using a thunking function, lets
create a thunking function to use for the STACK_OF macros.

The problem we're addressing is one that gives rise to ubsan issues.
clang-16 forward have a ubsan test that confirms that the target symbol
that we call through a pointer matches the type of the pointer itself.
for instance

int foo(void *a, void *b)
{
   ...
}

int (*fooptr)(char *ac, int *bc) = foo;

fooptr(&charval, &intval);

is strictly speaking in C undefined behavior (even though in normal
operation this works as expected).  Newer compilers are strict about
this however, as several security frameworks operate with an expectation
that this constraint is met.
See https://github.com/openssl/openssl/issues/22896#issuecomment-1837266357
for details.

So we need to create a thunking function.  The sole purpose of this
thunking function is to accept the "real" comparison function for the
STACK_OF macros, along with the two items to compare of the type that
they are passed as from the calling function, and do the convervsion of
both the comparison function and the data pointers to the types that the
real comparison function expects

So we:
1) Modify the DEFINE_STACK_OF macros to create this thunking function
2) Add an OPENSSL_sk_set_cmp_thunks api to set the comparison function
3) modify the requisite places in the stack code to use the thunking
   function when available

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Sat Feb  7 18:11:14 2026
(Merged from https://github.com/openssl/openssl/pull/29640)
2026-02-07 13:11:08 -05:00
Neil Horman
25a51c5cac add cmp_thunk function to ossl_bsearch
Add the initial groundwork to allow for the use of a thunking function
with bsearch.  Normally our comparison function signature doesn't match
the type of the pointer we call it through, leading to ubsan errors,
this lets those signatures match and gives us a place to do the proper
casting

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Sat Feb  7 18:11:11 2026
(Merged from https://github.com/openssl/openssl/pull/29640)
2026-02-07 13:11:02 -05:00
Ganna Starovoytova
be54bba640 adds tests for CVEs 2025/2026
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sat Feb  7 13:05:48 2026
(Merged from https://github.com/openssl/openssl/pull/29932)
2026-02-07 08:05:40 -05:00
Alexandr Nedvedicky
5fed2b1153 make test/quic_multistream_test.c clang-format friendly
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Feb  6 18:05:50 2026
(Merged from https://github.com/openssl/openssl/pull/29945)
2026-02-06 13:05:36 -05:00
kovan
3f450936a1 doc: Fix typos and grammar in BIO_s_accept documentation
- Fix "and attempt" to "an attempt"
- Fix "BIO_BIN_NORMAL" typo to "BIO_BIND_NORMAL"
- Add missing B<> formatting around BIO_BIND_NORMAL and BIO_RR_ACCEPT
- Fix "at then end" to "at the end"
- Fix incomplete sentence about BIO_should_io_special()
- Update copyright year

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
MergeDate: Fri Feb  6 13:34:18 2026
(Merged from https://github.com/openssl/openssl/pull/29910)
2026-02-06 08:34:12 -05:00
Neil Horman
df1ad5dbf8 replace curl in our interop testing
Since curl dropped support for using the OpenSSL quic stack, we have no
use for it anymore in our interop testing.  Replace it with our own
http3 demonstration client.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Fri Feb  6 12:46:26 2026
(Merged from https://github.com/openssl/openssl/pull/29922)
2026-02-06 07:46:21 -05:00
Neil Horman
58ef864189 Update ossl-http3-demo to support multiple requests
In order to use our http3 demo to do interop testing, said demo needs to
be able to handle multiple requests and responses written to specific
output files.

Add that code here, allowing us to specify optionally a list of requests
on the command line to send to the server, as well as a download
directory, so that requests made get written locally to the same name as
the request in the specified download directory.

while we're at it, also clean up the code infrastructure to use SSL_poll
to do read-ready checking, rather than iterating/mutating the internal
hash table, which is questionable to do (i.e. we shouldn't be removing
elements from the hash table while iterating over it).

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Fri Feb  6 12:46:24 2026
(Merged from https://github.com/openssl/openssl/pull/29922)
2026-02-06 07:46:21 -05:00
slontis
baf4156f70 AES-WRAP: Add tests
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29940)
2026-02-06 18:42:03 +11:00
slontis
ca8a2bd618 AES-WRAP fixes.
Partially fixes issue in Discussion 22861

AES-WRAP pad is documented as only working for non streaming cases.
It did not however enforce this, so a user could potentially
wrap something incorrectly without an error and then not be able to
unwrap it without an error. The code now checks that update is only
called once.

An internal function returned an int which could be negative for bad
input values, and the return value was assigned to a size_t which
ignored the error condition.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29940)
2026-02-06 18:42:03 +11:00
slontis
59147c96d2 BIO_f_cipher(): Increase internal buffer size used by CipherUpdate()
Previously running the commandline "openssl enc -id-aes256-wrap-pad ...'
with a large PQ private key failed since AES-WRAP is not streamable,
and multiple calls to CipherUpdate() are not allowed. Increasing the
size causes CipherUpdate() to only be called once.
The size of the buffer has been changed from 4K to 8K.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29940)
2026-02-06 18:42:03 +11:00
Ethan
cb095dd513 doc: changed data_size value for OSSL_PARAM_octet_string() in EVP_SIGNATURE-SLH-DSA.pod
CLA: trivial

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29933)
2026-02-06 07:56:39 +11:00
Bob Beck
7e56cab285 Make OPENSSL_cleanup() G A
(Your choice of G and A words)

This installs a global destructor if we have destructor support.

The global destructor does nothing and immediately returns under
normal operation. If a global flag indicating that global cleanup
is wanted, it does what OPENSSL_cleanup() used to do.

OPENSSL_cleanup() is then modified to set the global flag indicating
that global cleanup is wanted. At this point if we have destructor
support, it immeditely returns. If we do not have destructor support,
it manually calls the destructor function (meaning without destructor
support it does exactly what it used to do).

This ensures that if we have destructor support, the actions of an
OPENSSL_cleanup() requested by an application will only happen
after any subordinate library destructors which could call into
OpenSSL functions have already run.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Thu Feb  5 19:19:17 2026
(Merged from https://github.com/openssl/openssl/pull/29721)
2026-02-05 14:19:09 -05:00
Neil Horman
156347ff2c Don't setup a default context while tearing down private contexts
In providers/applications that create custom libctx'es via
OSSL_LIB_CTX_new, its possible, if the default provider has never been
initaialized during the lifetime of the linked libcrypto, that we
actually wind up creating the default libctx when we free the
aforementioned custom libctx via, as an example:

legacy_teardown->
 OSSL_LIB_CTX_free->
  ossl_lib_ctx_is_default->
   get_default_context->
    get_thread_default_context->
     default_context_do_init

While this isn't catastrophic, its needless, and in some cases has the
potential to leak memory (for instance if a provider is loaded and
unloaded repeatedly in an environment in which the provider is linked to
libcrypto.so while the calling application is statically linked to
libcrypto.a

Its also fairly easy to clean up, by adding an internal parameter to
gate the creation of the default libctx on the request of the caller, so
do that here

Fixes openssl/project#1846

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Feb  5 17:08:13 2026
(Merged from https://github.com/openssl/openssl/pull/29830)
2026-02-05 12:08:03 -05:00
Milan Broz
1f23e41029 Fix const spec in test
This patch fixes several const specifiers and unneeded casts
(visible with non-default const-qual warning).

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Thu Feb  5 09:13:46 2026
(Merged from https://github.com/openssl/openssl/pull/29800)
2026-02-05 10:13:37 +01:00
Viktor Dukhovni
254c4d7ae4 Added CHANGES.MD entry
Also added a couple of missing markdown quotes around strings with
internal liternal underscores.  More remain...

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Thu Feb  5 09:09:46 2026
(Merged from https://github.com/openssl/openssl/pull/24551)
2026-02-05 10:09:18 +01:00
Viktor Dukhovni
e9e0480e5d Advertise FFDHE groups also with TLS 1.2-only
When the TLS max version is TLS 1.2, include supported RFC7919 FFDHE
groups in the supported_groups extension, provided we support at least
one DHE key exchange ciphersuite.

Also skip the EC point formats extension when the minimum (D)TLS version
is greater than 1.2.  That extension is obsolete as of (D)TLS 1.3.

Finally, folded some extant long lines from the previous RFC7919 commits.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Thu Feb  5 09:09:43 2026
(Merged from https://github.com/openssl/openssl/pull/24551)
2026-02-05 10:09:18 +01:00
Joachim Vandersmissen
2af8022aaf Implement second step of RFC7919 in TLS 1.2 server
Before this commit, the logic for generating a temporary DH key for DHE
cipher suites is the following:
1) If dh_tmp_auto is set (see SSL_set_dh_auto), the SSL server
   automatically selects a set of DH parameters (P and G) appropriate
   for the security level of the cipher suite. The groups are taken from
   IKE (RFC 2409 and RFC 3526).
2) Otherwise, if the user provided a pre-generated set of DH parameters
   (SSL_set0_tmp_dh_pkey), those parameters are used.
3) Finally, if neither 1) or 2) are applicable, a callback function can
   be set using SSL_set_tmp_dh_callback, which will be invoked to
   generate the temporary DH parameters. From OpenSSL 3.0, this
   functionality is deprecated.
4) Using the parameters from step 1-3, an ephemeral DH key is
   generated. The parameters and the public key are sent to the client.

The logic above is updated by inserting an additional step, prior to
step 1:
0) If tls1_shared_group returns any shared known group between the
   server and the client, the DH parameters associated with this group
   are selected.

This is still compliant with RFC7919, as the server will already have
checked the Supported Groups extension during the ciphersuite selection
process (implemented in the previous commit).

Now, the tests need to be updated: By default, the TLS 1.2 server will
default to RFC7919 groups. To bypass this behavior, the supported groups
on the client side is set to "xorgroup", ensuring that the client does
not advertise any FFDHE group support and the server falls back to the
old logic.

An additional test is also added to ensure that the TLS 1.2 server does
select the right group if the client advertises any of the RFC7919
groups.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Thu Feb  5 09:09:41 2026
(Merged from https://github.com/openssl/openssl/pull/24551)
2026-02-05 10:09:18 +01:00
Joachim Vandersmissen
92131d3afc Implement first step of RFC7919 in TLS 1.2 server
RFC 7919 states:
    If a compatible TLS server receives a Supported Groups extension from
    a client that includes any FFDHE group (i.e., any codepoint between
    256 and 511, inclusive, even if unknown to the server), and if none
    of the client-proposed FFDHE groups are known and acceptable to the
    server, then the server MUST NOT select an FFDHE cipher suite.

We implement this behavior by adding a new function that checks this
condition as its inverse: only select FFDHE cipher suites if at least
one of the client-proposed FFDHE groups is known and acceptable, or
if the client did _not_ send any FFDHE groups.

Also add a test to verify two possible outcomes:
1) The client proposes FFDHE and non-FFDHE ciphersuites -> the server
will select a non-FFDHE ciphersuite.
2) The client only proposes FFDHE ciphersuites -> the server will end
the connection.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Thu Feb  5 09:09:40 2026
(Merged from https://github.com/openssl/openssl/pull/24551)
2026-02-05 10:09:18 +01:00
Joachim Vandersmissen
e23b33a995 Support FFDHE groups in tls1_shared_group
Update tls1_shared_group to allow filtering for FFDHE and/or ECDHE
groups. This will be used for implementing RFC 7919 groups support in
the TLS 1.2 server. As defined in RFC 7919:
   Codepoints in the "Supported Groups Registry" with a high byte of
   0x01 (that is, between 256 and 511, inclusive) are set aside for
   FFDHE groups

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Thu Feb  5 09:09:38 2026
(Merged from https://github.com/openssl/openssl/pull/24551)
2026-02-05 10:09:18 +01:00
Alexander Hansen Færøy
40d8060c0e Explicitly define SIO_UDP_NETRESET for MinGW builds.
This patch explicitly defines the value `SIO_UDP_NETRESET` according to
both what Windows and ReactOS does.

Fixes: #29818.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Thu Feb  5 08:54:17 2026
(Merged from https://github.com/openssl/openssl/pull/29826)
2026-02-05 09:54:04 +01:00
Milan Broz
7c75acfedc Fix const spec in apps
This patch fixes several const specifiers
(visible with non-default const-qual warning).

 - Functions like SSL_set_tlsext_host_name takes
   non-cost hostname parameter.

 - packet buffer is read in BIO_read, so it
   cannot be const

The rest is missing const specifiers where casting
to non-cost is not needed.

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Feb  4 19:49:15 2026
(Merged from https://github.com/openssl/openssl/pull/29796)
2026-02-04 14:49:08 -05:00
Neil Horman
b00fae4ef8 Gate use of IPV6_PMTUDISC_PROBE on it being defined
We accidentally introduced a use of IPV6_PMTUDISC_PROBE without checking
if it was defined in
https://github.com/openssl/openssl/pull/28809

leading to build failures on systems that don't define it.  Fix that.

Fixes #29903

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Wed Feb  4 19:23:14 2026
(Merged from https://github.com/openssl/openssl/pull/29927)
2026-02-04 14:23:08 -05:00
Randall S. Becker
307ed7b8f0 Guard RWLOCK methods by USE_RWLOCK in threads_pthread.c
Fixes: #29883

Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Feb  4 15:55:47 2026
(Merged from https://github.com/openssl/openssl/pull/29924)
2026-02-04 10:54:49 -05:00
Dr. David von Oheimb
b235c756f1 crypto/{CMS,PKCS7,OCSP,TS,X509}: constify various cert list parameters
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/22304)
2026-02-04 13:51:19 +01:00
Dr. David von Oheimb
8db2649384 X509_ALGOR_set_md(): Add return value to indicate success or failure
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17495)
2026-02-04 13:44:40 +01:00
Milan Broz
d36cdcdce9 Fix const spec in ssl
This patch fixes several const specifiers and undeeded
casts (visible with non-default const-qual warning).

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Feb  3 17:26:31 2026
(Merged from https://github.com/openssl/openssl/pull/29799)
2026-02-03 12:26:23 -05:00
Alexandr Nedvedicky
1cc9298992 Fix broken build for non-gnu make
Ml-dsa provider module requires der_digests.h which is generated
from der_digets.h.in. The dependency must be explicitly set in
build.info otherwise the .h file is missing when
providers/common/der/der_ml_dsa_key.c gets compiled.

The issue seems to affect only make found in base system on OpenBSD.
gnu-make (a.k.a gmake) is not affected.

It got introduced by #175cda569d

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Tue Feb  3 17:13:36 2026
(Merged from https://github.com/openssl/openssl/pull/29853)
2026-02-03 12:13:25 -05:00
Dr. David von Oheimb
7dd4b69dde public API: Remove needless 'const' from scalar types
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18229)
2026-02-03 15:15:32 +01:00
Milan Broz
14819cf8bf Fix const spec in providers
This patch fixes several const specifiers
(visible with non-default const-qual warning).

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Feb  3 14:12:00 2026
(Merged from https://github.com/openssl/openssl/pull/29798)
2026-02-03 09:11:52 -05:00
kovan
109ee515c9 doc: add return value documentation for EVP_CIPHER_*_params functions
Document that EVP_CIPHER_get_params(), EVP_CIPHER_CTX_get_params() and
EVP_CIPHER_CTX_set_params() return 1 for success and 0 for failure.

Fixes #29725

CLA: trivial

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

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Feb  3 09:51:47 2026
(Merged from https://github.com/openssl/openssl/pull/29779)
2026-02-03 10:51:36 +01:00
kovan
88d39f33d1 doc: clarify OSSL_DISPATCH array usage in provider-base
The previous wording "arrays are indexed by numbers" was misleading
as it suggested direct array indexing. Clarify that OSSL_DISPATCH
entries contain a function_id field that identifies the function.

Fixes #27125

CLA: trivial

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

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Feb  3 09:48:02 2026
(Merged from https://github.com/openssl/openssl/pull/29769)
2026-02-03 10:47:25 +01:00
Tommy Chiang
59a62db65b SSL_CONF_FLAG: Prevent setting both CMDLINE and FILE flags
The `SSL_CONF_CTX_set_flags` function did not prevent setting both
`SSL_CONF_FLAG_CMDLINE` and `SSL_CONF_FLAG_FILE` flags, which is an
invalid combination. This commit adds a check to prevent this and
updates the documentation to clarify that only one of these flags
can be set.

A new test case is also added to verify the correct behavior.

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

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Feb  3 09:40:04 2026
(Merged from https://github.com/openssl/openssl/pull/29752)
2026-02-03 10:39:56 +01:00
Milan Broz
3cef0d98aa Update CONTRIBUTING.md for clang-format style
The old Perl tool no longer exists, mention clang-format
and utilities.

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

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

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Tue Feb  3 09:07:35 2026
(Merged from https://github.com/openssl/openssl/pull/29755)
2026-02-03 10:07:23 +01:00
Daniel Kubec
dc01d6cfa1 ASN.1: Raise additional errors in crl_set_issuers()
Additional ASN.1 parsing errors are now raised to the error stack,
allowing invalid CRLs to be rejected early with detailed error messages.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Feb  3 09:02:15 2026
(Merged from https://github.com/openssl/openssl/pull/29750)
2026-02-03 10:01:47 +01:00
Tomas Mraz
24b51ab61c Fix typo in CHANGES and NEWS entry for CVE-2019-1551
Fixes #12977

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Feb  3 08:56:59 2026
(Merged from https://github.com/openssl/openssl/pull/29740)
2026-02-03 09:56:50 +01:00
Tomas Mraz
75b06fd1e6 check_cert_crl(): Avoid potential UAF when using the value of current_crl
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
MergeDate: Tue Feb  3 08:50:53 2026
(Merged from https://github.com/openssl/openssl/pull/29679)
2026-02-03 09:50:50 +01:00
Bob Beck
c20ede00bb Ensure current_crl always points to the crl we are considering
As mentioned by Viktor Dukhovni, the desired behaviour is:

The current_crl is NULL when the running callback invocation is about errors
unrelated to validation failures via a particular CRL a user may want to
report the issuer of.

The current_crl is (whenever possible) not NULL when reporting errors
specifically related to that CRL.

The problem with this happens when we call check_crl with something that
is not what current_crl is set to. We can potentially enter the time check
code, and we then need to call the callback with the certificate that
failed the time check which is not current_crl.

Correct this by removing the dance in the time check code, and always
setting current_crl whenver we call check_crl.

This means that when we are considering a delta crl, we report the
correct crl to the callback, instead of possibly handing them NULL
(if they get called after a failing time check clobbers it), or the
non-delta crl (because we are looking at a delta while having
current_crl set to crl - which was why we had the dance in the time code
to begin with.  We don't need to change current_crl in the time check
code if we always have current_crl set to the thing we are evaluting.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Feb  3 08:50:52 2026
(Merged from https://github.com/openssl/openssl/pull/29679)
2026-02-03 09:50:50 +01:00
noctuelles
4b09d0d04e BIO_get_data.pod: Warn about use outside of a custom BIO implementation
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Feb  3 08:47:06 2026
(Merged from https://github.com/openssl/openssl/pull/29675)
2026-02-03 09:45:01 +01:00
Dr. David von Oheimb
1c6a5d46ff apps/cmp.c: fix help output and diagnostics in corner cases such as -reqout_only
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Feb  3 08:43:06 2026
(Merged from https://github.com/openssl/openssl/pull/28478)
2026-02-03 09:42:56 +01:00
Dr. David von Oheimb
43db29b222 80-test_cmp_http.t: improve diagnostics on failure getting server output
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Feb  3 08:43:04 2026
(Merged from https://github.com/openssl/openssl/pull/28478)
2026-02-03 09:42:56 +01:00
Dr. David von Oheimb
8eed141a82 openssl-cmp.pod.in: fix doc of -server uri argument and tweak doc of -tls_used
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Feb  3 08:43:03 2026
(Merged from https://github.com/openssl/openssl/pull/28478)
2026-02-03 09:42:11 +01:00
Dr. David von Oheimb
c797a57dd4 apps/cmp.c: avoid misleading warning with p10cr; add warnings on options ignored when not doing rr
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Feb  3 08:43:02 2026
(Merged from https://github.com/openssl/openssl/pull/28478)
2026-02-03 09:42:11 +01:00
Dr. David von Oheimb
a984275f16 apps/cmp.c: avoid misleading error on genm with -reqout_only
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Feb  3 08:43:00 2026
(Merged from https://github.com/openssl/openssl/pull/28478)
2026-02-03 09:42:11 +01:00
Dr. David von Oheimb
371b259013 apps/cmp.c: make error/warning/info/debug log output text lines consistently start upper-case
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Feb  3 08:42:59 2026
(Merged from https://github.com/openssl/openssl/pull/28478)
2026-02-03 09:42:10 +01:00
Dr. David von Oheimb
23ac9d9883 apps/cmp.c: tweak error and warning outputs, e.g., on ignored options and -rspin with too few args
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Feb  3 08:42:57 2026
(Merged from https://github.com/openssl/openssl/pull/28478)
2026-02-03 09:42:10 +01:00
Danny Tsen
5aaa7e5fdc aes-gcm-ppc.pl: Removed .localentry directive
Otherwise there is mixing of  ELFv1 ABI and ELFv2 ABI directives
and PPC64 big endian builds fail.

Fixes #29815

Signed-off-by: Danny Tsen <dtsen@us.ibm.com>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Feb  3 08:39:50 2026
(Merged from https://github.com/openssl/openssl/pull/29827)
2026-02-03 09:37:45 +01:00
Alexandr Nedvedicky
539c7a001d Add enable-tls-deprecated-ec option to keep provider compatibility
test happy.

Fixes openssl/project#1849

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Mon Feb  2 16:50:45 2026
(Merged from https://github.com/openssl/openssl/pull/29866)
2026-02-02 11:50:41 -05:00
Dr. David von Oheimb
7f503e882b ASN1_item_sign_ctx(): prevent crash due to wrong memory deallocation on d2i_X509_ALGOR() failure
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27737)
2026-02-02 08:10:44 +01:00
Neil Horman
de67b7cce9 Use fixed version of curl in quic-interop-container
As part of 6aaac9dd388a64d0f511544496608693e1105d13 in
https://github.com/curl/curl.git

Curl dropped support for using the quic-tls interface to use our quic
stack.  Because our interop testing relies on using curl to do testing,
our builds broke.

Until we can find an alternate client to do https transfers over
http3/quic, we need to back off our quic build point to a commit prior
to the above so we can maintain our interop testing.

Long term, we need to enhance our own http3 demo client to support the
download/resumption/etc features that we need for interop.  We're
tracking that effort in:
https://github.com/openssl/project/issues/1850

Fixes openssl/project#1848

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MergeDate: Fri Jan 30 12:20:11 2026
(Merged from https://github.com/openssl/openssl/pull/29857)
2026-01-29 13:30:57 -05:00
Neil Horman
257877448a Update test/README.md
Co-authored-by: Matt Caswell <matt@openssl.org>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jan 29 16:37:40 2026
(Merged from https://github.com/openssl/openssl/pull/29573)
2026-01-29 11:37:23 -05:00
Neil Horman
f4557e314f add valgrind supression file
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jan 29 16:37:37 2026
(Merged from https://github.com/openssl/openssl/pull/29573)
2026-01-29 11:37:23 -05:00
Neil Horman
8dbf306663 zero buffers in sslapitest
valgrind gripes about this, as its possible to reach the TEST_mem_eq
test without ever having initalized the buffer

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jan 29 16:37:35 2026
(Merged from https://github.com/openssl/openssl/pull/29573)
2026-01-29 11:37:23 -05:00
Neil Horman
9569582d5a initalize control block on dgram_sendmmsg
Passing uninitalized data to a syscall result in valgrind warnings, and
probably shouldn't be done anyway.  Fix that

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jan 29 16:37:32 2026
(Merged from https://github.com/openssl/openssl/pull/29573)
2026-01-29 11:37:23 -05:00
Neil Horman
0f6d2e5202 Exclude some tests from valgrind
Some tests (liek the mem_alloc and abort tests do things with malloc
intentionally as sanity checks that valgrind complains about, and so we
just shouldn't run those tests under valgrind at all

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jan 29 16:37:30 2026
(Merged from https://github.com/openssl/openssl/pull/29573)
2026-01-29 11:37:17 -05:00
Neil Horman
f4d96545c4 Update valgrind to use separate logs
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jan 29 16:37:28 2026
(Merged from https://github.com/openssl/openssl/pull/29573)
2026-01-29 11:37:17 -05:00
Neil Horman
40b01b815c Add a method to run our test suite under valgrind
As part of our effort to provide a supression file for valgrind that we
can maintain, we should have the ability to run our tests under
valgrind.

Add an environment variable OSSL_USE_VALGRIND to prefix all our app and
test executions with the valgrind tool so that we can run it
automatically

Fixes openssl/project#1801

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jan 29 16:37:26 2026
(Merged from https://github.com/openssl/openssl/pull/29573)
2026-01-29 11:37:17 -05:00
rainerjung
bb1f540d0f Fix coding style check by adding clang format exclusions
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Jan 29 14:22:55 2026
(Merged from https://github.com/openssl/openssl/pull/29817)
2026-01-29 09:22:41 -05:00
rainerjung
44699dcc69 Sparc asm: remove whitespace that breaks asm syntax in generated files
This fixes #29808.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Jan 29 14:22:50 2026
(Merged from https://github.com/openssl/openssl/pull/29817)
2026-01-29 09:22:41 -05:00
Ingo Franzki
66ead9927d s390x: EC: use OpenSSL's RNG for ECDSA nonce 'k' for FIPS module
The KDSA instruction can operate in 2 different modes:
- Deterministic mode - nonce 'k' is supplied by user.
- Non-deterministic mode - nonce 'k' is randomly generated by the instruction
  itself.

When running in the FIPS-Module, do not use KDSA's non-deterministic mode,
but generate the nonce 'k' using OpenSSL's random number generator. This
ensures that the nonce is generated using a FIPS-approved random number
generator.

It also makes the FIPS KAT tests work, because those use a pre-setup
deterministic random number generator to produce deterministic ECDSA
signatures even for non-deterministic mode.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29754)
2026-01-29 09:21:22 +11:00
kovan
e2f837410e doc: Add const to SSL_CTX_set1_groups/curves documentation
The set1_groups and set1_curves functions do not modify their input
arrays, so the documentation should reflect const-correct signatures.

Fixes #27422

CLA: trivial

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

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29762)
2026-01-29 09:11:00 +11:00
kovan
2815901f59 doc: Add deprecation note to SSL_get_peer_certificate description
Fixes #22972

CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29764)
2026-01-29 09:10:00 +11:00
kovan
8db1c93d5a doc: Clarify SSL_get_SSL_CTX returns internal pointer
Document that the returned pointer is internal, reference count is not
incremented, and should not be freed. Mention SSL_CTX_up_ref() for
callers who need to retain the SSL_CTX.

Fixes #28298

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

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29767)
2026-01-29 09:09:00 +11:00
kovan
5ebffe48b5 doc: add missing DH_check_pub_key documentation and fix typo
Add DH_check_pub_key to NAME and SYNOPSIS sections. Fix typo where
DH_check_params() was incorrectly written instead of DH_check_params_ex()
in the description of the _ex functions.

Also remove DH_check_pub_key from util/missingcrypto.txt since it is
now documented.

Fixes #8473

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

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29768)
2026-01-29 09:08:14 +11:00
kovan
98b60fa848 doc: Fix incorrect parameter reference in EVP_MAC
The "key" parameter documentation referenced a non-existent "algorithm"
parameter. Change to reference the actual "cipher" and "digest" parameters.

Fixes #12580

CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29766)
2026-01-29 09:06:44 +11:00
Eugene Syromiatnikov
ed57d1e06d test/evp_test.c: avoid resource leak in digest_test_run()
The function can return on ctrl2params() returning 0 without freeing
the allocated memory associated with the got pointer.  Fix it by jumping
to the err label that performs the cleanup instead of returning
immediately.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1680647
Fixes: 9c73843141 "Add support for CSHAKE."
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Jan 28 12:57:04 2026
(Merged from https://github.com/openssl/openssl/pull/29757)
2026-01-28 07:56:46 -05:00
Eugene Syromiatnikov
63f62bf4e5 srtpkdf.c: avoid ctx NULL dereference kdf_srtpkdf_set_ctx_params()
ctx is dereferenced before NULL check to obtain libctx.  Fix it
by moving the dereference after the NULL check.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1680648
Fixes: fe67753da4 "Add SRTPKDF implementation"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Jan 28 12:57:00 2026
(Merged from https://github.com/openssl/openssl/pull/29757)
2026-01-28 07:56:46 -05:00
Eugene Syromiatnikov
7ad410d6c6 crypto/bio/bf_buff.c: drop extraneous ctx NULL check in buffer_ctrl()
b->ptr cannot be NULL, so, the check is not needed, drop it.
Reported by Coverity as a potential NULL dereference in ctx->ibuf_len
access.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1680636
Fixes: f17230ae6c "Fix of EOF and retry handling in BIO implementations"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Jan 28 12:56:56 2026
(Merged from https://github.com/openssl/openssl/pull/29757)
2026-01-28 07:56:46 -05:00
Neil Horman
c91cf3a52f Update doc/man3/OPENSSL_init_crypto.pod
Co-authored-by: Matt Caswell <matt@openssl.org>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Jan 27 20:43:01 2026
(Merged from https://github.com/openssl/openssl/pull/29648)
2026-01-27 15:42:50 -05:00
Neil Horman
8751d7bb86 Fix documentation for OPENSSL_cleanup in pod files
Fixes openssl/project#1826

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Jan 27 20:42:58 2026
(Merged from https://github.com/openssl/openssl/pull/29648)
2026-01-27 15:42:50 -05:00
Neil Horman
1ef3cd84b6 Fix ubsan errors in OPENSSL_sk_pop_free
ubsan reports an error in the free callback function for
OPENSSL_sk_pop_free.

Need to add a thunking shim to cast the pointer data types to their
proper types

Fixes #29616

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jan 27 17:25:34 2026
(Merged from https://github.com/openssl/openssl/pull/29690)
2026-01-27 12:25:21 -05:00
Andrew Dinh
2c13bf1528 PKCS12_item_decrypt_d2i_ex(): Check oct argument for NULL
Fixes CVE-2025-69421

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 26 19:56:08 2026
2026-01-26 20:55:19 +01:00
Bob Beck
ea8fc4c345 Verify ASN1 object's types before attempting to access them
as a particular type

Issue was reported in ossl_ess_get_signing_cert but is also present in
ossl_ess_get_signing_cert_v2.

Fixes: https://github.com/openssl/srt/issues/61
Fixes CVE-2025-69420

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 26 19:53:36 2026
2026-01-26 20:53:20 +01:00
Norbert Pocs
be9375d5d4 Fix OCB AES-NI/HW stream path unauthenticated/unencrypted trailing bytes
When ctx->stream (e.g., AES‑NI or ARMv8 CE) is available, the fast path
encrypts/decrypts full blocks but does not advance in/out pointers. The
tail-handling code then operates on the base pointers, effectively reprocessing
the beginning of the buffer while leaving the actual trailing bytes
unencrypted (encryption) or using the wrong plaintext (decryption). The
authentication checksum excludes the true tail.

CVE-2025-69418

Fixes: https://github.com/openssl/srt/issues/58

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 26 19:48:35 2026
2026-01-26 20:47:37 +01:00
Igor Ustinov
84f73f79af Check the received uncompressed certificate length to prevent excessive
pre-decompression allocation.

The patch was proposed by Tomas Dulka and Stanislav Fort (Aisle Research).

Fixes: CVE-2025-66199

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 26 19:45:21 2026
2026-01-26 20:45:14 +01:00
Neil Horman
b21663c35a Fix heap buffer overflow in BIO_f_linebuffer
When a FIO_f_linebuffer is part of a bio chain, and the next BIO
preforms short writes, the remainder of the unwritten buffer is copied
unconditionally to the internal buffer ctx->obuf, which may not be
sufficiently sized to handle the remaining data, resulting in a buffer
overflow.

Fix it by only copying data when ctx->obuf has space, flushing to the
next BIO to increase available storage if needed.

Fixes openssl/srt#48

Fixes CVE-2025-68160

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 26 19:41:40 2026
2026-01-26 20:41:37 +01:00
Viktor Dukhovni
6028c0654e Report truncation in oneshot openssl dgst -sign
Previously input was silently truncated at 16MB, now if the input is
longer than limit, an error is reported.

The bio_to_mem() apps helper function was changed to return 0 or 1,
and return the size of the result via an output size_t pointer.

Fixes  CVE-2025-15469

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 26 19:37:41 2026
2026-01-26 20:37:35 +01:00
Daniel Kubec
293b55de0c ossl_quic_get_cipher_by_char(): Add a NULL guard before dereferencing SSL_CIPHER
Fixes CVE-2025-15468

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 26 19:36:04 2026
2026-01-26 20:35:49 +01:00
Igor Ustinov
6297ac45d7 Test for handling of AEAD-encrypted CMS with inadmissibly long IV
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 26 19:31:49 2026
2026-01-26 20:31:24 +01:00
Igor Ustinov
b1a995ebcf Some comments to clarify functions usage
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 26 19:31:47 2026
2026-01-26 20:31:24 +01:00
Igor Ustinov
0ddd6b6bcb Correct handling of AEAD-encrypted CMS with inadmissibly long IV
Fixes CVE-2025-15467

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 26 19:31:45 2026
2026-01-26 20:31:24 +01:00
Alicja Kario
192fd36cfa Additional PKCS12 PBMAC1 malformed testcase files
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Mon Jan 26 16:14:20 2026
2026-01-26 17:14:10 +01:00
Tomas Mraz
65ce85b7e3 Add testcase for PKCS12 with invalid PBMAC1 key length
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Alicja Kario <hkario@redhat.com>
MergeDate: Mon Jan 26 16:14:18 2026
2026-01-26 17:14:10 +01:00
Tomas Mraz
de157b8ff3 pkcs12: Validate salt and keylength in PBMAC1
The keylength value must be present and we accept
EVP_MAX_MD_SIZE at maximum.

The salt ASN.1 type must be OCTET STRING.

Fixes CVE-2025-11187

Reported by Stanislav Fort (Aisle Research) and Petr Simecek (Aisle Research).
Reported independently also by Hamza (Metadust).

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Alicja Kario <hkario@redhat.com>
MergeDate: Mon Jan 26 16:14:15 2026
2026-01-26 17:14:10 +01:00
Orgad Shaneh
4430162203 CI: Disable scheduled Fuzzing action in forks
There is no reason to run it in forks.

Similar to 6e5ce1ebb5.

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 26 15:47:57 2026
(Merged from https://github.com/openssl/openssl/pull/29660)
2026-01-26 16:47:50 +01:00
Daniel Kubec
7b9f20d94f ASN1: Fix type handling in AKID serial number conversion
The Authority Key Identifier's serial number field is an ASN1 integer, so use
the appropriate i2s_ASN1_INTEGER function instead of i2s_ASN1_OCTET_STRING
for string conversion. This fixes handling of negative serial numbers
which were previously displayed incorrectly.

While negative serial numbers are not RFC-compliant, we want to process
existing CRLs and certificates that may contain them, as this does not cause
any security issues. Rejecting invalid serial numbers during
generation is out of scope for this change.

Fixes #27406

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 26 15:29:33 2026
(Merged from https://github.com/openssl/openssl/pull/29717)
2026-01-26 16:29:26 +01:00
Anton Moryakov
a3e67efa01 crypto: x509: fix unreachable code in X509V3_get_section and X509V3_get_string
The functions X509V3_get_section() and X509V3_get_string() contain a
redundant null check after an identical check has already guaranteed
that the function pointer (ctx->db_meth->get_section / get_string) is
non-NULL. As a result, the final 'return NULL;' statement is unreachable.

This change removes the redundant condition and the dead code, improving
code clarity and eliminating warnings from static analyzers.

Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
MergeDate: Mon Jan 26 15:28:01 2026
(Merged from https://github.com/openssl/openssl/pull/29692)
2026-01-26 16:27:52 +01:00
Daniel Kubec
6d2f848f94 Added SSL_CTX_get0_alpn_protos() and SSL_get0_alpn_protos()
Fixes #4952

Co-authored-by: Pauli <ppzgs1@gmail.com>
Co-authored-by: Tomáš Mráz <tm@t8m.info>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 26 15:26:21 2026
(Merged from https://github.com/openssl/openssl/pull/29646)
2026-01-26 16:26:14 +01:00
Tomas Mraz
9ae1002d42 PROV_R_INVALID_FUNCTION_NAME: Fix colliding error reason code
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Jan 23 17:42:08 2026
(Merged from https://github.com/openssl/openssl/pull/29738)
2026-01-23 15:33:42 +01:00
slontis
9c73843141 Add support for CSHAKE.
Unlike SHAKE this has default values set for the xof length.

CSHAKE uses either SHAKE or KECCAK[c] depending on whether
custom strings are set or not. If either string is set, it encodes
the strings and uses KECCAK[c], otherwise it behaves the same as
SHAKE (without the default xof length problem).

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Fri Jan 23 14:07:53 2026
(Merged from https://github.com/openssl/openssl/pull/28432)
2026-01-23 15:07:51 +01:00
Milan Broz
3fa6bb2333 Remove disabled-optimization warning again
This warning does not play well in combination with sanitizers
and its value is dubious. Instead of complicated decisions
based on configuration flags just remove it from global list.

Fixes: #29673

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

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Jan 23 14:00:29 2026
(Merged from https://github.com/openssl/openssl/pull/29714)
2026-01-23 15:00:22 +01:00
Tomas Mraz
070c036623 rsa_enc.c: Properly duplicate the oaep_label member
Otherwise UAF and doublefree appears when the duplicate
is freed.
Reported by Tomas Dulka and Stanislav Fort (Aisle Research)

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Jan 23 10:37:36 2026
(Merged from https://github.com/openssl/openssl/pull/29707)
2026-01-23 11:37:25 +01:00
Tomas Mraz
b5c45d8407 rsa_sig.c: Properly duplicate the sig member
Otherwise UAF and doublefree appears when the duplicate
is freed.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Jan 23 10:37:34 2026
(Merged from https://github.com/openssl/openssl/pull/29707)
2026-01-23 11:37:25 +01:00
Tomas Mraz
cf29b4194e Correct alert when extended master secret support is dropped
When resuming session with the extended master secret support
dropped we should use SSL_AD_HANDSHAKE_FAILURE instead of
SSL_AD_ILLEGAL_PARAMETER according to the RFC7627 section 5.

Fixes #9791

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Jan 23 10:33:12 2026
(Merged from https://github.com/openssl/openssl/pull/29706)
2026-01-23 11:32:58 +01:00
Daniel Kubec
f5f8571119 DOC: Add EVP_CIPHER_CTX_{get,set}_app_data documentation
Fixes #9788

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Fri Jan 23 10:27:16 2026
(Merged from https://github.com/openssl/openssl/pull/29704)
2026-01-23 11:27:05 +01:00
Helen Zhang
fe67753da4 Add SRTPKDF implementation
In compliance with RFC 3711, Section 4.3.3

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Fri Jan 23 10:19:32 2026
(Merged from https://github.com/openssl/openssl/pull/29435)
2026-01-23 11:19:31 +01:00
Daniel Kubec
d2a126c20e DOC: Clarify EVP_PKEY_CTX_{get,set}_app_data documentation
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
MergeDate: Fri Jan 23 10:14:10 2026
(Merged from https://github.com/openssl/openssl/pull/29710)
2026-01-23 11:14:00 +01:00
Neil Horman
a4148379a8 check-news-changes.yml: Fix the label check
The yaml for the check-news-changes CI job had an error in the step
conditional that prevented skipping the check if the
no_news_changes_needed flag was set.  Fix that.

While we're add it, also add some debug code so that we can better see
what the checks are looking at during the CI job.

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Jan 22 17:19:07 2026
(Merged from https://github.com/openssl/openssl/pull/29705)
2026-01-22 18:18:40 +01:00
Igor Ustinov
f17230ae6c Fix of EOF and retry handling in BIO implementations
Added handling for negative length in read functions.

Fixes openssl/project#1739

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Jan 22 17:12:37 2026
(Merged from https://github.com/openssl/openssl/pull/29401)
2026-01-22 18:12:13 +01:00
SiteRelEnby
045ca33cef Fix NULL pointer dereference when zlib DSO fails to load
When ZLIB_SHARED is defined and DSO_load() fails to load the zlib
library, ossl_comp_zlib_init() incorrectly returns 1 (success) while
leaving all function pointers (p_compress, p_uncompress, etc.) as NULL.

This causes COMP_zlib() and COMP_zlib_oneshot() to return valid-looking
COMP_METHOD pointers, but when these methods are used (e.g., during
TLS 1.3 certificate decompression), the NULL function pointers are
dereferenced, causing a SIGSEGV crash.

The bug occurs because the NULL pointer check (lines 297-303) was inside
the `if (zlib_dso != NULL)` block, so it was skipped entirely when
DSO_load() returned NULL.

The fix moves the NULL pointer check outside the conditional block,
consistent with how c_brotli.c and c_zstd.c handle this case. Now if
the DSO fails to load, all function pointers remain NULL, the check
catches this, and the function correctly returns 0 (failure).

This also fixes an incorrect cast of p_uncompress from compress_ft to
the correct uncompress_ft type.

PoC demonstrating the bug: https://github.com/SiteRelEnby/openssl-zlib-poc

Fixes #23563

CLA: trivial

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Jan 22 17:00:50 2026
(Merged from https://github.com/openssl/openssl/pull/29699)
2026-01-22 18:00:26 +01:00
JohnnySavages
c53d784272 Remove unnecessary post-increment
Found by Linux Verification Center (linuxtesting.org) with SVACE.

CLA:trivial

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jan 22 10:10:51 2026
(Merged from https://github.com/openssl/openssl/pull/29456)
2026-01-22 11:10:42 +01:00
Alexandr Nedvedicky
d15e717722 Explain the purpose of _WIN32_WINNT macro and how it is supposed to be used
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Jan 22 10:04:08 2026
(Merged from https://github.com/openssl/openssl/pull/29614)
2026-01-22 11:04:06 +01:00
Dmitry Belyavskiy
4933e83f32 Deprecate support of weak elliptic curves in TLS by default
See RFC 8422, section 5.1.1

Reviewed-by: Alicja Kario <hkario@redhat.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Jan 22 10:00:08 2026
(Merged from https://github.com/openssl/openssl/pull/29658)
2026-01-22 11:00:05 +01:00
Milan Broz
b3fbf9da79 Add float-conversion to default strict warnings
As discussed, bad-function-cast and conversion produces strange results.

Add at least float-conversion - Warn for implicit conversions that reduce
the precision of a real value.

Also fix ct_test absolute value seconds calculation (without using math.h)
and then converts is to time_t.
(n.b. this is not stricly needed for the relaxed warnings, but it is more readable)

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

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

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jan 22 09:58:07 2026
(Merged from https://github.com/openssl/openssl/pull/29663)
2026-01-22 10:57:55 +01:00
Eugene Syromiatnikov
41329aba52 Drop darwin-ppc{,64} targets
PowerPC support has been dropped in Mac OS X with the release of Mac OS
X Lion (10.7) in 2010, and the last supporting release, Snow Leopard
(10.6.x) is out of support since 2011.
Also remove Rhapsody (the Mac OS X precursor) targets.

Complements: https://github.com/openssl/openssl/pull/29653
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jan 22 09:55:26 2026
(Merged from https://github.com/openssl/openssl/pull/29672)
2026-01-22 10:54:17 +01:00
Neil Horman
18ca04616f Update SHA384_Update to do thunking
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29650)
2026-01-22 09:40:35 +11:00
Neil Horman
11e1a4841a convert SHA512_Update to do thunking
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29650)
2026-01-22 09:40:35 +11:00
Neil Horman
1f2ae01f5b Send SHA224_Update through the aproproate thunk
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29650)
2026-01-22 09:40:35 +11:00
Neil Horman
8dfa6cdc26 Convert SHA1_Update in the same manner as SHA256_Update
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29650)
2026-01-22 09:40:35 +11:00
Neil Horman
85f6102785 Do thunking of SHA256_Update
The SHA256_Update function (in fact all functions implemented via the
HASH_UPDATE macro) have mismatched prototypes with the
OSSL_FUNC_digest_update_fn.

This leads to ubsan errors with more recent versions of clang

Create a Thunk that does the proper casting on those function pointer
callbacks

Fixes #29615

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29650)
2026-01-22 09:40:35 +11:00
Dimitri John Ledkov
b2ecef451c fips: Upgrade KAT ECDSA curves to minimum 128bits
Upgrade prime ECDSA self tests from secp224r1 to prime256v1.
Upgrade binary ECDSA self tests from sect233r1 to sect283r1.

This is forward looking change to allow raising the lower bound in
ossl_ec_check_security_strength() /
OSSL_FIPS_MIN_SECURITY_STRENGTH_BITS in case legacy/deprecated
behaviour is not needed to be supported (for example builds with
support for primary curves only of P-256 or higher).

Did a test build to ensure that updating
OSSL_FIPS_MIN_SECURITY_STRENGTH_BITS to 128 passes fips
selftests. Note not currently recommended.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29674)
2026-01-21 11:06:12 +11:00
JohnnySavages
ab1b8837c6 Change evp_keymgmt_util_clear_operation_cache return type to void
Found by Linux Verification Center (linuxtesting.org) with SVACE.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29458)
2026-01-21 09:15:07 +11:00
Zijie Zhao
c729de6ec3 Fix EVP_KEYMGMT leak in evp_pkey_signature_init() error paths
Early returns when signature/key type are incompatible bypass cleanup
of `tmp_keymgmt` allocated via `evp_keymgmt_fetch_from_prov()`. Use goto
to ensure `EVP_KEYMGMT_free()` is called on all error paths.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Jan 20 19:01:17 2026
(Merged from https://github.com/openssl/openssl/pull/29651)
2026-01-20 20:01:11 +01:00
Milan Broz
8bf30b21bd Fix type-limits and add this warning to default strict warnings
One mistake recently introduced in commit b6aed64e47.

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

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

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue Jan 20 18:44:58 2026
(Merged from https://github.com/openssl/openssl/pull/29662)
2026-01-20 19:44:52 +01:00
Milan Broz
06304d4f4f Fix unterminated-string-initialization and add this warning to strict warnings
The -Wunterminated-string-initialization is a strange gcc warning,
as C99 allows non-nul string initialization.
Note, it is included in -Wextra, but does not exist in old gcc versions.

However, it can report other real bugs.

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

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

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Jan 20 18:43:39 2026
(Merged from https://github.com/openssl/openssl/pull/29661)
2026-01-20 19:43:12 +01:00
Zijie Zhao
72029afd91 Fix double-free in TLS1-PRF KDF when digest change fails
When changing the digest from MD5-SHA1 to a non-MD5-SHA1 digest,
`ctx->P_sha1` is freed but not set to NULL. If `ossl_prov_macctx_load()`
subsequently fails, `ctx->P_sha1` remains as a dangling pointer.
When the context is later freed via `kdf_tls1_prf_reset()`, this
causes a double-free.

Fix by setting `ctx->P_sha1` to NULL immediately after freeing it.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Jan 20 18:21:38 2026
(Merged from https://github.com/openssl/openssl/pull/29649)
2026-01-20 19:21:32 +01:00
Konstantin Bogdanov
06666f0d54 Zero out memory after allocation to avoid usage of uninitialized memory
==1155903==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x5571e03fe712 in ASN1_get_object cmake-build-release-msan/./contrib/openssl/crypto/asn1/asn1_lib.c:62:11
    #1 0x5571e0408981 in asn1_check_tlen cmake-build-release-msan/./contrib/openssl/crypto/asn1/tasn_dec.c:1164:13
    #2 0x5571e04048c8 in asn1_item_embed_d2i cmake-build-release-msan/./contrib/openssl/crypto/asn1/tasn_dec.c:346:15
    #3 0x5571e04043ba in asn1_item_ex_d2i_intern cmake-build-release-msan/./contrib/openssl/crypto/asn1/tasn_dec.c:118:10
    #4 0x5571e04043ba in ASN1_item_d2i_ex cmake-build-release-msan/./contrib/openssl/crypto/asn1/tasn_dec.c:144:9
    #5 0x5571e04043ba in ASN1_item_d2i cmake-build-release-msan/./contrib/openssl/crypto/asn1/tasn_dec.c:154:12
    #6 0x5571e08460ad in ossl_epki2pki_der_decode cmake-build-release-msan/./contrib/openssl/providers/implementations/encode_decode/decode_epki2pki.c:161:13
    #7 0x5571e084c5a3 in pem2der_decode cmake-build-release-msan/./contrib/openssl/providers/implementations/encode_decode/decode_pem2der.c:227:18
    #8 0x5571e053827e in decoder_process cmake-build-release-msan/./contrib/openssl/crypto/encode_decode/decoder_lib.c:1101:14
    #9 0x5571e0537016 in OSSL_DECODER_from_bio cmake-build-release-msan/./contrib/openssl/crypto/encode_decode/decoder_lib.c:82:10
    #10 0x5571e067f5c4 in pem_read_bio_key_decoder cmake-build-release-msan/./contrib/openssl/crypto/pem/pem_pkey.c:60:13
    #11 0x5571e067f5c4 in pem_read_bio_key cmake-build-release-msan/./contrib/openssl/crypto/pem/pem_pkey.c:241:11
    #12 0x5571e06801d3 in PEM_read_bio_PrivateKey_ex cmake-build-release-msan/./contrib/openssl/crypto/pem/pem_pkey.c:304:12
    #13 0x5571e0350beb in SSL_CTX_use_PrivateKey_file cmake-build-release-msan/./contrib/openssl/ssl/ssl_rsa.c:415:16
    #14 0x5571dd4dfa6a in Poco::Net::Context::init(Poco::Net::Context::Params const&) cmake-build-release-msan/./base/poco/NetSSL_OpenSSL/src/Context.cpp:296:14
    #15 0x5571dd4deb28 in Poco::Net::Context::Context(Poco::Net::Context::Usage, Poco::Net::Context::Params const&) cmake-build-release-msan/./base/poco/NetSSL_OpenSSL/src/Context.cpp:54:2
    #16 0x5571dd4f5c2d in Poco::Net::SSLManager::initDefaultContext(bool) cmake-build-release-msan/./base/poco/NetSSL_OpenSSL/src/SSLManager.cpp:287:34
    #17 0x5571dd4f220b in Poco::Net::SSLManager::defaultServerContext() cmake-build-release-msan/./base/poco/NetSSL_OpenSSL/src/SSLManager.cpp:125:3
    #18 0x5571cf03e24e in DB::CertificateReloader::findOrInsert(ssl_ctx_st*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) cmake-build-release-msan/./src/Server/CertificateReloader.cpp:134:57
    #19 0x5571cf038968 in DB::CertificateReloader::tryLoadImpl(Poco::Util::AbstractConfiguration const&, ssl_ctx_st*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) cmake-build-release-msan/./src/Server/CertificateReloader.cpp:202:19
    #20 0x5571cf0377be in DB::CertificateReloader::tryLoad(Poco::Util::AbstractConfiguration const&, ssl_ctx_st*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) cmake-build-release-msan/./src/Server/CertificateReloader.cpp:117:5
    #21 0x5571cf0377be in DB::CertificateReloader::tryLoad(Poco::Util::AbstractConfiguration const&) cmake-build-release-msan/./src/Server/CertificateReloader.cpp:104:5
    #22 0x5571a6dd25b6 in DB::Server::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) cmake-build-release-msan/./programs/server/Server.cpp:2548:37
    #23 0x5571dd55924b in Poco::Util::Application::run() cmake-build-release-msan/./base/poco/Util/src/Application.cpp:315:8
    #24 0x5571a6d7be66 in DB::Server::run() cmake-build-release-msan/./programs/server/Server.cpp:660:25
    #25 0x5571dd5a373a in Poco::Util::ServerApplication::run(int, char**) cmake-build-release-msan/./base/poco/Util/src/ServerApplication.cpp:131:9
    #26 0x5571a6d73b43 in mainEntryClickHouseServer(int, char**) cmake-build-release-msan/./programs/server/Server.cpp:447:20
    #27 0x55718152671d in main cmake-build-release-msan/./programs/main.cpp:380:21
    #28 0x7feb2b627634 in __libc_start_call_main /usr/src/debug/glibc/glibc/csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #29 0x7feb2b6276e8 in __libc_start_main /usr/src/debug/glibc/glibc/csu/../csu/libc-start.c:360:3
    #30 0x55718148ce6d in _start (/home/thevar1able/nvmemount/clickhouse/cmake-build-release-msan/programs/clickhouse+0xa889e6d) (BuildId: 0ab37401c8c27a02d94eb81b9cc50d79736b4266)

  Uninitialized value was created by a heap allocation
    #0 0x55718151d58d in malloc (/home/thevar1able/nvmemount/clickhouse/cmake-build-release-msan/programs/clickhouse+0xa91a58d) (BuildId: 0ab37401c8c27a02d94eb81b9cc50d79736b4266)
    #1 0x5571e0634a19 in CRYPTO_malloc cmake-build-release-msan/./contrib/openssl/crypto/mem.c:211:11
    #2 0x5571e06840ef in PKCS12_pbe_crypt_ex cmake-build-release-msan/./contrib/openssl/crypto/pkcs12/p12_decr.c:78:16
    #3 0x5571e0845f0a in ossl_epki2pki_der_decode cmake-build-release-msan/./contrib/openssl/providers/implementations/encode_decode/decode_epki2pki.c:143:18
    #4 0x5571e084c5a3 in pem2der_decode cmake-build-release-msan/./contrib/openssl/providers/implementations/encode_decode/decode_pem2der.c:227:18
    #5 0x5571e053827e in decoder_process cmake-build-release-msan/./contrib/openssl/crypto/encode_decode/decoder_lib.c:1101:14
    #6 0x5571e0537016 in OSSL_DECODER_from_bio cmake-build-release-msan/./contrib/openssl/crypto/encode_decode/decoder_lib.c:82:10
    #7 0x5571e067f5c4 in pem_read_bio_key_decoder cmake-build-release-msan/./contrib/openssl/crypto/pem/pem_pkey.c:60:13
    #8 0x5571e067f5c4 in pem_read_bio_key cmake-build-release-msan/./contrib/openssl/crypto/pem/pem_pkey.c:241:11
    #9 0x5571e06801d3 in PEM_read_bio_PrivateKey_ex cmake-build-release-msan/./contrib/openssl/crypto/pem/pem_pkey.c:304:12
    #10 0x5571e0350beb in SSL_CTX_use_PrivateKey_file cmake-build-release-msan/./contrib/openssl/ssl/ssl_rsa.c:415:16
    #11 0x5571dd4dfa6a in Poco::Net::Context::init(Poco::Net::Context::Params const&) cmake-build-release-msan/./base/poco/NetSSL_OpenSSL/src/Context.cpp:296:14
    #12 0x5571dd4deb28 in Poco::Net::Context::Context(Poco::Net::Context::Usage, Poco::Net::Context::Params const&) cmake-build-release-msan/./base/poco/NetSSL_OpenSSL/src/Context.cpp:54:2
    #13 0x5571dd4f5c2d in Poco::Net::SSLManager::initDefaultContext(bool) cmake-build-release-msan/./base/poco/NetSSL_OpenSSL/src/SSLManager.cpp:287:34
    #14 0x5571dd4f220b in Poco::Net::SSLManager::defaultServerContext() cmake-build-release-msan/./base/poco/NetSSL_OpenSSL/src/SSLManager.cpp:125:3
    #15 0x5571cf03e24e in DB::CertificateReloader::findOrInsert(ssl_ctx_st*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) cmake-build-release-msan/./src/Server/CertificateReloader.cpp:134:57
    #16 0x5571cf038968 in DB::CertificateReloader::tryLoadImpl(Poco::Util::AbstractConfiguration const&, ssl_ctx_st*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) cmake-build-release-msan/./src/Server/CertificateReloader.cpp:202:19
    #17 0x5571cf0377be in DB::CertificateReloader::tryLoad(Poco::Util::AbstractConfiguration const&, ssl_ctx_st*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) cmake-build-release-msan/./src/Server/CertificateReloader.cpp:117:5
    #18 0x5571cf0377be in DB::CertificateReloader::tryLoad(Poco::Util::AbstractConfiguration const&) cmake-build-release-msan/./src/Server/CertificateReloader.cpp:104:5
    #19 0x5571a6dd25b6 in DB::Server::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) cmake-build-release-msan/./programs/server/Server.cpp:2548:37
    #20 0x5571dd55924b in Poco::Util::Application::run() cmake-build-release-msan/./base/poco/Util/src/Application.cpp:315:8
    #21 0x5571a6d7be66 in DB::Server::run() cmake-build-release-msan/./programs/server/Server.cpp:660:25

CLA: trivial

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Jan 20 18:19:16 2026
(Merged from https://github.com/openssl/openssl/pull/29647)
2026-01-20 19:18:57 +01:00
Viktor Dukhovni
aa4802204b Enable signing of empty files with pkeyutl
The allocated buffer for the file contents is then zero bytes long,
which `app_malloc()` used to refuse.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Jan 20 18:17:12 2026
(Merged from https://github.com/openssl/openssl/pull/29613)
2026-01-20 19:17:06 +01:00
Josh Holtrop
233e181058 Fix openssl-cms man page references to -EncryptedData_encrypt option
CLA: trivial

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Jan 20 18:06:27 2026
(Merged from https://github.com/openssl/openssl/pull/27996)
2026-01-20 19:06:17 +01:00
Daniel Kubec
4fb0e0b47a Drop darwin-i386(-cc) targets from Configurations
Fixes #18515

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Jan 20 12:12:43 2026
(Merged from https://github.com/openssl/openssl/pull/29653)
2026-01-20 13:12:34 +01:00
Tomas Mraz
bcc33dfcd9 Rename test_base64_simdutf to base64_simdutf_test
The new name is better for consistency with other tests.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Mon Jan 19 14:20:35 2026
(Merged from https://github.com/openssl/openssl/pull/29550)
2026-01-19 14:15:35 +00:00
Tomas Mraz
a27b2ca26a base64 encoder: Make ctx->length a constant
It is never changed anywhere.

Fixes #29518

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Mon Jan 19 14:20:35 2026
(Merged from https://github.com/openssl/openssl/pull/29550)
2026-01-19 14:15:35 +00:00
Tomas Mraz
84eb1d3ac2 b64_ctrl(): Do not try to call EVP_Encode functions when not writing
The BIO_CTRL_FLUSH should just forward the call to the underlying
BIOs when not writing.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Mon Jan 19 14:20:35 2026
(Merged from https://github.com/openssl/openssl/pull/29550)
2026-01-19 14:15:22 +00:00
Dmitry Belyavskiy
3f4a593350 Adjust documentation of EVP_SKEY_import_raw_key
Fixes #29509

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Mon Jan 19 14:12:01 2026
(Merged from https://github.com/openssl/openssl/pull/29546)
2026-01-19 14:12:12 +00:00
Bob Beck
51ba3bb8c3 Constify the X509_STORE_CTX argument to the lookup_certs functions.
The justification for this not being const was because of
lookup_certs_sk(). The reasons this function could not have a
const store, is that it set the ctx's error code
when we could not allocate memory and returned NULL.

However, the other lookup_certs function, X509_STORE_CTX_get1_certs,
already does not set this error code when failing to allocate
memory on a return.

Given that you can't depend on the out of memory error code being
set in the general case, and the Beyonce rule appears to indicate
that nobody likes this behaviour (as nobody put a test on it) I
think it's safe to say we should just not modify the ctx, and
constify it.

For #28654

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Mon Jan 19 12:03:05 2026
(Merged from https://github.com/openssl/openssl/pull/29488)
2026-01-19 12:02:24 +00:00
Ryan Keane
da5d7f9073 fix: Fix uninstall_dev failing to remove empty dir
Fix this error:
```
rmdir "$PREFIX/lib64/cmake/OpenSSL"
rmdir "$PREFIX/lib64"
rmdir: failed to remove '$PREFIX/lib64': Directory not empty
```
Because `rmdir $PREFIX/lib64/cmake` is missing

CLA: trivial
Signed-off-by: Ryan Keane <the.ra2.ifv@gmail.com>

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Mon Jan 19 11:58:05 2026
(Merged from https://github.com/openssl/openssl/pull/29472)
2026-01-19 11:57:45 +00:00
shridhar kalavagunta
9547ac72f0 Fixes issue 28885
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Mon Jan 19 11:55:58 2026
(Merged from https://github.com/openssl/openssl/pull/29297)
2026-01-19 11:55:39 +00:00
Joshua Rogers
c64912cd59 Clear addr_iter on reset in bss_conn
Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28915)
2026-01-19 11:36:33 +00:00
Joshua Rogers
eb84d81e93 Clear addr_iter on reset in bss_acpt
Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28915)
2026-01-19 11:36:33 +00:00
Nikola Pajkovsky
c098f72990 update fuzz/corpora submodule
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/29670)
2026-01-19 09:42:45 +01:00
Dr. David von Oheimb
85bc702cad util/ and .ctags.d/: remove remaining references to deleted util/check-format.pl
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29655)
2026-01-19 08:12:45 +01:00
slontis
fe874fcf0d KDF: Add configuration options to disable many of the KDF algorithms.
This includes KDF's for ss,x963,hmac-drbg,KB,KRB5,PVK,SNMP,SSH and X942.
SSKDF/X963KDF Changes: Modify code to handle algorithms being disabled via configuration options.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29576)
2026-01-19 15:51:45 +11:00
slontis
68424f565d Make OpenSSL generated error files use the current clang-format.
Anytime a new error code is added it generates error related files.
These are generated using a perl script which used readable indenting.
The indenting has been removed.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29631)
2026-01-19 13:56:16 +11:00
Dimitri John Ledkov
5983b3210c rand_lib: do not silently ignore custom seed source failures
If a custom seed source is specified in the config file, it can be
silently ignored. For example if it is missing, fails to be created,
or fails to initialize it can be silently ignored and fallback to os
entropy instead.

To reproduce this, perform default configuration of openssl without
jitter entropy source, and then specify jitter entropy
source. Currently entropy will fall back to getrandom, instead of
erroring out.

This is not unique to jitter entropy source, there are a few other
entropy source providers out there on the market, and in all cases if
one is configuring OpenSSL to use a given seed source by name, it
should be honored.

Currently this will output a fresh rsa key, with this change however
it will now result in an error:

```
./Configure
make
./util/wrap.pl -jitter ./apps/openssl genrsa
Warning: generating random key material may take a long time
if the system has a poor entropy source
genrsa: Error generating RSA key
80ABAB8F9F7F0000:error:0308010C:digital envelope routines:inner_evp_generic_fetch:unsupported:crypto/evp/evp_fetch.c:375:Global default library context, Algorithm (JITTER : 0), Properties (<null>)
80ABAB8F9F7F0000:error:12000090:random number generator:rand_new_seed:unable to fetch drbg:crypto/rand/rand_lib.c:613:
80ABAB8F9F7F0000:error:0308010C:digital envelope routines:inner_evp_generic_fetch:unsupported:crypto/evp/evp_fetch.c:375:Global default library context, Algorithm (JITTER : 0), Properties (<null>)
80ABAB8F9F7F0000:error:12000090:random number generator:rand_new_seed:unable to fetch drbg:crypto/rand/rand_lib.c:613:
```

IMHO, if a user is configuring a custom seed source, it should be
honored without silently eating errors.

Note this partially reverts 1d180bbe8e
"rand: allow seed-src to be missing", which as far as I understand was
done to ensure that fallback seedsource is allowed to be missing. This
new implementation preserves this behaviour by ensuring error is not
raised if SEED-SRC (which since the above commit was changed to a
macro define OPENSSL_DEFAULT_SEED_SRC) is used as a fallback, and it
fails to be fetched. Previously all errors were popped unconditionaly,
thus same behaviour is preserved if SEED-SRC is completely missing and
it wasn't configured in the config file. cc @paulidale, also see: -
https://github.com/openssl/openssl/pull/13640

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29316)
2026-01-19 07:48:36 +11:00
Dmitry Belyavskiy
54d175c7d5 Disabling explicit EC curves encoding
In case the parameters don't exactly match the well-known ones

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Simo Sorce <simo@redhat.com>
(Merged from https://github.com/openssl/openssl/pull/29639)
2026-01-17 10:31:43 +01:00
Kurt Roeckx
09c2bc5f6c Remove support for SSLv2 Client Hello
Drop support for the SSLv2 Client Hello. We allowed that a client send
an SSLv2 compatible Client Hello.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Alicja Kario <hkario@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28041)
2026-01-16 15:52:49 +00:00
Neil Horman
90d6c3b260 Fix make check-format target
With our move to clang-format we no longer have a check-format script,
and so this make target is broken.

Fix it up to use clang-format-diff instead

Fixes #29594

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Jan 16 14:37:09 2026
(Merged from https://github.com/openssl/openssl/pull/29634)
2026-01-16 09:37:05 -05:00
Igor Ustinov
ca20e54e86 SSL_CTX_is_server() was added.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Jan 16 13:19:25 2026
(Merged from https://github.com/openssl/openssl/pull/29635)
2026-01-16 14:19:18 +01:00
Pauli
22e1d8971b test: fix tests in lightof test_strn2_ removals
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29627)
2026-01-16 08:31:21 +11:00
Pauli
c90e160fe2 test: fix endecode_test in light of test_strn2 removal
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29627)
2026-01-16 08:31:21 +11:00
Pauli
b79ec4cb22 test: get rid of the TEST_strn2_ functions
Their semantics are poorly defined and they are rarely used.  The _ne
version being completely unused & tricky to define properly.

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29627)
2026-01-16 08:31:20 +11:00
Neil Horman
84ee443446 Fix search pattern in check-news-changes CI job
The check for impacting a public api had an incorrect pattern in the
search, leading to erroneous failures.  Fix it up.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jan 15 17:14:30 2026
(Merged from https://github.com/openssl/openssl/pull/29636)
2026-01-15 12:14:25 -05:00
Milan Broz
f99eff7055 Add disabled-optimization and pointer-arith to compiler warnings
These flags seems not to be part of -Wextra, but looks like
could be useful in CI. According to gcc man page:

 disabled-optimization
  Warn if a requested optimization pass is disabled.

 pointer-arith
  Warn about anything that depends on the "size of" a function
  type or of "void".

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

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

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Thu Jan 15 16:16:40 2026
(Merged from https://github.com/openssl/openssl/pull/29622)
2026-01-15 17:16:24 +01:00
Viktor Dukhovni
e57f7941af Expose and report EC curve field degrees
Expose the EC field degree as a gettable parameter for both provided
and legacy EC keys.  In the latter case, drop a spurious assertion,
since even in debug builds an application may try to get an unknown
parameter, and this should return an error rather than abort.

In the EC `TEXT` encoding format, instead of reporting the bit count of
the group order, report the field degree (which matches the size number
in the curve's name when present) and also the symmetric-equivalent
security-bits (adjusted down the the standard numbers (80, 112, 128,
192, 256).

Along the way, add a missing getter method for the EC_GROUP security
bits.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Thu Jan 15 16:10:26 2026
(Merged from https://github.com/openssl/openssl/pull/29539)
2026-01-15 17:10:12 +01:00
Dmitry Belyavskiy
b6a281b75f Simultaneous derivation of several EVP_SKEY objects
A proposed design for using EVP_SKEY objects in the TLS stack

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Simo Sorce <simo@redhat.com>
(Merged from https://github.com/openssl/openssl/pull/29160)
2026-01-15 14:18:05 +01:00
Alexandr Nedvedicky
c478df55d5 BIO_FLAGS_BASE64_NO_NL ignored by b64_write() in OpenSSL 4.0.0
Fixes #29618

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29629)
2026-01-15 11:06:27 +01:00
Nikola Pajkovsky
7e535fe6b1 apps: check OPENSSL_uni2utf8 return value
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29590)
2026-01-14 11:26:59 +01:00
Norbert Pocs
2bc0ee0400 github/workflows: Update checkout@v5 to v6
New version is out.

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

Reviewed-by: Dmitry Misharov <dmitry@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29566)
2026-01-14 10:27:17 +01:00
slontis
175cda569d ML-DSA: Add a digest that can calculate external mu.
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29223)
2026-01-14 18:15:12 +11:00
Neil Horman
faf48d097b Update .github/workflows/check-news-changes.yml
Co-authored-by: Pocs Norbert <norbertpocs0@gmail.com>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jan 13 19:17:42 2026
(Merged from https://github.com/openssl/openssl/pull/29536)
2026-01-13 14:17:34 -05:00
Neil Horman
4e1ee1662a Add script to aid scanning of a release branch for missed NEWS/CHANGES
Add script to run over a commit range looking for PR's that didn't add a
NEWS/CHANGES entry, but perhaps should have.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jan 13 19:17:39 2026
(Merged from https://github.com/openssl/openssl/pull/29536)
2026-01-13 14:17:26 -05:00
Neil Horman
7f51fd8ef7 Create a simple check for suggesting NEWS/CHANGES additions
During a release cycle we always wind up going through our git history
to try make sure we caught all the stuff that needed a CHANGES/NEWS
entry.  Lets try make that at least a little more automated here.  PR's
that reference CVEs, come from feature branches or impact public apis
generally need a NEWS/CHANGES entry, so lets flag those during CI.  It
should serve as a reminder to add entries to NEWS/CHANGES to prs meeting
the above criteria, and can be ignored via the application of the
no_news_changes_needed label to the PR.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Tue Jan 13 19:17:37 2026
(Merged from https://github.com/openssl/openssl/pull/29536)
2026-01-13 14:17:26 -05:00
Bob Beck
c082649033 Ensure ASN1 types are checked before use.
Some of these were fixed by LibreSSL in commit aa1f637d45
this fix includes the other fixes in that commit, as well as fixes for others found by a scan
for a similar unvalidated access paradigm in the tree.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29582)
2026-01-13 12:11:18 +01:00
slontis
a62d247888 Add clang-format file exclusions for generated files related to OBJ
objects.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Jan 13 10:13:37 2026
(Merged from https://github.com/openssl/openssl/pull/29599)
2026-01-13 11:13:33 +01:00
slontis
9bd2f96139 Add an OID for "id-alg-hss-lms-hashsig"
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Tue Jan 13 10:13:35 2026
(Merged from https://github.com/openssl/openssl/pull/29599)
2026-01-13 11:13:33 +01:00
Eugene Syromiatnikov
4d3d1c9f01 ml_dsa_kmgmt: check params against len and not pointers in ml_dsa_key_fromdata
The rest of the function conditions the presence/usage of pk/seed/sk
on the non-zeroness of pk_len/seed_len/sk_len, respectively, so perform
the *_len checks in a similar fashion;  that makes it in line
with the similarly written ml_kem_key_fromdata() and stops giving Coverity
ideas that the pointers can be NULL when the respective len variables
are non-zero.

Fixes: 5421423ef9 "Flexible encoders for ML-DSA"
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1680314
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29596)
2026-01-12 16:12:09 -05:00
Joshua Rogers
0f20676e99 quic: remove dead VERSION_NEG handling in ch_rx_handle_packet
VERSION_NEG packets are handled and returned from earlier in the function.
The later switch case and its helper are unreachable and contradictory.
Remove them to avoid confusion and future behavior drift.

Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 12 18:54:09 2026
(Merged from https://github.com/openssl/openssl/pull/28920)
2026-01-12 19:54:03 +01:00
Joshua Rogers
92b5ba86f6 quic: remove redundant free of inner TLS in accept_connection
SSL_free(conn_ssl) for a QCSO enters ossl_quic_free, which calls qc_cleanup.
qc_cleanup already frees qc->tls via SSL_free(qc->tls) and then frees qc->ch.
The additional SSL_free(ossl_quic_channel_get0_tls(new_ch)) releases the same
TLS a second time, which is redundant.

We also replace some of the pure condition checks with ossl_assert() checks
as these conditions cannot really fail.

Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 12 18:54:07 2026
(Merged from https://github.com/openssl/openssl/pull/28920)
2026-01-12 19:51:35 +01:00
Joshua Rogers
d62febf758 quic: free popped incoming channel on early exit in accept_connection
If we pop a channel but fail to extract or adopt its SSL pointer,
we return without releasing the channel. Add a small cleanup at
the function epilogue to free new_ch when conn_ssl is NULL.

Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 12 18:54:05 2026
(Merged from https://github.com/openssl/openssl/pull/28920)
2026-01-12 19:49:41 +01:00
Liu-ErMeng
a8f8e64a56 fix vpsm4_ex bug in AARCH64 big-endian platform
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 12 18:46:42 2026
(Merged from https://github.com/openssl/openssl/pull/29504)
2026-01-12 19:46:26 +01:00
Gleb Popov
ea7cbff76d bn: Remove the BN_RECURSION cpp define
Just like in previous commit, this define does not represent a toggleable
feature, but is entirely dependent on the OPENSSL_SMALL_FOOTPRINT define.

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 12 18:44:27 2026
(Merged from https://github.com/openssl/openssl/pull/29204)
2026-01-12 19:44:10 +01:00
Gleb Popov
2dcf5361dd bn: Remove the BN_SQR_COMBA cpp define
Just like in previous commit, this define does not represent a toggleable
feature, but is entirely dependent on the OPENSSL_SMALL_FOOTPRINT define.

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 12 18:44:25 2026
(Merged from https://github.com/openssl/openssl/pull/29204)
2026-01-12 19:44:10 +01:00
Gleb Popov
9c26985326 bn: Remove the BN_MUL_COMBA cpp define
It does not represent a feature that some arch may or may not possess, but
instead is entirely dependent on the OPENSSL_SMALL_FOOTPRINT option.

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 12 18:44:24 2026
(Merged from https://github.com/openssl/openssl/pull/29204)
2026-01-12 19:44:10 +01:00
Jiasheng Jiang
ffb5ca705b test/bio_base64_test.c: Add check for BIO_new()
Add check for the return value of BIO_new() to avoid NULL pointer dereference.

Fixes: 0cd9dd703e ("Improve base64 BIO correctness and error reporting")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Mon Jan 12 18:42:15 2026
(Merged from https://github.com/openssl/openssl/pull/27993)
2026-01-12 19:42:02 +01:00
Jiasheng Jiang
669815e846 fuzz/cmp.c: Correct the usages of BIO_new()
Use BIO_free() to free "in" if error occurs to avoid memory leak.
Moreover, add check for "out" to avoid NULL pointer dereference.
Also replace OPENSSL_assert with return.

Fixes: e599d0a ("Add CMP fuzzing to fuzz/cmp.c, including a couple of helpers in crypto/cmp/")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Mon Jan 12 18:40:14 2026
(Merged from https://github.com/openssl/openssl/pull/27920)
2026-01-12 19:39:23 +01:00
Tomas Mraz
eea134e1f5 Add WSAIoctl to allowed platform symbols on Windows
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Mon Jan 12 18:37:12 2026
(Merged from https://github.com/openssl/openssl/pull/29608)

(cherry picked from commit 0f8166512f)
2026-01-12 19:37:25 +01:00
zhoulu
f1482a709d Instruction reordering to further improve SM4-CBC decryption performance on the RISC-V architecture
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29544)
2026-01-12 10:13:07 -05:00
Heath Dutton🕴️
d2e4f588b6 apps/speed.c: support algorithm name aliases in kem and sig lookup
Fixes #29355

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29571)
2026-01-12 12:31:19 +01:00
Heath Dutton🕴️
b45fb748bd Add PKCS12 fuzzer
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29572)
2026-01-12 12:28:56 +01:00
Milan Broz
f442c00266 Add clang-21 to CI compilers
Signed-off-by: Milan Broz <gmazyland@gmail.com>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29587)
2026-01-12 12:20:16 +01:00
Dmitry Misharov
ca58a66e31 do not hardcode CI workspace path
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29577)
2026-01-12 12:07:45 +01:00
Simo Sorce
16fe8dc019 Fix max index define that was not updated
In PR #29145 a new OSSL_LIB_CTX_SSL_CONF_IMODULE was added, but
the OSSL_LIB_CTX_MAX_INDEXES value was left behind.

This should probably be converted to an enum, but I'll leave that work
to some other brave soul.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29581)
2026-01-12 11:47:48 +01:00
Norbert Pocs
d130c5f748 windows-makefile: Don't prefix libdir when it is absolute path
When --libdir was passed to configuration as an absolute path then
the makefile MODULESDIR_dir became concat(prefix, libdir) creating
an invalid path.

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

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29579)
2026-01-12 11:43:43 +01:00
Alexandr Nedvedicky
4a7d9705f3 QUIC listener may fail with SSL_POLL_EVENT_EL on windows.
recvfrom() may return WSAECONNRESET when the destination port
used in a previous sendto() call is no longer available. This
causes QUIC PORT to swich from running state. This behavior
is not desired for QUIC protocol. The trick is to disable
SIO_UDP_CONNRESET flag on UDP port used by QUIC.

The issue was kindly reported and root caused by goforit22123-netizen@

Fixes: #29530

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Mon Jan 12 10:27:25 2026
(Merged from https://github.com/openssl/openssl/pull/29538)
2026-01-12 11:27:22 +01:00
Nikola Pajkovsky
277634a842 lhash_test: set back num_workers to 16
commit 131c2a1adb ("Defang the lhash test") has reduced default number
of the thread workers in CI to HARNESS_JOBS / 4. Setting LHASH_WORKERS
will set it back.

Resolves: https://github.com/openssl/project/issues/1769
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Mon Jan 12 10:09:54 2026
(Merged from https://github.com/openssl/openssl/pull/29565)
2026-01-12 11:09:47 +01:00
Matt Caswell
85645be82e Clean up some unnecessary includes
Now that we have removed lots of deadcode various files are including
more than they need to. We can slim down the list of includes.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29446)
2026-01-12 08:31:38 +00:00
Matt Caswell
b217b18009 Remove dead EVP_rc5() code
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29446)
2026-01-12 08:31:38 +00:00
Matt Caswell
6215430101 Remove legacy fields from the EVP_CIPHER structure
We remove legacy fields that are no longer used for anything from the
EVP_CIPHER structure.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29446)
2026-01-12 08:31:38 +00:00
Matt Caswell
f9bdb61bbf Remove some last remaining EVP_CIPHER related legacy paths
There were some final remaining legacy paths that are now redundant and
can be removed.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29446)
2026-01-12 08:31:38 +00:00
Matt Caswell
86d7f1665d Remove dead EVP_rc4_hmac_md5() code
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29446)
2026-01-12 08:31:38 +00:00
Matt Caswell
4c8280a13c Remove dead EVP_enc_null() code
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29446)
2026-01-12 08:31:38 +00:00
Matt Caswell
4237166530 Remove dead EVP_chacha20_*() code
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29446)
2026-01-12 08:31:38 +00:00
Matt Caswell
32eaa748a3 Cleanup block cipher macros in include/crypto/evp.h
Remove some unneeded deadcode and fix the formatting

Also fix all users of those macros to avoid compilation warnings

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29446)
2026-01-12 08:31:38 +00:00
Matt Caswell
d4c1efccab Remove dead EVP_aes_*() code
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29446)
2026-01-12 08:31:38 +00:00
Matt Caswell
c68b696289 Remove dead EVP_aes_*_cbc_hmac_sha256() code
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29446)
2026-01-12 08:31:38 +00:00
Matt Caswell
6f850e16fb Remove dead EVP_aes_*_cbc_hmac_sha1() code
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29446)
2026-01-12 08:31:38 +00:00
Jiasheng Jiang
bfdf7c889b fuzz/provider.c: Add check for OPENSSL_malloc() to avoid potential NULL pointer dereference
Add check for the return value of OPENSSL_malloc() to avoid potential NULL pointer dereference.

Fixes: f3b988d ("Add provider fuzzer")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27868)
2026-01-10 09:35:49 -05:00
Matt Caswell
cec5022d5c Document the EVP_PKEY_asn1* removed functions
For every function that was removed we add an entry to
ossl-removed-api.pod

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29405)
2026-01-09 15:53:16 +00:00
Matt Caswell
1d4919dcc7 Update the documentation to remove referenceds to EVP_PKEY_ASN1_METHOD
Now that EVP_PKEY_ASN1_METHODs have been removed from the public API we
need to update the documentation accordingly. They still exist internally
and so some references are still appropriate in the internal documetnation.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29405)
2026-01-09 15:52:12 +00:00
Matt Caswell
c65e34bfce Remove the ability to create a custom EVP_PKEY_ASN1_METHOD
Now that the ability to register a custom EVP_PKEY_ASN1_METHOD has
been removed in an earlier commit, we can now remove the functions that
are used to create a custom EVP_PKEY_ASN1_METHOD.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29405)
2026-01-09 15:52:12 +00:00
Matt Caswell
f9f6d5666a Remove the ability to query the internal EVP_PKEY_ASN1_METHODs
Previously there were a few functions where you could obtain a handle
on registered EVP_PKEY_ASN1_METHODs and query information about them.
We remove the capability.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29405)
2026-01-09 15:52:12 +00:00
Matt Caswell
48d311ee55 Remove EVP_PKEY_asn1_add0()
We remove the ability to add application defined EVP_PKEY_ASN1_METHODs
via the `EVP_PKEY_asn1_add0()` function. We also remove the related function
`EVP_PKEY_asn1_add_alias()`.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29405)
2026-01-09 15:52:12 +00:00
Neil Horman
f247e19fd3 Add a test to ensure that instantiation of drbgs work
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29560)
2026-01-09 10:07:59 -05:00
Neil Horman
8655a91c79 fetch macctx while fetching digest when creating HMAC-DRBG
Somewhere in our conversion from .c files to .inc files for our rand
providers, we created code in drbg_hmac_set_ctx_params_locked to fetch
our digest and hmac when creating the rand instance.  However, the
function drbg_fetch_algs_from_prov only fetched our digest for this rand
type, not the hmac, and returned 1 while doing so, indicating success.
This is problematic because it means that we never wind up fetching an
HMAC for this rand type.  As a result we never compute the strength of
the DRBG and so any attempt to seed it fails.

Ensure that, if we load a digest for this DRBG, we also fetch an HMAC,
and fail if we can't do so, so the HMAC-DRBG is useful.

Fixes openssl/private#853

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29560)
2026-01-09 10:07:59 -05:00
Matt Caswell
2b91fd900f Clean up some unnecessary inclusions
After the deadcode removal there were varios include files being used
that are no longer necessary. We remove them.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29460)
2026-01-09 09:25:51 -05:00
Matt Caswell
b2168cd81d Remove some legacy fields from the EVP_MD_CTX structure
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29460)
2026-01-09 09:25:51 -05:00
Matt Caswell
84b5f265ce Cleanup the EVP_MD structure
Remove fields that are no longer needed.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29460)
2026-01-09 09:25:51 -05:00
Matt Caswell
a82bb34662 Remove legacy method deadcode for EVP_MD implementations
Remove the legacy EVP_MD implementation functions. These are no longer
used due to providers. This code is now unreachable due to the removal of
the functions related to custom EVP_MD methods.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29460)
2026-01-09 09:25:51 -05:00
Alexandr Nedvedicky
1cb0d36b39 MinGW does not know __int64, we can rely on int64_t provided by <stdint.h>
<stdint.H> is part of libraries which come with C99 compiler.

Fixes: #29548

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29553)
2026-01-08 08:02:31 -05:00
Richard Levitte
aa4b47483f Fix util/mkinstallvars.pl to treat LIBDIR and libdir correctly
OpenSSL's build file (Makefile) handles library directories via two
variables, 'LIBDIR' and 'libdir', where the former is empty when the
path given through ./Configure's '--libdir' is absolute.

This was forgotten when treating the resulting values in,
util/mkinstallvars.pl, which got libdir in exporters/libcrypto.pc
to not be quite right if .Configure was called with a '--libdir'
with an absolute path.

The fix turns out to be quite easy.

Resolves: https://github.com/openssl/openssl/issues/28779

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29540)
2026-01-08 12:30:24 +01:00
Bernd Edlinger
48b788cad3 Fix a possible crash in ASN1_generate_nconf
Due to an out of memory error, the i2d_ASN1_TYPE might fail
and cause a segfault.
This adds a missing check for NULL pointer and a test case
that exercises IMPLICIT and EXPLICT tagging in generate_v3,
since there was no test coverage at all for this code section.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Jan  8 10:13:43 2026
(Merged from https://github.com/openssl/openssl/pull/29545)
2026-01-08 11:13:25 +01:00
Alexandr Nedvedicky
818bbcf475 ctx_simd and ctx_ref must be freed in error path
CID 1679597
CID 1679599

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jan  8 10:10:49 2026
(Merged from https://github.com/openssl/openssl/pull/29543)
2026-01-08 11:10:46 +01:00
Frederik Wedel-Heinen
b0041c909e Cleanup in cryptlib.h.
Remove unused ossl_crypto_ex_data_get_ossl_lib_ctx() and memdbg_lock.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Jan  8 10:08:08 2026
(Merged from https://github.com/openssl/openssl/pull/29500)
2026-01-08 11:08:02 +01:00
Frederik Wedel-Heinen
2ffad846c7 Correctly handle the cases where SSL_dup fails.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Thu Jan  8 10:06:48 2026
(Merged from https://github.com/openssl/openssl/pull/29485)
2026-01-08 11:06:43 +01:00
JohnnySavages
c8bae42190 Remove unnecessary argc assign
Found by Linux Verification Center (linuxtesting.org) with SVACE.

CLA:trivial

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Thu Jan  8 10:03:55 2026
(Merged from https://github.com/openssl/openssl/pull/29457)
2026-01-08 11:03:40 +01:00
Dr. David von Oheimb
bfb103387c X509_VERIFY_PARAM_set_flags.pod: fix doc of NULL param to X509_VERIFY_PARAM_set1_email() and X509_VERIFY_PARAM_set1{,_ip}()
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Jan  8 09:56:15 2026
(Merged from https://github.com/openssl/openssl/pull/29150)
2026-01-08 10:56:10 +01:00
Dr. David von Oheimb
ac5e2d22af X509_VERIFY_PARAM_set_flags.pod: remove heavily outdated texts on X509_V_FLAG_NO_ALT_CHAINS; other small fixes
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Jan  8 09:56:14 2026
(Merged from https://github.com/openssl/openssl/pull/29150)
2026-01-08 10:56:10 +01:00
Dr. David von Oheimb
6d643de2d5 X509_VERIFY_PARAM_set_flags.pod: add hint on joint use of X509_VERIFY_PARAM_set1_host() and SSL_set_tlsext_host_name()
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Jan  8 09:56:12 2026
(Merged from https://github.com/openssl/openssl/pull/29150)
2026-01-08 10:55:50 +01:00
Anton Moryakov
5e2e7c60d3 apps: ocsp.c: fix null dereference in ocsp_response
Report of the static analyzer:
Function 'OCSP_cert_to_id' may return NULL on allocation failure,
but its return value is dereferenced in 'OCSP_id_issuer_cmp'
without prior NULL check at ocsp.c:1088. This can lead to a null
pointer dereference and cause a segmentation fault, resulting
in a denial-of-service (DoS) condition. Although such failures
are rare, an attacker could potentially trigger them under memory
pressure. All other calls to 'OCSP_cert_to_id' in the codebase
(e.g., add_ocsp_cert, add_ocsp_serial) properly check for NULL,
making this instance a clear omission.

Correct explained:
Added a NULL check after calling OCSP_cert_to_id() when creating
'ca_id' inside the issuer lookup loop. If the allocation fails, the
function now safely returns an internal error response instead of
risking a crash. This change aligns the code with existing
error-handling patterns in the same file and improves robustness
against resource exhaustion attacks.

Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Jan  8 09:01:09 2026
(Merged from https://github.com/openssl/openssl/pull/29033)
2026-01-08 10:01:00 +01:00
Andreas Aigner
2a0aea5a9b Remove unused Data::Dumper from cmake exporter
* Remove additional dependency for old build boxes (in particular centos)

CLA: trivial

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Thu Jan  8 08:55:10 2026
(Merged from https://github.com/openssl/openssl/pull/24632)

(cherry picked from commit df0a0fd613)
2026-01-08 09:55:48 +01:00
Dr. David von Oheimb
d57a13c6c4 apps/cmp.c: fix handling of passwords when loading pubkey from possibyl password-protected container
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28477)
2026-01-07 12:56:15 +01:00
Dr. David von Oheimb
62af159ea5 apps/cmp.c: refactor load_key_pwd() and load_cert_pwd() params for clarity w.r.t. password source vs. actual password
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28477)
2026-01-07 12:56:15 +01:00
Dr. David von Oheimb
2f949642a1 apps/lib/apps.c: fix load_certs_multifile() and load_certstore() w.r.t. password source vs. actual password
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28477)
2026-01-07 12:56:15 +01:00
Dr. David von Oheimb
48d4c8fb8b apps/lib/apps.c load_key_certs_crls() refactor uidata use and tweak error message
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28477)
2026-01-07 12:56:15 +01:00
Neil Horman
2d4bb3753b Add new test test_base64_simdutf to .gitignore file
the test_base64_simdutf test is commonly built but not ignored by our
.gitignore file, fix that up

Fixes #29529

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29551)
2026-01-07 13:59:42 +11:00
Neil Horman
ee8772e356 prevent large latency in base64_simdutf test
The base64_simdutf test has a printf statement inside a double for loop
that causes a huge amount of latency when run under our perl scripts.
Average run time on my system is about 1min 58 seconds.

We shouldn't be using a printf statement there anyway (likely TEST_info
instead), but we don't need that either, so just remove the printf
entirely.  This decreases the run time to around a second to complete.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29542)
2026-01-07 11:31:05 +11:00
Anatolii Ohorodnyk
5707fd0753 test: use runtime FIPS detection instead of compile-time check
Replace #ifdef FIPS_MODULE with OSSL_PROVIDER_available() runtime check
in ecdsatest.c. The compile-time check is not meaningful for test cases
as the test binary may be compiled without FIPS_MODULE but run with the
FIPS provider loaded.

Fixes #28255

CLA: trivial

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29527)
2026-01-07 08:28:51 +11:00
Dr. David von Oheimb
7123614134 apps.c: fix next_item() to correctly handle space(s) before comma separators
* Modified the parsing logic to handle space-followed-by-comma patterns
* Updated the separator skipping logic to process at most one comma while allowing multiple spaces
* Added a test case with a mixed DNS and IP SAN entry that includes the problematic spacing pattern

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28471)
2026-01-06 21:02:20 +01:00
Bernd Edlinger
c0a7890b62 Fix a memory leak in sctp code
There is a memory leak of the addrinfo struct when
`./openssl s_server -dtls -sctp -accept 127.0.0.1:4433`
is used, but `sysctl -w net.sctp.auth_enable=1`
is not done before.
Additionally this fixes an oversight, when
`./openssl s_client -dtls -sctp -connect localhost:4433`
is used to connect to above server.
The first connect attempt is to IPv6 ::1, which might fail,
but the second attempt might still succeed, so continue to
try all addesses even when the SCTP socket fails for one of them.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29541)
2026-01-06 07:56:14 -05:00
Dr. David von Oheimb
7e05e8d6a3 UI_new.pod: fix doc of UI_add_user_data()
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28475)
2026-01-05 17:59:40 +01:00
Frederik Wedel-Heinen
4185261efc Fix possible null pointer dereference.
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29537)
2026-01-05 09:36:06 -05:00
Neil Horman
cf8b11c184 Fix dead code/constant expression in simdutf test
Coverity issues:
https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1677828
and
https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1677827

caught some dead code in the simdutf test.

The total variable is defined as an int, which is tested against <=
INT_MAX, and > INT_MAX, which will always be true, and false
respectively, making the <= test needless, and the condition the latter
bounds dead code

Clean that up.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29525)
2026-01-04 17:51:56 -05:00
Neil Horman
b6aed64e47 Fix overflow in EVP_EncodeFinal
https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1677829

With recent changes, evp_encodeblock_int may return a negative value,
which EVP_EncodeFinal does not anticipate.  As the latter sets out[ret]
to "\0" where ret is the return value of evp_encodeblock_int, we may
underflow the array index and access invalid memory locations.

Only update the output buffer if the return value is greater or equal to
zero.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29525)
2026-01-04 17:51:56 -05:00
Neil Horman
fb99acc994 Fix constant bounds checking in evp_encodeblock_int
https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1677830

Reports that several locations in the above function bound for loops
with a check for
ret <= INT_MAX

Given that ret is defined as an int, it can never be larger than
INT_MAX, and so is always true.

We can just remove the check for this variable.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29525)
2026-01-04 17:51:56 -05:00
Neil Horman
3b69cc994c Fix more dead code in b64_write
https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1677831

reports more dead code in b64_write

ret is incremented by inl in b64_write prior to being tested for zero.
Since inl is previously tested for being <= 0, and returns if it is, ret
must be at least 1 during the test, making the trinary test dead code.

Just return -1 here.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29525)
2026-01-04 17:51:56 -05:00
Neil Horman
3e8a68008c check for null returns in test_base64_simdutf.c
We derferences two pointers in this code which we fail to check for null
first.  reported by:

https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1677832

Just move the null check a bit higher

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29525)
2026-01-04 17:51:49 -05:00
Neil Horman
b6ab93b783 Remove dead code in b64_write
recent updates triggered this coverity issues:
https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1677834

Because ret is initalized to zero, and checked prior to any further
update, the first return statement in this change is unreachable

Further the return ret == 0 ? i : ret statement makes teh setting of
buf_len and buf_off unreachable.

Remove all of this unreachable code

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29525)
2026-01-04 17:51:49 -05:00
Bob Beck
61c876198d Remove the ASN1_STRING_FLAG_X509_TIME flag
It's only use was to do some somewhat confused cruftery
inside of ossl_asn1_time_to_tm as a special case to
implement ASN1_TIME_set_string_X509.

As it turns out, you don't need the cruftery of a special
case inside of ossl_asn1_time_to_tm to implement this
function, so the flag is completely unnecessary.

This removes flag, and simplifies this to work without it.

It removes the cruft only from ossl_asn1_time_to_tm,
minimally. This function really needs some cleanup and
makes my eyes bleed but I am resisting the temptation
to do that with this PR and making this a the minimal
change needed for review. I will clean up that function
in a follow on pr.

As tests on the behaviour of ASN1_TIME_set_string_X509
were added with it, Beyonce dances happily for me and I
only need to pass the existing tests, not write as bunch
of new ones.. .

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29187)
2026-01-03 09:27:31 -05:00
Neil Horman
441a2c105c Fix register save/restore issue in ppc
Recently, the addition of some vector register save restore logic from:
https://github.com/openssl/openssl/pull/28990

Triggered an issue in our quic_multistream_test, notably causing a
connection shutdown with error code 1, rather than successful
completion.

The problem has been root caused to an error in how the ppc aes code
saves and restores vector registers.

The aes gcm code uses VSR instructions (vsldoi, etc), to maniuplate
vector registers, which only operate on the upper half of the vector
register file (VS32-63), and operands are implicitly offset to do this.
(i.e. <instr> v31 actually operates on register vs63).

However, the SAVE/RESTORE macros which save and restore those values use
stxv/lxv instructions to do the save and restore, which are VSX
instructions that have access to the full vector register file, and so
by restoring V1, rather than V33, etc, we actuall restore values to the
wrong registers, causing various issues (most notably the above
misconfiguration of the quic SSL shutdown event, which sets the error
code erroneously to 1 instead of the expected 0 value).

Fix it by offsetting the SAVE_REGS and RESTORE_REGS macros to reference
the proper registers when doing save and restore.

Fixes #29516

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29528)
2025-12-31 16:38:21 -05:00
Tomas Mraz
9aeb35372f run-checker-daily.yml: heartbeats cannot be enabled anymore
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29517)
2025-12-31 12:49:43 -05:00
609bob
117dc48fd5 bss_acpt.c: Free strings returned from previous BIO_ADDR_hostname_string() calls
CLA: trivial

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29452)
2025-12-31 13:50:06 +01:00
zhoulu
2d75c5e383 SM4-CBC performance improvement on RISC-V
Modify the IV update method to further improve the performance of
SM4-CBC encryption on the RISC-V architecture.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29451)
2025-12-31 13:46:34 +01:00
xxcui
14018b02df SM3: Performance optimized with RISC-V Vector Crypto
RISC-V Cryptographic Vector Extension provides ZVK instructions which
can be used to accelerate SM3 computing.

By calculating SHA512 performance on C930 FPGA, it is proven that sm3
speed is improved from 120695K to 323844K.

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29264)
2025-12-31 13:43:19 +01:00
Richard Levitte
a91e844d7a Add explicit error queue instructions in d2i_X509(3) and SSL_get_error(3)
Co-authored-by: Tomáš Mráz <tm@t8m.info>

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28264)
2025-12-31 12:28:07 +01:00
Frederik Wedel-Heinen
9ada832a81 Fix typo in hex_prin() and make it static
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29493)
2025-12-31 12:26:20 +01:00
fengpengbo
b34e890c21 This PR performs further optimization based on the already merged "Implement Montgomery multiplication assembly optimization for RV64GC" (#28012).
The key improvements include:code formatting unification、instruction scheduling optimization、register allocation strategy update、updates to addition/subtraction carry and borrow flag handling.
These enhancements aim to improve both the code maintainability and its execution performance, particularly on out-of-order RISC-V cores.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29438)
2025-12-30 08:22:46 -05:00
Jiasheng Jiang
323e48b6fb demos/bio/sconnect.c: Add check for BIO_new()
Add check for the return value of BIO_new() to guarantee the success.

Fixes: 0f113f3ee4 ("Run util/openssl-format-source -v -c .")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27919)
2025-12-28 16:56:32 -05:00
Jiasheng Jiang
7ed1f08326 test/evp_extra_test.c: Add check for BIO_new()
Add check for the return value of BIO_new() to avoid NULL pointer dereference.

Fixes: fd19fc4c27 ("Test that a key is usable after an EVP_PKEY_fromdata call")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27994)
2025-12-28 16:52:18 -05:00
Neil Horman
0755a8ef90 Add ci test to run against minimal gcc version we support
We currently support gcc 9 as a minimum compiler version.  We should run
at least one ci job against that minimal version to make sure we don't
break anything.

Most notably this will help us catch errors if we attempt to use
intrinsics that aren't supported by that compiler.

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29482)
2025-12-26 17:32:46 -05:00
fengpengbo
7a53925198 Fix register usage comment in ARMv8 Montgomery sqr asm.
In the bn_sqr8x_mont function, a comment describing the accumulation step for the partial product a[1]*a[0] incorrectly referenced the low part ('lo') of the product. The value being added to the temporary register t[2] is actually the high part ('hi') of that multiplication.
Correct the comment from "t[2]+lo(a[1]*a[0])" to "t[2]+hi(a[1]*a[0])".

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29436)
2025-12-24 18:32:54 -05:00
Andrew Dinh
a11b5ae0d2 SSL3 documentation nits
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29338)
2025-12-23 10:54:08 -05:00
Andrew Dinh
6821363f28 Add no-ssl3 back as a no-op
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29338)
2025-12-23 10:54:08 -05:00
Andrew Dinh
b53d8bf168 Add entry to CHANGES.md
Explain the changes to configure

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29338)
2025-12-23 10:54:08 -05:00
Andrew Dinh
0b271780ea Remove sslv3 flags from x86 CI jobs
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29338)
2025-12-23 10:54:08 -05:00
Andrew Dinh
8d623d4979 Update documentation using enable-ssl3 Configure flags
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29338)
2025-12-23 10:54:08 -05:00
Andrew Dinh
357beec47f Allow enabling deprecated flags that haven't been removed yet
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29338)
2025-12-23 10:54:08 -05:00
Andrew Dinh
8c108ae03b Deprecate SSL3 Configure flags
Show a deprecated warning if users attempt to run Configure script with
no-ssl3, no-ssl, or no-ssl3-method. Also adds a fix to the Configure
script preventing users from enabling deprecated flags.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29338)
2025-12-23 10:54:08 -05:00
Andrew Dinh
b3d26e438a Rename SSL3 error codes to TLS equivalents
Updated error code names and references from SSL3 to TLS in error definitions and error strings. Legacy error codes are preserved in sslerr_legacy.h for backward compatibility

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29338)
2025-12-23 10:54:08 -05:00
Andrew Dinh
21fc75e49f Address SSLv3 removal nits
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29338)
2025-12-23 10:54:08 -05:00
Andrew Dinh
4574e1b3cb Remove unused SSLv3 specific error codes
Also remove the SSL_TXT_SSLV3 name.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29338)
2025-12-23 10:54:08 -05:00
Kurt Roeckx
60c15b2aff Remove support for SSLv3
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29338)
2025-12-23 10:54:06 -05:00
Bob Beck
fc756e594e Constify return value of X509_get_X509_PUBKEY()
You really should not be mutating this.

Part of #28654
Fixes: https://github.com/openssl/project/issues/1771

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29428)
2025-12-23 08:16:37 -05:00
Bob Beck
f18816261e Constify the return value of X509_get0_pubkey_bitstr()
Part of #28654
Fixes: https://github.com/openssl/project/issues/1772

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29434)
2025-12-23 08:06:00 -05:00
Norbert Pocs
077e94f6e5 Interop: c_rehash was removed; don't look for it
Signed-off-by: Norbert Pocs <norbertp@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29474)
2025-12-23 07:55:37 -05:00
xxcui
93119bae7f SHA512 performance optimized by RISCV RVV
This patch is dedicated to improve SHA512 speed with RISCV
Cryptographic Vector Extension.

Below performance output is calculated by Xuantie C930 FPGA with VLEN256.
  - sha512 speed might be improved from 197032K to 1010986KB

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29263)
2025-12-23 14:50:26 +11:00
Nick Nuon
3a69b19028 Added AVX2 encoding + scalar improvements
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29178)
2025-12-23 14:47:41 +11:00
Tomas Mraz
6f73fe1c68 Remove BIO_f_reliable() as it is broken
It was broken since the OpenSSL 3.0 release and
nobody complained. Apparently nobody is using it.
It would be practically impossible to reimplement
it with the provided EVP_MDs in backwards-compatible
manner.

Fixes #29413

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29445)
2025-12-21 14:26:15 -05:00
Theo Buehler
da8f09846b Add ASN1_BIT_STRING_get_length()
From tb@openbsd.org with tests adapted by beck for OpenSSL.

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29387)
2025-12-20 15:51:53 -05:00
Sashan
d78e642f28 Update doc/man3/OPENSSL_init_crypto.pod
Co-authored-by: Matt Caswell <matt@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29385)
2025-12-19 12:06:38 -05:00
Sashan
994413f995 Update NEWS.md
Co-authored-by: Matt Caswell <matt@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29385)
2025-12-19 12:06:38 -05:00
Sashan
095db166f7 Update CHANGES.md
Co-authored-by: Matt Caswell <matt@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29385)
2025-12-19 12:05:09 -05:00
sashan
85773d519a - update NEWS.md
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29385)
2025-12-19 12:02:25 -05:00
sashan
874552686c - fix CHANGES.md style
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29385)
2025-12-19 12:02:01 -05:00
sashan
01b420986d - fix .cstyle
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29385)
2025-12-19 12:02:01 -05:00
Alexandr Nedvedicky
31659fe326 Introduce OPENSSL_ATEXIT_CLEANUP env. variable.
libcrypto does not arm OPENSSL_cleanup() function as atexit(3) handler by default.
If application/user wants libcrypto to install OPENSSL_cleanup() as atexit handler,
then OPENSSL_ATEXIT_CLEANUP env. variable must be set.

If platform's libc does not provide atexit(3), then OPENSSL_ATEXIT_CLEANUP has no effect.

The OPENSSL_atexit() is wrapper of atexit(3) provided by libc now.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29385)
2025-12-19 12:01:59 -05:00
Tomas Mraz
380ff14485 BIO_send/recvmmsg(): Pass msgs_processed to the return callback
This avoids crash if a legacy BIO callback is set and
BIO_sendmmsg() or BIO_recvmmsg() is used.

Reported by Stanislav Fort (Aisle Research)

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29395)
2025-12-19 16:36:03 +01:00
Norbert Pocs
ca9827379a win-makefile.tmpl: Fix program install check
When the array is empty then copy.pl fails, because there is nothing to
copy. The empty check was done on a different variable.

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

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29427)
2025-12-19 16:10:24 +01:00
Norbert Pocs
43033e129b Remove the c_rehash script
The `openssl rehash` should be used instead.

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

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29427)
2025-12-19 16:10:24 +01:00
Richard Levitte
3a06643251 test/run_tests.pl: Ensure that all HARNESS_VERBOSE values are respected
... with perl truthiness in mind

Most of all, this means not having undue expectations that its value
is numerical (this is particularly true when HARNESS_VERBOSE isn't given
by the user, and this script's default is "yes").

We do this by ensuring that $tap_verbosity is turned into an appropriate
number if HARNESS_VERBOSE's value isn't numerical.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29443)
2025-12-19 15:55:34 +01:00
Danny Tsen
ebd690b1eb ppc64le: Restore VSX registers in AES/GCM ppc64le encrypt/decrypt
The implementation failed to restore VSX vector registers from vs14-vs22.

Re-implemented based on Linux kernel version.

Fixes #28961

Signed-off-by: Danny Tsen <dtsen@us.ibm.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28990)
2025-12-19 15:08:27 +01:00
Milan Broz
706606c008 Add engine stubs test
This test tries to use all stub macros and compare return values
to verify that OPENSSL_ENGINE_STUBS define works.

Fixes openssl/project#1762

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

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29414)
2025-12-19 09:03:42 -05:00
Milan Broz
9ce72b90eb Remove ossl_err_load_ENGINE_strings from stubs
This was an internal function and should not be here.

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

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29414)
2025-12-19 09:03:42 -05:00
Milan Broz
807fd8bc09 Fix stub definitions for no-deprecated config
Used types are only available if OPENSSL_NO_DEPRECATED_3_0
is not defined.

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

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29414)
2025-12-19 09:03:42 -05:00
Milan Broz
8d58b05b28 Fix typo in engine.h stub
Signed-off-by: Milan Broz <gmazyland@gmail.com>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29414)
2025-12-19 09:03:41 -05:00
Simo Sorce
eea8db4124 Harden digest context deserialization
The deserialization functions for SHA2 and SHA3 digest contexts did not
sufficiently validate the incoming data. Corruption in transmission or
on saved disk data could cause a out-of-bounds memory access if buffer
sizes did not match expected values.

Add sanity checks to the SHA2 and SHA3 deserialization functions to validate
buffer-related fields before they are used. The serialization format for these
digests has been changed to place these critical fields early in the stream to
enable this validation.

Additionally, add a note to the EVP_DigestInit man page to warn users that
deserialization should only be performed on trusted data. The checks we
implement are not meant to address processing of untrusted data
maliciously crafted by an attacker.

Application that need to store data or transmit it through untrusted
media SHOULD implement proper encryption and message authentication
on their own using things like CMS or other appropriate secure message
containers.

These check have been added also to quiet a bit security researchers
that try to find any way to claim CVE bounties even in completely
unlikely or invalid scenarios.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29404)
2025-12-19 14:23:04 +01:00
slontis
e1e04709de evp_test Fix tests that were always skipped
The "Verify-Message" type looks for private keys only,
which meant anything using a public key got skipped.
Changed the entries to "Verify-Message-Public" which tries the public
key first.
This uncovered one test that needed to be removed since ECDSA-MD5 is not
a valid fetchable algorithm (in any OpenSSL provider).

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28040)
2025-12-19 08:08:12 -05:00
Eugene Syromiatnikov
b16a53862c util: add reformat-patches script
A small script that tries to perform reformatting of a patch set.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29356)
2025-12-19 08:02:47 -05:00
Richard Levitte
cfbd2e1bae Use 'codespell:ignore' where justifiable
There's this one random string where we have the word "Hellow".  It's a
random string, "correct" spelling is really not important, so we tell
codespell to just ignore that line.

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29437)
2025-12-19 13:06:04 +01:00
Richard Levitte
dc7f7f01ad Fix legitimate spelling errors
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29437)
2025-12-19 13:06:04 +01:00
Richard Levitte
e2b15858a7 Adjust .codespellrc
- add 'external/*' to the list of patterns to skip
- add '*.csr' to the list of patterns to skip

Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29437)
2025-12-19 13:06:04 +01:00
Bob Beck
4036f4b0e3 Add new public API for checking certificate times.
Fixes: #1631

This changes the previously internal ossl_x509_check_certificate_times()
to be the public X509_check_certificate_times(). It adds documentation
for the new function and marks X509_cmp_time, X509_cmp_timeframe,
and X509_cmp_current_time as deprecated in 4.0, as discussed in #1631.

Since the function is now public, we can replace the remaining
uses of deprecated stuff with this function.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29152)
2025-12-18 13:34:58 -05:00
Weizhi Ao
5cbbced70d Fix silent failure in ASYNC_start_job when size is 0
When ASYNC_start_job is called with args != NULL but size == 0,
OPENSSL_malloc(0) is called. Depending on the libc implementation,
malloc(0) may return NULL, causing a silent failure.

This patch modifies the logic to skip allocation if size is 0.

CLA: trivial

Reviewed-by: Norbert Pocs <norbertp@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/29377)
2025-12-18 17:34:42 +01:00
Matthias Kraft
576efc44ae Ensure path to libcrypto can be resolved on AIX.
On AIX, the environment of the test executable for test_includes doesn't
contain a resolvable search path to the just built libcrypto. Setup
LIBPATH to point to the build results.

Fixes #29352.

Signed-off-by: Matthias Kraft <Matthias.Kraft@ibm.com>

Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29375)
2025-12-18 17:32:37 +01:00
martin
f13fe0e025 Add documentation for X509_V_FLAG_OCSP_RESP_CHECK and X509_V_FLAG_OCSP_RESP_CHECK_ALL
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29327)
2025-12-18 17:31:13 +01:00
Dr. David von Oheimb
c8073cac15 apps/x509.c: factor out add_object() for handling -addtrust and -addreject options
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/28371)
2025-12-18 17:28:53 +01:00
Milan Broz
0ccd3a238f Add mention of OPENSSL_ENGINE_STUBS to openssl_user_macros(7)
Fixes openssl/project#1743
Fixes openssl/project#1744

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

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29424)
2025-12-18 16:55:39 +01:00
Matt Caswell
c28576e784 Add removed EVP_PKEY_meth* functions to ossl-removed-api.pod
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29384)
2025-12-18 10:57:50 +00:00
Matt Caswell
d7a4f81aed Remove all EVP_PKEY_meth_* functions from the documentation
These functions have been removed so the documentation should be updated
accordingly.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29384)
2025-12-18 10:57:39 +00:00
Matt Caswell
60d4b986e7 Clean up some final vistigial remnants of EVP_PKEY_METHOD
We retain the opaque type because it is still used by the ENGINE stubs.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29384)
2025-12-18 10:57:39 +00:00
Matt Caswell
00022fdfad Remove references to the pmeth field in an EVP_PKEY_CTX
We don't set this field anymore so we should remove all usage of it.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29384)
2025-12-18 10:57:38 +00:00
Matt Caswell
a570f1a09b Delete the EC EVP_PKEY_METHOD
It is no longer used so can be removed

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29384)
2025-12-18 10:57:38 +00:00
Matt Caswell
90bb6e2c93 Delete the DSA EVP_PKEY_METHOD
It is no longer used so can be removed

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29384)
2025-12-18 10:57:38 +00:00
Matt Caswell
b7d69bad17 Delete the RSA EVP_PKEY_METHOD
It is no longer used so can be removed

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29384)
2025-12-18 10:57:38 +00:00
Matt Caswell
7fd85ef726 Delete the ECX EVP_PKEY_METHOD
It is no longer used so can be removed

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29384)
2025-12-18 10:57:38 +00:00
Matt Caswell
ce6a336128 Delete the DH EVP_PKEY_METHOD
It is no longer used so can be removed

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29384)
2025-12-18 10:57:38 +00:00
Matt Caswell
f3f70e170f Remove custom EVP_PKEY_METHODs
We retain custom EVP_PKEY_ASN1_METHODs for now - to be removed in some
subsequent PR.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29384)
2025-12-18 10:57:38 +00:00
Norbert Pocs
53b78f2a49 Check return code of UTF8_putc
Signed-off-by: Norbert Pocs <norbertp@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29376)
2025-12-18 11:23:09 +01:00
Norbert Pocs
51e8f70ba3 Harden ASN1_mbstring_ncopy
Reported by Murali Aniruddhan

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

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29376)
2025-12-18 11:23:09 +01:00
Alexandr Nedvedicky
5a45547c8e The stream garbage collector loop in ossl_quic_stream_map_gc() is never entered
Also remove ready_for_gc_next(), it is not needed any more.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29402)
2025-12-18 11:11:03 +01:00
Ondrej Moris
e547988940 Revert "tests: temporarily skip MLDSA pkcs11-provider test"
This reverts commit 2b97f4d300.

Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28717)
2025-12-17 15:07:40 -05:00
Richard Levitte
16fa01bb86 Add a couple of DH related StatementMacros, and adjust
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29383)
2025-12-17 10:19:43 -05:00
Richard Levitte
7996349056 Unbreak some function signature that got broken up after the return type
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29383)
2025-12-17 10:19:43 -05:00
Richard Levitte
63e912b758 Redo source reformatting with the TypeNames added
This resulted in some source reformatting becoming a bit less trippy

This is the script I used to run clang-format appropriately enough:

    #! /bin/bash

    include_re=$(yq -r '.repos.[].hooks.[] | select(.id == "clang-format") | .files' < .pre-commit-config.yaml)
    known_generated=( crypto/bn/bn_prime.h
                      crypto/objects/obj_dat.h
                      crypto/objects/obj_xref.h
                      include/openssl/obj_mac.h
                      crypto/conf/conf_def.h
                      crypto/asn1/charmap.h
                      '*_err.c'
                      '*err.h' )

    exclusions=()
    for g in "${known_generated[@]}"; do
        # Convert pattern to a regex
        g=${g//\./\\.}
        g=${g//\*/.\*}
        exclusions+=( "^${g}\$" )
    done
    # Join all exclusions into one regex
    exclude_re=$(IFS='|'; echo "${exclusions[*]}")

    (set -x; git ls-files | grep -E $include_re | grep -Ev $exclude_re | xargs clang-format -i)

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29383)
2025-12-17 10:19:43 -05:00
Richard Levitte
aa9defaa1f Dump all known typedefs into .clang-format
This was done by calling a script I made on the spot:

    bash add-types-to-clang-format > .clang-format.new && mv .clang-format.new .clang-format

This is what that script looked like:

    #! /bin/bash

    sed -ne '1,/^CommentPragmas:/p' < .clang-format

    cat <<_____
    # OpenSSL uses typedefs extensively. Tell clang-format about them.
    TypeNames:
    _____

    include_re=$(yq -r '.repos.[].hooks.[] | select(.id == "clang-format") | .files' < .pre-commit-config.yaml)
    include_dirs=( apps crypto include providers ssl )
    git ls-files "${include_dirs[@]}" \
        | grep -E $include_re \
        | xargs ctags -f - \
        | awk -F "\t" -- '$2 ~ /\.h/ && $4 == "t" { printf "  - \"%s\"\n", $1 }' \
        | sort \
        | uniq

    cat <<_____
      # The following types are macros, and need to remain that way, unfortunately
      - "HASH_CTX"
      - "HASH_LONG"
      - "MD32_REG_T"
    _____

    sed -ne '/^# OpenSSL uses macros extensively/,$p' < .clang-format

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29383)
2025-12-17 10:19:43 -05:00
Richard Levitte
a999136e01 Refactor types that are '#define'd into proper typedefs
I looked for them with the following grep pipe, and then read through
the output to discern what are actual type definitions, and converted
what I found manually.

    git grep -En -e '#define [a-zA-Z_0-9]+ ' -- '*.h' \
        | sed -e 's|//.*||' -e 's|/\*.*\*/||g' \
        | grep -Ev ' ([0-9]|.*".*|.*\\$)'

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29383)
2025-12-17 10:19:43 -05:00
Richard Levitte
821b265d21 Add a few more ASN.1 related StatementMacros
This resulted in an adjustment of reformatting that is a bit less trippy
in some places.

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29383)
2025-12-17 10:19:43 -05:00
Richard Levitte
92d1ea3bf2 Missed a spot!
For some reason, source reformatting didn't catch everything.

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29383)
2025-12-17 10:19:43 -05:00
Bob Beck
131c2a1adb Defang the lhash test
This is bascially eating my mac, as it now runs for 80 seconds
and eats all the CPU's exercising lock contention.

This dials it back to consume at most a quarter of the CPU's in
use by HARNESS_JOBS, unless LHASH_WORKERS is set to override it
in which case we use that.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/29406)
2025-12-17 08:45:38 -05:00
Tomas Mraz
495cf0efe6 apps/req.c: Always set permissions for private key output
The key output will be always private.

Reported with a proposed fix by Stanislav Fort (Aisle Research).

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29397)
2025-12-17 13:47:29 +01:00
Neil Horman
a28accadf7 Fix Coverity issue in kdf_snmpkdf_set_ctx_params
Coverity flagged a use before NULL check error in
kdf_snmpkdf_set_ctx_params.

In this function the ctx pointer was dereferenced to obtain a
OSSL_LIB_CTX pointer, and only after that dereference was ctx checked
for being NULL.

fix is pretty clear, just move the OSSL_LIB_CTX computation down to a
point after ctx is checked for NULL.

fixes openssl/project#1765

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29400)
2025-12-17 13:45:22 +01:00
Viktor Dukhovni
473dff4781 New -encopt option for pkey(1) and genpkey(1)
This allows setting the ML-KEM and ML-DSA output formats.
At the same fixing surprising lack of password encryption
of PKCS#8 private keys in DER output form in the CLI apps.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29324)
2025-12-17 13:40:17 +01:00
Viktor Dukhovni
29f8cebfcb Fix codespell error in sslapitest
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29392)
2025-12-17 13:33:09 +01:00
Paul Elliott
ddcfc1a1be Fix error in PAC/BTI AArch64 build
Clang format removes a space here, which creates a compiler error when
building for PAC/BTI. Fix this and Turn off clang format for this line

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/29399)
2025-12-17 13:17:09 +01:00
Bob Beck
ac7f76380b Make the test output show how long each test takes by default.
Unless we have reduced the verbosity level, or overridden it with
a HARNESS_TIMER setting.

This makes it easier to realize when you are making a test that is
starting to dominate testing time for developers, and makes it
easier for developers to see it.

For: https://github.com/openssl/project/issues/1767

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29408)
2025-12-17 13:09:52 +01:00
Nikola Pajkovsky
6255955d08 method store performance improvements
The proposed architectural change focuses on improving concurrency and
reducing contention within the method store. The fundamental concept
involves moving away from a monolithic synchronisation
mechanism—specifically, a single read-write lock (rwlock)—that
currently guards the entire method store.

Instead of this single point of contention, the strategy is to
introduce per-shard synchronisation. This means the method store will
be partitioned, or sharded, into several independent segments. Each of
these segments, or shards, will be protected by its own dedicated
read-write lock.

The data in the table below was generated by running evp_fetch twenty times per thread.

|---------+----------+---------+---------+---------+---------+---------+---+--------+--------+--------+--------+--------|
|                    | Shards (u/sec)                                  |   | Improvements %
|---------+----------+---------+---------+---------+---------+---------+---+--------+--------+--------+--------+--------|
| Threads | Base     |       2 |       4 |       8 |      16 |      32 |   |      2 |      4 |      8 |     16 |     32 |
|---------+----------+---------+---------+---------+---------+---------+---+--------+--------+--------+--------+--------|
|       1 |  0.18282 | 0.18497 | 0.18306 | 0.18314 | 0.18485 | 0.18352 |   |   1.17 |   0.13 |   0.18 |   1.11 |   0.39 |
|       2 |  0.43588 | 0.35560 | 0.34131 | 0.32516 | 0.33948 | 0.35076 |   | -18.42 | -21.70 | -25.40 | -22.12 | -19.53 |
|       4 |  1.58185 | 1.06459 | 1.06258 | 0.98698 | 0.98700 | 1.06689 |   | -32.70 | -32.83 | -37.61 | -37.60 | -32.55 |
|       8 |  3.15686 | 1.75061 | 1.67458 | 1.50241 | 1.62453 | 1.74750 |   | -44.55 | -46.95 | -52.41 | -48.54 | -44.64 |
|      16 |  5.53647 | 2.83137 | 2.58007 | 2.65972 | 2.64882 | 2.82755 |   | -48.86 | -53.40 | -51.96 | -52.16 | -48.93 |
|      32 | 10.72727 | 4.97483 | 4.43692 | 4.52524 | 4.68358 | 4.84840 |   | -53.62 | -58.64 | -57.82 | -56.34 | -54.80 |
|      64 | 21.12103 | 9.43241 | 7.79981 | 7.91148 | 8.33305 | 8.34230 |   | -55.34 | -63.07 | -62.54 | -60.55 | -60.50 |

Perf tests were running on the system:
  Architecture: x86_64
  CPU op-mode(s): 32-bit, 64-bit
  Address sizes: 46 bits physical, 48 bits virtual
  Byte Order: Little Endian
  CPU(s): 96
  On-line CPU(s) list: 0-95
  Vendor ID: GenuineIntel
  Model name: Intel(R) Xeon(R) Gold 6248R CPU @ 3.00GHz
  CPU family: 6
  Model: 85
  Thread(s) per core: 2
  Core(s) per socket: 24
  Socket(s): 2

The most performant option is a configuration with 512 cache entries with
4 shards. There are two new defines NUM_SHARDS, and CACHE_SIZE which
can be tweaked at will.

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29205)
2025-12-17 12:29:17 +01:00
Matt Caswell
bc2d17bbc4 Update ossl-removed-api to mention the EVP_MD_meth* functions
All the EVP_MD_meth* functions have been removed so they should be
documented as such.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29366)
2025-12-17 10:23:22 +00:00
Matt Caswell
afe83c9a93 Remove mentions of EVP_MD_meth* from the documentation
With the removal of EVP_MD_meth* we need to update the documentation
accordingly.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29366)
2025-12-17 10:23:22 +00:00
Matt Caswell
992368ec46 Remove support for custom MD methods
Custom MD methods are considered legacy and have been deprecated
since 3.0. With the removal of ENGINEs they become a lot less useful
and add significant complexity to the code. We should therefore remove
them in 4.0.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29366)
2025-12-17 10:23:12 +00:00
Neil Horman
1bfdcf9057 Prevent freeing of parent listener in SSL_listen_ex
Its been reported that, when using SSL_listen_ex to obtain a new
connection from a listener, that, if the listener is freed prior to the
obtained connection, we get use-after-free conditions when freeing said
obtained connections.

This occurs because SSL_listen_ex fails to take a reference on the
parent listener SSL object (in the same way that SSL_new_from_listener
does).  If the listener is freed first, then several listener resources
are freed, which the obtained connection still makes use of, hence the
use-after-free.

The fix is to do what SSL_new_from_listener does, namely:
1) Increase the reference count on the listener SSL object.
2) Ensure that the connection qc->listener points to the listener object
   so that, when the connection is freed, we call SSL_free on the
   listener object, dropping the reference count we take in
   SSL_listen_ex.

While we're at it, this PR also modifies the quicapi test for testing
the SSL_listen_ex call, freeing the listener first to ensure that the
increased refcount holds the SSL object data stable until the connection
is freed.

Thanks to Stanislav Fort at Asile Research for pointing out this issue.

fixes openssl/project#1766

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29398)
2025-12-16 10:18:37 -05:00
2234 changed files with 136829 additions and 114418 deletions

File diff suppressed because it is too large Load diff

View file

@ -14,6 +14,7 @@ ignore-words-list =
ADDAD,
addin,
adin,
ADn,
AFAIR,
afile,
afterAll,
@ -74,6 +75,7 @@ ignore-words-list =
configury,
consumation,
couldn,
couter,
crasher,
crashers,
crate,
@ -130,6 +132,7 @@ ignore-words-list =
Gost,
GOST,
Hart,
hashin,
hasTable,
hel,
hist,
@ -332,6 +335,7 @@ skip =
*.asc,
*.bin,
*.crt,
*.csr,
*.css.map,
*.eps,
*.fr.utf-8,
@ -441,6 +445,7 @@ skip =
CREDITS,
CREDITS.TXT,
DONATIONS,
external/*,
jquery.js,
jquery.min.map,
localization*-[a-z][a-z]_[a-zA-Z][a-zA-Z].*,

View file

@ -1,5 +1,5 @@
#
# Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2023-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -10,4 +10,3 @@
# List file names or patterns you want ctags to ignore.
--exclude=.ctags.d
--exclude=test
--exclude=check-format-test-positives.c

View file

@ -3,7 +3,11 @@ Thank you for your pull request. Please review these requirements:
Contributors guide: https://github.com/openssl/openssl/blob/master/CONTRIBUTING.md
Other than that, provide a description above this comment if there isn't one already
Include a clear description of the issue or feature above this comment if not already provided. This should briefly outline the issue or feature being addressed, along with any relevant implementation details. For performance improvements, include benchmark results as well.
Please always add meaningful commit messages. Commit message titles (the first line of each commit message which should be separated by an empty line from the rest of the message) should be kept to 50-70 characters if possible. Further details and Fixes #issue number annotations should be placed in the commit message body (i.e, after the empty line).
Pull requests and commits should be self-contained, allowing readers to understand what changed and why without needing to reference related issues or having prior knowledge. Individual commit messages should include all relevant details to ensure future contributors can easily follow the git history. Clearly explain what is changing and why, and feel free to include detailed (long) descriptions when beneficial to understanding.
If this fixes a GitHub issue, make sure to have a line saying 'Fixes #XXXX' (without quotes) in the commit message.
-->

5
.github/ci-deps.json vendored Normal file
View file

@ -0,0 +1,5 @@
{
"jom-1.1.7.exe": "8435dbf96eb9ee65395d46d04dc3af2ff6b2618aefbc7964eeede9be669e8bd6",
"nasm-3.01-installer-x64.exe": "7881e9febc8b6558581041019b7890f109bef0694d93ed82c9589794c7b5a600",
"nasm-3.01-installer-x86.exe": "2e3041dd2abe36cb7e9938057c3cf090dd2eac42d3280957359f87c4d83b9ed0"
}

View file

@ -0,0 +1,202 @@
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
name: Cross Compile for AArch64 Extensions
on:
pull_request:
types: [opened, reopened, edited, synchronize]
push:
schedule:
- cron: '05 03 * * *'
workflow_dispatch:
permissions:
contents: read
jobs:
cross-compilation-aarch64:
# pull request title contains 'aarch64'
# pull request title contains 'arm64'
# pull request body contains '[aarch64 ci]'
# push event commit message contains '[aarch64 ci]'
# cron job
# manual dispatch
if: contains(github.event.pull_request.title, 'aarch64') || contains(github.event.pull_request.title, 'AArch64') || contains(github.event.pull_request.title, 'arm64') || contains(github.event.pull_request.body, '[aarch64 ci]') || contains(github.event.head_commit.message, '[aarch64 ci]') || (github.event_name == 'schedule' && github.repository == 'openssl/openssl') || github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
# The platform matrix specifies:
# arch: the architecture to build for, this defines the tool-chain
# prefix {arch}- and the Debian compiler package gcc-{arch}
# name.
# libs: the Debian package for the necessary link/runtime libraries.
# target: the OpenSSL configuration target to use, this is passed
# directly to the config command line.
# fips: set to "no" to disable building FIPS, leave unset to
# build the FIPS provider.
# tests: omit this to run all the tests using QEMU, set it to "none"
# to never run the tests, otherwise its value is passed to
# the "make test" command to allow selective disabling of
# tests.
# qemucpu: optional; string that describes CPU properties.
# The string will be used to set the QEMU_CPU variable.
# opensslcapsname: optional; string that describes the postfix of the
# OpenSSL environment variable that defines CPU
# capabilities. E.g. "foo" will result in an
# environment variable with the name OPENSSL_foo.
# opensslcaps: optional; if opensslcapsname (see above) is set, then
# this string will be used as content for the OpenSSL
# capabilities variable.
# capslabel: label used for artifacts.
platform: [
{
# Baseline Armv8 crypto extensions:
# include/crypto/aes_platform.h
# providers/implementations/ciphers/cipher_aes_hw_armv8.inc
# crypto/sha/asm/sha1-armv8.pl
# crypto/aes/asm/aes-sha256-armv8.pl
arch: aarch64-linux-gnu,
libs: libc6-dev-arm64-cross,
target: linux-aarch64,
fips: no,
qemucpu: max,
opensslcapsname: armcap, # OPENSSL_armcap
opensslcaps: "0x1d",
capslabel: armv8-crypto
}, {
# PMULL-enabled AES-GCM / GHASH:
# include/crypto/aes_platform.h
# crypto/modes/asm/aes-gcm-armv8_64.pl
# crypto/modes/asm/ghashv8-armx.pl
arch: aarch64-linux-gnu,
libs: libc6-dev-arm64-cross,
target: linux-aarch64,
fips: no,
qemucpu: max,
opensslcapsname: armcap, # OPENSSL_armcap
opensslcaps: "0x3d",
capslabel: armv8-pmull
}, {
# SHA512 extension:
# crypto/aes/asm/aes-sha512-armv8.pl
arch: aarch64-linux-gnu,
libs: libc6-dev-arm64-cross,
target: linux-aarch64,
fips: no,
qemucpu: max,
opensslcapsname: armcap, # OPENSSL_armcap
opensslcaps: "0x7d",
capslabel: armv8-sha512
}, {
# SHA3-accelerated path. Since OPENSSL_armcap short-circuits runtime
# detection, include the derived "worth using" and unroll bits too:
# crypto/sha/sha3.c
# providers/implementations/digests/sha3_prov.c
# providers/implementations/ciphers/cipher_aes_gcm_hw_armv8.inc
# providers/implementations/ciphers/cipher_aes_hw_armv8.inc
arch: aarch64-linux-gnu,
libs: libc6-dev-arm64-cross,
target: linux-aarch64,
fips: no,
qemucpu: max,
opensslcapsname: armcap, # OPENSSL_armcap
opensslcaps: "0x1987d",
capslabel: armv8-sha3
}, {
# SVE2 Poly1305 path. OPENSSL_armcap requires the derived
# ARMV9_SVE2_POLY1305 bit to be set explicitly when capability
# probing is overridden:
# crypto/poly1305/asm/poly1305-armv8.pl
# crypto/chacha/asm/chacha-armv8-sve.pl
arch: aarch64-linux-gnu,
libs: libc6-dev-arm64-cross,
target: linux-aarch64,
fips: no,
qemucpu: max,
opensslcapsname: armcap, # OPENSSL_armcap
opensslcaps: "0x2601d",
capslabel: armv9-sve2-poly1305
}
]
runs-on: ubuntu-latest
steps:
- name: install packages
run: |
sudo apt-get update
sudo apt-get -yq --allow-unauthenticated --allow-downgrades --allow-remove-essential --allow-change-held-packages install \
gcc-${{ matrix.platform.arch }} \
${{ matrix.platform.libs }}
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
run: git submodule update --init --depth 1 fuzz/corpora
- name: config with FIPS
if: matrix.platform.fips != 'no'
run: |
./config --banner=Configured --strict-warnings enable-fips enable-lms \
--cross-compile-prefix=${{ matrix.platform.arch }}- \
${{ matrix.platform.target }}
- name: config without FIPS
if: matrix.platform.fips == 'no'
run: |
./config --banner=Configured --strict-warnings enable-lms \
--cross-compile-prefix=${{ matrix.platform.arch }}- \
${{ matrix.platform.target }}
- name: config dump
run: ./configdata.pm --dump
- name: make
run: make -s -j4
- name: install qemu
if: matrix.platform.tests != 'none'
run: sudo apt-get -yq --allow-unauthenticated --allow-downgrades --allow-remove-essential --allow-change-held-packages install qemu-user
- name: Set QEMU environment
if: matrix.platform.qemucpu != ''
run: echo "QEMU_CPU=${{ matrix.platform.qemucpu }}" >> $GITHUB_ENV
- name: Set OpenSSL caps environment
if: matrix.platform.opensslcapsname != ''
run: echo "OPENSSL_${{ matrix.platform.opensslcapsname }}=\
${{ matrix.platform.opensslcaps }}" >> $GITHUB_ENV
- name: get cpu info
run: cat /proc/cpuinfo
- name: get openssl cpu info
if: matrix.platform.tests != 'none'
run: QEMU_LD_PREFIX=/usr/${{ matrix.platform.arch }} ./util/opensslwrap.sh info -cpusettings
- name: make all tests
if: github.event_name == 'push' && matrix.platform.tests == ''
run: |
.github/workflows/make-test \
TESTS="-test_afalg" \
QEMU_LD_PREFIX=/usr/${{ matrix.platform.arch }}
- name: make some tests
if: github.event_name == 'push' && matrix.platform.tests != 'none' && matrix.platform.tests != ''
run: |
.github/workflows/make-test \
TESTS="${{ matrix.platform.tests }} -test_afalg" \
QEMU_LD_PREFIX=/usr/${{ matrix.platform.arch }}
- name: make evp tests
if: github.event_name == 'pull_request' && matrix.platform.tests != 'none'
run: |
.github/workflows/make-test \
TESTS="test_evp*" \
QEMU_LD_PREFIX=/usr/${{ matrix.platform.arch }}
- name: save artifacts
if: success() || failure()
uses: actions/upload-artifact@v5
with:
name: "cross-compiles-aarch64@${{ matrix.platform.capslabel }}"
path: artifacts.tar.gz
if-no-files-found: ignore

167
.github/workflows/avx512-sde.yml vendored Normal file
View file

@ -0,0 +1,167 @@
# Copyright 2026 The OpenSSL Project Authors. All Rights Reserved.
# Copyright (c) 2026 Intel Corporation. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
# Run AVX512-specific tests under Intel SDE.
#
# GitHub Actions runners currently do not have AVX512 hardware.
# Intel SDE emulates AVX512 instructions and spoofs CPUID,
# so AVX512 code paths are exercised.
#
# To update Intel SDE: find the new mirror ID and file date from
# https://www.intel.com/content/www/us/en/download/684897
# and update the three env vars below.
name: AVX512 tests via Intel SDE
on:
schedule:
- cron: '30 02 * * *'
workflow_dispatch:
permissions:
contents: read
env:
SDE_VERSION: 10.8.0
SDE_DATE: 2026-03-15
SDE_MIRROR_ID: 915934
jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: install NASM
run: sudo apt-get install -y nasm
- name: install Intel SDE
run: |
SDE_URL="https://downloadmirror.intel.com/${SDE_MIRROR_ID}/sde-external-${SDE_VERSION}-${SDE_DATE}-lin.tar.xz"
SDE_SHA256="50b320cd226acef7a491f5b321fc1be3c3c7984f9e27a456e64894b5b0979dd3"
curl -fsSL -o /tmp/sde.tar.xz "$SDE_URL"
echo "$SDE_SHA256 /tmp/sde.tar.xz" | sha256sum -c -
mkdir /tmp/sde
tar -xf /tmp/sde.tar.xz -C /tmp/sde/
sudo mv /tmp/sde/sde-external-${SDE_VERSION}-${SDE_DATE}-lin /opt/sde
echo "/opt/sde" >> "$GITHUB_PATH"
- name: config
run: |
./config --banner=Configured --strict-warnings no-shared enable-fips
- name: build
run: make -j4
- name: show CPU and OpenSSL build info
run: |
cat /proc/cpuinfo | grep -m1 "model name"
sde64 -icx -- ./apps/openssl version -c
- name: ml_dsa_internal_test (AVX512 via SDE)
run: sde64 -icx -- ./test/ml_dsa_internal_test
- name: sha3_x4_internal_test (AVX512 via SDE)
run: sde64 -icx -- ./test/sha3_x4_internal_test
- name: fipsinstall (FIPS KAT via SDE)
run: sde64 -icx -- ./apps/openssl fipsinstall -module ./providers/fips.so -out /tmp/fipsmodule.cnf -provider_name fips
windows:
runs-on: windows-2022
env:
VCVARS: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: install nasm
if: github.repository == 'openssl/openssl'
run: |
$installer = "nasm-3.01-installer-x64.exe"
Invoke-WebRequest -Uri "https://openssl-library.org/ci-deps/$installer" -OutFile $installer
$expected = (Get-Content "$env:GITHUB_WORKSPACE\.github\ci-deps.json" -Raw | ConvertFrom-Json).$installer
$actual = (Get-FileHash $installer -Algorithm SHA256).Hash
if ($actual -ne $expected) { throw "SHA256 mismatch for $installer (expected $expected, got $actual)" }
Start-Process -FilePath ".\$installer" -ArgumentList '/S' -Wait
"C:\Program Files\NASM" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: install nasm (forks)
if: github.repository != 'openssl/openssl'
run: |
$installer = "nasm-3.01-installer-x64.exe"
Invoke-WebRequest -Uri "https://www.nasm.us/pub/nasm/releasebuilds/3.01/win64/$installer" -OutFile $installer
Start-Process -FilePath ".\$installer" -ArgumentList '/S' -Wait
"C:\Program Files\NASM" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: install jom
if: github.repository == 'openssl/openssl'
run: |
mkdir C:\jom
Invoke-WebRequest -Uri "https://openssl-library.org/ci-deps/jom-1.1.7.exe" -OutFile C:\jom\jom.exe
$expected = (Get-Content "$env:GITHUB_WORKSPACE\.github\ci-deps.json" -Raw | ConvertFrom-Json).'jom-1.1.7.exe'
$actual = (Get-FileHash C:\jom\jom.exe -Algorithm SHA256).Hash
if ($actual -ne $expected) { throw "SHA256 mismatch for jom.exe (expected $expected, got $actual)" }
"C:\jom" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: install jom (forks)
if: github.repository != 'openssl/openssl'
run: |
mkdir C:\jom
Invoke-WebRequest -Uri "https://download.qt.io/official_releases/jom/jom_1_1_7.zip" -OutFile C:\jom\jom.zip
Expand-Archive -Path C:\jom\jom.zip -DestinationPath C:\jom
"C:\jom" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: install Intel SDE
run: |
$url = "https://downloadmirror.intel.com/$env:SDE_MIRROR_ID/sde-external-$env:SDE_VERSION-$env:SDE_DATE-win.tar.xz"
$expected = "176F87C80EB42BB91B73E1428F4A0FD067DF322F901F9B4359B20B86B92C2BAE"
curl.exe -fsSL -o sde-win.tar.xz $url
$actual = (Get-FileHash sde-win.tar.xz -Algorithm SHA256).Hash
if ($actual -ne $expected) { throw "SDE SHA256 mismatch: got $actual" }
& "C:\Program Files\7-Zip\7z.exe" x sde-win.tar.xz -so | & "C:\Program Files\7-Zip\7z.exe" x -si -ttar -o"C:\sde"
$sdeRoot = "C:\sde\sde-external-$env:SDE_VERSION-$env:SDE_DATE-win"
if (-not (Test-Path "$sdeRoot\sde.exe")) { throw "sde.exe not found in $sdeRoot" }
"$sdeRoot" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: prepare build directory
run: mkdir _build
- name: config
working-directory: _build
shell: cmd
run: |
call "%VCVARS%"
perl ..\Configure --banner=Configured --strict-warnings no-shared enable-fips no-makedepend
- name: build
working-directory: _build
shell: cmd
run: |
call "%VCVARS%"
jom /j4 /S
- name: show CPU and OpenSSL build info
working-directory: _build
run: sde -icx -- apps\openssl.exe version -c
- name: ml_dsa_internal_test (AVX512 via SDE)
working-directory: _build
shell: cmd
run: sde -icx -- test\ml_dsa_internal_test.exe
- name: sha3_x4_internal_test (AVX512 via SDE)
working-directory: _build
shell: cmd
run: sde -icx -- test\sha3_x4_internal_test.exe
- name: fipsinstall (FIPS KAT via SDE)
working-directory: _build
shell: cmd
run: sde -icx -- apps\openssl.exe fipsinstall -module providers\fips.dll -out fipsmodule.cnf -provider_name fips

View file

@ -1,4 +1,4 @@
# Copyright 2021-2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -19,6 +19,9 @@ jobs:
matrix:
release: [
{
branch: '4.0',
cppflags: ''
}, {
branch: '3.6',
cppflags: ''
}, {
@ -27,12 +30,6 @@ jobs:
}, {
branch: '3.4',
cppflags: 'CPPFLAGS=-ansi'
}, {
branch: '3.3',
cppflags: 'CPPFLAGS=-ansi',
}, {
branch: '3.2',
cppflags: 'CPPFLAGS=-ansi'
}, {
branch: '3.0',
cppflags: 'CPPFLAGS=-ansi'
@ -40,7 +37,7 @@ jobs:
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
if: ${{ contains(join(github.event.pull_request.labels.*.name,','),matrix.release.branch) }}
with:
ref: ${{ github.event.pull_request.head.sha }}
@ -55,7 +52,7 @@ jobs:
git config user.name "OpenSSL Machine"
git config user.email "openssl-machine@openssl.org"
echo Cherry-picking $REFSTART..$REFEND
git cherry-pick $REFSTART..$REFEND
git cherry-pick $REFSTART..$REFEND || { git diff | head -n1000; exit 1; }
- name: config
if: ${{ contains(join(github.event.pull_request.labels.*.name,','),matrix.release.branch) }}
run: ${{ matrix.release.cppflags }} ./config --strict-warnings --banner=Configured no-asm enable-fips --strict-warnings -D_DEFAULT_SOURCE && perl configdata.pm --dump

105
.github/workflows/check-news-changes.yml vendored Normal file
View file

@ -0,0 +1,105 @@
# Copyright 2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
name: "Scan to check for NEWS/CHANGES suggestions"
on: pull_request
env:
NEED_NEWS_CHANGES: "no"
SKIP_NEWS_CHECK: "no"
PR_NUMBER: ${{ github.event.number }}
GH_TOKEN: ${{ github.token }}
permissions: {}
jobs:
scan_for_news_changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
fetch-depth: 0
- name: "Check if we have the label to skip this test"
run: |
SKIP_TEST=$(gh pr view $PR_NUMBER --json labels --jq '.labels[] | select(.name == "no_news_changes_needed") | .name')
if [ -n "$SKIP_TEST" ]; then
echo "SKIP_NEWS_CHECK=yes" >> $GITHUB_ENV
fi
- name: "Check if we already have a NEWS/CHANGES entry"
if: ${{ env.SKIP_NEWS_CHECK == 'no' }}
run: |
git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} > ./names.txt
echo "changed files between ${{ github.event.pull_request.base.sha }} and ${{ github.event.pull_request.head.sha }}"
cat ./names.txt
set +e
grep -q "NEWS\.md" names.txt
if [ $? -eq 0 ]; then
echo "FOUND_NEWS_CHANGES_ADDITION=yes" >> $GITHUB_ENV
else
grep -q "CHANGES\.md" names.txt
if [ $? -eq 0 ]; then
echo "FOUND_NEWS_CHANGES_ADDITION=yes" >> $GITHUB_ENV
else
echo "FOUND_NEWS_CHANGES_ADDITION=no" >> $GITHUB_ENV
fi
fi
- name: "Check if this PR affects a CVE"
if: ${{ env.FOUND_NEWS_CHANGES_ADDITION == 'no' && env.SKIP_NEWS_CHECK == 'no' }}
run: |
git log ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} > ./log.txt
set +e
grep -q "CVE-" ./log.txt
if [ $? -eq 0 ]; then
echo "Changes in this PR reference a CVE"
echo "NEED_NEWS_CHANGES=yes" >> $GITHUB_ENV
fi
- name: "Check if this PR impacts a public API"
if: ${{ env.FOUND_NEWS_CHANGES_ADDITION == 'no' && env.SKIP_NEWS_CHECK == 'no' }}
run: |
set +e
git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} > ./names.txt
echo "changed files between ${{ github.event.pull_request.base.sha }} and ${{ github.event.pull_request.head.sha }}"
cat ./names.txt
grep -q "include/openssl" ./names.txt
if [ $? -eq 0 ]; then
echo "Changes in this PR may impact public APIS's"
echo "NEED_NEWS_CHANGES=yes" >> $GITHUB_ENV
fi
- name: "Check if this is a feature branch merge"
if: ${{ env.FOUND_NEWS_CHANGES_ADDITION == 'no' && env.SKIP_NEWS_CHECK == 'no' }}
run: |
set +e
echo ${{ github.head_ref }} | grep -q "feature"
if [ $? -eq 0 ]; then
echo "Feature branch found"
echo "NEED_NEWS_CHANGES=yes" >> $GITHUB_ENV
fi
- name: "Check if configuration options have changed"
if: ${{ env.FOUND_NEWS_CHANGES_ADDITION == 'no' && env.SKIP_NEWS_CHECK == 'no' }}
run: |
git checkout ${{ github.event.pull_request.base.sha }}
set +e
./Configure --help > ./before.txt 2>&1
git checkout ${{ github.event.pull_request.head.sha }}
./Configure --help > ./after.txt 2>&1
set -e
CONF_CHANGE=$(diff ./before.txt ./after.txt | wc -l)
if [ $CONF_CHANGE -ne 0 ]; then
echo "Configuration options changes"
echo "NEED_NEWS_CHANGES=yes" >> $GITHUB_ENV
fi
- name: "Report Results"
if: ${{ env.SKIP_NEWS_CHECK == 'no' }}
run: |
if [ "${{ env.NEED_NEWS_CHANGES }}" == "yes" ]; then
echo "Suggest that you add a NEWS/CHANGES entry for this PR"
echo "Alternatively, quiet this suggestion by applying the no_news_changes_needed label"
exit 1
fi

125
.github/workflows/ci-doc-changes.yml vendored Normal file
View file

@ -0,0 +1,125 @@
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
name: Documentation and Installability CI
on: [pull_request, push]
permissions:
contents: read
env:
OSSL_RUN_CI_TESTS: 1
jobs:
check_docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: config
run: ./config --strict-warnings --banner=Configured enable-fips && perl configdata.pm --dump
- name: make build_generated
run: make -s build_generated
- name: make doc-nits
run: make doc-nits
- name: make help
run: make help
- name: make md-nits
run: |
sudo gem install mdl
make md-nits
# out-of-source-and-install checks multiple things at the same time:
# - That building, testing and installing works from an out-of-source
# build tree
# - That building, testing and installing works with a read-only source
# tree
out-of-readonly-source-and-install-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
path: ./source
persist-credentials: false
- name: checkout fuzz/corpora submodule
run: git submodule update --init --depth 1 fuzz/corpora
working-directory: ./source
- name: make source read-only
run: chmod -R a-w ./source
- name: create build and install directories
run: |
mkdir ./build
mkdir ./install
- name: config
run: |
../source/config --banner=Configured enable-demos enable-h3demo enable-fips enable-lms enable-quic enable-acvp-tests --strict-warnings --prefix=$(cd ../install; pwd)
perl configdata.pm --dump
working-directory: ./build
- name: make
run: make -s -j4
working-directory: ./build
- name: get cpu info
run: |
cat /proc/cpuinfo
./util/opensslwrap.sh version -c
working-directory: ./build
- name: make test
run: ../source/.github/workflows/make-test
working-directory: ./build
- name: save artifacts
if: success() || failure()
uses: actions/upload-artifact@v5
with:
name: "ci@out-of-readonly-source-and-install-ubuntu"
path: build/artifacts.tar.gz
- name: make install
run: make install
working-directory: ./build
out-of-readonly-source-and-install-macos:
runs-on: macos-15
steps:
- uses: actions/checkout@v6
with:
path: ./source
persist-credentials: false
- name: checkout fuzz/corpora submodule
run: git submodule update --init --depth 1 fuzz/corpora
working-directory: ./source
- name: make source read-only
run: chmod -R a-w ./source
- name: create build and install directories
run: |
mkdir ./build
mkdir ./install
- name: config
run: |
../source/config --banner=Configured enable-fips enable-lms enable-demos enable-h3demo enable-quic enable-acvp-tests --strict-warnings --prefix=$(cd ../install; pwd)
perl configdata.pm --dump
working-directory: ./build
- name: make
run: make -s -j4
working-directory: ./build
- name: get cpu info
run: |
sysctl machdep.cpu
./util/opensslwrap.sh version -c
working-directory: ./build
- name: make test
run: ../source/.github/workflows/make-test
working-directory: ./build
- name: save artifacts
if: success() || failure()
uses: actions/upload-artifact@v5
with:
name: "ci@out-of-readonly-source-and-install-macos-15"
path: build/artifacts.tar.gz
- name: make install
run: make install
working-directory: ./build

View file

@ -1,4 +1,4 @@
# Copyright 2021-2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -7,7 +7,25 @@
name: GitHub CI
on: [pull_request, push]
on:
pull_request:
paths-ignore:
- 'doc/**'
- '*.md'
- '*.pod'
- 'README*'
- 'funding.json'
- 'LICENSE.txt'
- 'VERSION.dat'
push:
paths-ignore:
- 'doc/**'
- '*.md'
- '*.pod'
- 'README*'
- 'funding.json'
- 'LICENSE.txt'
- 'VERSION.dat'
# for some reason, this does not work:
# variables:
@ -32,7 +50,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get -yq --no-install-suggests --no-install-recommends --allow-unauthenticated --allow-downgrades --allow-remove-essential --allow-change-held-packages install unifdef
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
@ -45,32 +63,13 @@ jobs:
- name: git diff
run: git diff --exit-code
check_docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: config
run: ./config --strict-warnings --banner=Configured enable-fips && perl configdata.pm --dump
- name: make build_generated
run: make -s build_generated
- name: make doc-nits
run: make doc-nits
- name: make help
run: make help
- name: make md-nits
run: |
sudo gem install mdl
make md-nits
# This checks that we use ANSI C language syntax and semantics.
# We are not as strict with libraries, but rather adapt to what's
# expected to be available in a certain version of each platform.
check-c99:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: config
@ -81,19 +80,21 @@ jobs:
basic_gcc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
run: git submodule update --init --depth 1 fuzz/corpora
- name: localegen
run: sudo locale-gen tr_TR.UTF-8
- name: cmocka
run: sudo apt-get -y install libcmocka-dev
- name: fipsvendor
# Make one fips build use a customized FIPS vendor
run: echo "FIPS_VENDOR=CI" >> VERSION.dat
- name: config
# enable-quic is on by default, but we leave it here to check we're testing the explicit enable somewhere
run: CC=gcc ./config --strict-warnings --banner=Configured enable-demos enable-h3demo enable-sslkeylog enable-fips enable-quic enable-lms && perl configdata.pm --dump
run: CC=gcc ./config --strict-warnings --banner=Configured enable-demos enable-h3demo enable-ec_explicit_curves enable-sslkeylog enable-fips enable-quic enable-lms enable-unit-tests && perl configdata.pm --dump
- name: make
run: make -s -j4
- name: get cpu info
@ -115,7 +116,7 @@ jobs:
basic_clang:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -140,11 +141,11 @@ jobs:
linux-arm64:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: config
run: ./config --strict-warnings enable-demos enable-fips enable-lms enable-ec_nistp_64_gcc_128 enable-md2 enable-rc5 enable-ssl3 enable-ssl3-method enable-trace
run: ./config --strict-warnings enable-demos enable-fips enable-lms enable-ec_nistp_64_gcc_128 enable-md2 enable-rc5 enable-trace
- name: config dump
run: ./configdata.pm --dump
- name: make
@ -162,10 +163,35 @@ jobs:
name: "ci@linux-arm64"
path: artifacts.tar.gz
gcc-min-version:
runs-on: ubuntu-latest
container:
image: docker.io/gcc:9
timeout-minutes: 90
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: config
run: ./config --strict-warnings --banner=Configured enable-fips && perl configdata.pm --dump
- name: make
run: make -s -j4
- name: print gcc version
run: |
gcc --version
- name: get cpu info
run: |
cat /proc/cpuinfo
./util/opensslwrap.sh version -c
- name: make test
run: .github/workflows/make-test
linux-x86:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: run container
@ -178,7 +204,7 @@ jobs:
- name: config
run: |
podman exec -t $CONTAINER_ID sh -c \
"./config --strict-warnings linux-x86 enable-demos enable-fips enable-lms enable-md2 enable-rc5 enable-ssl3 enable-ssl3-method enable-trace"
"./config --strict-warnings linux-x86 enable-demos enable-fips enable-lms enable-md2 enable-rc5 enable-trace"
- name: config dump
run: |
podman exec -t $CONTAINER_ID sh -c \
@ -206,7 +232,7 @@ jobs:
freebsd-x86_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: config
@ -217,7 +243,7 @@ jobs:
shutdown_vm: false
run: |
sudo pkg install -y gcc perl5
./config --strict-warnings enable-fips enable-lms enable-ec_nistp_64_gcc_128 enable-md2 enable-rc5 enable-ssl3 enable-ssl3-method enable-trace
./config --strict-warnings enable-fips enable-lms enable-ec_nistp_64_gcc_128 enable-md2 enable-rc5 enable-trace
- name: config dump
uses: cross-platform-actions/action@46e8d7fb25520a8d6c64fd2b7a1192611da98eda #v0.30.0
with:
@ -250,7 +276,7 @@ jobs:
minimal:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -275,7 +301,7 @@ jobs:
no-deprecated:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -300,7 +326,7 @@ jobs:
no-shared-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -325,7 +351,7 @@ jobs:
no-shared-macos:
runs-on: macos-14
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -350,7 +376,7 @@ jobs:
non-caching:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -379,7 +405,7 @@ jobs:
address_ub_sanitizer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -389,7 +415,7 @@ jobs:
sudo cat /proc/sys/vm/mmap_rnd_bits
sudo sysctl -w vm.mmap_rnd_bits=28
- name: config
run: ./config --strict-warnings --banner=Configured --debug enable-demos enable-h3demo enable-asan enable-ubsan enable-rc5 enable-md2 enable-ec_nistp_64_gcc_128 enable-fips enable-lms && perl configdata.pm --dump
run: ./config --strict-warnings --banner=Configured --debug enable-demos enable-h3demo enable-asan enable-ec_explicit_curves enable-ubsan enable-rc5 enable-md2 enable-ec_nistp_64_gcc_128 enable-fips enable-lms && perl configdata.pm --dump
- name: make
run: make -s -j4
- name: get cpu info
@ -408,7 +434,7 @@ jobs:
fuzz_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -418,7 +444,7 @@ jobs:
sudo cat /proc/sys/vm/mmap_rnd_bits
sudo sysctl -w vm.mmap_rnd_bits=28
- name: config
run: ./config --strict-warnings --banner=Configured --debug -DPEDANTIC -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION enable-asan enable-ubsan enable-rc5 enable-md2 enable-ec_nistp_64_gcc_128 enable-weak-ssl-ciphers enable-ssl3 enable-ssl3-method enable-nextprotoneg && perl configdata.pm --dump
run: ./config --strict-warnings --banner=Configured --debug -DPEDANTIC -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION enable-asan enable-ec_explicit_curves enable-ubsan enable-rc5 enable-md2 enable-ec_nistp_64_gcc_128 enable-weak-ssl-ciphers enable-nextprotoneg && perl configdata.pm --dump
- name: make
run: make -s -j4
- name: get cpu info
@ -435,10 +461,44 @@ jobs:
path: artifacts.tar.gz
if-no-files-found: ignore
fuzz_tests_mfail:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
run: git submodule update --init --depth 1 fuzz/corpora
- name: Adjust ASLR for sanitizer
run: sudo sysctl -w vm.mmap_rnd_bits=28
- name: config
run: |
./config --strict-warnings --banner=Configured --debug \
-DPEDANTIC -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION \
enable-asan enable-ec_explicit_curves enable-ubsan \
enable-rc5 enable-md2 enable-ec_nistp_64_gcc_128 \
enable-weak-ssl-ciphers enable-nextprotoneg
perl configdata.pm --dump
- name: make
run: make -s -j4
- name: make test (fuzz with mfail)
env:
OSSL_FUZZ_TEST_BUDGET: 1200
OSSL_FUZZ_TEST_JOBS: 4
run: .github/workflows/make-test OPENSSL_TEST_RAND_ORDER=0 TESTS="test_fuzz*"
- name: save artifacts
if: success() || failure()
uses: actions/upload-artifact@v5
with:
name: "ci@fuzz_tests_mfail"
path: artifacts.tar.gz
if-no-files-found: ignore
memory_sanitizer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -449,7 +509,7 @@ jobs:
sudo sysctl -w vm.mmap_rnd_bits=28
- name: config
# --debug -O1 is to produce a debug build that runs in a reasonable amount of time
run: CC=clang ./config --strict-warnings --banner=Configured --debug no-shared -O1 -fsanitize=memory -DOSSL_SANITIZE_MEMORY -fno-optimize-sibling-calls enable-rc5 enable-md2 enable-ec_nistp_64_gcc_128 enable-fips enable-lms no-slh-dsa && perl configdata.pm --dump
run: CC=clang ./config --strict-warnings --banner=Configured --debug no-shared -O1 -fsanitize=memory -DOSSL_SANITIZE_MEMORY -fno-optimize-sibling-calls enable-rc5 enable-md2 enable-ec_nistp_64_gcc_128 enable-ec_explicit_curves enable-fips enable-lms no-slh-dsa && perl configdata.pm --dump
- name: make
run: make -s -j4
- name: get cpu info
@ -468,7 +528,7 @@ jobs:
threads_sanitizer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -497,7 +557,7 @@ jobs:
enable_non-default_options:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -524,7 +584,7 @@ jobs:
full_featured:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -538,7 +598,7 @@ jobs:
- name: install extra config support
run: sudo apt-get -y install libsctp-dev abigail-tools libzstd-dev zstd
- name: config
run: ./config --strict-warnings --banner=Configured enable-demos enable-h3demo enable-ktls enable-fips enable-lms enable-egd enable-ec_nistp_64_gcc_128 enable-md2 enable-rc5 enable-sctp enable-ssl3 enable-ssl3-method enable-weak-ssl-ciphers enable-trace enable-zlib enable-zstd && perl configdata.pm --dump
run: ./config --strict-warnings --banner=Configured enable-demos enable-h3demo enable-ec_explicit_curves enable-ktls enable-fips enable-lms enable-egd enable-ec_nistp_64_gcc_128 enable-md2 enable-rc5 enable-sctp enable-weak-ssl-ciphers enable-trace enable-zlib enable-zstd && perl configdata.pm --dump
- name: make
run: make -s -j4
- name: get cpu info
@ -557,7 +617,7 @@ jobs:
no-legacy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -582,13 +642,13 @@ jobs:
legacy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
run: git submodule update --init --depth 1 fuzz/corpora
- name: config
run: ./config --strict-warnings --banner=Configured --debug enable-demos enable-h3demo no-shared enable-crypto-mdebug enable-rc5 enable-md2 enable-ssl3 enable-ssl3-method enable-weak-ssl-ciphers enable-zlib enable-ec_nistp_64_gcc_128 no-fips && perl configdata.pm --dump
run: ./config --strict-warnings --banner=Configured --debug enable-demos enable-h3demo no-shared enable-crypto-mdebug enable-rc5 enable-md2 enable-weak-ssl-ciphers enable-zlib enable-ec_nistp_64_gcc_128 enable-ec_explicit_curves no-fips && perl configdata.pm --dump
- name: make
run: make -s -j4
- name: get cpu info
@ -604,99 +664,10 @@ jobs:
name: "ci@legacy"
path: artifacts.tar.gz
# out-of-source-and-install checks multiple things at the same time:
# - That building, testing and installing works from an out-of-source
# build tree
# - That building, testing and installing works with a read-only source
# tree
out-of-readonly-source-and-install-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
path: ./source
persist-credentials: false
- name: checkout fuzz/corpora submodule
run: git submodule update --init --depth 1 fuzz/corpora
working-directory: ./source
- name: make source read-only
run: chmod -R a-w ./source
- name: create build and install directories
run: |
mkdir ./build
mkdir ./install
- name: config
run: |
../source/config --banner=Configured enable-demos enable-h3demo enable-fips enable-lms enable-quic enable-acvp-tests --strict-warnings --prefix=$(cd ../install; pwd)
perl configdata.pm --dump
working-directory: ./build
- name: make
run: make -s -j4
working-directory: ./build
- name: get cpu info
run: |
cat /proc/cpuinfo
./util/opensslwrap.sh version -c
working-directory: ./build
- name: make test
run: ../source/.github/workflows/make-test
working-directory: ./build
- name: save artifacts
if: success() || failure()
uses: actions/upload-artifact@v5
with:
name: "ci@out-of-readonly-source-and-install-ubuntu"
path: build/artifacts.tar.gz
- name: make install
run: make install
working-directory: ./build
out-of-readonly-source-and-install-macos:
runs-on: macos-15
steps:
- uses: actions/checkout@v5
with:
path: ./source
persist-credentials: false
- name: checkout fuzz/corpora submodule
run: git submodule update --init --depth 1 fuzz/corpora
working-directory: ./source
- name: make source read-only
run: chmod -R a-w ./source
- name: create build and install directories
run: |
mkdir ./build
mkdir ./install
- name: config
run: |
../source/config --banner=Configured enable-fips enable-lms enable-demos enable-h3demo enable-quic enable-acvp-tests --strict-warnings --prefix=$(cd ../install; pwd)
perl configdata.pm --dump
working-directory: ./build
- name: make
run: make -s -j4
working-directory: ./build
- name: get cpu info
run: |
sysctl machdep.cpu
./util/opensslwrap.sh version -c
working-directory: ./build
- name: make test
run: ../source/.github/workflows/make-test
working-directory: ./build
- name: save artifacts
if: success() || failure()
uses: actions/upload-artifact@v5
with:
name: "ci@out-of-readonly-source-and-install-macos-15"
path: build/artifacts.tar.gz
- name: make install
run: make install
working-directory: ./build
external-tests-misc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
submodules: recursive
persist-credentials: false
@ -704,14 +675,10 @@ jobs:
run: |
sudo apt-get update
sudo apt-get -yq install bison gettext keyutils ldap-utils libldap2-dev libkeyutils-dev python3 python3-paste python3-pyrad slapd tcsh python3-virtualenv virtualenv python3-kdcproxy gdb libtls-dev wget gpg
- name: install cpanm and Test2::V0 for gost_engine testing
uses: perl-actions/install-with-cpanm@10d60f00b4073f484fc29d45bfbe2f776397ab3d # v1.7
with:
install: Test2::V0
- name: setup hostname workaround
run: sudo hostname localhost
- name: config
run: ./config --strict-warnings --banner=Configured --debug enable-rc5 enable-md2 enable-ssl3 enable-ssl3-method enable-weak-ssl-ciphers enable-zlib enable-ec_nistp_64_gcc_128 enable-external-tests no-fips && perl configdata.pm --dump
run: ./config --strict-warnings --banner=Configured --debug enable-rc5 enable-md2 enable-weak-ssl-ciphers enable-zlib enable-ec_nistp_64_gcc_128 enable-external-tests no-fips && perl configdata.pm --dump
- name: make
run: make -s -j4
- uses: dtolnay/rust-toolchain@0f44b27771c32bda9f458f75a1e241b09791b331
@ -721,8 +688,9 @@ jobs:
run: |
cat /proc/cpuinfo
./util/opensslwrap.sh version -c
- name: test external gost-engine
run: make test TESTS="test_external_gost_engine"
- name: test failure when selecting non-existing test case
run: |
! make test TESTS="test_external_gost_engine"
- name: test external krb5
run: make test TESTS="test_external_krb5"
- name: test external tlsfuzzer
@ -740,7 +708,7 @@ jobs:
external-tests-oqs-provider:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
submodules: recursive
persist-credentials: false
@ -761,13 +729,13 @@ jobs:
steps:
- name: package installs
run: |
dnf install -y perl-FindBin perl-IPC-Cmd perl-File-Compare perl-File-Copy perl-Test-Simple perl-Test-Harness python3 make g++ perl git meson opensc expect kryoptic
- uses: actions/checkout@v5
dnf install -y perl-FindBin perl-IPC-Cmd perl-File-Compare perl-File-Copy perl-Test-Simple perl-Test-Harness python3 make g++ perl git meson opensc expect kryoptic xxd
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora and pkcs11-provider submodule
run: |
git config --global --add safe.directory /__w/openssl/openssl
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git submodule update --init --depth 1 fuzz/corpora
git submodule update --init --depth 1 pkcs11-provider
- name: config
@ -793,7 +761,7 @@ jobs:
PYTHON:
- 3.9
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
submodules: recursive
persist-credentials: false
@ -818,3 +786,50 @@ jobs:
./util/opensslwrap.sh version -c
- name: test external pyca
run: make test TESTS="test_external_pyca" VERBOSE=1
external-test-bssl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Configure OpenSSL
run: ./config enable-external-tests
- name: Build OpenSSL
run: make -s -j4
- name: Clone BoringSSL 0.20260211.0
run: git clone --depth 1 --branch 0.20260211.0 https://boringssl.googlesource.com/boringssl
- name: Configure and Build BoringSSL
run: |
cd boringssl
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=../../boringssl/.local ..
make -s -j4
make install
cd ../..
- name: Test ECH with BoringSSL
run: make test TESTS='test_external_ech_bssl' V=1
external-test-nss:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Configure OpenSSL
run: ./config enable-external-tests
- name: Build OpenSSL
run: make -s -j4
- name: Clone and Build NSS
run: |
mkdir nss
cd nss
git clone --depth 1 --branch NSS_3_112_3_RTM https://github.com/nss-dev/nss.git
hg clone https://hg.mozilla.org/projects/nspr -r NSPR_4_36_BRANCH
cd nss
USE_64=1 make nss_build_all
USE_64=1 make install
cd ../..
- name: Test ECH with NSS
run: make test TESTS='test_external_ech_nss' V=1

View file

@ -1,4 +1,4 @@
# Copyright 2021-2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -24,7 +24,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get -y install ${{ matrix.gcc }}
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -37,7 +37,7 @@ jobs:
- name: config dump
run: ./configdata.pm --dump
- name: make
run: make -s -j
run: make -s -j4
- name: get cpu info
run: |
cat /proc/cpuinfo
@ -49,7 +49,7 @@ jobs:
strategy:
fail-fast: false
matrix:
clang: [clang-11, clang-12, clang-13, clang-14, clang-15, clang-16, clang-17, clang-18, clang-19, clang-20]
clang: [clang-11, clang-12, clang-13, clang-14, clang-15, clang-16, clang-17, clang-18, clang-19, clang-20, clang-21]
runs-on: ubuntu-22.04
steps:
- name: install packages
@ -60,7 +60,7 @@ jobs:
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-$VERSION main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update || true
sudo apt-get -y install ${{ matrix.clang }}
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -73,7 +73,7 @@ jobs:
- name: config dump
run: ./configdata.pm --dump
- name: make
run: make -s -j
run: make -s -j4
- name: get cpu info
run: |
cat /proc/cpuinfo

View file

@ -1,4 +1,4 @@
# Copyright 2021-2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -46,29 +46,23 @@ jobs:
else
MATRIX=$(cat << EOF
[{
"branch": "master",
"extra_config": "enable-fips enable-tfo enable-lms enable-crypto-mdebug enable-unit-tests"
}, {
"branch": "openssl-4.0",
"extra_config": "enable-fips enable-tfo enable-lms enable-crypto-mdebug"
},{
"branch": "openssl-3.6",
"extra_config": "no-afalgeng enable-fips enable-tfo"
"extra_config": "no-afalgeng enable-fips enable-tfo enable-lms"
},{
"branch": "openssl-3.5",
"extra_config": "no-afalgeng enable-fips enable-tfo"
},{
"branch": "openssl-3.4",
"extra_config": "no-afalgeng enable-fips enable-tfo"
}, {
"branch": "openssl-3.3",
"extra_config": "no-afalgeng enable-fips enable-tfo"
}, {
"branch": "openssl-3.2",
"extra_config": "no-afalgeng enable-fips enable-tfo"
}, {
"branch": "openssl-3.1",
"extra_config": "no-afalgeng enable-fips"
}, {
"branch": "openssl-3.0",
"extra_config": "no-afalgeng enable-fips"
}, {
"branch": "master",
"extra_config": "enable-fips enable-tfo enable-lms enable-crypto-mdebug enable-allocfail-tests"
}]
EOF
)
@ -87,7 +81,7 @@ jobs:
branches: ${{ fromJSON(needs.define-matrix.outputs.branches) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
submodules: recursive
ref: ${{ matrix.branches.branch }}
@ -99,7 +93,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get -yq install lcov
sudo apt-get -yq install bison gettext keyutils ldap-utils libldap2-dev libkeyutils-dev python3 python3-paste python3-pyrad slapd tcsh python3-virtualenv virtualenv python3-kdcproxy
sudo apt-get -yq install bison gettext keyutils ldap-utils libcmocka-dev libldap2-dev libkeyutils-dev python3 python3-paste python3-pyrad slapd tcsh python3-virtualenv virtualenv python3-kdcproxy
- name: install Test2::V0 for gost_engine testing
uses: perl-actions/install-with-cpanm@10d60f00b4073f484fc29d45bfbe2f776397ab3d #v1.7
with:
@ -107,7 +101,7 @@ jobs:
- name: setup hostname workaround
run: sudo hostname localhost
- name: config
run: CC=gcc ./config --debug --coverage ${{ matrix.branches.extra_config }} no-asm enable-rc5 enable-md2 enable-ssl3 enable-nextprotoneg enable-ssl3-method enable-weak-ssl-ciphers enable-zlib enable-ec_nistp_64_gcc_128 enable-buildtest-c++ enable-ssl-trace enable-trace
run: CC=gcc ./config --debug --coverage ${{ matrix.branches.extra_config }} no-asm enable-rc5 enable-md2 enable-nextprotoneg enable-weak-ssl-ciphers enable-zlib enable-ec_nistp_64_gcc_128 enable-buildtest-c++ enable-ssl-trace enable-trace
- name: config dump
run: ./configdata.pm --dump
- name: make

View file

@ -1,4 +1,4 @@
# Copyright 2021-2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -7,13 +7,35 @@
name: Cross Compile
on: [pull_request, push]
on:
pull_request:
paths-ignore:
- 'doc/**'
- '*.md'
- '*.pod'
- 'README*'
- 'funding.json'
- 'LICENSE.txt'
- 'VERSION.dat'
push:
paths-ignore:
- 'doc/**'
- '*.md'
- '*.pod'
- 'README*'
- 'funding.json'
- 'LICENSE.txt'
- 'VERSION.dat'
permissions:
contents: read
jobs:
cross-compilation:
# Run the full test suite on push, and on pull requests labelled with
# 'extended tests'. Other pull requests only run the EVP tests.
env:
EXTENDED: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'extended tests') }}
strategy:
fail-fast: false
matrix:
@ -168,7 +190,7 @@ jobs:
sudo apt-get -yq --allow-unauthenticated --allow-downgrades --allow-remove-essential --allow-change-held-packages install \
gcc-${{ matrix.platform.arch }} \
${{ matrix.platform.libs }}
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -211,19 +233,19 @@ jobs:
cat /proc/cpuinfo
QEMU_LD_PREFIX=/usr/${{ matrix.platform.arch }} ./util/opensslwrap.sh version -c
- name: make all tests
if: github.event_name == 'push' && matrix.platform.tests == ''
if: env.EXTENDED == 'true' && matrix.platform.tests == ''
run: |
.github/workflows/make-test \
TESTS="-test_afalg" \
QEMU_LD_PREFIX=/usr/${{ matrix.platform.arch }}
- name: make some tests
if: github.event_name == 'push' && matrix.platform.tests != 'none' && matrix.platform.tests != ''
if: env.EXTENDED == 'true' && matrix.platform.tests != 'none' && matrix.platform.tests != ''
run: |
.github/workflows/make-test \
TESTS="${{ matrix.platform.tests }} -test_afalg" \
QEMU_LD_PREFIX=/usr/${{ matrix.platform.arch }}
- name: make evp tests
if: github.event_name == 'pull_request' && matrix.platform.tests != 'none'
if: env.EXTENDED != 'true' && matrix.platform.tests != 'none'
run: |
.github/workflows/make-test \
TESTS="test_evp*" \

View file

@ -0,0 +1,110 @@
# Copyright 2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
name: Constant-time validation (daily)
# Verifies that several algorithms needing constant-time execution do not
# branch on secret data.
#
# The library is built with enable-ct-validation, which defines
# OPENSSL_CONSTANT_TIME_VALIDATION and causes secret regions to be marked
# as "uninitialised" from Valgrind memcheck's perspective. The tests are
# then run via "make test" with OSSL_VALGRIND_CT=yes, which makes
# OpenSSL::Test::test() wrap every test binary with:
#
# valgrind --tool=memcheck --track-origins=yes --error-exitcode=1
#
# The wrapper chain (util/wrap.pl -> util/shlib_wrap.sh) is preserved, so
# LD_LIBRARY_PATH is set correctly for shared-library builds. Any
# control-flow branch or memory index that depends on secret data causes
# valgrind to exit with code 1, which propagates back through the test
# harness and fails the job.
#
# See include/internal/constant_time.h for the CONSTTIME_SECRET /
# CONSTTIME_DECLASSIFY macro documentation.
#
# Architecture note: Valgrind's memcheck supports x86_64, aarch64, s390x,
# and ppc64 well. GitHub Actions provides hosted runners for x86_64
# (ubuntu-latest) and aarch64 (ubuntu-24.04-arm); we test both here.
# s390x and ppc64 runners are not available in the public GitHub Actions
# fleet, so they are not included.
#
# Package note: on Debian/Ubuntu the valgrind package bundles the C headers
# (valgrind/memcheck.h) — no separate -dev package is required. On Fedora
# the headers are in valgrind-devel; see Configure for the full list.
on:
schedule:
- cron: '45 03 * * *'
workflow_dispatch:
permissions:
contents: read
jobs:
ct-validation:
if: github.repository == 'openssl/openssl'
strategy:
fail-fast: false
matrix:
# Constant-timeness is a property of the generated machine code, which
# the compiler derives differently per architecture. Therefore we verify
# both the assembly and C implementations on every architecture we can
# run Valgrind on.
include:
# Default builds use assembler implementations (when available)
- name: linux-x86_64
runs-on: ubuntu-latest
config_extra: ""
- name: linux-aarch64
runs-on: ubuntu-24.04-arm
config_extra: ""
# no-asm builds always use C implementations
- name: linux-x86_64-no-asm
runs-on: ubuntu-latest
config_extra: no-asm
- name: linux-aarch64-no-asm
runs-on: ubuntu-24.04-arm
config_extra: no-asm
name: CT validation (${{ matrix.name }})
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install valgrind
# On Debian/Ubuntu the main 'valgrind' package includes
# /usr/include/valgrind/memcheck.h — no separate -dev package needed.
run: |
sudo apt-get -y update
sudo apt-get -y install valgrind
- name: Configure with CT validation enabled
run: |
./Configure enable-ct-validation ${{ matrix.config_extra }}
./configdata.pm --dump
- name: Build
run: make -j$(nproc)
- name: Run CT validation under Valgrind
# OSSL_VALGRIND_CT=yes causes OpenSSL::Test::test() to wrap each
# test binary with valgrind --track-origins=yes --error-exitcode=1.
# util/wrap.pl -> util/shlib_wrap.sh sets LD_LIBRARY_PATH first, so
# the shared libraries are found correctly.
#
# Algorithms covered:
# - memcmp: test_crypto_memcmp
# - ML-KEM: test_internal_ml_kem
# - ML-DSA: test_internal_ml_dsa
run: |
make TESTS="test_internal_ml_kem test_internal_ml_dsa test_crypto_memcmp" \
OSSL_VALGRIND_CT=yes \
test

View file

@ -1,4 +1,4 @@
# Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -6,7 +6,16 @@
# https://www.openssl.org/source/license.html
name: FIPS Check and ABIDIFF
on: [pull_request]
on:
pull_request:
paths-ignore:
- 'doc/**'
- '*.md'
- '*.pod'
- 'README*'
- 'funding.json'
- 'LICENSE.txt'
- 'VERSION.dat'
permissions:
contents: read
@ -26,7 +35,7 @@ jobs:
mkdir ./build
mkdir ./source
mkdir ./artifact
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
repository: ${{ github.event.pull_request.base.repo.full_name }}
ref: ${{ github.event.pull_request.base.ref }}
@ -44,7 +53,7 @@ jobs:
- name: make fips-checksums pristine
run: make fips-checksums
working-directory: ./build-pristine
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
path: source
persist-credentials: false
@ -79,7 +88,7 @@ jobs:
compute-abidiff:
runs-on: ubuntu-latest
env:
BUILD_OPTS: -g --strict-warnings enable-ktls enable-fips enable-egd enable-ec_nistp_64_gcc_128 enable-md2 enable-rc5 enable-sctp enable-ssl3 enable-ssl3-method enable-trace enable-zlib enable-zstd
BUILD_OPTS: -g --strict-warnings enable-ktls enable-fips enable-egd enable-ec_nistp_64_gcc_128 enable-md2 enable-rc5 enable-sctp enable-trace enable-zlib enable-zstd
steps:
- name: create build dirs
run: |
@ -90,7 +99,7 @@ jobs:
mkdir ./artifact
- name: install extra config support
run: sudo apt-get -y install libsctp-dev abigail-tools libzstd-dev zstd
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
repository: ${{ github.event.pull_request.base.repo.full_name }}
ref: ${{ github.event.pull_request.base.ref }}
@ -102,7 +111,7 @@ jobs:
- name: make pristine
run: make -s -j4
working-directory: ./build-pristine
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
path: source
persist-credentials: false

View file

@ -1,4 +1,4 @@
# Copyright 2021-2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -35,7 +35,7 @@ jobs:
name: libFuzzer+,
config: enable-fuzz-libfuzzer enable-asan enable-ubsan -fno-sanitize=function -fsanitize-coverage=trace-cmp -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION,
libs: --with-fuzzer-lib=/usr/lib/llvm-18/lib/libFuzzer.a --with-fuzzer-include=/usr/include/clang/18/include/fuzzer,
extra: enable-fips enable-lms enable-ec_nistp_64_gcc_128 -fno-sanitize=alignment enable-tls1_3 enable-weak-ssl-ciphers enable-rc5 enable-md2 enable-ssl3 enable-ssl3-method enable-nextprotoneg,
extra: enable-fips enable-lms enable-ec_nistp_64_gcc_128 -fno-sanitize=alignment enable-tls1_3 enable-weak-ssl-ciphers enable-rc5 enable-md2 enable-nextprotoneg,
install: libfuzzer-18-dev,
cc: clang-18,
linker: clang++-18,
@ -52,7 +52,7 @@ jobs:
run: |
sudo cat /proc/sys/vm/mmap_rnd_bits
sudo sysctl -w vm.mmap_rnd_bits=28
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false

View file

@ -16,7 +16,7 @@ jobs:
if: github.repository == 'openssl/openssl'
runs-on: ubuntu-22.04
container:
image: docker.io/fedora:40
image: docker.io/fedora:43
options: --sysctl net.ipv6.conf.lo.disable_ipv6=0
timeout-minutes: 90
strategy:
@ -26,30 +26,31 @@ jobs:
env:
COMPONENT: ${{ matrix.COMPONENT }}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Display environment
run: export
- name : Install needed tools
run: |
dnf -y install perl gcc rpmdevtools dnf-utils make tmt-all beakerlib \
fips-mode-setup crypto-policies-scripts
dnf -y install perl gcc make \
rpmdevtools dnf-utils \
tmt-all beakerlib \
crypto-policies-scripts
- name: install interop tests
run: |
cd ${GITHUB_WORKSPACE}
git clone --branch=openssl-v0.1 --depth=1 https://gitlab.com/redhat-crypto/tests/interop.git
git clone --branch=openssl-v0.2 --depth=1 https://gitlab.com/redhat-crypto/tests/interop.git
- name: build openssl as an rpm
run: |
mkdir -p /build/SPECS && cd /build && echo -e "%_topdir /build\n%_lto_cflags %{nil}" >~/.rpmmacros && rpmdev-setuptree
cd /build && cp ${GITHUB_WORKSPACE}/interop/openssl/openssl.spec SPECS/ && \
cd SPECS/ && source ${GITHUB_WORKSPACE}/VERSION.dat && \
sed -i "s/soversion 3/soversion $SHLIB_VERSION/;s/^Version: .*\$/Version: $MAJOR.$MINOR.$PATCH/" openssl.spec && \
sed -i "/^%attr.*_libdir.*engines-/ d" openssl.spec && \
sed -i 's/^Release: .*$/Release: dev/' openssl.spec
sed -i "s/SOVERSION/$SHLIB_VERSION/" openssl.spec && \
sed -i "s/^Version: .*\$/Version: $MAJOR.$MINOR.$PATCH/" openssl.spec
yum-builddep -y /build/SPECS/openssl.spec # just for sure nothing is missing
mkdir -p /build/SOURCES
tar --transform "s/^__w\/openssl\/openssl/openssl-$MAJOR.$MINOR.$PATCH/" -czf /build/SOURCES/openssl-$MAJOR.$MINOR.$PATCH.tar.gz /__w/openssl/openssl/
tar --transform "s/^__w\/openssl\/openssl/openssl-$MAJOR.$MINOR.$PATCH/" -czf /build/SOURCES/openssl-$MAJOR.$MINOR.$PATCH.tar.gz "$GITHUB_WORKSPACE"
rpmbuild -bb /build/SPECS/openssl.spec
rpm -i --force /build/RPMS/x86_64/openssl-*
cp ${GITHUB_WORKSPACE}/interop/openssl/openssl.cnf /etc/pki/tls/openssl.cnf
@ -67,11 +68,10 @@ jobs:
matrix:
branch: [
{ openssl: 'master', openssh: 'openssl-master', openssl_config: 'no-docs'},
{ openssl: 'openssl-4.0', openssh: 'openssl-4.0', openssl_config: 'no-docs'},
{ openssl: 'openssl-3.6', openssh: 'openssl-3.6', openssl_config: 'no-docs'},
{ openssl: 'openssl-3.5', openssh: 'openssl-3.5', openssl_config: 'no-docs'},
{ openssl: 'openssl-3.4', openssh: 'openssl-3.4', openssl_config: 'no-docs'},
{ openssl: 'openssl-3.3', openssh: 'openssl-3.3', openssl_config: 'no-docs'},
{ openssl: 'openssl-3.2', openssh: 'openssl-3.2', openssl_config: 'no-docs'},
{ openssl: 'openssl-3.0', openssh: 'openssl-3.0', openssl_config: ''}
]
runs-on: ubuntu-latest
@ -80,28 +80,24 @@ jobs:
TEST_SSH_UNSAFE_PERMISSIONS: 1
TEST_SSH_HOSTBASED_AUTH: yes
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
ref: ${{ matrix.branch.openssl }}
fetch-depth: 1
- name: config
run: ./config --banner=Configured -fPIC --prefix=/opt/openssl ${{ matrix.openssl_config }} shared -Wl,-rpath,/opt/openssl/lib64 && perl configdata.pm --dump
- name: make
run: |
make -s -j4
make -s -j4 install_sw
- name: install dependencies of openssh
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get -yq install autoconf zlib1g-dev
- name: run openssh
- uses: actions/checkout@v6
with:
persist-credentials: false
repository: openssh/openssh-portable
fetch-depth: 1
- name: setup ci
run: sh ./.github/setup_ci.sh ${{ matrix.branch.openssh }} ubuntu-latest
- name: autoreconf
run: autoreconf
- name: configure
run: sh ./.github/configure.sh ${{ matrix.branch.openssh }}
- name: make
run: |
git clone --branch master --depth 1 https://github.com/openssh/openssh-portable.git
cd openssh-portable
sh ./.github/setup_ci.sh ${{ matrix.branch.openssh }} ubuntu-latest
autoreconf
sh ./.github/configure.sh ${{ matrix.branch.openssh }}
make clean
make -s -j4
sh ./.github/run_test.sh
- name: run tests
run: sh ./.github/run_test.sh

View file

@ -1,48 +0,0 @@
# Copyright 2021-2025 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
name: "Make release"
on:
push:
tags:
- "openssl-*"
permissions: {}
jobs:
release:
runs-on: "releaser"
steps:
- name: "Checkout"
uses: "actions/checkout@v5"
with:
fetch-depth: 1
ref: ${{ github.ref_name }}
github-server-url: "https://github.openssl.org/"
repository: "openssl/openssl"
token: ${{ secrets.GHE_TOKEN }}
path: ${{ github.ref_name }}
persist-credentials: false
- name: "Prepare assets"
env:
SIGNING_KEY_UID: ${{ vars.signing_key_uid }}
run: |
cd "$GITHUB_REF_NAME"
./util/mktar.sh
mkdir -p assets && mv "$GITHUB_REF_NAME.tar.gz" assets/ && cd assets
openssl sha1 -r "$GITHUB_REF_NAME.tar.gz" > "$GITHUB_REF_NAME.tar.gz.sha1"
openssl sha256 -r "$GITHUB_REF_NAME.tar.gz" > "$GITHUB_REF_NAME.tar.gz.sha256"
gpg -u "$SIGNING_KEY_UID" -o "$GITHUB_REF_NAME.tar.gz.asc" -sba "$GITHUB_REF_NAME.tar.gz"
- name: "Create release"
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
VERSION=$(echo "$GITHUB_REF_NAME" | cut -d "-" -f 2-)
PRE_RELEASE=$([[ "$GITHUB_REF_NAME" =~ alpha|beta ]] && echo "-p" || echo "")
NOTES=$(curl -s "https://api.openssl.org/release-metadata/news/?version=$VERSION&capture_title=False")
gh release create "$GITHUB_REF_NAME" $PRE_RELEASE -t "OpenSSL $VERSION" -d --notes "$NOTES" -R "$GITHUB_REPOSITORY" "$GITHUB_REF_NAME/assets/"*

View file

@ -19,7 +19,7 @@ export OSSL_CI_ARTIFACTS_PATH="$(cd "$OSSL_CI_ARTIFACTS_PATH"; pwd)"
# Run the tests. This might fail, but we need to capture artifacts anyway.
set +e
make test HARNESS_JOBS=${HARNESS_JOBS:-4} "$@"
make test HARNESS_JOBS=${HARNESS_JOBS:-4} LHASH_WORKERS=${LHASH_WORKERS:-16} "$@"
RESULT=$?
set -e

View file

@ -1,4 +1,4 @@
# Copyright 2021-2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -36,7 +36,7 @@ jobs:
steps:
- name: install packages
run: apk --no-cache add build-base perl linux-headers ${{ matrix.cc }}
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: config
@ -52,7 +52,7 @@ jobs:
cat /proc/cpuinfo
./util/opensslwrap.sh version -c
- name: make test
run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
run: make test HARNESS_JOBS=${HARNESS_JOBS:-4} LHASH_WORKERS=${LHASH_WORKERS:-16}
linux:
if: github.repository == 'openssl/openssl'
@ -88,7 +88,7 @@ jobs:
runs-on: ubuntu-latest
container: ${{ matrix.zoo.image }}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: install packages
@ -104,7 +104,7 @@ jobs:
cat /proc/cpuinfo
./util/opensslwrap.sh version -c
- name: make test
run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
run: make test HARNESS_JOBS=${HARNESS_JOBS:-4} LHASH_WORKERS=${LHASH_WORKERS:-16}
macos:
if: github.repository == 'openssl/openssl'
@ -114,7 +114,7 @@ jobs:
os: [macos-14, macos-15, macos-15-intel]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -130,7 +130,7 @@ jobs:
sysctl machdep.cpu
./util/opensslwrap.sh version -c
- name: make test
run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
run: make test HARNESS_JOBS=${HARNESS_JOBS:-4} LHASH_WORKERS=${LHASH_WORKERS:-16}
windows:
if: github.repository == 'openssl/openssl'
@ -141,18 +141,31 @@ jobs:
- os: windows-2022
vcvars: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
- os: windows-2025
vcvars: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
vcvars: C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\Build\vcvars64.bat
runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
run: git submodule update --init --depth 1 fuzz/corpora
- name: install nasm
run: |
choco install nasm
$installer = "nasm-3.01-installer-x64.exe"
Invoke-WebRequest -Uri "https://openssl-library.org/ci-deps/$installer" -OutFile $installer
$expected = (Get-Content "$env:GITHUB_WORKSPACE\.github\ci-deps.json" -Raw | ConvertFrom-Json).$installer
$actual = (Get-FileHash $installer -Algorithm SHA256).Hash
if ($actual -ne $expected) { throw "SHA256 mismatch for $installer (expected $expected, got $actual)" }
Start-Process -FilePath ".\$installer" -ArgumentList '/S' -Wait
"C:\Program Files\NASM" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: install jom
run: |
mkdir C:\jom
Invoke-WebRequest -Uri "https://openssl-library.org/ci-deps/jom-1.1.7.exe" -OutFile C:\jom\jom.exe
$expected = (Get-Content "$env:GITHUB_WORKSPACE\.github\ci-deps.json" -Raw | ConvertFrom-Json).'jom-1.1.7.exe'
$actual = (Get-FileHash C:\jom\jom.exe -Algorithm SHA256).Hash
if ($actual -ne $expected) { throw "SHA256 mismatch for jom.exe (expected $expected, got $actual)" }
"C:\jom" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: prepare the build directory
run: mkdir _build
- name: config
@ -167,7 +180,7 @@ jobs:
shell: cmd
run: |
call "${{ matrix.platform.vcvars }}"
nmake /S
jom /j4 /S
- name: download coreinfo
run: |
mkdir _build\coreinfo
@ -183,16 +196,16 @@ jobs:
shell: cmd
run: |
call "${{ matrix.platform.vcvars }}"
nmake test VERBOSE_FAILURE=yes HARNESS_JOBS=4
jom test VERBOSE_FAILURE=yes HARNESS_JOBS=4 LHASH_WORKERS=16
linux-arm64:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: config
run: ./config --strict-warnings enable-fips enable-ec_nistp_64_gcc_128 enable-md2 enable-rc5 enable-ssl3 enable-ssl3-method enable-trace
run: ./config --strict-warnings enable-fips enable-ec_nistp_64_gcc_128 enable-md2 enable-rc5 enable-trace
- name: config dump
run: ./configdata.pm --dump
- name: make
@ -200,12 +213,12 @@ jobs:
- name: get cpu info
run: ./util/opensslwrap.sh version -c
- name: make test
run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
run: make test HARNESS_JOBS=${HARNESS_JOBS:-4} LHASH_WORKERS=${LHASH_WORKERS:-16}
linux-x86:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: run container
@ -218,7 +231,7 @@ jobs:
- name: config
run: |
podman exec -t $CONTAINER_ID sh -c \
"./config --strict-warnings linux-x86 enable-demos enable-fips enable-lms enable-md2 enable-rc5 enable-ssl3 enable-ssl3-method enable-trace"
"./config --strict-warnings linux-x86 enable-demos enable-fips enable-lms enable-md2 enable-rc5 enable-trace"
- name: config dump
run: |
podman exec -t $CONTAINER_ID sh -c \
@ -247,11 +260,11 @@ jobs:
runs-on: linux-ppc64le
if: github.repository == 'openssl/openssl'
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: config
run: ./config --strict-warnings enable-fips enable-ec_nistp_64_gcc_128 enable-md2 enable-rc5 enable-ssl3 enable-ssl3-method enable-trace
run: ./config --strict-warnings enable-fips enable-ec_nistp_64_gcc_128 enable-md2 enable-rc5 enable-trace
- name: config dump
run: ./configdata.pm --dump
- name: make
@ -261,17 +274,17 @@ jobs:
cat /proc/cpuinfo
./util/opensslwrap.sh version -c
- name: make test
run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
run: make test HARNESS_JOBS=${HARNESS_JOBS:-4} LHASH_WORKERS=${LHASH_WORKERS:-16}
linux-s390x:
runs-on: linux-s390x
if: github.repository == 'openssl/openssl'
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: config
run: ./config --strict-warnings enable-fips enable-md2 enable-rc5 enable-ssl3 enable-ssl3-method enable-trace
run: ./config --strict-warnings enable-fips enable-md2 enable-rc5 enable-trace
- name: config dump
run: ./configdata.pm --dump
- name: make
@ -281,17 +294,17 @@ jobs:
cat /proc/cpuinfo
./util/opensslwrap.sh version -c
- name: make test
run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
run: make test HARNESS_JOBS=${HARNESS_JOBS:-4} LHASH_WORKERS=${LHASH_WORKERS:-16}
linux-riscv64:
runs-on: linux-riscv64
if: github.repository == 'openssl/openssl'
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: config
run: ./config enable-fips enable-ec_nistp_64_gcc_128 enable-md2 enable-rc5 enable-ssl3 enable-ssl3-method enable-trace
run: ./config enable-fips enable-ec_nistp_64_gcc_128 enable-md2 enable-rc5 enable-trace
- name: config dump
run: ./configdata.pm --dump
- name: make
@ -301,13 +314,13 @@ jobs:
- name: make test
env:
OPENSSL_riscvcap: RV64GC_ZBA_ZBB_ZBC_ZBS_ZKT_V
run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
run: make test HARNESS_JOBS=${HARNESS_JOBS:-4} LHASH_WORKERS=${LHASH_WORKERS:-16}
freebsd-x86_64:
runs-on: ubuntu-latest
if: github.repository == 'openssl/openssl'
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: config
@ -318,7 +331,7 @@ jobs:
shutdown_vm: false
run: |
sudo pkg install -y gcc perl5
./config --strict-warnings enable-fips enable-ec_nistp_64_gcc_128 enable-md2 enable-rc5 enable-ssl3 enable-ssl3-method enable-trace
./config --strict-warnings enable-fips enable-ec_nistp_64_gcc_128 enable-md2 enable-rc5 enable-trace
- name: config dump
uses: cross-platform-actions/action@46e8d7fb25520a8d6c64fd2b7a1192611da98eda #v0.30.0
with:
@ -341,3 +354,45 @@ jobs:
run: |
./util/opensslwrap.sh version -c
.github/workflows/make-test
openbsd-x86_64:
runs-on: ubuntu-latest
if: github.repository == 'openssl/openssl'
steps:
- uses: actions/checkout@v6
- name: config
uses: cross-platform-actions/action@46e8d7fb25520a8d6c64fd2b7a1192611da98eda #v0.30.0
with:
operating_system: openbsd
architecture: x86-64
version: '7.7'
shutdown_vm: false
run: |
./config --strict-warnings enable-fips enable-ec_nistp_64_gcc_128 enable-md2 enable-rc5 enable-trace
- name: config dump
uses: cross-platform-actions/action@46e8d7fb25520a8d6c64fd2b7a1192611da98eda #v0.30.0
with:
operating_system: openbsd
architecture: x86-64
version: '7.7'
shutdown_vm: false
run: |
./configdata.pm --dump
- name: make
uses: cross-platform-actions/action@46e8d7fb25520a8d6c64fd2b7a1192611da98eda #v0.30.0
with:
operating_system: openbsd
architecture: x86-64
version: '7.7'
shutdown_vm: false
run: |
make -j4
- name: make test
uses: cross-platform-actions/action@46e8d7fb25520a8d6c64fd2b7a1192611da98eda #v0.30.0
with:
operating_system: openbsd
architecture: x86-64
version: '7.7'
run: |
./util/opensslwrap.sh version -c
.github/workflows/make-test

View file

@ -1,4 +1,4 @@
# Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -15,6 +15,7 @@ permissions:
jobs:
Fuzzing:
if: github.event_name != 'schedule' || github.repository == 'openssl/openssl'
runs-on: ubuntu-latest
steps:
- name: Clear unnecessary files

View file

@ -1,4 +1,4 @@
# Copyright 2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2025-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -7,7 +7,25 @@
# Jobs run per pull request submission
name: Perl-minimal-checker CI
on: [pull_request, push]
on:
pull_request:
paths-ignore:
- 'doc/**'
- '*.md'
- '*.pod'
- 'README*'
- 'funding.json'
- 'LICENSE.txt'
- 'VERSION.dat'
push:
paths-ignore:
- 'doc/**'
- '*.md'
- '*.pod'
- 'README*'
- 'funding.json'
- 'LICENSE.txt'
- 'VERSION.dat'
permissions:
contents: read
@ -37,7 +55,7 @@ jobs:
make -j$(nproc) && make install
perl -MTest::More -e 'print "$Test::More::VERSION\n"'
popd
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Build openssl

View file

@ -1,4 +1,4 @@
# Copyright 2023-2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2023-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -10,13 +10,22 @@
name: Provider compatibility for PRs
on: [pull_request]
on:
pull_request:
paths-ignore:
- 'doc/**'
- '*.md'
- '*.pod'
- 'README*'
- 'funding.json'
- 'LICENSE.txt'
- 'VERSION.dat'
permissions:
contents: read
env:
opts: enable-rc5 enable-md2 enable-ssl3 enable-weak-ssl-ciphers enable-zlib
opts: enable-rc5 enable-md2 enable-weak-ssl-ciphers enable-zlib
jobs:
fips-releases:
@ -109,36 +118,43 @@ jobs:
name: '',
dir: PR,
tgz: PR.tar.gz,
extra_config: "enable-lms enable-tls-deprecated-ec",
}, {
name: openssl-3.0,
dir: branch-3.0,
tgz: branch-3.0.tar.gz,
}, {
name: openssl-3.3,
dir: branch-3.3,
tgz: branch-3.3.tar.gz,
extra_config: "",
}, {
name: openssl-3.4,
dir: branch-3.4,
tgz: branch-3.4.tar.gz,
extra_config: "",
}, {
name: openssl-3.5,
dir: branch-3.5,
tgz: branch-3.5.tar.gz,
extra_config: "",
}, {
name: openssl-3.6,
dir: branch-3.6,
tgz: branch-3.6.tar.gz,
extra_config: "enable-lms",
}, {
name: openssl-4.0,
dir: branch-4.0,
tgz: branch-4.0.tar.gz,
extra_config: "enable-lms enable-tls-deprecated-ec",
}, {
name: master,
dir: branch-master,
tgz: branch-master.tar.gz,
extra_config: "enable-lms enable-tls-deprecated-ec",
},
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
path: ${{ matrix.branch.dir }}
repository: openssl/openssl
@ -149,7 +165,7 @@ jobs:
- name: config branch
run: |
./config --banner=Configured enable-shared enable-fips ${{ env.opts }}
./config --banner=Configured enable-shared enable-fips ${{ env.opts }} ${{ matrix.branch.extra_config }}
working-directory: ${{ matrix.branch.dir }}
- name: config dump current
run: ./configdata.pm --dump
@ -198,20 +214,20 @@ jobs:
# Note that releases are not used as a test environment for
# later providers. Problems in these situations ought to be
# caught by cross branch testing before the release.
tree_a: [ branch-3.6, branch-3.5, branch-3.4, branch-3.3, branch-3.0,
tree_a: [ branch-4.0, branch-3.6, branch-3.5, branch-3.4, branch-3.0,
openssl-3.0.0, openssl-3.0.8, openssl-3.0.9, openssl-3.1.2 ]
tree_b: [ PR ]
include:
- tree_a: PR
tree_b: branch-master
- tree_a: PR
tree_b: branch-4.0
- tree_a: PR
tree_b: branch-3.6
- tree_a: PR
tree_b: branch-3.5
- tree_a: PR
tree_b: branch-3.4
- tree_a: PR
tree_b: branch-3.3
- tree_a: PR
tree_b: branch-3.0
steps:

View file

@ -1,4 +1,4 @@
# Copyright 2023-2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2023-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -24,7 +24,7 @@ permissions:
contents: read
env:
opts: enable-rc5 enable-md2 enable-ssl3 enable-weak-ssl-ciphers enable-zlib
opts: enable-rc5 enable-md2 enable-weak-ssl-ciphers enable-zlib
jobs:
fips-releases:
@ -119,11 +119,6 @@ jobs:
dir: branch-3.0,
tgz: branch-3.0.tar.gz,
extra_config: "",
}, {
name: openssl-3.3,
dir: branch-3.3,
tgz: branch-3.3.tar.gz,
extra_config: "",
}, {
name: openssl-3.4,
dir: branch-3.4,
@ -139,17 +134,22 @@ jobs:
dir: branch-3.6,
tgz: branch-3.6.tar.gz,
extra_config: "enable-lms",
}, {
name: openssl-4.0,
dir: branch-4.0,
tgz: branch-4.0.tar.gz,
extra_config: "enable-lms enable-tls-deprecated-ec",
}, {
name: master,
dir: branch-master,
tgz: branch-master.tar.gz,
extra_config: "enable-lms",
extra_config: "enable-lms enable-tls-deprecated-ec",
},
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
path: ${{ matrix.branch.dir }}
repository: openssl/openssl
@ -213,10 +213,10 @@ jobs:
# Note that releases are not used as a test environment for
# later providers. Problems in these situations ought to be
# caught by cross branch testing before the release.
tree_a: [ branch-master, branch-3.6, branch-3.5, branch-3.4, branch-3.3,
tree_a: [ branch-master, branch-4.0, branch-3.6, branch-3.5, branch-3.4,
branch-3.0,
openssl-3.0.0, openssl-3.0.8, openssl-3.0.9, openssl-3.1.2 ]
tree_b: [ branch-master, branch-3.6, branch-3.5, branch-3.4, branch-3.3,
tree_b: [ branch-master, branch-4.0, branch-3.6, branch-3.5, branch-3.4,
branch-3.0 ]
steps:
- name: early exit checks

View file

@ -1,4 +1,4 @@
# Copyright 2021-2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -10,6 +10,14 @@ name: Cross Compile for RISC-V Extensions
on:
pull_request:
types: [opened, reopened, edited, synchronize]
paths-ignore:
- 'doc/**'
- '*.md'
- '*.pod'
- 'README*'
- 'funding.json'
- 'LICENSE.txt'
- 'VERSION.dat'
push:
schedule:
- cron: '35 02 * * *'
@ -52,6 +60,9 @@ jobs:
# opensslcaps: optional; if opensslcapsname (see above) is set, then
# this string will be used as content for the OpenSSL
# capabilities variable.
# capscheck: optional; ERE pattern passed to grep -E to assert that
# "openssl info -cpusettings" output contains expected
# capabilities when using the hwprobe detection path.
# ppa: Launchpad PPA repository to download packages from.
platform: [
# Scalar Crypto
@ -161,6 +172,28 @@ jobs:
qemucpu: "rv64,zba=true,zbb=true,zbc=true,zbs=true,zbkb=true,zbkc=true,zbkx=true,zknd=true,zkne=true,zknh=true,zksed=true,zksh=true,zkr=true,zkt=true,v=true,vlen=128,zvbb=true,zvbc=true,zvkb=true,zvkg=true,zvkned=true,zvknha=true,zvknhb=true,zvksed=true,zvksh=true",
opensslcapsname: riscvcap, # OPENSSL_riscvcap
opensslcaps: "rv64gc_zba_zbb_zbc_zbs_zbkb_zbkc_zbkx_zknd_zkne_zknh_zksed_zksh_zkr_zkt_v_zvbb_zvbc_zvkb_zvkg_zvkned_zvknha_zvknhb_zvksed_zvksh"
}, {
# RV64GC with all currently OpenSSL-supported extensions, with zvl256
# crypto/sha/asm/sha512-riscv64-zvkb-zvknhb.pl
# crypto/sm3/asm/sm3-riscv64-zvksh.pl
arch: riscv64-linux-gnu,
libs: libc6-dev-riscv64-cross,
target: linux64-riscv64,
fips: no,
qemucpu: "rv64,zba=true,zbb=true,zbc=true,zbs=true,zbkb=true,zbkc=true,zbkx=true,zknd=true,zkne=true,zknh=true,zksed=true,zksh=true,zkr=true,zkt=true,v=true,vlen=256,zvbb=true,zvbc=true,zvkb=true,zvkg=true,zvkned=true,zvknha=true,zvknhb=true,zvksed=true,zvksh=true",
opensslcapsname: riscvcap, # OPENSSL_riscvcap
opensslcaps: "rv64gc_zba_zbb_zbc_zbs_zbkb_zbkc_zbkx_zknd_zkne_zknh_zksed_zksh_zkr_zkt_v_zvbb_zvbc_zvkb_zvkg_zvkned_zvknha_zvknhb_zvksed_zvksh_zvl256"
}, {
# RV64GC with all currently OpenSSL-supported extensions, with zvl512
# crypto/sha/asm/sha512-riscv64-zvkb-zvknhb.pl
# crypto/sm3/asm/sm3-riscv64-zvksh.pl
arch: riscv64-linux-gnu,
libs: libc6-dev-riscv64-cross,
target: linux64-riscv64,
fips: no,
qemucpu: "rv64,zba=true,zbb=true,zbc=true,zbs=true,zbkb=true,zbkc=true,zbkx=true,zknd=true,zkne=true,zknh=true,zksed=true,zksh=true,zkr=true,zkt=true,v=true,vlen=512,zvbb=true,zvbc=true,zvkb=true,zvkg=true,zvkned=true,zvknha=true,zvknhb=true,zvksed=true,zvksh=true",
opensslcapsname: riscvcap, # OPENSSL_riscvcap
opensslcaps: "rv64gc_zba_zbb_zbc_zbs_zbkb_zbkc_zbkx_zknd_zkne_zknh_zksed_zksh_zkr_zkt_v_zvbb_zvbc_zvkb_zvkg_zvkned_zvknha_zvknhb_zvksed_zvksh_zvl512"
}, {
# Inline asm
# zbb/zbkb:
@ -180,6 +213,35 @@ jobs:
qemucpu: "rv64,zbb=true,zbkb=true,zknh=true,zksh=true",
opensslcapsname: riscvcap, # OPENSSL_riscvcap
opensslcaps: "rv64gc_inlineasm" # for uploading artifact
}, {
# hwprobe path: RV64GC without V, no OPENSSL_riscvcap override.
# Forces the hwprobe_to_cap() code path (skipped when OPENSSL_riscvcap is set).
# V is absent so AT_HWCAP V bit is clear (VECTOR_CAPABLE=false).
# The rv64 CPU model includes ZBB/ZBC/ZBS/ZBKB by default.
arch: riscv64-linux-gnu,
libs: libc6-dev-riscv64-cross,
target: linux64-riscv64,
fips: no,
qemucpu: "rv64,zbb=true,zbc=true,zbs=true,zbkb=true,v=false",
# No opensslcapsname: hwprobe is used for capability detection.
opensslcaps: "rv64gc_novector_hwprobe",
# ZBB must be detected
capscheck: "_ZBB",
}, {
# hwprobe path: RV64GC + V + ZVKNED (vlen=128), no OPENSSL_riscvcap override.
# Forces the hwprobe_to_cap() code path (skipped when OPENSSL_riscvcap is set).
# V is present so AT_HWCAP V bit is set (VECTOR_CAPABLE=true).
arch: riscv64-linux-gnu,
libs: libc6-dev-riscv64-cross,
target: linux64-riscv64,
fips: no,
qemucpu: "rv64,v=true,vlen=128,zvkned=true",
# No opensslcapsname: hwprobe is used for capability detection.
opensslcaps: "rv64gc_v_zvkned_hwprobe",
# V must be detected. ZVKNED is not reported by QEMU 8.2.2 (ubuntu-latest)
# via hwprobe despite being set in QEMU_CPU; tighten once CI moves to a
# newer QEMU that reports all Zvk* extensions via hwprobe.
capscheck: "_V",
}
]
runs-on: ubuntu-latest
@ -194,7 +256,7 @@ jobs:
sudo apt-get -yq --allow-unauthenticated --allow-downgrades --allow-remove-essential --allow-change-held-packages install \
gcc-${{ matrix.platform.arch }} \
${{ matrix.platform.libs }}
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -238,6 +300,13 @@ jobs:
if: matrix.platform.tests != 'none'
run: QEMU_LD_PREFIX=/usr/${{ matrix.platform.arch }} ./util/opensslwrap.sh info -cpusettings
- name: check detected capabilities
if: matrix.platform.capscheck != ''
run: |
QEMU_LD_PREFIX=/usr/${{ matrix.platform.arch }} \
./util/opensslwrap.sh info -cpusettings | \
grep -qE "${{ matrix.platform.capscheck }}"
- name: make all tests
if: github.event_name == 'push' && matrix.platform.tests == ''
run: |

View file

@ -1,4 +1,4 @@
# Copyright 2021-2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -7,7 +7,25 @@
# Jobs run per pull request submission
name: Run-checker CI
on: [pull_request, push]
on:
pull_request:
paths-ignore:
- 'doc/**'
- '*.md'
- '*.pod'
- 'README*'
- 'funding.json'
- 'LICENSE.txt'
- 'VERSION.dat'
push:
paths-ignore:
- 'doc/**'
- '*.md'
- '*.pod'
- 'README*'
- 'funding.json'
- 'LICENSE.txt'
- 'VERSION.dat'
permissions:
contents: read
@ -41,12 +59,12 @@ jobs:
no-tls1_2,
no-tls1_3,
enable-trace enable-fips,
no-ui,
no-quic
no-quic,
-DOPENSSL_USE_IPV6=0
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule

View file

@ -1,4 +1,4 @@
# Copyright 2021-2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -30,7 +30,6 @@ jobs:
no-asan,
no-asm,
no-async,
no-atexit,
no-autoalginit,
no-autoerrinit,
no-autoload-config,
@ -55,8 +54,6 @@ jobs:
no-dtls1_2,
no-dtls1_2-method,
no-dtls1-method,
no-ecdh,
no-ecdsa,
enable-ec_nistp_64_gcc_128,
enable-egd,
# enable-external-tests, # Requires extra setup
@ -68,10 +65,13 @@ jobs:
# enable-fuzz-libfuzzer, # Requires extra setup
no-gost,
enable-h3demo,
enable-heartbeats,
enable-hqinterop,
no-hmac-drbg-kdf,
no-hw,
no-idea,
no-ikev2kdf,
no-kbkdf,
no-krb5kdf,
enable-lms,
no-makedepend,
enable-md2,
@ -85,6 +85,7 @@ jobs:
no-poly1305,
no-posix-io,
no-psk,
no-pvkkdf,
no-rc2,
enable-rc5,
no-rdrand,
@ -100,12 +101,14 @@ jobs:
no-sm2-precomp,
no-sm3,
no-sm4,
no-snmpkdf,
no-sock,
no-srtpkdf,
no-sse2,
no-sshkdf,
no-sskdf,
no-ssl,
no-ssl-trace,
enable-ssl3,
enable-ssl3-method,
enable-sslkeylog,
no-shared,
no-tests,
@ -122,6 +125,8 @@ jobs:
no-uplink,
no-weak-ssl-ciphers,
no-whirlpool,
no-x942kdf,
no-x963kdf,
enable-zlib-dynamic,
-DOPENSSL_PEDANTIC_ZEROIZATION,
-DOPENSSL_PEDANTIC_ZEROIZATION enable-fips,
@ -131,7 +136,7 @@ jobs:
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -153,7 +158,7 @@ jobs:
if: github.repository == 'openssl/openssl'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -200,7 +205,7 @@ jobs:
sudo apt-get update
sudo apt-get -yq --no-install-suggests --no-install-recommends --allow-unauthenticated --allow-downgrades --allow-remove-essential --allow-change-held-packages install brotli libbrotli1 libbrotli-dev
- name: checkout openssl
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -225,7 +230,7 @@ jobs:
sudo apt-get update
sudo apt-get -yq --no-install-suggests --no-install-recommends --allow-unauthenticated --allow-downgrades --allow-remove-essential --allow-change-held-packages install zstd libzstd1 libzstd-dev
- name: checkout openssl
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -251,7 +256,7 @@ jobs:
sudo apt-get -yq --no-install-suggests --no-install-recommends --allow-unauthenticated --allow-downgrades --allow-remove-essential --allow-change-held-packages install brotli libbrotli1 libbrotli-dev
sudo apt-get -yq --no-install-suggests --no-install-recommends --allow-unauthenticated --allow-downgrades --allow-remove-essential --allow-change-held-packages install zstd libzstd1 libzstd-dev
- name: checkout openssl
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -272,7 +277,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout openssl
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Adjust ASLR for sanitizer
@ -301,7 +306,7 @@ jobs:
sudo apt-get update
sudo apt-get -yq --no-install-suggests --no-install-recommends --allow-unauthenticated --allow-downgrades --allow-remove-essential --allow-change-held-packages install brotli libbrotli1 libbrotli-dev
- name: checkout openssl
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -330,7 +335,7 @@ jobs:
sudo apt-get update
sudo apt-get -yq --no-install-suggests --no-install-recommends --allow-unauthenticated --allow-downgrades --allow-remove-essential --allow-change-held-packages install zstd libzstd1 libzstd-dev
- name: checkout openssl
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -357,7 +362,7 @@ jobs:
os: [ubuntu-latest, macos-15, macos-15-intel]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -375,7 +380,7 @@ jobs:
if: github.repository == 'openssl/openssl'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -395,7 +400,7 @@ jobs:
if: github.repository == 'openssl/openssl'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -419,7 +424,7 @@ jobs:
bn_debug:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: config

View file

@ -1,4 +1,4 @@
# Copyright 2021-2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -31,6 +31,7 @@ jobs:
no-srp,
no-srtp,
no-ts,
no-ui,
no-integrity-only-ciphers,
enable-weak-ssl-ciphers,
enable-zlib,
@ -42,7 +43,7 @@ jobs:
run: |
sudo cat /proc/sys/vm/mmap_rnd_bits
sudo sysctl -w vm.mmap_rnd_bits=28
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
@ -64,11 +65,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout openssl
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout jitter
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
repository: smuellerDD/jitterentropy-library
ref: v3.5.0
@ -92,7 +93,7 @@ jobs:
threads_sanitizer_atomic_fallback:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule

View file

@ -18,7 +18,7 @@ jobs:
if: ${{ github.repository == 'openssl/openssl' && !inputs.only_interop }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: "log in to quay.io"
@ -36,7 +36,7 @@ jobs:
if: ${{ github.repository == 'openssl/openssl' && !inputs.only_interop }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
repository: microsoft/msquic
ref: main
@ -71,7 +71,7 @@ jobs:
tests: retry
fail-fast: false
steps: &client_steps
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
repository: 'quic-interop/quic-interop-runner'
fetch-depth: 0
@ -98,8 +98,8 @@ jobs:
"msquic-openssl": { image: "quay.io/openssl-ci/msquic-openssl"
, url: "https://github.com/microsoft/msquic"
, role: "both"
}}' ./implementations.json > ./implementations.tmp
mv ./implementations.tmp implementations.json
}}' ./implementations_quic.json > ./implementations.tmp
mv ./implementations.tmp implementations_quic.json
- name: Set up docker
uses: docker/setup-docker-action@efe9e3891a4f7307e689f2100b33a155b900a608 # v4.5.0
with:
@ -129,7 +129,7 @@ jobs:
tests: amplificationlimit
fail-fast: false
steps: &server_steps
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
repository: 'quic-interop/quic-interop-runner'
fetch-depth: 0
@ -156,8 +156,8 @@ jobs:
"msquic-openssl": { image: "quay.io/openssl-ci/msquic-openssl"
, url: "https://github.com/microsoft/msquic"
, role: "both"
}}' ./implementations.json > ./implementations.tmp
mv ./implementations.tmp implementations.json
}}' ./implementations_quic.json > ./implementations.tmp
mv ./implementations.tmp implementations_quic.json
- name: Set up docker
uses: docker/setup-docker-action@efe9e3891a4f7307e689f2100b33a155b900a608 # v4.5.0
with:

View file

@ -1,4 +1,4 @@
# Copyright 2021-2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -27,11 +27,11 @@ jobs:
run: |
echo ${{ secrets.COVERITY_AUTH_KEY }} | base64 -d > /auth_key_file.txt
chmod 0600 /auth_key_file.txt
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Config
run: CC=gcc ./config --strict-warnings --banner=Configured --debug enable-lms enable-fips enable-rc5 enable-md2 enable-ssl3 enable-nextprotoneg enable-ssl3-method enable-weak-ssl-ciphers enable-zlib enable-ec_nistp_64_gcc_128 no-shared enable-buildtest-c++ enable-external-tests -DPEDANTIC
run: CC=gcc ./config --strict-warnings --banner=Configured --debug enable-lms enable-fips enable-rc5 enable-md2 enable-nextprotoneg enable-weak-ssl-ciphers enable-zlib enable-ec_nistp_64_gcc_128 no-shared enable-buildtest-c++ enable-external-tests -DPEDANTIC
- name: Config dump
run: ./configdata.pm --dump
- name: Make

View file

@ -1,4 +1,4 @@
# Copyright 2021-2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -21,7 +21,7 @@ jobs:
if: github.repository == 'openssl/openssl'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: tool download
@ -30,7 +30,7 @@ jobs:
--post-data "token=${{ secrets.COVERITY_TOKEN }}&project=openssl%2Fopenssl" \
--progress=dot:giga -O coverity_tool.tgz
- name: config
run: CC=gcc ./config --strict-warnings --banner=Configured --debug enable-lms enable-fips enable-rc5 enable-md2 enable-ssl3 enable-nextprotoneg enable-ssl3-method enable-weak-ssl-ciphers enable-zlib enable-ec_nistp_64_gcc_128 no-shared enable-buildtest-c++ enable-external-tests -DPEDANTIC
run: CC=gcc ./config --strict-warnings --banner=Configured --debug enable-lms enable-fips enable-rc5 enable-md2 enable-nextprotoneg enable-weak-ssl-ciphers enable-zlib enable-ec_nistp_64_gcc_128 no-shared enable-buildtest-c++ enable-external-tests -DPEDANTIC
- name: config dump
run: ./configdata.pm --dump
- name: tool install

View file

@ -1,4 +1,4 @@
# Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -7,13 +7,22 @@
name: Coding style validation
on: [pull_request]
on:
pull_request:
paths-ignore:
- 'doc/**'
- '*.md'
- '*.pod'
- 'README*'
- 'funding.json'
- 'LICENSE.txt'
- 'VERSION.dat'
jobs:
check-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
- name: "Get changed files"
env:

66
.github/workflows/valgrind-daily.yml vendored Normal file
View file

@ -0,0 +1,66 @@
# Copyright 2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
name: Test valgrind suppression file
# Jobs run daily
on:
schedule:
- cron: '30 02 * * *'
workflow_dispatch:
permissions:
contents: read
jobs:
check-valgrind-suppressions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install valgrind
run: |
sudo apt-get -y update
sudo apt-get -y install valgrind
- name: Get parse suppressions script
run: |
wget https://raw.githubusercontent.com/coqui-ai/STT/refs/tags/v1.4.0/parse_valgrind_suppressions.sh
echo "7414fcb9405f8bd1632442a0b66ffb35457994c6b8b49b2aa91530cf9a7ff645 ./parse_valgrind_suppressions.sh" > ./valgrind_suppressions.sha256
sha256sum -c ./valgrind_suppressions.sha256
chmod 755 ./parse_valgrind_suppressions.sh
- name: Configure
run: |
./Configure -DOPENSSL_VALGRIND_TEST
./configdata.pm --dump
- name: Make
run: |
make -j
- name: Make test
run: |
# The quic radix and multistream test times out under valgrind in ci
make TESTS="-test_quic_radix -test_quic_multistream" OSSL_USE_VALGRIND=yes test
- name: Check for leaks
run: |
set +e
NUM_LOGS=$(find . -name 'valgrind.log.*' | wc -l)
echo "Found $NUM_LOGS valgrind logs"
if [ $NUM_LOGS == 0 ]; then
echo "No logs found!"
exit 1
fi
for i in $(find . -name 'valgrind.log.*'); do
./parse_valgrind_suppressions.sh $i >> ./new_suppressions.txt
done
NEW_SUPPRESSION_LINES=$(cat ./new_suppressions.txt | wc -l)
if [ $NEW_SUPPRESSION_LINES != 0 ]; then
echo "New Suppressions Found that need to be addressed!"
cat ./new_suppressions.txt
exit 1
fi
echo "No new suppressions found"
exit 0

View file

@ -1,4 +1,4 @@
# Copyright 2021-2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -7,7 +7,26 @@
name: Windows GitHub CI
on: [pull_request, push]
on:
pull_request:
paths-ignore:
- 'doc/**'
- '*.md'
- '*.pod'
- 'README*'
- 'funding.json'
- 'LICENSE.txt'
- 'VERSION.dat'
push:
paths-ignore:
- 'doc/**'
- '*.md'
- '*.pod'
- 'README*'
- 'funding.json'
- 'LICENSE.txt'
- 'VERSION.dat'
permissions:
contents: read
@ -25,22 +44,51 @@ jobs:
- arch: amd64
os: windows-2025
config: enable-lms enable-fips no-thread-pool no-quic
vcvars: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
vcvars: C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\Build\vcvars64.bat
- arch: x86
os: windows-2022
config: no-fips enable-lms
vcvars: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat
runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
run: git submodule update --init --depth 1 fuzz/corpora
- name: install nasm
if: github.repository == 'openssl/openssl'
run: |
choco install nasm ${{ matrix.platform.arch == 'x86' && '--x86' || '' }}
$installer = "nasm-3.01-installer-${{ matrix.platform.arch == 'x86' && 'x86' || 'x64' }}.exe"
Invoke-WebRequest -Uri "https://openssl-library.org/ci-deps/$installer" -OutFile $installer
$expected = (Get-Content "$env:GITHUB_WORKSPACE\.github\ci-deps.json" -Raw | ConvertFrom-Json).$installer
$actual = (Get-FileHash $installer -Algorithm SHA256).Hash
if ($actual -ne $expected) { throw "SHA256 mismatch for $installer (expected $expected, got $actual)" }
Start-Process -FilePath ".\$installer" -ArgumentList '/S' -Wait
"C:\Program Files${{ matrix.platform.arch == 'x86' && ' (x86)' || '' }}\NASM" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: install nasm (forks)
if: github.repository != 'openssl/openssl'
run: |
$installer = "nasm-3.01-installer-${{ matrix.platform.arch == 'x86' && 'x86' || 'x64' }}.exe"
Invoke-WebRequest -Uri "https://www.nasm.us/pub/nasm/releasebuilds/3.01/win${{ matrix.platform.arch == 'x86' && '32' || '64' }}/$installer" -OutFile $installer
Start-Process -FilePath ".\$installer" -ArgumentList '/S' -Wait
"C:\Program Files${{ matrix.platform.arch == 'x86' && ' (x86)' || '' }}\NASM" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: install jom
if: github.repository == 'openssl/openssl'
run: |
mkdir C:\jom
Invoke-WebRequest -Uri "https://openssl-library.org/ci-deps/jom-1.1.7.exe" -OutFile C:\jom\jom.exe
$expected = (Get-Content "$env:GITHUB_WORKSPACE\.github\ci-deps.json" -Raw | ConvertFrom-Json).'jom-1.1.7.exe'
$actual = (Get-FileHash C:\jom\jom.exe -Algorithm SHA256).Hash
if ($actual -ne $expected) { throw "SHA256 mismatch for jom.exe (expected $expected, got $actual)" }
"C:\jom" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: install jom (forks)
if: github.repository != 'openssl/openssl'
run: |
mkdir C:\jom
Invoke-WebRequest -Uri "https://download.qt.io/official_releases/jom/jom_1_1_7.zip" -OutFile C:\jom\jom.zip
Expand-Archive -Path C:\jom\jom.zip -DestinationPath C:\jom
"C:\jom" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: prepare the build directory
run: mkdir _build
- name: config
@ -55,7 +103,7 @@ jobs:
shell: cmd
run: |
call "${{ matrix.platform.vcvars }}"
nmake /S
jom /j4 /S
- name: download coreinfo
run: |
mkdir _build\coreinfo
@ -67,6 +115,7 @@ jobs:
apps/openssl.exe version -v | %{($_ -split '\s+')[1]}
apps/openssl.exe version -v | %{($_ -split '\s+')[1] -replace '([0-9]+\.[0-9]+)(\..*)','$1'}
echo "OSSL_VERSION=$(apps/openssl.exe version -v | %{($_ -split '\s+')[1] -replace '([0-9]+\.[0-9]+)(\..*)','$1'})" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
echo "OSSL_MAJOR=$(apps/openssl.exe version -v | %{($_ -split '\s+')[1] -replace '([0-9]+)\.[0-9]+(\..*)','$1'})" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Set registry keys
working-directory: _build
run: |
@ -83,13 +132,16 @@ jobs:
./apps/openssl.exe version -c
- name: Check platform symbol usage
working-directory: _build
run: perl ../util/checkplatformsyms.pl ../util/platform_symbols/windows-symbols.txt libcrypto-3-x64.dll ./libssl-3-x64.dll
shell: cmd
run: |
call "${{ matrix.platform.vcvars }}"
perl ../util/checkplatformsyms.pl ../util/platform_symbols/windows-symbols.txt libcrypto-%OSSL_MAJOR%${{ matrix.platform.arch == 'amd64' && '-x64' || '' }}.dll ./libssl-%OSSL_MAJOR%${{ matrix.platform.arch == 'amd64' && '-x64' || '' }}.dll
- name: test
working-directory: _build
shell: cmd
run: |
call "${{ matrix.platform.vcvars }}"
nmake test VERBOSE_FAILURE=yes TESTS=-test_fuzz* HARNESS_JOBS=4
jom test VERBOSE_FAILURE=yes TESTS=-test_fuzz* HARNESS_JOBS=4
- name: install
# Run on 64 bit only as 32 bit is slow enough already
if: ${{ matrix.platform.arch == 'amd64' }}
@ -98,31 +150,47 @@ jobs:
run: |
call "${{ matrix.platform.vcvars }}"
mkdir _dest
nmake install DESTDIR=_dest
jom /j4 install DESTDIR=_dest
plain:
runs-on: windows-2022
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
run: git submodule update --init --depth 1 fuzz/corpora
- name: prepare the build directory
run: mkdir _build
- name: install jom
if: github.repository == 'openssl/openssl'
run: |
mkdir C:\jom
Invoke-WebRequest -Uri "https://openssl-library.org/ci-deps/jom-1.1.7.exe" -OutFile C:\jom\jom.exe
$expected = (Get-Content "$env:GITHUB_WORKSPACE\.github\ci-deps.json" -Raw | ConvertFrom-Json).'jom-1.1.7.exe'
$actual = (Get-FileHash C:\jom\jom.exe -Algorithm SHA256).Hash
if ($actual -ne $expected) { throw "SHA256 mismatch for jom.exe (expected $expected, got $actual)" }
"C:\jom" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: install jom (forks)
if: github.repository != 'openssl/openssl'
run: |
mkdir C:\jom
Invoke-WebRequest -Uri "https://download.qt.io/official_releases/jom/jom_1_1_7.zip" -OutFile C:\jom\jom.zip
Expand-Archive -Path C:\jom\jom.zip -DestinationPath C:\jom
"C:\jom" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: config
working-directory: _build
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
perl ..\Configure --banner=Configured --strict-warnings enable-demos no-makedepend no-shared no-fips enable-md2 enable-rc5 enable-ssl3 enable-ssl3-method enable-weak-ssl-ciphers enable-trace enable-crypto-mdebug -DOSSL_WINCTX=openssl VC-WIN64A-masm
perl ..\Configure --banner=Configured --strict-warnings enable-demos no-makedepend no-shared no-fips enable-md2 enable-rc5 enable-weak-ssl-ciphers enable-trace enable-crypto-mdebug -DOSSL_WINCTX=openssl VC-WIN64A-masm
perl configdata.pm --dump
- name: build
working-directory: _build
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
nmake /S
jom /j4 /S
- name: download coreinfo
run: |
mkdir _build\coreinfo
@ -141,16 +209,85 @@ jobs:
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
nmake test VERBOSE_FAILURE=yes HARNESS_JOBS=4
unit-tests:
runs-on: windows-2022
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
run: git submodule update --init --depth 1 fuzz/corpora
- name: install jom
if: github.repository == 'openssl/openssl'
run: |
mkdir C:\jom
Invoke-WebRequest -Uri "https://openssl-library.org/ci-deps/jom-1.1.7.exe" -OutFile C:\jom\jom.exe
$expected = (Get-Content "$env:GITHUB_WORKSPACE\.github\ci-deps.json" -Raw | ConvertFrom-Json).'jom-1.1.7.exe'
$actual = (Get-FileHash C:\jom\jom.exe -Algorithm SHA256).Hash
if ($actual -ne $expected) { throw "SHA256 mismatch for jom.exe (expected $expected, got $actual)" }
"C:\jom" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: install jom (forks)
if: github.repository != 'openssl/openssl'
run: |
mkdir C:\jom
Invoke-WebRequest -Uri "https://download.qt.io/official_releases/jom/jom_1_1_7.zip" -OutFile C:\jom\jom.zip
Expand-Archive -Path C:\jom\jom.zip -DestinationPath C:\jom
"C:\jom" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: install cmocka and detours via vcpkg
shell: pwsh
run: |
& "$env:VCPKG_INSTALLATION_ROOT\vcpkg.exe" install cmocka:x64-windows-static-md detours:x64-windows-static-md
"VCPKG_INST=$env:VCPKG_INSTALLATION_ROOT\installed\x64-windows-static-md" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: prepare the build directory
run: mkdir _build
- name: config
working-directory: _build
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
perl ..\Configure VC-WIN64A --banner=Configured --strict-warnings no-makedepend no-asm enable-unit-tests ^
--with-cmocka-include=%VCPKG_INST%\include --with-cmocka-lib=%VCPKG_INST%\lib ^
--with-detours-include=%VCPKG_INST%\include --with-detours-lib=%VCPKG_INST%\lib
perl configdata.pm --dump
- name: build
working-directory: _build
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
jom /j4 /S
- name: test
working-directory: _build
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
jom test VERBOSE=1 TESTS=test_unit
minimal:
runs-on: windows-2022
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
run: git submodule update --init --depth 1 fuzz/corpora
- name: prepare the build directory
run: mkdir _build
- name: install jom
if: github.repository == 'openssl/openssl'
run: |
mkdir C:\jom
Invoke-WebRequest -Uri "https://openssl-library.org/ci-deps/jom-1.1.7.exe" -OutFile C:\jom\jom.exe
$expected = (Get-Content "$env:GITHUB_WORKSPACE\.github\ci-deps.json" -Raw | ConvertFrom-Json).'jom-1.1.7.exe'
$actual = (Get-FileHash C:\jom\jom.exe -Algorithm SHA256).Hash
if ($actual -ne $expected) { throw "SHA256 mismatch for jom.exe (expected $expected, got $actual)" }
"C:\jom" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: install jom (forks)
if: github.repository != 'openssl/openssl'
run: |
mkdir C:\jom
Invoke-WebRequest -Uri "https://download.qt.io/official_releases/jom/jom_1_1_7.zip" -OutFile C:\jom\jom.zip
Expand-Archive -Path C:\jom\jom.zip -DestinationPath C:\jom
"C:\jom" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: config
working-directory: _build
shell: cmd
@ -163,7 +300,7 @@ jobs:
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
nmake
jom /j4 /S
- name: download coreinfo
run: |
mkdir _build\coreinfo
@ -180,7 +317,7 @@ jobs:
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
nmake test VERBOSE_FAILURE=yes TESTS=-test_fuzz* HARNESS_JOBS=4
jom test VERBOSE_FAILURE=yes TESTS=-test_fuzz* HARNESS_JOBS=4
cygwin:
# Run a job for each of the specified target architectures:
@ -202,7 +339,7 @@ jobs:
MAKE_PARAMS: -j 4
steps:
# Checkout before cygwin can mess with PATH...
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: cygwin/cygwin-install-action@f2009323764960f80959895c7bc3bb30210afe4d #v6
@ -216,7 +353,89 @@ jobs:
# - name: Clone repo
# run: bash -c "pwd && git clone --branch ${{ github.ref_name }} --depth 1 https://github.com/${{ github.repository }}.git"
- name: Full build
run: bash -c "gcc --version && ./config ${{ matrix.platform.config }} && make $MAKE_PARAMS"
shell: bash
run: |
gcc --version
./config ${{ matrix.platform.config }}
make $MAKE_PARAMS
# Disable testing for now. TBD: Need local cygwin installation to debug .
# - name: Run openssl tests
# run: bash -c "cd openssl && make V=1 test"
mingw64:
strategy:
matrix:
platform:
- arch: mingw64
target: x86_64
# Avoid MINGW bug in headers. Remove when CI is upgraded.
config: enable-demos -Wno-array-bounds
- arch: mingw
target: i686
config: -Wno-array-bounds -Wno-stringop-overflow
runs-on: ubuntu-latest
env:
CC: ${{ matrix.platform.target }}-w64-mingw32-gcc
CXX: ${{ matrix.platform.target }}-w64-mingw32-g++
AR: ${{ matrix.platform.target }}-w64-mingw32-ar
RANLIB: ${{ matrix.platform.target }}-w64-mingw32-ranlib
RC: ${{ matrix.platform.target }}-w64-mingw32-windres
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: install MINGW64
run: sudo apt-get install -y mingw-w64
- name: config
run: ./config ${{ matrix.platform.arch }} --strict-warnings --banner=Configured ${{ matrix.platform.config }}
- name: make
run: make -j4 -s
msys2-mingw64:
strategy:
matrix:
platform:
- arch: UCRT64
cc: gcc
pkgs: mingw-w64-ucrt-x86_64-gcc
config: mingw64 enable-demos
- arch: CLANG64
cc: clang
pkgs: mingw-w64-clang-x86_64-clang
config: mingw64
runs-on: windows-latest
env:
CC: ${{ matrix.platform.cc }}
MSYSTEM: ${{ matrix.platform.arch }}
CHERE_INVOKING: 'yes'
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: install MSYS2
run: |
$url = 'https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe'
(New-Object System.Net.WebClient).DownloadFile($url, 'msys2.exe')
# Remove preinstalled MSYS2
if (Test-Path C:\msys64) { Remove-Item -Recurse -Force C:\msys64 }
.\msys2.exe -y -oC:\
Remove-Item msys2.exe
- name: update MSYS2
run: |
C:\msys64\usr\bin\bash.exe -lc ' '
# Update core and then normal update
C:\msys64\usr\bin\bash.exe -lc 'pacman --noconfirm -Syuu'
C:\msys64\usr\bin\bash.exe -lc 'pacman --noconfirm -Syuu'
- name: install dependencies
run: C:\msys64\usr\bin\bash.exe -lc 'pacman --noconfirm -S --needed perl git make ${{ matrix.platform.pkgs }}'
- name: config
run: C:\msys64\usr\bin\bash.exe -lc './config --strict-warnings --banner=Configured ${{ matrix.platform.config }}'
- name: make
run: C:\msys64\usr\bin\bash.exe -lc 'make -j4 -s'
# Tests are broken for now
# - name: test
# run: C:\msys64\usr\bin\bash.exe -lc 'make test'

View file

@ -1,4 +1,4 @@
# Copyright 2022-2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2022-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -23,15 +23,44 @@ jobs:
zstd:
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
run: git submodule update --init --depth 1 fuzz/corpora
- name: install nasm
if: github.repository == 'openssl/openssl'
run: |
choco install nasm
$installer = "nasm-3.01-installer-x64.exe"
Invoke-WebRequest -Uri "https://openssl-library.org/ci-deps/$installer" -OutFile $installer
$expected = (Get-Content "$env:GITHUB_WORKSPACE\.github\ci-deps.json" -Raw | ConvertFrom-Json).$installer
$actual = (Get-FileHash $installer -Algorithm SHA256).Hash
if ($actual -ne $expected) { throw "SHA256 mismatch for $installer (expected $expected, got $actual)" }
Start-Process -FilePath ".\$installer" -ArgumentList '/S' -Wait
"C:\Program Files\NASM" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: install nasm (forks)
if: github.repository != 'openssl/openssl'
run: |
$installer = "nasm-3.01-installer-x64.exe"
Invoke-WebRequest -Uri "https://www.nasm.us/pub/nasm/releasebuilds/3.01/win64/$installer" -OutFile $installer
Start-Process -FilePath ".\$installer" -ArgumentList '/S' -Wait
"C:\Program Files\NASM" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: install jom
if: github.repository == 'openssl/openssl'
run: |
mkdir C:\jom
Invoke-WebRequest -Uri "https://openssl-library.org/ci-deps/jom-1.1.7.exe" -OutFile C:\jom\jom.exe
$expected = (Get-Content "$env:GITHUB_WORKSPACE\.github\ci-deps.json" -Raw | ConvertFrom-Json).'jom-1.1.7.exe'
$actual = (Get-FileHash C:\jom\jom.exe -Algorithm SHA256).Hash
if ($actual -ne $expected) { throw "SHA256 mismatch for jom.exe (expected $expected, got $actual)" }
"C:\jom" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: install jom (forks)
if: github.repository != 'openssl/openssl'
run: |
mkdir C:\jom
Invoke-WebRequest -Uri "https://download.qt.io/official_releases/jom/jom_1_1_7.zip" -OutFile C:\jom\jom.zip
Expand-Archive -Path C:\jom\jom.zip -DestinationPath C:\jom
"C:\jom" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: prepare the build directory
run: mkdir _build
- name: Get zstd
@ -42,15 +71,15 @@ jobs:
working-directory: _build
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
call "C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
perl ..\Configure --strict-warnings enable-comp enable-zstd --with-zstd-include=C:\vcpkg\packages\zstd_x64-windows\include --with-zstd-lib=C:\vcpkg\packages\zstd_x64-windows\lib\zstd.lib no-makedepend -DOSSL_WINCTX=openssl VC-WIN64A
perl configdata.pm --dump
- name: build
working-directory: _build
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
nmake
call "C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
jom /j4 /S
- name: Gather openssl version info
working-directory: _build
run: |
@ -76,28 +105,54 @@ jobs:
7z.exe x coreinfo/Coreinfo.zip
./Coreinfo64.exe -accepteula -f
./apps/openssl.exe version -c
- name: Check platform symbol usage
run: |
perl ./util/checkplatformsyms.pl ./util/platform_symbols/windows-symbols.txt libcrypto-3-x64.dll ./libssl-3-x64.dll
- name: test
working-directory: _build
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
nmake test VERBOSE_FAILURE=yes TESTS="-test_fuzz* -test_fipsload" HARNESS_JOBS=4
call "C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
jom test VERBOSE_FAILURE=yes TESTS="-test_fuzz* -test_fipsload" HARNESS_JOBS=4
brotli:
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: checkout fuzz/corpora submodule
run: git submodule update --init --depth 1 fuzz/corpora
- name: install nasm
if: github.repository == 'openssl/openssl'
run: |
choco install nasm
$installer = "nasm-3.01-installer-x64.exe"
Invoke-WebRequest -Uri "https://openssl-library.org/ci-deps/$installer" -OutFile $installer
$expected = (Get-Content "$env:GITHUB_WORKSPACE\.github\ci-deps.json" -Raw | ConvertFrom-Json).$installer
$actual = (Get-FileHash $installer -Algorithm SHA256).Hash
if ($actual -ne $expected) { throw "SHA256 mismatch for $installer (expected $expected, got $actual)" }
Start-Process -FilePath ".\$installer" -ArgumentList '/S' -Wait
"C:\Program Files\NASM" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: install nasm (forks)
if: github.repository != 'openssl/openssl'
run: |
$installer = "nasm-3.01-installer-x64.exe"
Invoke-WebRequest -Uri "https://www.nasm.us/pub/nasm/releasebuilds/3.01/win64/$installer" -OutFile $installer
Start-Process -FilePath ".\$installer" -ArgumentList '/S' -Wait
"C:\Program Files\NASM" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: install jom
if: github.repository == 'openssl/openssl'
run: |
mkdir C:\jom
Invoke-WebRequest -Uri "https://openssl-library.org/ci-deps/jom-1.1.7.exe" -OutFile C:\jom\jom.exe
$expected = (Get-Content "$env:GITHUB_WORKSPACE\.github\ci-deps.json" -Raw | ConvertFrom-Json).'jom-1.1.7.exe'
$actual = (Get-FileHash C:\jom\jom.exe -Algorithm SHA256).Hash
if ($actual -ne $expected) { throw "SHA256 mismatch for jom.exe (expected $expected, got $actual)" }
"C:\jom" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: install jom (forks)
if: github.repository != 'openssl/openssl'
run: |
mkdir C:\jom
Invoke-WebRequest -Uri "https://download.qt.io/official_releases/jom/jom_1_1_7.zip" -OutFile C:\jom\jom.zip
Expand-Archive -Path C:\jom\jom.zip -DestinationPath C:\jom
"C:\jom" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: prepare the build directory
run: mkdir _build
- name: Get brotli
@ -108,15 +163,15 @@ jobs:
working-directory: _build
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
call "C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
perl ..\Configure --strict-warnings enable-comp enable-brotli --with-brotli-include=C:\vcpkg\packages\brotli_x64-windows\include --with-brotli-lib=C:\vcpkg\packages\brotli_x64-windows\lib no-makedepend -DOSSL_WINCTX=openssl VC-WIN64A
perl configdata.pm --dump
- name: build
working-directory: _build
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
nmake
call "C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
jom /j4 /S
- name: Gather openssl version info
working-directory: _build
run: |
@ -146,5 +201,5 @@ jobs:
working-directory: _build
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
nmake test VERBOSE_FAILURE=yes TESTS="-test_fuzz* -test_fipsload" HARNESS_JOBS=4
call "C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
jom test VERBOSE_FAILURE=yes TESTS="-test_fuzz* -test_fipsload" HARNESS_JOBS=4

22
.gitignore vendored
View file

@ -59,6 +59,8 @@
/include/openssl/x509_vfy.h
/include/openssl/core_names.h
/apps/include/configuration.h
# Auto generated parameter name files
/crypto/params_idx.c
@ -86,6 +88,7 @@ providers/common/include/prov/der_wrap.h
providers/common/include/prov/der_sm2.h
providers/common/include/prov/der_ml_dsa.h
providers/common/include/prov/der_hkdf.h
providers/fips/fipsparams.inc
providers/implementations/asymciphers/rsa_enc.inc
providers/implementations/asymciphers/sm2_enc.inc
providers/implementations/exchange/dh_exch.inc
@ -101,6 +104,7 @@ providers/implementations/encode_decode/encode_key2ms.inc
providers/implementations/kdfs/argon2.inc
providers/implementations/kdfs/hkdf.inc
providers/implementations/kdfs/hmacdrbg_kdf.inc
providers/implementations/kdfs/ikev2kdf.inc
providers/implementations/kdfs/kbkdf.inc
providers/implementations/kdfs/krb5kdf.inc
providers/implementations/kdfs/pbkdf1.inc
@ -108,10 +112,13 @@ providers/implementations/kdfs/pbkdf2.inc
providers/implementations/kdfs/pkcs12kdf.inc
providers/implementations/kdfs/pvkkdf.inc
providers/implementations/kdfs/scrypt.inc
providers/implementations/kdfs/snmpkdf.inc
providers/implementations/kdfs/srtpkdf.inc
providers/implementations/kdfs/sshkdf.inc
providers/implementations/kdfs/sskdf.inc
providers/implementations/kdfs/tls1_prf.inc
providers/implementations/kdfs/x942kdf.inc
providers/implementations/kdfs/x963kdf.inc
providers/implementations/kem/ec_kem.inc
providers/implementations/kem/ecx_kem.inc
providers/implementations/kem/ml_kem_kem.inc
@ -132,6 +139,7 @@ providers/implementations/keymgmt/mlx_kmgmt.inc
providers/implementations/keymgmt/slh_dsa_kmgmt.inc
providers/implementations/keymgmt/template_kmgmt.inc
providers/implementations/signature/eddsa_sig.inc
providers/implementations/signature/mac_legacy_sig.inc
providers/implementations/signature/ml_dsa_sig.inc
providers/implementations/signature/rsa_sig.inc
providers/implementations/signature/slh_dsa_sig.inc
@ -161,8 +169,9 @@ providers/implementations/digests/digestcommon.inc
providers/implementations/digests/mdc2_prov.inc
providers/implementations/digests/sha2_prov.inc
providers/implementations/digests/sha3_prov.inc
providers/implementations/digests/ml_dsa_mu_prov.inc
providers/implementations/digests/cshake_prov.inc
providers/implementations/include/prov/blake2_params.inc
providers/implementations/kdfs/snmpkdf.inc
providers/implementations/macs/cmac_prov.inc
providers/implementations/macs/gmac_prov.inc
providers/implementations/macs/hmac_prov.inc
@ -191,6 +200,7 @@ providers/implementations/rands/test_rng.inc
/test/gost2814789t
/test/ssltest_old
/test/*test
/test/*memfail
/test/fips_aesavs
/test/fips_desmovs
/test/fips_dhvs
@ -301,8 +311,6 @@ providers/implementations/rands/test_rng.inc
# Misc auto generated files
/doc/man7/openssl_user_macros.pod
/tools/c_rehash
/tools/c_rehash.pl
/util/shlib_wrap.sh
/util/wrap.pl
/tags
@ -423,3 +431,11 @@ doc-nits
# LSP (Language Server Protocol) support
.cache/
compile_commands.json
# coverage files
*.gcda
*.gcno
lcov.info
run_tests
depend

View file

@ -11,3 +11,9 @@ repos:
types_or: []
files: '\.c\.in$|\.h\.in$|\.c$|\.h$'
args: ["--style=file"]
exclude: |
(?x)^(
crypto/objects/obj_dat.h|
crypto/objects/obj_xref.h|
include/openssl/obj_mac.h
)$

2231
CHANGES.md

File diff suppressed because it is too large Load diff

View file

@ -27,6 +27,28 @@ communication before submitting many pull requests. In addition,
contributors should personally evaluate potential patches generated by
automated tools.
Provide a clear description of the issue or feature being addressed,
including any relevant implementation details and, for performance
improvements, benchmark results.
Pull requests and commits should be self-contained, enabling readers to
understand what changed and why without needing to reference related
issues or having prior knowledge. Commit messages should include all
relevant details to help future contributors follow the git history,
with clear explanations of what is changing and why. Long descriptions
are encouraged if they aid understanding. Commit message titles (their
first line) should be kept to 50-70 characters if possible.
Pull Requests (PR's) go through multiple phases before they are merged. In the
first phase the label 'approval: review pending' is added. Once you receive 2 or
more approvals from [Committers] the label is changed to 'approval: done' and
24 hours after this the label changes to 'approval: ready to merge'. At some time
after this your PR will be merged and the PR is closed. Reviewers may ask you to
make changes at any phase before the Pull Request is merged, and any changes
(that are not just a rebase) will require re-approval.
[Committers]: https://openssl-library.org/about/committers/index.html
To make it easier to review and accept your pull request, please follow these
guidelines:
@ -58,7 +80,37 @@ guidelines:
git push -f [<repository> [<branch>]]
```
2. All source files should start with the following text (with
2. Similarly, if a non-trivial portion of a contribution was created
using an AI tool, you must declare which agent and model were used.
This is done by adding `Assisted-by: {agent}:{model}` below the commit
message:
```
One-line summary of change with AI-generated portions
Assisted-by: Claude:claude-sonnet-4-6
```
Multiple Assisted-by trailers can be included if multiple tools were used:
```
Assisted-by: Claude:claude-sonnet-4-6
Assisted-by: ChatGPT:gpt-4o
Assisted-by: GitHub Copilot:gpt-4.1
```
You will need to have signed a v1.1 or later CLA in order to
include AI-generated content in your contribution. CLAs signed
after June 2026 will have the requisite clauses.
Consult the [OpenSSL AI Code and Documentation Contribution
Policy] if an AI model assisted with the creation of your
contribution.
[OpenSSL AI Code and Documentation Contribution
Policy]: <https://openssl-library.org/policies/general/ai-policy/>
3. All source files should start with the following text (with
appropriate comment characters at the start of each line and the
year(s) updated):
@ -71,33 +123,37 @@ guidelines:
https://www.openssl.org/source/license.html
```
3. Patches should be as current as possible; expect to have to rebase
4. Patches should be as current as possible; expect to have to rebase
often. We do not accept merge commits, you will have to remove them
(usually by rebasing) before it will be acceptable.
4. Code provided should follow our [coding style] and [documentation policy]
and compile without warnings.
There is a [Perl tool](util/check-format.pl) that helps
finding code formatting mistakes and other coding style nits.
5. Code provided should follow our [coding style](STYLE.md) and
[documentation policy](DOCUMENTATION.md) and compile without warnings when
using a --strict-warnings configuration.
Consistent formatting is enforced by using `clang-format` with configuration
stored in [.clang-format](.clang-format). OpenSSL uses `WebKit` style.
You can configure git pre-commit to automatically reformat your code with
[.pre-commit-config.yaml](.pre-commit-config.yaml) configuration.
There is also a [Perl tool](util/reformat-patches.sh) to help with
reformatting existing patches.
Where `gcc` or `clang` is available, you should use the
`--strict-warnings` `Configure` option. OpenSSL compiles on many varied
platforms: try to ensure you only use portable features.
Clean builds via GitHub Actions are required. They are started automatically
whenever a PR is created or updated by committers.
[coding style]: https://openssl-library.org/policies/technical/coding-style/
[documentation policy]: https://openssl-library.org/policies/technical/documentation-policy/
5. When at all possible, code contributions should include tests. These can
6. When at all possible, code contributions should include tests. These can
either be added to an existing test, or completely new. Please see
[test/README.md](test/README.md) for information on the test framework.
6. New features or changed functionality must include
7. New features or changed functionality must include
documentation. Please look at the `.pod` files in `doc/man[1357]` for
examples of our style. Run `make doc-nits` to make sure that your
documentation changes are clean.
7. For user visible changes (API changes, behaviour changes, ...),
8. For user visible changes (API changes, behaviour changes, ...),
consider adding a note in [CHANGES.md](CHANGES.md).
This could be a summarising description of the change, and could
explain the grander details.
@ -108,5 +164,37 @@ guidelines:
with a specific release without having to sift through the higher
noise ratio in git-log.
8. Guidelines on how to integrate error output of new crypto library modules
9. Guidelines on how to integrate error output of new crypto library modules
can be found in [crypto/err/README.md](crypto/err/README.md).
10. Once your Pull Request gets to the stage of being reviewed fixup commits
should be used where possible. Fixup commits are squashed when the PR is
finally merged. Fixup commits are done in the following way:
```
# Add one or more updated files that needed changes
git add <filename>
# Do a fixup commit
# <commit-id> is the id of a previous commit that you want to fix up.
git commit --fixup <commit-id>
# Do a non forced push
git push
```
To view commit-id's use:
```
git log
```
11. If a Pull Request addresses an [issue](https://github.com/openssl/openssl/issues/)
the commit should include the line:
```
Fixes: LINK
```
where LINK is the https link to the issue in github.

View file

@ -47,7 +47,7 @@ my %targets=(
defines =>
sub {
my @defs = ( 'OPENSSL_BUILDING_OPENSSL' );
my @defs = ();
push @defs, "BROTLI" unless $disabled{brotli};
push @defs, "BROTLI_SHARED" unless $disabled{"brotli-dynamic"};
push @defs, "ZLIB" unless $disabled{zlib};

View file

@ -5,7 +5,8 @@
my $vc_win64a_info = {};
sub vc_win64a_info {
unless (%$vc_win64a_info) {
if (`nasm -v 2>NUL` =~ /NASM version ([0-9]+\.[0-9]+)/ && $1 >= 2.0) {
# Minimum NASM version is 2.09 otherwise SHA3 might be miscompiled
if (`nasm -v 2>NUL` =~ /NASM version ([0-9]+)\.([0-9]+)/ && ($1 > 2 || ($1 == 2 && $2 >= 9))) {
$vc_win64a_info = { AS => "nasm",
ASFLAGS => "-g",
asflags => "-Ox -f win64 -DNEAR",
@ -60,70 +61,6 @@ sub vc_win32_info {
return $vc_win32_info;
}
my $vc_wince_info = {};
sub vc_wince_info {
unless (%$vc_wince_info) {
# sanity check
$die->('%OSVERSION% is not defined') if (!defined(env('OSVERSION')));
$die->('%PLATFORM% is not defined') if (!defined(env('PLATFORM')));
$die->('%TARGETCPU% is not defined') if (!defined(env('TARGETCPU')));
#
# Idea behind this is to mimic flags set by eVC++ IDE...
#
my $wcevers = env('OSVERSION'); # WCENNN
my $wcevernum;
my $wceverdotnum;
if ($wcevers =~ /^WCE([1-9])([0-9]{2})$/) {
$wcevernum = "$1$2";
$wceverdotnum = "$1.$2";
} else {
$die->('%OSVERSION% value is insane');
$wcevernum = "{unknown}";
$wceverdotnum = "{unknown}";
}
my $wcecdefs = "-D_WIN32_WCE=$wcevernum -DUNDER_CE=$wcevernum"; # -D_WIN32_WCE=NNN
my $wcelflag = "/subsystem:windowsce,$wceverdotnum"; # ...,N.NN
my $wceplatf = env('PLATFORM');
$wceplatf =~ tr/a-z0-9 /A-Z0-9_/;
$wcecdefs .= " -DWCE_PLATFORM_$wceplatf";
my $wcetgt = env('TARGETCPU'); # just shorter name...
SWITCH: for($wcetgt) {
/^X86/ && do { $wcecdefs.=" -Dx86 -D_X86_ -D_i386_ -Di_386_";
$wcelflag.=" /machine:X86"; last; };
/^ARMV4[IT]/ && do { $wcecdefs.=" -DARM -D_ARM_ -D$wcetgt";
$wcecdefs.=" -DTHUMB -D_THUMB_" if($wcetgt=~/T$/);
$wcecdefs.=" -QRarch4T -QRinterwork-return";
$wcelflag.=" /machine:THUMB"; last; };
/^ARM/ && do { $wcecdefs.=" -DARM -D_ARM_ -D$wcetgt";
$wcelflag.=" /machine:ARM"; last; };
/^MIPSIV/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt";
$wcecdefs.=" -D_MIPS64 -QMmips4 -QMn32";
$wcelflag.=" /machine:MIPSFPU"; last; };
/^MIPS16/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt";
$wcecdefs.=" -DMIPSII -QMmips16";
$wcelflag.=" /machine:MIPS16"; last; };
/^MIPSII/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt";
$wcecdefs.=" -QMmips2";
$wcelflag.=" /machine:MIPS"; last; };
/^R4[0-9]{3}/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000";
$wcelflag.=" /machine:MIPS"; last; };
/^SH[0-9]/ && do { $wcecdefs.=" -D$wcetgt -D_${wcetgt}_ -DSHx";
$wcecdefs.=" -Qsh4" if ($wcetgt =~ /^SH4/);
$wcelflag.=" /machine:$wcetgt"; last; };
{ $wcecdefs.=" -D$wcetgt -D_${wcetgt}_";
$wcelflag.=" /machine:$wcetgt"; last; };
}
$vc_wince_info = { cppflags => $wcecdefs,
lflags => $wcelflag };
}
return $vc_wince_info;
}
# Helper functions for the VMS configs
my $vms_info = {};
sub vms_info {
@ -686,7 +623,6 @@ my %targets = (
release => "-O3"),
cflags => threads("-pthread"),
cxxflags => combine("-std=c++11", threads("-pthread")),
lib_cppflags => "-DOPENSSL_USE_NODELETE",
ex_libs => add("-ldl", threads("-pthread")),
bn_ops => "BN_LLONG RC4_CHAR",
thread_scheme => "pthreads",
@ -970,7 +906,6 @@ my %targets = (
perlasm_scheme => 'void',
},
"linux64-sparcv9" => {
# GCC 3.1 is a requirement
inherit_from => [ "linux-generic64" ],
cflags => add("-m64 -mcpu=ultrasparc"),
cxxflags => add("-m64 -mcpu=ultrasparc"),
@ -1499,7 +1434,7 @@ my %targets = (
#### Visual C targets
#
# Win64 targets, WIN64I denotes IA-64/Itanium and WIN64A - AMD64
# Win64 target, WIN64A denotes AMD64
#
# Note about /wd4090, disable warning C4090. This warning returns false
# positives in some situations. Disabling it altogether masks both
@ -1541,10 +1476,10 @@ my %targets = (
"UNICODE", "_UNICODE",
"_CRT_SECURE_NO_DEPRECATE",
"_WINSOCK_DEPRECATED_NO_WARNINGS"),
lib_cflags => add("/Zi /Fdossl_static.pdb"),
lib_cflags => add("/Z7"),
lib_defines => add("L_ENDIAN"),
dso_cflags => "/Zi /Fddso.pdb",
bin_cflags => "/Zi /Fdapp.pdb",
dso_cflags => "/Z7",
bin_cflags => "/Z7",
# def_flag made to empty string so a .def file gets generated
shared_defflag => '',
shared_ldflag => "/dll",
@ -1566,11 +1501,11 @@ my %targets = (
cflags => add(picker(default => '/Gs0 /GF /Gy',
debug =>
sub {
($disabled{shared} ? "" : "/MDd");
($disabled{shared} ? "" : ($disabled{"static-vcruntime"} ? "/MDd" : ($disabled{threads} ? "" : "/MTd")));
},
release =>
sub {
($disabled{shared} ? "" : "/MD");
($disabled{shared} ? "" : ($disabled{"static-vcruntime"} ? "/MD": ($disabled{threads} ? "" : "/MT")));
})),
defines => add(picker(default => [], # works as type cast
debug => [ "DEBUG", "_DEBUG" ])),
@ -1607,17 +1542,6 @@ my %targets = (
}),
bn_ops => add("SIXTY_FOUR_BIT"),
},
"VC-WIN64I" => {
inherit_from => [ "VC-WIN64-common" ],
AS => "ias",
ASFLAGS => "-d debug",
asoutflag => "-o ",
sys_id => "WIN64I",
uplink_arch => 'ia64',
asm_arch => 'ia64',
perlasm_scheme => "ias",
multilib => "-ia64",
},
"VC-WIN64A" => {
inherit_from => [ "VC-WIN64-common" ],
AS => sub { vc_win64a_info()->{AS} },
@ -1645,53 +1569,6 @@ my %targets = (
# some installation path heuristics in windows-makefile.tmpl...
build_scheme => add("VC-WOW", { separator => undef }),
},
"VC-CE" => {
inherit_from => [ "VC-common" ],
CFLAGS => add(picker(debug => "/Od",
release => "/O1i")),
CPPDEFINES => picker(debug => [ "DEBUG", "_DEBUG" ]),
LDFLAGS => add("/nologo /opt:ref"),
cflags =>
combine('/GF /Gy',
sub { vc_wince_info()->{cflags}; },
sub { `cl 2>&1` =~ /Version ([0-9]+)\./ && $1>=14
? ($disabled{shared} ? " /MT" : " /MD")
: " /MC"; }),
cppflags => sub { vc_wince_info()->{cppflags}; },
lib_defines => add("NO_CHMOD", "OPENSSL_SMALL_FOOTPRINT"),
lib_cppflags => sub { vc_wince_info()->{cppflags}; },
includes =>
add(combine(sub { defined(env('WCECOMPAT'))
? '$(WCECOMPAT)/include' : (); },
sub { defined(env('PORTSDK_LIBPATH'))
? '$(PORTSDK_LIBPATH)/../../include'
: (); })),
lflags => add(combine(sub { vc_wince_info()->{lflags}; },
sub { defined(env('PORTSDK_LIBPATH'))
? "/entry:mainCRTstartup" : (); })),
sys_id => "WINCE",
bn_ops => add("BN_LLONG"),
ex_libs => add(sub {
my @ex_libs = ();
push @ex_libs, 'ws2.lib' unless $disabled{sock};
push @ex_libs, 'crypt32.lib';
if (defined(env('WCECOMPAT'))) {
my $x = '$(WCECOMPAT)/lib';
if (-f "$x/env('TARGETCPU')/wcecompatex.lib") {
$x .= '/$(TARGETCPU)/wcecompatex.lib';
} else {
$x .= '/wcecompatex.lib';
}
push @ex_libs, $x;
}
push @ex_libs, '$(PORTSDK_LIBPATH)/portlib.lib'
if (defined(env('PORTSDK_LIBPATH')));
push @ex_libs, '/nodefaultlib coredll.lib corelibc.lib'
if (env('TARGETCPU') =~ /^X86|^ARMV4[IT]/);
return join(" ", @ex_libs);
}),
},
#### MinGW
"mingw-common" => {
inherit_from => [ 'BASE_unix' ],
@ -1703,7 +1580,7 @@ my %targets = (
cppflags => combine("-DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN",
threads("-D_MT")),
lib_cppflags => "-DL_ENDIAN",
ex_libs => add("-lws2_32 -lgdi32 -lcrypt32"),
ex_libs => add("-lws2_32 -lgdi32 -lcrypt32 -lbcrypt"),
thread_scheme => "winthreads",
dso_scheme => "win32",
shared_target => "mingw-shared",
@ -1856,45 +1733,6 @@ my %targets = (
shared_cflag => "-fPIC",
shared_extension => ".\$(SHLIB_VERSION_NUMBER).dylib",
},
# Option "freeze" such as -std=gnu9x can't negatively interfere
# with future defaults for below two targets, because MacOS X
# for PPC has no future, it was discontinued by vendor in 2009.
"darwin8-ppc-cc" => {
inherit_from => [ "darwin-ppc" ],
disable => [ "async" ]
},
"darwin-ppc-cc" => { inherit_from => [ "darwin-ppc" ] }, # Historic alias
"darwin-ppc" => {
inherit_from => [ "darwin-common" ],
cflags => add("-arch ppc -std=gnu9x -Wa,-force_cpusubtype_ALL"),
lib_cppflags => add("-DB_ENDIAN"),
shared_cflag => add("-fno-common"),
asm_arch => 'ppc32',
perlasm_scheme => "osx32",
},
"darwin8-ppc64-cc" => {
inherit_from => [ "darwin64-ppc" ],
disable => [ "async" ]
},
"darwin64-ppc-cc" => { inherit_from => [ "darwin64-ppc" ] }, # Historic alias
"darwin64-ppc" => {
inherit_from => [ "darwin-common" ],
cflags => add("-arch ppc64 -std=gnu9x"),
lib_cppflags => add("-DB_ENDIAN"),
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
asm_arch => 'ppc64',
perlasm_scheme => "osx64",
},
"darwin-i386-cc" => { inherit_from => [ "darwin-i386" ] }, # Historic alias
"darwin-i386" => {
inherit_from => [ "darwin-common" ],
CFLAGS => add(picker(release => "-fomit-frame-pointer")),
cflags => add("-arch i386"),
lib_cppflags => add("-DL_ENDIAN"),
bn_ops => "BN_LLONG RC4_INT",
asm_arch => 'x86',
perlasm_scheme => "macosx",
},
"darwin64-x86_64-cc" => { inherit_from => [ "darwin64-x86_64" ] }, # Historic alias
"darwin64-x86_64" => {
inherit_from => [ "darwin-common" ],
@ -2012,8 +1850,7 @@ my %targets = (
? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); }),
cflag_incfirst => '/FIRST_INCLUDE=',
lib_defines =>
add("OPENSSL_USE_NODELETE",
"_XOPEN_SOURCE", "_XOPEN_SOURCE_EXTENDED=1",
add("_XOPEN_SOURCE", "_XOPEN_SOURCE_EXTENDED=1",
sub {
return vms_info()->{def_zlib}
? "LIBZ=\"\"\"".vms_info()->{def_zlib}."\"\"\"" : ();

View file

@ -22,7 +22,6 @@
ex_libs => add('-lrld'),
enable => ['egd'],
# Not currently inherited
disable => ['atexit'],
dso_scheme => 'DLFCN',
sys_id => 'TANDEM',
},
@ -191,7 +190,7 @@
'nonstop-archenv-x86_64-oss',
'nonstop-ilp32',
'nonstop-efloat-x86_64' ],
disable => ['threads','atexit'],
disable => ['threads'],
},
'nonstop-nsx_put' => {
inherit_from => [ 'nonstop-common',
@ -201,7 +200,6 @@
'nonstop-model-put' ],
multilib => '-put',
multibin => '-put',
disable => ['atexit'],
},
'nonstop-nsx_64' => {
inherit_from => [ 'nonstop-common',
@ -210,7 +208,7 @@
'nonstop-efloat-x86_64' ],
multilib => '64',
multibin => '64',
disable => ['threads','atexit'],
disable => ['threads'],
},
'nonstop-nsx_64_put' => {
inherit_from => [ 'nonstop-common',
@ -220,7 +218,6 @@
'nonstop-model-put' ],
multilib => '64-put',
multibin => '64-put',
disable => ['atexit'],
},
'nonstop-nsx_64_klt' => {
inherit_from => [ 'nonstop-common',
@ -230,19 +227,18 @@
'nonstop-model-klt' ],
multilib => '64-klt',
multibin => '64-klt',
disable => ['atexit'],
},
'nonstop-nsx_g' => {
inherit_from => [ 'nonstop-common',
'nonstop-archenv-x86_64-guardian',
'nonstop-ilp32', 'nonstop-nfloat-x86_64' ],
disable => ['threads','atexit'],
disable => ['threads'],
},
'nonstop-nsx_g_tandem' => {
inherit_from => [ 'nonstop-common',
'nonstop-archenv-x86_64-guardian',
'nonstop-ilp32', 'nonstop-tfloat-x86_64' ],
disable => ['threads','atexit'],
disable => ['threads'],
},
'nonstop-nsv' => {
inherit_from => [ 'nonstop-nsx' ],
@ -252,7 +248,7 @@
'nonstop-archenv-itanium-oss',
'nonstop-ilp32',
'nonstop-efloat-itanium' ],
disable => ['threads','atexit'],
disable => ['threads'],
},
'nonstop-nse_put' => {
inherit_from => [ 'nonstop-common',
@ -262,7 +258,6 @@
'nonstop-model-put' ],
multilib => '-put',
multibin => '-put',
disable => ['atexit'],
},
'nonstop-nse_64' => {
inherit_from => [ 'nonstop-common',
@ -271,7 +266,7 @@
'nonstop-efloat-itanium' ],
multilib => '64',
multibin => '64',
disable => ['threads','atexit'],
disable => ['threads'],
},
'nonstop-nse_64_put' => {
inherit_from => [ 'nonstop-common',
@ -281,5 +276,4 @@
'nonstop-model-put' ],
multilib => '64-put',
multibin => '64-put',
disable => ['atexit'],
},

View file

@ -502,7 +502,7 @@ The build-file template is processed with the perl module
Text::Template, using `{-` and `-}` as delimiters that enclose the
perl code fragments that generate configuration-dependent content.
Those perl fragments have access to all the hash variables from
configdata.pem.
configdata.pm.
The build-file template is expected to define at least the following
perl functions in a perl code fragment enclosed with `{-` and `-}`.

View file

@ -11,6 +11,7 @@
our $makedepcmd = platform->makedepcmd();
sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ }
sub run_on_windows { $^O =~ /^(?:cygwin|msys|MSWin32)/ }
# Shared AIX support is special. We put libcrypto[64].so.ver into
# libcrypto.a and use libcrypto_a.a as static one, unless using
@ -72,6 +73,7 @@ OPTIONS={- $config{options} -}
CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
SRCDIR={- $config{sourcedir} -}
BLDDIR={- $config{builddir} -}
RESULT_D=$(BLDDIR)/test-runs
FIPSKEY={- $config{FIPSKEY} -}
VERSION={- "$config{full_version}" -}
@ -502,6 +504,9 @@ BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
'$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
CMOCKA_LIBS={- $config{cmocka_libs} // '' -}
DETOURS_LIBS={- $config{detours_libs} // '' -}
# CPPFLAGS_Q is used for one thing only: to build up buildinf.h
CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
$cppflags2 =~ s|([\\"])|\\$1|g;
@ -599,6 +604,12 @@ list-tests: ## List available tests that can be invoked via "make test TESTS=<na
##@ Workspace cleaning
cov-clean: ## Remove all coverage data files
-find . \( -name '*.gcda' -o -name '*.gcno' \) \! -type d | xargs $(RM)
cov-reset: ## Remove runtime coverage counters
-find . -name '*.gcda' \! -type d | xargs $(RM)
libclean:
@set -e; for s in $(SHLIB_INFO); do \
if [ "$$s" = ";" ]; then continue; fi; \
@ -633,15 +644,32 @@ clean: libclean ## Clean the workspace, keep the configuration
$(RM) $(MANDOCS7)
$(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(FIPSMODULE) $(SCRIPTS)
$(RM) $(GENERATED_MANDATORY) $(GENERATED)
-find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -exec $(RM) {} \;
-find . -name '*{- platform->objext() -}' \! -name '.*' \! -type d -exec $(RM) {} \;
$(RM) core
$(RM) tags TAGS doc-nits md-nits
$(RM) -r test/test-runs
$(RM) -r $(RESULT_D)
$(RM) providers/fips*.new
-find . -type l \! -name '.*' \! -wholename './pkcs11-provider/*' -exec $(RM) {} \;
# Remove the generated dependency files, object files, and symlinks
# in a single pass, avoid descending into submodules.
-find . \( -path './cloudflare-quiche' \
-o -path './fuzz/corpora' \
-o -path './gost-engine' \
-o -path './krb5' \
-o -path './oqs-provider' \
-o -path './pkcs11-provider' \
-o -path './pyca-cryptography' \
-o -path './python-ecdsa' \
-o -path './tlsfuzzer' \
-o -path './tlslite-ng' \
-o -path './wycheproof' \) \
-prune \
-o \! -type d \
\( -name '*{- platform->depext() -}' \
-o -name '*{- platform->objext() -}' \
-o -type l \) \
\! -name '.*' \
-exec $(RM) '{}' +
distclean: clean ## Clean and remove the configuration
distclean: clean cov-clean ## Clean and remove the configuration
$(RM) include/openssl/configuration.h
$(RM) configdata.pm
$(RM) Makefile
@ -879,6 +907,7 @@ uninstall_dev: uninstall_runtime_libs
done
-$(RMDIR) "$(DESTDIR)$(PKGCONFIGDIR)"
-$(RMDIR) "$(DESTDIR)$(CMAKECONFIGDIR)"
-$(RMDIR) "$(DESTDIR)$(libdir)/cmake"
-$(RMDIR) "$(DESTDIR)$(libdir)"
_install_modules_deps: install_runtime_libs build_modules
@ -1180,10 +1209,18 @@ lint: ## Evaluate C code via "splint"
echo splint -DLINT -posixlib -preproc -D__gnuc_va_list=void \
-I. -Iinclude -Iapps/include $(CRYPTOHEADERS) $(SSLHEADERS) $(SRCS) )
.PHONY: check-format
check-format: ## Evaluate C code according to OpenSSL coding standards
( cd $(SRCDIR); $(PERL) util/check-format.pl \
$(SRCS) \$(CRYPTOHEADERS) $(SSLHEADERS) )
CLANG_FORMAT_DIFF = clang-format-diff
.PHONY: check-format check-clang-format-diff-cmd
check-clang-format-diff-cmd:
@if ! command -v "$(CLANG_FORMAT_DIFF)" >/dev/null; then \
echo "Unable to find ${CLANG_FORMAT_DIFF}";\
echo "Please set the CLANG_FORMAT_DIFF variable to your clang-format-diff command";\
exit 1;\
fi
check-format: check-clang-format-diff-cmd ## Evaluate C code according to OpenSSL coding standards
( cd $(SRCDIR); git diff -U0 --no-prefix --no-color | $(CLANG_FORMAT_DIFF) )
generate_apps:
( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
@ -1280,11 +1317,14 @@ providers/fips.module.sources.new: configdata.pm
for x in crypto/bn/asm/*.pl crypto/bn/asm/*.S \
crypto/aes/asm/*.pl crypto/aes/asm/*.S \
crypto/ec/asm/*.pl \
crypto/ml_dsa/asm/*.pl \
crypto/ml_kem/asm/*.pl \
crypto/modes/asm/*.pl \
crypto/sha/asm/*.pl \
crypto/slh_dsa/asm/*.pl \
crypto/*cpuid.pl crypto/*cpuid.S \
crypto/*cap.c; do \
echo "$$x"; \
test -e "$$x" && echo "$$x"; \
done \
) | grep -v sm2p256 | sort | uniq > providers/fips.module.sources.new
rm -rf sources-tmp
@ -1307,7 +1347,8 @@ errors:
include/openssl/dtls1.h
include/openssl/srtp.h
include/openssl/quic.h
include/openssl/sslerr_legacy.h );
include/openssl/sslerr_legacy.h
include/openssl/ech.h);
my @cryptoheaders_tmpl =
qw( include/internal/dso.h
include/internal/o_dir.h
@ -1542,12 +1583,24 @@ EOF
my $section = $1;
my $name = uc basename($args{src}, ".$section");
my $pod = $gen0;
return <<"EOF";
if ($config{manpage_format} eq "mdoc") {
return <<"EOF";
$args{src}: $pod
pod2mdoc -n $name -s $section\$(MANSUFFIX) \\
-d \$(RELEASE_DATE) \\
$pod >\$\@
EOF
} elsif ($config{manpage_format} eq "roff") {
return <<"EOF";
$args{src}: $pod
pod2man --name=$name --section=$section\$(MANSUFFIX) --center=OpenSSL \\
--date=\$(RELEASE_DATE) --release=\$(VERSION) \\
$pod >\$\@
EOF
} else {
die "Unhandled manpage format: $config{manpage_format}";
}
} elsif (platform->isdef($args{src})) {
#
# Linker script-ish generator
@ -1858,13 +1911,27 @@ $import: $full
EOF
}
}
$recipe .= <<"EOF";
if (!run_on_windows()) {
$recipe .= <<"EOF";
$full: $fulldeps
\$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
-o $full$shared_def \\
$fullobjs \\
$linklibs \$(LIB_EX_LIBS)
EOF
} else {
$recipe .= <<"EOF";
$full: $fulldeps
\$(file >\$@.lst, \\
$fullobjs \\
)
\$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
-o $full$shared_def \\
@\$@.lst \\
$linklibs \$(LIB_EX_LIBS)
rm -f \$@.lst
EOF
}
if (windowsdll()) {
$recipe .= <<"EOF";
rm -f apps/$full
@ -1969,6 +2036,15 @@ EOF
push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
}
}
my $wrapflags = '';
if (defined $unified_info{wraps}->{$args{bin}}) {
$wrapflags = ' ' . join(' ',
map { "-Wl,--wrap=$_" }
@{$unified_info{wraps}->{$args{bin}}});
}
my $utlibs = $unified_info{unit_test_libs}->{$args{bin}};
$utlibs = $utlibs ne '' ? ' ' . $utlibs : '' if defined $utlibs;
$utlibs //= '';
my $linkflags = join("", map { $_." " } @linkdirs);
my $linklibs = join("", map { $_." " } @linklibs);
my $cmd = '$(CC)';
@ -1986,10 +2062,10 @@ EOF
return <<"EOF";
$bin: $deps
rm -f $bin
\$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
\$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS)$wrapflags \\
-o $bin \\
$objs \\
$linklibs\$(BIN_EX_LIBS)
$linklibs\$(BIN_EX_LIBS)$utlibs
EOF
}
sub in2script {

View file

@ -38,6 +38,7 @@
PLATFORM={- $config{target} -}
SRCDIR={- $config{sourcedir} -}
BLDDIR={- $config{builddir} -}
RESULT_D=$(BLDDIR)\test-runs
FIPSKEY={- $config{FIPSKEY} -}
VERSION={- "$config{full_version}" -}
@ -208,7 +209,7 @@ OPENSSLDIR_dir={- canonpath($openssldir_dir) -}
LIBDIR={- our $libdir = $config{libdir} || "lib";
file_name_is_absolute($libdir) ? "" : $libdir -}
MODULESDIR_dev={- use File::Spec::Functions qw(:DEFAULT splitpath catpath);
our $modulesprefix = catdir($prefix,$libdir);
our $modulesprefix = file_name_is_absolute($libdir) ? $libdir : catdir($prefix,$libdir);
our ($modulesprefix_dev, $modulesprefix_dir,
$modulesprefix_file) =
splitpath($modulesprefix, 1);
@ -379,6 +380,9 @@ BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
'$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
CMOCKA_LIBS={- $config{cmocka_libs} // '' -}
DETOURS_LIBS={- $config{detours_libs} // '' -}
# CPPFLAGS_Q is used for one thing only: to build up buildinf.h
CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
$cppflags2 =~ s|([\\"])|\\$1|g;
@ -449,22 +453,22 @@ uninstall: {- "uninstall_docs" if !$disabled{docs}; -} uninstall_sw {- $disabled
libclean:
"$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """{.,apps,test,fuzz}/$$1.*"""; } @ARGV" $(SHLIBS)
-del /Q /F $(LIBS) libcrypto.* libssl.* ossl_static.pdb
-del /Q /F $(LIBS) libcrypto.* libssl.*
clean: libclean
{- join("\n\t", map { "-del /Q /F $_" } @HTMLDOCS1) || "\@rem" -}
{- join("\n\t", map { "-del /Q /F $_" } @HTMLDOCS3) || "\@rem" -}
{- join("\n\t", map { "-del /Q /F $_" } @HTMLDOCS5) || "\@rem" -}
{- join("\n\t", map { "-del /Q /F $_" } @HTMLDOCS7) || "\@rem" -}
{- join("\n\t", map { "-del /Q /F $_" } @PROGRAMS) || "\@rem" -}
{- join("\n\t", map { "-del /Q /F $_" } @MODULES) || "\@rem" -}
{- join("\n\t", map { "-del /Q /F $_" } @SCRIPTS) || "\@rem" -}
{- join("\n\t", map { "-del /Q /F $_" } @GENERATED_MANDATORY) || "\@rem" -}
{- join("\n\t", map { "-del /Q /F $_" } @GENERATED) || "\@rem" -}
{- join("\n\t", map { "-if exist $_ del /Q /F $_" } @HTMLDOCS1) || "\@rem" -}
{- join("\n\t", map { "-if exist $_ del /Q /F $_" } @HTMLDOCS3) || "\@rem" -}
{- join("\n\t", map { "-if exist $_ del /Q /F $_" } @HTMLDOCS5) || "\@rem" -}
{- join("\n\t", map { "-if exist $_ del /Q /F $_" } @HTMLDOCS7) || "\@rem" -}
{- join("\n\t", map { "-if exist $_ del /Q /F $_" } @PROGRAMS) || "\@rem" -}
{- join("\n\t", map { "-if exist $_ del /Q /F $_" } @MODULES) || "\@rem" -}
{- join("\n\t", map { "-if exist $_ del /Q /F $_" } @SCRIPTS) || "\@rem" -}
{- join("\n\t", map { "-if exist $_ del /Q /F $_" } @GENERATED_MANDATORY) || "\@rem" -}
{- join("\n\t", map { "-if exist $_ del /Q /F $_" } @GENERATED) || "\@rem" -}
-del /Q /S /F *.d *.obj *.pdb *.ilk *.manifest
-del /Q /S /F apps\*.lib apps\*.rc apps\*.res apps\*.exp
-del /Q /S /F test\*.exp
-rd /Q /S test\test-runs
-@if exist "$(RESULT_D)" rd /Q /S "$(RESULT_D)"
distclean: clean
-del /Q /F include\openssl\configuration.h
@ -544,8 +548,6 @@ install_dev: install_runtime_libs
"$(INSTALLTOP)\include\openssl"
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(libdir)"
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_LIBS) "$(libdir)"
@if "$(SHLIBS)"=="" \
"$(PERL)" "$(SRCDIR)\util\copy.pl" ossl_static.pdb "$(libdir)"
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(CMAKECONFIGDIR)"
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_EXPORTERS_CMAKE) "$(CMAKECONFIGDIR)"
@ -584,10 +586,10 @@ install_programs: install_runtime_libs build_inst_programs
@if not "$(INSTALL_PROGRAMS)"=="" \
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMS) \
"$(INSTALLTOP)\bin"
@if not "$(INSTALL_PROGRAMS)"=="" \
@if not "$(INSTALL_PROGRAMPDBS)"=="" \
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMPDBS) \
"$(INSTALLTOP)\bin"
@if not "$(INSTALL_PROGRAMS)"=="" \
@if not "$(BIN_SCRIPTS)"=="" \
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BIN_SCRIPTS) \
"$(INSTALLTOP)\bin"
@ -1002,11 +1004,14 @@ EOF
my $ress = join($target{ld_resp_delim}, @ress);
my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps);
my $deps = join(" ", @objs, @ress, @deps);
my $utlibs = $unified_info{unit_test_libs}->{$args{bin}};
$utlibs = (defined $utlibs && $utlibs ne '')
? "$utlibs$target{ld_resp_delim}" : '';
return <<"EOF";
$bin: $deps
IF EXIST $bin.manifest DEL /F /Q $bin.manifest
\$(LD) \$(LDFLAGS) \$(BIN_LDFLAGS) @<<
$objs$target{ld_resp_delim}\$(LDOUTFLAG)$bin$target{ldpostoutflag}$target{ld_resp_delim}$linklibs\$(BIN_EX_LIBS)$target{ldresflag}$target{ldresflag}$ress
$objs$target{ld_resp_delim}\$(LDOUTFLAG)$bin$target{ldpostoutflag}$target{ld_resp_delim}$utlibs$linklibs\$(BIN_EX_LIBS)$target{ldresflag}$target{ldresflag}$ress
<<
IF EXIST $bin.manifest \\
\$(MT) \$(MTFLAGS) \$(MTINFLAG)$bin.manifest \$(MTOUTFLAG)$bin

429
Configure
View file

@ -1,6 +1,6 @@
#! /usr/bin/env perl
# -*- mode: perl; -*-
# Copyright 2016-2025 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 2016-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@ -27,7 +27,7 @@ use OpenSSL::config;
my $orig_death_handler = $SIG{__DIE__};
$SIG{__DIE__} = \&death_handler;
my $usage="Usage: Configure [no-<feature> ...] [enable-<feature> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]thread-pool] [[no-]default-thread-pool] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-egd] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--config=FILE] [--help] os/compiler[:flags]\n";
my $usage="Usage: Configure [no-<feature> ...] [enable-<feature> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]thread-pool] [[no-]default-thread-pool] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-egd] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--config=FILE] [--manpage-format={roff,mdoc}] [--help] os/compiler[:flags]\n";
my $banner = <<"EOF";
@ -171,16 +171,17 @@ my @gcc_devteam_warn = qw(
-Wextra
-Wno-unused-parameter
-Wno-missing-field-initializers
-Wno-unterminated-string-initialization
-Wswitch
-Wsign-compare
-Wshadow
-Wformat
-Wno-type-limits
-Wtype-limits
-Wundef
-Werror
-Wmissing-prototypes
-Wstrict-prototypes
-Wpointer-arith
-Wfloat-conversion
);
# These are used in addition to $gcc_devteam_warn when the compiler is clang.
@ -221,16 +222,9 @@ our $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT";
#
# API compatibility name to version number mapping.
#
# This table expresses when API additions or changes can occur
my $apitable = {
# This table expresses when API additions or changes can occur.
# The numbering used changes from 3.0 and on because we updated
# (solidified) our version numbering scheme at that point.
# From 3.0 and on, we internalise the given version number in decimal
# as MAJOR * 10000 + MINOR * 100 + 0
"3.0.0" => 30000,
"3.0" => 30000,
# Note that before 3.0, we didn't have the same version number scheme.
# Still, the numbering we use here covers what we need.
"1.1.1" => 10101,
@ -241,6 +235,19 @@ my $apitable = {
"0.9.8" => 908,
};
# From 3.0 and on, we internalise the given version number in decimal
# as MAJOR * 10000 + MINOR * 100 + 0
my @post30_versions = ([3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],
[4, 0], [4, 1],
);
# The numbering used changes from 3.0 and on because we updated
# (solidified) our version numbering scheme at that point.
foreach (@post30_versions) {
my ($x, $y) = @{$_};
$apitable->{"$x.$y.0"} = $apitable->{"$x.$y"} = $x * 10000 + $y * 100;
}
# For OpenSSL::config::get_platform
my %guess_opts = ();
@ -288,6 +295,7 @@ my $dofile = abs2rel(catfile($srcdir, "util/dofile.pl"));
my $local_config_envname = 'OPENSSL_LOCAL_CONFIG_DIR';
$config{manpage_format} = "roff";
$config{sourcedir} = abs2rel($srcdir, $blddir);
$config{builddir} = abs2rel($blddir, $blddir);
# echo -n 'holy hand grenade of antioch' | openssl sha256
@ -413,61 +421,120 @@ my $auto_threads=1; # enable threads automatically? true by default
my $default_ranlib;
# Known TLS and DTLS protocols
my @tls = qw(ssl3 tls1 tls1_1 tls1_2 tls1_3);
my @tls = qw(tls1 tls1_1 tls1_2 tls1_3);
my @dtls = qw(dtls1 dtls1_2);
# Explicitly known options that are possible to disable. They can
# be regexps, and will be used like this: /^no-${option}$/
# For developers: keep it sorted alphabetically
my @disablables = (
"acvp-tests",
"apps",
my @disablables_protocols = (
"cmp",
"dtls",
"http",
"ocsp",
"ktls",
"tls",
"tls-deprecated-ec",
"quic",
"sctp",
"srp",
"srtp"
);
foreach my $proto ((@tls, @dtls))
{
push(@disablables_protocols, $proto);
push(@disablables_protocols, "$proto-method") unless $proto eq "tls1_3";
}
my @disablables_algorithms = (
"argon2",
"aria",
"asan",
"asm",
"async",
"atexit",
"autoalginit",
"autoerrinit",
"autoload-config",
"bf",
"blake2",
"brotli",
"camellia",
"cast",
"chacha",
"cmac",
"cms",
"comp",
"des",
"dh",
"dsa",
"hmac-drbg-kdf",
"ec",
"ec2m",
"ecx",
"kbkdf",
"krb5kdf",
"gost",
"idea",
"ikev2kdf",
"md2",
"md4",
"md5",
"mdc2",
"ml-dsa",
"ml-kem",
"lms",
"ocb",
"poly1305",
"psk",
"pvkkdf",
"rc2",
"rc4",
"rc5",
"rmd160",
"scrypt",
"seed",
"siphash",
"slh-dsa",
"siv",
"snmpkdf",
"sm2",
"sm3",
"sm4",
"srtpkdf",
"sshkdf",
"sskdf",
"x942kdf",
"x963kdf",
"whirlpool",
"zlib",
"zstd",
);
my @disablables_features = (
"acvp-tests",
"apps",
"asan",
"asm",
"async",
"autoalginit",
"autoerrinit",
"autoload-config",
"brotli-dynamic",
"buildtest-c++",
"bulk",
"cached-fetch",
"camellia",
"dgram",
"winstore",
"cast",
"chacha",
"cmac",
"cmp",
"cms",
"comp",
"crypto-mdebug",
"allocfail-tests",
"ct",
"ct-validation",
"default-thread-pool",
"demos",
"h3demo",
"hqinterop",
"deprecated",
"des",
"dgram",
"dh",
"docs",
"dsa",
"dso",
"dtls",
"ec",
"ec2m",
"ech",
"ec_explicit_curves",
"ec_nistp_64_gcc_128",
"ecdh",
"ecdsa",
"ecx",
"egd",
"err",
"external-tests",
@ -478,84 +545,48 @@ my @disablables = (
"fips-jitter",
"fuzz-afl",
"fuzz-libfuzzer",
"gost",
"http",
"idea",
"integrity-only-ciphers",
"jitter",
"ktls",
"legacy",
"lms",
"makedepend",
"md2",
"md4",
"mdc2",
"ml-dsa",
"ml-kem",
"module",
"msan",
"multiblock",
"nextprotoneg",
"ocb",
"ocsp",
"pic",
"pie",
"pinshared",
"poly1305",
"posix-io",
"psk",
"quic",
"unstable-qlog",
"rc2",
"rc4",
"rc5",
"rdrand",
"rfc3779",
"rmd160",
"scrypt",
"sctp",
"secure-memory",
"seed",
"shared",
"siphash",
"siv",
"slh-dsa",
"sm2",
"sm2-precomp",
"sm3",
"sm4",
"sock",
"srp",
"srtp",
"sse2",
"ssl",
"ssl-trace",
"static-vcruntime",
"stdio",
"sslkeylog",
"tests",
"tfo",
"thread-pool",
"threads",
"tls",
"tls-deprecated-ec",
"trace",
"ts",
"ubsan",
"ui-console",
"unit-test",
"unit-tests",
"uplink",
"weak-ssl-ciphers",
"whirlpool",
"zlib",
"zlib-dynamic",
"zstd",
"zstd-dynamic",
);
foreach my $proto ((@tls, @dtls))
{
push(@disablables, $proto);
push(@disablables, "$proto-method") unless $proto eq "tls1_3";
}
);
my @disablables = sort (@disablables_protocols,@disablables_algorithms,@disablables_features);
# Internal disablables, for aliasing purposes. They serve no special
# purpose here, but allow scripts to get to know them through configdata.pm,
@ -566,6 +597,7 @@ my @disablables_int = qw(
);
my %deprecated_disablables = (
"atexit" => undef,
"engine" => undef,
"static-engine" => undef,
"dynamic-engine" => undef,
@ -581,11 +613,15 @@ my %deprecated_disablables = (
"ripemd" => "rmd160",
"ui" => "ui-console",
"heartbeats" => undef,
"ssl" => undef,
"ssl3" => undef,
"ssl3-method" => undef,
);
# All of the following are disabled by default:
our %disabled = ( # "what" => "comment"
"atexit" => "default",
"fips" => "default",
"fips-jitter" => "default",
"asan" => "default",
@ -594,9 +630,11 @@ our %disabled = ( # "what" => "comment"
"buildtest-c++" => "default",
"crypto-mdebug" => "default",
"allocfail-tests" => "default",
"ct-validation" => "default",
"demos" => "default",
"h3demo" => "default",
"hqinterop" => "default",
"ec_explicit_curves" => "default",
"ec_nistp_64_gcc_128" => "default",
"egd" => "default",
"engine" => "default",
@ -611,13 +649,14 @@ our %disabled = ( # "what" => "comment"
"msan" => "default",
"rc5" => "default",
"sctp" => "default",
"ssl3" => "default",
"ssl3-method" => "default",
"sslkeylog" => "default",
"static-vcruntime" => "default",
"tfo" => "default",
"tls-deprecated-ec" => "default",
"trace" => "default",
"ubsan" => "default",
"unit-test" => "default",
"unit-tests" => "default",
"weak-ssl-ciphers" => "default",
"zlib" => "default",
"zlib-dynamic" => "default",
@ -629,32 +668,32 @@ our %disabled = ( # "what" => "comment"
my @disable_cascades = (
# "what" => [ "cascade", ... ]
"bulk" => [ "shared", "dso",
"argon2", "aria", "async", "atexit", "autoload-config",
"argon2", "aria", "async", "autoload-config",
"blake2", "bf", "camellia", "cast", "chacha",
"cmac", "cms", "cmp", "comp", "ct",
"des", "dgram", "dh", "dsa",
"ec",
"filenames",
"idea", "ktls", "lms",
"ec", "ech",
"filenames", "hmac-drbg-kdf",
"idea", "ikev2kdf", "kbkdf", "krb5kdf", "ktls", "lms",
"md4", "ml-dsa", "ml-kem", "multiblock",
"nextprotoneg", "ocsp", "ocb", "poly1305", "psk",
"rc2", "rc4", "rmd160",
"pvkkdf", "rc2", "rc4", "rmd160",
"scrypt", "seed", "siphash", "siv",
"slh-dsa", "sm3", "sm4", "srp",
"srtp", "ssl3-method", "ssl-trace",
"slh-dsa", "sm3", "sm4", "snmpkdf",
"srp", "srtp", "srtpkdf", "sshkdf", "sskdf",
"ssl-trace",
"tfo",
"ts", "ui-console", "whirlpool",
"x942kdf", "x963kdf",
"fips-securitychecks" ],
sub { $config{processor} eq "386" }
=> [ "sse2" ],
"ssl" => [ "ssl3" ],
"ssl3-method" => [ "ssl3" ],
"zlib" => [ "zlib-dynamic" ],
"brotli" => [ "brotli-dynamic" ],
"zstd" => [ "zstd-dynamic" ],
"des" => [ "mdc2" ],
"deprecated" => [ "tls-deprecated-ec" ],
"ec" => [ qw(ec2m ecdsa ecdh sm2 gost ecx tls-deprecated-ec) ],
"ec" => [ qw(ec2m ec_explicit_curves sm2 gost ecx tls-deprecated-ec) ],
"dgram" => [ "dtls", "quic", "sctp" ],
"sock" => [ "dgram", "tfo" ],
"dtls" => [ @dtls ],
@ -687,7 +726,7 @@ my @disable_cascades = (
"stdio" => [ "apps", "egd" ],
"apps" => [ "tests" ],
"tests" => [ "external-tests" ],
"tests" => [ "external-tests", "unit-tests" ],
"comp" => [ "zlib", "brotli", "zstd" ],
"sm3" => [ "sm2" ],
sub { !$disabled{"unit-test"} } => [ "heartbeats" ],
@ -822,6 +861,11 @@ $config{ex_libs} = [ env('__CNF_LDLIBS') || () ];
$config{openssl_api_defines}=[];
$config{openssl_sys_defines}=[];
$config{openssl_feature_defines}=[];
$config{openssl_disabled_protocols}=[];
$config{openssl_disabled_algorithms}=[];
$config{openssl_disabled_features}=[];
$config{options}="";
$config{build_type} = "release";
my $target="";
@ -882,6 +926,14 @@ while (@argvcopy)
$unsupported_options{$_} = 1;
next;
}
# Do not allow users to enable removed features
if (/^enable-(.+)$/ && exists $deprecated_disablables{$word}
&& $deprecated_disablables{$word} eq undef)
{
$unsupported_options{$_} = 1;
next;
}
}
if (/^no-(.+)$/ || /^disable-(.+)$/)
{
@ -901,11 +953,6 @@ while (@argvcopy)
}
$disabled{"dtls"} = "option(dtls)";
}
elsif ($1 eq "ssl")
{
# Last one of its kind
$disabled{"ssl3"} = "option(ssl)";
}
elsif ($1 eq "tls")
{
# XXX: Tests will fail if all SSL/TLS
@ -998,6 +1045,10 @@ while (@argvcopy)
{
$config{build_type} = "release";
}
elsif (/^--manpage-format=(mdoc|roff)$/)
{
$config{manpage_format}="$1";
}
elsif (/^--pgo$/)
{
$config{build_type} = "pgo";
@ -1071,6 +1122,22 @@ while (@argvcopy)
{
$withargs{fuzzer_include}=$1;
}
elsif (/^--with-cmocka-lib=(.*)$/)
{
$withargs{cmocka_lib}=$1;
}
elsif (/^--with-cmocka-include=(.*)$/)
{
$withargs{cmocka_include}=$1;
}
elsif (/^--with-detours-lib=(.*)$/)
{
$withargs{detours_lib}=$1;
}
elsif (/^--with-detours-include=(.*)$/)
{
$withargs{detours_include}=$1;
}
elsif (/^--with-rand-seed=(.*)$/)
{
foreach my $x (split(m|,|, $1))
@ -1354,8 +1421,7 @@ at runtime in openssl.cnf or configured at build time with
-DOPENSSL_DEFAULT_SEED_SRC.
Please read the 'Note on random number generation' section in the
INSTALL.md instructions and the RAND_DRBG(7) manual page for more
details.
INSTALL.md instructions for more details.
============================== WARNING ===============================
_____
@ -1584,12 +1650,12 @@ unless ($disabled{threads}) {
}
}
# Find out if clang's sanitizers have been enabled with -fsanitize
# flags and ensure that the corresponding %disabled elements area
# removed to reflect that the sanitizers are indeed enabled.
# Find out if clang's sanitizers have been enabled with -fsanitize (or
# /fsanitize for VC targets) flags and ensure that the corresponding %disabled
# elements area removed to reflect that the sanitizers are indeed enabled.
my %detected_sanitizers = ();
foreach (grep /^-fsanitize=/, @{$config{CFLAGS} || []}) {
(my $checks = $_) =~ s/^-fsanitize=//;
foreach (grep { /^[-\/]fsanitize=/ } @{$config{CFLAGS} || []}) {
(my $checks = $_) =~ s|^[-/]fsanitize=||;
foreach (split /,/, $checks) {
my $d = { address => 'asan',
undefined => 'ubsan',
@ -1624,11 +1690,17 @@ if (($target{shared_target} // '') eq "")
}
unless ($disabled{asan} || defined $detected_sanitizers{asan}) {
push @{$config{cflags}}, "-fsanitize=address";
push @{$config{cflags}},
$config{target} =~ /^VC-/ ? "/fsanitize=address" : "-fsanitize=address";
}
my %predefined_C = compiler_predefined($config{CROSS_COMPILE}.$config{CC});
unless ($disabled{ubsan} || defined $detected_sanitizers{ubsan}) {
push @{$config{cflags}}, "-fsanitize=undefined", "-fno-sanitize-recover=all", "-DPEDANTIC";
if ($predefined_C{__clang__}) {
push @{$config{cflags}}, "-fno-sanitize=function";
}
}
unless ($disabled{msan} || defined $detected_sanitizers{msan}) {
@ -1637,8 +1709,50 @@ unless ($disabled{msan} || defined $detected_sanitizers{msan}) {
unless ($disabled{"fuzz-libfuzzer"} && $disabled{"fuzz-afl"}
&& $disabled{asan} && $disabled{ubsan} && $disabled{msan}) {
push @{$config{cflags}}, "-fno-omit-frame-pointer", "-g";
push @{$config{cxxflags}}, "-fno-omit-frame-pointer", "-g" if $config{CXX};
unless ($config{target} =~ /^VC-/) {
push @{$config{cflags}}, "-fno-omit-frame-pointer", "-g";
push @{$config{cxxflags}}, "-fno-omit-frame-pointer", "-g" if $config{CXX};
}
}
# Valgrind-based constant-time validation: marks secret data as "undefined"
# to Valgrind's memcheck tool, so that any control flow or memory indexing
# that depends on secret data is flagged as an error. Requires valgrind
# headers at build time and running the tests under valgrind at test time.
# Use |make TESTS="test_internal_ml_kem test_internal_ml_dsa" test| under
# valgrind after building with this option.
#
# Package names for the required valgrind headers:
# Debian/Ubuntu : valgrind (headers bundled in the main package)
# Fedora/RHEL : valgrind-devel
# Alpine : valgrind-dev
# Arch Linux : valgrind
unless ($disabled{"ct-validation"}) {
# Probe for <valgrind/memcheck.h> so that we give a clear error here
# rather than a cryptic compile failure inside constant_time.h later.
my $cc = ($config{CROSS_COMPILE} // "").$config{CC};
my $probe_src = "ct_valgrind_probe_$$.c";
my $probe_obj = "ct_valgrind_probe_$$.o";
open(my $fh, ">", $probe_src)
or die "Cannot write probe file '$probe_src': $!";
print $fh "#include <valgrind/memcheck.h>\n";
close($fh);
my $probe_ok = (system("$cc -c -o $probe_obj $probe_src 2>/dev/null") == 0);
unlink($probe_src, $probe_obj);
if (!$probe_ok) {
die <<EOT;
***** enable-ct-validation requires <valgrind/memcheck.h> at build time,
***** but the header was not found by '$cc'.
*****
***** Install the appropriate package and re-run Configure:
***** Debian/Ubuntu : sudo apt-get install valgrind
***** Fedora/RHEL : sudo dnf install valgrind-devel
***** Alpine : sudo apk add valgrind-dev
***** Arch Linux : sudo pacman -S valgrind
EOT
}
push @{$config{openssl_feature_defines}}, "OPENSSL_CONSTANT_TIME_VALIDATION";
}
#
# Platform fix-ups
@ -1666,7 +1780,6 @@ if ($target{sys_id} ne "")
push @{$config{openssl_sys_defines}}, "OPENSSL_SYS_$target{sys_id}";
}
my %predefined_C = compiler_predefined($config{CROSS_COMPILE}.$config{CC});
my %predefined_CXX = $config{CXX}
? compiler_predefined($config{CROSS_COMPILE}.$config{CXX})
: ();
@ -1827,6 +1940,29 @@ unless ($disabled{winstore}) {
push @{$config{openssl_other_defines}}, "OPENSSL_NO_KTLS" if ($disabled{ktls});
# Keywords accepted in a build.info UNIT_TEST[] link set.
my @unit_test_keywords = qw(cmocka detours);
unless ($disabled{"unit-tests"}) {
if ($target =~ /^linux/ || $target =~ /^BSD/) {
$config{cmocka_includes} =
$withargs{cmocka_include} ? [$withargs{cmocka_include}] : [];
$config{cmocka_libs} = $withargs{cmocka_lib}
? "-L$withargs{cmocka_lib} -lcmocka" : "-lcmocka";
} elsif ($target =~ /^VC-/) {
$config{cmocka_includes} =
$withargs{cmocka_include} ? [$withargs{cmocka_include}] : [];
$config{cmocka_libs} = $withargs{cmocka_lib}
? "/LIBPATH:$withargs{cmocka_lib} cmocka.lib" : "cmocka.lib";
$config{detours_includes} =
$withargs{detours_include} ? [$withargs{detours_include}] : [];
$config{detours_libs} = $withargs{detours_lib}
? "/LIBPATH:$withargs{detours_lib} detours.lib" : "detours.lib";
} else {
disable('no-unit-test-support', 'unit-tests');
}
}
# Get the extra flags used when building shared libraries and modules. We
# do this late because some of them depend on %disabled.
@ -1907,6 +2043,20 @@ foreach my $what (sort keys %disabled) {
my $macro = $disabled_info{$what}->{macro} = "OPENSSL_NO_$WHAT";
push @{$config{openssl_feature_defines}}, $macro;
my @rules = (
[ \@disablables_protocols, 'openssl_disabled_protocols' ],
[ \@disablables_algorithms, 'openssl_disabled_algorithms' ],
[ \@disablables_features, 'openssl_disabled_features' ],
);
for my $r (@rules) {
my ($list, $target) = @$r;
if (grep { $what eq $_ } @$list) {
push @{$config{$target}}, uc $what;
}
}
$skipdir{"crypto/$skipdir"} = $what
unless $what eq 'async' || $what eq 'err' || $what eq 'dso' || $what eq 'http';
}
@ -2037,6 +2187,8 @@ if ($builder eq "unified") {
my %includes = ();
my %defines = ();
my %depends = ();
my %unit_tests = ();
my %wraps = ();
my %generate = ();
my %imagedocs = ();
my %htmldocs = ();
@ -2292,6 +2444,16 @@ if ($builder eq "unified") {
\$attributes{depends}, $+{ATTRIBS},
tokenize($expand_variables->($+{VALUE})))
if !@skip || $skip[$#skip] > 0; },
qr/^\s* UNIT_TEST ${index_re} \s* = \s* ${value_re} \s* $/x
=> sub { $push_to->(\%unit_tests, $expand_variables->($+{INDEX}),
undef, undef,
tokenize($expand_variables->($+{VALUE})))
if !@skip || $skip[$#skip] > 0; },
qr/^\s* WRAP ${index_re} \s* = \s* ${value_re} \s* $/x
=> sub { $push_to->(\%wraps, $expand_variables->($+{INDEX}),
undef, undef,
tokenize($expand_variables->($+{VALUE})))
if !@skip || $skip[$#skip] > 0; },
qr/^\s* GENERATE ${index_re} ${attribs_re} \s* = \s* ${value_re} \s* $/x
=> sub { $push_to->(\%generate, $expand_variables->($+{INDEX}),
\$attributes{generate}, $+{ATTRIBS},
@ -2578,6 +2740,27 @@ if ($builder eq "unified") {
}
}
foreach my $dest (keys %wraps) {
my $ddest = cleanfile($buildd, $dest, $blddir);
foreach my $fn (@{$wraps{$dest}}) {
push @{$unified_info{wraps}->{$ddest}}, $fn;
}
}
foreach my $dest (keys %unit_tests) {
my $ddest = cleanfile($buildd, $dest, $blddir);
foreach my $kw (@{$unit_tests{$dest}}) {
die "***** Unknown keyword '$kw' in UNIT_TEST[$dest] at $sourced/$f\n"
unless grep { $_ eq $kw } @unit_test_keywords;
}
$unified_info{unit_tests}->{$ddest} =
[ @{$unit_tests{$dest}} ];
}
# WRAP implies cmocka unless an explicit UNIT_TEST set was given
foreach my $dest (keys %{$unified_info{wraps} // {}}) {
$unified_info{unit_tests}->{$dest} //= [ "cmocka" ];
}
foreach my $section (keys %imagedocs) {
foreach (@{$imagedocs{$section}}) {
my $imagedocs = cleanfile($buildd, $_, $blddir);
@ -2910,6 +3093,28 @@ EOF
}
}
# Attach cmocka (and, on Windows, Detours) include paths to unit tests,
# based on each test's UNIT_TEST[] link set.
if (!$disabled{"unit-tests"}) {
while (my ($dest, $libs) = each %{$unified_info{unit_tests} // {}}) {
my %want = map { $_ => 1 } @$libs;
push @{$unified_info{includes}->{$dest}}, @{$config{cmocka_includes}}
if $want{cmocka} && @{$config{cmocka_includes} // []};
push @{$unified_info{includes}->{$dest}}, @{$config{detours_includes}}
if $want{detours} && @{$config{detours_includes} // []};
}
}
if (!$disabled{"unit-tests"}) {
foreach my $dest (sort keys %{$unified_info{unit_tests} // {}}) {
my %want = map { $_ => 1 } @{$unified_info{unit_tests}->{$dest}};
my @resolved;
push @resolved, '$(CMOCKA_LIBS)' if $want{cmocka} && $config{cmocka_libs};
push @resolved, '$(DETOURS_LIBS)' if $want{detours} && $config{detours_libs};
$unified_info{unit_test_libs}->{$dest} = join(' ', @resolved);
}
}
# For the schemes that need it, we provide the old *_obj configs
# from the *_asm_obj ones
foreach (grep /_(asm|aux)_src$/, keys %target) {

194
DOCUMENTATION.md Normal file
View file

@ -0,0 +1,194 @@
OpenSSL Documentation Policy
============================
This document describes the code documentation and commenting requirements
for the OpenSSL project.
The project's documentation is about making the libraries and tools more
accessible to our users and making the code more maintainable. This policy
applies to new submissions; existing code does not uniformly conform to it
and will be brought up to standard gradually.
Any non-trivial change to existing code must bring the affected code into
conformance with this policy as part of the same change. In particular,
renaming or relocating functions, changes to public APIs, and any change
that would render an existing POD page or in-source comment inaccurate
require the corresponding documentation to be updated. This includes
adding documentation that was previously absent where the change brings
the affected code within the scope of this policy.
The form and style of code comments themselves -- comment markers, layout,
the use of `/**` and `/*-` blocks, doxygen markup, the structure of the
sample multi-line comment, and similar -- are described in
[STYLE.md](STYLE.md). This file describes what *must* be documented and
where; [STYLE.md](STYLE.md) describes how code comments look.
Command line commands and arguments
-----------------------------------
All new commands, as well as new or modified arguments to existing
commands, must be documented in the `doc/man1` directory. This
documentation is in POD format.
Public symbols in the libraries
-------------------------------
All new public symbols must be documented in a POD manual page in the
`doc/man3` directory. This includes types, macros, and functions.
The allowed exceptions are:
- guard macros preventing a header file being included twice
- new symbols generated automatically via `make update` (errors, objects, etc.)
Each public function's declaration in its public header must carry a
doxygen comment block. The block's `@see` must include the function's
own manual page (`name(3)`) and may include additional manual pages
that a caller needs to use the function correctly. The doxygen block
is a navigation aid pointing to the canonical reference documentation
in the corresponding POD file; see [STYLE.md](STYLE.md) for the
doxygen form.
Overviews, conventions, et al
-----------------------------
Where additional user-facing information is required, it should be
included in the `doc/man7` section. This includes, but is not limited to:
- algorithm descriptions and parameters
- architectural and subsystem overviews
- user guides and tutorials
- conventions and reference material (environment variables, glossary,
threading rules, file format conventions)
Internal functions, structures, globals and macros
--------------------------------------------------
Internal functions, structures, globals and macros are non-public
items declared in any header that is not part of the public API.
These include items declared in:
- `include/internal/` (shared across subsystems);
- `include/crypto/` (cryptographic internals);
- per-directory local headers (for example, `crypto/asn1/asn1_local.h`)
shared between source files in a single subdirectory.
These should all be documented at the declaration site -- that is,
in the header that declares them -- using a doxygen-style comment
block. For functions, this places the comment at the prototype,
where editor tooling (clangd and similar) can surface it to readers
at every call site. The comment should describe the purpose and,
for functions, the input and output arguments and the return value.
See [STYLE.md](STYLE.md) for the doxygen conventions used by OpenSSL.
For *trivial* items, where their operation is obvious from their
implementation, the documentation requirement is not mandated. The
following are generally representative of trivial items, however it is
quite possible for any of these to be non-trivial in specific instances
and therefore require documentation:
- `OSSL_DISPATCH` tables
- upref functions
- free functions
- simple getter/setter functions
- wrappers for other functions (a function that calls a more recent
`_ex` variant or a group of functions that call a common internal
routine)
For structures, each of the fields should be commented stating its
purpose. Again, a *trivial* exception applies where the purpose is
obvious. Some representative examples:
- `OSSL_LIB_CTX *ctx;` where there is only one library context referenced
in the structure.
- `struct *next;` in a linked list implementation.
- `CRYPTO_REF_COUNT refcnt;`
File-local items
----------------
These are functions, structures, globals, and macros that are local
to a single C file: `static` functions, file-scope variables,
structures, and macros defined inside a `.c` file with no declaration
in any header.
These should all be documented at the point of definition. Follow the
same rules and exceptions as for internal items above. In some cases
slightly more leniency with respect to *trivial* can be tolerated.
Code comments
-------------
The form, style, and content guidance for code comments are described in
[STYLE.md](STYLE.md). Comments are required at the points described in
the internal and static sections above, subject to the *trivial*
exception, and at the additional points described in
[STYLE.md](STYLE.md).
Assembly code
-------------
Assembly code should include a good description of the algorithm and
approach being used. This should be followed by a performance comparison
and then the assembly code itself. The assembly code should be well
commented, but it is not necessary to comment every line. A comment
describing each block of code suffices.
For pure-assembly modules (`.s` files and the perlasm scripts that
generate them), comments use the native syntax of the assembler or
generator (typically `#`). Doxygen-style markup does not apply here;
the algorithm description, performance comparison, and per-block
comments described above are still required.
For assembly that appears inline inside a C file (within an `asm()`
statement, for example), the surrounding C function is documented
with doxygen-style C comments as for any other C code; see
[STYLE.md](STYLE.md). Comments inside the `asm()` body itself use
plain C `/* */` comments.
There are no *trivial* exceptions for assembly code.
Configure options
-----------------
New options added to the configuration scripts must be documented in the
[INSTALL.md](INSTALL.md) file.
Changes and news
----------------
Significant modifications should be documented in the
[CHANGES.md](CHANGES.md) file.
Very significant features and changes should be documented in the
[NEWS.md](NEWS.md) file.
In both cases, the added note should be short and to the point, and
should be written for users of the library, focusing on impact rather
than implementation details.
Automated sanity checking
-------------------------
The `make doc-nits` command should be run before submitting a pull
request and any problems it locates must be addressed.
Language
--------
The language used for documentation shall be *British English*.
In general the language, abbreviations, layout and formatting should also
correspond to the
[LDP](https://openssl-library.org/policies/general/glossary/#ldp)
guidelines.
Common sense
------------
Comments and documentation are to improve readability and comprehension.
Where the code is obvious, there is no need to include a comment.
However, common sense applies: always err in favour of including more
comments than less or none. Code that you have just written that is
*obvious* will not necessarily be to someone else two years later. See
[STYLE.md](STYLE.md) for the form and content of code comments.

8
HOWTO.md Normal file
View file

@ -0,0 +1,8 @@
MODIFYING OPENSSL SOURCE
========================
This is a collection of pointers to parts of the documentation that will help
people doing modifications.
* [doc/HOWTO/adding-functions.md](Adding new Functions)
* [doc/HOWTO/documenting-functions-macros.md](Documenting Functions and Macros)

View file

@ -169,13 +169,11 @@ issue the following commands to build OpenSSL.
$ nmake test
As mentioned in the [Choices](#choices) section, you need to pick one
of the four Configure targets in the first command.
of the Configure targets in the first command.
Most likely you will be using the `VC-WIN64A`/`VC-WIN64A-HYBRIDCRT` target for
64bit Windows binaries (AMD64) or `VC-WIN32`/`VC-WIN32-HYBRIDCRT` for 32bit
Windows binaries (X86).
The other two options are `VC-WIN64I` (Intel IA64, Itanium) and
`VC-CE` (Windows CE) are rather uncommon nowadays.
Installing OpenSSL
------------------
@ -428,6 +426,22 @@ The names of the libraries are:
* brotlidec.lib
* brotlienc.lib
### with-cmocka-include
--with-cmocka-include=DIR
The directory for the location of the cmocka include file. This option is only
necessary if [enable-unit-tests](#enable-unit-tests) is used and the include
file is not already on the system include path.
### with-cmocka-lib
--with-cmocka-lib=DIR
The directory containing the cmocka library. This option is only necessary if
[enable-unit-tests](#enable-unit-tests) is used and the library is not already
on the system library path.
### with-zlib-include
--with-zlib-include=DIR
@ -584,6 +598,15 @@ In the following list, always the non-default variant is documented: if
feature `xxxx` is disabled by default then `enable-xxxx` is documented and
if feature `xxxx` is enabled by default then `no-xxxx` is documented.
### enable-static-vcruntime
Build binaries that do not require that VC runtimes are installed
This option will produce binaries that are "self contained", that do not
depend upon VC runtime libraries being installed, so can be used on any
computer running MS Windows. Without this option, the build will produce
binaries that rely on the VC runtimes being installed and available.
### enable-ktls
Build with Kernel TLS support.
@ -634,9 +657,10 @@ Do not build support for async operations.
Do not use `atexit()` in libcrypto builds.
`atexit()` has varied semantics between platforms and can cause SIGSEGV in some
circumstances. This option disables the atexit registration of OPENSSL_cleanup.
By default, NonStop configurations use `no-atexit`.
Before version 4.0, OpenSSL used to set `atexit()` handler for cleaning up
global data, and this option allowed to disable that functionality. `atexit()`
handler setup was removed in OpenSSL 4.0, so `no-atexit` option is retained
for compatibility reasons only, always present, and does nothing.
### no-autoalginit
@ -757,20 +781,22 @@ Don't build and install documentation, i.e. manual pages in various forms.
Don't build support for loading Dynamic Shared Objects (DSO)
### no-ec
### enable-tls-deprecated-ec
Don't build support for Elliptic Curves.
### no-ec2m
Don't build support for binary Elliptic Curves
### no-tls-deprecated-ec
Disable legacy TLS EC groups that were deprecated in RFC8422. These are the
Enable legacy TLS EC groups that were deprecated in RFC8422. These are the
Koblitz curves, B<secp160r1>, B<secp160r2>, B<secp192r1>, B<secp224r1>, and the
binary Elliptic curves that would also be disabled by C<no-ec2m>.
### enable-ec_expicit_curves
Enable support for explictitly specified elliptic curves not matching the
well-known ones. Until this option is on, such curves can't be instantiated
from ASN.1 formats.
### no-ech
Don't build support for Encrypted Client Hello (ECH) extension.
### enable-ec_nistp_64_gcc_128
Enable support for optimised implementations of some commonly used NIST
@ -806,6 +832,12 @@ external test suites are currently supported:
See the file [test/README-external.md](test/README-external.md)
for further details.
### enable-unit-tests
Enable building and running unit tests.
This works only on platforms supporting ld `--wrap` option like Linux and BSD.
### no-filenames
Don't compile in filename and line number information (e.g. for errors and
@ -857,6 +889,13 @@ Note that if this feature is enabled then GOST ciphersuites are only available
if the GOST algorithms are also available through loading an externally supplied
engine.
### no-engine, no-static-engine, no-dynamic-engine
The `no-engine` option is always present. These options are deprecated and do
nothing, and are retained for backwards compatibility only. The ENGINE API was
deprecated in OpenSSL 3.0 and removed in OpenSSL 4.0, so applications should
transition to using providers instead.
### no-http
Disable HTTP support.
@ -867,26 +906,10 @@ Don't build the legacy provider.
Disabling this also disables the legacy algorithms: MD2 (already disabled by default).
### enable-lms
Enable Leighton-Micali Signatures (LMS) support.
Support is currently limited to verification only as per
[SP 800-208](https://csrc.nist.gov/pubs/sp/800/208/final).
### no-makedepend
Don't generate dependencies.
### no-ml-dsa
Disable Module-Lattice-Based Digital Signature Standard (ML-DSA) support.
ML-DSA is based on CRYSTALS-DILITHIUM. See [FIPS 204].
### no-ml-kem
Disable Module-Lattice-Based Key-Encapsulation Mechanism Standard (ML-KEM)
support. ML-KEM is based on CRYSTALS-KYBER. See [FIPS 203].
### no-module
Don't build any dynamically loadable modules.
@ -917,17 +940,17 @@ Build with support for Position Independent Execution.
Don't pin the shared libraries.
By default OpenSSL will attempt to stay in memory until the process exits.
This is so that libcrypto and libssl can be properly cleaned up automatically
via an `atexit()` handler. The handler is registered by libcrypto and cleans
up both libraries. On some platforms the `atexit()` handler will run on unload of
libcrypto (if it has been dynamically loaded) rather than at process exit.
By default, on supported platforms (such as Linux and GNU Hurd), OpenSSL
is built with linker options (e.g., `-Wl,-znodelete`) that prevent the
operating system from unloading the libcrypto and libssl shared libraries
from memory, even if the application explicitly unloads them using
`dlclose()`. On platforms that do not support these options, this feature
is disabled by default.
This option can be used to stop OpenSSL from attempting to stay in memory until the
process exits. This could lead to crashes if either libcrypto or libssl have
already been unloaded at the point that the atexit handler is invoked, e.g. on a
platform which calls `atexit()` on unload of the library, and libssl is unloaded
before libcrypto then a crash is likely to happen.
This option prevents the addition of those linker flags, allowing the
shared libraries to be completely unloaded from the process address space.
This is useful for applications that dynamically load and unload OpenSSL
plugins to conserve memory.
Note that shared library pinning is not automatically disabled for static builds,
i.e., `no-shared` does not imply `no-pinshared`. This may come as a surprise when
@ -935,10 +958,6 @@ linking libcrypto statically into a shared third-party library, because in this
case the shared library will be pinned. To prevent this behaviour, you need to
configure the static build using `no-shared` and `no-pinshared` together.
Applications can suppress running of the `atexit()` handler at run time by
using the `OPENSSL_INIT_NO_ATEXIT` option to `OPENSSL_init_crypto()`.
See the man page for it for further details.
### no-posix-io
Don't use POSIX IO capabilities.
@ -966,11 +985,6 @@ Do not create shared libraries, only static ones.
See [Notes on shared libraries](#notes-on-shared-libraries) below.
### no-slh-dsa
Disable Stateless Hash Based Digital Signature Standard support.
(SLH-DSA is based on SPHINCS+. See [FIPS 205])
### no-sm2-precomp
Disable using the SM2 precomputed table on aarch64 to make the library smaller.
@ -1101,10 +1115,12 @@ The User Interface console method enables text based console prompts.
### enable-unit-test
Enable additional unit test APIs.
Enable exposing SSL_test_functions for overwriting ssl_init_wbio_buffer.
This should not typically be used in production deployments.
This option is deprecated and will be removed in OpenSSL 5.0.
### no-uplink
Don't build support for UPLINK interface.
@ -1161,8 +1177,8 @@ Don't build support for negotiating the specified SSL/TLS protocol.
If `no-tls` is selected then all of `tls1`, `tls1_1`, `tls1_2` and `tls1_3`
are disabled.
Similarly `no-dtls` will disable `dtls1` and `dtls1_2`. The `no-ssl` option is
synonymous with `no-ssl3`. Note this only affects version negotiation.
Similarly `no-dtls` will disable `dtls1` and `dtls1_2`.
`no-ssl` and `no-ssl3` are deprecated and do nothing.
OpenSSL will still provide the methods for applications to explicitly select
the individual protocol versions.
@ -1178,28 +1194,37 @@ Analogous to `no-{protocol}` but in addition do not build the methods for
applications to explicitly select individual protocol versions. Note that there
is no `no-tls1_3-method` option because there is no application method for
TLSv1.3.
`no-ssl3` is deprecated and does nothing.
Using individual protocol methods directly is deprecated. Applications should
use `TLS_method()` instead.
### enable-{algorithm}
enable-{md2|rc5}
enable-{md2|rc5|lms}
Build with support for the specified algorithm.
The `lms` algorithm support is currently limited to verification only as per
[SP 800-208](https://csrc.nist.gov/pubs/sp/800/208/final).
### no-{algorithm}
no-{aria|bf|blake2|camellia|cast|chacha|cmac|
des|dh|dsa|ecdh|ecdsa|idea|md4|mdc2|ml-dsa|
ml-kem|ocb|poly1305|rc2|rc4|rmd160|scrypt|
seed|siphash|siv|sm2|sm3|sm4|whirlpool}
des|dh|dsa|
ec|ec2m|ecdh|ecdsa|hmac-drbg-kdf|idea|ikev2kdf|kbkdf|krb5kdf|
md4|mdc2|
ml-dsa|ml-kem|
ocb|poly1305|pvkkdf|rc2|rc4|rmd160|scrypt|
seed|siphash|siv|slh-dsa|sm2|sm3|sm4|snmpkdf|srtpkdf|sshkdf|sskdf|
x942kdf|x963kdf|whirlpool}
Build without support for the specified algorithm.
The `ripemd` algorithm is deprecated and if used is synonymous with `rmd160`.
### Compiler-specific options
Compiler-specific options
-------------------------
-Dxxx, -Ixxx, -Wp, -lxxx, -Lxxx, -Wl, -rpath, -R, -framework, -static
@ -1230,7 +1255,17 @@ encoding.
Take note of the [Environment Variables](#environment-variables) documentation
below and how these flags interact with those variables.
### Environment Variables
Miscellaneous options
---------------------
### --manpage-format
Specify a specific output manpage format. The supported output types are mandoc
and *roff. The *roff output format is the default for legacy and portability
reasons.
Environment Variables
---------------------
VAR=value
@ -1307,10 +1342,18 @@ If `CC` is set, it is advisable to also set `CXX` to ensure both the C and C++
compiler are in the same "family". This becomes relevant with
`enable-external-tests` and `enable-buildtest-c++`.
### Reconfigure
Reconfigure
-----------
reconf
reconfigure
### Make targets
`$ make reconf`
or
`$ make reconfigure`
### Description
Reconfigure from earlier data.
@ -1928,9 +1971,8 @@ on Cygwin, shared libraries are named `cygcrypto-1.1.dll` and `cygssl-1.1.dll`
with import libraries `libcrypto.dll.a` and `libssl.dll.a`.
On Windows build with MSVC or using MingW, shared libraries are named
`libcrypto-1_1.dll` and `libssl-1_1.dll` for 32-bit Windows,
`libcrypto-1_1-x64.dll` and `libssl-1_1-x64.dll` for 64-bit x86_64 Windows,
and `libcrypto-1_1-ia64.dll` and `libssl-1_1-ia64.dll` for IA64 Windows.
`libcrypto-1_1.dll` and `libssl-1_1.dll` for 32-bit Windows, and
`libcrypto-1_1-x64.dll` and `libssl-1_1-x64.dll` for 64-bit x86_64 Windows.
With MSVC, the import libraries are named `libcrypto.lib` and `libssl.lib`,
while with MingW, they are named `libcrypto.dll.a` and `libssl.dll.a`.

680
NEWS.md
View file

@ -7,6 +7,7 @@ release. For more details please read the CHANGES file.
OpenSSL Releases
----------------
- [OpenSSL 4.1](#openssl-41)
- [OpenSSL 4.0](#openssl-40)
- [OpenSSL 3.6](#openssl-36)
- [OpenSSL 3.5](#openssl-35)
@ -22,20 +23,280 @@ OpenSSL Releases
- [OpenSSL 1.0.0](#openssl-100)
- [OpenSSL 0.9.x](#openssl-09x)
OpenSSL 4.1
-----------
### Major changes between OpenSSL 4.0 and OpenSSL 4.1 [under development]
* API calls `CRYPTO_atomic_load_ptr`, `CRYPTO_atomic_store_ptr`, and
`CRYPTO_atomic_cmp_exch_ptr` have been added.
* Fixed verification of DSA certificates signed with SHA-384 or SHA-512.
OpenSSL 4.0
-----------
### Major changes between OpenSSL 3.6 and OpenSSL 4.0 [under development]
### Major changes between OpenSSL 4.0.0 and OpenSSL 4.0.1 [9 Jun 2026]
* ENGINE support was removed. The `no-engine` build option and the
`OPENSSL_NO_ENGINE` macro is always present.
OpenSSL 4.0.1 is a security patch release. The most severe CVE fixed
in this release is High.
* The crypto-mdebug-backtrace configuration option has been entirely removed.
This release incorporates the following bug fixes and mitigations:
* Fixed heap use-after-free in `PKCS7_verify()`.
([CVE-2026-45447])
* Fixed CMS `AuthEnvelopedData` processing may accept forged messages.
([CVE-2026-34182])
* Fixed unbounded memory growth in the QUIC `PATH_CHALLENGE` handler.
([CVE-2026-34183])
* Fixed double-free when checking OCSP stapled response.
([CVE-2026-35188])
* Fixed NULL pointer dereference in QUIC server initial packet handling.
([CVE-2026-42764])
* Fixed AES-OCB IV ignored on `EVP_Cipher()` path.
([CVE-2026-45445])
* Fixed possible heap buffer overflow in ASN.1 multibyte string conversion.
([CVE-2026-7383])
* Fixed out-of-bounds read in CMS password-based decryption.
([CVE-2026-9076])
* Fixed heap buffer over-read in ASN.1 content parsing.
([CVE-2026-34180])
* Fixed PKCS#12 files with PBMAC1 are accepted with short HMAC keys.
([CVE-2026-34181])
* Fixed NULL dereference in certificate verification with OCSP Checking.
([CVE-2026-42765])
* Fixed possible NULL dereference in password-dased CMS decryption.
([CVE-2026-42766])
* Fixed NULL pointer dereference in CRMF `EncryptedValue` decryption.
([CVE-2026-42767])
* Fixed multi-`RecipientInfo` Bleichenbacher Oracle in `CMS_decrypt()`
and `PKCS7_decrypt()`.
([CVE-2026-42768])
* Fixed trust anchor substitution via `cert`/`issuer` typo in CMP
`rootCaKeyUpdate`.
([CVE-2026-42769])
* Fixed FFC-DH peer validation uses attacker-supplied `q`.
([CVE-2026-42770])
* Fixed possible out of bounds read in `X509_VERIFY_PARAM_set1_email()`.
([CVE-2026-42771])
* Fixed incorrect tag processing for empty messages in AES-GCM-SIV
and AES-SIV modes.
([CVE-2026-45446])
* Fixed a regression introduced in 4.0.0 that led to a `openssl pkey`
command crash when it was invoked to encrypt a private key with password
being provided interactively.
* Fixed a regression introduced in 4.0.0 that led to `openssl s_client -adv`
command prematurely terminating a session when reading input of 16384 bytes
in one `read()` call.
### Major changes between OpenSSL 3.6 and OpenSSL 4.0.0 [14 Apr 2026]
OpenSSL 4.0.0 is a feature release adding significant new functionality
to OpenSSL.
This release incorporates the following potentially significant or incompatible
changes:
* Removed extra leading '00:' when printing key data such as an RSA modulus
in hexadecimal format where the first (most significant) byte is >= 0x80.
* Standardized the width of hexadecimal dumps to 24 bytes for signatures
(to stay within the 80 characters limit) and 16 bytes for everything else.
* Lower bounds checks are now enforced when using `PKCS5_PBKDF2_HMAC` API
with FIPS provider.
* Added AKID verification checks when `X509_V_FLAG_X509_STRICT` is set.
* Augmented CRL verification process with several additional checks.
* `libcrypto` no longer cleans up globally allocated data via `atexit()`.
* `BIO_snprintf()` now uses `snprintf()` provided by libc instead of internal
implementation.
* `OPENSSL_cleanup()` now runs in a global destructor, or not at all
by default.
* `ASN1_STRING` has been made opaque.
* Signatures of numerous API functions, including those that are related
to X509 processing, are changed to include `const` qualifiers for argument
and return types, where suitable.
* Deprecated `X509_cmp_time()`, `X509_cmp_current_time()`,
and `X509_cmp_timeframe()` in favor of `X509_check_certificate_times()`.
* Removed support for the SSLv2 Client Hello.
* Removed support for SSLv3. SSLv3 has been deprecated since 2015,
and OpenSSL had it disabled by default since version 1.1.0 (2016).
* Removed support for engines. The `no-engine` build option
and the `OPENSSL_NO_ENGINE` macro are always present.
* Support of deprecated elliptic curves in TLS according to [RFC 8422] was
disabled at compile-time by default. To enable it, use the
`enable-tls-deprecated-ec` configuration option.
* Support of explicit EC curves was disabled at compile-time by default.
To enable it, use the `enable-ec_explicit_curves` configuration option.
* Removed `c_rehash` script tool. Use `openssl rehash` instead.
* Removed the deprecated `msie-hack` option from the `openssl ca` command.
* Removed `BIO_f_reliable()` implementation without replacement.
It was broken since 3.0 release without any complaints.
* Removed deprecated support for custom `EVP_CIPHER`, `EVP_MD`, `EVP_PKEY`,
and `EVP_PKEY_ASN1` methods.
* Removed deprecated fixed SSL/TLS version method functions.
* Removed deprecated functions `ERR_get_state()`, `ERR_remove_state()`
and `ERR_remove_thread_state()`. The `ERR_STATE` object is now always
opaque.
* Dropped `darwin-i386{,-cc}` and `darwin-ppc{,64}{,-cc}` targets
from Configurations.
This release adds the following new features:
* Support for Encrypted Client Hello (ECH, [RFC 9849]).
See `doc/designs/ech-api.md` for details.
* Support for [RFC 8998], signature algorithm `sm2sig_sm3`, key exchange
group `curveSM2`, and [tls-hybrid-sm2-mlkem] post-quantum group
`curveSM2MLKEM768`.
* cSHAKE function support as per [SP 800-185].
* "ML-DSA-MU" digest algorithm support.
* Support for SNMP KDF and SRTP KDF.
* FIPS self tests can now be deferred and run as needed when installing
the FIPS module with the `-defer_tests` option of the `openssl fipsinstall`
command.
* Support for using either static or dynamic VC runtime linkage
on Windows.
* Support for negotiated FFDHE key exchange in TLS 1.2 in accordance
with [RFC 7919].
OpenSSL 3.6
-----------
### Major changes between OpenSSL 3.5 and OpenSSL 3.6 [under development]
### Major changes between OpenSSL 3.6.1 and OpenSSL 3.6.2 [7 Apr 2026]
OpenSSL 3.6.2 is a security patch release. The most severe CVE fixed in this
release is Moderate.
This release incorporates the following bug fixes and mitigations:
* Fixed incorrect failure handling in RSA KEM RSASVE encapsulation.
([CVE-2026-31790])
* Fixed loss of key agreement group tuple structure when the `DEFAULT` keyword
is used in the server-side configuration of the key-agreement group list.
([CVE-2026-2673])
* Fixed out-of-bounds read in AES-CFB-128 on x86-64 CPUs with AVX-512 support.
([CVE-2026-28386])
* Fixed potential use-after-free in DANE client code.
([CVE-2026-28387])
* Fixed NULL pointer dereference when processing a delta CRL.
([CVE-2026-28388])
* Fixed possible NULL dereference when processing CMS KeyAgreeRecipientInfo.
([CVE-2026-28389])
* Fixed possible NULL dereference when processing CMS
KeyTransportRecipientInfo.
([CVE-2026-28390])
* Fixed heap buffer overflow in hexadecimal conversion.
([CVE-2026-31789])
### Major changes between OpenSSL 3.6.0 and OpenSSL 3.6.1 [27 Jan 2026]
OpenSSL 3.6.1 is a security patch release. The most severe CVE fixed in this
release is High.
This release incorporates the following bug fixes and mitigations:
* Fixed Improper validation of PBMAC1 parameters in PKCS#12 MAC verification.
([CVE-2025-11187])
* Fixed Stack buffer overflow in CMS `AuthEnvelopedData` parsing.
([CVE-2025-15467])
* Fixed NULL dereference in `SSL_CIPHER_find()` function on unknown cipher ID.
([CVE-2025-15468])
* Fixed `openssl dgst` one-shot codepath silently truncates inputs >16 MiB.
([CVE-2025-15469])
* Fixed TLS 1.3 `CompressedCertificate` excessive memory allocation.
([CVE-2025-66199])
* Fixed Heap out-of-bounds write in `BIO_f_linebuffer` on short writes.
([CVE-2025-68160])
* Fixed Unauthenticated/unencrypted trailing bytes with low-level OCB
function calls.
([CVE-2025-69418])
* Fixed Out of bounds write in `PKCS12_get_friendlyname()` UTF-8 conversion.
([CVE-2025-69419])
* Fixed Missing `ASN1_TYPE` validation in `TS_RESP_verify_response()`
function.
([CVE-2025-69420])
* Fixed NULL Pointer Dereference in `PKCS12_item_decrypt_d2i_ex()` function.
([CVE-2025-69421])
* Fixed Missing `ASN1_TYPE` validation in PKCS#12 parsing.
([CVE-2026-22795])
* Fixed `ASN1_TYPE` Type Confusion in the `PKCS7_digest_from_attributes()`
function.
([CVE-2026-22796])
* Fixed a regression in `X509_V_FLAG_CRL_CHECK_ALL` flag handling by
restoring its pre-3.6.0 behaviour.
* Fixed a regression in handling stapled OCSP responses causing handshake
failures for OpenSSL 3.6.0 servers with various client implementations.
### Major changes between OpenSSL 3.5 and OpenSSL 3.6.0 [1 Oct 2025]
OpenSSL 3.6.0 is a feature release adding significant new functionality
to OpenSSL.
This release incorporates the following potentially significant or incompatible
changes:
@ -754,7 +1015,7 @@ OpenSSL 1.1.1
### Major changes between OpenSSL 1.1.1d and OpenSSL 1.1.1e [17 Mar 2020]
* Fixed an overflow bug in the x64_64 Montgomery squaring procedure
* Fixed an overflow bug in the x86_64 Montgomery squaring procedure
used in exponentiation with 512-bit moduli ([CVE-2019-1551])
### Major changes between OpenSSL 1.1.1c and OpenSSL 1.1.1d [10 Sep 2019]
@ -1984,190 +2245,233 @@ OpenSSL 0.9.x
* Support for various new platforms
<!-- Links -->
[CVE-2025-9232]: https://www.openssl.org/news/vulnerabilities.html#CVE-2025-9232
[CVE-2025-9231]: https://www.openssl.org/news/vulnerabilities.html#CVE-2025-9231
[CVE-2025-9230]: https://www.openssl.org/news/vulnerabilities.html#CVE-2025-9230
[CVE-2025-4575]: https://www.openssl.org/news/vulnerabilities.html#CVE-2025-4575
[CVE-2024-13176]: https://www.openssl.org/news/vulnerabilities.html#CVE-2024-13176
[CVE-2024-9143]: https://www.openssl.org/news/vulnerabilities.html#CVE-2024-9143
[CVE-2024-6119]: https://www.openssl.org/news/vulnerabilities.html#CVE-2024-6119
[CVE-2024-5535]: https://www.openssl.org/news/vulnerabilities.html#CVE-2024-5535
[CVE-2024-4741]: https://www.openssl.org/news/vulnerabilities.html#CVE-2024-4741
[CVE-2024-4603]: https://www.openssl.org/news/vulnerabilities.html#CVE-2024-4603
[CVE-2024-2511]: https://www.openssl.org/news/vulnerabilities.html#CVE-2024-2511
[CVE-2024-0727]: https://www.openssl.org/news/vulnerabilities.html#CVE-2024-0727
[CVE-2023-6237]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-6237
[CVE-2023-6129]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-6129
[CVE-2023-5678]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-5678
[CVE-2023-5363]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-5363
[CVE-2023-4807]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-4807
[CVE-2023-3817]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-3817
[CVE-2023-3446]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-3446
[CVE-2023-2975]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-2975
[CVE-2023-2650]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-2650
[CVE-2023-1255]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-1255
[CVE-2023-0466]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-0466
[CVE-2023-0465]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-0465
[CVE-2023-0464]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-0464
[CVE-2023-0401]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-0401
[CVE-2023-0286]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-0286
[CVE-2023-0217]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-0217
[CVE-2023-0216]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-0216
[CVE-2023-0215]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-0215
[CVE-2022-4450]: https://www.openssl.org/news/vulnerabilities.html#CVE-2022-4450
[CVE-2022-4304]: https://www.openssl.org/news/vulnerabilities.html#CVE-2022-4304
[CVE-2022-4203]: https://www.openssl.org/news/vulnerabilities.html#CVE-2022-4203
[CVE-2022-3996]: https://www.openssl.org/news/vulnerabilities.html#CVE-2022-3996
[CVE-2022-2274]: https://www.openssl.org/news/vulnerabilities.html#CVE-2022-2274
[CVE-2022-2097]: https://www.openssl.org/news/vulnerabilities.html#CVE-2022-2097
[CVE-2020-1971]: https://www.openssl.org/news/vulnerabilities.html#CVE-2020-1971
[CVE-2020-1967]: https://www.openssl.org/news/vulnerabilities.html#CVE-2020-1967
[CVE-2019-1563]: https://www.openssl.org/news/vulnerabilities.html#CVE-2019-1563
[CVE-2019-1559]: https://www.openssl.org/news/vulnerabilities.html#CVE-2019-1559
[CVE-2019-1552]: https://www.openssl.org/news/vulnerabilities.html#CVE-2019-1552
[CVE-2019-1551]: https://www.openssl.org/news/vulnerabilities.html#CVE-2019-1551
[CVE-2019-1549]: https://www.openssl.org/news/vulnerabilities.html#CVE-2019-1549
[CVE-2019-1547]: https://www.openssl.org/news/vulnerabilities.html#CVE-2019-1547
[CVE-2019-1543]: https://www.openssl.org/news/vulnerabilities.html#CVE-2019-1543
[CVE-2018-5407]: https://www.openssl.org/news/vulnerabilities.html#CVE-2018-5407
[CVE-2018-0739]: https://www.openssl.org/news/vulnerabilities.html#CVE-2018-0739
[CVE-2018-0737]: https://www.openssl.org/news/vulnerabilities.html#CVE-2018-0737
[CVE-2018-0735]: https://www.openssl.org/news/vulnerabilities.html#CVE-2018-0735
[CVE-2018-0734]: https://www.openssl.org/news/vulnerabilities.html#CVE-2018-0734
[CVE-2018-0733]: https://www.openssl.org/news/vulnerabilities.html#CVE-2018-0733
[CVE-2018-0732]: https://www.openssl.org/news/vulnerabilities.html#CVE-2018-0732
[CVE-2017-3738]: https://www.openssl.org/news/vulnerabilities.html#CVE-2017-3738
[CVE-2017-3737]: https://www.openssl.org/news/vulnerabilities.html#CVE-2017-3737
[CVE-2017-3736]: https://www.openssl.org/news/vulnerabilities.html#CVE-2017-3736
[CVE-2017-3735]: https://www.openssl.org/news/vulnerabilities.html#CVE-2017-3735
[CVE-2017-3733]: https://www.openssl.org/news/vulnerabilities.html#CVE-2017-3733
[CVE-2017-3732]: https://www.openssl.org/news/vulnerabilities.html#CVE-2017-3732
[CVE-2017-3731]: https://www.openssl.org/news/vulnerabilities.html#CVE-2017-3731
[CVE-2017-3730]: https://www.openssl.org/news/vulnerabilities.html#CVE-2017-3730
[CVE-2016-7055]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-7055
[CVE-2016-7054]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-7054
[CVE-2016-7053]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-7053
[CVE-2016-7052]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-7052
[CVE-2016-6309]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-6309
[CVE-2016-6308]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-6308
[CVE-2016-6307]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-6307
[CVE-2016-6306]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-6306
[CVE-2016-6305]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-6305
[CVE-2016-6304]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-6304
[CVE-2016-6303]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-6303
[CVE-2016-6302]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-6302
[CVE-2016-2183]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-2183
[CVE-2016-2182]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-2182
[CVE-2016-2181]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-2181
[CVE-2016-2180]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-2180
[CVE-2016-2179]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-2179
[CVE-2016-2178]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-2178
[CVE-2016-2177]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-2177
[CVE-2016-2176]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-2176
[CVE-2016-2109]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-2109
[CVE-2016-2107]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-2107
[CVE-2016-2106]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-2106
[CVE-2016-2105]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-2105
[CVE-2016-0800]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-0800
[CVE-2016-0799]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-0799
[CVE-2016-0798]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-0798
[CVE-2016-0797]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-0797
[CVE-2016-0705]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-0705
[CVE-2016-0702]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-0702
[CVE-2016-0701]: https://www.openssl.org/news/vulnerabilities.html#CVE-2016-0701
[CVE-2015-3197]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-3197
[CVE-2015-3196]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-3196
[CVE-2015-3195]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-3195
[CVE-2015-3194]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-3194
[CVE-2015-3193]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-3193
[CVE-2015-1793]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-1793
[CVE-2015-1792]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-1792
[CVE-2015-1791]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-1791
[CVE-2015-1790]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-1790
[CVE-2015-1789]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-1789
[CVE-2015-1788]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-1788
[CVE-2015-1787]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-1787
[CVE-2015-0293]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-0293
[CVE-2015-0291]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-0291
[CVE-2015-0290]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-0290
[CVE-2015-0289]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-0289
[CVE-2015-0288]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-0288
[CVE-2015-0287]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-0287
[CVE-2015-0286]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-0286
[CVE-2015-0285]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-0285
[CVE-2015-0209]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-0209
[CVE-2015-0208]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-0208
[CVE-2015-0207]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-0207
[CVE-2015-0206]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-0206
[CVE-2015-0205]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-0205
[CVE-2015-0204]: https://www.openssl.org/news/vulnerabilities.html#CVE-2015-0204
[CVE-2014-8275]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-8275
[CVE-2014-5139]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-5139
[CVE-2014-3572]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-3572
[CVE-2014-3571]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-3571
[CVE-2014-3570]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-3570
[CVE-2014-3569]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-3569
[CVE-2014-3568]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-3568
[CVE-2014-3567]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-3567
[CVE-2014-3566]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-3566
[CVE-2014-3513]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-3513
[CVE-2014-3512]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-3512
[CVE-2014-3511]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-3511
[CVE-2014-3510]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-3510
[CVE-2014-3509]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-3509
[CVE-2014-3508]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-3508
[CVE-2014-3507]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-3507
[CVE-2014-3506]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-3506
[CVE-2014-3505]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-3505
[CVE-2014-3470]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-3470
[CVE-2014-0224]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-0224
[CVE-2014-0221]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-0221
[CVE-2014-0198]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-0198
[CVE-2014-0195]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-0195
[CVE-2014-0160]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-0160
[CVE-2014-0076]: https://www.openssl.org/news/vulnerabilities.html#CVE-2014-0076
[CVE-2013-6450]: https://www.openssl.org/news/vulnerabilities.html#CVE-2013-6450
[CVE-2013-6449]: https://www.openssl.org/news/vulnerabilities.html#CVE-2013-6449
[CVE-2013-4353]: https://www.openssl.org/news/vulnerabilities.html#CVE-2013-4353
[CVE-2013-0169]: https://www.openssl.org/news/vulnerabilities.html#CVE-2013-0169
[CVE-2013-0166]: https://www.openssl.org/news/vulnerabilities.html#CVE-2013-0166
[CVE-2012-2686]: https://www.openssl.org/news/vulnerabilities.html#CVE-2012-2686
[CVE-2012-2333]: https://www.openssl.org/news/vulnerabilities.html#CVE-2012-2333
[CVE-2012-2110]: https://www.openssl.org/news/vulnerabilities.html#CVE-2012-2110
[CVE-2012-0884]: https://www.openssl.org/news/vulnerabilities.html#CVE-2012-0884
[CVE-2012-0050]: https://www.openssl.org/news/vulnerabilities.html#CVE-2012-0050
[CVE-2012-0027]: https://www.openssl.org/news/vulnerabilities.html#CVE-2012-0027
[CVE-2011-4619]: https://www.openssl.org/news/vulnerabilities.html#CVE-2011-4619
[CVE-2011-4577]: https://www.openssl.org/news/vulnerabilities.html#CVE-2011-4577
[CVE-2011-4576]: https://www.openssl.org/news/vulnerabilities.html#CVE-2011-4576
[CVE-2011-4108]: https://www.openssl.org/news/vulnerabilities.html#CVE-2011-4108
[CVE-2011-3210]: https://www.openssl.org/news/vulnerabilities.html#CVE-2011-3210
[CVE-2011-3207]: https://www.openssl.org/news/vulnerabilities.html#CVE-2011-3207
[CVE-2011-0014]: https://www.openssl.org/news/vulnerabilities.html#CVE-2011-0014
[CVE-2010-5298]: https://www.openssl.org/news/vulnerabilities.html#CVE-2010-5298
[CVE-2010-4252]: https://www.openssl.org/news/vulnerabilities.html#CVE-2010-4252
[CVE-2010-4180]: https://www.openssl.org/news/vulnerabilities.html#CVE-2010-4180
[CVE-2010-3864]: https://www.openssl.org/news/vulnerabilities.html#CVE-2010-3864
[CVE-2010-2939]: https://www.openssl.org/news/vulnerabilities.html#CVE-2010-2939
[CVE-2010-1633]: https://www.openssl.org/news/vulnerabilities.html#CVE-2010-1633
[CVE-2010-0740]: https://www.openssl.org/news/vulnerabilities.html#CVE-2010-0740
[CVE-2010-0433]: https://www.openssl.org/news/vulnerabilities.html#CVE-2010-0433
[CVE-2009-3555]: https://www.openssl.org/news/vulnerabilities.html#CVE-2009-3555
[CVE-2009-0789]: https://www.openssl.org/news/vulnerabilities.html#CVE-2009-0789
[CVE-2009-0591]: https://www.openssl.org/news/vulnerabilities.html#CVE-2009-0591
[CVE-2009-0590]: https://www.openssl.org/news/vulnerabilities.html#CVE-2009-0590
[CVE-2008-5077]: https://www.openssl.org/news/vulnerabilities.html#CVE-2008-5077
[CVE-2006-4343]: https://www.openssl.org/news/vulnerabilities.html#CVE-2006-4343
[CVE-2006-4339]: https://www.openssl.org/news/vulnerabilities.html#CVE-2006-4339
[CVE-2006-3737]: https://www.openssl.org/news/vulnerabilities.html#CVE-2006-3737
[CVE-2006-2940]: https://www.openssl.org/news/vulnerabilities.html#CVE-2006-2940
[CVE-2006-2937]: https://www.openssl.org/news/vulnerabilities.html#CVE-2006-2937
[CVE-2005-2969]: https://www.openssl.org/news/vulnerabilities.html#CVE-2005-2969
[OpenSSL Guide]: https://docs.openssl.org/master/man7/ossl-guide-introduction
[CHANGES.md]: ./CHANGES.md
[README-QUIC.md]: ./README-QUIC.md
[issue tracker]: https://github.com/openssl/openssl/issues
[CMVP]: https://csrc.nist.gov/projects/cryptographic-module-validation-program
[CVE-2005-2969]: https://openssl-library.org/news/vulnerabilities/#CVE-2005-2969
[CVE-2006-2937]: https://openssl-library.org/news/vulnerabilities/#CVE-2006-2937
[CVE-2006-2940]: https://openssl-library.org/news/vulnerabilities/#CVE-2006-2940
[CVE-2006-3737]: https://openssl-library.org/news/vulnerabilities/#CVE-2006-3737
[CVE-2006-4339]: https://openssl-library.org/news/vulnerabilities/#CVE-2006-4339
[CVE-2006-4343]: https://openssl-library.org/news/vulnerabilities/#CVE-2006-4343
[CVE-2008-5077]: https://openssl-library.org/news/vulnerabilities/#CVE-2008-5077
[CVE-2009-0590]: https://openssl-library.org/news/vulnerabilities/#CVE-2009-0590
[CVE-2009-0591]: https://openssl-library.org/news/vulnerabilities/#CVE-2009-0591
[CVE-2009-0789]: https://openssl-library.org/news/vulnerabilities/#CVE-2009-0789
[CVE-2009-3555]: https://openssl-library.org/news/vulnerabilities/#CVE-2009-3555
[CVE-2010-0433]: https://openssl-library.org/news/vulnerabilities/#CVE-2010-0433
[CVE-2010-0740]: https://openssl-library.org/news/vulnerabilities/#CVE-2010-0740
[CVE-2010-1633]: https://openssl-library.org/news/vulnerabilities/#CVE-2010-1633
[CVE-2010-2939]: https://openssl-library.org/news/vulnerabilities/#CVE-2010-2939
[CVE-2010-3864]: https://openssl-library.org/news/vulnerabilities/#CVE-2010-3864
[CVE-2010-4180]: https://openssl-library.org/news/vulnerabilities/#CVE-2010-4180
[CVE-2010-4252]: https://openssl-library.org/news/vulnerabilities/#CVE-2010-4252
[CVE-2010-5298]: https://openssl-library.org/news/vulnerabilities/#CVE-2010-5298
[CVE-2011-0014]: https://openssl-library.org/news/vulnerabilities/#CVE-2011-0014
[CVE-2011-3207]: https://openssl-library.org/news/vulnerabilities/#CVE-2011-3207
[CVE-2011-3210]: https://openssl-library.org/news/vulnerabilities/#CVE-2011-3210
[CVE-2011-4108]: https://openssl-library.org/news/vulnerabilities/#CVE-2011-4108
[CVE-2011-4576]: https://openssl-library.org/news/vulnerabilities/#CVE-2011-4576
[CVE-2011-4577]: https://openssl-library.org/news/vulnerabilities/#CVE-2011-4577
[CVE-2011-4619]: https://openssl-library.org/news/vulnerabilities/#CVE-2011-4619
[CVE-2012-0027]: https://openssl-library.org/news/vulnerabilities/#CVE-2012-0027
[CVE-2012-0050]: https://openssl-library.org/news/vulnerabilities/#CVE-2012-0050
[CVE-2012-0884]: https://openssl-library.org/news/vulnerabilities/#CVE-2012-0884
[CVE-2012-2110]: https://openssl-library.org/news/vulnerabilities/#CVE-2012-2110
[CVE-2012-2333]: https://openssl-library.org/news/vulnerabilities/#CVE-2012-2333
[CVE-2012-2686]: https://openssl-library.org/news/vulnerabilities/#CVE-2012-2686
[CVE-2013-0166]: https://openssl-library.org/news/vulnerabilities/#CVE-2013-0166
[CVE-2013-0169]: https://openssl-library.org/news/vulnerabilities/#CVE-2013-0169
[CVE-2013-4353]: https://openssl-library.org/news/vulnerabilities/#CVE-2013-4353
[CVE-2013-6449]: https://openssl-library.org/news/vulnerabilities/#CVE-2013-6449
[CVE-2013-6450]: https://openssl-library.org/news/vulnerabilities/#CVE-2013-6450
[CVE-2014-0076]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-0076
[CVE-2014-0160]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-0160
[CVE-2014-0195]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-0195
[CVE-2014-0198]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-0198
[CVE-2014-0221]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-0221
[CVE-2014-0224]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-0224
[CVE-2014-3470]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-3470
[CVE-2014-3505]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-3505
[CVE-2014-3506]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-3506
[CVE-2014-3507]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-3507
[CVE-2014-3508]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-3508
[CVE-2014-3509]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-3509
[CVE-2014-3510]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-3510
[CVE-2014-3511]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-3511
[CVE-2014-3512]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-3512
[CVE-2014-3513]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-3513
[CVE-2014-3566]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-3566
[CVE-2014-3567]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-3567
[CVE-2014-3568]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-3568
[CVE-2014-3569]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-3569
[CVE-2014-3570]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-3570
[CVE-2014-3571]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-3571
[CVE-2014-3572]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-3572
[CVE-2014-5139]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-5139
[CVE-2014-8275]: https://openssl-library.org/news/vulnerabilities/#CVE-2014-8275
[CVE-2015-0204]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-0204
[CVE-2015-0205]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-0205
[CVE-2015-0206]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-0206
[CVE-2015-0207]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-0207
[CVE-2015-0208]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-0208
[CVE-2015-0209]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-0209
[CVE-2015-0285]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-0285
[CVE-2015-0286]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-0286
[CVE-2015-0287]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-0287
[CVE-2015-0288]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-0288
[CVE-2015-0289]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-0289
[CVE-2015-0290]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-0290
[CVE-2015-0291]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-0291
[CVE-2015-0293]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-0293
[CVE-2015-1787]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-1787
[CVE-2015-1788]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-1788
[CVE-2015-1789]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-1789
[CVE-2015-1790]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-1790
[CVE-2015-1791]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-1791
[CVE-2015-1792]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-1792
[CVE-2015-1793]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-1793
[CVE-2015-3193]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-3193
[CVE-2015-3194]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-3194
[CVE-2015-3195]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-3195
[CVE-2015-3196]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-3196
[CVE-2015-3197]: https://openssl-library.org/news/vulnerabilities/#CVE-2015-3197
[CVE-2016-0701]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-0701
[CVE-2016-0702]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-0702
[CVE-2016-0705]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-0705
[CVE-2016-0797]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-0797
[CVE-2016-0798]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-0798
[CVE-2016-0799]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-0799
[CVE-2016-0800]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-0800
[CVE-2016-2105]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-2105
[CVE-2016-2106]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-2106
[CVE-2016-2107]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-2107
[CVE-2016-2109]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-2109
[CVE-2016-2176]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-2176
[CVE-2016-2177]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-2177
[CVE-2016-2178]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-2178
[CVE-2016-2179]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-2179
[CVE-2016-2180]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-2180
[CVE-2016-2181]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-2181
[CVE-2016-2182]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-2182
[CVE-2016-2183]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-2183
[CVE-2016-6302]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-6302
[CVE-2016-6303]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-6303
[CVE-2016-6304]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-6304
[CVE-2016-6305]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-6305
[CVE-2016-6306]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-6306
[CVE-2016-6307]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-6307
[CVE-2016-6308]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-6308
[CVE-2016-6309]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-6309
[CVE-2016-7052]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-7052
[CVE-2016-7053]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-7053
[CVE-2016-7054]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-7054
[CVE-2016-7055]: https://openssl-library.org/news/vulnerabilities/#CVE-2016-7055
[CVE-2017-3730]: https://openssl-library.org/news/vulnerabilities/#CVE-2017-3730
[CVE-2017-3731]: https://openssl-library.org/news/vulnerabilities/#CVE-2017-3731
[CVE-2017-3732]: https://openssl-library.org/news/vulnerabilities/#CVE-2017-3732
[CVE-2017-3733]: https://openssl-library.org/news/vulnerabilities/#CVE-2017-3733
[CVE-2017-3735]: https://openssl-library.org/news/vulnerabilities/#CVE-2017-3735
[CVE-2017-3736]: https://openssl-library.org/news/vulnerabilities/#CVE-2017-3736
[CVE-2017-3737]: https://openssl-library.org/news/vulnerabilities/#CVE-2017-3737
[CVE-2017-3738]: https://openssl-library.org/news/vulnerabilities/#CVE-2017-3738
[CVE-2018-0732]: https://openssl-library.org/news/vulnerabilities/#CVE-2018-0732
[CVE-2018-0733]: https://openssl-library.org/news/vulnerabilities/#CVE-2018-0733
[CVE-2018-0734]: https://openssl-library.org/news/vulnerabilities/#CVE-2018-0734
[CVE-2018-0735]: https://openssl-library.org/news/vulnerabilities/#CVE-2018-0735
[CVE-2018-0737]: https://openssl-library.org/news/vulnerabilities/#CVE-2018-0737
[CVE-2018-0739]: https://openssl-library.org/news/vulnerabilities/#CVE-2018-0739
[CVE-2018-5407]: https://openssl-library.org/news/vulnerabilities/#CVE-2018-5407
[CVE-2019-1543]: https://openssl-library.org/news/vulnerabilities/#CVE-2019-1543
[CVE-2019-1547]: https://openssl-library.org/news/vulnerabilities/#CVE-2019-1547
[CVE-2019-1549]: https://openssl-library.org/news/vulnerabilities/#CVE-2019-1549
[CVE-2019-1551]: https://openssl-library.org/news/vulnerabilities/#CVE-2019-1551
[CVE-2019-1552]: https://openssl-library.org/news/vulnerabilities/#CVE-2019-1552
[CVE-2019-1559]: https://openssl-library.org/news/vulnerabilities/#CVE-2019-1559
[CVE-2019-1563]: https://openssl-library.org/news/vulnerabilities/#CVE-2019-1563
[CVE-2020-1967]: https://openssl-library.org/news/vulnerabilities/#CVE-2020-1967
[CVE-2020-1971]: https://openssl-library.org/news/vulnerabilities/#CVE-2020-1971
[CVE-2022-2097]: https://openssl-library.org/news/vulnerabilities/#CVE-2022-2097
[CVE-2022-2274]: https://openssl-library.org/news/vulnerabilities/#CVE-2022-2274
[CVE-2022-3996]: https://openssl-library.org/news/vulnerabilities/#CVE-2022-3996
[CVE-2022-4203]: https://openssl-library.org/news/vulnerabilities/#CVE-2022-4203
[CVE-2022-4304]: https://openssl-library.org/news/vulnerabilities/#CVE-2022-4304
[CVE-2022-4450]: https://openssl-library.org/news/vulnerabilities/#CVE-2022-4450
[CVE-2023-0215]: https://openssl-library.org/news/vulnerabilities/#CVE-2023-0215
[CVE-2023-0216]: https://openssl-library.org/news/vulnerabilities/#CVE-2023-0216
[CVE-2023-0217]: https://openssl-library.org/news/vulnerabilities/#CVE-2023-0217
[CVE-2023-0286]: https://openssl-library.org/news/vulnerabilities/#CVE-2023-0286
[CVE-2023-0401]: https://openssl-library.org/news/vulnerabilities/#CVE-2023-0401
[CVE-2023-0464]: https://openssl-library.org/news/vulnerabilities/#CVE-2023-0464
[CVE-2023-0465]: https://openssl-library.org/news/vulnerabilities/#CVE-2023-0465
[CVE-2023-0466]: https://openssl-library.org/news/vulnerabilities/#CVE-2023-0466
[CVE-2023-1255]: https://openssl-library.org/news/vulnerabilities/#CVE-2023-1255
[CVE-2023-2650]: https://openssl-library.org/news/vulnerabilities/#CVE-2023-2650
[CVE-2023-2975]: https://openssl-library.org/news/vulnerabilities/#CVE-2023-2975
[CVE-2023-3446]: https://openssl-library.org/news/vulnerabilities/#CVE-2023-3446
[CVE-2023-3817]: https://openssl-library.org/news/vulnerabilities/#CVE-2023-3817
[CVE-2023-4807]: https://openssl-library.org/news/vulnerabilities/#CVE-2023-4807
[CVE-2023-5363]: https://openssl-library.org/news/vulnerabilities/#CVE-2023-5363
[CVE-2023-5678]: https://openssl-library.org/news/vulnerabilities/#CVE-2023-5678
[CVE-2023-6129]: https://openssl-library.org/news/vulnerabilities/#CVE-2023-6129
[CVE-2023-6237]: https://openssl-library.org/news/vulnerabilities/#CVE-2023-6237
[CVE-2024-0727]: https://openssl-library.org/news/vulnerabilities/#CVE-2024-0727
[CVE-2024-2511]: https://openssl-library.org/news/vulnerabilities/#CVE-2024-2511
[CVE-2024-4603]: https://openssl-library.org/news/vulnerabilities/#CVE-2024-4603
[CVE-2024-4741]: https://openssl-library.org/news/vulnerabilities/#CVE-2024-4741
[CVE-2024-5535]: https://openssl-library.org/news/vulnerabilities/#CVE-2024-5535
[CVE-2024-6119]: https://openssl-library.org/news/vulnerabilities/#CVE-2024-6119
[CVE-2024-9143]: https://openssl-library.org/news/vulnerabilities/#CVE-2024-9143
[CVE-2024-13176]: https://openssl-library.org/news/vulnerabilities/#CVE-2024-13176
[CVE-2025-4575]: https://openssl-library.org/news/vulnerabilities/#CVE-2025-4575
[CVE-2025-9230]: https://openssl-library.org/news/vulnerabilities/#CVE-2025-9230
[CVE-2025-9231]: https://openssl-library.org/news/vulnerabilities/#CVE-2025-9231
[CVE-2025-9232]: https://openssl-library.org/news/vulnerabilities/#CVE-2025-9232
[CVE-2025-11187]: https://openssl-library.org/news/vulnerabilities/#CVE-2025-11187
[CVE-2025-15467]: https://openssl-library.org/news/vulnerabilities/#CVE-2025-15467
[CVE-2025-15468]: https://openssl-library.org/news/vulnerabilities/#CVE-2025-15468
[CVE-2025-15469]: https://openssl-library.org/news/vulnerabilities/#CVE-2025-15469
[CVE-2025-66199]: https://openssl-library.org/news/vulnerabilities/#CVE-2025-66199
[CVE-2025-68160]: https://openssl-library.org/news/vulnerabilities/#CVE-2025-68160
[CVE-2025-69418]: https://openssl-library.org/news/vulnerabilities/#CVE-2025-69418
[CVE-2025-69419]: https://openssl-library.org/news/vulnerabilities/#CVE-2025-69419
[CVE-2025-69420]: https://openssl-library.org/news/vulnerabilities/#CVE-2025-69420
[CVE-2025-69421]: https://openssl-library.org/news/vulnerabilities/#CVE-2025-69421
[CVE-2026-2673]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-2673
[CVE-2026-7383]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-7383
[CVE-2026-9076]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-9076
[CVE-2026-22795]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-22795
[CVE-2026-22796]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-22796
[CVE-2026-28386]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-28386
[CVE-2026-28387]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-28387
[CVE-2026-28388]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-28388
[CVE-2026-28389]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-28389
[CVE-2026-28390]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-28390
[CVE-2026-31789]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-31789
[CVE-2026-31790]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-31790
[CVE-2026-34180]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-34180
[CVE-2026-34181]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-34181
[CVE-2026-34182]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-34182
[CVE-2026-34183]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-34183
[CVE-2026-35188]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-35188
[CVE-2026-42764]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-42764
[CVE-2026-42765]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-42765
[CVE-2026-42766]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-42766
[CVE-2026-42767]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-42767
[CVE-2026-42768]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-42768
[CVE-2026-42769]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-42769
[CVE-2026-42770]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-42770
[CVE-2026-42771]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-42771
[CVE-2026-45445]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-45445
[CVE-2026-45446]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-45446
[CVE-2026-45447]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-45447
[ESV]: https://csrc.nist.gov/Projects/cryptographic-module-validation-program/entropy-validations
[OpenSSL Guide]: https://docs.openssl.org/master/man7/ossl-guide-introduction
[README-QUIC.md]: ./README-QUIC.md
[RFC 7919]: https://datatracker.ietf.org/doc/html/rfc7919
[RFC 8422]: https://datatracker.ietf.org/doc/html/rfc8422
[RFC 8998]: https://datatracker.ietf.org/doc/html/rfc8998#name-iana-considerations
[RFC 9849]: https://datatracker.ietf.org/doc/html/rfc9849
[SP 800-185]: https://csrc.nist.gov/pubs/sp/800/185/final
[SP 800-208]: https://csrc.nist.gov/pubs/sp/800/208/final
[issue tracker]: https://github.com/openssl/openssl/issues
[jitterentropy-library]: https://github.com/smuellerDD/jitterentropy-library

View file

@ -32,4 +32,18 @@ The list of C-99 features we don't support in OpenSSL project follows:
{
char s[n]; /* variable size array */
...
}
```
Exit status macros (`EXIT_SUCCESS`, `EXIT_FAILURE`)
---------------------------------------------------
These macros from `<stdlib.h>` represent *process* exit status. Do not use
them as return values from internal APIs (any function that is not `main()`).
Use them only as the return value from `main()` or as the argument to
`exit(3)` (or equivalent, such as `_exit()`).
Elsewhere, be consistent with the rest of the codebase: return a positive
value for success (often `1`), and `0` or a non-positive value for failure,
or `bool` when that improves clarity. See
<https://github.com/openssl/openssl/issues/30562>.

View file

@ -55,26 +55,6 @@ option to `./Configure`.
TNS/E has moved to a limited support state, so fixes for this platform will not
be guaranteed in future.
Linking and Loading Considerations
----------------------------------
Because of how the NonStop Common Runtime Environment (CRE) works, there are
restrictions on how programs can link and load with OpenSSL libraries.
On current NonStop platforms, programs cannot both statically link OpenSSL
libraries and dynamically load OpenSSL shared libraries concurrently. If this
is done, there is a high probability of encountering a SIGSEGV condition
relating to `atexit()` processing when a shared library is unloaded and when
the program terminates. This limitation applies to all OpenSSL shared library
components.
A control has been added as of 3.3.x to disable calls to `atexit()` within the
`libcrypto` builds (specifically in `crypto/init.c`). This switch can be
controlled using `disable-atexit` or `enable-atexit`, and is disabled by default
for NonStop builds. If you need to have `atexit()` functionality, set
`enabled-atexit` when configuring OpenSSL to enable the `atexit()` call to
register `OPENSSL_cleanup()` automatically. Preferably, you can explicitly call
`OPENSSL_cleanup()` from your application.
Secure Memory
-------------
@ -187,7 +167,7 @@ the following variables. The following set of compiler defines are required:
### Optional Build Variables
DBGFLAG="--debug"
CIPHENABLES="enable-ssl3 enable-ssl3-method enable-weak-ssl-ciphers enable-rc4"
CIPHENABLES="enable-weak-ssl-ciphers enable-rc4"
### Internal Known TNS/X to TNS/E Cross Compile Variables

View file

@ -70,3 +70,76 @@ with the `VERBOSE` or `VF` or `VFP` options to gather additional information.
$ make test VERBOSE=1 TESTS=test_test EXE_SHELL="$(/bin/pwd)/util/wrap.pl \
valgrind --error-exitcode=1 --leak-check=full -q" OPENSSL_ia32cap=":0"
Still reachable memory
======================
OpenSSL 4.0 no longer arms `OPENSSL_cleanup()` function as an `atexit(3)`
handler. So, unless the application explicitly calls `OPENSSL_cleanup()`, valgrind and
similar memory leak detectors may report `still reachable` memory blocks
as memory leaks. An example of a valgrind report reads as follows:
# valgrind ./pkeyread -f pem -k dh 8
==280439== Memcheck, a memory error detector
==280439== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==280439== Using Valgrind-3.24.0 and LibVEX; rerun with -h for copyright info
==280439== Command: ./pkeyread -f pem -k dh 8
==280439==
Average time per pem(dh) call: 506329.113924us
==280439==
==280439== HEAP SUMMARY:
==280439== in use at exit: 239,521 bytes in 4,137 blocks
==280439== total heap usage: 21,841 allocs, 17,704 frees, 4,089,104 bytes allocated
==280439==
==280439== LEAK SUMMARY:
==280439== definitely lost: 0 bytes in 0 blocks
==280439== indirectly lost: 0 bytes in 0 blocks
==280439== possibly lost: 0 bytes in 0 blocks
==280439== still reachable: 239,521 bytes in 4,137 blocks
==280439== suppressed: 0 bytes in 0 blocks
==280439== Rerun with --leak-check=full to see details of leaked memory
==280439==
==280439== For lists of detected and suppressed errors, rerun with: -s
==280439== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
The valgrind output above reports there are 239,521 of reachable memory
when process exits. That memory is not regarded as a true memory leak
as the OS will reclaim that memory on process exit, rendering calls to libc
`free()` within `OPENSSL_cleanup()` useless. Also calling `OPENSSL_cleanup()`
is discouraged when libcrypto is being linked with process to satisfy more
than one dependency paths. If it is the case then calling `OPENSSL_cleanup()`
may lead to spurious application crashes during exit.
If memory leaks caused by _still reachable memory_ are still an issue,
then preferred way is to suppress those reports using the suppression
file [1] instead of changing exiting code by adding a call to `OPENSSL_cleanup()`.
The suppression file for OpenSSL is shipped within the OpenSSL sources and
can be found at`$OPENSSL_SRCS/util/valgrind.suppressions` where `OPENSSL_SRCS`
is an environment variable containing path to the OpenSSL source
tree. To use it, just add `--suppressions` option to the valgrind command:
`valgrind --suppressions="$OPENSSL_SRCS/util/valgrind.suppression" ...`
For `pkeyread` the command and output reads as follows:
# valgrind --suppressions=$OPENSSL_SRCS/util/valgrind.suppression ./pkeyread -f pem -k dh 8
==280896== Memcheck, a memory error detector
==280896== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==280896== Using Valgrind-3.24.0 and LibVEX; rerun with -h for copyright info
==280896== Command: ./pkeyread -f pem -k dh 8
==280896==
Average time per pem(dh) call: 476190.476190us
==280896==
==280896== HEAP SUMMARY:
==280896== in use at exit: 239,521 bytes in 4,137 blocks
==280896== total heap usage: 22,816 allocs, 18,679 frees, 4,325,714 bytes allocated
==280896==
==280896== LEAK SUMMARY:
==280896== definitely lost: 0 bytes in 0 blocks
==280896== indirectly lost: 0 bytes in 0 blocks
==280896== possibly lost: 0 bytes in 0 blocks
==280896== still reachable: 0 bytes in 0 blocks
==280896== suppressed: 239,521 bytes in 4,137 blocks
==280896==
==280896== For lists of detected and suppressed errors, rerun with: -s
==280896== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
[1] <https://valgrind.org/docs/manual/manual-core.html#manual-core.suppress>

View file

@ -7,6 +7,8 @@ Notes for Windows platforms
- [Native builds using MinGW](#native-builds-using-mingw)
- [Linking native applications](#linking-native-applications)
- [Hosted builds using Cygwin](#hosted-builds-using-cygwin)
- [Hosted builds using Windows Subsystem for Linux (WSL)](
#hosted-builds-using-windows-subsystem-for-linux-wsl)
There are various options to build and run OpenSSL on the Windows platforms.
@ -23,7 +25,7 @@ or
"Hosted" OpenSSL relies on an external POSIX compatibility layer
for building (using GNU/Unix shell, compiler, and tools) and at run time.
For this option, you can use Cygwin.
For this option, you can use Cygwin or the Windows Subsystem for Linux (WSL).
Native builds using Visual C++
==============================
@ -92,6 +94,13 @@ Quick start
dependency feature can speed up build times by up to 50%:
`perl Configure no-makedepend`
b. If you want the OpenSSL binaries to be "self contained", usable on any
computer running MS Windows, use 'perl Configure enable-static-vcruntime'.
Otherwise, build will produce binaries that depend on the VC runtime
libraries being installed and available, and will not work on computers
that do not have them. (This option adds 1 MB to the total size of the
two dll's.)
6. `nmake`
7. `nmake test`
@ -287,3 +296,71 @@ NOTE: `make test` and normal file operations may fail in directories
mounted as text (i.e. `mount -t c:\somewhere /home`) due to Cygwin
stripping of carriage returns. To avoid this, ensure that a binary
mount is used, e.g. `mount -b c:\somewhere /home`.
Hosted builds using Windows Subsystem for Linux (WSL)
======================================================
WSL provides a Linux-compatible environment directly on Windows, allowing
OpenSSL to be built using standard GNU/Unix tools. The resulting OpenSSL
runs within the WSL environment and relies on the WSL compatibility layer
at run time.
1. Install WSL and a Linux distribution (e.g. Ubuntu), see
<https://learn.microsoft.com/windows/wsl/install>
2. Ensure your distribution is up to date:
sudo apt update && sudo apt upgrade
3. Install the required build dependencies. On Debian/Ubuntu-based
distributions:
sudo apt install build-essential perl make
4. Optionally install the NASM assembler for optimised assembly routines:
sudo apt install nasm
5. Run the WSL shell (e.g. Ubuntu) from the Start menu or by running
`wsl` from a Windows command prompt
6. From the root of the OpenSSL source directory, configure the build:
./Configure
or specify a prefix and openssldir explicitly:
./Configure --prefix=/usr/local/ssl --openssldir=/usr/local/ssl
7. Build, test, and install:
make
make test
make install
Apart from the setup steps above, follow the Unix / Linux instructions
in INSTALL.md and the shared library path guidance in NOTES-UNIX.md.
NOTE: The OpenSSL source tree should reside on the Linux filesystem
(e.g. under `~/`) rather than on a mounted Windows path such as
`/mnt/c/`. Building from a mounted Windows path can result in
significantly slower build times and occasional failures due to
filesystem permission and interoperability differences between NTFS
and the Linux layer. If your source is on the Windows filesystem,
copy it into the WSL home directory first:
cp -r /mnt/c/path/to/openssl ~/openssl
NOTE: If you do build from a mounted Windows path (e.g. /mnt/c/), be aware
that Windows line endings (CRLF) in source or script files can cause
configure and build scripts to fail. In this case, run dos2unix on the
affected files before building:
dos2unix Configure # removes all \r (carriage return) characters
dos2unix config # does the same, but for the config script
dos2unix *.sh # runs dos2unix on all shell scripts in the directory,
# ensuring every .sh file has correct Unix line endings
dos2unix can be installed via:
sudo apt install dos2unix

View file

@ -109,19 +109,19 @@ which versions are FIPS validated. For this example we use OpenSSL 3.1.2.
Download and build the latest release of OpenSSL
------------------------------------------------
We use OpenSSL 3.5.0 here, (but you could also use the latest 3.5.X)
We use OpenSSL 3.6.0 here, (but you could also use the latest 3.6.X)
$ wget https://www.openssl.org/source/openssl-3.5.0.tar.gz
$ tar -xf openssl-3.5.0.tar.gz
$ cd openssl-3.5.0
$ wget https://www.openssl.org/source/openssl-3.6.0.tar.gz
$ tar -xf openssl-3.6.0.tar.gz
$ cd openssl-3.6.0
$ ./Configure enable-fips
$ make
Use the OpenSSL FIPS provider for testing
-----------------------------------------
We do this by replacing the artifact for the OpenSSL 3.5.0 FIPS provider.
Note that the OpenSSL 3.5.0 FIPS provider has not been validated
We do this by replacing the artifact for the OpenSSL 3.6.0 FIPS provider.
Note that the OpenSSL 3.6.0 FIPS provider has not been validated
so it must not be used for FIPS purposes.
$ cp ../openssl-3.1.2/providers/fips.so providers/.
@ -147,7 +147,7 @@ Copy the FIPS provider artifacts (`fips.so` & `fipsmodule.cnf`) to known locatio
Check that the correct FIPS provider is being used
--------------------------------------------------
$ cd ../openssl-3.5.0
$ cd ../openssl-3.6.0
$./util/wrap.pl -fips apps/openssl list -provider-path providers \
-provider fips -providers
@ -155,7 +155,7 @@ Check that the correct FIPS provider is being used
Providers:
base
name: OpenSSL Base Provider
version: 3.5.0
version: 3.6.0
status: active
fips
name: OpenSSL FIPS Provider

View file

@ -49,7 +49,7 @@ The OpenSSL toolkit includes:
basis of the TLS implementation, but can also be used independently.
- **openssl**
the OpenSSL command line tool, a swiss army knife for cryptographic tasks,
the OpenSSL command line tool, a Swiss Army knife for cryptographic tasks,
testing and analyzing. It can be used for
- creation of key parameters
- creation of X.509 certificates, CSRs and CRLs
@ -150,10 +150,10 @@ The manual pages for the master branch and all current stable releases are
available online.
- [OpenSSL master](https://docs.openssl.org/master/)
- [OpenSSL 4.0](https://docs.openssl.org/4.0/)
- [OpenSSL 3.6](https://docs.openssl.org/3.6/)
- [OpenSSL 3.5](https://docs.openssl.org/3.5/)
- [OpenSSL 3.4](https://docs.openssl.org/3.4/)
- [OpenSSL 3.3](https://docs.openssl.org/3.3/)
- [OpenSSL 3.2](https://docs.openssl.org/3.2/)
- [OpenSSL 3.0](https://docs.openssl.org/3.0/)
Demos
@ -198,7 +198,7 @@ attempting to develop or distribute cryptographic code.
Copyright
=========
Copyright (c) 1998-2025 The OpenSSL Project Authors
Copyright (c) 1998-2026 The OpenSSL Project Authors
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson

1133
STYLE.md Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
MAJOR=4
MINOR=0
MINOR=1
PATCH=0
PRE_RELEASE_TAG=dev
BUILD_METADATA=

View file

@ -10,7 +10,7 @@
use strict;
use warnings;
my @directory_vars = ( "dir", "certs", "crl_dir", "new_certs_dir" );
my @directory_vars = ( "dir", "certs", "new_certs_dir" );
my @file_vars = ( "database", "certificate", "serial", "crlnumber",
"crl", "private_key", "RANDFILE" );
while(<STDIN>) {

View file

@ -5,10 +5,3 @@ $ v := {- sprintf "%02d", split(/\./, $config{version}) -}
$
$ OPENSSL'v' :== $OSSL$EXE:OPENSSL'v'
$ OPENSSL :== $OSSL$EXE:OPENSSL'v'
$
$ IF F$TYPE(PERL) .EQS. "STRING"
$ THEN
$ C_REHASH :== 'PERL' OSSL$EXE:c_rehash.pl
$ ELSE
$ WRITE SYS$ERROR "NOTE: no perl => no C_REHASH"
$ ENDIF

View file

@ -1,5 +1,5 @@
/*
* Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -82,8 +82,9 @@ int asn1parse_main(int argc, char **argv)
const unsigned char *ctmpbuf;
int indent = 0, noout = 0, dump = 0, informat = FORMAT_PEM;
int offset = 0, ret = 1, i, j;
long num, tmplen;
unsigned char *tmpbuf;
long num;
size_t tmplen;
const unsigned char *tmpbuf;
unsigned int length = 0;
OPTION_CHOICE o;
const ASN1_ITEM *it = NULL;
@ -192,7 +193,7 @@ int asn1parse_main(int argc, char **argv)
goto end;
if (genconf == NULL && genstr == NULL && informat == FORMAT_PEM) {
if (PEM_read_bio(in, &name, &header, &str, &num) != 1) {
BIO_printf(bio_err, "Error reading PEM file\n");
BIO_puts(bio_err, "Error reading PEM file\n");
ERR_print_errors(bio_err);
goto end;
}
@ -241,12 +242,12 @@ int asn1parse_main(int argc, char **argv)
if (sk_OPENSSL_STRING_num(osk)) {
tmpbuf = str;
tmplen = num;
tmplen = (size_t)num;
for (i = 0; i < sk_OPENSSL_STRING_num(osk); i++) {
ASN1_TYPE *atmp;
int typ;
j = strtol(sk_OPENSSL_STRING_value(osk, i), NULL, 0);
if (j <= 0 || j >= tmplen) {
if (j <= 0 || (size_t)j >= tmplen) {
BIO_printf(bio_err, "'%s' is out of range\n",
sk_OPENSSL_STRING_value(osk, i));
continue;
@ -255,10 +256,10 @@ int asn1parse_main(int argc, char **argv)
tmplen -= j;
atmp = at;
ctmpbuf = tmpbuf;
at = d2i_ASN1_TYPE(NULL, &ctmpbuf, tmplen);
at = d2i_ASN1_TYPE(NULL, &ctmpbuf, (long)tmplen);
ASN1_TYPE_free(atmp);
if (!at) {
BIO_printf(bio_err, "Error parsing structure\n");
BIO_puts(bio_err, "Error parsing structure\n");
ERR_print_errors(bio_err);
goto end;
}
@ -271,15 +272,21 @@ int asn1parse_main(int argc, char **argv)
goto end;
}
/* hmm... this is a little evil but it works */
tmpbuf = at->value.asn1_string->data;
tmplen = at->value.asn1_string->length;
tmpbuf = ASN1_STRING_get0_data(at->value.asn1_string);
tmplen = ASN1_STRING_length_ex(at->value.asn1_string);
if (tmplen > INT_MAX) {
BIO_puts(bio_err, "ASN.1 string length exceeds INT_MAX\n");
ERR_print_errors(bio_err);
goto end;
}
}
str = tmpbuf;
num = tmplen;
/* XXX casts away const */
str = (unsigned char *)tmpbuf;
num = (int)tmplen;
}
if (offset < 0 || offset >= num) {
BIO_printf(bio_err, "Error: offset out of range\n");
BIO_puts(bio_err, "Error: offset out of range\n");
goto end;
}
@ -289,7 +296,7 @@ int asn1parse_main(int argc, char **argv)
length = (unsigned int)num;
if (derout != NULL) {
if (BIO_write(derout, str + offset, length) != (int)length) {
BIO_printf(bio_err, "Error writing output\n");
BIO_puts(bio_err, "Error writing output\n");
ERR_print_errors(bio_err);
goto end;
}

View file

@ -18,6 +18,7 @@ $OPENSSLSRC=\
pkcs8.c pkey.c pkeyparam.c pkeyutl.c prime.c rand.c req.c \
s_client.c s_server.c s_time.c sess_id.c skeyutl.c smime.c speed.c \
spkac.c verify.c version.c x509.c rehash.c storeutl.c \
ech.c \
list.c info.c fipsinstall.c pkcs12.c
IF[{- !$disabled{'ec'} -}]
$OPENSSLSRC=$OPENSSLSRC ec.c ecparam.c

351
apps/ca.c
View file

@ -1,5 +1,5 @@
/*
* Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -25,6 +25,8 @@
#include <openssl/ocsp.h>
#include <openssl/pem.h>
#include <crypto/asn1.h>
#ifndef W_OK
#ifdef OPENSSL_SYS_VMS
#include <unistd.h>
@ -70,7 +72,6 @@
#define ENV_POLICY "policy"
#define ENV_EXTENSIONS "x509_extensions"
#define ENV_CRLEXT "crl_extensions"
#define ENV_MSIE_HACK "msie_hack"
#define ENV_NAMEOPT "name_opt"
#define ENV_CERTOPT "cert_opt"
#define ENV_EXTCOPY "copy_extensions"
@ -141,7 +142,6 @@ static void write_new_certificate(BIO *bp, X509 *x, int output_der, int notext);
static CONF *extfile_conf = NULL;
static int preserve = 0;
static int msie_hack = 0;
typedef enum OPTION_choice {
OPT_COMMON,
@ -176,7 +176,6 @@ typedef enum OPTION_choice {
OPT_PRESERVEDN,
OPT_NOEMAILDN,
OPT_GENCRL,
OPT_MSIE_HACK,
OPT_CRL_LASTUPDATE,
OPT_CRL_NEXTUPDATE,
OPT_CRLDAYS,
@ -221,8 +220,6 @@ const OPTIONS ca_options[] = {
{ "dateopt", OPT_DATEOPT, 's', "Datetime format used for printing. (rfc_822/iso_8601). Default is rfc_822." },
{ "notext", OPT_NOTEXT, '-', "Do not print the generated certificate" },
{ "batch", OPT_BATCH, '-', "Don't ask questions" },
{ "msie_hack", OPT_MSIE_HACK, '-',
"msie modifications to handle all Universal Strings" },
{ "ss_cert", OPT_SS_CERT, '<', "File contains a self signed cert to sign" },
{ "spkac", OPT_SPKAC, '<',
"File contains DN and signed public key and challenge" },
@ -411,7 +408,7 @@ int ca_main(int argc, char **argv)
enddate = opt_arg();
break;
case OPT_DAYS:
days = atoi(opt_arg());
days = opt_int_arg();
break;
case OPT_MD:
dgst = opt_arg();
@ -480,9 +477,6 @@ int ca_main(int argc, char **argv)
case OPT_GENCRL:
gencrl = 1;
break;
case OPT_MSIE_HACK:
msie_hack = 1;
break;
case OPT_CRL_LASTUPDATE:
crl_lastupdate = opt_arg();
break;
@ -623,7 +617,7 @@ end_of_options:
if (passin == NULL) {
free_passin = 1;
if (!app_passwd(passinarg, NULL, &passin, NULL)) {
BIO_printf(bio_err, "Error getting password\n");
BIO_puts(bio_err, "Error getting password\n");
goto end;
}
}
@ -645,7 +639,7 @@ end_of_options:
goto end;
if (!X509_check_private_key(x509, pkey)) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"CA certificate and CA private key do not match\n");
goto end;
}
@ -656,9 +650,6 @@ end_of_options:
f = app_conf_try_string(conf, BASE_SECTION, ENV_PRESERVE);
if (f != NULL && (*f == 'y' || *f == 'Y'))
preserve = 1;
f = app_conf_try_string(conf, BASE_SECTION, ENV_MSIE_HACK);
if (f != NULL && (*f == 'y' || *f == 'Y'))
msie_hack = 1;
f = app_conf_try_string(conf, section, ENV_NAMEOPT);
if (f != NULL) {
@ -692,7 +683,7 @@ end_of_options:
outdir = NCONF_get_string(conf, section, ENV_NEW_CERTS_DIR);
if (outdir == NULL) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"there needs to be defined a directory for new certificate to be placed in\n");
goto end;
}
@ -765,7 +756,7 @@ end_of_options:
TXT_DB_write(bio_out, db->db);
BIO_printf(bio_err, "%d entries loaded from the database\n",
sk_OPENSSL_PSTRING_num(db->db->data));
BIO_printf(bio_err, "generating index\n");
BIO_puts(bio_err, "generating index\n");
}
if (index_index(db) <= 0)
@ -779,11 +770,11 @@ end_of_options:
i = do_updatedb(db, NULL);
if (i == -1) {
BIO_printf(bio_err, "Malloc failure\n");
BIO_puts(bio_err, "Malloc failure\n");
goto end;
} else if (i == 0) {
if (verbose)
BIO_printf(bio_err, "No entries found to mark expired\n");
BIO_puts(bio_err, "No entries found to mark expired\n");
} else {
if (!save_index(dbfile, "new", db))
goto end;
@ -880,11 +871,8 @@ end_of_options:
X509V3_CTX ctx;
X509V3_set_ctx_test(&ctx);
X509V3_set_nconf(&ctx, extfile_conf);
if (!X509V3_EXT_add_nconf(extfile_conf, &ctx, extensions, NULL)) {
BIO_printf(bio_err,
"Error checking certificate extensions from extfile section %s\n",
extensions);
if (!do_EXT_add_nconf(extfile_conf, extfile_conf, &ctx, NULL,
"Error checking certificate extensions from extfile section %s\n", extensions)) {
ret = 1;
goto end;
}
@ -900,11 +888,8 @@ end_of_options:
X509V3_CTX ctx;
X509V3_set_ctx_test(&ctx);
X509V3_set_nconf(&ctx, conf);
if (!X509V3_EXT_add_nconf(conf, &ctx, extensions, NULL)) {
BIO_printf(bio_err,
"Error checking certificate extension config section %s\n",
extensions);
if (!do_EXT_add_nconf(conf, conf, &ctx, NULL,
"Error checking certificate extension config section %s\n", extensions)) {
ret = 1;
goto end;
}
@ -920,27 +905,27 @@ end_of_options:
days = 0;
}
if (enddate == NULL && days == 0) {
BIO_printf(bio_err, "cannot lookup how many days to certify for\n");
BIO_puts(bio_err, "cannot lookup how many days to certify for\n");
goto end;
}
if (days != 0 && enddate != NULL)
BIO_printf(bio_err,
BIO_puts(bio_err,
"Warning: -enddate or -not_after option overriding -days option\n");
if (rand_ser) {
if ((serial = BN_new()) == NULL || !rand_serial(serial, NULL)) {
BIO_printf(bio_err, "error generating serial number\n");
BIO_puts(bio_err, "error generating serial number\n");
goto end;
}
} else {
serial = load_serial(serialfile, NULL, create_ser, NULL);
if (serial == NULL) {
BIO_printf(bio_err, "error while loading serial number\n");
BIO_puts(bio_err, "error while loading serial number\n");
goto end;
}
if (verbose) {
if (BN_is_zero(serial)) {
BIO_printf(bio_err, "next serial number is 00\n");
BIO_puts(bio_err, "next serial number is 00\n");
} else {
if ((f = BN_bn2hex(serial)) == NULL)
goto end;
@ -956,7 +941,7 @@ end_of_options:
}
if ((cert_sk = sk_X509_new_null()) == NULL) {
BIO_printf(bio_err, "Memory allocation failure\n");
BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
if (spkac_file != NULL) {
@ -970,11 +955,11 @@ end_of_options:
goto end;
if (j > 0) {
total_done++;
BIO_printf(bio_err, "\n");
BIO_puts(bio_err, "\n");
if (!BN_add_word(serial, 1))
goto end;
if (!sk_X509_push(cert_sk, x)) {
BIO_printf(bio_err, "Memory allocation failure\n");
BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
}
@ -991,11 +976,11 @@ end_of_options:
goto end;
if (j > 0) {
total_done++;
BIO_printf(bio_err, "\n");
BIO_puts(bio_err, "\n");
if (!BN_add_word(serial, 1))
goto end;
if (!sk_X509_push(cert_sk, x)) {
BIO_printf(bio_err, "Memory allocation failure\n");
BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
}
@ -1011,11 +996,11 @@ end_of_options:
goto end;
if (j > 0) {
total_done++;
BIO_printf(bio_err, "\n");
BIO_puts(bio_err, "\n");
if (!BN_add_word(serial, 1))
goto end;
if (!sk_X509_push(cert_sk, x)) {
BIO_printf(bio_err, "Memory allocation failure\n");
BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
}
@ -1032,13 +1017,13 @@ end_of_options:
goto end;
if (j > 0) {
total_done++;
BIO_printf(bio_err, "\n");
BIO_puts(bio_err, "\n");
if (!BN_add_word(serial, 1)) {
X509_free(x);
goto end;
}
if (!sk_X509_push(cert_sk, x)) {
BIO_printf(bio_err, "Memory allocation failure\n");
BIO_puts(bio_err, "Memory allocation failure\n");
X509_free(x);
goto end;
}
@ -1057,12 +1042,12 @@ end_of_options:
(void)BIO_flush(bio_err);
tmp[0] = '\0';
if (fgets(tmp, sizeof(tmp), stdin) == NULL) {
BIO_printf(bio_err, "CERTIFICATION CANCELED: I/O error\n");
BIO_puts(bio_err, "CERTIFICATION CANCELED: I/O error\n");
ret = 0;
goto end;
}
if (tmp[0] != 'y' && tmp[0] != 'Y') {
BIO_printf(bio_err, "CERTIFICATION CANCELED\n");
BIO_puts(bio_err, "CERTIFICATION CANCELED\n");
ret = 0;
goto end;
}
@ -1085,26 +1070,26 @@ end_of_options:
#endif
if (verbose)
BIO_printf(bio_err, "writing new certificates\n");
BIO_puts(bio_err, "writing new certificates\n");
for (i = 0; i < sk_X509_num(cert_sk); i++) {
BIO *Cout = NULL;
X509 *xi = sk_X509_value(cert_sk, i);
const ASN1_INTEGER *serialNumber = X509_get0_serialNumber(xi);
const unsigned char *psn = ASN1_STRING_get0_data(serialNumber);
const int snl = ASN1_STRING_length(serialNumber);
const int filen_len = 2 * (snl > 0 ? snl : 1) + sizeof(".pem");
const size_t snl = ASN1_STRING_length_ex(serialNumber);
const size_t filen_len = 2 * (snl > 0 ? snl : 1) + sizeof(".pem");
char *n = new_cert + outdirlen;
if (outdirlen + filen_len > PATH_MAX) {
BIO_printf(bio_err, "certificate file name too long\n");
BIO_puts(bio_err, "certificate file name too long\n");
goto end;
}
if (snl > 0) {
static const char HEX_DIGITS[] = "0123456789ABCDEF";
for (j = 0; j < snl; j++, psn++) {
for (j = 0; (size_t)j < snl; j++, psn++) {
*n++ = HEX_DIGITS[*psn >> 4];
*n++ = HEX_DIGITS[*psn & 0x0F];
}
@ -1146,7 +1131,7 @@ end_of_options:
if (!rotate_index(dbfile, "new", "old"))
goto end;
BIO_printf(bio_err, "Database updated\n");
BIO_puts(bio_err, "Database updated\n");
}
}
@ -1161,10 +1146,8 @@ end_of_options:
X509V3_CTX ctx;
X509V3_set_ctx_test(&ctx);
X509V3_set_nconf(&ctx, conf);
if (!X509V3_EXT_add_nconf(conf, &ctx, crl_ext, NULL)) {
BIO_printf(bio_err,
"Error checking CRL extension section %s\n", crl_ext);
if (!do_EXT_add_nconf(conf, conf, &ctx, NULL,
"Error checking CRL extension section %s\n", crl_ext)) {
ret = 1;
goto end;
}
@ -1174,7 +1157,7 @@ end_of_options:
if (crlnumberfile != NULL) {
if ((crlnumber = load_serial(crlnumberfile, NULL, 0, NULL))
== NULL) {
BIO_printf(bio_err, "error while loading CRL number\n");
BIO_puts(bio_err, "error while loading CRL number\n");
goto end;
}
}
@ -1188,13 +1171,13 @@ end_of_options:
crlhours = 0;
}
if ((crl_nextupdate == NULL) && (crldays == 0) && (crlhours == 0) && (crlsec == 0)) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"cannot lookup how long until the next CRL is issued\n");
goto end;
}
if (verbose)
BIO_printf(bio_err, "making CRL\n");
BIO_puts(bio_err, "making CRL\n");
if ((crl = X509_CRL_new_ex(app_get0_libctx(), app_get0_propq())) == NULL)
goto end;
if (!X509_CRL_set_issuer_name(crl, X509_get_subject_name(x509)))
@ -1243,7 +1226,7 @@ end_of_options:
/* we now have a CRL */
if (verbose)
BIO_printf(bio_err, "signing CRL\n");
BIO_puts(bio_err, "signing CRL\n");
/* Add any extensions asked for */
@ -1253,12 +1236,11 @@ end_of_options:
X509V3_set_ctx(&crlctx, x509, NULL, NULL, crl, 0);
X509V3_set_nconf(&crlctx, conf);
if (crl_ext != NULL)
if (!X509V3_EXT_CRL_add_nconf(conf, &crlctx, crl_ext, crl)) {
BIO_printf(bio_err,
"Error adding CRL extensions from section %s\n", crl_ext);
goto end;
}
if (crl_ext != NULL && !X509V3_EXT_CRL_add_nconf(conf, &crlctx, crl_ext, crl)) {
BIO_printf(bio_err,
"Error adding CRL extensions from section %s\n", crl_ext);
goto end;
}
if (crlnumberfile != NULL) {
tmpser = BN_to_ASN1_INTEGER(crlnumber, NULL);
if (!tmpser)
@ -1301,7 +1283,7 @@ end_of_options:
/*****************************************************************/
if (dorevoke) {
if (infile == NULL) {
BIO_printf(bio_err, "no input files\n");
BIO_puts(bio_err, "no input files\n");
goto end;
} else {
X509 *revcert;
@ -1323,7 +1305,7 @@ end_of_options:
if (!rotate_index(dbfile, "new", "old"))
goto end;
BIO_printf(bio_err, "Database updated\n");
BIO_puts(bio_err, "Database updated\n");
}
}
ret = 0;
@ -1381,31 +1363,31 @@ static int certify(X509 **xret, const char *infile, int informat,
if (req == NULL)
goto end;
if ((pktmp = X509_REQ_get0_pubkey(req)) == NULL) {
BIO_printf(bio_err, "Error unpacking public key\n");
BIO_puts(bio_err, "Error unpacking public key\n");
goto end;
}
if (verbose)
X509_REQ_print_ex(bio_err, req, nameopt, X509_FLAG_COMPAT);
BIO_printf(bio_err, "Check that the request matches the signature\n");
BIO_puts(bio_err, "Check that the request matches the signature\n");
ok = 0;
if (selfsign && !X509_REQ_check_private_key(req, pkey)) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"Certificate request and CA private key do not match\n");
goto end;
}
i = do_X509_REQ_verify(req, pktmp, vfyopts);
if (i < 0) {
BIO_printf(bio_err, "Signature verification problems...\n");
BIO_puts(bio_err, "Signature verification problems...\n");
goto end;
}
if (i == 0) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"Signature did not match the certificate request\n");
goto end;
}
BIO_printf(bio_err, "Signature ok\n");
BIO_puts(bio_err, "Signature ok\n");
ok = do_body(xret, pkey, x509, dgst, sigopts, policy, db, serial, subj,
chtype, multirdn, email_dn, startdate, enddate, days, batch,
@ -1442,24 +1424,24 @@ static int certify_cert(X509 **xret, const char *infile, int certformat,
if (verbose)
X509_print(bio_err, template_cert);
BIO_printf(bio_err, "Check that the request matches the signature\n");
BIO_puts(bio_err, "Check that the request matches the signature\n");
if ((pktmp = X509_get0_pubkey(template_cert)) == NULL) {
BIO_printf(bio_err, "error unpacking public key\n");
BIO_puts(bio_err, "error unpacking public key\n");
goto end;
}
i = do_X509_verify(template_cert, pktmp, vfyopts);
if (i < 0) {
ok = 0;
BIO_printf(bio_err, "Signature verification problems....\n");
BIO_puts(bio_err, "Signature verification problems....\n");
goto end;
}
if (i == 0) {
ok = 0;
BIO_printf(bio_err, "Signature did not match the certificate\n");
BIO_puts(bio_err, "Signature did not match the certificate\n");
goto end;
} else {
BIO_printf(bio_err, "Signature ok\n");
BIO_puts(bio_err, "Signature ok\n");
}
if ((rreq = X509_to_X509_REQ(template_cert, NULL, NULL)) == NULL)
@ -1488,10 +1470,10 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
const X509_NAME *name = NULL;
X509_NAME *CAname = NULL, *subject = NULL;
const ASN1_TIME *tm;
ASN1_STRING *str, *str2;
ASN1_OBJECT *obj;
const ASN1_STRING *str, *str2;
const ASN1_OBJECT *obj;
X509 *ret = NULL;
X509_NAME_ENTRY *ne, *tne;
const X509_NAME_ENTRY *ne, *tne;
EVP_PKEY *pktmp;
int ok = -1, i, j, last, nid;
const char *p;
@ -1507,52 +1489,49 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
if (subj) {
X509_NAME *n = parse_name(subj, chtype, multirdn, "subject");
int ok_local;
if (!n)
goto end;
X509_REQ_set_subject_name(req, n);
ok_local = X509_REQ_set_subject_name(req, n);
X509_NAME_free(n);
if (ok_local == 0)
goto end;
}
if (default_op)
BIO_printf(bio_err, "The Subject's Distinguished Name is as follows\n");
BIO_puts(bio_err, "The Subject's Distinguished Name is as follows\n");
name = X509_REQ_get_subject_name(req);
for (i = 0; i < X509_NAME_entry_count(name); i++) {
int type;
ne = X509_NAME_get_entry(name, i);
str = X509_NAME_ENTRY_get_data(ne);
obj = X509_NAME_ENTRY_get_object(ne);
nid = OBJ_obj2nid(obj);
if (msie_hack) {
/* assume all type should be strings */
if (str->type == V_ASN1_UNIVERSALSTRING)
ASN1_UNIVERSALSTRING_to_string(str);
if (str->type == V_ASN1_IA5STRING && nid != NID_pkcs9_emailAddress)
str->type = V_ASN1_T61STRING;
if (nid == NID_pkcs9_emailAddress
&& str->type == V_ASN1_PRINTABLESTRING)
str->type = V_ASN1_IA5STRING;
}
type = ASN1_STRING_type(str);
/* If no EMAIL is wanted in the subject */
if (nid == NID_pkcs9_emailAddress && !email_dn)
continue;
/* check some things */
if (nid == NID_pkcs9_emailAddress && str->type != V_ASN1_IA5STRING) {
BIO_printf(bio_err,
if (nid == NID_pkcs9_emailAddress && type != V_ASN1_IA5STRING) {
BIO_puts(bio_err,
"\nemailAddress type needs to be of type IA5STRING\n");
goto end;
}
if (str->type != V_ASN1_BMPSTRING && str->type != V_ASN1_UTF8STRING) {
j = ASN1_PRINTABLE_type(str->data, str->length);
if ((j == V_ASN1_T61STRING && str->type != V_ASN1_T61STRING) || (j == V_ASN1_IA5STRING && str->type == V_ASN1_PRINTABLESTRING)) {
BIO_printf(bio_err,
"\nThe string contains characters that are illegal for the ASN.1 type\n");
if (type != V_ASN1_BMPSTRING && type != V_ASN1_UTF8STRING) {
size_t tmp = ASN1_STRING_length_ex(str);
if (tmp > INT_MAX)
goto end;
j = ASN1_PRINTABLE_type(ASN1_STRING_get0_data(str), (int)tmp);
if ((j == V_ASN1_T61STRING && type != V_ASN1_T61STRING)
|| (j == V_ASN1_IA5STRING && type == V_ASN1_PRINTABLESTRING)) {
BIO_puts(bio_err,
"\nThe string contains characters that are illegal for the"
" ASN.1 type\n");
goto end;
}
}
@ -1563,7 +1542,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
/* Ok, now we check the 'policy' stuff. */
if ((subject = X509_NAME_new()) == NULL) {
BIO_printf(bio_err, "Memory allocation failure\n");
BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
@ -1588,7 +1567,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
last = -1;
for (;;) {
X509_NAME_ENTRY *push = NULL;
const X509_NAME_ENTRY *push = NULL;
/* lookup the object in the supplied name list */
j = X509_NAME_get_index_by_OBJ(name, obj, last);
@ -1648,8 +1627,8 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
"The %s field is different between\n"
"CA certificate (%s) and the request (%s)\n",
cv->name,
((str2 == NULL) ? "NULL" : (char *)str2->data),
((str == NULL) ? "NULL" : (char *)str->data));
((str2 == NULL) ? "NULL" : (char *)ASN1_STRING_get0_data(str2)),
((str == NULL) ? "NULL" : (char *)ASN1_STRING_get0_data(str)));
goto end;
}
} else {
@ -1661,7 +1640,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
if (push != NULL) {
if (!X509_NAME_add_entry(subject, push, -1, 0)) {
BIO_printf(bio_err, "Memory allocation failure\n");
BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
}
@ -1680,7 +1659,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
/* We are now totally happy, lets make and sign the certificate */
if (verbose)
BIO_printf(bio_err,
BIO_puts(bio_err,
"Everything appears to be ok, creating and signing the certificate\n");
if ((ret = X509_new_ex(app_get0_libctx(), app_get0_propq())) == NULL)
@ -1724,7 +1703,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
if (!X509V3_set_issuer_pkey(&ext_ctx, pkey))
goto end;
if (!cert_matches_key(ret, pkey))
BIO_printf(bio_err,
BIO_puts(bio_err,
"Warning: Signature key and public key of cert do not match\n");
}
@ -1732,34 +1711,24 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
if (ext_sect) {
if (extfile_conf != NULL) {
if (verbose)
BIO_printf(bio_err, "Extra configuration file found\n");
BIO_puts(bio_err, "Extra configuration file found\n");
/* Use the extfile_conf configuration db LHASH */
X509V3_set_nconf(&ext_ctx, extfile_conf);
/* Adds exts contained in the configuration file */
if (!X509V3_EXT_add_nconf(extfile_conf, &ext_ctx, ext_sect, ret)) {
BIO_printf(bio_err,
"Error adding certificate extensions from extfile section %s\n",
ext_sect);
if (!do_EXT_add_nconf(extfile_conf, extfile_conf, &ext_ctx, ret,
"Error adding certificate extensions from extfile section %s\n", ext_sect))
goto end;
}
if (verbose)
BIO_printf(bio_err,
BIO_puts(bio_err,
"Successfully added extensions from file.\n");
} else if (ext_sect) {
/* We found extensions to be set from config file */
X509V3_set_nconf(&ext_ctx, lconf);
if (!X509V3_EXT_add_nconf(lconf, &ext_ctx, ext_sect, ret)) {
BIO_printf(bio_err,
"Error adding certificate extensions from config section %s\n",
ext_sect);
if (!do_EXT_add_nconf(lconf, lconf, &ext_ctx, ret,
"Error adding certificate extensions from config section %s\n", ext_sect))
goto end;
}
if (verbose)
BIO_printf(bio_err,
BIO_puts(bio_err,
"Successfully added extensions from config\n");
}
}
@ -1767,12 +1736,12 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
/* Copy extensions from request (if any) */
if (!copy_extensions(ret, req, ext_copy)) {
BIO_printf(bio_err, "ERROR: adding extensions from request\n");
BIO_puts(bio_err, "ERROR: adding extensions from request\n");
goto end;
}
if (verbose)
BIO_printf(bio_err,
BIO_puts(bio_err,
"The subject name appears to be ok, checking database for clashes\n");
/* Build the correct Subject if no e-mail is wanted in the subject. */
@ -1785,7 +1754,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
* because this retains its structure.
*/
if ((dn_subject = X509_NAME_dup(subject)) == NULL) {
BIO_printf(bio_err, "Memory allocation failure\n");
BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
i = -1;
@ -1806,7 +1775,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
row[DB_name] = X509_NAME_oneline(X509_get_subject_name(ret), NULL, 0);
if (row[DB_name] == NULL) {
BIO_printf(bio_err, "Memory allocation failure\n");
BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
@ -1815,7 +1784,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
else
row[DB_serial] = BN_bn2hex(serial);
if (row[DB_serial] == NULL) {
BIO_printf(bio_err, "Memory allocation failure\n");
BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
@ -1828,7 +1797,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
OPENSSL_free(row[DB_name]);
row[DB_name] = OPENSSL_strdup(row[DB_serial]);
if (row[DB_name] == NULL) {
BIO_printf(bio_err, "Memory allocation failure\n");
BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
}
@ -1849,13 +1818,13 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
BIO_printf(bio_err,
"ERROR:Serial number %s has already been issued,\n",
row[DB_serial]);
BIO_printf(bio_err,
BIO_puts(bio_err,
" check the database/serial_file for corruption\n");
}
}
if (rrow != NULL) {
BIO_printf(bio_err, "The matching entry has the following details\n");
BIO_puts(bio_err, "The matching entry has the following details\n");
if (rrow[DB_type][0] == DB_TYPE_EXP)
p = "Expired";
else if (rrow[DB_type][0] == DB_TYPE_REV)
@ -1892,7 +1861,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
}
if (!default_op) {
BIO_printf(bio_err, "Certificate Details:\n");
BIO_puts(bio_err, "Certificate Details:\n");
/*
* Never print signature details because signature not present
*/
@ -1900,25 +1869,25 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
X509_print_ex(bio_err, ret, nameopt, certopt);
}
BIO_printf(bio_err, "Certificate is to be certified until ");
BIO_puts(bio_err, "Certificate is to be certified until ");
ASN1_TIME_print_ex(bio_err, X509_get0_notAfter(ret), dateopt);
if (days)
BIO_printf(bio_err, " (%ld days)", days);
BIO_printf(bio_err, "\n");
BIO_puts(bio_err, "\n");
if (!batch) {
BIO_printf(bio_err, "Sign the certificate? [y/n]:");
BIO_puts(bio_err, "Sign the certificate? [y/n]:");
(void)BIO_flush(bio_err);
buf[0] = '\0';
if (fgets(buf, sizeof(buf), stdin) == NULL) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"CERTIFICATE WILL NOT BE CERTIFIED: I/O error\n");
ok = 0;
goto end;
}
if (!(buf[0] == 'y' || buf[0] == 'Y')) {
BIO_printf(bio_err, "CERTIFICATE WILL NOT BE CERTIFIED\n");
BIO_puts(bio_err, "CERTIFICATE WILL NOT BE CERTIFIED\n");
ok = 0;
goto end;
}
@ -1934,14 +1903,14 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
/* We now just add it to the database as DB_TYPE_VAL('V') */
row[DB_type] = OPENSSL_strdup("V");
tm = X509_get0_notAfter(ret);
row[DB_exp_date] = app_malloc(tm->length + 1, "row expdate");
memcpy(row[DB_exp_date], tm->data, tm->length);
row[DB_exp_date][tm->length] = '\0';
row[DB_exp_date] = app_malloc(ASN1_STRING_length_ex(tm) + 1, "row expdate");
memcpy(row[DB_exp_date], ASN1_STRING_get0_data(tm), ASN1_STRING_length_ex(tm));
row[DB_exp_date][ASN1_STRING_length_ex(tm)] = '\0';
row[DB_rev_date] = NULL;
row[DB_file] = OPENSSL_strdup("unknown");
if ((row[DB_type] == NULL) || (row[DB_file] == NULL)
|| (row[DB_name] == NULL)) {
BIO_printf(bio_err, "Memory allocation failure\n");
BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
@ -1951,8 +1920,9 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
irow[DB_NUMBER] = NULL;
if (!TXT_DB_insert(db->db, irow)) {
BIO_printf(bio_err, "failed to update database\n");
BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error);
BIO_printf(bio_err, "failed to update database\n"
"TXT_DB error number %ld\n",
db->db->error);
goto end;
}
irow = NULL;
@ -2039,7 +2009,9 @@ static int certify_spkac(X509 **xret, const char *infile, EVP_PKEY *pkey,
/*
* Build up the subject name set.
*/
n = X509_REQ_get_subject_name(req);
n = X509_NAME_new();
if (n == NULL)
goto end;
for (i = 0;; i++) {
if (sk_CONF_VALUE_num(sk) <= i)
@ -2063,7 +2035,7 @@ static int certify_spkac(X509 **xret, const char *infile, EVP_PKEY *pkey,
if (strcmp(type, "SPKAC") == 0) {
spki = NETSCAPE_SPKI_b64_decode(cv->value, -1);
if (spki == NULL) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"unable to load Netscape SPKAC structure\n");
goto end;
}
@ -2081,25 +2053,28 @@ static int certify_spkac(X509 **xret, const char *infile, EVP_PKEY *pkey,
goto end;
}
if (!X509_REQ_set_subject_name(req, n))
goto end;
/*
* Now extract the key from the SPKI structure.
*/
BIO_printf(bio_err, "Check that the SPKAC request matches the signature\n");
BIO_puts(bio_err, "Check that the SPKAC request matches the signature\n");
if ((pktmp = NETSCAPE_SPKI_get_pubkey(spki)) == NULL) {
BIO_printf(bio_err, "error unpacking SPKAC public key\n");
BIO_puts(bio_err, "error unpacking SPKAC public key\n");
goto end;
}
j = NETSCAPE_SPKI_verify(spki, pktmp);
if (j <= 0) {
EVP_PKEY_free(pktmp);
BIO_printf(bio_err,
BIO_puts(bio_err,
"signature verification failed on SPKAC public key\n");
goto end;
}
BIO_printf(bio_err, "Signature ok\n");
BIO_puts(bio_err, "Signature ok\n");
X509_REQ_set_pubkey(req, pktmp);
EVP_PKEY_free(pktmp);
@ -2109,6 +2084,7 @@ static int certify_spkac(X509 **xret, const char *infile, EVP_PKEY *pkey,
ext_copy, 0, dateopt);
end:
X509_REQ_free(req);
X509_NAME_free(n);
CONF_free(parms);
NETSCAPE_SPKI_free(spki);
X509_NAME_ENTRY_free(ne);
@ -2147,7 +2123,7 @@ static int do_revoke(X509 *x509, CA_DB *db, REVINFO_TYPE rev_type,
row[DB_name] = OPENSSL_strdup(row[DB_serial]);
}
if ((row[DB_name] == NULL) || (row[DB_serial] == NULL)) {
BIO_printf(bio_err, "Memory allocation failure\n");
BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
/*
@ -2163,14 +2139,14 @@ static int do_revoke(X509 *x509, CA_DB *db, REVINFO_TYPE rev_type,
/* We now just add it to the database as DB_TYPE_REV('V') */
row[DB_type] = OPENSSL_strdup("V");
tm = X509_get0_notAfter(x509);
row[DB_exp_date] = app_malloc(tm->length + 1, "row exp_data");
memcpy(row[DB_exp_date], tm->data, tm->length);
row[DB_exp_date][tm->length] = '\0';
row[DB_exp_date] = app_malloc(ASN1_STRING_length_ex(tm) + 1, "row exp_data");
memcpy(row[DB_exp_date], ASN1_STRING_get0_data(tm), ASN1_STRING_length_ex(tm));
row[DB_exp_date][ASN1_STRING_length_ex(tm)] = '\0';
row[DB_rev_date] = NULL;
row[DB_file] = OPENSSL_strdup("unknown");
if (row[DB_type] == NULL || row[DB_file] == NULL) {
BIO_printf(bio_err, "Memory allocation failure\n");
BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
@ -2180,8 +2156,9 @@ static int do_revoke(X509 *x509, CA_DB *db, REVINFO_TYPE rev_type,
irow[DB_NUMBER] = NULL;
if (!TXT_DB_insert(db->db, irow)) {
BIO_printf(bio_err, "failed to update database\n");
BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error);
BIO_printf(bio_err, "failed to update database\n"
"TXT_DB error number %ld\n",
db->db->error);
OPENSSL_free(irow);
goto end;
}
@ -2213,7 +2190,7 @@ static int do_revoke(X509 *x509, CA_DB *db, REVINFO_TYPE rev_type,
BIO_printf(bio_err, "Revoking Certificate %s.\n", rrow[DB_serial]);
rev_str = make_revocation_str(rev_type, value);
if (!rev_str) {
BIO_printf(bio_err, "Error in revocation arguments\n");
BIO_puts(bio_err, "Error in revocation arguments\n");
goto end;
}
rrow[DB_type][0] = DB_TYPE_REV;
@ -2294,7 +2271,7 @@ end:
return ok;
}
int do_updatedb(CA_DB *db, time_t *now)
int do_updatedb(CA_DB *db, const time_t *now)
{
ASN1_TIME *a_tm = NULL;
int i, cnt = 0;
@ -2375,7 +2352,7 @@ static char *make_revocation_str(REVINFO_TYPE rev_type, const char *rev_arg)
const char *reason = NULL, *other = NULL;
ASN1_OBJECT *otmp;
ASN1_UTCTIME *revtm = NULL;
int i;
size_t i;
switch (rev_type) {
case REV_NONE:
@ -2432,15 +2409,15 @@ static char *make_revocation_str(REVINFO_TYPE rev_type, const char *rev_arg)
if (!revtm)
return NULL;
i = revtm->length + 1;
i = ASN1_STRING_length_ex(revtm) + 1;
if (reason)
i += (int)(strlen(reason) + 1);
i += strlen(reason) + 1;
if (other)
i += (int)(strlen(other) + 1);
i += strlen(other) + 1;
str = app_malloc(i, "revocation reason");
OPENSSL_strlcpy(str, (char *)revtm->data, i);
OPENSSL_strlcpy(str, (const char *)ASN1_STRING_get0_data(revtm), i);
if (reason) {
OPENSSL_strlcat(str, ",", i);
OPENSSL_strlcat(str, reason, i);
@ -2517,7 +2494,7 @@ static int old_entry_print(const ASN1_OBJECT *obj, const ASN1_STRING *str)
{
char buf[25], *pbuf;
const char *p;
int j;
size_t j;
j = i2a_ASN1_OBJECT(bio_err, obj);
pbuf = buf;
@ -2527,30 +2504,30 @@ static int old_entry_print(const ASN1_OBJECT *obj, const ASN1_STRING *str)
*(pbuf++) = '\0';
BIO_puts(bio_err, buf);
if (str->type == V_ASN1_PRINTABLESTRING)
BIO_printf(bio_err, "PRINTABLE:'");
else if (str->type == V_ASN1_T61STRING)
BIO_printf(bio_err, "T61STRING:'");
else if (str->type == V_ASN1_IA5STRING)
BIO_printf(bio_err, "IA5STRING:'");
else if (str->type == V_ASN1_UNIVERSALSTRING)
BIO_printf(bio_err, "UNIVERSALSTRING:'");
if (ASN1_STRING_type(str) == V_ASN1_PRINTABLESTRING)
BIO_puts(bio_err, "PRINTABLE:'");
else if (ASN1_STRING_type(str) == V_ASN1_T61STRING)
BIO_puts(bio_err, "T61STRING:'");
else if (ASN1_STRING_type(str) == V_ASN1_IA5STRING)
BIO_puts(bio_err, "IA5STRING:'");
else if (ASN1_STRING_type(str) == V_ASN1_UNIVERSALSTRING)
BIO_puts(bio_err, "UNIVERSALSTRING:'");
else
BIO_printf(bio_err, "ASN.1 %2d:'", str->type);
BIO_printf(bio_err, "ASN.1 %2d:'", ASN1_STRING_type(str));
p = (const char *)str->data;
for (j = str->length; j > 0; j--) {
p = (const char *)ASN1_STRING_get0_data(str);
for (j = ASN1_STRING_length_ex(str); j > 0; j--) {
if ((*p >= ' ') && (*p <= '~'))
BIO_printf(bio_err, "%c", *p);
else if (*p & 0x80)
BIO_printf(bio_err, "\\0x%02X", *p);
else if ((unsigned char)*p == 0xf7)
BIO_printf(bio_err, "^?");
BIO_puts(bio_err, "^?");
else
BIO_printf(bio_err, "^%c", *p + '@');
p++;
}
BIO_printf(bio_err, "'\n");
BIO_puts(bio_err, "'\n");
return 1;
}
@ -2567,7 +2544,7 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
tmp = OPENSSL_strdup(str);
if (!tmp) {
BIO_printf(bio_err, "memory allocation failure\n");
BIO_puts(bio_err, "memory allocation failure\n");
goto end;
}
@ -2589,7 +2566,7 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
if (prevtm) {
*prevtm = ASN1_UTCTIME_new();
if (*prevtm == NULL) {
BIO_printf(bio_err, "memory allocation failure\n");
BIO_puts(bio_err, "memory allocation failure\n");
goto end;
}
if (!ASN1_UTCTIME_set_string(*prevtm, rtime_str)) {
@ -2613,7 +2590,7 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
reason_code = OCSP_REVOKED_STATUS_REMOVEFROMCRL;
} else if (reason_code == 8) { /* Hold instruction */
if (!arg_str) {
BIO_printf(bio_err, "missing hold instruction\n");
BIO_puts(bio_err, "missing hold instruction\n");
goto end;
}
reason_code = OCSP_REVOKED_STATUS_CERTIFICATEHOLD;
@ -2629,12 +2606,12 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
ASN1_OBJECT_free(hold);
} else if ((reason_code == 9) || (reason_code == 10)) {
if (!arg_str) {
BIO_printf(bio_err, "missing compromised time\n");
BIO_puts(bio_err, "missing compromised time\n");
goto end;
}
comp_time = ASN1_GENERALIZEDTIME_new();
if (comp_time == NULL) {
BIO_printf(bio_err, "memory allocation failure\n");
BIO_puts(bio_err, "memory allocation failure\n");
goto end;
}
if (!ASN1_GENERALIZEDTIME_set_string(comp_time, arg_str)) {

View file

@ -1,5 +1,5 @@
/*
* Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -20,7 +20,6 @@ typedef enum OPTION_choice {
OPT_COMMON,
OPT_STDNAME,
OPT_CONVERT,
OPT_SSL3,
OPT_TLS1,
OPT_TLS1_1,
OPT_TLS1_2,
@ -48,9 +47,6 @@ const OPTIONS ciphers_options[] = {
OPT_SECTION("Cipher specification"),
{ "s", OPT_S, '-', "Only supported ciphers" },
#ifndef OPENSSL_NO_SSL3
{ "ssl3", OPT_SSL3, '-', "Ciphers compatible with SSL3" },
#endif
#ifndef OPENSSL_NO_TLS1
{ "tls1", OPT_TLS1, '-', "Ciphers compatible with TLS1" },
#endif
@ -135,10 +131,6 @@ int ciphers_main(int argc, char **argv)
case OPT_CONVERT:
convert = opt_arg();
break;
case OPT_SSL3:
min_version = SSL3_VERSION;
max_version = SSL3_VERSION;
break;
case OPT_TLS1:
min_version = TLS1_VERSION;
max_version = TLS1_VERSION;
@ -207,13 +199,13 @@ int ciphers_main(int argc, char **argv)
#endif
if (ciphersuites != NULL && !SSL_CTX_set_ciphersuites(ctx, ciphersuites)) {
BIO_printf(bio_err, "Error setting TLSv1.3 ciphersuites\n");
BIO_puts(bio_err, "Error setting TLSv1.3 ciphersuites\n");
goto err;
}
if (ciphers != NULL) {
if (!SSL_CTX_set_cipher_list(ctx, ciphers)) {
BIO_printf(bio_err, "Error in cipher list\n");
BIO_puts(bio_err, "Error in cipher list\n");
goto err;
}
}
@ -237,10 +229,10 @@ int ciphers_main(int argc, char **argv)
if (p == NULL)
break;
if (i != 0)
BIO_printf(bio_out, ":");
BIO_printf(bio_out, "%s", p);
BIO_puts(bio_out, ":");
BIO_puts(bio_out, p);
}
BIO_printf(bio_out, "\n");
BIO_puts(bio_out, "\n");
} else {
for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) {

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
/*
* Copyright 2008-2025 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2008-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -284,9 +284,9 @@ const OPTIONS cms_options[] = {
{ "cades", OPT_DUP, '-', "Check signingCertificate (CAdES-BES)" },
{ "verify_retcode", OPT_VERIFY_RETCODE, '-',
"Exit non-zero on verification failure" },
{ "CAfile", OPT_CAFILE, '<', "Trusted certificates file" },
{ "CApath", OPT_CAPATH, '/', "Trusted certificates directory" },
{ "CAstore", OPT_CASTORE, ':', "Trusted certificates store URI" },
{ "CAfile", OPT_CAFILE, '<', "File in PEM format with trusted CA certs" },
{ "CApath", OPT_CAPATH, '/', "Dir with trusted CA cert files in PEM format" },
{ "CAstore", OPT_CASTORE, ':', "URI of store with trusted CA certs" },
{ "no-CAfile", OPT_NOCAFILE, '-',
"Do not load the default certificates file" },
{ "no-CApath", OPT_NOCAPATH, '-',
@ -323,7 +323,7 @@ static CMS_ContentInfo *load_content_info(int informat, BIO *in, int flags,
ret = CMS_ContentInfo_new_ex(app_get0_libctx(), app_get0_propq());
if (ret == NULL) {
BIO_printf(bio_err, "Error allocating CMS_contentinfo\n");
BIO_puts(bio_err, "Error allocating CMS_contentinfo\n");
return NULL;
}
switch (informat) {
@ -791,7 +791,7 @@ int cms_main(int argc, char **argv)
keyidx += sk_OPENSSL_STRING_num(skkeys);
}
if (keyidx < 0) {
BIO_printf(bio_err, "No key specified\n");
BIO_puts(bio_err, "No key specified\n");
goto opthelp;
}
if (key_param == NULL || key_param->idx != keyidx) {
@ -908,7 +908,7 @@ int cms_main(int argc, char **argv)
goto end;
}
if (sksigners == NULL) {
BIO_printf(bio_err, "No signer certificate specified\n");
BIO_puts(bio_err, "No signer certificate specified\n");
goto opthelp;
}
signerfile = NULL;
@ -916,23 +916,23 @@ int cms_main(int argc, char **argv)
} else if (operation == SMIME_DECRYPT) {
if (recipfile == NULL && keyfile == NULL
&& secret_key == NULL && pwri_pass == NULL) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"No recipient certificate or key specified\n");
goto opthelp;
}
} else if (operation == SMIME_ENCRYPT) {
if (*argv == NULL && secret_key == NULL
&& pwri_pass == NULL && sk_X509_num(encerts) <= 0) {
BIO_printf(bio_err, "No recipient(s) certificate(s) specified\n");
BIO_puts(bio_err, "No recipient(s) certificate(s) specified\n");
goto opthelp;
}
} else if (!operation) {
BIO_printf(bio_err, "No operation option (-encrypt|-decrypt|-sign|-verify|...) specified.\n");
BIO_puts(bio_err, "No operation option (-encrypt|-decrypt|-sign|-verify|...) specified.\n");
goto opthelp;
}
if (!app_passwd(passinarg, NULL, &passin, NULL)) {
BIO_printf(bio_err, "Error getting password\n");
BIO_puts(bio_err, "Error getting password\n");
goto end;
}
@ -940,19 +940,19 @@ int cms_main(int argc, char **argv)
if ((operation & SMIME_SIGNERS) == 0) {
if ((flags & CMS_DETACHED) == 0)
BIO_printf(bio_err,
BIO_puts(bio_err,
"Warning: -nodetach option is ignored for non-signing operation\n");
flags &= ~CMS_DETACHED;
}
if ((operation & SMIME_IP) == 0 && contfile != NULL)
BIO_printf(bio_err,
BIO_puts(bio_err,
"Warning: -contfile option is ignored for the given operation\n");
if (operation != SMIME_ENCRYPT && *argv != NULL)
BIO_printf(bio_err,
BIO_puts(bio_err,
"Warning: recipient certificate file parameters ignored for operation other than -encrypt\n");
if (operation != SMIME_ENCRYPT && recip_first != NULL)
BIO_printf(bio_err,
BIO_puts(bio_err,
"Warning: -recip_kdf and -recip_ukm parameters ignored for operation other than -encrypt\n");
if ((flags & CMS_BINARY) != 0) {
@ -970,7 +970,7 @@ int cms_main(int argc, char **argv)
if (!cipher)
cipher = (EVP_CIPHER *)EVP_aes_256_cbc();
if (secret_key && !secret_keyid) {
BIO_printf(bio_err, "No secret key id\n");
BIO_puts(bio_err, "No secret key id\n");
goto end;
}
@ -1025,20 +1025,20 @@ int cms_main(int argc, char **argv)
if (digesthex != NULL) {
if (operation != SMIME_SIGN) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"Cannot use -digest for non-signing operation\n");
goto end;
}
if (infile != NULL
|| (flags & CMS_DETACHED) == 0
|| (flags & CMS_STREAM) != 0) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"Cannot use -digest when -in, -nodetach or streaming is used\n");
goto end;
}
digestbin = OPENSSL_hexstr2buf(digesthex, &digestlen);
if (digestbin == NULL) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"Invalid hex value after -digest\n");
goto end;
}
@ -1213,7 +1213,7 @@ int cms_main(int argc, char **argv)
if (originator != NULL
&& ERR_GET_REASON(ERR_peek_error())
== CMS_R_ERROR_UNSUPPORTED_STATIC_KEY_AGREEMENT) {
BIO_printf(bio_err, "Cannot use originator for encryption\n");
BIO_puts(bio_err, "Cannot use originator for encryption\n");
goto end;
}
goto end;
@ -1327,7 +1327,7 @@ int cms_main(int argc, char **argv)
}
if (cms == NULL) {
BIO_printf(bio_err, "Error creating CMS structure\n");
BIO_puts(bio_err, "Error creating CMS structure\n");
goto end;
}
@ -1360,7 +1360,7 @@ int cms_main(int argc, char **argv)
}
if (!CMS_decrypt(cms, NULL, NULL, indata, out, flags)) {
BIO_printf(bio_err, "Error decrypting CMS structure\n");
BIO_puts(bio_err, "Error decrypting CMS structure\n");
goto end;
}
} else if (operation == SMIME_DATA_OUT) {
@ -1371,9 +1371,9 @@ int cms_main(int argc, char **argv)
goto end;
} else if (operation == SMIME_DIGEST_VERIFY) {
if (CMS_digest_verify(cms, indata, out, flags) > 0) {
BIO_printf(bio_err, "Verification successful\n");
BIO_puts(bio_err, "Verification successful\n");
} else {
BIO_printf(bio_err, "Verification failure\n");
BIO_puts(bio_err, "Verification failure\n");
goto end;
}
} else if (operation == SMIME_ENCRYPTED_DECRYPT) {
@ -1407,9 +1407,9 @@ int cms_main(int argc, char **argv)
} else if (operation == SMIME_VERIFY_RECEIPT) {
if (CMS_verify_receipt(rcms, cms, other, store, flags) > 0) {
BIO_printf(bio_err, "Verification successful\n");
BIO_puts(bio_err, "Verification successful\n");
} else {
BIO_printf(bio_err, "Verification failure\n");
BIO_puts(bio_err, "Verification failure\n");
goto end;
}
} else {
@ -1445,11 +1445,11 @@ int cms_main(int argc, char **argv)
} else if (outformat == FORMAT_ASN1) {
ret = i2d_CMS_bio_stream(out, cms, in, flags);
} else {
BIO_printf(bio_err, "Bad output format for CMS file\n");
BIO_puts(bio_err, "Bad output format for CMS file\n");
goto end;
}
if (ret <= 0) {
BIO_printf(bio_err, "Error writing CMS output\n");
BIO_puts(bio_err, "Error writing CMS output\n");
ret = 6;
goto end;
}
@ -1580,13 +1580,15 @@ static void receipt_request_print(CMS_ContentInfo *cms)
ERR_print_errors(bio_err);
} else {
const char *id;
int idlen;
size_t idlen;
CMS_ReceiptRequest_get0_values(rr, &scid, &allorfirst,
&rlist, &rto);
BIO_puts(bio_err, " Signed Content ID:\n");
idlen = ASN1_STRING_length(scid);
idlen = ASN1_STRING_length_ex(scid);
if (idlen > INT_MAX)
idlen = INT_MAX;
id = (const char *)ASN1_STRING_get0_data(scid);
BIO_dump_indent(bio_err, id, idlen, 4);
BIO_dump_indent(bio_err, id, (int)idlen, 4);
BIO_puts(bio_err, " Receipts From");
if (rlist != NULL) {
BIO_puts(bio_err, " List:\n");

View file

@ -1,5 +1,5 @@
/*
* Copyright 2025 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2025-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -28,20 +28,20 @@ static void print_escaped_value(BIO *out, const char *value)
case '#':
case '\\':
case '$':
BIO_printf(out, "\\");
BIO_puts(out, "\\");
BIO_write(out, p, 1);
break;
case '\n':
BIO_printf(out, "%s", "\\n");
BIO_puts(out, "\\n");
break;
case '\r':
BIO_printf(out, "%s", "\\r");
BIO_puts(out, "\\r");
break;
case '\b':
BIO_printf(out, "%s", "\\b");
BIO_puts(out, "\\b");
break;
case '\t':
BIO_printf(out, "%s", "\\t");
BIO_puts(out, "\\t");
break;
case ' ':
if (p == value || p[1] == '\0') {
@ -56,7 +56,7 @@ static void print_escaped_value(BIO *out, const char *value)
* more trouble than adding the quotes just around the
* first and last leading and trailing space.
*/
BIO_printf(out, "%s", "\" \"");
BIO_puts(out, "\" \"");
break;
}
/* FALLTHROUGH */
@ -80,7 +80,7 @@ static void print_section(BIO *out, const CONF *cnf, OPENSSL_CSTRING section_nam
BIO_printf(out, "%s = ", value->name);
print_escaped_value(out, value->value);
BIO_printf(out, "\n");
BIO_puts(out, "\n");
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -84,9 +84,9 @@ const OPTIONS crl_options[] = {
{ "gendelta", OPT_GENDELTA, '<', "Other CRL to compare/diff to the Input one" },
OPT_SECTION("Certificate"),
{ "CApath", OPT_CAPATH, '/', "Verify CRL using certificates in dir" },
{ "CAfile", OPT_CAFILE, '<', "Verify CRL using certificates in file name" },
{ "CAstore", OPT_CASTORE, ':', "Verify CRL using certificates in store URI" },
{ "CAfile", OPT_CAFILE, '<', "File in PEM format with trusted CA certs" },
{ "CApath", OPT_CAPATH, '/', "Dir with trusted CA cert files in PEM format" },
{ "CAstore", OPT_CASTORE, ':', "URI of store with trusted CA certs" },
{ "no-CAfile", OPT_NOCAFILE, '-',
"Do not load the default certificates file" },
{ "no-CApath", OPT_NOCAPATH, '-',
@ -252,20 +252,20 @@ int crl_main(int argc, char **argv)
goto end;
ctx = X509_STORE_CTX_new();
if (ctx == NULL || !X509_STORE_CTX_init(ctx, store, NULL, NULL)) {
BIO_printf(bio_err, "Error initialising X509 store\n");
BIO_puts(bio_err, "Error initialising X509 store\n");
goto end;
}
xobj = X509_STORE_CTX_get_obj_by_subject(ctx, X509_LU_X509,
X509_CRL_get_issuer(x));
if (xobj == NULL) {
BIO_printf(bio_err, "Error getting CRL issuer certificate\n");
BIO_puts(bio_err, "Error getting CRL issuer certificate\n");
goto end;
}
pkey = X509_get_pubkey(X509_OBJECT_get0_X509(xobj));
X509_OBJECT_free(xobj);
if (pkey == NULL) {
BIO_printf(bio_err, "Error getting CRL issuer public key\n");
BIO_puts(bio_err, "Error getting CRL issuer public key\n");
goto end;
}
i = X509_CRL_verify(x, pkey);
@ -273,11 +273,10 @@ int crl_main(int argc, char **argv)
if (i < 0)
goto end;
if (i == 0) {
BIO_printf(bio_err, "verify failure\n");
BIO_puts(bio_err, "verify failure\n");
goto end;
} else {
BIO_printf(bio_err, "verify OK\n");
}
} else
BIO_puts(bio_err, "verify OK\n");
}
if (crldiff != NULL) {
@ -310,7 +309,11 @@ int crl_main(int argc, char **argv)
const ASN1_BIT_STRING *sig;
X509_CRL_get0_signature(x, &sig, NULL);
corrupt_signature(sig);
/* XXX Casts away const, because it mutates the value! */
if (!corrupt_signature((ASN1_BIT_STRING *)sig)) {
BIO_puts(bio_err, "Error corrupting signature\n");
goto end;
}
}
if (num) {
@ -322,7 +325,7 @@ int crl_main(int argc, char **argv)
ASN1_INTEGER *crlnum;
crlnum = X509_CRL_get_ext_d2i(x, NID_crl_number, NULL, NULL);
BIO_printf(bio_out, "crlNumber=");
BIO_puts(bio_out, "crlNumber=");
if (crlnum) {
BIO_puts(bio_out, "0x");
i2a_ASN1_INTEGER(bio_out, crlnum);
@ -330,7 +333,7 @@ int crl_main(int argc, char **argv)
} else {
BIO_puts(bio_out, "<NONE>");
}
BIO_printf(bio_out, "\n");
BIO_puts(bio_out, "\n");
}
if (hash == i) {
int ok;
@ -338,7 +341,7 @@ int crl_main(int argc, char **argv)
app_get0_propq(), &ok);
if (num > 1)
BIO_printf(bio_out, "issuer name hash=");
BIO_puts(bio_out, "issuer name hash=");
if (ok) {
BIO_printf(bio_out, "%08lx\n", hash_value);
} else {
@ -349,23 +352,23 @@ int crl_main(int argc, char **argv)
#ifndef OPENSSL_NO_MD5
if (hash_old == i) {
if (num > 1)
BIO_printf(bio_out, "issuer name old hash=");
BIO_puts(bio_out, "issuer name old hash=");
BIO_printf(bio_out, "%08lx\n",
X509_NAME_hash_old(X509_CRL_get_issuer(x)));
}
#endif
if (lastupdate == i) {
BIO_printf(bio_out, "lastUpdate=");
BIO_puts(bio_out, "lastUpdate=");
ASN1_TIME_print_ex(bio_out, X509_CRL_get0_lastUpdate(x), dateopt);
BIO_printf(bio_out, "\n");
BIO_puts(bio_out, "\n");
}
if (nextupdate == i) {
BIO_printf(bio_out, "nextUpdate=");
BIO_puts(bio_out, "nextUpdate=");
if (X509_CRL_get0_nextUpdate(x))
ASN1_TIME_print_ex(bio_out, X509_CRL_get0_nextUpdate(x), dateopt);
else
BIO_printf(bio_out, "NONE");
BIO_printf(bio_out, "\n");
BIO_puts(bio_out, "NONE");
BIO_puts(bio_out, "\n");
}
if (fingerprint == i) {
int j;
@ -373,7 +376,7 @@ int crl_main(int argc, char **argv)
unsigned char md[EVP_MAX_MD_SIZE];
if (!X509_CRL_digest(x, digest, md, &n)) {
BIO_printf(bio_err, "out of memory\n");
BIO_puts(bio_err, "out of memory\n");
goto end;
}
BIO_printf(bio_out, "%s Fingerprint=",
@ -401,7 +404,7 @@ int crl_main(int argc, char **argv)
else
i = PEM_write_bio_X509_CRL(out, x);
if (!i) {
BIO_printf(bio_err, "unable to write CRL\n");
BIO_puts(bio_err, "unable to write CRL\n");
goto end;
}
ret = 0;

View file

@ -1,5 +1,5 @@
/*
* Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -121,7 +121,7 @@ int crl2pkcs7_main(int argc, char **argv)
else if (informat == FORMAT_PEM)
crl = PEM_read_bio_X509_CRL(in, NULL, NULL, NULL);
if (crl == NULL) {
BIO_printf(bio_err, "unable to load CRL\n");
BIO_puts(bio_err, "unable to load CRL\n");
ERR_print_errors(bio_err);
goto end;
}
@ -156,7 +156,7 @@ int crl2pkcs7_main(int argc, char **argv)
for (i = 0; i < sk_OPENSSL_STRING_num(certflst); i++) {
certfile = sk_OPENSSL_STRING_value(certflst, i);
if (add_certs_from_file(cert_stack, certfile) < 0) {
BIO_printf(bio_err, "error loading certificates\n");
BIO_puts(bio_err, "error loading certificates\n");
ERR_print_errors(bio_err);
goto end;
}
@ -172,7 +172,7 @@ int crl2pkcs7_main(int argc, char **argv)
else if (outformat == FORMAT_PEM)
i = PEM_write_bio_PKCS7(out, p7);
if (!i) {
BIO_printf(bio_err, "unable to write pkcs7 object\n");
BIO_puts(bio_err, "unable to write pkcs7 object\n");
ERR_print_errors(bio_err);
goto end;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -7,10 +7,10 @@
* https://www.openssl.org/source/license.html
*/
#include "apps.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "apps.h"
#include "progs.h"
#include <openssl/bio.h>
#include <openssl/err.h>
@ -20,6 +20,7 @@
#include <openssl/pem.h>
#include <openssl/hmac.h>
#include <ctype.h>
#include <sys/stat.h>
#undef BUFSIZE
#define BUFSIZE 1024 * 8
@ -133,7 +134,7 @@ int dgst_main(int argc, char **argv)
int oneshot_sign = 0;
buf = app_malloc(BUFSIZE, "I/O buffer");
md = (EVP_MD *)EVP_get_digestbyname(argv[0]);
md = EVP_MD_fetch(app_get0_libctx(), argv[0], app_get0_propq());
if (md != NULL)
digestname = argv[0];
@ -151,12 +152,12 @@ int dgst_main(int argc, char **argv)
ret = EXIT_SUCCESS;
goto end;
case OPT_LIST:
BIO_printf(bio_out, "Supported digests:\n");
BIO_puts(bio_out, "Supported digests:\n");
dec.bio = bio_out;
dec.n = 0;
OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_MD_METH,
show_digests, &dec);
BIO_printf(bio_out, "\n");
BIO_puts(bio_out, "\n");
ret = EXIT_SUCCESS;
goto end;
case OPT_C:
@ -200,7 +201,7 @@ int dgst_main(int argc, char **argv)
out_bin = 1;
break;
case OPT_XOFLEN:
xoflen = atoi(opt_arg());
xoflen = opt_int_arg();
break;
case OPT_DEBUG:
debug = 1;
@ -282,7 +283,7 @@ int dgst_main(int argc, char **argv)
}
if (do_verify && sigfile == NULL) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"No signature to verify: use the -signature option\n");
goto end;
}
@ -299,7 +300,7 @@ int dgst_main(int argc, char **argv)
}
if (!app_passwd(passinarg, NULL, &passin, NULL)) {
BIO_printf(bio_err, "Error getting password\n");
BIO_puts(bio_err, "Error getting password\n");
goto end;
}
@ -315,7 +316,7 @@ int dgst_main(int argc, char **argv)
goto end;
if ((!(mac_name == NULL) + !(keyfile == NULL) + !(hmac_key == NULL)) > 1) {
BIO_printf(bio_err, "MAC and signing key cannot both be specified\n");
BIO_puts(bio_err, "MAC and signing key cannot both be specified\n");
goto end;
}
@ -387,7 +388,7 @@ int dgst_main(int argc, char **argv)
if (oneshot_sign) {
mctx = signctx;
} else if (BIO_get_md_ctx(bmd, &mctx) <= 0) {
BIO_printf(bio_err, "Error getting context\n");
BIO_puts(bio_err, "Error getting context\n");
goto end;
}
if (do_verify)
@ -399,7 +400,7 @@ int dgst_main(int argc, char **argv)
app_get0_libctx(),
app_get0_propq(), sigkey, NULL);
if (res == 0) {
BIO_printf(bio_err, "Error setting context\n");
BIO_puts(bio_err, "Error setting context\n");
goto end;
}
if (sigopts != NULL) {
@ -419,17 +420,17 @@ int dgst_main(int argc, char **argv)
EVP_MD_CTX *mctx = NULL;
if (oneshot_sign) {
BIO_printf(bio_err, "Oneshot algorithms don't use a digest\n");
BIO_puts(bio_err, "Oneshot algorithms don't use a digest\n");
goto end;
}
if (BIO_get_md_ctx(bmd, &mctx) <= 0) {
BIO_printf(bio_err, "Error getting context\n");
BIO_puts(bio_err, "Error getting context\n");
goto end;
}
if (md == NULL)
md = (EVP_MD *)EVP_sha256();
if (!EVP_DigestInit_ex(mctx, md, NULL)) {
BIO_printf(bio_err, "Error setting digest\n");
BIO_puts(bio_err, "Error setting digest\n");
goto end;
}
}
@ -464,7 +465,7 @@ int dgst_main(int argc, char **argv)
}
if (xoflen > 0) {
if (!EVP_MD_xof(md)) {
BIO_printf(bio_err, "Length can only be specified for XOF\n");
BIO_puts(bio_err, "Length can only be specified for XOF\n");
goto end;
}
/*
@ -473,7 +474,7 @@ int dgst_main(int argc, char **argv)
* and verify_final methods.
*/
if (sigkey != NULL) {
BIO_printf(bio_err, "Signing key cannot be specified for XOF\n");
BIO_puts(bio_err, "Signing key cannot be specified for XOF\n");
goto end;
}
}
@ -482,10 +483,14 @@ int dgst_main(int argc, char **argv)
BIO_set_fp(in, stdin, BIO_NOCLOSE);
if (oneshot_sign)
ret = do_fp_oneshot_sign(out, signctx, in, separator, out_bin,
sigkey, sigbuf, siglen, NULL, "stdin");
sigkey, sigbuf, siglen, NULL, NULL)
? EXIT_SUCCESS
: EXIT_FAILURE;
else
ret = do_fp(out, buf, inp, separator, out_bin, xoflen,
sigkey, sigbuf, siglen, NULL, md_name, "stdin");
sigkey, sigbuf, siglen, NULL, md_name, "stdin")
? EXIT_SUCCESS
: EXIT_FAILURE;
} else {
const char *sig_name = NULL;
@ -501,12 +506,12 @@ int dgst_main(int argc, char **argv)
continue;
} else {
if (oneshot_sign) {
if (do_fp_oneshot_sign(out, signctx, in, separator, out_bin,
if (!do_fp_oneshot_sign(out, signctx, in, separator, out_bin,
sigkey, sigbuf, siglen, sig_name,
argv[i]))
ret = EXIT_FAILURE;
} else {
if (do_fp(out, buf, inp, separator, out_bin, xoflen,
if (!do_fp(out, buf, inp, separator, out_bin, xoflen,
sigkey, sigbuf, siglen, sig_name, md_name, argv[i]))
ret = EXIT_FAILURE;
}
@ -547,17 +552,15 @@ static void show_digests(const OBJ_NAME *name, void *arg)
/* Filter out message digests that we cannot use */
md = EVP_MD_fetch(app_get0_libctx(), name->name, app_get0_propq());
if (md == NULL) {
if (EVP_get_digestbyname(name->name) == NULL)
return;
}
if (md == NULL)
return;
BIO_printf(dec->bio, "-%-25s", name->name);
if (++dec->n == 3) {
BIO_printf(dec->bio, "\n");
BIO_puts(dec->bio, "\n");
dec->n = 0;
} else {
BIO_printf(dec->bio, " ");
BIO_puts(dec->bio, " ");
}
EVP_MD_free(md);
@ -633,30 +636,34 @@ static void print_out(BIO *out, unsigned char *buf, size_t len,
}
for (i = 0; i < (int)len; i++) {
if (sep && (i != 0))
BIO_printf(out, ":");
BIO_puts(out, ":");
BIO_printf(out, "%02x", buf[i]);
}
BIO_printf(out, "\n");
BIO_puts(out, "\n");
}
}
static void print_verify_result(BIO *out, int i)
{
if (i > 0)
BIO_printf(out, "Verified OK\n");
BIO_puts(out, "Verified OK\n");
else if (i == 0)
BIO_printf(out, "Verification failure\n");
BIO_puts(out, "Verification failure\n");
else
BIO_printf(bio_err, "Error verifying data\n");
BIO_puts(bio_err, "Error verifying data\n");
}
/*
* Returns 1 on success, 0 on failure. Do not use EXIT_SUCCESS / EXIT_FAILURE
* here; reserve those for main() and exit(3) (issue #30562).
*/
int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, int xoflen,
EVP_PKEY *key, unsigned char *sigin, int siglen,
const char *sig_name, const char *md_name,
const char *file)
{
size_t len = BUFSIZE;
int i, ret = EXIT_FAILURE;
int i, ret = 0;
unsigned char *allocated_buf = NULL;
while (BIO_pending(bp) || !BIO_eof(bp)) {
@ -674,7 +681,7 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, int xoflen
i = EVP_DigestVerifyFinal(ctx, sigin, (unsigned int)siglen);
print_verify_result(out, i);
if (i > 0)
ret = EXIT_SUCCESS;
ret = 1;
goto end;
}
if (key != NULL) {
@ -683,7 +690,7 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, int xoflen
BIO_get_md_ctx(bp, &ctx);
if (!EVP_DigestSignFinal(ctx, NULL, &tmplen)) {
BIO_printf(bio_err, "Error getting maximum length of signed data\n");
BIO_puts(bio_err, "Error getting maximum length of signed data\n");
goto end;
}
if (tmplen > BUFSIZE) {
@ -692,7 +699,7 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, int xoflen
buf = allocated_buf;
}
if (!EVP_DigestSignFinal(ctx, buf, &len)) {
BIO_printf(bio_err, "Error signing data\n");
BIO_puts(bio_err, "Error signing data\n");
goto end;
}
} else if (xoflen > 0) {
@ -707,7 +714,7 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, int xoflen
BIO_get_md_ctx(bp, &ctx);
if (!EVP_DigestFinalXOF(ctx, buf, len)) {
BIO_printf(bio_err, "Error Digesting Data\n");
BIO_puts(bio_err, "Error Digesting Data\n");
goto end;
}
} else {
@ -716,7 +723,7 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, int xoflen
goto end;
}
print_out(out, buf, len, sep, binout, sig_name, md_name, file);
ret = EXIT_SUCCESS;
ret = 1;
end:
if (allocated_buf != NULL)
OPENSSL_clear_free(allocated_buf, len);
@ -724,54 +731,87 @@ end:
return ret;
}
/*
* Perform one-shot verify or sign on a contiguous data buffer.
* Returns 0 on failure, 1 on success.
*/
static int do_oneshot_verify_sign(EVP_MD_CTX *ctx, BIO *out,
unsigned char *sigin, int siglen, EVP_PKEY *key,
const unsigned char *data, size_t len,
int sep, int binout, const char *sig_name, const char *file)
{
int res;
size_t siglen_out = 0;
unsigned char *sig = NULL;
if (sigin != NULL) {
res = EVP_DigestVerify(ctx, sigin, siglen, data, len);
print_verify_result(out, res);
return res > 0;
}
if (key != NULL) {
if (EVP_DigestSign(ctx, NULL, &siglen_out, data, len) != 1) {
BIO_puts(bio_err, "Error getting maximum length of signed data\n");
return 0;
}
sig = app_malloc(siglen_out, "Signature buffer");
if (EVP_DigestSign(ctx, sig, &siglen_out, data, len) != 1) {
BIO_puts(bio_err, "Error signing data\n");
OPENSSL_free(sig);
return 0;
}
print_out(out, sig, siglen_out, sep, binout, sig_name, NULL, file);
OPENSSL_free(sig);
return 1;
}
BIO_puts(bio_err, "key must be set for one-shot algorithms\n");
return 0;
}
/*
* Some new algorithms only support one shot operations.
* For these we need to buffer all input and then do the sign on the
* total buffered input. These algorithms set a NULL digest name which is
* then used inside EVP_DigestVerify() and EVP_DigestSign().
* Returns 1 on success, 0 on failure. Do not use EXIT_SUCCESS / EXIT_FAILURE
* here; reserve those for main() and exit(3) (issue #30562).
*/
static int do_fp_oneshot_sign(BIO *out, EVP_MD_CTX *ctx, BIO *in, int sep, int binout,
EVP_PKEY *key, unsigned char *sigin, int siglen,
const char *sig_name, const char *file)
{
int res, ret = EXIT_FAILURE;
size_t len = 0;
int buflen = 0;
int maxlen = 16 * 1024 * 1024;
uint8_t *buf = NULL, *sig = NULL;
int ret = 0;
size_t buflen = 0;
size_t maxlen = 16 * 1024 * 1024;
uint8_t *buf = NULL;
buflen = bio_to_mem(&buf, maxlen, in);
if (buflen <= 0) {
BIO_printf(bio_err, "Read error in %s\n", file);
return ret;
}
if (sigin != NULL) {
res = EVP_DigestVerify(ctx, sigin, siglen, buf, buflen);
print_verify_result(out, res);
if (res > 0)
ret = EXIT_SUCCESS;
goto end;
}
if (key != NULL) {
if (EVP_DigestSign(ctx, NULL, &len, buf, buflen) != 1) {
BIO_printf(bio_err, "Error getting maximum length of signed data\n");
goto end;
}
sig = app_malloc(len, "Signature buffer");
if (EVP_DigestSign(ctx, sig, &len, buf, buflen) != 1) {
BIO_printf(bio_err, "Error signing data\n");
goto end;
}
print_out(out, sig, len, sep, binout, sig_name, NULL, file);
ret = EXIT_SUCCESS;
} else {
BIO_printf(bio_err, "key must be set for one-shot algorithms\n");
goto end;
}
#if defined(OPENSSL_SYS_UNIX) && defined(_POSIX_MAPPED_FILES) && _POSIX_MAPPED_FILES > 0
if (file != NULL) {
const unsigned char *data = NULL;
size_t filesize = 0;
int r = app_mmap_file(file, bio_err, (size_t)-1, &data, &filesize);
end:
OPENSSL_free(sig);
OPENSSL_clear_free(buf, buflen);
if (r == 1) {
ret = do_oneshot_verify_sign(ctx, out, sigin, siglen, key, data,
filesize, sep, binout, sig_name, file);
munmap((void *)data, filesize);
return ret;
}
if (r == -1)
return 0; /* error already printed */
/* r == 0: empty file, fall through to buffer path */
}
#endif
{
const char *display_file = file != NULL ? file : "stdin";
if (!bio_to_mem(&buf, &buflen, maxlen, in))
return 0;
ret = do_oneshot_verify_sign(ctx, out, sigin, siglen, key, buf, buflen,
sep, binout, sig_name, display_file);
OPENSSL_clear_free(buf, buflen);
}
return ret;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -178,7 +178,7 @@ int dhparam_main(int argc, char **argv)
num = DEFBITS;
if (dsaparam && g) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"Error, generator may not be chosen for DSA parameters\n");
goto end;
}
@ -218,16 +218,16 @@ int dhparam_main(int argc, char **argv)
if (dsaparam) {
if (EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, num) <= 0) {
BIO_printf(bio_err, "Error, unable to set DSA prime length\n");
BIO_puts(bio_err, "Error, unable to set DSA prime length\n");
goto end;
}
} else {
if (EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, num) <= 0) {
BIO_printf(bio_err, "Error, unable to set DH prime length\n");
BIO_puts(bio_err, "Error, unable to set DH prime length\n");
goto end;
}
if (EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, g) <= 0) {
BIO_printf(bio_err, "Error, unable to set generator\n");
BIO_puts(bio_err, "Error, unable to set generator\n");
goto end;
}
}
@ -301,13 +301,13 @@ int dhparam_main(int argc, char **argv)
OSSL_DECODER_CTX_free(decoderctx);
} while (!done);
if (tmppkey == NULL) {
BIO_printf(bio_err, "Error, unable to load parameters\n");
BIO_puts(bio_err, "Error, unable to load parameters\n");
goto end;
}
if (dsaparam) {
if (!EVP_PKEY_is_a(tmppkey, "DSA")) {
BIO_printf(bio_err, "Error, unable to load DSA parameters\n");
BIO_puts(bio_err, "Error, unable to load DSA parameters\n");
goto end;
}
pkey = dsa_to_dh(tmppkey);
@ -316,7 +316,7 @@ int dhparam_main(int argc, char **argv)
} else {
if (!EVP_PKEY_is_a(tmppkey, "DH")
&& !EVP_PKEY_is_a(tmppkey, "DHX")) {
BIO_printf(bio_err, "Error, unable to load DH parameters\n");
BIO_puts(bio_err, "Error, unable to load DH parameters\n");
goto end;
}
pkey = tmppkey;
@ -334,14 +334,14 @@ int dhparam_main(int argc, char **argv)
if (check) {
ctx = EVP_PKEY_CTX_new_from_pkey(app_get0_libctx(), pkey, app_get0_propq());
if (ctx == NULL) {
BIO_printf(bio_err, "Error, failed to check DH parameters\n");
BIO_puts(bio_err, "Error, failed to check DH parameters\n");
goto end;
}
if (EVP_PKEY_param_check(ctx) <= 0) {
BIO_printf(bio_err, "Error, invalid parameters generated\n");
BIO_puts(bio_err, "Error, invalid parameters generated\n");
goto end;
}
BIO_printf(bio_err, "DH parameters appear to be ok.\n");
BIO_puts(bio_err, "DH parameters appear to be ok.\n");
}
if (!noout) {
@ -354,7 +354,7 @@ int dhparam_main(int argc, char **argv)
if (ectx == NULL || !OSSL_ENCODER_to_bio(ectx, out)) {
OSSL_ENCODER_CTX_free(ectx);
BIO_printf(bio_err, "Error, unable to write DH parameters\n");
BIO_puts(bio_err, "Error, unable to write DH parameters\n");
goto end;
}
OSSL_ENCODER_CTX_free(ectx);
@ -387,7 +387,7 @@ static EVP_PKEY *dsa_to_dh(EVP_PKEY *dh)
if (!EVP_PKEY_get_bn_param(dh, OSSL_PKEY_PARAM_FFC_P, &bn_p)
|| !EVP_PKEY_get_bn_param(dh, OSSL_PKEY_PARAM_FFC_Q, &bn_q)
|| !EVP_PKEY_get_bn_param(dh, OSSL_PKEY_PARAM_FFC_G, &bn_g)) {
BIO_printf(bio_err, "Error, failed to set DH parameters\n");
BIO_puts(bio_err, "Error, failed to set DH parameters\n");
goto err;
}
@ -399,7 +399,7 @@ static EVP_PKEY *dsa_to_dh(EVP_PKEY *dh)
|| !OSSL_PARAM_BLD_push_BN(tmpl, OSSL_PKEY_PARAM_FFC_G,
bn_g)
|| (params = OSSL_PARAM_BLD_to_param(tmpl)) == NULL) {
BIO_printf(bio_err, "Error, failed to set DH parameters\n");
BIO_puts(bio_err, "Error, failed to set DH parameters\n");
goto err;
}
@ -407,7 +407,7 @@ static EVP_PKEY *dsa_to_dh(EVP_PKEY *dh)
if (ctx == NULL
|| EVP_PKEY_fromdata_init(ctx) <= 0
|| EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_KEY_PARAMETERS, params) <= 0) {
BIO_printf(bio_err, "Error, failed to set DH parameters\n");
BIO_puts(bio_err, "Error, failed to set DH parameters\n");
goto err;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -174,23 +174,23 @@ int dsa_main(int argc, char **argv)
private = !pubin && (!pubout || text);
if (!app_passwd(passinarg, passoutarg, &passin, &passout)) {
BIO_printf(bio_err, "Error getting passwords\n");
BIO_puts(bio_err, "Error getting passwords\n");
goto end;
}
BIO_printf(bio_err, "read DSA key\n");
BIO_puts(bio_err, "read DSA key\n");
if (pubin)
pkey = load_pubkey(infile, informat, 1, passin, "public key");
else
pkey = load_key(infile, informat, 1, passin, "private key");
if (pkey == NULL) {
BIO_printf(bio_err, "unable to load Key\n");
BIO_puts(bio_err, "unable to load Key\n");
ERR_print_errors(bio_err);
goto end;
}
if (!EVP_PKEY_is_a(pkey, "DSA")) {
BIO_printf(bio_err, "Not a DSA key\n");
BIO_puts(bio_err, "Not a DSA key\n");
goto end;
}
@ -215,9 +215,9 @@ int dsa_main(int argc, char **argv)
ERR_print_errors(bio_err);
goto end;
}
BIO_printf(out, "Public Key=");
BIO_puts(out, "Public Key=");
BN_print(out, pub_key);
BIO_printf(out, "\n");
BIO_puts(out, "\n");
BN_free(pub_key);
}
@ -225,7 +225,7 @@ int dsa_main(int argc, char **argv)
ret = 0;
goto end;
}
BIO_printf(bio_err, "writing DSA key\n");
BIO_puts(bio_err, "writing DSA key\n");
if (outformat == FORMAT_ASN1) {
output_type = "DER";
} else if (outformat == FORMAT_PEM) {
@ -234,12 +234,12 @@ int dsa_main(int argc, char **argv)
output_type = "MSBLOB";
} else if (outformat == FORMAT_PVK) {
if (pubin) {
BIO_printf(bio_err, "PVK form impossible with public key input\n");
BIO_puts(bio_err, "PVK form impossible with public key input\n");
goto end;
}
output_type = "PVK";
} else {
BIO_printf(bio_err, "bad output format specified for outfile\n");
BIO_puts(bio_err, "bad output format specified for outfile\n");
goto end;
}
@ -287,13 +287,13 @@ int dsa_main(int argc, char **argv)
params[0] = OSSL_PARAM_construct_int("encrypt-level", &pvk_encr);
if (!OSSL_ENCODER_CTX_set_params(ectx, params)) {
BIO_printf(bio_err, "invalid PVK encryption level\n");
BIO_puts(bio_err, "invalid PVK encryption level\n");
goto end;
}
}
if (!OSSL_ENCODER_to_bio(ectx, out)) {
BIO_printf(bio_err, "unable to write key\n");
BIO_puts(bio_err, "unable to write key\n");
goto end;
}
ret = 0;

View file

@ -1,5 +1,5 @@
/*
* Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -153,7 +153,7 @@ int dsaparam_main(int argc, char **argv)
ctx = EVP_PKEY_CTX_new_from_name(app_get0_libctx(), "DSA", app_get0_propq());
if (ctx == NULL) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"Error, DSA parameter generation context allocation failed\n");
goto end;
}
@ -167,23 +167,23 @@ int dsaparam_main(int argc, char **argv)
EVP_PKEY_CTX_set_app_data(ctx, bio_err);
if (verbose) {
EVP_PKEY_CTX_set_cb(ctx, progress_cb);
BIO_printf(bio_err, "Generating DSA parameters, %d bit long prime\n",
BIO_printf(bio_err, "Generating DSA parameters, %d bit long prime\n"
"This could take some time\n",
num);
BIO_printf(bio_err, "This could take some time\n");
}
if (EVP_PKEY_paramgen_init(ctx) <= 0) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"Error, DSA key generation paramgen init failed\n");
goto end;
}
if (EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, num) <= 0) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"Error, DSA key generation setting bit length failed\n");
goto end;
}
if (numqbits > 0) {
if (EVP_PKEY_CTX_set_dsa_paramgen_q_bits(ctx, numqbits) <= 0) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"Error, DSA key generation setting subprime bit length failed\n");
goto end;
}
@ -214,7 +214,7 @@ int dsaparam_main(int argc, char **argv)
else
i = PEM_write_bio_Parameters(out, params);
if (!i) {
BIO_printf(bio_err, "Error, unable to write DSA parameters\n");
BIO_puts(bio_err, "Error, unable to write DSA parameters\n");
goto end;
}
}
@ -228,7 +228,7 @@ int dsaparam_main(int argc, char **argv)
goto end;
}
if (EVP_PKEY_keygen_init(ctx) <= 0) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"Error, unable to initialise for key generation\n");
goto end;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 2002-2025 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2002-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -54,7 +54,7 @@ const OPTIONS ec_options[] = {
{ "check", OPT_CHECK, '-', "check key consistency" },
{ "", OPT_CIPHER, '-', "Any supported cipher" },
{ "param_enc", OPT_PARAM_ENC, 's',
"Specifies the way the ec parameters are encoded" },
"Selects between named_curve and explicit EC parameter encoding" },
{ "conv_form", OPT_CONV_FORM, 's', "Specifies the point conversion form " },
OPT_SECTION("Output"),
@ -172,7 +172,7 @@ int ec_main(int argc, char **argv)
private = !pubin && (text || (!param_out && !pubout));
if (!app_passwd(passinarg, passoutarg, &passin, &passout)) {
BIO_printf(bio_err, "Error getting passwords\n");
BIO_puts(bio_err, "Error getting passwords\n");
goto end;
}
@ -182,7 +182,7 @@ int ec_main(int argc, char **argv)
eckey = load_key(infile, informat, 1, passin, "private key");
if (eckey == NULL) {
BIO_printf(bio_err, "unable to load Key\n");
BIO_puts(bio_err, "unable to load Key\n");
goto end;
}
@ -194,25 +194,25 @@ int ec_main(int argc, char **argv)
&& !EVP_PKEY_set_utf8_string_param(
eckey, OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT,
point_format)) {
BIO_printf(bio_err, "unable to set point conversion format\n");
BIO_puts(bio_err, "unable to set point conversion format\n");
goto end;
}
if (asn1_encoding != NULL
&& !EVP_PKEY_set_utf8_string_param(
eckey, OSSL_PKEY_PARAM_EC_ENCODING, asn1_encoding)) {
BIO_printf(bio_err, "unable to set asn1 encoding format\n");
BIO_puts(bio_err, "unable to set asn1 encoding format\n");
goto end;
}
if (no_public) {
if (!EVP_PKEY_set_int_param(eckey, OSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC, 0)) {
BIO_printf(bio_err, "unable to disable public key encoding\n");
BIO_puts(bio_err, "unable to disable public key encoding\n");
goto end;
}
} else {
if (!EVP_PKEY_set_int_param(eckey, OSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC, 1)) {
BIO_printf(bio_err, "unable to enable public key encoding\n");
BIO_puts(bio_err, "unable to enable public key encoding\n");
goto end;
}
}
@ -221,7 +221,7 @@ int ec_main(int argc, char **argv)
assert(pubin || private);
if ((pubin && EVP_PKEY_print_public(out, eckey, 0, NULL) <= 0)
|| (!pubin && EVP_PKEY_print_private(out, eckey, 0, NULL) <= 0)) {
BIO_printf(bio_err, "unable to print EC key\n");
BIO_puts(bio_err, "unable to print EC key\n");
goto end;
}
}
@ -229,13 +229,13 @@ int ec_main(int argc, char **argv)
if (check) {
pctx = EVP_PKEY_CTX_new_from_pkey(NULL, eckey, NULL);
if (pctx == NULL) {
BIO_printf(bio_err, "unable to check EC key\n");
BIO_puts(bio_err, "unable to check EC key\n");
goto end;
}
if (EVP_PKEY_check(pctx) <= 0)
BIO_printf(bio_err, "EC Key Invalid!\n");
BIO_puts(bio_err, "EC Key Invalid!\n");
else
BIO_printf(bio_err, "EC Key valid.\n");
BIO_puts(bio_err, "EC Key valid.\n");
ERR_print_errors(bio_err);
}
@ -269,7 +269,7 @@ int ec_main(int argc, char **argv)
strlen(passout));
}
if (!OSSL_ENCODER_to_bio(ectx, out)) {
BIO_printf(bio_err, "unable to write EC key\n");
BIO_puts(bio_err, "unable to write EC key\n");
goto end;
}
}

283
apps/ech.c Normal file
View file

@ -0,0 +1,283 @@
/*
* Copyright 2024-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "apps.h"
#include "progs.h"
#include <openssl/ssl.h>
#include <openssl/bio.h>
#include <openssl/evp.h>
#include <openssl/err.h>
#include <openssl/bn.h>
#include <openssl/pem.h>
#include <openssl/rand.h>
#include <openssl/hpke.h>
#include <openssl/objects.h>
#include <openssl/x509.h>
#ifndef OPENSSL_NO_ECH
#define OSSL_ECH_KEYGEN_MODE 0 /* default: generate a key pair/ECHConfig */
#define OSSL_ECH_SELPRINT_MODE 1 /* we can print/down-select ECHConfigList */
#define OSSL_ECH_MAXINFILES 5 /* we'll only take this many inputs */
typedef enum OPTION_choice {
/* standard openssl options */
OPT_ERR = -1,
OPT_EOF = 0,
OPT_HELP,
OPT_VERBOSE,
OPT_TEXT,
OPT_OUT,
OPT_IN,
/* ECHConfig specifics */
OPT_PUBLICNAME,
OPT_ECHVERSION,
OPT_MAXNAMELENGTH,
OPT_HPKESUITE,
OPT_SELECT
} OPTION_CHOICE;
const OPTIONS ech_options[] = {
OPT_SECTION("General options"),
{ "help", OPT_HELP, '-', "Display this summary" },
{ "verbose", OPT_VERBOSE, '-', "Provide additional output" },
{ "text", OPT_TEXT, '-', "Provide human-readable output" },
OPT_SECTION("Key generation"),
{ "out", OPT_OUT, '>',
"Private key and/or ECHConfig [default: echconfig.pem]" },
{ "public_name", OPT_PUBLICNAME, 's', "public_name value" },
{ "max_name_len", OPT_MAXNAMELENGTH, 'n',
"Maximum host name length value [default: 0]" },
{ "suite", OPT_HPKESUITE, 's', "HPKE ciphersuite: e.g. \"0x20,1,3\"" },
{ "ech_version", OPT_ECHVERSION, 'n',
"ECHConfig version [default: 0xff0d (13)]" },
OPT_SECTION("ECH PEM file downselect/display"),
{ "in", OPT_IN, '<', "An ECH PEM file" },
{ "select", OPT_SELECT, 'n', "Downselect to the numbered ECH config" },
{ NULL }
};
/**
* @brief map version string like 0xff01 or 65291 to uint16_t
* @param arg is the version string, from command line
* @return is the uint16_t value (with zero for error cases)
*/
static uint16_t verstr2us(char *arg)
{
long lv = strtol(arg, NULL, 0);
uint16_t rv = 0;
if (lv < 0xffff && lv > 0)
rv = (uint16_t)lv;
return rv;
}
int ech_main(int argc, char **argv)
{
char *prog = NULL;
OPTION_CHOICE o;
int i, rv = 1, verbose = 0, text = 0, outsupp = 0;
int select = OSSL_ECHSTORE_ALL, numinfiles = 0;
char *outfile = NULL, *infile = NULL;
char *infiles[OSSL_ECH_MAXINFILES] = { NULL };
char *public_name = NULL, *suitestr = NULL;
uint16_t ech_version = OSSL_ECH_CURRENT_VERSION;
uint8_t max_name_length = 0;
OSSL_HPKE_SUITE hpke_suite = OSSL_HPKE_SUITE_DEFAULT;
int mode = OSSL_ECH_KEYGEN_MODE; /* key generation */
OSSL_ECHSTORE *es = NULL;
BIO *ecf = NULL;
prog = opt_init(argc, argv, ech_options);
while ((o = opt_next()) != OPT_EOF) {
switch (o) {
case OPT_EOF:
case OPT_ERR:
BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
goto end;
case OPT_HELP:
opt_help(ech_options);
rv = 0;
goto end;
case OPT_VERBOSE:
verbose = 1;
break;
case OPT_TEXT:
text = 1;
break;
case OPT_SELECT:
mode = OSSL_ECH_SELPRINT_MODE;
select = strtol(opt_arg(), NULL, 10);
break;
case OPT_OUT:
outfile = opt_arg();
outsupp = 1;
break;
case OPT_IN:
mode = OSSL_ECH_SELPRINT_MODE;
infile = opt_arg();
if (numinfiles >= OSSL_ECH_MAXINFILES) {
BIO_printf(bio_err, "too many input files, only %d allowed\n",
OSSL_ECH_MAXINFILES);
goto opthelp;
}
infiles[numinfiles] = infile;
numinfiles++;
break;
case OPT_PUBLICNAME:
public_name = opt_arg();
break;
case OPT_ECHVERSION:
ech_version = verstr2us(opt_arg());
break;
case OPT_MAXNAMELENGTH: {
long tmp = strtol(opt_arg(), NULL, 10);
if (tmp < 0 || tmp > OSSL_ECH_MAX_MAXNAMELEN) {
BIO_printf(bio_err,
"max name length out of range [0,%d] (%ld)\n",
OSSL_ECH_MAX_MAXNAMELEN, tmp);
goto opthelp;
} else {
max_name_length = (uint8_t)tmp;
}
} break;
case OPT_HPKESUITE:
suitestr = opt_arg();
break;
}
}
argc = opt_num_rest();
argv = opt_rest();
if (argc != 0) {
BIO_printf(bio_err, "%s: Unknown parameter %s\n", prog, argv[0]);
goto opthelp;
}
/* Check ECH-specific inputs */
switch (ech_version) {
case OSSL_ECH_RFC9849_VERSION: /* fall through */
case 13:
ech_version = OSSL_ECH_RFC9849_VERSION;
break;
default:
BIO_printf(bio_err, "Un-supported version (0x%04x)\n", ech_version);
goto end;
}
if (suitestr != NULL) {
if (OSSL_HPKE_str2suite(suitestr, &hpke_suite) != 1) {
BIO_printf(bio_err, "Bad OSSL_HPKE_SUITE (%s)\n", suitestr);
ERR_print_errors(bio_err);
goto end;
}
}
/* Set default if needed */
if (outfile == NULL)
outfile = "echconfig.pem";
es = OSSL_ECHSTORE_new(NULL, NULL);
if (es == NULL)
goto end;
if (mode == OSSL_ECH_KEYGEN_MODE) {
if (public_name == NULL) {
BIO_printf(bio_err, "public_name required\n");
goto end;
}
if (verbose)
BIO_printf(bio_err, "Calling OSSL_ECHSTORE_new_config\n");
if ((ecf = bio_open_owner(outfile, FORMAT_PEM, 1)) == NULL
|| OSSL_ECHSTORE_new_config(es, ech_version, max_name_length,
public_name, hpke_suite)
!= 1
|| OSSL_ECHSTORE_write_pem(es, 0, ecf) != 1) {
BIO_printf(bio_err, "OSSL_ECHSTORE_new_config error\n");
goto end;
}
if (verbose)
BIO_printf(bio_err, "OSSL_ECHSTORE_new_config success\n");
rv = 0;
}
if (mode == OSSL_ECH_SELPRINT_MODE) {
if (numinfiles == 0)
goto opthelp;
for (i = 0; i != numinfiles; i++) {
if ((ecf = BIO_new_file(infiles[i], "r")) == NULL
|| OSSL_ECHSTORE_read_pem(es, ecf, OSSL_ECH_FOR_RETRY) != 1) {
BIO_printf(bio_err, "OSSL_ECHSTORE_read_pem error: %s\n",
infiles[i]);
goto end;
}
BIO_free(ecf);
ecf = NULL;
}
if (verbose)
BIO_printf(bio_err, "Success reading %d files\n", numinfiles);
if (outsupp == 1) {
/* write result to that, with downselection if required */
if (verbose)
BIO_printf(bio_err, "Will write to %s\n", outfile);
if (verbose && select != OSSL_ECHSTORE_ALL)
BIO_printf(bio_err, "Selected entry: %d\n", select);
if ((ecf = BIO_new_file(outfile, "w")) == NULL
|| OSSL_ECHSTORE_write_pem(es, select, ecf) != 1) {
BIO_printf(bio_err, "OSSL_ECHSTORE_write_pem error: %s\n",
outfile);
goto end;
}
if (verbose)
BIO_printf(bio_err, "Success writing to %s\n", outfile);
}
rv = 0;
}
if (text) {
int oi_ind, oi_cnt = 0;
if (OSSL_ECHSTORE_num_entries(es, &oi_cnt) != 1)
goto end;
if (verbose)
BIO_printf(bio_err, "Printing %d ECHConfig values\n", oi_cnt);
for (oi_ind = 0; oi_ind != oi_cnt; oi_ind++) {
time_t secs = 0;
char *pn = NULL, *ec = NULL;
int has_priv, for_retry;
if (OSSL_ECHSTORE_get1_info(es, oi_ind, &secs, &pn, &ec,
&has_priv, &for_retry)
!= 1) {
OPENSSL_free(pn); /* just in case */
OPENSSL_free(ec);
goto end;
}
BIO_printf(bio_err, "ECH entry: %d public_name: %s age: %lld%s%s\n",
oi_ind, pn, (long long)secs,
has_priv ? " (has private key)" : "",
for_retry ? " (will be sent in retry-configs)" : "");
BIO_printf(bio_err, "\t%s\n", ec);
OPENSSL_free(pn);
OPENSSL_free(ec);
}
if (verbose)
BIO_printf(bio_err, "Success printing %d ECHConfigList\n", oi_cnt);
rv = 0;
}
end:
OSSL_ECHSTORE_free(es);
BIO_free_all(ecf);
return rv;
opthelp:
BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
BIO_printf(bio_err, "\tup to %d -in instances allowed\n", OSSL_ECH_MAXINFILES);
OSSL_ECHSTORE_free(es);
BIO_free_all(ecf);
return rv;
}
#endif

View file

@ -1,5 +1,5 @@
/*
* Copyright 2002-2025 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2002-2026 The OpenSSL Project Authors. All Rights Reserved.
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
@ -57,7 +57,7 @@ const OPTIONS ecparam_options[] = {
{ "text", OPT_TEXT, '-', "Print the ec parameters in text form" },
{ "noout", OPT_NOOUT, '-', "Do not print the ec parameter" },
{ "param_enc", OPT_PARAM_ENC, 's',
"Specifies the way the ec parameters are encoded" },
"Selects between named_curve and explicit EC parameter encoding" },
OPT_SECTION("Parameter"),
{ "check", OPT_CHECK, '-', "Validate the ec parameters" },
@ -91,8 +91,7 @@ static int list_builtin_curves(BIO *out)
if (sname == NULL)
sname = "";
BIO_printf(out, " %-10s: ", sname);
BIO_printf(out, "%s\n", comment);
BIO_printf(out, " %-10s: %s\n", sname, comment);
}
OPENSSL_free(curves);
return 1;
@ -210,11 +209,11 @@ int ecparam_main(int argc, char **argv)
OSSL_PARAM *p = params;
if (strcmp(curve_name, "secp192r1") == 0) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"using curve name prime192v1 instead of secp192r1\n");
curve_name = SN_X9_62_prime192v1;
} else if (strcmp(curve_name, "secp256r1") == 0) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"using curve name prime256v1 instead of secp256r1\n");
curve_name = SN_X9_62_prime256v1;
}
@ -239,7 +238,7 @@ int ecparam_main(int argc, char **argv)
|| EVP_PKEY_keygen_init(gctx_params) <= 0
|| EVP_PKEY_CTX_set_params(gctx_params, params) <= 0
|| EVP_PKEY_keygen(gctx_params, &params_key) <= 0) {
BIO_printf(bio_err, "unable to generate key\n");
BIO_puts(bio_err, "unable to generate key\n");
goto end;
}
} else {
@ -258,14 +257,14 @@ int ecparam_main(int argc, char **argv)
&& !EVP_PKEY_set_utf8_string_param(
params_key, OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT,
point_format)) {
BIO_printf(bio_err, "unable to set point conversion format\n");
BIO_puts(bio_err, "unable to set point conversion format\n");
goto end;
}
if (asn1_encoding != NULL
&& !EVP_PKEY_set_utf8_string_param(
params_key, OSSL_PKEY_PARAM_EC_ENCODING, asn1_encoding)) {
BIO_printf(bio_err, "unable to set asn1 encoding format\n");
BIO_puts(bio_err, "unable to set asn1 encoding format\n");
goto end;
}
}
@ -273,7 +272,7 @@ int ecparam_main(int argc, char **argv)
if (no_seed
&& !EVP_PKEY_set_octet_string_param(params_key, OSSL_PKEY_PARAM_EC_SEED,
NULL, 0)) {
BIO_printf(bio_err, "unable to clear seed\n");
BIO_puts(bio_err, "unable to clear seed\n");
goto end;
}
@ -283,27 +282,27 @@ int ecparam_main(int argc, char **argv)
if (text
&& EVP_PKEY_print_params(out, params_key, 0, NULL) <= 0) {
BIO_printf(bio_err, "unable to print params\n");
BIO_puts(bio_err, "unable to print params\n");
goto end;
}
if (check || check_named) {
BIO_printf(bio_err, "checking elliptic curve parameters: ");
BIO_puts(bio_err, "checking elliptic curve parameters: ");
if (check_named
&& !EVP_PKEY_set_utf8_string_param(params_key,
OSSL_PKEY_PARAM_EC_GROUP_CHECK_TYPE,
OSSL_PKEY_EC_GROUP_CHECK_NAMED)) {
BIO_printf(bio_err, "unable to set check_type\n");
BIO_puts(bio_err, "unable to set check_type\n");
goto end;
}
pctx = EVP_PKEY_CTX_new_from_pkey(app_get0_libctx(), params_key,
app_get0_propq());
if (pctx == NULL || EVP_PKEY_param_check(pctx) <= 0) {
BIO_printf(bio_err, "failed\n");
BIO_puts(bio_err, "failed\n");
goto end;
}
BIO_printf(bio_err, "ok\n");
BIO_puts(bio_err, "ok\n");
}
if (outformat == FORMAT_ASN1 && genkey)
@ -314,7 +313,7 @@ int ecparam_main(int argc, char **argv)
params_key, OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS,
outformat == FORMAT_ASN1 ? "DER" : "PEM", NULL, NULL);
if (!OSSL_ENCODER_to_bio(ectx_params, out)) {
BIO_printf(bio_err, "unable to write elliptic curve parameters\n");
BIO_puts(bio_err, "unable to write elliptic curve parameters\n");
goto end;
}
}
@ -332,7 +331,7 @@ int ecparam_main(int argc, char **argv)
app_get0_propq());
if (EVP_PKEY_keygen_init(gctx_key) <= 0
|| EVP_PKEY_keygen(gctx_key, &key) <= 0) {
BIO_printf(bio_err, "unable to generate key\n");
BIO_puts(bio_err, "unable to generate key\n");
goto end;
}
assert(private);
@ -340,8 +339,8 @@ int ecparam_main(int argc, char **argv)
key, OSSL_KEYMGMT_SELECT_ALL,
outformat == FORMAT_ASN1 ? "DER" : "PEM", NULL, NULL);
if (!OSSL_ENCODER_to_bio(ectx_key, out)) {
BIO_printf(bio_err, "unable to write elliptic "
"curve parameters\n");
BIO_puts(bio_err, "unable to write elliptic "
"curve parameters\n");
goto end;
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -24,6 +24,7 @@
#include <openssl/comp.h>
#endif
#include <ctype.h>
#include <inttypes.h>
#undef SIZE
#undef BSIZE
@ -114,7 +115,7 @@ const OPTIONS enc_options[] = {
{ "S", OPT_UPPER_S, 's', "Salt, in hex" },
{ "iv", OPT_IV, 's', "IV in hex" },
{ "md", OPT_MD, 's', "Use specified digest to create a key from the passphrase" },
{ "k", OPT_K, 's', "Passphrase (Deprecated" },
{ "k", OPT_K, 's', "Passphrase (Deprecated)" },
{ "kfile", OPT_KFILE, '<', "Read passphrase from file (Deprecated)" },
{ "pass", OPT_PASS, 's', "Passphrase source" },
{ "iter", OPT_ITER, 'p',
@ -142,15 +143,15 @@ const OPTIONS enc_options[] = {
};
static EVP_SKEY *skey_from_params(const EVP_CIPHER *cipher, const char *skeymgmt,
STACK_OF(OPENSSL_STRING) *opts)
STACK_OF(OPENSSL_STRING) *opts)
{
EVP_SKEY *skey = NULL;
EVP_SKEYMGMT *mgmt = NULL;
OSSL_PARAM *params = NULL;
mgmt = EVP_SKEYMGMT_fetch(app_get0_libctx(),
skeymgmt != NULL ? skeymgmt : EVP_CIPHER_name(cipher),
app_get0_propq());
skeymgmt != NULL ? skeymgmt : EVP_CIPHER_name(cipher),
app_get0_propq());
if (mgmt == NULL)
return NULL;
@ -161,8 +162,8 @@ static EVP_SKEY *skey_from_params(const EVP_CIPHER *cipher, const char *skeymgmt
}
skey = EVP_SKEY_import(app_get0_libctx(), EVP_SKEYMGMT_get0_name(mgmt),
app_get0_propq(), OSSL_SKEYMGMT_SELECT_ALL, params);
OSSL_PARAM_free(params);
app_get0_propq(), OSSL_SKEYMGMT_SELECT_ALL, params);
app_params_free(params);
EVP_SKEYMGMT_free(mgmt);
return skey;
@ -243,12 +244,12 @@ int enc_main(int argc, char **argv)
ret = 0;
goto end;
case OPT_LIST:
BIO_printf(bio_out, "Supported ciphers:\n");
BIO_puts(bio_out, "Supported ciphers:\n");
dec.bio = bio_out;
dec.n = 0;
OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH,
show_ciphers, &dec);
BIO_printf(bio_out, "\n");
BIO_puts(bio_out, "\n");
ret = 0;
goto end;
case OPT_E:
@ -424,7 +425,7 @@ int enc_main(int argc, char **argv)
if (base64 && bsize < 80)
bsize = 80;
if (verbose)
BIO_printf(bio_err, "bufsize=%d\n", bsize);
BIO_printf(bio_out, "bufsize=%d\n", bsize);
#ifndef OPENSSL_NO_ZLIB
if (do_zlib)
@ -447,7 +448,7 @@ int enc_main(int argc, char **argv)
if (infile == NULL) {
if (!streamable && printkey != 2) { /* if just print key and exit, it's ok */
BIO_printf(bio_err, "Unstreamable cipher mode\n");
BIO_puts(bio_err, "Unstreamable cipher mode\n");
goto end;
}
in = dup_bio_in(informat);
@ -459,7 +460,7 @@ int enc_main(int argc, char **argv)
if (str == NULL && passarg != NULL) {
if (!app_passwd(passarg, NULL, &pass, NULL)) {
BIO_printf(bio_err, "Error getting password\n");
BIO_puts(bio_err, "Error getting password\n");
goto end;
}
str = pass;
@ -486,13 +487,13 @@ int enc_main(int argc, char **argv)
break;
}
if (i < 0) {
BIO_printf(bio_err, "bad password read\n");
BIO_puts(bio_err, "bad password read\n");
goto end;
}
}
} else {
#endif
BIO_printf(bio_err, "password required\n");
BIO_puts(bio_err, "password required\n");
goto end;
}
}
@ -583,13 +584,13 @@ int enc_main(int argc, char **argv)
sptr = NULL;
} else {
if (hsalt != NULL && !set_hex(hsalt, salt, saltlen)) {
BIO_printf(bio_err, "invalid hex salt value\n");
BIO_puts(bio_err, "invalid hex salt value\n");
goto end;
}
if (enc) { /* encryption */
if (hsalt == NULL) {
if (RAND_bytes(salt, saltlen) <= 0) {
BIO_printf(bio_err, "RAND_bytes failed\n");
BIO_puts(bio_err, "RAND_bytes failed\n");
goto end;
}
/*
@ -604,25 +605,25 @@ int enc_main(int argc, char **argv)
(char *)salt,
saltlen)
!= saltlen)) {
BIO_printf(bio_err, "error writing output file\n");
BIO_puts(bio_err, "error writing output file\n");
goto end;
}
}
} else { /* decryption */
if (hsalt == NULL) {
if (BIO_read(rbio, mbuf, sizeof(mbuf)) != sizeof(mbuf)) {
BIO_printf(bio_err, "error reading input file\n");
BIO_puts(bio_err, "error reading input file\n");
goto end;
}
if (memcmp(mbuf, magic, sizeof(mbuf)) == 0) { /* file IS salted */
if (BIO_read(rbio, salt,
saltlen)
!= saltlen) {
BIO_printf(bio_err, "error reading input file\n");
BIO_puts(bio_err, "error reading input file\n");
goto end;
}
} else { /* file is NOT salted, NO salt available */
BIO_printf(bio_err, "bad magic number\n");
BIO_puts(bio_err, "bad magic number\n");
goto end;
}
}
@ -643,7 +644,7 @@ int enc_main(int argc, char **argv)
if (!PKCS5_PBKDF2_HMAC(str, (int)str_len, sptr, islen,
iter, dgst, iklen + ivlen, tmpkeyiv)) {
BIO_printf(bio_err, "PKCS5_PBKDF2_HMAC failed\n");
BIO_puts(bio_err, "PKCS5_PBKDF2_HMAC failed\n");
goto end;
}
/* split and move data back to global buffer */
@ -651,13 +652,13 @@ int enc_main(int argc, char **argv)
memcpy(iv, tmpkeyiv + iklen, ivlen);
rawkey_set = 1;
} else {
BIO_printf(bio_err, "*** WARNING : "
"deprecated key derivation used.\n"
"Using -iter or -pbkdf2 would be better.\n");
BIO_puts(bio_err, "*** WARNING : "
"deprecated key derivation used.\n"
"Using -iter or -pbkdf2 would be better.\n");
if (!EVP_BytesToKey(cipher, dgst, sptr,
(unsigned char *)str, (int)str_len,
1, key, iv)) {
BIO_printf(bio_err, "EVP_BytesToKey failed\n");
BIO_puts(bio_err, "EVP_BytesToKey failed\n");
goto end;
}
rawkey_set = 1;
@ -675,9 +676,9 @@ int enc_main(int argc, char **argv)
int siz = EVP_CIPHER_get_iv_length(cipher);
if (siz == 0) {
BIO_printf(bio_err, "warning: iv not used by this cipher\n");
BIO_puts(bio_err, "warning: iv not used by this cipher\n");
} else if (!set_hex(hiv, iv, siz)) {
BIO_printf(bio_err, "invalid hex iv value\n");
BIO_puts(bio_err, "invalid hex iv value\n");
goto end;
}
}
@ -688,12 +689,12 @@ int enc_main(int argc, char **argv)
* No IV was explicitly set and no IV was generated.
* Hence the IV is undefined, making correct decryption impossible.
*/
BIO_printf(bio_err, "iv undefined\n");
BIO_puts(bio_err, "iv undefined\n");
goto end;
}
if (hkey != NULL) {
if (!set_hex(hkey, key, EVP_CIPHER_get_key_length(cipher))) {
BIO_printf(bio_err, "invalid hex key value\n");
BIO_puts(bio_err, "invalid hex key value\n");
goto end;
}
/* wiping secret data as we no longer need it */
@ -706,7 +707,7 @@ int enc_main(int argc, char **argv)
* or an opaque symmetric key. We do not allow both options simultaneously.
*/
if (rawkey_set > 0 && (skeyopts != NULL || skeyuri != NULL)) {
BIO_printf(bio_err, "Either a raw key or the skeyopt/skeyuri args must be used.\n");
BIO_puts(bio_err, "Either a raw key or the skeyopt/skeyuri args must be used.\n");
goto end;
}
@ -735,7 +736,7 @@ int enc_main(int argc, char **argv)
char *storepass = NULL;
if (!app_passwd(storepassarg, NULL, &storepass, NULL)) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"Error getting store password from 'storepass' argument\n");
}
@ -749,7 +750,7 @@ int enc_main(int argc, char **argv)
skey = skey_from_params(cipher, skeymgmt, skeyopts);
if (skey == NULL) {
BIO_printf(bio_err, "Error creating opaque key object for skeymgmt %s\n",
skeymgmt ? skeymgmt : EVP_CIPHER_name(cipher));
skeymgmt ? skeymgmt : EVP_CIPHER_name(cipher));
goto end;
}
}
@ -806,11 +807,11 @@ int enc_main(int argc, char **argv)
if (inl <= 0)
break;
if (!streamable && !BIO_eof(rbio)) { /* do not output data */
BIO_printf(bio_err, "Unstreamable cipher mode\n");
BIO_puts(bio_err, "Unstreamable cipher mode\n");
goto end;
}
if (BIO_write(wbio, (char *)buff, inl) != inl) {
BIO_printf(bio_err, "error writing output file\n");
BIO_puts(bio_err, "error writing output file\n");
goto end;
}
if (!streamable)
@ -818,16 +819,17 @@ int enc_main(int argc, char **argv)
}
if (!BIO_flush(wbio)) {
if (enc)
BIO_printf(bio_err, "bad encrypt\n");
BIO_puts(bio_err, "bad encrypt\n");
else
BIO_printf(bio_err, "bad decrypt\n");
BIO_puts(bio_err, "bad decrypt\n");
goto end;
}
ret = 0;
if (verbose) {
BIO_printf(bio_err, "bytes read : %8ju\n", BIO_number_read(in));
BIO_printf(bio_err, "bytes written: %8ju\n", BIO_number_written(out));
BIO_printf(bio_err, "bytes read : %8" PRIu64 "\n"
"bytes written: %8" PRIu64 "\n",
BIO_number_read(in), BIO_number_written(out));
}
end:
ERR_print_errors(bio_err);
@ -853,25 +855,29 @@ end:
static void show_ciphers(const OBJ_NAME *name, void *arg)
{
struct doall_enc_ciphers *dec = (struct doall_enc_ciphers *)arg;
const EVP_CIPHER *cipher;
EVP_CIPHER *cipher;
if (!islower((unsigned char)*name->name))
return;
/* Filter out ciphers that we cannot use */
cipher = EVP_get_cipherbyname(name->name);
cipher = EVP_CIPHER_fetch(app_get0_libctx(), name->name, app_get0_propq());
if (cipher == NULL
|| (EVP_CIPHER_get_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) != 0
|| (EVP_CIPHER_get_flags(cipher) & EVP_CIPH_FLAG_ENC_THEN_MAC) != 0
|| EVP_CIPHER_get_mode(cipher) == EVP_CIPH_XTS_MODE)
|| EVP_CIPHER_get_mode(cipher) == EVP_CIPH_XTS_MODE) {
EVP_CIPHER_free(cipher);
return;
}
BIO_printf(dec->bio, "-%-25s", name->name);
if (++dec->n == 3) {
BIO_printf(dec->bio, "\n");
BIO_puts(dec->bio, "\n");
dec->n = 0;
} else
BIO_printf(dec->bio, " ");
BIO_puts(dec->bio, " ");
EVP_CIPHER_free(cipher);
}
static int set_hex(const char *in, unsigned char *out, int size)
@ -882,17 +888,17 @@ static int set_hex(const char *in, unsigned char *out, int size)
i = size * 2;
n = (int)strlen(in);
if (n > i) {
BIO_printf(bio_err, "hex string is too long, ignoring excess\n");
BIO_puts(bio_err, "hex string is too long, ignoring excess\n");
n = i; /* ignore exceeding part */
} else if (n < i) {
BIO_printf(bio_err, "hex string is too short, padding with zero bytes to length\n");
BIO_puts(bio_err, "hex string is too short, padding with zero bytes to length\n");
}
memset(out, 0, size);
for (i = 0; i < n; i++) {
j = (unsigned char)*in++;
if (!isxdigit(j)) {
BIO_printf(bio_err, "non-hex digit\n");
BIO_puts(bio_err, "non-hex digit\n");
return 0;
}
j = (unsigned char)OPENSSL_hexchar2int(j);

View file

@ -1,5 +1,5 @@
/*
* Copyright 2019-2025 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2019-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -77,7 +77,8 @@ typedef enum OPTION_choice {
OPT_NO_PBKDF2_LOWER_BOUND_CHECK,
OPT_ECDH_COFACTOR_CHECK,
OPT_SELF_TEST_ONLOAD,
OPT_SELF_TEST_ONINSTALL
OPT_SELF_TEST_ONINSTALL,
OPT_DEFER_TESTS
} OPTION_CHOICE;
const OPTIONS fipsinstall_options[] = {
@ -150,6 +151,7 @@ const OPTIONS fipsinstall_options[] = {
"Disable lower bound check for PBKDF2" },
{ "ecdh_cofactor_check", OPT_ECDH_COFACTOR_CHECK, '-',
"Enable Cofactor check for ECDH" },
{ "defer_tests", OPT_DEFER_TESTS, '-', "Enables test deferral" },
OPT_SECTION("Input"),
{ "in", OPT_IN, '<', "Input config file, used when verifying" },
@ -197,6 +199,7 @@ typedef struct {
unsigned int x942kdf_key_check : 1;
unsigned int pbkdf2_lower_bound_check : 1;
unsigned int ecdh_cofactor_check : 1;
unsigned int defer_tests : 1;
} FIPS_OPTS;
/* Pedantic FIPS compliance */
@ -231,6 +234,7 @@ static const FIPS_OPTS pedantic_opts = {
1, /* x942kdf_key_check */
1, /* pbkdf2_lower_bound_check */
1, /* ecdh_cofactor_check */
0, /* defer_tests */
};
/* Default FIPS settings for backward compatibility */
@ -265,6 +269,7 @@ static FIPS_OPTS fips_opts = {
0, /* x942kdf_key_check */
1, /* pbkdf2_lower_bound_check */
0, /* ecdh_cofactor_check */
0, /* defer_tests */
};
static int check_non_pedantic_fips(int pedantic, const char *name)
@ -309,7 +314,7 @@ static int load_fips_prov_and_run_self_test(const char *prov_name,
prov = OSSL_PROVIDER_load(NULL, prov_name);
if (prov == NULL) {
BIO_printf(bio_err, "Failed to load FIPS module\n");
BIO_puts(bio_err, "Failed to load FIPS module\n");
goto end;
}
if (!quiet) {
@ -321,7 +326,7 @@ static int load_fips_prov_and_run_self_test(const char *prov_name,
&build, sizeof(build));
*p = OSSL_PARAM_construct_end();
if (!OSSL_PROVIDER_get_params(prov, params)) {
BIO_printf(bio_err, "Failed to query FIPS module parameters\n");
BIO_puts(bio_err, "Failed to query FIPS module parameters\n");
goto end;
}
if (OSSL_PARAM_modified(params))
@ -335,7 +340,7 @@ static int load_fips_prov_and_run_self_test(const char *prov_name,
&vers, sizeof(vers));
*p = OSSL_PARAM_construct_end();
if (!OSSL_PROVIDER_get_params(prov, params)) {
BIO_printf(bio_err, "Failed to query FIPS module parameters\n");
BIO_puts(bio_err, "Failed to query FIPS module parameters\n");
goto end;
}
}
@ -363,11 +368,13 @@ static int print_mac(BIO *bio, const char *label, const unsigned char *mac,
static int write_config_header(BIO *out, const char *prov_name,
const char *section)
{
return BIO_printf(out, "openssl_conf = openssl_init\n\n")
&& BIO_printf(out, "[openssl_init]\n")
&& BIO_printf(out, "providers = provider_section\n\n")
&& BIO_printf(out, "[provider_section]\n")
&& BIO_printf(out, "%s = %s\n\n", prov_name, section);
return (BIO_printf(out, "openssl_conf = openssl_init\n\n"
"[openssl_init]\n"
"providers = provider_section\n\n"
"[provider_section]\n"
"%s = %s\n\n",
prov_name, section)
> 0);
}
/*
@ -386,109 +393,75 @@ static int write_config_fips_section(BIO *out, const char *section,
{
int ret = 0;
if (BIO_printf(out, "[%s]\n", section) <= 0
|| BIO_printf(out, "activate = 1\n") <= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_FIPS_PARAM_INSTALL_VERSION,
VERSION_VAL)
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_FIPS_PARAM_CONDITIONAL_ERRORS,
opts->conditional_errors ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_SECURITY_CHECKS,
opts->security_checks ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_HMAC_KEY_CHECK,
opts->hmac_key_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_KMAC_KEY_CHECK,
opts->kmac_key_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_TLS1_PRF_EMS_CHECK,
opts->tls_prf_ems_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_NO_SHORT_MAC,
opts->no_short_mac ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_DRBG_TRUNC_DIGEST,
opts->drgb_no_trunc_dgst ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_SIGNATURE_DIGEST_CHECK,
opts->signature_digest_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_HKDF_DIGEST_CHECK,
opts->hkdf_digest_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n",
OSSL_PROV_PARAM_TLS13_KDF_DIGEST_CHECK,
opts->tls13_kdf_digest_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n",
OSSL_PROV_PARAM_TLS1_PRF_DIGEST_CHECK,
opts->tls1_prf_digest_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n",
OSSL_PROV_PARAM_SSHKDF_DIGEST_CHECK,
opts->sshkdf_digest_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_SSKDF_DIGEST_CHECK,
opts->sskdf_digest_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n",
OSSL_PROV_PARAM_X963KDF_DIGEST_CHECK,
opts->x963kdf_digest_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_DSA_SIGN_DISABLED,
opts->dsa_sign_disabled ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_TDES_ENCRYPT_DISABLED,
opts->tdes_encrypt_disabled ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n",
OSSL_PROV_PARAM_RSA_PKCS15_PAD_DISABLED,
opts->rsa_pkcs15_padding_disabled ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n",
OSSL_PROV_PARAM_RSA_PSS_SALTLEN_CHECK,
opts->rsa_pss_saltlen_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n",
OSSL_PROV_PARAM_RSA_SIGN_X931_PAD_DISABLED,
opts->sign_x931_padding_disabled ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_HKDF_KEY_CHECK,
opts->hkdf_key_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_KBKDF_KEY_CHECK,
opts->kbkdf_key_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n",
OSSL_PROV_PARAM_TLS13_KDF_KEY_CHECK,
opts->tls13_kdf_key_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_TLS1_PRF_KEY_CHECK,
opts->tls1_prf_key_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_SSHKDF_KEY_CHECK,
opts->sshkdf_key_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_SSKDF_KEY_CHECK,
opts->sskdf_key_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_X963KDF_KEY_CHECK,
opts->x963kdf_key_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_X942KDF_KEY_CHECK,
opts->x942kdf_key_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n",
OSSL_PROV_PARAM_PBKDF2_LOWER_BOUND_CHECK,
opts->pbkdf2_lower_bound_check ? "1" : "0")
<= 0
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_ECDH_COFACTOR_CHECK,
opts->ecdh_cofactor_check ? "1" : "0")
if (BIO_printf(out, "[%s]\n"
"activate = 1\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n"
"%s = %s\n",
section,
OSSL_PROV_FIPS_PARAM_INSTALL_VERSION, VERSION_VAL,
OSSL_PROV_FIPS_PARAM_CONDITIONAL_ERRORS, opts->conditional_errors ? "1" : "0",
OSSL_PROV_PARAM_SECURITY_CHECKS, opts->security_checks ? "1" : "0",
OSSL_PROV_PARAM_HMAC_KEY_CHECK, opts->hmac_key_check ? "1" : "0",
OSSL_PROV_PARAM_KMAC_KEY_CHECK, opts->kmac_key_check ? "1" : "0",
OSSL_PROV_PARAM_TLS1_PRF_EMS_CHECK, opts->tls_prf_ems_check ? "1" : "0",
OSSL_PROV_PARAM_NO_SHORT_MAC, opts->no_short_mac ? "1" : "0",
OSSL_PROV_PARAM_DRBG_TRUNC_DIGEST, opts->drgb_no_trunc_dgst ? "1" : "0",
OSSL_PROV_PARAM_SIGNATURE_DIGEST_CHECK, opts->signature_digest_check ? "1" : "0",
OSSL_PROV_PARAM_HKDF_DIGEST_CHECK, opts->hkdf_digest_check ? "1" : "0",
OSSL_PROV_PARAM_TLS13_KDF_DIGEST_CHECK, opts->tls13_kdf_digest_check ? "1" : "0",
OSSL_PROV_PARAM_TLS1_PRF_DIGEST_CHECK, opts->tls1_prf_digest_check ? "1" : "0",
OSSL_PROV_PARAM_SSHKDF_DIGEST_CHECK, opts->sshkdf_digest_check ? "1" : "0",
OSSL_PROV_PARAM_SSKDF_DIGEST_CHECK, opts->sskdf_digest_check ? "1" : "0",
OSSL_PROV_PARAM_X963KDF_DIGEST_CHECK, opts->x963kdf_digest_check ? "1" : "0",
OSSL_PROV_PARAM_DSA_SIGN_DISABLED, opts->dsa_sign_disabled ? "1" : "0",
OSSL_PROV_PARAM_TDES_ENCRYPT_DISABLED, opts->tdes_encrypt_disabled ? "1" : "0",
OSSL_PROV_PARAM_RSA_PKCS15_PAD_DISABLED, opts->rsa_pkcs15_padding_disabled ? "1" : "0",
OSSL_PROV_PARAM_RSA_PSS_SALTLEN_CHECK, opts->rsa_pss_saltlen_check ? "1" : "0",
OSSL_PROV_PARAM_RSA_SIGN_X931_PAD_DISABLED, opts->sign_x931_padding_disabled ? "1" : "0",
OSSL_PROV_PARAM_HKDF_KEY_CHECK, opts->hkdf_key_check ? "1" : "0",
OSSL_PROV_PARAM_KBKDF_KEY_CHECK, opts->kbkdf_key_check ? "1" : "0",
OSSL_PROV_PARAM_TLS13_KDF_KEY_CHECK, opts->tls13_kdf_key_check ? "1" : "0",
OSSL_PROV_PARAM_TLS1_PRF_KEY_CHECK, opts->tls1_prf_key_check ? "1" : "0",
OSSL_PROV_PARAM_SSHKDF_KEY_CHECK, opts->sshkdf_key_check ? "1" : "0",
OSSL_PROV_PARAM_SSKDF_KEY_CHECK, opts->sskdf_key_check ? "1" : "0",
OSSL_PROV_PARAM_X963KDF_KEY_CHECK, opts->x963kdf_key_check ? "1" : "0",
OSSL_PROV_PARAM_X942KDF_KEY_CHECK, opts->x942kdf_key_check ? "1" : "0",
OSSL_PROV_PARAM_PBKDF2_LOWER_BOUND_CHECK, opts->pbkdf2_lower_bound_check ? "1" : "0",
OSSL_PROV_PARAM_ECDH_COFACTOR_CHECK, opts->ecdh_cofactor_check ? "1" : "0")
<= 0
|| !print_mac(out, OSSL_PROV_FIPS_PARAM_MODULE_MAC, module_mac,
module_mac_len))
module_mac_len)
|| BIO_printf(out, "%s = %s\n", OSSL_PROV_FIPS_PARAM_DEFER_TESTS,
opts->defer_tests ? "1" : "0")
<= 0)
goto end;
if (install_mac != NULL
@ -572,37 +545,37 @@ static int verify_config(const char *infile, const char *section,
s = NCONF_get_string(conf, section, OSSL_PROV_FIPS_PARAM_INSTALL_VERSION);
if (s == NULL || strcmp(s, VERSION_VAL) != 0) {
BIO_printf(bio_err, "version not found\n");
BIO_puts(bio_err, "version not found\n");
goto end;
}
s = NCONF_get_string(conf, section, OSSL_PROV_FIPS_PARAM_MODULE_MAC);
if (s == NULL) {
BIO_printf(bio_err, "Module integrity MAC not found\n");
BIO_puts(bio_err, "Module integrity MAC not found\n");
goto end;
}
buf1 = OPENSSL_hexstr2buf(s, &len);
if (buf1 == NULL
|| (size_t)len != module_mac_len
|| memcmp(module_mac, buf1, module_mac_len) != 0) {
BIO_printf(bio_err, "Module integrity mismatch\n");
BIO_puts(bio_err, "Module integrity mismatch\n");
goto end;
}
if (install_mac != NULL && install_mac_len > 0) {
s = NCONF_get_string(conf, section, OSSL_PROV_FIPS_PARAM_INSTALL_STATUS);
if (s == NULL || strcmp(s, INSTALL_STATUS_VAL) != 0) {
BIO_printf(bio_err, "install status not found\n");
BIO_puts(bio_err, "install status not found\n");
goto end;
}
s = NCONF_get_string(conf, section, OSSL_PROV_FIPS_PARAM_INSTALL_MAC);
if (s == NULL) {
BIO_printf(bio_err, "Install indicator MAC not found\n");
BIO_puts(bio_err, "Install indicator MAC not found\n");
goto end;
}
buf2 = OPENSSL_hexstr2buf(s, &len);
if (buf2 == NULL
|| (size_t)len != install_mac_len
|| memcmp(install_mac, buf2, install_mac_len) != 0) {
BIO_printf(bio_err, "Install indicator status mismatch\n");
BIO_puts(bio_err, "Install indicator status mismatch\n");
goto end;
}
}
@ -802,6 +775,9 @@ int fipsinstall_main(int argc, char **argv)
set_selftest_onload_option = 1;
fips_opts.self_test_onload = 0;
break;
case OPT_DEFER_TESTS:
fips_opts.defer_tests = 1;
break;
}
}
@ -850,7 +826,7 @@ int fipsinstall_main(int argc, char **argv)
module_bio = bio_open_default(module_fname, 'r', FORMAT_BINARY);
if (module_bio == NULL) {
BIO_printf(bio_err, "Failed to open module file\n");
BIO_puts(bio_err, "Failed to open module file\n");
goto end;
}
@ -866,7 +842,7 @@ int fipsinstall_main(int argc, char **argv)
ctx = EVP_MAC_CTX_new(mac);
if (ctx == NULL) {
BIO_printf(bio_err, "Unable to create MAC CTX for module check\n");
BIO_puts(bio_err, "Unable to create MAC CTX for module check\n");
goto end;
}
@ -878,7 +854,7 @@ int fipsinstall_main(int argc, char **argv)
goto end;
if (!EVP_MAC_CTX_set_params(ctx, params)) {
BIO_printf(bio_err, "MAC parameter error\n");
BIO_puts(bio_err, "MAC parameter error\n");
ERR_print_errors(bio_err);
ok = 0;
}
@ -889,7 +865,7 @@ int fipsinstall_main(int argc, char **argv)
ctx2 = EVP_MAC_CTX_dup(ctx);
if (ctx2 == NULL) {
BIO_printf(bio_err, "Unable to create MAC CTX for install indicator\n");
BIO_puts(bio_err, "Unable to create MAC CTX for install indicator\n");
goto end;
}
@ -900,7 +876,7 @@ int fipsinstall_main(int argc, char **argv)
mem_bio = BIO_new_mem_buf((const void *)INSTALL_STATUS_VAL,
(int)strlen(INSTALL_STATUS_VAL));
if (mem_bio == NULL) {
BIO_printf(bio_err, "Unable to create memory BIO\n");
BIO_puts(bio_err, "Unable to create memory BIO\n");
goto end;
}
if (!do_mac(ctx2, read_buffer, mem_bio, install_mac, &install_mac_len))
@ -913,7 +889,7 @@ int fipsinstall_main(int argc, char **argv)
install_mac, install_mac_len))
goto end;
if (!quiet)
BIO_printf(bio_err, "VERIFY PASSED\n");
BIO_puts(bio_err, "VERIFY PASSED\n");
} else {
conf = generate_config_and_load(prov_name, section_name, module_mac,
module_mac_len, &fips_opts);
@ -936,7 +912,7 @@ int fipsinstall_main(int argc, char **argv)
fout = out_fname == NULL ? dup_bio_out(FORMAT_TEXT)
: bio_open_default(out_fname, 'w', FORMAT_TEXT);
if (fout == NULL) {
BIO_printf(bio_err, "Failed to open file\n");
BIO_puts(bio_err, "Failed to open file\n");
goto end;
}
@ -945,7 +921,7 @@ int fipsinstall_main(int argc, char **argv)
install_mac, install_mac_len))
goto end;
if (!quiet)
BIO_printf(bio_err, "INSTALL PASSED\n");
BIO_puts(bio_err, "INSTALL PASSED\n");
}
ret = 0;

View file

@ -1,5 +1,5 @@
/*
* Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -117,7 +117,7 @@ int gendsa_main(int argc, char **argv)
private = 1;
if (!app_passwd(NULL, passoutarg, NULL, &passout)) {
BIO_printf(bio_err, "Error getting password\n");
BIO_puts(bio_err, "Error getting password\n");
goto end;
}
@ -136,13 +136,13 @@ int gendsa_main(int argc, char **argv)
ctx = EVP_PKEY_CTX_new_from_pkey(app_get0_libctx(), pkey, app_get0_propq());
if (ctx == NULL) {
BIO_printf(bio_err, "unable to create PKEY context\n");
BIO_puts(bio_err, "unable to create PKEY context\n");
goto end;
}
EVP_PKEY_free(pkey);
pkey = NULL;
if (EVP_PKEY_keygen_init(ctx) <= 0) {
BIO_printf(bio_err, "unable to set up for key generation\n");
BIO_puts(bio_err, "unable to set up for key generation\n");
goto end;
}
pkey = app_keygen(ctx, "DSA", nbits, verbose);
@ -151,7 +151,7 @@ int gendsa_main(int argc, char **argv)
assert(private);
if (!PEM_write_bio_PrivateKey(out, pkey, enc, NULL, 0, NULL, passout)) {
BIO_printf(bio_err, "unable to output generated key\n");
BIO_puts(bio_err, "unable to output generated key\n");
goto end;
}
ret = 0;

View file

@ -1,5 +1,5 @@
/*
* Copyright 2006-2025 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2006-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -22,6 +22,7 @@ static int init_keygen_file(EVP_PKEY_CTX **pctx, const char *file,
typedef enum OPTION_choice {
OPT_COMMON,
OPT_OUTFORM,
OPT_ENCOPT,
OPT_OUT,
OPT_PASS,
OPT_PARAMFILE,
@ -53,6 +54,7 @@ const OPTIONS genpkey_options[] = {
{ "out", OPT_OUT, '>', "Output (private key) file" },
{ "outpubkey", OPT_OUTPUBKEY, '>', "Output public key file" },
{ "outform", OPT_OUTFORM, 'F', "output format (DER or PEM)" },
{ "encopt", OPT_ENCOPT, 's', "Private key encoder parameter" },
{ "pass", OPT_PASS, 's', "Output file pass phrase source" },
{ "genparam", OPT_GENPARAM, '-', "Generate parameters, not key" },
{ "text", OPT_TEXT, '-', "Print the private key in text" },
@ -106,7 +108,7 @@ static void show_gen_pkeyopt(const char *algname, OSSL_LIB_CTX *libctx, const ch
if (params == NULL)
goto cleanup;
BIO_printf(bio_err, "\nThe possible -pkeyopt arguments are:\n");
BIO_puts(bio_err, "\nThe possible -pkeyopt arguments are:\n");
for (i = 0; params[i].key != NULL; ++i) {
const char *name = param_datatype_2name(params[i].data_type, &ishex);
@ -130,6 +132,7 @@ int genpkey_main(int argc, char **argv)
OPTION_CHOICE o;
int outformat = FORMAT_PEM, text = 0, ret = 1, rv, do_param = 0;
int private = 0, i;
STACK_OF(OPENSSL_STRING) *encopt = NULL;
OSSL_LIB_CTX *libctx = app_get0_libctx();
STACK_OF(OPENSSL_STRING) *keyopt = NULL;
@ -154,6 +157,12 @@ int genpkey_main(int argc, char **argv)
if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &outformat))
goto opthelp;
break;
case OPT_ENCOPT:
if (encopt == NULL)
encopt = sk_OPENSSL_STRING_new_null();
if (!sk_OPENSSL_STRING_push(encopt, opt_arg()))
goto end;
break;
case OPT_OUT:
outfile = opt_arg();
break;
@ -236,7 +245,7 @@ int genpkey_main(int argc, char **argv)
if (!opt_cipher(ciphername, &cipher))
goto opthelp;
if (ciphername != NULL && do_param == 1) {
BIO_printf(bio_err, "Cannot use cipher with -genparam option\n");
BIO_puts(bio_err, "Cannot use cipher with -genparam option\n");
goto opthelp;
}
@ -272,16 +281,16 @@ int genpkey_main(int argc, char **argv)
rv = PEM_write_bio_Parameters(mem_out, pkey);
} else if (outformat == FORMAT_PEM) {
assert(private);
rv = PEM_write_bio_PrivateKey(mem_out, pkey, cipher, NULL, 0, NULL, pass);
rv = encode_private_key(mem_out, "PEM", pkey, encopt, cipher, pass);
if (rv > 0 && mem_outpubkey != NULL)
rv = PEM_write_bio_PUBKEY(mem_outpubkey, pkey);
} else if (outformat == FORMAT_ASN1) {
assert(private);
rv = i2d_PrivateKey_bio(mem_out, pkey);
rv = encode_private_key(mem_out, "DER", pkey, encopt, cipher, pass);
if (rv > 0 && mem_outpubkey != NULL)
rv = i2d_PUBKEY_bio(mem_outpubkey, pkey);
} else {
BIO_printf(bio_err, "Bad format specified for key\n");
BIO_puts(bio_err, "Bad format specified for key\n");
goto end;
}
@ -322,6 +331,7 @@ end:
outfile, strerror(errno));
}
}
sk_OPENSSL_STRING_free(encopt);
EVP_PKEY_free(pkey);
EVP_PKEY_CTX_free(ctx);
EVP_CIPHER_free(cipher);

View file

@ -1,5 +1,5 @@
/*
* Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -171,7 +171,7 @@ int genrsa_main(int argc, char **argv)
if (!opt_cipher(ciphername, &enc))
goto end;
if (!app_passwd(NULL, passoutarg, NULL, &passout)) {
BIO_printf(bio_err, "Error getting password\n");
BIO_puts(bio_err, "Error getting password\n");
goto end;
}
@ -188,19 +188,19 @@ int genrsa_main(int argc, char **argv)
EVP_PKEY_CTX_set_app_data(ctx, bio_err);
if (EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, num) <= 0) {
BIO_printf(bio_err, "Error setting RSA length\n");
BIO_puts(bio_err, "Error setting RSA length\n");
goto end;
}
if (!BN_set_word(bn, f4)) {
BIO_printf(bio_err, "Error allocating RSA public exponent\n");
BIO_puts(bio_err, "Error allocating RSA public exponent\n");
goto end;
}
if (EVP_PKEY_CTX_set1_rsa_keygen_pubexp(ctx, bn) <= 0) {
BIO_printf(bio_err, "Error setting RSA public exponent\n");
BIO_puts(bio_err, "Error setting RSA public exponent\n");
goto end;
}
if (EVP_PKEY_CTX_set_rsa_keygen_primes(ctx, primes) <= 0) {
BIO_printf(bio_err, "Error setting number of primes\n");
BIO_puts(bio_err, "Error setting number of primes\n");
goto end;
}
pkey = app_keygen(ctx, "RSA", num, verbose);
@ -213,7 +213,7 @@ int genrsa_main(int argc, char **argv)
/* Every RSA key has an 'e' */
EVP_PKEY_get_bn_param(pkey, "e", &e);
if (e == NULL) {
BIO_printf(bio_err, "Error cannot access RSA e\n");
BIO_puts(bio_err, "Error cannot access RSA e\n");
goto end;
}
hexe = BN_bn2hex(e);

View file

@ -7,7 +7,12 @@
* https://www.openssl.org/source/license.html
*/
#if !defined(OSSL_APPS_INCLUDE_APP_PARAMS_H)
#define OSSL_APPS_INCLUDE_APP_PARAMS_H
#include <openssl/core.h>
int print_param_types(const char *thing, const OSSL_PARAM *pdefs, int indent);
void print_param_value(const OSSL_PARAM *p, int indent);
#endif /* !defined(OSSL_APPS_INCLUDE_APP_PARAMS_H) */

View file

@ -1,5 +1,5 @@
/*
* Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -10,6 +10,16 @@
#ifndef OSSL_APPS_H
#define OSSL_APPS_H
#if defined(__linux__) || defined(__sun__) || defined(__hpux)
/*
* Allow open() and stat() to work with files larger than 2GB on 32-bit
* systems. See crypto/o_fopen.c and crypto/bio/bss_file.c.
*/
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
#endif
#include "internal/common.h" /* for HAS_PREFIX */
#include "internal/nelem.h"
#include <assert.h>
@ -22,6 +32,19 @@
#endif
#include <openssl/e_os2.h>
#if defined(OPENSSL_SYS_UNIX) && defined(_POSIX_MAPPED_FILES) && _POSIX_MAPPED_FILES > 0
#include <sys/mman.h>
#include <unistd.h>
/*
* Map a file read-only into memory. Returns 1 on success (*out_data and
* *out_size set; caller must munmap when done), 0 when file size is 0 (no
* error, caller may use buffer path), or -1 on error (message printed to
* bio_err). known_size: (size_t)-1 = stat to get size; 0 = do not map
* (return 0); > 0 = use this size (caller obtained it from stat of same path).
*/
int app_mmap_file(const char *path, BIO *err_bio, size_t known_size,
const unsigned char **out_data, size_t *out_size);
#endif
#include <openssl/types.h>
#include <openssl/bio.h>
#include <openssl/x509.h>
@ -78,7 +101,7 @@ void wait_for_async(SSL *s);
int has_stdin_waiting(void);
#endif
void corrupt_signature(const ASN1_STRING *signature);
int corrupt_signature(ASN1_STRING *signature);
/* Helpers for setting X509v3 certificate fields notBefore and notAfter */
int check_cert_time_string(const char *time, const char *desc);
@ -102,6 +125,10 @@ int wrap_password_callback(char *buf, int bufsiz, int verify, void *cb_data);
int progress_cb(EVP_PKEY_CTX *ctx);
void dump_cert_text(BIO *out, X509 *x);
int encode_private_key(
BIO *out, const char *output_type, const EVP_PKEY *pkey,
const STACK_OF(OPENSSL_STRING) *encopt, const EVP_CIPHER *cipher,
const char *pass);
void print_name(BIO *out, const char *title, const X509_NAME *nm);
void print_bignum_var(BIO *, const BIGNUM *, const char *,
int, unsigned char *);
@ -141,11 +168,10 @@ char *process_additional_mac_key_arguments(const char *arg);
char *get_str_from_file(const char *filename);
int load_cert_certs(const char *uri,
X509 **pcert, STACK_OF(X509) **pcerts,
int exclude_http, const char *pass, const char *desc,
X509_VERIFY_PARAM *vpm);
STACK_OF(X509) *load_certs_multifile(char *files, const char *pass,
int exclude_http, const char *pass, const char *desc, X509_VERIFY_PARAM *vpm);
STACK_OF(X509) *load_certs_multifile(char *files, const char *source,
const char *desc, X509_VERIFY_PARAM *vpm);
X509_STORE *load_certstore(char *input, const char *pass, const char *desc,
X509_STORE *load_certstore(char *input, const char *source, const char *desc,
X509_VERIFY_PARAM *vpm);
int load_certs(const char *uri, int maybe_stdin, STACK_OF(X509) **certs,
const char *pass, const char *desc);
@ -160,6 +186,7 @@ int load_key_certs_crls(const char *uri, int format, int maybe_stdin,
EVP_SKEY **pskey);
EVP_SKEY *load_skey(const char *uri, int format, int maybe_stdin,
const char *pass, int quiet);
int load_rpk_file(SSL *ssl, const char *file);
X509_STORE *setup_verify(const char *CAfile, int noCAfile,
const char *CApath, int noCApath,
const char *CAstore, int noCAstore);
@ -216,7 +243,7 @@ typedef struct ca_db_st {
#endif
} CA_DB;
extern int do_updatedb(CA_DB *db, time_t *now);
extern int do_updatedb(CA_DB *db, const time_t *now);
void app_bail_out(char *fmt, ...);
/**
@ -264,7 +291,7 @@ int parse_yesno(const char *str, int def);
X509_NAME *parse_name(const char *str, int chtype, int multirdn,
const char *desc);
void policies_print(X509_STORE_CTX *ctx);
int bio_to_mem(unsigned char **out, int maxlen, BIO *in);
int bio_to_mem(unsigned char **out, size_t *outlen, size_t maxlen, BIO *in);
int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value);
int x509_ctrl_string(X509 *x, const char *value);
int x509_req_ctrl_string(X509_REQ *x, const char *value);
@ -272,6 +299,10 @@ int init_gen_str(EVP_PKEY_CTX **pctx,
const char *algname, int do_param,
OSSL_LIB_CTX *libctx, const char *propq);
int cert_matches_key(const X509 *cert, const EVP_PKEY *pkey);
int do_EXT_add_nconf(CONF *conf1, CONF *conf2, X509V3_CTX *ctx,
X509 *cert, const char *msg, const char *sect);
int do_EXT_REQ_add_nconf(CONF *conf1, CONF *conf2, X509V3_CTX *ctx,
X509_REQ *req, const char *msg, const char *sect);
int do_X509_sign(X509 *x, int force_v1, EVP_PKEY *pkey, const char *md,
STACK_OF(OPENSSL_STRING) *sigopts, X509V3_CTX *ext_ctx);
int do_X509_verify(X509 *x, EVP_PKEY *pkey, STACK_OF(OPENSSL_STRING) *vfyopts);
@ -286,12 +317,14 @@ extern char *psk_key;
unsigned char *next_protos_parse(size_t *outlen, const char *in);
int check_cert_attributes(BIO *bio, X509 *x,
int check_cert_might_be_valid(BIO *bio, BIO *bio_err, X509 *x,
const char *checkhost, const char *checkemail,
const char *checkip, int print);
const char *checkip);
void store_setup_crl_download(X509_STORE *st);
int host_is_ip_address(const char *host);
typedef struct app_http_tls_info_st {
const char *server;
const char *port;

View file

@ -10,6 +10,9 @@
#ifndef OSSL_APPS_UI_H
#define OSSL_APPS_UI_H
#include <openssl/types.h>
#include <openssl/ui.h>
#define PW_MIN_LENGTH 4
typedef struct pw_cb_data {
const void *password;

View file

@ -19,6 +19,8 @@
OSSL_CMP_SRV_CTX *ossl_cmp_mock_srv_new(OSSL_LIB_CTX *libctx,
const char *propq);
void ossl_cmp_mock_srv_free(OSSL_CMP_SRV_CTX *srv_ctx);
OSSL_CMP_MSG *ossl_cmp_mock_server_perform(OSSL_CMP_CTX *ctx,
const OSSL_CMP_MSG *req);
int ossl_cmp_mock_srv_set1_refCert(OSSL_CMP_SRV_CTX *srv_ctx, X509 *cert);
int ossl_cmp_mock_srv_set1_certOut(OSSL_CMP_SRV_CTX *srv_ctx, X509 *cert);
@ -34,6 +36,7 @@ int ossl_cmp_mock_srv_set1_oldWithNew(OSSL_CMP_SRV_CTX *srv_ctx, X509 *cert);
int ossl_cmp_mock_srv_set_statusInfo(OSSL_CMP_SRV_CTX *srv_ctx, int status,
int fail_info, const char *text);
int ossl_cmp_mock_srv_set_sendError(OSSL_CMP_SRV_CTX *srv_ctx, int bodytype);
int ossl_cmp_mock_srv_set_useBadProtection(OSSL_CMP_SRV_CTX *srv_ctx, int bodytype);
int ossl_cmp_mock_srv_set_pollCount(OSSL_CMP_SRV_CTX *srv_ctx, int count);
int ossl_cmp_mock_srv_set_checkAfterTime(OSSL_CMP_SRV_CTX *srv_ctx, int sec);

View file

@ -0,0 +1,44 @@
/*
* {- join("\n * ", @autowarntext) -}
*
* Copyright 2016-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#ifndef APPS_CONFIGURATION_H
#define APPS_CONFIGURATION_H
/* clang-format off */
{-
my $generate_openssl_disable_array = sub {
my ($key) = @_;
my $data = $config{$key};
my $res = "static const char * const ${key}[] = {\n";
$res .= "\t\"\",\n";
if ($data && @$data) {
foreach (@$data) {
$res .= "\t\"$_\",\n";
}
}
$res .= "};\n";
return $res;
};
$OUT .= $generate_openssl_disable_array->('openssl_disabled_protocols');
$OUT .= "\n";
$OUT .= $generate_openssl_disable_array->('openssl_disabled_algorithms');
$OUT .= "\n";
$OUT .= $generate_openssl_disable_array->('openssl_disabled_features');
-}
/* clang-format on */
#endif

View file

@ -7,7 +7,12 @@
* https://www.openssl.org/source/license.html
*/
#if !defined(APPS_INCLUDE_EC_COMMON_H)
#define APPS_INCLUDE_EC_COMMON_H
#ifndef OPENSSL_NO_EC
#include <stddef.h>
static const char *point_format_options[] = {
"uncompressed",
"compressed",
@ -21,3 +26,5 @@ static const char *asn1_encoding_options[] = {
NULL
};
#endif
#endif /* !defined(APPS_INCLUDE_EC_COMMON_H) */

View file

@ -7,7 +7,12 @@
* https://www.openssl.org/source/license.html
*/
#if !defined(OSSL_APPS_INCLUDE_NAMES_H)
#define OSSL_APPS_INCLUDE_NAMES_H
#include <openssl/evp.h>
#include <openssl/safestack.h>
#include <openssl/types.h>
/* Standard comparing function for names */
int name_cmp(const char *const *a, const char *const *b);
@ -15,3 +20,5 @@ int name_cmp(const char *const *a, const char *const *b);
void collect_names(const char *name, void *vdata);
/* Sorts and prints a stack of names to |out| */
void print_names(BIO *out, STACK_OF(OPENSSL_CSTRING) *names);
#endif /* !defined(OSSL_APPS_INCLUDE_NAMES_H) */

View file

@ -39,9 +39,9 @@
{ "purpose", OPT_V_PURPOSE, 's', \
"certificate chain purpose" }, \
{ "verify_name", OPT_V_VERIFY_NAME, 's', "verification policy name" }, \
{ "verify_depth", OPT_V_VERIFY_DEPTH, 'n', \
{ "verify_depth", OPT_V_VERIFY_DEPTH, 'N', \
"chain depth limit" }, \
{ "auth_level", OPT_V_VERIFY_AUTH_LEVEL, 'n', \
{ "auth_level", OPT_V_VERIFY_AUTH_LEVEL, 'N', \
"chain authentication security level" }, \
{ "attime", OPT_V_ATTIME, 'M', "verification epoch time" }, \
{ "verify_hostname", OPT_V_VERIFY_HOSTNAME, 's', \
@ -341,8 +341,9 @@ typedef struct options_st {
* value type:
*
* '-' no value (also the value zero)
* 'n' number (type 'int')
* 'p' positive number (type 'int')
* 'n' any number (type 'int')
* 'p' positive number (type 'int', value > 0)
* 'N' is a non-negative number (type 'int', value >= 0)
* 'u' unsigned number (type 'unsigned long')
* 'l' number (type 'unsigned long')
* 'M' number (type 'intmax_t')
@ -356,7 +357,7 @@ typedef struct options_st {
* 'A' any ASN1, der/pem/b64 format [OPT_FMT_ASN1]
* 'c' pem/der/smime format [OPT_FMT_PDS]
*
* The 'l', 'n' and 'u' value types include the values zero,
* The 'l', 'n', 'N' and 'u' value types include the values zero,
* the 'p' value type does not.
*/
int valtype;

View file

@ -7,6 +7,9 @@
* https://www.openssl.org/source/license.html
*/
#if !defined(OSSL_APPS_INCLUDE_S_APPS_H)
#define OSSL_APPS_INCLUDE_S_APPS_H
#include <openssl/opensslconf.h>
#include <openssl/ssl.h>
@ -110,5 +113,8 @@ typedef struct srpsrvparm_st {
int set_up_srp_verifier_file(SSL_CTX *ctx, srpsrvparm *srp_callback_parm,
char *srpuserseed, char *srp_verifier_file);
void cleanup_srp(srpsrvparm *srp_callback_parm);
void lookup_srp_user(srpsrvparm *srp_callback_parm, BIO *bio_s_out);
#endif /* OPENSSL_NO_SRP */
#endif /* !defined(OSSL_APPS_INCLUDE_S_APPS_H) */

View file

@ -1,5 +1,5 @@
/*
* Copyright 2019-2025 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2019-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -39,7 +39,7 @@ const OPTIONS kdf_options[] = {
{ "digest", OPT_DIGEST, 's', "Digest" },
{ "mac", OPT_MAC, 's', "MAC" },
{ OPT_MORE_STR, 1, '-', "See 'Supported Controls' in the EVP_KDF_ docs\n" },
{ "keylen", OPT_KEYLEN, 's', "The size of the output derived key" },
{ "keylen", OPT_KEYLEN, 'p', "The size of the output derived key" },
OPT_SECTION("Output"),
{ "out", OPT_OUT, '>', "Output to filename rather than stdout" },
@ -101,7 +101,7 @@ int kdf_main(int argc, char **argv)
out_bin = 1;
break;
case OPT_KEYLEN:
dkm_len = atoi(opt_arg());
dkm_len = opt_int_arg();
break;
case OPT_OUT:
outfile = opt_arg();
@ -162,7 +162,7 @@ int kdf_main(int argc, char **argv)
goto err;
if (!EVP_KDF_CTX_set_params(ctx, params)) {
BIO_printf(bio_err, "KDF parameter error\n");
BIO_puts(bio_err, "KDF parameter error\n");
ERR_print_errors(bio_err);
ok = 0;
}
@ -176,7 +176,7 @@ int kdf_main(int argc, char **argv)
goto err;
if (dkm_len <= 0) {
BIO_printf(bio_err, "Invalid derived key length.\n");
BIO_puts(bio_err, "Derived key length is mandatory!\n");
goto err;
}
dkm_bytes = app_malloc(dkm_len, "out buffer");
@ -184,7 +184,7 @@ int kdf_main(int argc, char **argv)
goto err;
if (!EVP_KDF_derive(ctx, dkm_bytes, dkm_len, NULL)) {
BIO_printf(bio_err, "EVP_KDF_derive failed\n");
BIO_puts(bio_err, "EVP_KDF_derive failed\n");
goto err;
}
@ -193,7 +193,7 @@ int kdf_main(int argc, char **argv)
} else {
hexout = OPENSSL_buf2hexstr(dkm_bytes, dkm_len);
if (hexout == NULL) {
BIO_printf(bio_err, "Memory allocation failure\n");
BIO_puts(bio_err, "Memory allocation failure\n");
goto err;
}
BIO_printf(out, "%s\n\n", hexout);

View file

@ -1,5 +1,5 @@
/*
* Copyright 2019-2025 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2019-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -56,7 +56,7 @@ static int describe_param_type(char *buf, size_t bufsz, const OSSL_PARAM *param)
bufsz -= printed_len;
}
if (show_type_number) {
printed_len = BIO_snprintf(buf, bufsz, " [%d]", param->data_type);
printed_len = BIO_snprintf(buf, bufsz, " [%u]", param->data_type);
if (printed_len > 0) {
buf += printed_len;
bufsz -= printed_len;
@ -158,13 +158,13 @@ void print_param_value(const OSSL_PARAM *p, int indent)
if (OSSL_PARAM_get_uint64(p, &u))
BIO_printf(bio_out, "%llu\n", (unsigned long long int)u);
else
BIO_printf(bio_out, "error getting value\n");
BIO_puts(bio_out, "error getting value\n");
break;
case OSSL_PARAM_INTEGER:
if (OSSL_PARAM_get_int64(p, &i))
BIO_printf(bio_out, "%lld\n", (long long int)i);
else
BIO_printf(bio_out, "error getting value\n");
BIO_puts(bio_out, "error getting value\n");
break;
case OSSL_PARAM_UTF8_PTR:
print_param_utf8((const char **)p->data, p->return_size);

View file

@ -47,6 +47,7 @@ int app_provider_load(OSSL_LIB_CTX *libctx, const char *provider_name)
app_providers = sk_OSSL_PROVIDER_new_null();
if (app_providers == NULL
|| !sk_OSSL_PROVIDER_push(app_providers, prov)) {
OSSL_PROVIDER_unload(prov);
app_providers_cleanup();
return 0;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -84,7 +84,7 @@ int app_RAND_write(void)
if (save_rand_file == NULL)
return 1;
if (RAND_write_file(save_rand_file) == -1) {
BIO_printf(bio_err, "Cannot write random bytes:\n");
BIO_puts(bio_err, "Cannot write random bytes:\n");
ERR_print_errors(bio_err);
ret = 0;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2020-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -25,7 +25,7 @@ static ASN1_OCTET_STRING *mk_octet_string(void *value, size_t value_n)
ASN1_OCTET_STRING *v = ASN1_OCTET_STRING_new();
if (v == NULL) {
BIO_printf(bio_err, "error: allocation failed\n");
BIO_puts(bio_err, "error: allocation failed\n");
} else if (!ASN1_OCTET_STRING_set(v, value, (int)value_n)) {
ASN1_OCTET_STRING_free(v);
v = NULL;
@ -42,7 +42,7 @@ static int x509_ctrl(void *object, int cmd, void *value, size_t value_n)
ASN1_OCTET_STRING *v = mk_octet_string(value, value_n);
if (v == NULL) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"error: setting distinguishing ID in certificate failed\n");
return 0;
}
@ -65,7 +65,7 @@ static int x509_req_ctrl(void *object, int cmd, void *value, size_t value_n)
ASN1_OCTET_STRING *v = mk_octet_string(value, value_n);
if (v == NULL) {
BIO_printf(bio_err,
BIO_puts(bio_err,
"error: setting distinguishing ID in certificate signing request failed\n");
return 0;
}

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
/*
* Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -171,7 +171,7 @@ int password_callback(char *buf, int bufsiz, int verify, PW_CB_DATA *cb_data)
prompt_info = cb_data->prompt_info;
prompt = UI_construct_prompt(ui, "pass phrase", prompt_info);
if (prompt == NULL) {
BIO_printf(bio_err, "Out of memory\n");
BIO_puts(bio_err, "Out of memory\n");
UI_free(ui);
return 0;
}
@ -200,13 +200,13 @@ int password_callback(char *buf, int bufsiz, int verify, PW_CB_DATA *cb_data)
if (ok >= 0)
res = (int)strlen(buf);
if (ok == -1) {
BIO_printf(bio_err, "User interface error\n");
BIO_puts(bio_err, "User interface error\n");
ERR_print_errors(bio_err);
OPENSSL_cleanse(buf, (unsigned int)bufsiz);
res = 0;
}
if (ok == -2) {
BIO_printf(bio_err, "aborted!\n");
BIO_puts(bio_err, "aborted!\n");
OPENSSL_cleanse(buf, (unsigned int)bufsiz);
res = 0;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 2018-2025 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2018-2026 The OpenSSL Project Authors. All Rights Reserved.
* Copyright Siemens AG 2018-2020
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
@ -10,6 +10,7 @@
#include "apps.h"
#include "cmp_mock_srv.h"
#include "../../crypto/cmp/cmp_local.h" /* for access to msg->protection */
#include <openssl/cmp.h>
#include <openssl/err.h>
@ -28,6 +29,7 @@ typedef struct {
X509 *oldWithNew; /* to return in oldWithNew of rootKeyUpdate */
OSSL_CMP_PKISI *statusOut; /* status for ip/cp/kup/rp msg unless polling */
int sendError; /* send error response on given request type */
int useBadProtection; /* use bad protection on given response type */
OSSL_CMP_MSG *req; /* original request message during polling */
int pollCount; /* number of polls before actual cert response */
int curr_pollCount; /* number of polls so far for current request */
@ -59,6 +61,7 @@ static mock_srv_ctx *mock_srv_ctx_new(void)
goto err;
ctx->sendError = -1;
ctx->useBadProtection = -1;
/* all other elements are initialized to 0 or NULL, respectively */
return ctx;
@ -187,6 +190,19 @@ int ossl_cmp_mock_srv_set_sendError(OSSL_CMP_SRV_CTX *srv_ctx, int bodytype)
return 1;
}
int ossl_cmp_mock_srv_set_useBadProtection(OSSL_CMP_SRV_CTX *srv_ctx, int bodytype)
{
mock_srv_ctx *ctx = OSSL_CMP_SRV_CTX_get0_custom_ctx(srv_ctx);
if (ctx == NULL) {
ERR_raise(ERR_LIB_CMP, CMP_R_NULL_ARGUMENT);
return 0;
}
/* might check bodytype, but this would require exporting all body types */
ctx->useBadProtection = bodytype;
return 1;
}
int ossl_cmp_mock_srv_set_pollCount(OSSL_CMP_SRV_CTX *srv_ctx, int count)
{
mock_srv_ctx *ctx = OSSL_CMP_SRV_CTX_get0_custom_ctx(srv_ctx);
@ -329,6 +345,7 @@ static OSSL_CMP_PKISI *process_cert_request(OSSL_CMP_SRV_CTX *srv_ctx,
STACK_OF(ASN1_UTF8STRING) *strs;
ASN1_UTF8STRING *str;
const char *data;
size_t len;
if (OBJ_obj2nid(obj) == NID_id_it_certProfile) {
if (!OSSL_CMP_ITAV_get0_certProfile(itav, &strs))
@ -343,7 +360,8 @@ static OSSL_CMP_PKISI *process_cert_request(OSSL_CMP_SRV_CTX *srv_ctx,
ERR_raise(ERR_LIB_CMP, ERR_R_PASSED_INVALID_ARGUMENT);
return NULL;
}
if (strcmp(data, "profile1") != 0) {
if (((len = ASN1_STRING_length_ex(str)) != sizeof("profile1") - 1)
|| memcmp(data, "profile1", len) != 0) {
ERR_raise(ERR_LIB_CMP, CMP_R_UNEXPECTED_CERTPROFILE);
return NULL;
}
@ -591,6 +609,7 @@ static int process_genm(OSSL_CMP_SRV_CTX *srv_ctx,
if (rsp != NULL && sk_OSSL_CMP_ITAV_push(*out, rsp))
return 1;
sk_OSSL_CMP_ITAV_free(*out);
OSSL_CMP_ITAV_free(rsp);
return 0;
}
@ -614,10 +633,10 @@ static void process_error(OSSL_CMP_SRV_CTX *srv_ctx, const OSSL_CMP_MSG *error,
return;
}
BIO_printf(bio_err, "mock server received error:\n");
BIO_puts(bio_err, "mock server received error:\n");
if (statusInfo == NULL) {
BIO_printf(bio_err, "pkiStatusInfo absent\n");
BIO_puts(bio_err, "pkiStatusInfo absent\n");
} else {
sibuf = OSSL_CMP_snprint_PKIStatusInfo(statusInfo, buf, sizeof(buf));
BIO_printf(bio_err, "pkiStatusInfo: %s\n",
@ -625,22 +644,22 @@ static void process_error(OSSL_CMP_SRV_CTX *srv_ctx, const OSSL_CMP_MSG *error,
}
if (errorCode == NULL)
BIO_printf(bio_err, "errorCode absent\n");
BIO_puts(bio_err, "errorCode absent\n");
else
BIO_printf(bio_err, "errorCode: %ld\n", ASN1_INTEGER_get(errorCode));
if (sk_ASN1_UTF8STRING_num(errorDetails) <= 0) {
BIO_printf(bio_err, "errorDetails absent\n");
BIO_puts(bio_err, "errorDetails absent\n");
} else {
BIO_printf(bio_err, "errorDetails: ");
BIO_puts(bio_err, "errorDetails: ");
for (i = 0; i < sk_ASN1_UTF8STRING_num(errorDetails); i++) {
if (i > 0)
BIO_printf(bio_err, ", ");
BIO_puts(bio_err, ", ");
ASN1_STRING_print_ex(bio_err,
sk_ASN1_UTF8STRING_value(errorDetails, i),
ASN1_STRFLGS_ESC_QUOTE);
}
BIO_printf(bio_err, "\n");
BIO_puts(bio_err, "\n");
}
}
@ -712,6 +731,25 @@ static int process_pollReq(OSSL_CMP_SRV_CTX *srv_ctx,
return 1;
}
OSSL_CMP_MSG *ossl_cmp_mock_server_perform(OSSL_CMP_CTX *ctx,
const OSSL_CMP_MSG *req)
{
OSSL_CMP_SRV_CTX *srv_ctx = OSSL_CMP_CTX_get_transfer_cb_arg(ctx);
OSSL_CMP_MSG *rsp = OSSL_CMP_CTX_server_perform(ctx, req);
if (srv_ctx != NULL && rsp != NULL) {
mock_srv_ctx *mock_ctx = OSSL_CMP_SRV_CTX_get0_custom_ctx(srv_ctx);
if (mock_ctx != NULL && OSSL_CMP_MSG_get_bodytype(rsp) == mock_ctx->useBadProtection) {
ASN1_BIT_STRING *prot = rsp->protection;
if (prot != NULL && prot->length != 0 && prot->data != NULL)
prot->data[0] ^= 0x80; /* flip most significant bit of the first byte */
}
}
return rsp;
}
OSSL_CMP_SRV_CTX *ossl_cmp_mock_srv_new(OSSL_LIB_CTX *libctx, const char *propq)
{
OSSL_CMP_SRV_CTX *srv_ctx = OSSL_CMP_SRV_CTX_new(libctx, propq);

View file

@ -1,5 +1,5 @@
/*
* Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2020-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@ -53,7 +53,7 @@ static void log_with_prefix(const char *prog, const char *fmt, va_list ap)
(void)BIO_set_prefix(pre, prefix);
bio = BIO_push(pre, bio_err);
(void)BIO_vprintf(bio, fmt, ap);
(void)BIO_printf(bio, "\n");
(void)BIO_puts(bio, "\n");
(void)BIO_flush(bio);
(void)BIO_pop(pre);
BIO_free(pre);
@ -92,7 +92,7 @@ void trace_log_message(int category,
#else
(void)BIO_vprintf(out, fmt, ap);
#endif
(void)BIO_printf(out, "\n");
(void)BIO_puts(out, "\n");
OSSL_trace_end(category, out);
}
if (verbosity < level) {

Some files were not shown because too many files have changed in this diff Show more