]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
5 months agoAdd test case for RAND_set1_random_provider() call
Pauli [Thu, 30 May 2024 02:08:51 +0000 (12:08 +1000)] 
Add test case for RAND_set1_random_provider() call

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

5 months agodocument provider random bypass ability
Pauli [Mon, 27 May 2024 04:26:45 +0000 (14:26 +1000)] 
document provider random bypass ability

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

5 months agodocument internal ossl_provider_random_bytes rand funtion
Pauli [Mon, 27 May 2024 04:26:25 +0000 (14:26 +1000)] 
document internal ossl_provider_random_bytes rand funtion

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

5 months agoAdd support for random provider
Pauli [Thu, 23 May 2024 02:14:47 +0000 (12:14 +1000)] 
Add support for random provider

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

5 months agoDocument random_provider option in random section
Pauli [Thu, 23 May 2024 02:13:46 +0000 (12:13 +1000)] 
Document random_provider option in random section

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

5 months agoDocument RAND_set1_random_provider() API
Pauli [Wed, 22 May 2024 03:23:35 +0000 (13:23 +1000)] 
Document RAND_set1_random_provider() API

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

5 months agoAdd RAND_set1_random_provider() API
Pauli [Wed, 22 May 2024 03:23:16 +0000 (13:23 +1000)] 
Add RAND_set1_random_provider() API

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

5 months agoAdd a new provider API to generate random numbers.
Pauli [Tue, 21 May 2024 04:56:32 +0000 (14:56 +1000)] 
Add a new provider API to generate random numbers.

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

5 months agoResolve undefined behaviour in wpacket test
Pauli [Mon, 27 May 2024 03:37:41 +0000 (13:37 +1000)] 
Resolve undefined behaviour in wpacket test

There is no necessity for rand_data to be aligned so that it can be
directly dereferenced as a uint64_t.

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

5 months ago80-test_cmp_http.t: on test failures also print failed client invocations
Dr. David von Oheimb [Thu, 30 Jan 2025 08:06:41 +0000 (09:06 +0100)] 
80-test_cmp_http.t: on test failures also print failed client invocations

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

5 months ago80-test_cmp_http.t: on test failures print Mock server STDERR output
Dr. David von Oheimb [Wed, 29 Jan 2025 17:59:49 +0000 (18:59 +0100)] 
80-test_cmp_http.t: on test failures print Mock server STDERR output

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

5 months ago80-test_cmp_http_data/Mock/test.cnf: further relax total_timeout as workaround for...
Dr. David von Oheimb [Wed, 29 Jan 2025 07:18:40 +0000 (08:18 +0100)] 
80-test_cmp_http_data/Mock/test.cnf: further relax total_timeout as workaround for heavily loaded test systems

Fixes #26577

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26584)

6 months agoUse ASN1_INTEGER_get_int64() in ossl_serial_number_print()
Kazuki Yamaguchi [Sat, 25 Jan 2025 08:31:31 +0000 (17:31 +0900)] 
Use ASN1_INTEGER_get_int64() in ossl_serial_number_print()

A -1 return from ASN1_INTEGER_get() indicates both success and error.
Our man page calls out this ambiguity. Use ASN1_INTEGER_get_int64()
instead, which has a better error reporting and also a platform
independent behavior with respect to sizeof(long).

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

6 months agoFix pretty-printing empty serial number in ossl_serial_number_print()
Kazuki Yamaguchi [Sat, 25 Jan 2025 08:31:16 +0000 (17:31 +0900)] 
Fix pretty-printing empty serial number in ossl_serial_number_print()

Fix a crash when the ASN1_INTEGER has empty content. While it is
illegal, this is the initial state of the serialNumber field when an
X509 object is allocated by X509_new(). X509_print*() should be able to
process an incomplete X509 object too.

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

6 months agoEVP_DigestSign(): Check pctx != NULL
Bartel Artem [Fri, 24 Jan 2025 07:21:03 +0000 (10:21 +0300)] 
EVP_DigestSign(): Check pctx != NULL

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

6 months ago[providers/implementations/ciphers] make aes-gcm-siv work with zero-length messages
Billy Brumley [Thu, 23 Jan 2025 13:57:24 +0000 (08:57 -0500)] 
[providers/implementations/ciphers] make aes-gcm-siv work with zero-length messages

test cases lifted from RFC 8452

fixes #26431

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26535)

6 months agoOpen pem files in binary mode
Josh Cooper [Wed, 16 Oct 2024 22:06:16 +0000 (15:06 -0700)] 
Open pem files in binary mode

In order to avoid an MSVCRT bug affecting ftell and text mode[1], open PEM files
in binary mode. The PEM parser already handles CRLF translation[2].

[1] https://github.com/openssl/openssl/commit/8300a8742b2abc487594a09b5e6ee726dbd30771
[2] https://github.com/openssl/openssl/pull/24249#issuecomment-2192025429

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

6 months agoRevert "Work around Windows ftell() bug as per Microsoft engineering's suggestion"
Josh Cooper [Wed, 16 Oct 2024 19:24:03 +0000 (12:24 -0700)] 
Revert "Work around Windows ftell() bug as per Microsoft engineering's suggestion"

This reverts commit 8300a8742b2abc487594a09b5e6ee726dbd30771.

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

6 months agoClarify docs of EVP_CIPHER*_get_block_size
Viktor Dukhovni [Sun, 26 Jan 2025 06:02:31 +0000 (17:02 +1100)] 
Clarify docs of EVP_CIPHER*_get_block_size

Also, tolerate NULL input ctx, just like NULL cipher.

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

6 months agoossl_provider_prov_ctx is redundant
Viktor Dukhovni [Mon, 27 Jan 2025 02:44:55 +0000 (13:44 +1100)] 
ossl_provider_prov_ctx is redundant

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

6 months agoAdd version field check to PKCS8 decoder
Michael Baentsch [Sat, 18 Jan 2025 08:58:33 +0000 (09:58 +0100)] 
Add version field check to PKCS8 decoder

Fixes #26459

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

6 months agoExpanding trace of providers algorithms fetching/caching/etc
Dmitry Belyavskiy [Thu, 23 Jan 2025 16:27:31 +0000 (17:27 +0100)] 
Expanding trace of providers algorithms fetching/caching/etc

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

6 months agoAdd function X509_VERIFY_PARAM_get_purpose()
Rajeev Ranjan [Tue, 5 Nov 2024 13:26:29 +0000 (14:26 +0100)] 
Add function X509_VERIFY_PARAM_get_purpose()

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

6 months agoCMP: add support for central key generation
Rajeev Ranjan [Wed, 29 May 2024 16:19:29 +0000 (18:19 +0200)] 
CMP: add support for central key generation

- add testcase for central keygen
- add documentation

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

6 months agoFixes some memory leaks when errors occur in ossl_cmp_rp_new().
Frederik Wedel-Heinen [Sat, 21 Dec 2024 14:32:32 +0000 (15:32 +0100)] 
Fixes some memory leaks when errors occur in ossl_cmp_rp_new().

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

6 months agoAlso expose an accessor for a single string provider config property
Viktor Dukhovni [Fri, 24 Jan 2025 01:52:25 +0000 (12:52 +1100)] 
Also expose an accessor for a single string provider config property

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26550)

6 months agoExclude amplificationlimit test with mvfst client
Neil Horman [Thu, 23 Jan 2025 14:06:09 +0000 (09:06 -0500)] 
Exclude amplificationlimit test with mvfst client

The amplificationlimit interop test is failing currently with our
server.

However, based on the global nightly runs here:
https://github.com/openssl/openssl/actions/runs/12860128783/job/35851614148

it appears to be failing in all test cases.

Some analysis indicates that the client appears to abort operations
early during frame loss in this test.

As such just exclude the combination of this test and client.  Re-add it
later if it ever becomes functional

Fixes openssl/project#1062

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

6 months agoFix magic + 20 in PEM_ASN1_write_bio
Sean Kannanaikal [Wed, 22 Jan 2025 12:38:47 +0000 (07:38 -0500)] 
Fix magic + 20 in PEM_ASN1_write_bio

Fixes #26476

In the file crypto/pem/pem_lib.c the function had a +20 to account for
padding in the data size, however this was recognized to not be up to
standard quality. Instead it has now been updated to use the static
maximum block size and uses that for the calculation as opposed to a +20.

CLA: trivial

Reviewed-by: Paul Dale <ppzgs1@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/26526)

6 months agoFix passing struct by value rather than by reference to syscall
Mae [Wed, 22 Jan 2025 16:54:43 +0000 (16:54 +0000)] 
Fix passing struct by value rather than by reference to syscall

Fixes #26521

CLA: trivial

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

6 months agotemplate_kem.c: Use proper printf format for size_t
Tomas Mraz [Wed, 22 Jan 2025 16:40:44 +0000 (17:40 +0100)] 
template_kem.c: Use proper printf format for size_t

Fixes Coverity 1633351163335216333541633355

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/26522)

6 months agotemplate_kem.c: Check outlen before dereferencing it
Tomas Mraz [Wed, 22 Jan 2025 15:55:35 +0000 (16:55 +0100)] 
template_kem.c: Check outlen before dereferencing it

Fixes Coverity 163335316333561633357

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/26522)

6 months agoCheck returns of sk_X509_CRL_push and handle appropriately.
Frederik Wedel-Heinen [Fri, 20 Dec 2024 20:05:59 +0000 (21:05 +0100)] 
Check returns of sk_X509_CRL_push and handle appropriately.

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

6 months agoExpose the provider `c_get_params` function via PROV_CTX.
Viktor Dukhovni [Thu, 23 Jan 2025 04:42:14 +0000 (15:42 +1100)] 
Expose the provider `c_get_params` function via PROV_CTX.

This applies to the base, default and FIPS providers, could be added in
principle also to the legacy provider, but there's no compelling reason
to do that at the moment.

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

6 months agoDon't lose config infopairs of built-in providers
Viktor Dukhovni [Wed, 22 Jan 2025 15:43:53 +0000 (02:43 +1100)] 
Don't lose config infopairs of built-in providers

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

6 months agoos-zoo.yml: Add linux-s390x runner
Dmitry Misharov [Mon, 20 Jan 2025 08:19:48 +0000 (09:19 +0100)] 
os-zoo.yml: Add linux-s390x runner

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

6 months agoFix data race in asn1_str2tag() on tntmp which was accidentally made static
Stas Cymbalov [Tue, 21 Jan 2025 13:42:19 +0000 (16:42 +0300)] 
Fix data race in asn1_str2tag() on tntmp which was accidentally made static

Variables tntmp and tnst are declared in the same declaration and thus
share storage class specifiers (static). This is unfortunate as tntmp is
used during iteration through tnst array and shouldn't be static.
In particular this leads to two problems that may arise when multiple
threads are executing asn1_str2tag() concurrently:
1. asn1_str2tag() might return value that doesn't correspond to tagstr
   parameter. This can happen if other thread modifies tntmp to point to
   a different tnst element right after a successful name check in the
   if statement.
2. asn1_str2tag() might perform an out-of-bounds read of tnst array.
   This can happen when multiple threads all first execute tntmp = tnst;
   line and then start executing the loop. If that case those threads
   can end up incrementing tntmp past the end of tnst array.

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

6 months agoeddsa_signverify_init(): Avoid memory leak on error
Tomas Mraz [Tue, 21 Jan 2025 13:42:28 +0000 (14:42 +0100)] 
eddsa_signverify_init(): Avoid memory leak on error

Add missing WPACKET_cleanup() call.
Fixes Coverity 1638693

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/26500)

6 months agomac_legacy_kmgmt.c: Avoid possible memory leak on error
Tomas Mraz [Tue, 21 Jan 2025 13:38:23 +0000 (14:38 +0100)] 
mac_legacy_kmgmt.c: Avoid possible memory leak on error

Use mac_gen_cleanup() instead of just freeing the gctx.
Fixes Coverity 1638702

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/26500)

6 months agotest_kdf_scrypt(): Test resetting the KDF context
Tomas Mraz [Mon, 20 Jan 2025 08:16:30 +0000 (09:16 +0100)] 
test_kdf_scrypt(): Test resetting the KDF context

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

6 months agokdf_scrypt_reset(): NULLify freed pointers
Tomas Mraz [Mon, 20 Jan 2025 07:53:21 +0000 (08:53 +0100)] 
kdf_scrypt_reset(): NULLify freed pointers

Otherwise doublefree happens with further usage.

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

6 months agoscrypt: Do not free the context itself when fetch fails
Tomas Mraz [Mon, 20 Jan 2025 07:50:48 +0000 (08:50 +0100)] 
scrypt: Do not free the context itself when fetch fails

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

6 months agoconfig.pod: Fix typo
Alexander Heinlein [Tue, 21 Jan 2025 07:34:53 +0000 (08:34 +0100)] 
config.pod: Fix typo

CLA: trivial

Signed-off-by: Alexander Heinlein <alexander.heinlein@web.de>
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/26497)

6 months agoRefactor MAKE_ENCODER in providers/implementations/encode_decode/encode_key2any.c
Richard Levitte [Thu, 9 Jan 2025 13:36:20 +0000 (14:36 +0100)] 
Refactor MAKE_ENCODER in providers/implementations/encode_decode/encode_key2any.c

It took a parameter 'evp_type', which isn't used.  The comment describing
it mentions a future refactoring, but it appears that this has already
happened.

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

6 months agoGive DTLS tests more time to complete
Bernd Edlinger [Tue, 21 Jan 2025 15:12:18 +0000 (16:12 +0100)] 
Give DTLS tests more time to complete

Increase the timeout for DTLS tests to 10 seconds.
But do that only for DTLS as this would waste time
for other tests, most of the TLS tests do not need
this at all.

Fixes #26491

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

6 months agoapps/cms.c: Cleanup for dead assignment to argc
Alex Prabhat Bara [Fri, 27 Dec 2024 06:37:11 +0000 (12:07 +0530)] 
apps/cms.c: Cleanup for dead assignment to argc

CLA: trivial

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

6 months agorcu: Ensure that updates to the ID field of a qp don't lose refs
Neil Horman [Sun, 19 Jan 2025 21:43:37 +0000 (16:43 -0500)] 
rcu: Ensure that updates to the ID field of a qp don't lose refs

ppc64le occasionally still fails the threadstest on __rcu_torture

From several days of debugging, I think I've landed on the problem.

Occasionally, under high load I observe the following pattern

CPU0                                     CPU1
update_qp                                get_hold_current_qp
  atomic_and_fetch(qp->users, ID_MASK, RELEASE)
                                         atomic_add_fetch(qp->users, 1, RELEASE
  atomic_or_fetch(qp->users, ID_VAL++, RELEASE)

When this pattern occurs, the atomic or operation fails to see the published
value of CPU1 and when the or-ed value is written back to ram, the incremented
value in get_hold_current_qp is overwritten, meaning the hold that the reader
placed on the rcu lock is lost, allowing the writer to complete early, freeing
memory before a reader is done reading any held memory.

Why this is only observed on ppc64le I'm not sure, but it seems like a pretty
clear problem.

fix it by implementing ATOMIC_COMPARE_EXCHANGE_N, so that, on the write side in
update_qp, we can ensure that updates are only done if the read side hasn't
changed anything.  If it has, retry the operation.

With this fix, I'm able to run the threads test overnight (4000 iterations and
counting) without failure.

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

6 months agobyteorder.h: Fix MSVC compiler error C2371
Kelvin Lee [Fri, 17 Jan 2025 13:26:21 +0000 (00:26 +1100)] 
byteorder.h: Fix MSVC compiler error C2371

Compiling byteorder_test.c with VS2022 produces the following warnings
and errors:

E:\build\kiyolee\openssl\include\openssl\byteorder.h(24,21): warning
C4164: '_byteswap_ushort': intrinsic function not declared
(compiling source file '../../../test/byteorder_test.c')
E:\build\kiyolee\openssl\include\openssl\byteorder.h(25,21): warning
C4164: '_byteswap_ulong': intrinsic function not declared
(compiling source file '../../../test/byteorder_test.c')
E:\build\kiyolee\openssl\include\openssl\byteorder.h(26,21): warning
C4164: '_byteswap_uint64': intrinsic function not declared
(compiling source file '../../../test/byteorder_test.c')
E:\build\kiyolee\openssl\include\openssl\byteorder.h(112,18): warning
C4013: '_byteswap_ushort' undefined; assuming extern returning int
(compiling source file '../../../test/byteorder_test.c')
E:\build\kiyolee\openssl\include\openssl\byteorder.h(144,18): warning
C4013: '_byteswap_ulong' undefined; assuming extern returning int
(compiling source file '../../../test/byteorder_test.c')
E:\build\kiyolee\openssl\include\openssl\byteorder.h(182,18): warning
C4013: '_byteswap_uint64' undefined; assuming extern returning int
(compiling source file '../../../test/byteorder_test.c')
C:\Program Files (x86)\Windows
Kits\10\Include\10.0.22621.0\ucrt\stdlib.h(298,41): error C2371:
'_byteswap_ushort': redefinition; different basic types
(compiling source file '../../../test/byteorder_test.c')
C:\Program Files (x86)\Windows
Kits\10\Include\10.0.22621.0\ucrt\stdlib.h(299,41): warning C4142:
'_byteswap_ulong': benign redefinition of type
(compiling source file '../../../test/byteorder_test.c')
C:\Program Files (x86)\Windows
Kits\10\Include\10.0.22621.0\ucrt\stdlib.h(300,41): error C2371:
'_byteswap_uint64': redefinition; different basic types
(compiling source file '../../../test/byteorder_test.c')

CLA: trivial

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

6 months agoproviders/implementations/keymgmt/ec_kmgmt.c: Remove unused variable
Jiasheng Jiang [Thu, 9 Jan 2025 16:13:55 +0000 (16:13 +0000)] 
providers/implementations/keymgmt/ec_kmgmt.c: Remove unused variable

Remove unused variable "group".

CLA: trivial

Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26293)

6 months agoImprove ASN1_TIME_print documentation and output
Michael Baentsch [Wed, 8 Jan 2025 11:57:28 +0000 (12:57 +0100)] 
Improve ASN1_TIME_print documentation and output

This adds missing GMT indication when printing the local time as
it is converted to the UTC timezone before printing.

Also fixing the fractional seconds printing on EBCDIC platforms.

Fixes #26313

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26344)

6 months agokeymgmt: refactor fips indicator check
Dimitri John Ledkov [Sun, 20 Oct 2024 02:34:27 +0000 (03:34 +0100)] 
keymgmt: refactor fips indicator check

Currently direct call to ossl_ec_check_security_strength is used,
instead of ossl_fips_ind_ec_key_check() like in all other places.

Make keymgmt do the same check as ecdh_exch and ecdsa_sig do.

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

6 months agos_socket: naccept: close listening socket after accepting clients
Nadav Tasher [Fri, 20 Dec 2024 15:59:01 +0000 (17:59 +0200)] 
s_socket: naccept: close listening socket after accepting clients

When `-naccept` is passed (i.e with `s_server`), the listening socket remains open while handling
client, even after `naccept` is supposed to reach `0`.

This is caused to to the decrementation of `naccept` and closing of the socket
happening a little too late in the `do_server` function.

Signed-off-by: Nadav Tasher <tashernadav@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26228)

6 months agoSupport boolean queries against provider config
Viktor Dukhovni [Fri, 17 Jan 2025 11:58:43 +0000 (22:58 +1100)] 
Support boolean queries against provider config

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

6 months agoRevert "Move rodata to .rodata section for armv8"
Alexey Moksyakov [Tue, 21 Jan 2025 09:24:27 +0000 (12:24 +0300)] 
Revert "Move rodata to .rodata section for armv8"

This reverts commit 5b36728d974578f2c74e9f3d2ee6472187084882.

Issue #26458

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

6 months agoRestore correct registers in aarch64 AES-CTR code
Julian Andres Klode [Sat, 18 Jan 2025 20:12:45 +0000 (21:12 +0100)] 
Restore correct registers in aarch64 AES-CTR code

Commit 1d1ca79fe35dbe5c05faed5a2ef8c4de9c5adc49 introduced
save and restore for the registers, saving them as

stp d8,d9,[sp, #16]
stp d10,d11,[sp, #32]
stp d12,d13,[sp, #48]
stp d14,d15,[sp, #64]

But the restore code was inadvertently typoed:

ldp d8,d9,[sp, #16]
ldp d10,d11,[sp, #32]
ldp d12,d13,[sp, #48]
ldp d15,d16,[sp, #64]

Restoring [sp, #64] into d15,d16 instead of d14,d15.

Fixes: #26466
CLA: trivial

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

6 months agoMove some encode helpers to crypt/encode_decode/
Viktor Dukhovni [Mon, 20 Jan 2025 06:25:03 +0000 (17:25 +1100)] 
Move some encode helpers to crypt/encode_decode/

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

6 months agoCheck return of OSSL_PROVIDER_do_all to avoid coverity noise
Viktor Dukhovni [Sat, 18 Jan 2025 07:34:54 +0000 (18:34 +1100)] 
Check return of OSSL_PROVIDER_do_all to avoid coverity noise

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

6 months agoDon't promise a non-zero return size in error cases.
Viktor Dukhovni [Thu, 16 Jan 2025 08:45:50 +0000 (19:45 +1100)] 
Don't promise a non-zero return size in error cases.

When a requested parameter has a non-NULL result pointer,
and the error isn't simply that the result buffer is too
small, don't return a non-zero result size.

Returning a non-zero result size that isn't larger than the
user's provided space is an indication that a result of
that size was actually written, inviting trouble if the
error indication was inadvertenly lost.

Also, in such cases (wrong type, data can't be converted to the
requested type when otherwise supported, ...) there is nothing useful to
be done with the return size value, it can't help to address the
problem.

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

6 months agoMake the provider context available to encoders
Viktor Dukhovni [Sun, 19 Jan 2025 15:51:07 +0000 (02:51 +1100)] 
Make the provider context available to encoders

At the moment the provider context is only available to
encoders that encrypt, but it is useful more generally.

A similar change has already been merged to "master" on the
decoder side, this is the mirror change for encoders.  The
only significant difference is that PEM_ASN1_write_bio needed
to be "extended" (cloned) to allow it to pass the provider context
down to the `k2d` function it uses to encode the data.

I had to "hold my nose" and live with the random "20" added to the data
size in order to accomodate encryption with padding, which may produce
one more cipher block than the input length.  This really should ask
the EVP layer about the block length of the cipher, and allocate the
right amount.  This should be a separate fix for both the old
PEM_ASN1_write_bio() and the new PEM_ASN1_write_bio_ctx().

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

6 months agoAdd CHANGES.md and NEWS.md updates for CVE-2024-13176
Tomas Mraz [Wed, 15 Jan 2025 17:29:52 +0000 (18:29 +0100)] 
Add CHANGES.md and NEWS.md updates for CVE-2024-13176

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

6 months agoFix timing side-channel in ECDSA signature computation
Tomas Mraz [Wed, 15 Jan 2025 17:27:02 +0000 (18:27 +0100)] 
Fix timing side-channel in ECDSA signature computation

There is a timing signal of around 300 nanoseconds when the top word of
the inverted ECDSA nonce value is zero. This can happen with significant
probability only for some of the supported elliptic curves. In particular
the NIST P-521 curve is affected. To be able to measure this leak, the
attacker process must either be located in the same physical computer or
must have a very fast network connection with low latency.

Attacks on ECDSA nonce are also known as Minerva attack.

Fixes CVE-2024-13176

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

6 months agofix X509_PURPOSE_add() to take |sname| as primary key and handle |id| in a backwd...
Dr. David von Oheimb [Fri, 20 Dec 2024 09:07:15 +0000 (10:07 +0100)] 
fix X509_PURPOSE_add() to take |sname| as primary key and handle |id| in a backwd compat way for new purpose

Fixes #25873

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

6 months agofix X509_PURPOSE_set() to support clearing the purpose requirement as needed for...
Dr. David von Oheimb [Fri, 20 Dec 2024 08:12:43 +0000 (09:12 +0100)] 
fix X509_PURPOSE_set() to support clearing the purpose requirement as needed for X509_VERIFY_PARAM_set_purpose()

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

6 months agoIf you call X509_add_cert with cert == NULL and the X509_ADD_FLAG_UP_REF
otherddn1978 [Thu, 26 Dec 2024 10:26:34 +0000 (13:26 +0300)] 
If you call X509_add_cert with cert == NULL and the X509_ADD_FLAG_UP_REF
flag, it will сrash to X509_up_ref.  Passing NULL here is not valid,
return 0 if cert == NULL.

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

6 months agoFix documentation of OSSL_ASYM_CIPHER_PARAM_IMPLICIT_REJECTION
Richard Levitte [Wed, 15 Jan 2025 09:14:41 +0000 (10:14 +0100)] 
Fix documentation of OSSL_ASYM_CIPHER_PARAM_IMPLICIT_REJECTION

This drops OSSL_PKEY_PARAM_IMPLICIT_REJECTION - which is a meaningless
name - everywhere apart from still existing (for API stability, in
case someone uses that macro).

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

6 months agotest: aAissuingDistributionPoint X.509v3 extension
Jonathan M. Wilbur [Fri, 13 Dec 2024 06:52:25 +0000 (06:52 +0000)] 
test: aAissuingDistributionPoint X.509v3 extension

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

6 months agodoc: aAissuingDistributionPoint X.509v3 extension
Jonathan M. Wilbur [Fri, 13 Dec 2024 06:52:17 +0000 (06:52 +0000)] 
doc: aAissuingDistributionPoint X.509v3 extension

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

6 months agofeat: support the aAissuingDistributionPoint X.509v3 extension
Jonathan M. Wilbur [Fri, 13 Dec 2024 06:36:24 +0000 (06:36 +0000)] 
feat: support the aAissuingDistributionPoint X.509v3 extension

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

6 months agoSupport CLI and API setting of provider configuration parameters
Viktor Dukhovni [Thu, 16 Jan 2025 08:44:14 +0000 (19:44 +1100)] 
Support CLI and API setting of provider configuration parameters

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

6 months agoWork around to get llvm-mingw working on aarch64
Alexandr Nedvedicky [Wed, 15 Jan 2025 15:41:33 +0000 (16:41 +0100)] 
Work around to get llvm-mingw working on aarch64

It looks like llvm-mingw tool chain does not understand `.previous` asm
directive (see https://sourceware.org/binutils/docs/as/Previous.html).
As a workaround for win64 flavor (llvm-mingw toolchain) we let xlate
to emit .text instead of emitting .previous.

We also need to revisit usage of win64 flavor here in aarch64. We should
perhaps introduce a mingw flavour on aarch64 as well. win assembly
flavour should be used for microsoft assembler.

Fixes #26415

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

6 months agoMove rodata to .rodata section for armv8
Alexey Moksyakov [Thu, 16 Jan 2025 11:21:30 +0000 (14:21 +0300)] 
Move rodata to .rodata section for armv8

Adds missing files where asm code is generated by
perl scripts and read only constant is used

PR #24137

closes #23312

Signed-off-by: Alexey Moksyakov <yavtuk@yandex.ru>
Reviewed-by: Saša Nedvědický <sashan@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/26440)

6 months agoMissing .gitignore entries
Dmitry Belyavskiy [Tue, 14 Jan 2025 20:24:16 +0000 (21:24 +0100)] 
Missing .gitignore entries

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

6 months ago`atoi` should be allowed
Dmitry Belyavskiy [Tue, 14 Jan 2025 20:19:59 +0000 (21:19 +0100)] 
`atoi` should be allowed

When we compile with -O0 for Linux, the command
`./util/checkplatformsyms.pl ./util/platform_symbols/unix-symbols.txt ./libcrypto.so ./libssl.so`
complains to the lack of `atoi`

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

6 months agoprovider_deactivate(): Check return value of CRYPTO_atomic_add()
onexyoung [Mon, 23 Dec 2024 11:49:27 +0000 (14:49 +0300)] 
provider_deactivate(): Check return value of CRYPTO_atomic_add()

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

6 months agoWorkaround for RSA on AArch64 Big Endian
Nikolay Nikolaev [Tue, 24 Dec 2024 11:26:09 +0000 (13:26 +0200)] 
Workaround for RSA on AArch64 Big Endian

10646160125 introduced and optimized RSA NEON implementation
for AArch64 architecture, namely Cortex-A72 and Neoverse N1.
This implementation is broken in Big Endian mode, which is not
widely used, therefore not properly verified.
Here we disable this optimized implementation when Big Endian
platform is used.

Fixes: #22687
CLA: trivial

Signed-off-by: Nikolay Nikolaev <nicknickolaev@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/26257)

6 months agoRemove non-existing error code.
Peter Bierma [Sun, 12 Jan 2025 16:12:18 +0000 (11:12 -0500)] 
Remove non-existing error code.

CLA: trivial

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

6 months agoSynchronize openssl.txt with comperr.h
Peter Bierma [Sat, 11 Jan 2025 17:02:45 +0000 (12:02 -0500)] 
Synchronize openssl.txt with comperr.h

CLA: trivial

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

6 months agoFix dtls tests
Bernd Edlinger [Fri, 10 Jan 2025 07:45:20 +0000 (08:45 +0100)] 
Fix dtls tests

The dtls server process exits too early when the input
has an EOF condition.

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.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/26374)

6 months agoRevert "Use open2 instead of open for s_server instance"
Bernd Edlinger [Thu, 9 Jan 2025 20:26:12 +0000 (21:26 +0100)] 
Revert "Use open2 instead of open for s_server instance"

This reverts commit 4439ed16c5742e5ffb0417d45677900e77b299f2.

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.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/26374)

6 months agoRevert "chomp does not work on windows."
Bernd Edlinger [Thu, 9 Jan 2025 20:25:55 +0000 (21:25 +0100)] 
Revert "chomp does not work on windows."

This reverts commit 3e94e2b11d73ed22c601f818b31b7c4ca281f5d1.

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.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/26374)

6 months agoRevert "Do not confuse TAP::Parser by mixing up stderr with stdout."
Bernd Edlinger [Thu, 9 Jan 2025 20:24:44 +0000 (21:24 +0100)] 
Revert "Do not confuse TAP::Parser by mixing up stderr with stdout."

This reverts commit 3d3bb26a13dcc67f99e66de6a44ae9ced117f64b.

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.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/26374)

6 months agoCorrect documented KEM ids for OSSL_HPKE_str2suite
Tom Fay [Thu, 12 Dec 2024 09:38:54 +0000 (09:38 +0000)] 
Correct documented KEM ids for OSSL_HPKE_str2suite

CLA: trivial

Reviewed-by: Hugo Landau <hlandau@devever.net>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26159)

6 months agoAdd a GitHub workflow to make a release
Dmitry Misharov [Thu, 10 Oct 2024 14:15:55 +0000 (16:15 +0200)] 
Add a GitHub workflow to make a release

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

6 months agogenpkey: Avoid leaving empty file if encryption passphrase does not match
shridhar kalavagunta [Thu, 28 Nov 2024 17:30:50 +0000 (11:30 -0600)] 
genpkey: Avoid leaving empty file if encryption passphrase does not match

Fixes #25440

Reviewed-by: Hugo Landau <hlandau@devever.net>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26081)

6 months agoFix test failure in 30-test_evp_pkey_provided.t
Bernd Edlinger [Fri, 10 Jan 2025 18:58:46 +0000 (19:58 +0100)] 
Fix test failure in 30-test_evp_pkey_provided.t

In this test there is a random test output corruption.
`make test TESTS=test_evp_pkey_provided V=1` has some random output,
that can with a certain probability start a line with "ok" or so:

    # Setting up a OSSL_ENCODER context with passphrase
    # Testing with no encryption
jLixONcRPi/m64CGie4KKKDuGeTjtYwfima3BNYCGlgbLGeK3yYxBfZb9JjviOJ4
    # nHaNsRsONTAKyg==

This happens because large random data is output to bio_out
but some data remains buffered, and then test_note() is used to print
some comments on the bio_err file.  This causes output corruption that
confuses the TAP parser.
Fix that by flushing any pending output with test_flush_stdout() first.

Fixes #23992

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

6 months agoBig and little-endian load and store support
Viktor Dukhovni [Fri, 10 Jan 2025 08:00:15 +0000 (19:00 +1100)] 
Big and little-endian load and store support

These are needed in ML-KEM and ML-DSA, and are likely generally useful,
so public.

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

6 months agoFinishing touch to perlasm update to make it work on OpenBSD
sashan [Mon, 29 Apr 2024 12:04:56 +0000 (14:04 +0200)] 
Finishing touch to perlasm update to make it work on OpenBSD

This changeset brings a finishing touch to stuff we got from botovoq@
Changes to `crypto/perlasm/arm-xlate.pl` deal with verious assembler
flavours to keep various assembler compilers happy.

We also need to keep original code for 32-bit flavour in
`crypto/aes/asm/aesv8-armx.pl`.

Reviewed-by: Hugo Landau <hlandau@devever.net>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24137)

6 months agoMake it able to run asm code on OpenBSD (arm64)
Theo Buehler [Sun, 14 Apr 2024 23:23:36 +0000 (01:23 +0200)] 
Make it able to run asm code on OpenBSD (arm64)

In order to get asm code running on OpenBSD we must place
all constants into .rodata sections.

The change to crypto/perlasm/arm-xlate.pl adjusts changes
from Theo for additional assembler variants/flavours we
use for building OpenSSL.

Fixes #23312

Reviewed-by: Hugo Landau <hlandau@devever.net>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24137)

6 months agodrbg: provide requested amount of entropy, rather than self-strength
Dimitri John Ledkov [Fri, 1 Nov 2024 14:16:18 +0000 (14:16 +0000)] 
drbg: provide requested amount of entropy, rather than self-strength

Parent DRBG can be seed source (os or jitter) and thus able to provide
unlimited entropy.

get_entropy is documented to provide at least the request amount of
entropy. If requested amount of entropy is same as, or less than
drbg->strength, everything is compliant. However, if requested entropy
is more than drbg->strength (unlikely, but possible), the returned
amount of entropy will be insufficient and additional repeated calls
to get_entropy will be required.

Reading history of refactors, it seems to me that this function call
previouslly had assumptions and usecases that couldn't ever request or
require more than strength amount of entropy.

If entropy is set, request that amount, otherwise request
drbg->strength amount.

Reviewed-by: Hugo Landau <hlandau@devever.net>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/25850)

6 months agoFix obvious misspelling of ASN1_VALUE
Tom Cosgrove [Tue, 10 Dec 2024 11:31:11 +0000 (11:31 +0000)] 
Fix obvious misspelling of ASN1_VALUE

Reviewed-by: Hugo Landau <hlandau@devever.net>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26118)

6 months agoFix double 'the's
Tom Cosgrove [Thu, 5 Dec 2024 09:08:42 +0000 (09:08 +0000)] 
Fix double 'the's

Reviewed-by: Hugo Landau <hlandau@devever.net>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26118)

6 months agoLoongArch: we should access global symbol by la.global instead of
Wang Xin [Wed, 8 Jan 2025 01:18:47 +0000 (01:18 +0000)] 
LoongArch: we should access global symbol by la.global instead of
la.pcrel

openssl will not be built successfully with binutils-2.43.50.20241230
which checks if global symbols are accessed by PC-relative in shared
library.

CLA: trivial

Reviewed-by: Hugo Landau <hlandau@devever.net>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26336)

6 months agoFix premature reuse of qp's in rcu locks
Neil Horman [Fri, 10 Jan 2025 19:37:28 +0000 (14:37 -0500)] 
Fix premature reuse of qp's in rcu locks

An intermittent failure was noted on our new ppc64le CI runner, in which
what appeared to be a corrupted or invalid value getting returned from a
shared pointer under rcu protection

Investigation showed that the problem was with our small number of qp's
in a lock, and slightly incorrect accounting of the number of qp's
available we were prematurely recycling qp's, which led in turn to
premature completion of synchronization states, resulting in readers
reading memory that may have already been freed.

Fix it by:
a) Ensuring that we account for the fact that the first qp in an rcu
lock is allocated at the time the lock is created

and

b) Ensuring that we have a minimum number of 3 qp's:
1 that is free for write side allocation
1 that is in use by the write side currently
1 "next" qp that the read side can update while the prior qp is being
retired

With this change, the rcu threadstest runs indefinately in my testing

Fixes #26356

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

6 months agoFix intermittent test failure in 80-test_cmp_http.t
Bernd Edlinger [Thu, 9 Jan 2025 14:14:15 +0000 (15:14 +0100)] 
Fix intermittent test failure in 80-test_cmp_http.t

output to stderr is unbuffered bypassing the normal output, which does
not happen at line boundaries and is therefore confusing the TAP parser.
This is known to cause random test failures like this one:

80-test_cmp_http.t                    (Wstat: 0 Tests: 5 Failed: 0)
  Parse errors: Tests out of sequence.  Found (6) but expected (5)
                Bad plan.  You planned 6 tests but ran 5.

Fixes #23992

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

6 months agocoveralls.yml: Avoid excluding subdirectories of already excluded dirs
Tomas Mraz [Mon, 13 Jan 2025 13:24:22 +0000 (14:24 +0100)] 
coveralls.yml: Avoid excluding subdirectories of already excluded dirs

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

6 months agospeed: Pass IV to EVP_CipherInit_ex for -evp runs with non-AEAD ciphers
Ingo Franzki [Wed, 8 Jan 2025 15:00:33 +0000 (16:00 +0100)] 
speed: Pass IV to EVP_CipherInit_ex for -evp runs with non-AEAD ciphers

Some (non-AEAD) ciphers require an IV to be used. Always pass a (dummy) IV
when setting the key. It is ignored by ciphers that do not use an IV.

Commit 607a46d003f472d4bce646f3df6e85725094d68a corrected the use of AEAD
ciphers, but removed the IV from being passed to EVP_CipherInit_ex() for
non-AEAD ciphers.

Fixes: https://github.com/openssl/openssl/commit/607a46d003f472d4bce646f3df6e85725094d68a
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Hugo Landau <hlandau@devever.net>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26346)

6 months agoTweak case of [fs] variant letter in SLH-DSA algorithms
Viktor Dukhovni [Thu, 9 Jan 2025 13:09:09 +0000 (00:09 +1100)] 
Tweak case of [fs] variant letter in SLH-DSA algorithms

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

6 months agocoveralls.yml: Add --ignore-errors mismatch
Tomas Mraz [Fri, 10 Jan 2025 15:10:46 +0000 (16:10 +0100)] 
coveralls.yml: Add --ignore-errors mismatch

Once lcov is updated to 2.2 version or later, it could be dropped.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/26381)

6 months agoPre-ML-KEM/DSA decoder/encoder refactor
Viktor Dukhovni [Thu, 9 Jan 2025 03:33:18 +0000 (14:33 +1100)] 
Pre-ML-KEM/DSA decoder/encoder refactor

Simplify some decoder/encoder internals to facilitate upcoming support
for ML-KEM and ML-DSA.

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

6 months agoFix buildinf.h generation for space and backslash
Kai Pastor [Sat, 4 Jan 2025 10:48:26 +0000 (11:48 +0100)] 
Fix buildinf.h generation for space and backslash

Builds may be configured with CC or CFLAGS containing space and
double quotes. In particular on Windows, this may lead to passing
more than two arguments into mkbuildinf.pl.
In addition, backslashes must be escaped for constructing the C string.

Fixes #26253.

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

6 months agoUpdate error codes in "crypto/err/openssl.txt"
Michael Baentsch [Tue, 7 Jan 2025 09:30:56 +0000 (10:30 +0100)] 
Update error codes in "crypto/err/openssl.txt"

Fixes #26316

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