]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
3 days agofips: add DH PCT name
Pauli [Thu, 30 Jan 2025 23:16:17 +0000 (10:16 +1100)] 
fips: add DH PCT name

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

(cherry picked from commit 88a13095667228c2361361c97704ea992d837ade)

3 days agochanges: add note about PCT on key import to the FIPS provider
Pauli [Wed, 29 Jan 2025 01:41:59 +0000 (12:41 +1100)] 
changes: add note about PCT on key import to the FIPS provider

This is mandated by FIPS 140-3 IG 10.3.A additional comment 1.

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

(cherry picked from commit 32ff539daf83cccc15a159fe214cac66acc80fec)

3 days agorsa (fips): add PCT for key import
Pauli [Wed, 29 Jan 2025 00:31:33 +0000 (11:31 +1100)] 
rsa (fips): add PCT for key import

FIPS 140-3 IG 10.3.A additional comment 1 mandates a PCT on key import.

Fixes #26572

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

(cherry picked from commit 57230da2bd0be6b219cec2995832034b1e09e0e9)

3 days agoec (fips): add PCT for key import
Pauli [Wed, 29 Jan 2025 00:16:54 +0000 (11:16 +1100)] 
ec (fips): add PCT for key import

FIPS 140-3 IG 10.3.A additional comment 1 mandates a PCT on key import.

Fixes #26572

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

(cherry picked from commit a177798e0b8f3c7ff66b2a609924aafeb66b8b12)

3 days agoecx (fips): add PCT for key import
Pauli [Wed, 29 Jan 2025 00:16:44 +0000 (11:16 +1100)] 
ecx (fips): add PCT for key import

FIPS 140-3 IG 10.3.A additional comment 1 mandates a PCT on key import.

Fixes #26572

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

(cherry picked from commit 58ab3b0ffeea2b4c30f8794d281650ce7bfec6d2)

3 days agorsa: expose pairwise consistency test API
Pauli [Wed, 29 Jan 2025 00:44:02 +0000 (11:44 +1100)] 
rsa: expose pairwise consistency test API

This is only used by the FIPS provider as part of importing keys.  At least
at the moment.

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

(cherry picked from commit dc5cd6f70a0eeb30e272fe885a64f3e3d76b5e42)

3 days agoapps/asn1parse.c: correct help text order for -genstr option
Saurabh Kushwah [Wed, 30 Jul 2025 12:36:57 +0000 (18:06 +0530)] 
apps/asn1parse.c: correct help text order for -genstr option

CLA: trivial

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

(cherry picked from commit eac588ac360ca16e0f9979b6c70708f1e8991b4f)

5 days agofuzz/dtlsserver.c: Remove incorrect ifdef guard
Michael Baentsch [Mon, 28 Jul 2025 04:52:49 +0000 (06:52 +0200)] 
fuzz/dtlsserver.c: Remove incorrect ifdef guard

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28102)

(cherry picked from commit fd7fc90346306f49773866eddff90717e22b9181)

5 days agoOnly report generic error if provider did not put an error on the error queue
Ingo Franzki [Tue, 22 Jul 2025 13:09:27 +0000 (15:09 +0200)] 
Only report generic error if provider did not put an error on the error queue

Commit 72351b0d18078170af270418b2d5e9fc579cb1af added code to unconditionally
put a generic error onto the error stack, if key generation, encryption,
decryption, sign, or verify fails to ensure that there is an error entry
on the error queue, even if the provider did not itself put a specific error
onto the queue.

However, this can hide error details if an application just looks at the very
last error entry and checks for specific errors. Now, the generic error is
always the last entry, and the application won't find the expected error
entry, although it would be there as second last entry. This can lead to
different application behavior in error situations than before this change.

To fix this, only add the generic error entry if the provider did not itself
add an error entry onto the queue. That way, there always is an error on the
error queue in case of a failure, but no behavior change in case the provider
emitted the error entry itself.

Closes: https://github.com/openssl/openssl/issues/27992
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28073)

(cherry picked from commit b9ff440dd613e0c65527ef7eaf565f618979ecce)

5 days agoMake ERR_count_to_mark() available to providers via 'in' dispatch array
Ingo Franzki [Tue, 22 Jul 2025 13:01:38 +0000 (15:01 +0200)] 
Make ERR_count_to_mark() available to providers via 'in' dispatch array

Functions like ERR_set_mark(), ERR_clear_last_mark(), and ERR_pop_to_mark()
are already passed to the a provider via the 'in' dispatch array of the
provider initialization function (although the documentation did not
mention them).

Also pass ERR_count_to_mark() to the provider the same way, and update
the documentation to mention all four functions.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28073)

(cherry picked from commit f77fafd16e92699544466556d368ed7722f49dd8)

6 days agoPairwise check for DH keys import as part of FIPS
Nikola Pajkovsky [Thu, 17 Jul 2025 10:45:49 +0000 (12:45 +0200)] 
Pairwise check for DH keys import as part of FIPS

For DH key import, it appears the PCT and assurances are implemented in
the source but are not be performed by default.

Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28058)

(cherry picked from commit e08b83cbb3b853ae9dc364c32d927405172918ac)

6 days agoUpdate dh_pub to be pairwise consistent with dh_priv
Nikola Pajkovsky [Wed, 16 Jul 2025 12:37:58 +0000 (14:37 +0200)] 
Update dh_pub to be pairwise consistent with dh_priv

Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28058)

(cherry picked from commit 9c09d2076aad3ee853156048de60e3a1d93b424b)

7 days agotest-ec: Skip SM2 key import test if SM2 is disabled
Tomas Mraz [Mon, 28 Jul 2025 09:13:06 +0000 (11:13 +0200)] 
test-ec: Skip SM2 key import test if SM2 is disabled

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

(cherry picked from commit 981d6776a339bebbb1aa4a38b940dd1526ab3508)

8 days agoBackport of the fix #27506 (empty IDP causes error) to the version 3.5.
Igor Ustinov [Wed, 23 Jul 2025 17:48:50 +0000 (20:48 +0300)] 
Backport of the fix #27506 (empty IDP causes error) to the version 3.5.

(cherry picked from commit 6f0de58619a2a96a7ae9d098f572deda99dc73c9)

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

8 days ago- adding a missing file
Alexandr Nedvedicky [Tue, 22 Jul 2025 21:31:57 +0000 (23:31 +0200)] 
- adding a missing file

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

(cherry picked from commit d777deffbae3dc27f57c3086f385f91a62b1e5bd)

8 days ago- changes suggested by @t8m
Alexandr Nedvedicky [Tue, 22 Jul 2025 20:59:28 +0000 (22:59 +0200)] 
- changes suggested by @t8m

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

(cherry picked from commit 92330c8f80e4dbfc45b7718d9ed526f196daba0a)

8 days ago- fix RFC reference and indentation
sashan [Mon, 21 Jul 2025 06:57:41 +0000 (08:57 +0200)] 
- fix RFC reference and indentation

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

(cherry picked from commit a43b926fd2c73349c9eb6167f08a4d435e6f04a6)

8 days agoUpdate ssl/quic/quic_ackm.c
Sashan [Mon, 21 Jul 2025 06:44:17 +0000 (08:44 +0200)] 
Update ssl/quic/quic_ackm.c

Co-authored-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28023)

(cherry picked from commit b0836134764817fb8b20ceb432d8dff4fd58c2aa)

8 days agoUpdate ssl/quic/quic_ackm.c
Sashan [Mon, 21 Jul 2025 06:43:49 +0000 (08:43 +0200)] 
Update ssl/quic/quic_ackm.c

Co-authored-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28023)

(cherry picked from commit 4a3c954a0cdb9fa1f511ce43bb4833303a6067e2)

8 days agoACK manager must avoid infinite probe time when waiting handshake confirmation
sashan [Tue, 15 Jul 2025 13:09:40 +0000 (15:09 +0200)] 
ACK manager must avoid infinite probe time when waiting handshake confirmation

According to RFC 9002, section 6.2.2.1 the client the client must keep PTO (probe
time out) armed if it has not seen HANDSHAKE_DONE quic message from server.
Not following RFC spec here may cause the QUIC session to stale during TLS handshake.

Fixes openssl/project#1266

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

(cherry picked from commit cdbfacead0d07ed47fa1087d633acf6f6399aa2c)

9 days agoAdd a test of 'openssl storeutl' with a BER-encoded PKCS#12 file
Richard Levitte [Wed, 16 Jul 2025 13:08:48 +0000 (15:08 +0200)] 
Add a test of 'openssl storeutl' with a BER-encoded PKCS#12 file

The test file (test-BER.p12) was given to us by David von Oheimb

Co-Authored-By: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/28016)

(cherry picked from commit 49f8db53274191987b57d8e5542218690a983e35)

9 days agoFix OSSL_STORE to consider cached info in the EOF check.
Richard Levitte [Thu, 10 Jul 2025 15:55:50 +0000 (17:55 +0200)] 
Fix OSSL_STORE to consider cached info in the EOF check.

OSSL_STORE_load() called OSSL_STORE_eof() before checking if there is
cached OSSL_STORE_INFO to consider.  To fix this issue, the cached info
check is moved to OSSL_STORE_eof(), as that seems to make most common
sense.

This solves an issue with PKCS#12 files, where the cached info was never
considered because the underlying file IO layer signaled that EOF is
reached.

Fixes #28010

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/28016)

(cherry picked from commit 1f3af48c312a5f94612e9a822b78a3afdadc27c1)

10 days agosm2: sm2_sign.c: check EC_KEY_get0_private_key() for NULL in sm2_sig_gen()
AntonMoryakov [Mon, 2 Jun 2025 10:14:28 +0000 (13:14 +0300)] 
sm2: sm2_sign.c: check EC_KEY_get0_private_key() for NULL in sm2_sig_gen()

Static analysis revealed that sm2_sig_gen() dereferences the return value
of EC_KEY_get0_private_key() without checking for NULL. This could lead to
a crash if the private key is unset.

This patch adds a NULL check and raises ERR_R_PASSED_NULL_PARAMETER if the
key is missing.

Issue found by static analyzer:
> Return value of EC_KEY_get0_private_key() is dereferenced without checking for NULL (11/12 checked)

CLA: trivial
Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27741)

(cherry picked from commit c108ead2840a76a59fe02c049d08322a02b24761)

10 days agofix SM2 privatekey decode(PEM format, ECPrivateKey).
Alen Yan [Wed, 9 Jul 2025 01:23:00 +0000 (09:23 +0800)] 
fix SM2 privatekey decode(PEM format, ECPrivateKey).

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

(cherry picked from commit bd172dd0e1b76116402534aa4bb5c89d039e7762)

11 days agoopenssl rand command should use the loaded library context
Daniel Van Geest [Wed, 23 Jul 2025 08:30:57 +0000 (10:30 +0200)] 
openssl rand command should use the loaded library context

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

(cherry picked from commit e7d5398aa1349cc575a5b80e0d6eb28e61cb4bfa)

13 days agoRaise PROV_R_NULL_OUTPUT_BUFFER if shsec is NULL in ml_kem_encapsulate()
lanming [Thu, 10 Jul 2025 02:20:05 +0000 (10:20 +0800)] 
Raise PROV_R_NULL_OUTPUT_BUFFER if shsec is NULL in ml_kem_encapsulate()

Signed-off-by: lanming <lanming@huawei.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28009)

(cherry picked from commit 5d0c6c52e722f37f0254f8d5bfaf9b5c6b0df68b)

13 days agoAdd CODEOWNERS file
Dmitry Misharov [Fri, 18 Jul 2025 06:12:56 +0000 (08:12 +0200)] 
Add CODEOWNERS file

quarckster is the owner of the /.github/workflows/ directory.

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

(cherry picked from commit b3187ab5a757496e588ea9bdb7fabd12d194e66a)

2 weeks agopin GitHub Actions revisions from untrusted vendors
Dmitry Misharov [Mon, 31 Mar 2025 14:50:36 +0000 (16:50 +0200)] 
pin GitHub Actions revisions from untrusted vendors

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27209)

2 weeks agoUpdate container images in OS Zoo CI workflow
Dmitry Misharov [Wed, 16 Jul 2025 09:05:27 +0000 (11:05 +0200)] 
Update container images in OS Zoo CI workflow

Replace outdated and unsupported distro versions with up-to-date ones.

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

(cherry picked from commit a9a7e017b8cde8ea33918a63eec392b0f98979fe)

3 weeks agosec_mem: add note about the perf implications
Nikola Pajkovsky [Thu, 10 Jul 2025 07:03:38 +0000 (09:03 +0200)] 
sec_mem: add note about the perf implications

Testing secure storage for ml-kem/dsa [1] shows performace penalty
when secure storage is enabled.

| Threads | baseline usec/handshake | secmem usec/handshake |
|---------+-------------------------+-----------------------|
|       1 |              586.784756 |            588.306131 |
|       2 |              599.537648 |            601.007393 |
|       4 |              610.663361 |            613.600663 |
|       8 |              649.347376 |            869.693358 |
|      16 |             1176.402781 |           2487.335286 |
|      32 |             2345.594618 |           5155.747515 |
|      64 |             4697.556045 |          11170.627031 |

the test shows that sec mem is ok-ish up to the number of available cores,
and when the sec mem lock gets contended, performance goes down rapidly.
Tested on Apple M4 Pro.

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

Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
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 <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28011)

(cherry picked from commit b8cc32766060757254f31139d6c521465d796d0d)

3 weeks agoci: enable lms only on master
Nikola Pajkovsky [Fri, 11 Jul 2025 07:18:12 +0000 (09:18 +0200)] 
ci: enable lms only on master

a new config option cannot be enabled globally because the option
was not backported to the older versions.

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

(cherry picked from commit 4337989667b003bbf7ddc10984129d3cba298e8b)

3 weeks agoAdd note about use of EVP_PKEY in different libctxs
Michael Baentsch [Mon, 30 Jun 2025 07:33:46 +0000 (09:33 +0200)] 
Add note about use of EVP_PKEY in different libctxs

Co-authored-by: Shane Lontis <slontis@oracle.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26309)

(cherry picked from commit b2ac43b0d89b5b528941ad9d233b4cb4f99a7cca)

3 weeks agoPEM_read_CMS.pod: Correct the deprecation notice
Tomas Mraz [Fri, 20 Jun 2025 15:07:19 +0000 (17:07 +0200)] 
PEM_read_CMS.pod: Correct the deprecation notice

Fixes #27863

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27865)

(cherry picked from commit 9a6376dd75961c44232dae42943ceac10795a060)

3 weeks agotest/quic-openssl-docker/hq-interop/quic-hq-interop.c: Move BIO_free() to err label...
Jiasheng Jiang [Tue, 8 Jul 2025 23:18:43 +0000 (23:18 +0000)] 
test/quic-openssl-docker/hq-interop/quic-hq-interop.c: Move BIO_free() to err label to avoid memory leak

Relocate the BIO_free() call to the 'err' label to ensure the memory is properly freed in case of an error.

Fixes: ec6200bf0f ("Move hq-interop code to test/quic-openssl-docker")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27995)

(cherry picked from commit 13259a758ada910aec10313cd063ce54dacfc4a5)

3 weeks agoQUIC receiver may accidentally ACK packet it fails to process
Alexandr Nedvedicky [Wed, 9 Jul 2025 09:24:38 +0000 (11:24 +0200)] 
QUIC receiver may accidentally ACK packet it fails to process

we set ok to -1 as we enter ossl_quic_handle_frames().  If we
set ok to 0 here we effectively assume successful processing
of all frames found in packet. We do this just before
we return from function:

```
  1479
  1480     /* Now that special cases are out of the way, parse frames */
  1481     if (!PACKET_buf_init(&pkt, qpacket->hdr->data, qpacket->hdr->len)
  1482         || !depack_process_frames(ch, &pkt, qpacket,
  1483                                   enc_level,
  1484                                   qpacket->time,
  1485                                   &ackm_data))
  1486         goto end;
  1487
  1488     ok = 1;
  1489  end:
  1490     /*
  1491      * ASSUMPTION: If this function is called at all, |qpacket| is
  1492      * a legitimate packet, even if its contents aren't.
  1493      * Therefore, we call ossl_ackm_on_rx_packet() unconditionally, as long as
  1494      * |ackm_data| has at least been initialized.
  1495      */
  1496     if (ok >= 0)
  1497         ossl_ackm_on_rx_packet(ch->ackm, &ackm_data);
  1498
  1499     return ok > 0;
```

if the call to `depack_process_frames()` at line 1492 fails, because
barticualr frame in packet is corrupted/invalid we take a branch
to `end:` goto target. In this case we must avoid the call to
`ossl_ackm_on_rx_packet()`. Packet with malformed/invalid frame
must not be accepted. See RFC 9000 section 13.1:

    Once the packet has been fully processed, a receiver acknowledges
    receipt by sending one or more ACK frames containing the packet
    number of the received packet.

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

(cherry picked from commit e6c20588efa755c246f52d56891a889b201a015a)

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

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

Fixes #27940

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

(cherry picked from commit b321bf25c88f2e604f3dd387dd14e1e6369895ad)

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

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

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

(cherry picked from commit 36614faa98c5a947a635d3f44e78c7c36b722534)

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

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

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

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

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

(cherry picked from commit f2e45b6418fe9b969af1cb16843af8a7b73273c6)

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

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

(cherry picked from commit b63adfc58acba09f06050553957261aa19b58f0b)

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

Add check for the return value of BIO_new_file().

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

(cherry picked from commit 881ff0c225356a0f28bd55cea5a4c5204b7b7b8a)

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

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

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

(cherry picked from commit 8a7545607e872ccaff3018e2cd201cce65e615ec)

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

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

(cherry picked from commit bdb769841a32199cb0d0e6c03b09d4b515b49c70)

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

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

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

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

(cherry picked from commit 60775e31123e6ef66a7cf86f199289d6e250dceb)

4 weeks agoPrepare for 3.5.2 27933/head
openssl-machine [Tue, 1 Jul 2025 11:52:18 +0000 (11:52 +0000)] 
Prepare for 3.5.2

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Release: yes

4 weeks agoPrepare for release of 3.5.1 openssl-3.5.1
openssl-machine [Tue, 1 Jul 2025 11:52:08 +0000 (11:52 +0000)] 
Prepare for release of 3.5.1

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Release: yes

4 weeks agomake update
openssl-machine [Tue, 1 Jul 2025 11:52:07 +0000 (11:52 +0000)] 
make update

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Release: yes

4 weeks agoCopyright year updates
openssl-machine [Tue, 1 Jul 2025 11:50:25 +0000 (11:50 +0000)] 
Copyright year updates

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Release: yes

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

Release: yes

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

(cherry picked from commit f6c400f4ccaf6b36f5430aa3f6c94b704e335738)

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

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

CLA: Trivial

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

(cherry picked from commit b3161bd9a9329be3d6bf6b29a06835e2721898bb)

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

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

(cherry picked from commit de5a619aa015e7c8648e415975e5e2b722b2cbf7)

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

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

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

(cherry picked from commit 63cb8f99a13fdc4c7c3b1e88d66a3ff70b72e642)

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

Fixes #27890

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

(cherry picked from commit e7e79509986a3b6134ce3bbf30d7afcfd117c7eb)

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

Fixes #27891

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

(cherry picked from commit fa0c67a28a5a7d6ebeae7cb14d036780485e2fcd)

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

Increase the maximum number of signature algorithms.

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

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

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

(cherry picked from commit 7bdc0d13d2b9ce1c1d0ec1f89dacc16e5d045314)

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

Affected macros: ossl_likely and ossl_unlikely

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

(cherry picked from commit cdd01b5e0734b0324251b32a8edd97f42ba90429)

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

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

Fixes #27856

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

(cherry picked from commit b6ff5598539bf91608246ed81b4b534cbea6539d)

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

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

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

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

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

(cherry picked from commit 837592dcd994a22a7c8d08bf3cf421f6b2e51280)

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

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

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

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

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

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

(cherry picked from commit 403ba31a02e47d37070036529966d5a94d98c6fd)

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

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

(cherry picked from commit f7b10004dce1444a9712fc9e578e30576fcca6b6)

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

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

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

(cherry picked from commit 27eea04b0616847022847f6737e53704becae4c4)

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

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

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

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

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

(cherry picked from commit 48e3fe08639d84bd557c0d5248f5600f2fb1f7de)

6 weeks agoAdd strlen to symbols allowed on Windows
Tomas Mraz [Thu, 19 Jun 2025 08:59:10 +0000 (10:59 +0200)] 
Add strlen to symbols allowed on Windows

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27854)

(cherry picked from commit c296e1ce24d192d7ba52df4cd74eaec1a00ca7de)

6 weeks agoReport errors in ML-KEM pkey hash
Viktor Dukhovni [Fri, 11 Apr 2025 14:35:57 +0000 (00:35 +1000)] 
Report errors in ML-KEM pkey hash

When on import the public key hash of a private key fails to match the
public part, add an appropriate message to the error stack.  Previously,
the just failed to parse, without a reason.

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

(cherry picked from commit 8721def7fce8f895fa3e7b0eae9e577e5ecf32bb)

6 weeks agoAdd a test for SSL_set_verify with QUIC
Matt Caswell [Mon, 16 Jun 2025 15:01:52 +0000 (16:01 +0100)] 
Add a test for SSL_set_verify with QUIC

Check that we get the correct SSL object passed to the callback.

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

(cherry picked from commit fbb2a20732277ebf185ecaadb9e8570f8e9771d7)

6 weeks agoEnsure we pass the user SSL object for the SSL_set_verify callback
Matt Caswell [Mon, 16 Jun 2025 15:00:13 +0000 (16:00 +0100)] 
Ensure we pass the user SSL object for the SSL_set_verify callback

When calling the verify callback we need to ensure we supply the user SSL
object, and not any internal SSL object.

Fixes #27830

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

(cherry picked from commit 4b148ebb66cdac8a095f22cbdfa475d68c947f7a)

6 weeks agocheck-format.pl: prevent false positive on typedef with space and '(' after type...
Dr. David von Oheimb [Mon, 16 Jun 2025 14:43:03 +0000 (16:43 +0200)] 
check-format.pl: prevent false positive on typedef with space and '(' after type name

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

(cherry picked from commit 4a3809f7056b78031e72fc4e90eec3e708ca27e1)

6 weeks agocheck-format-test-negatives.c: add 2nd macro indent test and hint on how known false...
Dr. David von Oheimb [Fri, 13 Jun 2025 14:44:08 +0000 (16:44 +0200)] 
check-format-test-negatives.c: add 2nd macro indent test and hint on how known false positives are marked

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

(cherry picked from commit e925b99f9435826aca3fa41b7661e6e9fa7e10b6)

6 weeks agocheck-format.pl: prevent reporting "{ 1 stmt }" on "else if" branch unless -1 or...
Dr. David von Oheimb [Mon, 9 Jun 2025 13:54:05 +0000 (15:54 +0200)] 
check-format.pl: prevent reporting "{ 1 stmt }" on "else if" branch unless -1 or --1-stmt option is given

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

(cherry picked from commit f21a8391dd0ec3a0dbdc5dc5fa8b44a0b07abf6d)

6 weeks agocheck-format.pl: allow block for switch case/default
Dr. David von Oheimb [Mon, 9 Jun 2025 11:15:58 +0000 (13:15 +0200)] 
check-format.pl: allow block for switch case/default

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

(cherry picked from commit 560ea7ffbf5abac871a8d53f6aa3a44ac0349619)

6 weeks agocheck-format-test-positives.c slightly improve comment describing the '*@' tags
Dr. David von Oheimb [Tue, 6 May 2025 07:01:37 +0000 (09:01 +0200)] 
check-format-test-positives.c slightly improve comment describing the '*@' tags

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

(cherry picked from commit 58eb08985c485bf2fe010fb59c13ad0df2e0faa3)

6 weeks agoadapt check-format-test-positives.c for too long lines after limit was relaxed from...
Dr. David von Oheimb [Tue, 6 May 2025 06:56:52 +0000 (08:56 +0200)] 
adapt check-format-test-positives.c for too long lines after limit was relaxed from 80 to 100

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

(cherry picked from commit e6476de58d8e3440e3585843fd9ee62dd187f957)

7 weeks agofix: Better documentation on DTLS_set_timer_cb()
noctuelles [Tue, 10 Jun 2025 20:37:46 +0000 (22:37 +0200)] 
fix: Better documentation on DTLS_set_timer_cb()

Also more precise description of DTLS timeout mechanism.

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

(cherry picked from commit 49885aebe7cafc5caaa6929d0ed5a946e7f09c45)

7 weeks agoossl_rio_poll_builder_add_fd(): Fixup pfds after reallocation
sashan [Wed, 11 Jun 2025 06:23:38 +0000 (08:23 +0200)] 
ossl_rio_poll_builder_add_fd(): Fixup pfds after reallocation

Local variable `pfds` used in `ossl_rio_poll_builder_add_fd()` must be consistent
with `rpb->pfd_heap`. The function maintains array of SSL objects for SSL_poll(3ossl).
It works with no issues until we need to reallocate `rbp->pfd_heap` in `rpb_ensure_alloc()`.
After `rpb_ensure_alloc()` returns we must update local variable `pfds` with `rpb->pfd_heap`
not doing so makes function to write to dead buffer.

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

(cherry picked from commit 5ee8248d083c00583d52350ed9464bfb58d2f60c)

7 weeks agotest/helpers/quictestlib.c: Use goto instead of return to avoid memory leak
JiashengJiang [Mon, 12 May 2025 13:59:02 +0000 (09:59 -0400)] 
test/helpers/quictestlib.c: Use goto instead of return to avoid memory leak

When TEST_ptr(*cssl) fails, bdata should be freed to avoid memory leak.

Fixes: a55b689 ("Use reported short conn id len in qtestlib")
Signed-off-by: JiashengJiang <jiasheng@purdue.edu>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27599)

(cherry picked from commit de1e4989d564ea9a6d2960204806a1f3537419ad)

7 weeks agos390x: Fix HMAC to fail update or final call when already finalized
Ingo Franzki [Fri, 6 Jun 2025 12:20:38 +0000 (14:20 +0200)] 
s390x: Fix HMAC to fail update or final call when already finalized

After commit a5d1eadde1d566b528cfe495953300cd9f9fe1e9 the test step
'test_hmac_final_update_fail' of 'test_hmac' fails.

Return an error when update or final is used after the context has
already been finalized. Flag 'iimp' (intermediate-input-message-part)
must be 1 to allow an update or final call. If iimp is 0, then the
context has already been finalized.

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

(cherry picked from commit 339ced70da1206bf090c3de981093b99cfa0d39a)

7 weeks agoreturn NULL if gctx allocation fails.
Bartel Artem [Wed, 11 Jun 2025 03:58:31 +0000 (06:58 +0300)] 
return NULL if gctx allocation fails.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27795)

(cherry picked from commit 443298e0f0e2c8225f8c6d6fdc01c6c4d434028b)

7 weeks agocheck gctx for NULL before cleanup.
Bartel Artem [Tue, 10 Jun 2025 10:11:41 +0000 (13:11 +0300)] 
check gctx for NULL before cleanup.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27795)

(cherry picked from commit 02f9c9342d54c99981b0a83088982bf0d1083d7f)

7 weeks agoAllow our *_gen_cleanup functions to tolerate a NULL ctx
Matt Caswell [Wed, 11 Jun 2025 08:50:16 +0000 (09:50 +0100)] 
Allow our *_gen_cleanup functions to tolerate a NULL ctx

Our *_gen_cleanup functions are essentially "free" functions. Our
free functions tolerate NULL being passed. We are being inconsistent with
our *_gen_cleanup functions. Some of them tolerate NULL and others do not.

We should consistently tolerate NULL.

See also #27795

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

(cherry picked from commit fcc5df53697a63d0f153b0086054f509aad8e6bb)

7 weeks agogenpkey.c: Fix filename copy & paste bug in error output
Bartel Artem [Mon, 9 Jun 2025 04:23:06 +0000 (07:23 +0300)] 
genpkey.c: Fix filename copy & paste bug in error output

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27789)

(cherry picked from commit a4c5096d16a78d2c24f2880fba1ec7056eb3a96f)

7 weeks agoSilence -Wstringop-overflow warnings with gcc 14 on s390x
Ingo Franzki [Wed, 28 May 2025 06:55:49 +0000 (08:55 +0200)] 
Silence -Wstringop-overflow warnings with gcc 14 on s390x

Compiling OpenSSL on s390x with gcc 14 (i.e. in Fedora 41) shows several
-Wstringop-overflow warnings in providers/implementations/rands/drbg_ctr.c
and test/params_api_test.c.

Add explicit length checks to let the compiler know that it won't overrun
the buffer. This also silences the warnings.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27710)

(cherry picked from commit 9a788281d91f698d6a229d588b9cb36987549669)

7 weeks agoAllow keygen after dup of minimal PKEY ctx
Viktor Dukhovni [Tue, 13 May 2025 15:23:25 +0000 (01:23 +1000)] 
Allow keygen after dup of minimal PKEY ctx

It should be possible to repeatedly duplicate a PKEY CTX created via
EVP_PKEY_CTX_new_from_name() that has not yet been assigned an
"operation" (e.g. via EVP_PKEY_CTX_keygen_init()), and then perform
keygen_init() and keygen() on the duplicated copies.

When the operation is not yet set, all that's needed is to not try to
use the key if one isn't set yet.

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

(cherry picked from commit 2c74a8d1ef4e9c4b4468afefedb1f72425772a37)

7 weeks agoFix SHAKE AlgorithmIdentifier encodings
Daniel Van Geest [Fri, 28 Mar 2025 10:40:32 +0000 (10:40 +0000)] 
Fix SHAKE AlgorithmIdentifier encodings

NIST CSOR specifies that the id-shake128 and id-shake256
algorithm identifiers, like the SHA-3 ones, do not carry
any parameters.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27190)

(cherry picked from commit bef03c6a24f02df4e670697b16b6d7c8b1b604b4)

7 weeks agofix: add parsing check in TLS compress_certificate extension handler
yexiaochuan [Sat, 31 May 2025 09:47:58 +0000 (17:47 +0800)] 
fix: add parsing check in TLS compress_certificate extension handler

The tls_parse_compress_certificate function was missing validation
for trailing bytes after parsing the algorithm list, violating
RFC8446 section 4.2 which requires sending a decode_error alert
for unparseable messages.

This commit adds a check for remaining bytes in the packet after
the while loop and sends SSL_AD_DECODE_ERROR if any trailing
bytes are found.

Fixes #27717

CLA: trivial

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

(cherry picked from commit 8e787b102848e462a6d231883e2c42d91978c049)

8 weeks agocrypto/evp/ctrl_params_translate.c: prevent clashes of generic names NONE, GET, SET
Dr. David von Oheimb [Thu, 5 Jun 2025 11:16:13 +0000 (13:16 +0200)] 
crypto/evp/ctrl_params_translate.c: prevent clashes of generic names NONE, GET, SET

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27773)

(cherry picked from commit c37b9e3425c8576d089342c7cfdcc4dc0aedde54)

8 weeks agorand: add argument error checking to EVP_RAND_nonce()
Pauli [Thu, 5 Jun 2025 03:28:37 +0000 (13:28 +1000)] 
rand: add argument error checking to EVP_RAND_nonce()

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27766)

(cherry picked from commit a2cd7ecd75dcd0de214319ec11bf5b3701bec7a3)

8 weeks agorand: document the EVP_RAND_nonce() return correctly
Pauli [Thu, 5 Jun 2025 02:02:52 +0000 (12:02 +1000)] 
rand: document the EVP_RAND_nonce() return correctly

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27766)

(cherry picked from commit e81b252a955ae380c3af6129b0f9054c2594b8d6)

8 weeks agorand: produce correct return from EVP_RAND_nonce
Pauli [Wed, 4 Jun 2025 23:50:59 +0000 (09:50 +1000)] 
rand: produce correct return from EVP_RAND_nonce

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27766)

(cherry picked from commit a2b9120d15073ab596452fc361d01bb26ee13773)

8 weeks agorand: fix memory overrun bug
Pauli [Wed, 4 Jun 2025 23:50:34 +0000 (09:50 +1000)] 
rand: fix memory overrun bug

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27766)

(cherry picked from commit da585e214cf98468e28f4c12ec96ecc7a6192746)

8 weeks agorand: add unit test exhibiting memory overrun
Pauli [Wed, 4 Jun 2025 23:50:20 +0000 (09:50 +1000)] 
rand: add unit test exhibiting memory overrun

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27766)

(cherry picked from commit 6d490a92fe49ea6e41cb7874086dbad5462078c6)

8 weeks agoAdd a test to confirm that we can repeatedly create and destroy keys
Neil Horman [Thu, 5 Jun 2025 12:54:56 +0000 (08:54 -0400)] 
Add a test to confirm that we can repeatedly create and destroy keys

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

(cherry picked from commit b994ce4088fb52e769ee5e3e49bdde3030fadaf7)

8 weeks agoAllow for reuse of thread_local keys in threads_none
Neil Horman [Thu, 5 Jun 2025 12:25:52 +0000 (08:25 -0400)] 
Allow for reuse of thread_local keys in threads_none

If openssl is configured with no-threads, the implementation has a hard
limit of 256 LIB_CTX values, as each LIB_CTX allocates a thread local
key, and we never reuse them (like libc does when using
pthread_key_create/destroy.

Improve the situation by allowing for marking freed keys as unsued and
searching for an available key when allocating

Fixes #27757

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

(cherry picked from commit b6d01d1b1fef2e98a956b7ba4e8443cf7d916dcb)

8 weeks agoFix NIST ACVP server URLs in SLH-DSA test files
Yaroslav Lelkin [Thu, 5 Jun 2025 05:50:43 +0000 (10:50 +0500)] 
Fix NIST ACVP server URLs in SLH-DSA test files

CLA: trivial

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27770)

(cherry picked from commit 07c772847de682412448daea07582f566d30f7ac)

8 weeks agoRemove _strlen31
Neil Horman [Wed, 4 Jun 2025 19:48:45 +0000 (15:48 -0400)] 
Remove _strlen31

This function is old and fairly broken.  Code archeology in our git tree
hasn't revealed why it was creted (though it may have possibly been to
support older win32 systems that couldn't do 64 bit integers properly,
like windows 95/98).

There seems to be no good reason to keep it around, and given that it
has potentially serious side effects, lets just remove it.

Fixes #27761

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27763)

(cherry picked from commit b0d363a2cb039eac2908b7cb00b395235373193e)

8 weeks agoFix use of IO::Socket::IP on windows 2025
Neil Horman [Fri, 6 Jun 2025 00:57:35 +0000 (20:57 -0400)] 
Fix use of IO::Socket::IP on windows 2025

Apparently IO::Socket::IP has several odd behaviors on windows 2025,
notably indicating that AF_INET6 isn't a supported family when it
clearly is.

Follow the pattern in determinig the haveIPV6 variable in Proxy.pm, and
record if we determine IPv6 availablity with the IP class or the INET6
class and use the same method when testing port binding

Fixes project/#1213

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
(Merged from https://github.com/openssl/openssl/pull/27780)

(cherry picked from commit ae404a9b3bd052963b76434bcc97757d1d6d502e)

8 weeks agoTest randomly selected client port for availabilty in sslrecords test
Neil Horman [Tue, 3 Jun 2025 20:02:15 +0000 (16:02 -0400)] 
Test randomly selected client port for availabilty in sslrecords test

Encountered this error in a pr today:
https://github.com/openssl/openssl/actions/runs/15418713146/job/43387767612

===
Proxy started on port [::1]:56662
Engine "ossltest" set.
Using default temp DH parameters
ACCEPT [::1]:59189
Server responds on [::1]:59189
Engine "ossltest" set.
C0774F02907F0000:error:80000062:system library:BIO_bind:Address already in use:crypto/bio/bio_sock2.c:240:calling bind()
C0774F02907F0000:error:10000075:BIO routines:BIO_bind:unable to bind socket:crypto/bio/bio_sock2.c:242:
connect:errno=98
===

Its occuring because we randomly select a port to use for our client
connection in the sslrecords test.  Thats usually fine, but sometimes,
we get unlucky and pick a port thats already in use.  This presents as
random failures in our CI on this test.

So lets try harden ourselves against it.  When creating the client
connection, test the randomly selected port by trying to bind to it via
a call to IO::Socket::IP->new(). If that fails, try a different port
number, until we get one that works.  If it works, use that port in the
assignment for the clients local port value.

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

(cherry picked from commit f78f824c8e4064148af1186490e9b445871765fd)

2 months agoapps/x509.c: re-add ERR queue printing on errors
Dr. David von Oheimb [Sun, 1 Jun 2025 14:35:31 +0000 (16:35 +0200)] 
apps/x509.c: re-add ERR queue printing on errors

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

(cherry picked from commit ac85974bc34dc18830fa9401a7d4756dbd2d9e35)

2 months agoSplit arguments taking quotes into account
Viktor Dukhovni [Sun, 1 Jun 2025 02:47:15 +0000 (12:47 +1000)] 
Split arguments taking quotes into account

CA.pl supports interpolating multiple arguments into the executed
commands.  Previously these were evaluated by a shell, which supported
quoting of values that contain whitespace, backslashes, ...

With a shell no longer used (avoid command injection), backwards
compatibility requires some similar functionality.  The code now handles
double and single-quoted strings (shell-style word splitting), but not
parameter expansion ($foo remains unexpanded) or command substitution
(`cmd` and $(cmd) remain unexpanded).

On Windows system(@LIST) does not correctly preserve argv, do our
own quoting instead and use system(<$quoted_cmd>).

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27432)

(cherry picked from commit 287bbb28b09e930a8691efc92a5087bb951edb6b)

2 months agoAvoid shell commandline processing in CA.pl
Viktor Dukhovni [Fri, 18 Apr 2025 04:18:09 +0000 (14:18 +1000)] 
Avoid shell commandline processing in CA.pl

The CA.pl script used to build single-string string commandlines to pass
to a shell via `system(command_string)`.  That was fragile and not a best
practice.

This PR replaces `system(command_string)` with `system { executable } @argv`,
which avoids the shell whenever possible (at least Unix-like systems and
Windows).  The only question mark is whether some sort of quoting is
needed for VMS to preserve the case of commandline arguments even when
processes are spawned directly, rather than via the shell.

Unfortunately, given the way that some environment variables and
command-line options are used to construct the commands to run,
the result is still brittle.  The CA.pl utility really should
be replaced with something better.

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27432)

(cherry picked from commit 0b1bdef38ef1e3369a7bcde1b9a6eabe44b10e54)

2 months agoAdd a CHANGES.md entry regarding no_renegotiation alert
Matt Caswell [Mon, 2 Jun 2025 14:45:06 +0000 (15:45 +0100)] 
Add a CHANGES.md entry regarding no_renegotiation alert

Highight the bug being fixed for DTLS users

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27591)

(cherry picked from commit df5dff26efb6cdc96ebe50c35af394a1121e77fe)