openssl.git
18 months agoFix coverity 1516093 tainted scalar
Todd Short [Wed, 19 Oct 2022 14:12:57 +0000 (10:12 -0400)]
Fix coverity 1516093 tainted scalar

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

18 months agoupdate pyca cryptography to 38.0.2
Paul Kehrer [Wed, 19 Oct 2022 14:21:37 +0000 (09:21 -0500)]
update pyca cryptography to 38.0.2

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

18 months agolink the pyca tests against the correct openssl
Paul Kehrer [Wed, 19 Oct 2022 14:07:32 +0000 (09:07 -0500)]
link the pyca tests against the correct openssl

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

18 months agoFix make update
Matt Caswell [Thu, 20 Oct 2022 16:12:20 +0000 (17:12 +0100)]
Fix make update

The recent DTLS write record layer code and the certificate compression
code both added new SSL_R_ reason codes. The numbers are conflicting due
to rebase issues and causing make update to fail.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19457)

18 months agoFiner grained error records for provider load/init failures
Richard Levitte [Sun, 16 Oct 2022 05:52:09 +0000 (07:52 +0200)]
Finer grained error records for provider load/init failures

When a provider is activated, these three cases would record that the
provider init function failed (implying that it was called):

-   failure to load the provider module (in case it's a dynamically
    loadable module)
-   the init function not being present (i.e. being NULL)
-   the init function being called and returning an error indication
    (i.e. returning a false value)

This is confusing.

Separating the three cases so that they record different errors will
make it easier to determine causes of failure.

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

18 months agoFix no longer implicitly refresh the cached TBSCertificate
Gibeom Gwon [Tue, 11 Oct 2022 17:53:00 +0000 (02:53 +0900)]
Fix no longer implicitly refresh the cached TBSCertificate

This reverts commit 9249a34b076df9a9d55ab74ab465d336980cae6a.
Fixes #19388

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

18 months agoMove freeing of BIOs as late as possible
Matt Caswell [Tue, 18 Oct 2022 11:23:40 +0000 (12:23 +0100)]
Move freeing of BIOs as late as possible

Calling SSL_free() will call BIO_free_all() on the rbio and wbio. We
keep references to the rbio and wbio inside the record layer object.
References to that object are held directly, as well as in fragment
retransmission queues. We need to ensure all record layer objects are
cleaned up before we call BIO_free_all() on rbio/wbio - otherwise the
"top" BIO may not have its reference count drop to 0 when BIO_free_all()
is called. This means that the rest of the BIOs in the chain don't get
freed and a memory leak can occur.

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

18 months agoRemove some redundant code
Matt Caswell [Mon, 17 Oct 2022 15:33:40 +0000 (16:33 +0100)]
Remove some redundant code

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

18 months agoRemove the old buffer management code
Matt Caswell [Mon, 17 Oct 2022 14:46:02 +0000 (15:46 +0100)]
Remove the old buffer management code

We no longer use the old buffer management code now that it has all been
moved to the new record layer.

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

18 months agoRemove some TODO(RECLAYER) comments now that DTLS has been moved
Matt Caswell [Mon, 17 Oct 2022 14:13:18 +0000 (15:13 +0100)]
Remove some TODO(RECLAYER) comments now that DTLS has been moved

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

18 months agoRemove dtls_write_records
Matt Caswell [Mon, 17 Oct 2022 14:07:47 +0000 (15:07 +0100)]
Remove dtls_write_records

The dtls_write_records function, after the previous series of commits,
was functionally equivalent to tls_write_records_default - so it can be
removed completely.

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

18 months agoMove sequence increment to post encryption processing
Matt Caswell [Mon, 17 Oct 2022 13:42:09 +0000 (14:42 +0100)]
Move sequence increment to post encryption processing

This change make dtls_write_records virtuall the same as
tls_write_records_default, which will enable us to merge them in a
subsequent commit.

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

18 months agoRemove supurious set of the record type
Matt Caswell [Mon, 17 Oct 2022 13:37:32 +0000 (14:37 +0100)]
Remove supurious set of the record type

We already set the record type on the SSL3_RECORD structure. We don't
need to do it again (inconsistently).

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

18 months agoConsolidate sequence counter incrementing code
Matt Caswell [Mon, 17 Oct 2022 11:28:07 +0000 (12:28 +0100)]
Consolidate sequence counter incrementing code

The sequence counter was incremented in numerous different ways in
numerous different locations. We introduce a single function to do this
inside the record layer.

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

18 months agoEnsure the record layer is responsible for calculating record overheads
Matt Caswell [Fri, 14 Oct 2022 14:30:55 +0000 (15:30 +0100)]
Ensure the record layer is responsible for calculating record overheads

Don't calculate the potential record layer expansion outside of the
record layer. We move some code that was doing that into the record
layer.

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

18 months agoConvert dtls_write_records to use standard record layer functions
Matt Caswell [Thu, 13 Oct 2022 15:44:22 +0000 (16:44 +0100)]
Convert dtls_write_records to use standard record layer functions

We have standard functions for most of the work that dtls_write_records
does - so we convert it to use those functions instead.

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

18 months agoStart using WPACKET in the dtls write records code
Matt Caswell [Thu, 13 Oct 2022 10:25:56 +0000 (11:25 +0100)]
Start using WPACKET in the dtls write records code

Previously this was writing to the buffers directly. We use the safer
WPACKET instead

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

18 months agoUse common tls_write_records() even for DTLS
Matt Caswell [Fri, 7 Oct 2022 15:23:14 +0000 (16:23 +0100)]
Use common tls_write_records() even for DTLS

In practice this just means have a DTLS specific write_records that the
common tls_write_records() just calls. We also replace the use of
ssl3_write_pending() with tls_retry_write_records().

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

18 months agoConvert dtls_write_records() to return the correct return values
Matt Caswell [Thu, 6 Oct 2022 14:58:08 +0000 (15:58 +0100)]
Convert dtls_write_records() to return the correct return values

We now use standard record layer return values for this function. We
also convert the code to use RLAYERfatal instead of SSLfatal.

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

18 months agoUse record layer buffers for DTLS rather than the buffers in s->rlayer
Matt Caswell [Thu, 6 Oct 2022 14:10:42 +0000 (15:10 +0100)]
Use record layer buffers for DTLS rather than the buffers in s->rlayer

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

18 months agoMove dlts_write_records() function in the record layer
Matt Caswell [Thu, 6 Oct 2022 13:49:16 +0000 (14:49 +0100)]
Move dlts_write_records() function in the record layer

At the this stage we just move the code and don't restructure it to do it
the record layer way yet.

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

18 months agoCreate a dlts_write_records() function
Matt Caswell [Thu, 6 Oct 2022 13:16:01 +0000 (14:16 +0100)]
Create a dlts_write_records() function

In preparation for moving the DTLS code to use the new write record layer
architecture we first restructure the code to create a dtls_write_records()
function that mirrors the functionality that the record layer will provide.

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

18 months agoRemove create_empty_fragment from do_dtls1_write()
Matt Caswell [Thu, 6 Oct 2022 12:18:43 +0000 (13:18 +0100)]
Remove create_empty_fragment from do_dtls1_write()

do_dtls1_write() was never called with a value for create_empty_fragment
that was ever non-zero - so this is dead code and can be removed. The
equivalent code in the TLS processing is used for TLS1.0/SSLv3 to protect
against known IV weaknesses because those protocol versions do not have
an explicit IV. However DTLS1.0 is based on TLSv1.1 and *does* have an
explicit IV - so this is not useful there.

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

18 months agoc_rehash: Fix file extension matching
Tobias Girstmair [Tue, 18 Oct 2022 11:23:21 +0000 (13:23 +0200)]
c_rehash: Fix file extension matching

For some reason, parenthesis were added 8 years ago in commit
a787c2590e468585a1a19738e0c7f481ec91b762. This essentially removed the
\. and $ constructs from the middle branches. Hence a file called e.g.
cert.key would accidentally match the (cer) rule.

CLA: trivial

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

18 months agoadd a check for the return of sk_SRP_gN_new_null() so that capture the potential...
xkernel [Tue, 18 Oct 2022 16:54:26 +0000 (00:54 +0800)]
add a check for the return of sk_SRP_gN_new_null() so that capture the potential memory error in time

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

18 months agoripemd: document as being present in the default provider
Pauli [Mon, 17 Oct 2022 22:07:19 +0000 (09:07 +1100)]
ripemd: document as being present in the default provider

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

18 months agoAvoid putting ripemd_prov.c in libcommon otherwise it is regarded as fips source
Tomas Mraz [Mon, 17 Oct 2022 15:05:09 +0000 (17:05 +0200)]
Avoid putting ripemd_prov.c in libcommon otherwise it is regarded as fips source

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19375)

18 months agodefault provider: include RIPEMD160
Pauli [Tue, 11 Oct 2022 00:23:57 +0000 (11:23 +1100)]
default provider: include RIPEMD160

Including RIPEMD160 in both the default and legacy providers shouldn't break
anyone and makes the algorithm available more readily.

Fixes #17722

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

18 months agoAdd changes entry for RIPEMD160 being added to the default provider
Pauli [Tue, 18 Oct 2022 07:14:26 +0000 (18:14 +1100)]
Add changes entry for RIPEMD160 being added to the default provider

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

18 months agoAdd `for_comp` flag when retrieving certs for compression
Todd Short [Mon, 29 Aug 2022 21:00:07 +0000 (17:00 -0400)]
Add `for_comp` flag when retrieving certs for compression

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

18 months agoUpdate COMP_METHOD
Todd Short [Mon, 29 Aug 2022 18:58:57 +0000 (14:58 -0400)]
Update COMP_METHOD

size_t-ify the COMP_METHOD structure and functions.
Get rid of the non-functional COMP_METHODS and return NULL instead.

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

18 months agoAdd CI to build with brotli and zstd
Todd Short [Mon, 9 Aug 2021 20:56:54 +0000 (16:56 -0400)]
Add CI to build with brotli and zstd

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

18 months agoAdd support for compressed certificates (RFC8879)
Todd Short [Mon, 9 Aug 2021 20:56:50 +0000 (16:56 -0400)]
Add support for compressed certificates (RFC8879)

* Compressed Certificate extension (server/client)
* Server certificates (send/receive)
* Client certificate (send/receive)

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

18 months agoConvert ZLIB defines to OPENSSL_NO_ZLIB
Todd Short [Wed, 17 Aug 2022 21:36:27 +0000 (17:36 -0400)]
Convert ZLIB defines to OPENSSL_NO_ZLIB

Use the normal OPENSSL_NO_ prefix to enable/disable ZLIB
Make `BIO_f_zlib()` always available.

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

18 months agoAdd ZSTD compression support (RFC8478bis)
Todd Short [Mon, 9 Aug 2021 20:56:37 +0000 (16:56 -0400)]
Add ZSTD compression support (RFC8478bis)

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

18 months agoAdd brotli compression support (RFC7924)
Todd Short [Mon, 9 Aug 2021 20:56:29 +0000 (16:56 -0400)]
Add brotli compression support (RFC7924)

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

18 months agoFix sctp compile errors
slontis [Wed, 12 Oct 2022 06:03:08 +0000 (16:03 +1000)]
Fix sctp compile errors

Fixes #19371

running config with 'enable-sctp' gave compiler errors.

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

18 months agoFix documentation for OFB/OCB in the FIPS provider
Joachim Vandersmissen [Thu, 13 Oct 2022 09:55:57 +0000 (09:55 +0000)]
Fix documentation for OFB/OCB in the FIPS provider

CLA: trivial

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19408)

18 months agoFix typos in doc/designs/ddd/README.md
omahs [Fri, 14 Oct 2022 08:54:27 +0000 (10:54 +0200)]
Fix typos in doc/designs/ddd/README.md

CLA: trivial

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

18 months agoAdd missing include for DH_get0_priv_key()
Tomas Mraz [Thu, 13 Oct 2022 14:04:43 +0000 (16:04 +0200)]
Add missing include for DH_get0_priv_key()

Fixes #19410

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/19411)

18 months agocrypto: add preemptive threading support
Čestmír Kalina [Mon, 27 Sep 2021 20:42:11 +0000 (22:42 +0200)]
crypto: add preemptive threading support

Some primitives are designed to be used in a multi-threaded environment,
if supported, e.g., Argon2.

This patch adds support for preemptive threading and basic synchronization
primitives for platforms compliant with POSIX threads or Windows CRT.
Native functions are wrapped to provide a common (internal) API.

Threading support can be disabled at compile time. If enabled, threading
is disabled by default and needs to be explicitly enabled by the user.

Thread enablement requires an explicit limit on the number of threads that
OpenSSL may spawn (non-negative integer/infinity). The limit may be changed.

Signed-off-by: Čestmír Kalina <ckalina@redhat.com>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12255)

18 months agoci: add thread-pool and default-thread-pool
Čestmír Kalina [Tue, 27 Sep 2022 21:21:05 +0000 (17:21 -0400)]
ci: add thread-pool and default-thread-pool

Signed-off-by: Čestmír Kalina <ckalina@redhat.com>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12255)

18 months agoConfigure: add thread-pool and default-thread-pool
Čestmír Kalina [Thu, 25 Aug 2022 15:02:42 +0000 (17:02 +0200)]
Configure: add thread-pool and default-thread-pool

Signed-off-by: Čestmír Kalina <ckalina@redhat.com>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12255)

18 months agoCoverity 1515953: negative loop bound
Pauli [Fri, 14 Oct 2022 01:53:02 +0000 (12:53 +1100)]
Coverity 1515953: negative loop bound

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

18 months agoFix LLVM vs Apple LLVM version numbering confusion, for $avx512ifma
Richard Levitte [Fri, 7 Oct 2022 08:37:15 +0000 (10:37 +0200)]
Fix LLVM vs Apple LLVM version numbering confusion, for $avx512ifma

Apple LLVM has a different version numbering scheme than upstream LLVM.
That makes for quite a bit of confusion.

https://en.wikipedia.org/wiki/Xcode#Toolchain_versions to the rescue,
they have collected quite a lot of useful data.

This change is concentrated around the `$avx512ifma` flag

Fixes #16670 for the master branch

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

18 months agoAdd translation for ECX group parameter
Juergen Christ [Wed, 5 Oct 2022 11:57:21 +0000 (13:57 +0200)]
Add translation for ECX group parameter

Legacy EVP_PKEY_CTX objects did not support the "group" parameter for X25519
and X448.  The translation of this parameter resulted in an error.  This
caused errors for legacy keys and engines.

Fix this situation by adding a translation that simply checks that the correct
parameter is to be set, but does not actually set anything.  This is correct
since the group name is anyway optional for these two curves.

Fixes #19313

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19348)

18 months agoFix an occasional CI failure due to unaligned access
Bernd Edlinger [Tue, 11 Oct 2022 18:25:33 +0000 (20:25 +0200)]
Fix an occasional CI failure due to unaligned access

This happens rarely, but only because very few CI runs
use the exotic CPU type that is necessary to execute
anything within rsaz_exp_x2.c and enable UBSAN at the same time.

crypto/bn/rsaz_exp_x2.c:562:20: runtime error: load of misaligned address 0x612000022cc6 for type 'uint64_t' (aka 'unsigned long'), which requires 8 byte alignment
0x612000022cc6: note: pointer points here
 84 a3 78 e0 8e 8d  4a a5 51 9c 57 d0 d6 41  f3 26 d1 4e e1 98 42 b5  3a 9f 04 f1 73 d2 1d bf  73 44
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior crypto/bn/rsaz_exp_x2.c:562:20 in
../../util/wrap.pl ../../fuzz/server-test ../../fuzz/corpora/server => 1
not ok 2 - Fuzzing server

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19394)

18 months agoImprove performance of the encoder collection
slontis [Tue, 4 Oct 2022 23:57:51 +0000 (09:57 +1000)]
Improve performance of the encoder collection

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19344)

18 months agoPKCS12_SAFEBAG_set0_attrs: Remove const from function signature
Daniel Fiala [Fri, 7 Oct 2022 11:24:20 +0000 (13:24 +0200)]
PKCS12_SAFEBAG_set0_attrs: Remove const from function signature

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

18 months agoFix typo in PKCS12_SAFEBAG_set0_attrs
Daniel Fiala [Fri, 7 Oct 2022 06:56:54 +0000 (08:56 +0200)]
Fix typo in PKCS12_SAFEBAG_set0_attrs

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

18 months agooptimize ossl_sm4_set_key speed
zhangzhilei [Sat, 24 Sep 2022 02:32:36 +0000 (10:32 +0800)]
optimize ossl_sm4_set_key speed

this optimization comes from libgcrypt, increse about 48% speed

Benchmark on my AMD Ryzen Threadripper 3990X

before:
Did 5752000 SM4 setup operations in 1000151us (5751131.6 ops/sec)
after:
Did 8506000 SM4 setup operations in 1000023us (8505804.4 ops/sec)

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19270)

18 months agoUpdate CHANGES.md and NEWS.md for new release
Matt Caswell [Mon, 10 Oct 2022 10:20:08 +0000 (11:20 +0100)]
Update CHANGES.md and NEWS.md for new release

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

18 months agoAdd a test for TLSv1.3 only client sending a correct key_share
Matt Caswell [Fri, 30 Sep 2022 15:59:05 +0000 (16:59 +0100)]
Add a test for TLSv1.3 only client sending a correct key_share

Make sure that a TLSv1.3 only client does not send a TLSv1.3 key_share.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/19317)

18 months agoAdd a test for where a client sends a non-TLSv1.3 key share
Matt Caswell [Fri, 30 Sep 2022 15:51:58 +0000 (16:51 +0100)]
Add a test for where a client sends a non-TLSv1.3 key share

This should not happen but we should tolerate and send an HRR

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/19317)

18 months agoEnsure that the key share group is allowed for our protocol version
Matt Caswell [Fri, 30 Sep 2022 13:21:50 +0000 (14:21 +0100)]
Ensure that the key share group is allowed for our protocol version

We should never send or accept a key share group that is not in the
supported groups list or a group that isn't suitable for use in TLSv1.3

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/19317)

18 months agoFix a return value in tls_default_read_n
Matt Caswell [Wed, 5 Oct 2022 14:01:18 +0000 (15:01 +0100)]
Fix a return value in tls_default_read_n

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

18 months agoIntroduce a step to prepare the BIO before writing
Matt Caswell [Tue, 4 Oct 2022 15:32:02 +0000 (16:32 +0100)]
Introduce a step to prepare the BIO before writing

This removes some KTLS specific code from tls_retry_write_records().

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

18 months agoRemove ktls specific code from tls_setup_write_buffers
Matt Caswell [Tue, 4 Oct 2022 15:16:56 +0000 (16:16 +0100)]
Remove ktls specific code from tls_setup_write_buffers

The KTLS code no longer calls this function so this is not necessary.

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

18 months agoAdd a post encryption processing step
Matt Caswell [Tue, 4 Oct 2022 14:59:06 +0000 (15:59 +0100)]
Add a post encryption processing step

For example in this we add the MAC if we are doing encrypt-then-mac.

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

18 months agoAdd a prepare for encryption step
Matt Caswell [Tue, 27 Sep 2022 15:43:23 +0000 (16:43 +0100)]
Add a prepare for encryption step

This applies any mac that might be necessary, ensures that we have
enough space in the WPACKET to perform the encryption and sets up the
SSL3_RECORD ready for that encryption.

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

18 months agoMove record padding out of tls_common.c
Matt Caswell [Tue, 27 Sep 2022 14:32:22 +0000 (15:32 +0100)]
Move record padding out of tls_common.c

Only tls13_meth.c needs to handle adding record padding. All other
*_meth.c files can ignore it.

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

18 months agoDon't check whether we are using KTLS before calling the cipher function
Matt Caswell [Tue, 27 Sep 2022 14:06:20 +0000 (15:06 +0100)]
Don't check whether we are using KTLS before calling the cipher function

The KTLS cipher function is a no-op so it doesn't matter if we call it.
We shouldn't special case KTLS in tls_common.c

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

18 months agoDefer record header preparation to the protocol methods
Matt Caswell [Mon, 26 Sep 2022 16:44:11 +0000 (17:44 +0100)]
Defer record header preparation to the protocol methods

We introduce a new function to prepare the record header. KTLS has its own
version since this is done by the kernel.

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

18 months agoAbstract out the record type processing
Matt Caswell [Mon, 26 Sep 2022 16:07:02 +0000 (17:07 +0100)]
Abstract out the record type processing

Remove TLSv1.3 specific processing of the record type out of tls_common.c
and into tls13_meth.c

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

18 months agoDefer write buffer and WPACKET allocation/initialisation to protocol code
Matt Caswell [Mon, 26 Sep 2022 15:35:30 +0000 (16:35 +0100)]
Defer write buffer and WPACKET allocation/initialisation to protocol code

We move some protocol specific code for write buffer and WPACKET allocation
and initialisation out of tls_common.c and into the protocol specific files.

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

18 months agoRemove an old TODO from the code
Matt Caswell [Mon, 26 Sep 2022 11:00:28 +0000 (12:00 +0100)]
Remove an old TODO from the code

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

18 months agoUse the configured max_send_fragment value in the write record layer
Matt Caswell [Fri, 23 Sep 2022 15:53:23 +0000 (16:53 +0100)]
Use the configured max_send_fragment value in the write record layer

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

18 months agoRemove enc_write_state
Matt Caswell [Fri, 23 Sep 2022 11:59:22 +0000 (12:59 +0100)]
Remove enc_write_state

This field was used to track whether a cipher ctx was valid for writing
or not, and also whether we should write out plaintext alerts. With the new
record layer design we no longer need to track whether a cipher ctx is valid
since the whole record layer will be aborted if it is not. Also we have a
different mechanism for tracking whether we should write out plaintext
alerts. Therefore this field is removed from the SSL object.

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

18 months agoRemove some unneeded usage of the SSL_CONNECTION object
Matt Caswell [Fri, 23 Sep 2022 11:20:38 +0000 (12:20 +0100)]
Remove some unneeded usage of the SSL_CONNECTION object

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

18 months agoRemove most of the DTLS special casing from the write record code
Matt Caswell [Fri, 23 Sep 2022 11:06:54 +0000 (12:06 +0100)]
Remove most of the DTLS special casing from the write record code

Most of this was unnecessary anyway since DTLS isn't using these codepaths.

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

18 months agoConvert the TLSv1.3 crypto code to the new write record layer
Matt Caswell [Fri, 16 Sep 2022 16:34:40 +0000 (17:34 +0100)]
Convert the TLSv1.3 crypto code to the new write record layer

We also clean up some of the KTLS code while we are doing it now that all
users of KTLS have been moved to the new write record layer.

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

18 months agoAdd vpaes-loongarch64.pl module.
zhuchen [Thu, 29 Sep 2022 12:14:00 +0000 (20:14 +0800)]
Add vpaes-loongarch64.pl module.

Add 128 bit lsx vector expansion optimization code of Loongarch64 architecture
to AES. The test result on the 3A5000 improves performance by about 40%~50%.

Signed-off-by: zhuchen <zhuchen@loongson.cn>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19364)

18 months agoAdd LoongArch64 cpuid and OPENSSL_loongarchcap_P
zhuchen [Thu, 29 Sep 2022 11:50:52 +0000 (19:50 +0800)]
Add LoongArch64 cpuid and OPENSSL_loongarchcap_P

Loongarch64 architecture defines 128 bit vector extension lsx and 256 bit
vector extension lasx. The cpucfg instruction can be used to obtain whether
the CPU has a corresponding extension. This part of code is added to prepare
for the subsequent addition of corresponding vector instruction optimization.

Signed-off-by: zhuchen <zhuchen@loongson.cn>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19364)

18 months agonit: fix some pointer comparisons
FdaSilvaYY [Tue, 23 Aug 2022 18:53:31 +0000 (20:53 +0200)]
nit: fix some pointer comparisons

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

18 months agoapps & al : Fix various typos, repeated words, align some spelling to LDP.
FdaSilvaYY [Tue, 23 Aug 2022 18:45:13 +0000 (20:45 +0200)]
apps & al : Fix various typos, repeated words, align some spelling to LDP.
Mostly revamped from #16712
- fall thru -> fall through
- time stamp -> timestamp
- host name -> hostname
- ipv6 -> IPv6

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

18 months agoFix various typos, repeated words, align some spelling to LDP.
FdaSilvaYY [Tue, 23 Aug 2022 18:40:44 +0000 (20:40 +0200)]
Fix various typos, repeated words, align some spelling to LDP.
Partially revamped from #16712
- fall thru -> fall through
- time stamp -> timestamp
- host name -> hostname
- ipv6 -> IPv6

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

18 months agocrypto/*: Fix various typos, repeated words, align some spelling to LDP.
FdaSilvaYY [Tue, 23 Aug 2022 18:37:03 +0000 (20:37 +0200)]
crypto/*: Fix various typos, repeated words, align some spelling to LDP.
partially revamped from #16712
- fall thru -> fall through
- time stamp -> timestamp
- host name -> hostname
- ipv6 -> IPv6

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

18 months agocrypto: Fix various typos, repeated words, align some spelling to LDP.
FdaSilvaYY [Tue, 23 Aug 2022 18:33:58 +0000 (20:33 +0200)]
crypto: Fix various typos, repeated words, align some spelling to LDP.
partially revamped from #16712
- fall thru -> fall through
- time stamp -> timestamp
- file name -> filename
- host name -> hostname

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

18 months agoeckey_priv_encode(): Call ASN1_STRING_free() only on an ASN1_STRING
Tomas Mraz [Mon, 10 Oct 2022 06:59:23 +0000 (08:59 +0200)]
eckey_priv_encode(): Call ASN1_STRING_free() only on an ASN1_STRING

Also ASN1_OBJECT_free() never needs to be called on objects returned
from OBJ_nid2obj().

Fixes #19138

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19367)

18 months agotest: condition out code that relies on CHACHA.
Pauli [Sun, 9 Oct 2022 22:01:42 +0000 (09:01 +1100)]
test: condition out code that relies on CHACHA.

Run checker does a no-chacha build and tests fail because it can't be fetched.

Fixes #19363

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
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/19366)

18 months agoAlign util/libcrypto.num with the openssl-3.0 branch
Richard Levitte [Fri, 7 Oct 2022 06:24:59 +0000 (08:24 +0200)]
Align util/libcrypto.num with the openssl-3.0 branch

OPENSSL_strcasecmp() and OPENSSL_strncasecmp() appeared in OpenSSL 3.0.3,
and were assigned numbers in util/libcrypto.num.  These numbers must be
transported up to the master branch as long as development of OpenSSL 3.x
is going on there (as indicated by the version info found in VERSION.dat).

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/19357)

18 months agoFixed some grammar and spelling
Thiago Suchorski [Thu, 22 Sep 2022 11:27:27 +0000 (08:27 -0300)]
Fixed some grammar and spelling

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/19262)

18 months agoFix older clang warning on initialization
Tomas Mraz [Fri, 30 Sep 2022 09:32:41 +0000 (11:32 +0200)]
Fix older clang warning on initialization

We use memset() instead.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19311)

18 months agoAdd design document for the QUIC Stream Receive Buffers module
Tomas Mraz [Tue, 6 Sep 2022 15:34:54 +0000 (17:34 +0200)]
Add design document for the QUIC Stream Receive Buffers module

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19149)

18 months agoset MGF1 digest correctly
James Muir [Tue, 4 Oct 2022 14:48:43 +0000 (10:48 -0400)]
set MGF1 digest correctly

Fixes #19290

update rsa_set_ctx_params() so that the digest function used in the
MGF1 construction is set correctly.  Add a test for this to
evp_extra_test.c based on the code scaro-axway provided in #19290.

Reviewed-by: Dmitry Belyavskiy <beldmit@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/19342)

18 months agoUpdate the SSL_CTX_set1_groups documentation
Matt Caswell [Fri, 30 Sep 2022 12:43:55 +0000 (13:43 +0100)]
Update the SSL_CTX_set1_groups documentation

Mention the brainpool curves in the documentation

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

18 months agoAdd some more brainpool tests for TLSv1.3
Matt Caswell [Fri, 30 Sep 2022 12:35:28 +0000 (13:35 +0100)]
Add some more brainpool tests for TLSv1.3

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

18 months agoReimplement brainpool TLSv1.3 support group support
Matt Caswell [Fri, 30 Sep 2022 10:57:23 +0000 (11:57 +0100)]
Reimplement brainpool TLSv1.3 support group support

Create new TLS_GROUP_ENTRY values for these groups.

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

18 months agoPartial revert and reimplement "Enable brainpool curves for TLS1.3"
Matt Caswell [Fri, 30 Sep 2022 09:50:53 +0000 (10:50 +0100)]
Partial revert and reimplement "Enable brainpool curves for TLS1.3"

This partially reverts commit 0a10825a0 in order to reimplement it in a
simpler way in the next commit. The reverted aspects are all related to
the TLSv1.3 brainpool curves in the supported_groups extension. Rather
than special casing the handling of these curves we simply add new entries
to the groups table to represent them. They can then be handled without
any additional special casing. This makes the code simpler to maintain.

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

18 months agoFix crypto/dso/dso_vms.c
Richard Levitte [Fri, 7 Oct 2022 08:23:17 +0000 (10:23 +0200)]
Fix crypto/dso/dso_vms.c

In the "Stop raising ERR_R_MALLOC_FAILURE in most places" commit, some
fixes of this file weren't done quite right, leading to a symbol being
undeclared depending on building circumstances.

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

18 months agoChange all references to OpenSSL 3.1 to OpenSSL 3.2 in the master branch
Richard Levitte [Wed, 5 Oct 2022 15:52:46 +0000 (17:52 +0200)]
Change all references to OpenSSL 3.1 to OpenSSL 3.2 in the master branch

3.1 has been decided to be a FIPS 140-3 release, springing from the branch
openssl-3.0, and the master branch to continue with the development of
OpenSSL 3.2.

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19350)

18 months agoVMS: For executables, process the use of /INCLUDE=main a bit differently
Richard Levitte [Wed, 5 Oct 2022 10:47:32 +0000 (12:47 +0200)]
VMS: For executables, process the use of /INCLUDE=main a bit differently

The way it was implemented didn't play well with perl's join(), so it's
reimplemented a bit differently.

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

18 months agoRename ossl_sleep calls to OSSL_sleep everywhere
Richard Levitte [Mon, 3 Oct 2022 05:22:52 +0000 (07:22 +0200)]
Rename ossl_sleep calls to OSSL_sleep everywhere

Also, remove inclusions of internal/e_os.h where it seems no longer
necessary.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/19330)

18 months agoRename ossl_sleep() to OSSL_sleep() and make it public
Richard Levitte [Mon, 3 Oct 2022 05:10:34 +0000 (07:10 +0200)]
Rename ossl_sleep() to OSSL_sleep() and make it public

ossl_sleep() was implemented as a static inline function in internal/e_os.h,
using usleep() on Unix and Sleep() on Windows.  So far well and good.
However, it also has a fallback implementation for systems that do not have
usleep() or Sleep(), and that implementation happens to use ossl_time_now(),
which is a normal function, private to libcrypto, and is judged to be too
complex to sanely make into a static inline function.

This fallback creates a problem, because we do use ossl_sleep() in apps/ and
a few test programs in test/, and when they are linked with libcrypto in
shared library form, ossl_time_now() can't be found, since it's not publicly
exposed.

Something needs to give, and the easiest, and hopefully sanest answer is to
make ossl_sleep() a publicly exposed function, which requires a slight name
change.

Documentation and 'make update' result included.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/19330)

18 months agoMove the SSLv3 crypto code into the new record layer
Matt Caswell [Thu, 15 Sep 2022 16:36:52 +0000 (17:36 +0100)]
Move the SSLv3 crypto code into the new record layer

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

18 months agoEnable the ability to query the COMP_METHOD being used in the record layer
Matt Caswell [Thu, 15 Sep 2022 15:03:02 +0000 (16:03 +0100)]
Enable the ability to query the COMP_METHOD being used in the record layer

We also convert to passing COMP_METHOD rather than SSL_COMP to the record
layer. The former is a public type while the latter is internal only - and
the only thing we need from SSL_COMP is the method.

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

18 months agoConvert the TLSv1.0/1.1/1.2 crypto code to use the new write record layer
Matt Caswell [Wed, 14 Sep 2022 14:24:10 +0000 (15:24 +0100)]
Convert the TLSv1.0/1.1/1.2 crypto code to use the new write record layer

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

18 months agoQUIC Send Stream Management
Hugo Landau [Tue, 6 Sep 2022 12:23:29 +0000 (13:23 +0100)]
QUIC Send Stream Management

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

18 months agoFix regression in i2d_re_X509_REQ_tbs()
Tomas Mraz [Thu, 29 Sep 2022 11:00:45 +0000 (13:00 +0200)]
Fix regression in i2d_re_X509_REQ_tbs()

This fixes regression from commit 8e39049. There is also no point
in setting the modified flag after just calling i2d.

Fixes #19297

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/19299)

18 months agoAdd {lib}_R_{lib}_LIB, for our engines and other "external" modules
Richard Levitte [Thu, 29 Sep 2022 13:33:20 +0000 (15:33 +0200)]
Add {lib}_R_{lib}_LIB, for our engines and other "external" modules

Engines lacked the possibility to refer to themselves in this form:

    WHATEVERerr(WHATEVER_F_SOMETHING, WHATEVER_R_WHATEVER_LIB);

This little change makes that possible, and gets used in e_capi.

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