Commit Graph

6006 Commits

Author SHA1 Message Date
Frederik Wedel-Heinen 655fe34de8 Adds AES-128-ECB to ossltest provider to be able to reenable DTLS 1.3 ACK tests.
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28926)
2025-11-10 20:51:52 +01:00
Tomas Mraz dcf9b56d24 DTLS1.3: Disable tests that currently fail
With added TODO(DTLSv1.3) comments

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28455)
2025-10-02 14:53:11 +02:00
Frederik Wedel-Heinen 2f5444278f Fixes of tests for DTLS-1.3
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28455)
2025-10-02 14:53:11 +02:00
Frederik Wedel-Heinen fc4c66a2e7 TLS-1.3 specific sigalgs should be supported in DTLS-1.3
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28455)
2025-10-02 14:53:11 +02:00
Tomas Mraz 6061f14765 Use non-PQC key share for DTLS-1.3 TLSProxy tests
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28455)
2025-10-02 14:53:11 +02:00
Tomas Mraz 2eb43c2fc0 70-test_sslrecords.t: Fix indentation
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28455)
2025-10-02 14:52:54 +02:00
Frederik Wedel-Heinen b22ce78ffe Adds DTLS 1.3 ACK message functionality
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25119)
2025-10-02 14:48:16 +02:00
Frederik Wedel-Heinen c6a27f0fc4 Duplicate TLS 1.3 sslapitests for DTLS 1.3
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26912)
2025-10-02 14:47:24 +02:00
Frederik Wedel-Heinen ace0f07d7d test_server_mtu_larger_than_max_fragment_length() should be run for DTLS 1.3
Previously it was forced to run on DTLS 1.2>. But the underlying issue was fixed on master and it works now that the feature branch has been rebased on top of a more recent master.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26574)
2025-10-02 14:47:24 +02:00
Frederik Wedel-Heinen b6be4849ce Support DTLS 1.3 Unified Headers
Also set correct AAD for DTLS 1.3 message de-/encryption.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25668)
2025-10-02 14:47:24 +02:00
Frederik Wedel-Heinen cc2a800de6 TLSProxy: Handle partial messages with DTLS
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26532)
2025-10-02 14:47:24 +02:00
Frederik Wedel-Heinen 1dbfe164b9 DTLS 1.3 record number encryption
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23511)
2025-10-02 14:47:24 +02:00
Frederik Wedel-Heinen fc07ae54ba Support dtls 1.3 downgrade mechanism
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23320)
2025-10-02 14:47:24 +02:00
Frederik Wedel-Heinen 82a8c1731e Update epochs when changing key and cipher state for dtls 1.3
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23229)
2025-10-02 14:47:23 +02:00
Frederik Wedel-Heinen c36f588226 Fix SCTP todo
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24605)
2025-10-02 14:45:14 +02:00
Frederik Wedel-Heinen 85489b6ca9 Run 70-test_tls13certcomp.t with dtls
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24525)
2025-10-02 14:45:14 +02:00
Frederik Wedel-Heinen 7cd6a02213 Run 70-test_tls13kexmodes.t with dtls
It is currently unsupported because of missing support in TLSProxy.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24525)
2025-10-02 14:45:14 +02:00
Frederik Wedel-Heinen e87a65c1af Run 70-test_tls13messages.t with dtls
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24525)
2025-10-02 14:45:14 +02:00
Frederik Wedel-Heinen 1efabf496d Add support for running 70-test_tls13psk.t with dtls
Has to be currently disabled because it fails.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24525)
2025-10-02 14:45:14 +02:00
Frederik Wedel-Heinen 8b814f9787 Run 70-test_tls13hrr.t with dtls
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24525)
2025-10-02 14:45:14 +02:00
Frederik Wedel-Heinen ecfea5acad Run 70-test_tls13cookie.t with dtls
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24525)
2025-10-02 14:45:14 +02:00
Frederik Wedel-Heinen 35111d2424 Run 70-test_tls13alerts.t with dtls
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24525)
2025-10-02 14:45:14 +02:00
Frederik Wedel-Heinen c6de777d09 Fix an assertion failure which happens when a DTLS 1.3 client receives a HelloVerifyRequest.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24509)
2025-10-02 14:45:13 +02:00
Frederik Wedel-Heinen dd3b5d2b35 Place start of ClientHello correctly when calculating binder for DTLS 1.3
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24426)
2025-10-02 14:45:13 +02:00
Frederik Wedel-Heinen 32570a0dc3 Refactor code and fix a couple of missing DTLSv1.3 checks.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24345)
2025-10-02 14:45:13 +02:00
Frederik Wedel-Heinen 621a0812ae Run test_cookie() test with DTLS 1.3
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24425)
2025-10-02 14:45:13 +02:00
Frederik Wedel-Heinen f8317a47e9 Adds DTLSv1.3 to protocol_version.pm for additional protocol version tests.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23242)
2025-10-02 14:45:13 +02:00
Frederik Wedel-Heinen cb2b66e0e0 Clear old messages from queues in order to avoid leaks of record layer objects.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22275)
2025-10-02 14:45:13 +02:00
Frederik Wedel-Heinen 09665c977f Fix test_ssl_new tests
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22275)
2025-10-02 14:45:13 +02:00
Frederik Wedel-Heinen 58b9a4db2d Run some failing tests with DTLS1.2
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22275)
2025-10-02 14:45:13 +02:00
Frederik Wedel-Heinen 554d794a2e Update DTLS version tests
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22275)
2025-10-02 14:45:13 +02:00
Frederik Wedel-Heinen cc7766544a Adds DTLS1.3 to ssl protocol to text structs
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22273)
2025-10-02 14:45:12 +02:00
Nikola Pajkovsky 512f176185 hashtable: add option to disable RCU locks
a new config option _no_rcu_ is added into HT_CONFIG. When _no_rcu_ is
set then hashtable can be guarded with any other locking primitives,
and behives as ordinary hashtable. Also, all the impact of the
atomics used internally to the hash table was mitigated.

RCU performance

   # INFO:  @ test/lhash_test.c:747
   # multithread stress runs 40000 ops in 40.779656 seconds

No RCU, guarded with RWLOCK

   # INFO:  @ test/lhash_test.c:747
   # multithread stress runs 40000 ops in 36.976926 seconds

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28677)
2025-10-02 08:05:02 -04:00
Nikola Pajkovsky 18763ea155 hashtable: pass HT into hash function
When defining a custom hash function for a hashtable key, you typically start with:

  HT_START_KEY_DEFN(key)
  HT_DEF_KEY_FIELD(k, unsigned char *)
  HT_END_KEY_DEFN(KEY)

In this setup, the hash function signature requires keybuf and len as
parameters rather than the hashtable key itself. As a result,
accessing members of the hashtable structure becomes awkward, since
you must do something like:

  #define FROM_KEYBUF_TO_HT_KEY(keybuf, type) (type)((keybuf) - sizeof(HT_KEY))

  static uint64_t ht_hash(uint8_t *keybuf, size_t keylen)
  {
      KEY *k = FROM_KEYBUF_TO_HT_KEY(keybuf, KEY *);
      ...
  }

This kind of pointer arithmetic is both unnecessary and error-prone.
A cleaner approach is to pass the HT pointer directly into the hash
function. From there, you can safely cast it to the required type
without the pointer gymnastics.

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

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28677)
2025-10-02 08:04:47 -04:00
Daniel Kubec 6387ec6d49 Fix EVP_DecryptFinal_ex() for ChaCha20-Poly1305.
When using the ChaCha20-Poly1305 algorithm, the final interface
returns success without setting the authentication tag, whereas
the AES-GCM algorithm correctly returns failure in such cases.

Fixes #28137

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28683)
2025-10-02 10:07:32 +02:00
Ryan Hooper 7de825efa2 Fix Memory leak in CMS_EncryptedData_set1_key
When CMS_EncryptedData_set1_key is called repeatedly it will
leak data on the second call. This was because
cms->d.encryptedData was already set and needed to be cleared
before the call to M_ASN1_new_of.

Fixes: #28606

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28668)
2025-10-01 17:48:54 +02:00
Neil Horman 3206bb7082 Revert "fips: remove redundant RSA encrypt/decrypt KAT"
This reverts commit 635bf4946a.

During code review for FIPS-140-3 certification, our lab noticed that
the known answer test for RSA was removed.  This was done in the above
commit, as part of
https://github.com/openssl/openssl/pull/25988

Under the assertion that FIPS 140-3 Implementation Guidance section D.G
had relaxed the requirements for testing, obviating the need for this
test.

However, for the 3.5 FIPS-140-3 certification we are adding assertions
for support of KAS-IFC-SSC, which follows FIPS-140-3 I.G section D.F,
which does not contain the same relaxed constraints.  As such we need to
reintroduce the test.

While the specifics of the I.G requirements are slightly different in
D.F (allowing for other, potentially less time-consuming tests), the
most expedient path forward here is to simply re-introduce the test as
it existed previously, hence the reversion of the above commit.

Fixes openssl/private#832

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/28676)
2025-09-27 16:01:19 -04:00
Tomas Mraz c18b6968cc Add test for using KRB5KDF with erroneous key size
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/28663)
2025-09-26 12:47:41 -04:00
Bob Beck 7b4a56420d Make tests run faster on typical platforms.
Sadly not doable in make as it is notoriously bad at telling
you the parallelism being used by make -j.

If the HARNESS_JOBS environment variable has not been
set, this makes the perl script attempt to figure out how
many cpu's are available on anything windows/linux/macos/bsd like,
and if it can be successfully detected, we use that value.
if not, we use 1 as before.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/28426)
2025-09-25 16:55:50 +02:00
Richard Levitte 07474a3e8f Change test/recipes/95-test_external_oqsprovider.t to allow out-of-source builds
Unfortunately, CMake's FindOpenSSL.cmake module doesn't handle OpenSSL's
build tree very well when it's out-of-source.  This is resolved by create
a local OpenSSL "installation" with a minimum amount of symbolic links,
and using that.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28638)
2025-09-25 10:18:14 -04:00
Daniel Kubec 051108ee53 Fix EVP_PKEY_can_sign() handling of NULL from query_operation_name()
EVP_PKEY_can_sign() assumed query_operation_name(OSSL_OP_SIGNATURE)
always returns a non-NULL string. According to the documentation,
query_operation_name() may return NULL, in which case
EVP_KEYMGMT_get0_name() should be used as a fallback.

Fixes #27790

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28620)
2025-09-25 15:27:12 +02:00
Bernd Edlinger 5909d0d3fc Add a test for multi-threaded OBJ_create
After a successful OBJ_create the returned NID should
be the same NID that is returned from OBJ_ln2nid and
should not change any more, but after an unsuccessful
OBJ_create, another thread must have created the object,
therefore OBJ_ln2nid should not return NID_undef in that
case.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28582)
2025-09-25 11:23:52 +02:00
xiaoloudongfeng de0944c9b3 Fix length of digestinfo_sm3_der
This fixes the RSA-SM3 signatures to conform to the standard.

CLA: trivial

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/28415)
2025-09-25 10:50:01 +02:00
Andrew Dinh 3b00a13229 Skip LMS tests if fetch for the LMS algorithm fails
Check for specific LMS error

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28580)
2025-09-23 13:48:25 -04:00
Tomas Mraz 0a6b53ac87 Re-enable the ssl_trace_test()
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28627)
2025-09-23 16:37:36 +02:00
Tomas Mraz bb8bbdcfaa sslapitest.c: Skip test_ssl_trace() with FIPS providers older than 3.5
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28627)
2025-09-23 16:37:36 +02:00
Nikola Pajkovsky 7ca0240e5b Ensure q variable is freed
Fixes: d88c43a644 ("Ensure that empty or 1 element stacks are always sorted.")
Resolves: https://scan5.scan.coverity.com/#/project-view/65138/10222?selectedIssue=1665465
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28596)
2025-09-23 16:34:47 +02:00
Viktor Dukhovni 38e8981004 Added test suggested by Shane Lontis
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28624)
2025-09-23 11:56:58 +02:00
Ryan Hooper bd362f346c Fix CI Pipeline by Disabling SSL_TRACE_TEST
Disabling the SSL_TRACE_TEST since it caused an issue on
some cross compiles. A follow-on commit will change
the test.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28621)
2025-09-19 11:40:22 -04:00
Viktor Dukhovni d20cbc90e4 Fix ML-KEM key equality check when either unset
Fixes #28563

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28569)
2025-09-18 17:33:07 +02:00