]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
5 months agoRefactor EVP_SKEY initialization
Tomas Mraz [Mon, 17 Feb 2025 11:06:30 +0000 (12:06 +0100)] 
Refactor EVP_SKEY initialization

Enforce that skeymgmt cannot ever be NULL in EVP_SKEY.

Also add missing allocation checks.

Fixes multiple issues found by Coverity.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/26795)

5 months agoMake org.openssl.winstore: work in openssl-ts
Shakti Shah [Wed, 19 Feb 2025 16:08:36 +0000 (21:38 +0530)] 
Make org.openssl.winstore: work in openssl-ts

Fixes #26739

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

5 months agoSet op_num to 0
Andrew Dinh [Wed, 19 Feb 2025 11:24:47 +0000 (18:24 +0700)] 
Set op_num to 0

Here, op_num is just used for logging purposes (number of completed operations), so start it at 0

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

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

5 months agoFix coverity finding
Dmitry Belyavskiy [Wed, 19 Feb 2025 14:27:57 +0000 (15:27 +0100)] 
Fix coverity finding

Coverity ID: 1643094

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26831)

5 months agossl_lib.c: Check for NULL from SSL_CONNECTION_FROM_SSL()
Andrew Dinh [Wed, 19 Feb 2025 06:41:03 +0000 (13:41 +0700)] 
ssl_lib.c: Check for NULL from SSL_CONNECTION_FROM_SSL()

Fixes https://scan5.scan.coverity.com/#/project-view/62507/10222?selectedIssue=1643027
Fixes https://scan5.scan.coverity.com/#/project-view/62507/10222?selectedIssue=1643028

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

5 months agoEC_get_buildin_curves does not return an error, this check is unnecessary.
otherddn1978 [Wed, 12 Feb 2025 10:54:46 +0000 (13:54 +0300)] 
EC_get_buildin_curves does not return an error, this check is unnecessary.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

unused code has been removed

delete whitespace

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

5 months agoNULL checks for QUIC code
Andrew Dinh [Wed, 19 Feb 2025 06:49:06 +0000 (13:49 +0700)] 
NULL checks for QUIC code

Fixes https://scan5.scan.coverity.com/#/project-view/62507/10222?selectedIssue=1643033
Fixes https://scan5.scan.coverity.com/#/project-view/62507/10222?selectedIssue=1643032
Fixes https://scan5.scan.coverity.com/#/project-view/62507/10222?selectedIssue=1643031
Fixes https://scan5.scan.coverity.com/#/project-view/62507/10222?selectedIssue=1643030
Fixes https://scan5.scan.coverity.com/#/project-view/62507/10222?selectedIssue=1643029

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

5 months agoCI: ssl-trace is enabled by default
Tomas Mraz [Tue, 18 Feb 2025 07:44:40 +0000 (08:44 +0100)] 
CI: ssl-trace is enabled by default

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

5 months agotest/quicapitest.c: Fix build with no-ssl-trace
Tomas Mraz [Tue, 18 Feb 2025 07:42:12 +0000 (08:42 +0100)] 
test/quicapitest.c: Fix build with no-ssl-trace

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

5 months agofix: add check for NULL zalloc in tls-provider.c (reverse if statement)
Burkov Egor [Tue, 18 Feb 2025 09:49:07 +0000 (12:49 +0300)] 
fix: add check for NULL zalloc in tls-provider.c (reverse if statement)

CLA: trivial

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

5 months agoConfigurable import-time PCT for ML-KEM
Viktor Dukhovni [Fri, 14 Feb 2025 17:36:25 +0000 (04:36 +1100)] 
Configurable import-time PCT for ML-KEM

And related cleanup.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26789)

5 months agoslh-dsa: use fast flavours for FIPS Power Up Self Test
Pauli [Wed, 19 Feb 2025 03:51:18 +0000 (14:51 +1100)] 
slh-dsa: use fast flavours for FIPS Power Up Self Test

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26821)

5 months agotestutil: remove unused buffer from stanza structure
Pauli [Mon, 17 Feb 2025 08:42:46 +0000 (19:42 +1100)] 
testutil: remove unused buffer from stanza structure

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/26750)

5 months agoslh-dsa: update changes authorship
Pauli [Mon, 17 Feb 2025 03:56:11 +0000 (14:56 +1100)] 
slh-dsa: update changes authorship

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/26750)

5 months agoslh-dsa: add key generation tests
Pauli [Sun, 16 Feb 2025 23:46:34 +0000 (10:46 +1100)] 
slh-dsa: add key generation tests

These are reasonably fast so are not flagged as extended tests.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/26750)

5 months agoslhdsa: add Python script to convert NIST ACVP data to evp_test format
Pauli [Sun, 16 Feb 2025 23:46:12 +0000 (10:46 +1100)] 
slhdsa: add Python script to convert NIST ACVP data to evp_test format

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/26750)

5 months agoslh-dsa: change the seed parameter name from entropy to seed
Pauli [Sun, 16 Feb 2025 22:53:10 +0000 (09:53 +1100)] 
slh-dsa: change the seed parameter name from entropy to seed

This brings it inline with the same parameter for ML-KEM and ML-DSA.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/26750)

5 months agoevp_test: include signature generation and verification tests for SLH-DSA
Pauli [Fri, 14 Feb 2025 02:47:05 +0000 (13:47 +1100)] 
evp_test: include signature generation and verification tests for SLH-DSA

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/26750)

5 months agoslh-dsa: add signature generation tests
Pauli [Fri, 14 Feb 2025 01:55:21 +0000 (12:55 +1100)] 
slh-dsa: add signature generation tests

This marks the first use of the extended test feature in evp_test.
The reason behind this is the amount of time the full SLH-DSA tests consume.
The non-extended tests chosen so that they exercise all of the algorithms
at least once and all the varying combinations of features for the fast
algorithms.

On my build machine the full test suite takes: 290 seconds.
With the reduction to a dozen tests it takes: 10.5 seconds.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/26750)

5 months agoslh-dsa: add signature verification failure tests
Pauli [Fri, 14 Feb 2025 02:13:44 +0000 (13:13 +1100)] 
slh-dsa: add signature verification failure tests

These are fast and don't require reduction in number.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/26750)

5 months agoevp_test: add a Verify-Message-Public test type
Pauli [Fri, 14 Feb 2025 01:54:59 +0000 (12:54 +1100)] 
evp_test: add a Verify-Message-Public test type

This is like Verify-Message but accepts a public key instead of a private one.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/26750)

5 months agotestutil: increase the line length for reading stanzas
Pauli [Fri, 14 Feb 2025 02:00:59 +0000 (13:00 +1100)] 
testutil: increase the line length for reading stanzas

PQC algorithms and SLH-DSA in particular have very long lines of data.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/26750)

5 months agocoverage: enable extended EVP tests
Pauli [Thu, 13 Feb 2025 22:45:28 +0000 (09:45 +1100)] 
coverage: enable extended EVP tests

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/26750)

5 months agoevp_test: add concept of extended tests to evp_test
Pauli [Thu, 13 Feb 2025 22:43:54 +0000 (09:43 +1100)] 
evp_test: add concept of extended tests to evp_test

These tests are not run by default, instead they run when the EVP_TEST_EXTENDED environment variable
has an integer value other than zero.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/26750)

5 months agoMore consistent ML-KEM key checks
Viktor Dukhovni [Tue, 18 Feb 2025 07:42:41 +0000 (18:42 +1100)] 
More consistent ML-KEM key checks

- Cross-check seed `z` value on import as well as load.
- In import/load When re-generating from a seed, check hash of any
  explicit private key when both provided.
- Avoid leak of expanded key encoding when load fails.

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

5 months agoTypo fix
Viktor Dukhovni [Tue, 18 Feb 2025 09:41:13 +0000 (20:41 +1100)] 
Typo fix

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/26813)

5 months agoMerge quic client and quic server interop CI
Neil Horman [Mon, 17 Feb 2025 18:59:53 +0000 (13:59 -0500)] 
Merge quic client and quic server interop CI

Now that quic server is merged, we can merge the CI jobs that test the
client and server interop tests

Fixes openssl/project#1105

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

5 months agoAdd the SSL_NO_EOED macro test
Cheng Zhang [Thu, 13 Feb 2025 03:01:34 +0000 (11:01 +0800)] 
Add the SSL_NO_EOED macro test

test_no_end_of_early_data

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

5 months agoAdd the SSL_NO_EOED internal macro
Cheng Zhang [Tue, 11 Feb 2025 08:13:26 +0000 (16:13 +0800)] 
Add the SSL_NO_EOED internal macro

The TLS EndOfEarlyData message is not applicable in some scenarios (e.g., QUIC).
This adds a macro to handle this message.

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

5 months agossl3_ctrl(): Fix condition in SSL_CTRL_GET_PEER_SIGNATURE_NAME
Viktor Dukhovni [Tue, 18 Feb 2025 14:44:17 +0000 (01:44 +1100)] 
ssl3_ctrl(): Fix condition in SSL_CTRL_GET_PEER_SIGNATURE_NAME

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

5 months agoRelax checking of supported-groups/keyshare ordering
Neil Horman [Tue, 18 Feb 2025 14:01:40 +0000 (09:01 -0500)] 
Relax checking of supported-groups/keyshare ordering

quic interop testing showed that interop with the mvfst client was
failing, due to detecting mis ordering of supported groups and keyshare
extensions

This is strictly a mvfst problem to fix, but RFC 8446 indicates that we
MAY check the ordering but don't strictly have to.

We've opened an issue with the client to fix this, but in the interests
of client compatibility relax the ordering check so that, instead of
issuing a fatal alert, we just log a trace message indicating the
discrepancy

Fixes openssl/project#1106

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

5 months agoFix memory leak in ecdsa_keygen_knownanswer_test
Neil Horman [Mon, 17 Feb 2025 14:24:26 +0000 (09:24 -0500)] 
Fix memory leak in ecdsa_keygen_knownanswer_test

We allocate an EC_POINT with EC_POINT_new here, but in failing a
subsequent check, we don't free it, correct that.

Fixes #26779

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/26799)

5 months agoML-KEM Add ACVP tests using latest values from
slontis [Mon, 17 Feb 2025 23:54:35 +0000 (10:54 +1100)] 
ML-KEM Add ACVP tests using latest values from

https://github.com/usnistgov/ACVP-Server/blob/master/gen-val/json-files/
Which are parsed using mlkem_parse.py

The existing BoringSSL related .txt files have been left in place.

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

5 months ago ML-KEM: Modify existing ML-KEM keygen tests to not use custom data.
slontis [Mon, 17 Feb 2025 23:51:48 +0000 (10:51 +1100)] 
 ML-KEM: Modify existing ML-KEM keygen tests to not use custom data.

There are general input and output controls that are used instead.
Also fix a memory leak in keygen.

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

5 months agossl_test: correctly handle ML-DSA being disabled
Pauli [Tue, 18 Feb 2025 01:45:58 +0000 (12:45 +1100)] 
ssl_test: correctly handle ML-DSA being disabled

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26806)

5 months agomldsa: add run-checker workflow for no-ml-dsa option
Pauli [Mon, 17 Feb 2025 23:04:58 +0000 (10:04 +1100)] 
mldsa: add run-checker workflow for no-ml-dsa option

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26806)

5 months agoml-kem: add ML-KEM to bulk disable cascade
Pauli [Mon, 17 Feb 2025 23:08:11 +0000 (10:08 +1100)] 
ml-kem: add ML-KEM to bulk disable cascade

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26807)

5 months agoml-dsa: test ML-DSA under FIPS
Pauli [Mon, 17 Feb 2025 23:02:10 +0000 (10:02 +1100)] 
ml-dsa: test ML-DSA under FIPS

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/26805)

5 months agoFix coverity issues
Dmitry Belyavskiy [Mon, 17 Feb 2025 10:16:34 +0000 (11:16 +0100)] 
Fix coverity issues

Fixes coverity issues 16429641642965164296616429681642969

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

5 months agoFree hashtable prior to freeing atomic worker_lock
Neil Horman [Mon, 17 Feb 2025 15:13:32 +0000 (10:13 -0500)] 
Free hashtable prior to freeing atomic worker_lock

lhash_test uses a hashtable that may not be empty at the end of the test

Given that the free function frees the elements in the list and uses the
atomic worker_lock to do so, we need to free the hash table prior to
freeing the working lock to avoid the use of unallocated memory.

Fixes #26798

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26800)

5 months agoAdds missing checks of return from XXX_up_ref(). feature/evp_skey
Frederik Wedel-Heinen [Sat, 28 Dec 2024 09:13:48 +0000 (10:13 +0100)] 
Adds missing checks of return from XXX_up_ref().

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

5 months agoDo not call BIO_printf() from FIPS_MODULE
Tomas Mraz [Thu, 13 Feb 2025 20:00:03 +0000 (21:00 +0100)] 
Do not call BIO_printf() from FIPS_MODULE

Fixes #26743

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

5 months agoOSSL_CMP_MSG_http_perform(): support using BIO from OSSL_CMP_CTX_set_transfer_cb_arg()
Dr. David von Oheimb [Tue, 4 Feb 2025 13:12:23 +0000 (14:12 +0100)] 
OSSL_CMP_MSG_http_perform(): support using BIO from OSSL_CMP_CTX_set_transfer_cb_arg()

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

5 months agoInitial slh-dsa fuzzer 26788/head
Neil Horman [Fri, 7 Feb 2025 19:37:57 +0000 (14:37 -0500)] 
Initial slh-dsa fuzzer

Current preforms the following operations

1) Generates arbitrary key pairs
2) Generates key pairs with parameters (both correct and incorrect)
   based on fuzzer input buffer
3) Exports and re-imports keys, confirming validity
4) Preforms Sign and Verify operations with optional parameters based on
   fuzzer input buffer

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

5 months agoSLH-DSA: Add EVP_PKEY_CTX_dup() support.
slontis [Tue, 11 Feb 2025 04:30:59 +0000 (15:30 +1100)] 
SLH-DSA: Add EVP_PKEY_CTX_dup() support.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/26701)

5 months agoSLH_DSA: Make apps.c do_X509_REQ_verify() call work correctly.
slontis [Tue, 4 Feb 2025 06:39:34 +0000 (17:39 +1100)] 
SLH_DSA: Make apps.c do_X509_REQ_verify() call work correctly.

- Added sigid_algs for SLH_DSA such that OBJ_find_sigid_algs() works.
- OBJ_sn2nid() was also being called, so the SN form of SLH_DSA
  algorithms needed to be added to the provider dispatch tables.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26625)

5 months agoSLH_DSA: Add support for generating X509 certs via the openssl
slontis [Tue, 4 Feb 2025 03:35:38 +0000 (14:35 +1100)] 
SLH_DSA: Add support for generating X509 certs via the openssl
command line app.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26625)

5 months agoSLH-DSA cleanups
slontis [Tue, 28 Jan 2025 03:14:53 +0000 (14:14 +1100)] 
SLH-DSA cleanups

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoSLH-DSA More fixups
slontis [Thu, 23 Jan 2025 03:51:42 +0000 (14:51 +1100)] 
SLH-DSA More fixups

Also added slh_dsa_key_dup()

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoSLH-DSA: Remove legacy ASN1 method tables for SLH-DSA. Update to use
slontis [Wed, 22 Jan 2025 23:26:51 +0000 (10:26 +1100)] 
SLH-DSA: Remove legacy ASN1 method tables for SLH-DSA. Update to use
custom encoders for SLH_DSA decode_der2key.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoSLH-DSA cleanups
slontis [Wed, 22 Jan 2025 21:20:58 +0000 (08:20 +1100)] 
SLH-DSA cleanups

Addressed some review comments.
- Ref counting has been removed from SLH_DSA_KEY (EVP_PKEY is responsible
for the keys ref counting).
- Moved constants and prefetched objects into SLH_DSA_KEY.
- The SLH_DSA_HASH_CTX is still required since there are multiple
  contexts that need to propagate to a lot of functions, but it no
  longer contains the constants. Note that it also holds a pointer to
  the SLH_DSA_KEY.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoAdd SLH_DSA key validation.
slontis [Thu, 21 Nov 2024 05:09:18 +0000 (16:09 +1100)] 
Add SLH_DSA key validation.

The pairwise test requires that the computed PK_ROOT key matches the
keys PK_ROOT value. The public and private key tests just require the
key elements to exist.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoAdd SLH-DSA FIPS self tests
slontis [Thu, 21 Nov 2024 01:15:24 +0000 (12:15 +1100)] 
Add SLH-DSA FIPS self tests

This requires a keygen test, as well as Sign/Verify tests for at least 1
sha2 algorithm and 1 shake related algorithm.

A pairwise consistency test has also been added to the key generation.

Note that self test datat for the signature is currently stored as a
sha256 digest in order to reduce the memory footprint.
(Since the signature size for sha2/shake using 128s = ~8K, and for 128f = ~17K)

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoAdd SLH-DSA encoder/decoder support.
slontis [Tue, 19 Nov 2024 04:40:13 +0000 (15:40 +1100)] 
Add SLH-DSA encoder/decoder support.

This required adding additional EVP_PKEY_ASN1_METHOD methods.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoAddress style check nits for SLH-DSA
slontis [Tue, 12 Nov 2024 23:59:10 +0000 (10:59 +1100)] 
Address style check nits for SLH-DSA

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoUpdate SLH-DSA code to use PACKET and WPACKET.
slontis [Tue, 12 Nov 2024 07:35:10 +0000 (18:35 +1100)] 
Update SLH-DSA code to use PACKET and WPACKET.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoUpdate SLH-DSAto use EVP_PKEY_sign_message_init() instead of using the
slontis [Sun, 10 Nov 2024 23:41:35 +0000 (10:41 +1100)] 
Update SLH-DSAto use EVP_PKEY_sign_message_init() instead of using the
prehashed variant.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoAdd SLH-DSA design document
slontis [Fri, 8 Nov 2024 06:23:18 +0000 (17:23 +1100)] 
Add SLH-DSA design document

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoAdd SLH-DSA documentation
slontis [Fri, 8 Nov 2024 05:16:59 +0000 (16:16 +1100)] 
Add SLH-DSA documentation

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoSLH-DSA clean ups
slontis [Fri, 8 Nov 2024 05:08:31 +0000 (16:08 +1100)] 
SLH-DSA clean ups

- Make slh_dsa_sign() return the siglen when sig is NULL.
- Remove the ability in fromdata to generate the public key root
  given the private key and public key seed. This was messy and can
  be done by key generation instead.
- Add common EVP_PKEY gettablesto SLH_DSA keys
  (OSSL_PKEY_PARAM_BITS, OSSL_PKEY_PARAM_SECURITY_BITS, and
   OSSL_PKEY_PARAM_MAX_SIZE).
- Update tests based on the above changes.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoZeorize some secret values in SLH_DSA
slontis [Thu, 7 Nov 2024 10:01:27 +0000 (21:01 +1100)] 
Zeorize some secret values in SLH_DSA

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoAdded return code checks to SLH_DSA Hash functions and propogated the
slontis [Thu, 7 Nov 2024 08:01:16 +0000 (19:01 +1100)] 
Added return code checks to SLH_DSA Hash functions and propogated the
values thru the calling functions.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoAdd SLH_DSA to the FIPS provider.
slontis [Thu, 7 Nov 2024 06:43:19 +0000 (17:43 +1100)] 
Add SLH_DSA to the FIPS provider.

The keygen tests required "entropy" to be added via an additional
parameter for ACVP testing. This is required because TEST_RAND cant be
used to pass entropy to the FIPS provider, due to it not knowing the
lib ctx of the FIPS provider.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoAdd support for all 12 SLH-DSA parameter sets.
slontis [Thu, 7 Nov 2024 03:59:45 +0000 (14:59 +1100)] 
Add support for all 12 SLH-DSA parameter sets.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoAdd SLH-DSA signing.
slontis [Thu, 7 Nov 2024 00:24:06 +0000 (11:24 +1100)] 
Add SLH-DSA signing.

Also updated function comments.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoAdd SLH-DSA key generation
slontis [Wed, 6 Nov 2024 10:45:29 +0000 (21:45 +1100)] 
Add SLH-DSA key generation

Also made fromdata able to generate the public root key if the private
key seed + prf as well as the public key seed are passed to from data.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoAdd SLH_DSA signature verification.
slontis [Wed, 6 Nov 2024 06:37:08 +0000 (17:37 +1100)] 
Add SLH_DSA signature verification.

This uses a SLH_DSA_CTX that is passed to most functions.
It contains information related to a parameter set (such as constants,
hash functions, prefetched EVP_MD/EVP_MAC objects, as well as ADDRESS
functions). This context is seperated from the SLH_DSA_KEY since
multiple signature operations could be performed using the same keys.
This only implements functions required for SLH-DSA-SHA2-128s

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months ago Add base code to load a SLH_DSA public key.
slontis [Wed, 6 Nov 2024 03:22:45 +0000 (14:22 +1100)] 
 Add base code to load a SLH_DSA public key.

This loads a SLH_DSA public key from data.
A simple SLH_DSA keymanager imports this key.

Initially this only has a parameter set for
SLH-DSA-SHA2-128s

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoAdd SLH_DSA configuration option
slontis [Tue, 5 Nov 2024 04:18:41 +0000 (15:18 +1100)] 
Add SLH_DSA configuration option

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)

5 months agoCase-insensitive sigalgs
Viktor Dukhovni [Sat, 15 Feb 2025 15:25:16 +0000 (02:25 +1100)] 
Case-insensitive sigalgs

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

5 months agofips: omit PCT on key import
Pauli [Mon, 10 Feb 2025 22:32:28 +0000 (09:32 +1100)] 
fips: omit PCT on key import

Our lab thinks the IG 10.3.A additional comment 1 is a mistake and that
a PCT on import is not required.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26785)

5 months agoFixup error ennumeration 26802/head
Neil Horman [Fri, 14 Feb 2025 21:40:45 +0000 (16:40 -0500)] 
Fixup error ennumeration

The merge gives us a conflict on SSL_R_MISSING_QUIC_TLS_FUNCTIONS
which conflicted with SSL_R_LISTENER_USE_ONLY.  Move the former to
ordinal 423

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

5 months agoFix ssltrace test
Neil Horman [Fri, 14 Feb 2025 19:42:58 +0000 (14:42 -0500)] 
Fix ssltrace test

It seems something changed during the merge leading to a slightly longer
frame

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

5 months agoAdd ssl_unwrap.h to quic_tls_api.c
Neil Horman [Fri, 14 Feb 2025 19:25:41 +0000 (14:25 -0500)] 
Add ssl_unwrap.h to quic_tls_api.c

Needed after the macro re-arranging performed on the quic-server branch

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

5 months agoReadd the inclusion of quic_record_util.h to quic_tls.c
Neil Horman [Fri, 14 Feb 2025 19:21:31 +0000 (14:21 -0500)] 
Readd the inclusion of quic_record_util.h to quic_tls.c

Some refactoring on master removed the inclusion of quic_local.h from
ssl_local.h, which quic_tls.c needed on the server branch to pull in the
QRL_SUITE_AES128GCM and simmilar definitions.  Fix it by specifcially
adding quic_record_util.h into quic_tls.c, as we only need a few defines
from that header.

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

5 months agoFixup conflict between 3rd party quic-tls api and quic-server
Neil Horman [Fri, 14 Feb 2025 20:58:58 +0000 (15:58 -0500)] 
Fixup conflict between 3rd party quic-tls api and quic-server

Build.info changes between quic-server and master occured here, resolve
them.  Can't do it as a fixup as the conficting changes have already
been merged to master

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

5 months agoBackout validation of initial packet done by port_default_packet_handler()
Alexandr Nedvedicky [Thu, 13 Feb 2025 21:55:10 +0000 (22:55 +0100)] 
Backout validation of initial packet done by port_default_packet_handler()

QUIC interoperability tests discovered bugs in my earlier commit #59e7c2313be7cff.
This change reverts everything out.

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

5 months agoPerform initial AEAD validation before creating a channel
Alexandr Nedvedicky [Sun, 2 Feb 2025 16:40:25 +0000 (17:40 +0100)] 
Perform initial AEAD validation before creating a channel

We let port to create qrx object and use it for
packet validation. If packet validates, we then
create channel and pass pre-created qrx to channel's
constructor.

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/26610)

5 months agoAdd quic-server fuzz test. Also update fuzz corpora submodule.
Andrew Dinh [Wed, 22 Jan 2025 13:45:00 +0000 (20:45 +0700)] 
Add quic-server fuzz test. Also update fuzz corpora submodule.

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

5 months agoFix ossl_quic_trace to fetch connection short conn id len
Neil Horman [Wed, 29 Jan 2025 19:10:09 +0000 (14:10 -0500)] 
Fix ossl_quic_trace to fetch connection short conn id len

ossl_quic_trace currently fails to get the connection id when parsing a
short header.  now that we have an api to get the known length, go ahead
and use that to parse the header properly

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

5 months agoUse the recorded short conn id len in pktsplitbio
Neil Horman [Wed, 29 Jan 2025 18:19:49 +0000 (13:19 -0500)] 
Use the recorded short conn id len in pktsplitbio

Do the same thing in our pktsplit bio

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

5 months agoUse reported short conn id len in qtestlib
Neil Horman [Wed, 29 Jan 2025 18:18:57 +0000 (13:18 -0500)] 
Use reported short conn id len in qtestlib

Use the new short conn id internal api to record and use the connections
short conn id len when decoding packets in qtestlib

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

5 months agoAdd api to fetch short conn id len from a given channel/tserver
Neil Horman [Wed, 29 Jan 2025 18:17:32 +0000 (13:17 -0500)] 
Add api to fetch short conn id len from a given channel/tserver

Need an api to fetch the configured conn id len for short headers, add
that in here

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

5 months agoMove handling of connection close frames to QUIC FUTURE
Neil Horman [Wed, 29 Jan 2025 19:44:13 +0000 (14:44 -0500)] 
Move handling of connection close frames to QUIC FUTURE

There is a corner case in handling connection close frames for which RFC
guidance is unclear.  Given that, move addressing it to QUIC FUTURE

Fixes openssl/project#1075

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

5 months agoEliminate SSL_LISTENER_FLAG_NO_ACCEPT flag in QUIC
Neil Horman [Wed, 29 Jan 2025 19:38:45 +0000 (14:38 -0500)] 
Eliminate SSL_LISTENER_FLAG_NO_ACCEPT flag in QUIC

We've not implemented it yet, and don't need it for MVP, so move the
TODO's to QUIC FUTURE and remove the docs for it.

Fixes openssl/project#1074

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

5 months agoMove EAGAIN handling of QUIC retry/verneg frames to QUIC FUTURE
Neil Horman [Wed, 29 Jan 2025 19:31:25 +0000 (14:31 -0500)] 
Move EAGAIN handling of QUIC retry/verneg frames to QUIC FUTURE

Fixes openssl/project#1072
Fixes openssl/project#1073

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

5 months agoMove implementation of RETIRE CONN ID frames to QUIC FUTURE
Neil Horman [Wed, 29 Jan 2025 19:28:49 +0000 (14:28 -0500)] 
Move implementation of RETIRE CONN ID frames to QUIC FUTURE

Fixes openssl/project#1071

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

5 months agoMove quictestlib TODO to QUIC FUTURE
Neil Horman [Wed, 29 Jan 2025 19:19:35 +0000 (14:19 -0500)] 
Move quictestlib TODO to QUIC FUTURE

Improving handling of packets in tserver doesn't currently make sense,
as we're planning on eliminating it soon.  Move this TODO to QUIC FUTURE

Fixes openssl/project#1070

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

5 months agomove token store definition to quic_predef.h
Neil Horman [Sun, 2 Feb 2025 22:17:20 +0000 (17:17 -0500)] 
move token store definition to quic_predef.h

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

5 months agode-duplicate fnv1a_hash
Neil Horman [Sat, 1 Feb 2025 16:42:22 +0000 (11:42 -0500)] 
de-duplicate fnv1a_hash

I cloned a copy of fnv1a_hash from hashtable.c.  Deduplicate that so we
have common source code.

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

5 months agoRemove NEW_TOKEN public api
Neil Horman [Sat, 1 Feb 2025 16:28:25 +0000 (11:28 -0500)] 
Remove NEW_TOKEN public api

@sashan and I were discussing the usefulness of the public facing api
for NEW_TOKEN support, and he has concerns over its usefulness and our
being stuck with it if we need to make changes later.  Given that it is
a convience api for using multiple CTX-es to share a cache, its fine if
we remove it for now, as that seems like a less common use case.

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

5 months agoinit token to ease cleanup
Neil Horman [Fri, 31 Jan 2025 14:41:36 +0000 (09:41 -0500)] 
init token to ease cleanup

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

5 months agoRemove SSL_TOKEN_STORE_HANDLE type
Neil Horman [Fri, 31 Jan 2025 13:02:34 +0000 (08:02 -0500)] 
Remove SSL_TOKEN_STORE_HANDLE type

Replace it with SSL_TOKEN_STORE and make the structure opaque in the
public api

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

5 months agoModify ossl_quic_get_peer_token to return QUIC_TOKEN
Neil Horman [Thu, 30 Jan 2025 19:38:18 +0000 (14:38 -0500)] 
Modify ossl_quic_get_peer_token to return QUIC_TOKEN

we use this struct internally to track computed tokens, we may as well
use it when fetching those tokens, as it allows the removeal of the QTOK
type

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

5 months agoRename token_store functions to make them consistent
Neil Horman [Thu, 30 Jan 2025 17:14:26 +0000 (12:14 -0500)] 
Rename token_store functions to make them consistent

we use get0 to get a token store, but set to set it.  Since the latter
takes a refcount, change that to set1.  Also rename the interal quic
functions to match.

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

5 months agoReview fixups
Neil Horman [Tue, 28 Jan 2025 14:41:52 +0000 (09:41 -0500)] 
Review fixups

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

5 months agoFix a memory leak on free
Neil Horman [Tue, 28 Jan 2025 14:16:09 +0000 (09:16 -0500)] 
Fix a memory leak on free

Forgot to free the CRYPTO_REF when freeing a token

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

5 months agoReduce our NEW_TOKEN send rate.
Neil Horman [Tue, 28 Jan 2025 13:58:19 +0000 (08:58 -0500)] 
Reduce our NEW_TOKEN send rate.

Currently, we send a NEW_TOKEN frame on every new validated connection,
but thats not necessecary.  Since NEW_TOKEN tokens have a lifetime of 1
hour currently, we really only need to send a NEW_TOKEN if:
1) We validated a RETRY token
or
2) We validated a NEW_TOKEN for which the lifetime is nearing its limit

So lets do that.  When we validate a token, only generate a NEW_TOKEN if
the current token is a RETRY token, or if its a NEW_TOKEN, and there is
less than 10% of the tokens lifetime remaining.

This lets clients use NEW_TOKENS repeatedly (as per the RFC), and saves
us some network bandwith.

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

5 months agoDon't reserve an unused cid for NEW_TOKENS
Neil Horman [Mon, 27 Jan 2025 21:32:32 +0000 (16:32 -0500)] 
Don't reserve an unused cid for NEW_TOKENS

Just realized that NEW_TOKEN tokens don't need a reserved rscid.

Because a client might use a received NEW_TOKEN for multiple subsequent
connections, we allocate a cid when we validate the token on new
connection establishment (in fact we just use the one that the client
sends).  As such the allocated rscid never gets used, and just sits
there until it ages out.

Instead, fill the rscid with random data to mutate subsequently
generated NEW_TOKENS's, since it won't ever be part of the validation
process anyway.

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

5 months agoReference count QUIC_TOKENS
Neil Horman [Mon, 27 Jan 2025 18:56:40 +0000 (13:56 -0500)] 
Reference count QUIC_TOKENS

closer reading of RFC 9000 indicates that a NEW_TOKEN token can be
(re)used repeatedly.

so instead of creating a use once and discard pattern in the token api.
Let the tokens stick around until they are replaced with a new token
from the server.  To do this, we need to ref count the tokens so that we
don't accidentally free them while a given client is waiting to send an
initial frame making use of them.

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