4567 Commits
Author SHA1 Message Date
Daniel Kubec 87af1458a7 apps/x509.c: fail on X509_VERIFY_PARAM_new() failure under -checkend
The allocation failure was reported on the output BIO and then skipped
the certificate, so the command exited with status zero without having
checked anything. Report it on stderr and reach err: like every other
failure path, as deferred by commit 8da3880874 "apps/x509.c: failing
exit status on every failure path reaching err:".

Fixes: 4036f4b0e3 "Add new public API for checking certificate times."
Complements: 8da3880874 "apps/x509.c: failing exit status on every failure path reaching err:"
Assisted-by: Claude:claude-fable-5-1
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Merge-date: Tue Oct 27 17:10:46 2026
Merged-from: https://github.com/openssl/openssl/pull/33104
2026-10-27 18:09:49 +01:00
Daniel Kubec 4a5704abc6 apps/x509.c: fail -checkend on unparsable validity times
When the notBefore or notAfter field of a certificate cannot be parsed,
X509_check_certificate_times() fails with an error other than
X509_V_ERR_CERT_HAS_EXPIRED. The -checkend handling only reacted
to that one error, so a certificate with a corrupt validity period
printed nothing and exited with status zero, i.e. was treated
as not expiring.  The same silent success happened for a certificate
that is not yet valid at the check time.

Report an unparsable validity period as an error with a failing exit
status. Report a certificate that only becomes valid after the check
time as not expiring, which is what -checkend did before the switch
to X509_check_certificate_times(), as it cannot expire
before it is valid.

Add regression tests with corrupted notBefore and notAfter fields,
including with -multi, and with a not yet valid certificate.
Document the behaviour.

Resolves: https://github.com/openssl/openssl/issues/11772
Assisted-by: Claude:claude-fable-5-1
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Merge-date: Tue Oct 27 16:19:04 2026
Merged-from: https://github.com/openssl/openssl/pull/33105
2026-10-27 17:17:50 +01:00
Daniel Kubec 0e2a7f2338 apps/lib/cmp_mock_srv.c: Fix NULL dereference of ASN1_INTEGER in refcert_cmp()
The issuer and the serialNumber are independently OPTIONAL
in a CertTemplate.  A component absent from the request cannot confirm
a match with the reference cert, and ASN1_INTEGER_cmp() does not accept
NULL, so require each component the reference cert has to be present
in the request and to be equal.

Fixes: 66be663b64 "cmp_mock_srv.c: Add missing OldCertID check for 'kur' cert update requests"
References: b971d4198d "CMP mock server: add -ref_cert option and corresponding ossl_cmp_mock_srv_set1_refCert()"
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Mounir Idrassi <mounir.idrassi@idrix.fr>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Merge-date: Sat Oct 24 09:44:19 2026
Merged-from: https://github.com/openssl/openssl/pull/33071
2026-10-24 11:42:53 +02:00
skaiea13-aiandMounir Idrassi f9796787f5 apps/ocsp.c: fail on invalid response times
Propagate OCSP_check_validity() failures through print_ocsp_summary(),
so the command returns a nonzero exit status for stale responses.

Add a request-aware regression test using the existing signed fixtures.

Resolves: https://github.com/openssl/openssl/issues/32367
References: 639bb581ce "apps/ocsp: Return non zero exit code with invalid certID"
References: https://github.com/openssl/openssl/issues/7151
Co-Authored-by: Mounir Idrassi <mounir.idrassi@idrix.fr>
Assisted-by: OpenAI Codex:GPT-5
Assisted-by: OpenAI Codex:GPT-6
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Mounir Idrassi <mounir.idrassi@idrix.fr>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Merge-date: Mon Oct 19 13:41:13 2026
Merged-from: https://github.com/openssl/openssl/pull/32600
2026-10-19 15:37:49 +02:00
Mounir IDRASSI 41a2d15da0 apps/s_server.c: fix BIO leak in ech_load_dir() on read failure
When loading ECH keys from a directory (-ech_dir or -ech_noretry_dir),
ech_load_dir() allocated a BIO via BIO_new_file(), but only freed it
on the success path.  If a file was readable,
yet OSSL_ECHSTORE_read_pem() failed, the continue skipped
BIO_free_all(), leaking the BIO.

OSSL_ECHSTORE_read_pem() does not take ownership of the caller-supplied
BIO.  It pushes and pops its own internal buffer BIO, so the caller
remains responsible for freeing the file BIO in all cases.

Fix this by making the BIO local to each loop iteration and freeing
it in the failure branch as well as the success branch.
This also avoids carrying a dangling BIO pointer from one loop iteration
to the next.

Verified with Valgrind against a directory containing invalid ECH PEM
files: definitely lost: 0 bytes, previously leaked 128 bytes per failing
file.

Resolves: https://github.com/openssl/openssl/issues/31770
Fixes: a2e5848d9d "s_client and s_server options for ECH"
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Merge-date: Fri Oct  9 19:55:28 2026
Merged-from: https://github.com/openssl/openssl/pull/31790
2026-10-09 21:55:14 +02:00
Jakub Zelenka 74653a6df0 apps: set cookie callbacks on s_server SNI context
s_server only installed the DTLS and stateless cookie callbacks on its
main SSL_CTX. When -servername matched, the connection was switched to
the second context before the cookie was generated, so a DTLS 1.2
client sending that name failed the handshake with a cookie generation
callback failure instead of getting a HelloVerifyRequest.

Install the callbacks on the SNI context as well and cover the case
with a (D)TLSv1.2 server name handshake in the TLSProxy message test.

Assisted-by: Claude:claude-fable-5-1
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Mounir Idrassi <mounir.idrassi@idrix.fr>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Merge-date: Tue Oct  6 14:46:55 2026
Merged-from: https://github.com/openssl/openssl/pull/33093
2026-10-06 16:46:47 +02:00
Eugene Syromiatnikov 82eef37eb9 apps/x509.c: don't load extensions if no -extfile/-extensions/"extensions" opt
The documentation says "If neither of the options are given, an attempt
is made to open the default configuration file [..] If the unnamed
section [..] of the file does not list an B<extensions> variable,
no extensions are added";  however, an attempt was made to load
extensions in that case.  Avoid that by using non-NULL extsect
as a guard for do_EXT_REQ_add_nconf() and do_EXT_REQ_add_nconf() calls
(which also avoids passing NULL as an "%s" format qualifier argument
to BIO_printf() calls in case of load failure).

Fixes: 84419e373a "Improved handling of AKID/SKID extensions in CSRs and certs"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Jakub Zelenka <jakub.zelenka@openssl.foundation>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Merge-date: Mon Oct  5 10:09:56 2026
Merged-from: https://github.com/openssl/openssl/pull/33083
2026-10-05 12:09:53 +02:00
Dmitry Belyavskiy 95f35c26f3 Dealing with symmetric keys in pkcs12 command-line utility
This is a follow-up to #30937
Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>

Reviewed-by: Mounir Idrassi <mounir.idrassi@idrix.fr>
Reviewed-by: Simo Sorce <simo@redhat.com>
MergeDate: Tue Sep 29 18:34:13 2026
(Merged from https://github.com/openssl/openssl/pull/32978)
2026-09-29 20:33:41 +02:00
Mounir IDRASSI 7aa9f5091c apps/x509: Fix new output detection for -key signing
The signing-only option validation runs before load_key(), so
privkey is always NULL when determining newout. Consequently, -key
or -signkey alone does not identify re-signing an input certificate
or signing an -x509toreq output. Signing options are rejected, and
the default extensions section is not loaded.

Check privkeyfile at this stage, which records that the option was
supplied. Keep the later privkey check unchanged because the key has
been loaded by then. Add tests for the validation guard, re-signing
options, and certificate and request extensions.

Fixes #32150

Assisted-by: pi:kimi-k3
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Jakub Zelenka <jakub.zelenka@openssl.foundation>
Merge-date: Fri Sep 25 11:07:32 2026
Merged-from: https://github.com/openssl/openssl/pull/32151
2026-09-25 13:07:28 +02:00
Tomas Mraz fa5c8d1c51 apps/server.c: Do not declare use_sendfile and use_zc_sendfile without ktls
It is unused otherwise.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Merge-date: Thu Sep 17 14:05:04 2026
Merged-from: https://github.com/openssl/openssl/pull/32821
2026-09-17 16:04:53 +02:00
Jakub Zelenka e713336e3c apps: fix dsa app exit status on option parsing errors
The dsa app set ret to 0 before printing the option parsing error,
resulting in a successful exit status for invalid options.  All other
apps keep the initial error status in this case, so drop the errant
assignment to make dsa fail as expected.

Assisted-by: Claude:claude-fable-5
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Merge-date: Wed Sep 16 08:48:56 2026
Merged-from: https://github.com/openssl/openssl/pull/32590
2026-09-16 10:48:52 +02:00
Bernd Edlinger 3bdd4a655b Fix a memory leak in apps/ocsp.c issuer
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Merge-date: Tue Sep 15 16:28:52 2026
Merged-from: https://github.com/openssl/openssl/pull/32807
2026-09-15 18:28:50 +02:00
Neil Horman 1caa35f4fb Fix set but unsued variable in lib/opt.c
https://github.com/openssl/openssl/actions/runs/34494520852/job/102982686286

CI is failing because we have a varaible in opt.c that is set but never
used.

Just remove it.

Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
MergeDate: Sat Sep 12 13:18:16 2026
(Merged from https://github.com/openssl/openssl/pull/32787)
2026-09-12 09:18:09 -04:00
openssl-machine e074eab6c4 Copyright year updates
Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Merge-date: Wed Sep  9 13:12:46 2026
Release: yes
2026-09-09 13:12:46 +00:00
Jakub Zelenka d6d126cc6f apps: print an error for a non-positive genrsa bits argument
Previously a negative or zero numbits argument made genrsa exit
with a failure status without printing any error message.

Assisted-by: Claude:claude-fable-5
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Merge-date: Mon Sep  7 14:15:50 2026
Merged-from: https://github.com/openssl/openssl/pull/32592
2026-09-07 16:15:20 +02:00
Mounir IDRASSI 8da3880874 apps/x509.c: failing exit status on every failure path reaching err:
With -multi, a later certificate failure could return success after an
earlier certificate succeeded because ret retained the earlier result
on reaching err:.

Set ret = 1 at err: so every path reaching it reports failure. Paths
bypassing err: remain unchanged, including the pre-existing
X509_VERIFY_PARAM_new() failure under -checkend, which will be addressed
separately.

Add a regression test using -multi -checkhost with a two-certificate
chain whose second certificate fails.

Fixes #32189

Reviewed-by: Jakub Zelenka <jakub.zelenka@openssl.foundation>
Reviewed-by: Todd Short <todd.short@me.com>
Merge-date: Mon Sep  7 14:01:00 2026
Merged-from: https://github.com/openssl/openssl/pull/32190
2026-09-07 16:00:04 +02:00
Dr. David von Oheimb afa68ed2e0 PKCS7 and SMIME: improve documentation w.r.t. untrusted and signer certificates
Reviewed-by: Mounir Idrassi <mounir.idrassi@idrix.fr>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Merge-date: Thu Sep  3 09:26:56 2026
Merged-from: https://github.com/openssl/openssl/pull/22285
2026-09-03 11:26:53 +02:00
Tomas Mraz d2307ad06d s_server: Do not override -Verify with -verify_return_error
Or the verification flags in instead of overriding
the previous value with -verify_return_error.

Fixes e5f01903ed

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Merge-date: Thu Aug 27 16:15:34 2026
Merged-from: https://github.com/openssl/openssl/pull/32512
2026-08-27 18:15:20 +02:00
Norbert Pocs 99e44fd567 Don't use BIO_snprintf as it is deprecated
Signed-off-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Merge-date: Thu Aug 27 14:35:30 2026
Merged-from: https://github.com/openssl/openssl/pull/32547
2026-08-27 16:18:19 +02:00
Bob Beck 4f183765aa Sweep for printf UB - don't printf %s NULL
As an asn1_string of length 0 will have NULL data, don't
printf %s NULL.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Merge-date: Thu Aug 27 13:52:48 2026
Merged-from: https://github.com/openssl/openssl/pull/32178
2026-08-27 15:52:18 +02:00
Bob Beck 52a9a4f247 Don't call strlcpy on a non-string.
Again, ASN1_STRING_get0_data has never been guaranteed to be nul terminated.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Merge-date: Thu Aug 27 13:52:40 2026
Merged-from: https://github.com/openssl/openssl/pull/32178
2026-08-27 15:52:18 +02:00
Bob Beck 81e0cf8ea3 Don't read an ASN1_STRING data raw and assume it's 0 byte terminated
Fix latent app bug in policy error diagnostics.

Fixes: #32176
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Merge-date: Thu Aug 27 13:52:39 2026
Merged-from: https://github.com/openssl/openssl/pull/32178
2026-08-27 15:52:18 +02:00
Bob Beck ef9a766551 Don't treat a CRL distribution point URI as a NUL terminated string
get_dp_url() returned the internal ASN1_STRING data of a DIST_POINT URI
directly. That data has an explicit length and is not necessarily NUL
terminated, yet load_crl() and the HTTP client it hands the URI to consume
it as a C string, reading past the buffer for a certificate carrying a
primitive-form IA5String URI in its CRL distribution points.

Return an allocated NUL terminated copy of the URI and free it in
load_crl_crldp().

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Merge-date: Thu Aug 27 13:52:39 2026
Merged-from: https://github.com/openssl/openssl/pull/32178
2026-08-27 15:52:18 +02:00
Jan Luebbe b8631f9bbc Implement access to CMS verification results per signer
When verifying CMS messages with multiple signatures using
CMS_VERIFY_PARTIAL to implement additional custom requirements
regarding signatures from which certificates are required and/or
acceptable, information on which signature was considered invalid and
why by CMS_verify is useful for reporting or debugging.

Implement this by adding CMS_SignerInfo-based access to certificates
(CMS_SignerInfo_get0_signer_cert) and verification results
(CMS_SignerInfo_get_verification_result). Also use these new functions
to show more details when using 'openssl cms -verify' with
'-verify_partial'.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Merge-date: Thu Aug 27 13:14:14 2026
Merged-from: https://github.com/openssl/openssl/pull/27604
2026-08-27 15:12:30 +02:00
Jan Luebbe 5af9dbf128 Implement partial verification for CMS with multiple signatures
Currently, OpenSSL supports creating CMS SignedData structures with
multiple signers using CMS_sign() with the CMS_PARTIAL flag combined
with CMS_add1_signer(). This can be done for a new SignedData or by
adding signers to an existing structure. In addition to the C API, this
is supported via openssl cms -sign (using multiple -signer options) and
openssl cms -resign.

The corresponding CMS_verify() function and openssl cms -verify command
check the signatures sequentially and abort with an error on the first
problem. They support some flags (CMS_NO_SIGNER_CERT_VERIFY,
CMS_NO_ATTR_VERIFY, CMS_NO_CONTENT_VERIFY), which disable some aspects
of the verification, but do not allow continuing after a failed
signature verification.

The main use cases for multiple signatures on one message are:

* Simplify CA certificate roll-over by signing messages with keys in
  both the old and new hierarchies during a transition period.
  Recipients would have either the old or new CA installed (or
  temporarily even both). In all cases, we'd like to accept any message
  which as at least one signature that can be verified.

* Support user-implemented verification policies which require
  signatures from multiple specific signers.

* Support user-implemented verification policies which require a minimum
  number of signatures from different signers under under a trusted CA.

This is made possible by adding a CMS_VERIFY_PARTIAL flag to CMS_verify()
and exposing it through a new -verify_partial option to 'openssl cms
-verify'.

If this flag is set, the call is successful even if some of the
individual signatures cannot be verified (perhaps due to CAs missing
from the local store or expired certificates). The application would
then call CMS_get0_signers() and check if the set of valid signatures
satisfies its policy.

Fixes #3028
Fixes #26382

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Merge-date: Thu Aug 27 13:14:13 2026
Merged-from: https://github.com/openssl/openssl/pull/27604
2026-08-27 15:12:30 +02:00
Bob Beck e99307b011 Replace strlen-then-snprintf preconditions with snprintf-return
This restructureis the apps/lib/apps.c file-rotation helpers
to use snprintf for truncation detection, since they now can.

This also collapses the per-snprintf VMS ifdef into one
SUFFIX_SEP macro because the ifdef-per-call shape was making my eyes
bleed from all the copypasta'ed snprintf lines with only one character
changed in the format string.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
MergeDate: Wed Aug 26 16:20:32 2026
(Merged from https://github.com/openssl/openssl/pull/31640)
2026-08-26 12:20:02 -04:00
Bob Beck 27f277fd16 Replace strlen-then-snprintf pattern in save_serial() with a single truncation check.
This used to be necessary because BIO_snprintf() could not detect truncation
but now this is silly, and this ends up tripping GCC's -Wformat-truncation

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
MergeDate: Wed Aug 26 16:20:30 2026
(Merged from https://github.com/openssl/openssl/pull/31640)
2026-08-26 12:20:02 -04:00
Bob Beck 5a4883d5a3 Convert BIO_snprintf() usage in describe_param_type()
This adds the correct truncation check for snprintf() to
each block that advances the index.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
MergeDate: Wed Aug 26 16:20:14 2026
(Merged from https://github.com/openssl/openssl/pull/31640)
2026-08-26 12:20:02 -04:00
Bob Beck 486ec1f606 Convert BIO_snprintf() callers that detect truncation to snprintf().
These sites used the return value to detect truncation, then used the
buffer as is. Convert them to detect truncation in the standard
snprintf() way.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
MergeDate: Wed Aug 26 16:20:13 2026
(Merged from https://github.com/openssl/openssl/pull/31640)
2026-08-26 12:20:02 -04:00
Bob Beck cae917e2ee Convert BIO_snprintf() callers whose existing checks already work
under snprintf semantics.

These call sites already guarded the result with the C99 truncation
idiom, so they can simply use snprintf as a replacement as is.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
MergeDate: Wed Aug 26 16:20:09 2026
(Merged from https://github.com/openssl/openssl/pull/31640)
2026-08-26 12:20:02 -04:00
Bob Beck c192d4b6f8 Convert BIO_snprintf() callers that ignore the return value to snprintf().
Where the return value is discarded, BIO_snprintf() and snprintf() are
interchangeable: both write the same bytes and NUL-terminate the buffer.

The conversion is mechanical.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
MergeDate: Wed Aug 26 16:20:07 2026
(Merged from https://github.com/openssl/openssl/pull/31640)
2026-08-26 12:20:02 -04:00
Bob Beck c0fd83dc7c Add a build target for MSVC 2013
Apparently it is desired to keep this on life support.

So we add a build target for this non-C99 platform, and
provide internal versions of snprintf and vsnprintf for use
only on this platform that match the C99 semantics.

This allows us to use C99 semantics normally elsewhere.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
MergeDate: Wed Aug 26 16:20:04 2026
(Merged from https://github.com/openssl/openssl/pull/31640)
2026-08-26 12:20:02 -04:00
Frederik Wedel-Heinen fc599e96fd Support OSCP responses for DTLS 1.3
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28455)
2026-08-25 12:41:25 +01:00
Frederik Wedel-Heinen a99dd7aec5 Adds DTLS 1.3 ACK message functionality
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25119)
2026-08-25 12:41:24 +01:00
Frederik Wedel-Heinen 7d2232d3d8 Refactor code and fix a couple of missing DTLSv1.3 checks.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24345)
2026-08-25 12:41:24 +01:00
Frederik Wedel-Heinen e575462cf8 Don't allow renegotiation for DTLS 1.3
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22362)
2026-08-25 12:41:23 +01:00
Frederik Wedel-Heinen 5630fbfb71 Print session ticket for dtls 1.3 as well.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22260)
2026-08-25 12:41:23 +01:00
Frederik Wedel-Heinen 3c47f8fcf1 Integrate dtls1.3 in s_client and s_server
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22260)
2026-08-25 12:41:23 +01:00
YZL0v3ZZ ee7c64fbcd Fix system resource leak in TerminalSocket()
When establishing a terminal socket on OpenVMS, if the async I/O
read operation (sys$qio) fails, the error path returns early without
freeing the allocated channel via sys$dassgn.

Add sys$dassgn(TerminalDeviceChan) in the sys$qio error path during
creation. Also ensure dassgn executes regardless of whether sys$cancel
succeeds during deletion to avoid exhausting the I/O channel quota.

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Merge-date: Wed Aug 19 15:37:03 2026
Merged-from: https://github.com/openssl/openssl/pull/30375
2026-08-19 17:36:58 +02:00
Bob Beck dad6ff265a Use an int for the return value of i2a_ASN1_OBJECT
And as a result in this loop. I changed this to a size_t
which was needed where the variable was used later on and
missed this case at the start.

While harmless, coverity notices. so let's do it right

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Merge-date: Fri Aug 14 06:29:29 2026
Merged-from: https://github.com/openssl/openssl/pull/32310
2026-08-14 08:29:24 +02:00
Eugene Syromiatnikov 786353f4c5 Change set suffix in ASN1_STRING_set_{data,string} to set1
To comply with the naming guidelines for the API functions that transfer
ownership of the data.  The majority of the changes was done by

    for i in `git grep -l ASN1_STRING_set_data`; do \
        sed -i 's/ASN1_STRING_set_data/ASN1_STRING_set1_data/g' "$i"; \
    done
    for i in `git grep -l ASN1_STRING_set_string`; do \
        sed -i 's/ASN1_STRING_set_string/ASN1_STRING_set1_string/g' "$i"; \
    done

with a manual touch-up in util/libcrypto.num.

Complements: 28179061bf "Prepare a now opaque ASN1_STRING for the size_t rapture."
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Simo Sorce <simo@redhat.com>
MergeDate: Tue Aug 11 13:56:44 2026
(Merged from https://github.com/openssl/openssl/pull/32015)
2026-08-11 15:56:04 +02:00
Eugene Syromiatnikov 5b05b7da7c Rename ASN1_STRING_length_ex() to ASN1_STRING_get_length()
To make it in line with ASN1_BIT_STRING_get_length() and other (size)
getters.  The majority of the changes was done by

    for i in `git grep -l ASN1_STRING_length_ex`; do \
        sed -i 's/ASN1_STRING_length_ex/ASN1_STRING_get_length/g' "$i"; \
    done

with a manual touch-up in util/libcrypto.num.

Complements: 28179061bf "Prepare a now opaque ASN1_STRING for the size_t rapture."
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Simo Sorce <simo@redhat.com>
MergeDate: Tue Aug 11 13:56:42 2026
(Merged from https://github.com/openssl/openssl/pull/32015)
2026-08-11 15:56:00 +02:00
Shreenidhi Shedi a96cd528dc apps/tsget: minor cleanups
Add a progress() helper to centralise verbose output. Move usage()
to the top. Rename @old_argv to @saved_argv. Replace foreach with
for+lexical variable. Inline $output_base. Switch exists to defined
for option checks. Remove the main-program comment block.

Assisted-by: Claude:claude-sonnet-4-6
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>

Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Fri Aug  7 13:29:39 2026
(Merged from https://github.com/openssl/openssl/pull/31445)
2026-08-07 15:29:28 +02:00
Shreenidhi Shedi e9415c4fc6 apps/tsget: use three-arg open and binmode for binary safety
Switch bareword INPUT filehandle to a lexical filehandle with
three-argument open. Add binmode on both the STDIN and file paths
so timestamp request data is read as raw bytes on all platforms.

Assisted-by: Claude:claude-sonnet-4-6
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>

Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Fri Aug  7 13:29:38 2026
(Merged from https://github.com/openssl/openssl/pull/31445)
2026-08-07 15:29:28 +02:00
Shreenidhi Shedi 2f6c5fc193 apps/tsget: enable use warnings
Add "use warnings" and wrap CURLOPT_RANDOM_FILE and CURLOPT_EGDSOCKET
setopt calls in eval blocks, as these constants were removed from
libcurl and would cause an exception on modern installations.

Assisted-by: Claude:claude-sonnet-4-6
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>

Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Fri Aug  7 13:29:37 2026
(Merged from https://github.com/openssl/openssl/pull/31445)
2026-08-07 15:29:28 +02:00
Shreenidhi Shedi f9915f512c apps/tsget: replace CURLOPT_UPLOAD with CURLOPT_POST
Switch from the UPLOAD+CUSTOMREQUEST+read-callback approach to
POSTFIELDS, eliminating the read_body/write_body callbacks and the
INFILE/INFILESIZE/FILE options. Rename get_timestamp to send_request
with a simpler interface that writes directly to the output file via
CURLOPT_WRITEDATA.

Assisted-by: Claude:claude-sonnet-4-6
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>

Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Fri Aug  7 13:29:36 2026
(Merged from https://github.com/openssl/openssl/pull/31445)
2026-08-07 15:29:28 +02:00
Shreenidhi Shedi fc9a497df1 apps/tsget: switch WWW::Curl::Easy to Net::Curl::Easy
Minimal module swap: replace WWW::Curl::Easy with Net::Curl::Easy.
Update callback signatures (Net::Curl passes the easy handle as the
first argument), replace error-code-based perform() with eval/die,
and drop cleanup() which Net::Curl does not require.

Assisted-by: Claude:claude-sonnet-4-6
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>

Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Fri Aug  7 13:29:35 2026
(Merged from https://github.com/openssl/openssl/pull/31445)
2026-08-07 15:29:28 +02:00
Moryakhin Stas e3387d3a5a Fix encrypt decrypt fetch for cms from privoder side
For algorithms without NID (without registration via the engine), cms_enc attempts to fetch via OBJ_obj2txt.

passing cipher instead of NULL in EVP_PKEY_CTX_ctrl in apps/cms.c

Reviewed-by: Jakub Zelenka <jakub.zelenka@openssl.foundation>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
MergeDate: Sat Aug  1 03:02:06 2026
(Merged from https://github.com/openssl/openssl/pull/31512)
2026-08-01 10:01:50 +07:00
Sebastian Andrzej Siewior 30be19ca01 apps: Make s_client -quiet really quiet
Despite the -quiet option s_client still reports the host it connects to
and the certificate chain. Since -quiet is documented as "No s_client
output", hide all non-error output.

Pass the quiet option to init_client() to suppress the host output.
Set verify's quiet flag if quiet is passed.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jul 30 09:09:35 2026
(Merged from https://github.com/openssl/openssl/pull/30519)
2026-07-30 11:09:29 +02:00
Mounir IDRASSI 833efe31fc Remove remaining atoi()/atol() calls
Remove the remaining direct atoi()/atol() uses across apps, libcrypto,
libssl, providers, demos and tests, and route the replacements through
checked helpers instead of open-coding the conversion at each call site:

  - apps use the existing opt_int()/opt_long()/opt_int_arg() parsers;
  - libcrypto and provider code use the new internal ossl_strtol()/
    ossl_strtoint() helpers, a checked (and, for ossl_strtoint(),
    narrowing) signed counterpart to the public OPENSSL_strtoul();
  - libssl, demos and tests use OPENSSL_strtoul(); the test code shares
    a single test_strtoint() helper rather than repeating the bound check
    and cast per file;
  - unsigned values use OPENSSL_strtoul(), with call-site-specific range
    checks before narrowing where the destination type requires it.

Reject conversion failures and narrow through the helpers rather than
acting on garbage, and preserve the signed RSA-PSS saltlen sentinels
while rejecting invalid numeric strings. Add regression coverage for the
invalid RSA-PSS saltlen string path.

Fixes #8216

Assisted-by: OpenCode:GLM-5.2

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jul 29 17:02:18 2026
(Merged from https://github.com/openssl/openssl/pull/31731)
2026-07-29 19:02:10 +02:00