]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
2 years agoX509_REQ_get_extensions: add error queue entry on ill-formed extensions attribute
Dr. David von Oheimb [Mon, 1 Aug 2022 13:06:35 +0000 (15:06 +0200)] 
X509_REQ_get_extensions: add error queue entry on ill-formed extensions attribute

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

2 years agoutil/wrap.pl.in: If the subprocess died with a signal, let's re-signal it
Richard Levitte [Mon, 22 Aug 2022 16:40:54 +0000 (18:40 +0200)] 
util/wrap.pl.in: If the subprocess died with a signal, let's re-signal it

A simple 'kill' of the same signal on our own process should do it.
This will allow the shell that this is running under to catch it
properly, and output something if it usually does that.

Fixes #19041

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

2 years agoFix the return type for the rlayer_skip_early_data callback
Matt Caswell [Tue, 23 Aug 2022 13:45:32 +0000 (14:45 +0100)] 
Fix the return type for the rlayer_skip_early_data callback

There was a copy & paste error in the definition of the
rlayer_skip_early_data callback. The return type is supposed to
be "int" but it was defined as a pointer type. This was causing
test failures on some platforms.

Fixes #19037

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

2 years agorl->enc_ctx must be non-NULL and cipher must be set
Tomas Mraz [Fri, 19 Aug 2022 10:28:42 +0000 (12:28 +0200)] 
rl->enc_ctx must be non-NULL and cipher must be set

Otherwise ssl3_cipher() cannot work properly.

Fixes Coverity CID 1509401

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

2 years agoDo not use RLAYERfatal on NULL RLAYER
Tomas Mraz [Fri, 19 Aug 2022 10:19:55 +0000 (12:19 +0200)] 
Do not use RLAYERfatal on NULL RLAYER

or on record layer that is to be freed anyway.

Fixes Coverity CID 15094021509403

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

2 years agoCoverity 1508532: out of bounds access
Pauli [Mon, 22 Aug 2022 01:06:57 +0000 (11:06 +1000)] 
Coverity 1508532: out of bounds access

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

2 years agoOSSL_HTTP_REQ_CTX_nbio: add support for partial content-type string matching
Dr. David von Oheimb [Tue, 28 Jun 2022 15:23:45 +0000 (17:23 +0200)] 
OSSL_HTTP_REQ_CTX_nbio: add support for partial content-type string matching

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

2 years agoapp_http_tls_cb() and tls_error_hint(): code cleanup
Dr. David von Oheimb [Tue, 28 Jun 2022 10:10:49 +0000 (12:10 +0200)] 
app_http_tls_cb() and tls_error_hint(): code cleanup

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

2 years agoMakefile: Generate crypto objects only as far as needed
Dr. David von Oheimb [Tue, 11 May 2021 13:35:43 +0000 (15:35 +0200)] 
Makefile: Generate crypto objects only as far as needed

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

2 years agoMakefile: Call mknum.pl on 'make ordinals' only if needed
Dr. David von Oheimb [Tue, 11 May 2021 10:59:03 +0000 (12:59 +0200)] 
Makefile: Call mknum.pl on 'make ordinals' only if needed

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

2 years agoSupport decode SM2 parameters
K1 [Mon, 18 Jul 2022 17:18:12 +0000 (01:18 +0800)] 
Support decode SM2 parameters

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

2 years agoMoving notify check after the no time check
Ryan Kelley [Tue, 16 Aug 2022 05:28:50 +0000 (05:28 +0000)] 
Moving notify check after the no time check

CLA: trivial

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

2 years agoopenssl speed fails in FIPS mode
Dmitry Belyavskiy [Tue, 21 Dec 2021 15:52:25 +0000 (16:52 +0100)] 
openssl speed fails in FIPS mode

...because it uses md5 for HMAC tests. Skip md5 in case of its
unavailability.

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

2 years agoFix typo in migration guide
Tobias Nießen [Sat, 20 Aug 2022 16:56:21 +0000 (18:56 +0200)] 
Fix typo in migration guide

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

2 years agoAlways automatically add -DPEDANTIC with enable-ubsan
Tomas Mraz [Fri, 19 Aug 2022 13:48:34 +0000 (15:48 +0200)] 
Always automatically add -DPEDANTIC with enable-ubsan

To avoid reports like: #19028

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

2 years agoFix doc-nits
Todd Short [Mon, 22 Aug 2022 18:12:50 +0000 (14:12 -0400)] 
Fix doc-nits

PR #19031 updated options that that were listed as commands, these
options were already in openssl-list.pod.in, so they are redundant
in openssl.pod.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19044)

2 years agoevp: Use functions instead of direct structure field references
Tianjia Zhang [Mon, 30 Aug 2021 07:34:06 +0000 (15:34 +0800)] 
evp: Use functions instead of direct structure field references

AES and chacha20poly1305 also have some codes that directly reference
the fields in the EVP_CIPHER_CTX structure, such as 'ctx->buf' and
'ctx->encrypt', in order to make the code style uniform, use the
corresponding interface API instead of direct field references.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16465)

2 years agoevp: Simplify ARIA aead cipher definition
Tianjia Zhang [Mon, 30 Aug 2021 06:28:07 +0000 (14:28 +0800)] 
evp: Simplify ARIA aead cipher definition

Remove fixed macro variables, only keep the cipher mode name and
key length.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16465)

2 years agoAdd BSD-armv4 target based on linux-armv4
Piotr Kubaj [Fri, 29 Jul 2022 10:47:29 +0000 (12:47 +0200)] 
Add BSD-armv4 target based on linux-armv4

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

2 years agoClarify dashes are required for openssl list command
Jeff Croxell [Fri, 19 Aug 2022 02:30:20 +0000 (21:30 -0500)] 
Clarify dashes are required for openssl list command

Fixes #19013

CLA: trivial

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

2 years agoUpdate gitignore
Todd Short [Thu, 18 Aug 2022 15:05:43 +0000 (11:05 -0400)] 
Update gitignore

Add test/timing_load_creds

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

2 years agoBIO_sendmmsg/BIO_recvmmsg (API only)
Hugo Landau [Mon, 1 Aug 2022 09:33:00 +0000 (10:33 +0100)] 
BIO_sendmmsg/BIO_recvmmsg (API only)

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

2 years agoLimit the size of various MAXCHUNK definitions
Pauli [Mon, 15 Aug 2022 04:49:17 +0000 (14:49 +1000)] 
Limit the size of various MAXCHUNK definitions

The current code has issues when sizeof(long) <> sizeof(size_t).  The two
types are assumed to be interchangeable and them being different will
cause crashes and endless loops.

This fix limits the maximum chunk size for many of the symmetric ciphers
to 2^30 bytes.  This chunk size limits the amount of data that will
be encrypted/decrypted in one lump.  The code internally handles block
of data later than the chunk limit, so this will present no difference
to the caller.  Any loss of efficiency due to limiting the chunking to
1Gbyte rather than more should be insignificant.

Fixes Coverity issues:
    15084981508500 - 15085051508507 - 15085271508529 - 1508533,
    1508535 - 150853715085391508541 - 15085491508551 - 1508569 &
    1508571 - 1508582.

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

2 years agoCoverity: misuses of time_t
Pauli [Tue, 16 Aug 2022 01:05:02 +0000 (11:05 +1000)] 
Coverity: misuses of time_t

Coverity 1508506:

    Fixes a bug in the cookie code which would have caused problems for
    ten minutes before and after the lower 32 bits of time_t rolled over.

Coverity 1508534 & 1508540:

    Avoid problems when the lower 32 bits of time_t roll over by delaying
    the cast to integer until after the time delta has been computed.

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19004)

2 years agoCheck record layer callbacks are non-null
Matt Caswell [Tue, 9 Aug 2022 14:52:27 +0000 (15:52 +0100)] 
Check record layer callbacks are non-null

The current libssl code always ensures that the callbacks are non-null.
However, the record layer itself wasn't checkthing this. We ensure it does.

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

2 years agoFormatting cleanups
Matt Caswell [Wed, 27 Jul 2022 13:20:23 +0000 (14:20 +0100)] 
Formatting cleanups

Some minor formatting cleanups and other minor tweaks.

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

2 years agoRemove redefinition of macros
Matt Caswell [Wed, 27 Jul 2022 15:44:01 +0000 (16:44 +0100)] 
Remove redefinition of macros

Some macros were redefined in ssl3_cbc.c. We remove the redefinitions

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

2 years agoRemove redefinition of SSL_AD_NO_ALERT
Matt Caswell [Wed, 27 Jul 2022 13:54:48 +0000 (14:54 +0100)] 
Remove redefinition of SSL_AD_NO_ALERT

The SSL_AD_NO_ALERT value was defined in two places. We centralise its
definition.

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

2 years agoEnsure the rrl object is set to NULL after it is freed
Matt Caswell [Wed, 27 Jul 2022 13:52:13 +0000 (14:52 +0100)] 
Ensure the rrl object is set to NULL after it is freed

Once we free the rrl object we should NULL it to prevent a dangling ref
to it. Otherwise we could get a double free.

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

2 years agoRename some functions to be more consistent
Matt Caswell [Wed, 27 Jul 2022 13:50:16 +0000 (14:50 +0100)] 
Rename some functions to be more consistent

Some functions in the record layer were called rlayer_*, but most were
called tls_*. We standardise on the latter.

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

2 years agoRename DTLS1_BITMAP to DTLS_BITMAP
Matt Caswell [Wed, 27 Jul 2022 13:44:28 +0000 (14:44 +0100)] 
Rename DTLS1_BITMAP to DTLS_BITMAP

The 1 in DTLS1 is confusing and is removed. We also tweak the structure
to always be able to track 64 packets regardless of whether we are on a
32 bit or 64 bit system.

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

2 years agoRemove ssl/record/README.md
Matt Caswell [Wed, 27 Jul 2022 13:40:16 +0000 (14:40 +0100)] 
Remove ssl/record/README.md

This file contains design details for the old record layer and is no
longer relevant for the new design.

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

2 years agoStandardise type for epoch
Matt Caswell [Wed, 27 Jul 2022 13:37:27 +0000 (14:37 +0100)] 
Standardise type for epoch

The value for epoch was being represented internally via various types:
uint16_t, unsigned short, unsigned int, unsigned long

We standardise on uint16_t

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

2 years agoRemove the SSL3_RECORD read field
Matt Caswell [Wed, 27 Jul 2022 13:28:36 +0000 (14:28 +0100)] 
Remove the SSL3_RECORD read field

The read field is no longer used and can be safely removed.

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

2 years agoAdd a CHANGES.md entry for the record layer changes
Matt Caswell [Tue, 26 Jul 2022 15:41:55 +0000 (16:41 +0100)] 
Add a CHANGES.md entry for the record layer changes

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

2 years agoClean up some SCTP releated issues
Matt Caswell [Tue, 26 Jul 2022 14:25:03 +0000 (15:25 +0100)] 
Clean up some SCTP releated issues

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

2 years agoEnsure various record layer options can be updated
Matt Caswell [Tue, 26 Jul 2022 13:34:38 +0000 (14:34 +0100)] 
Ensure various record layer options can be updated

We would like the capability for the options/mode/read_ahead settings
to be updateable after the record layer object has been instantiated.

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

2 years agoRemove some redundant code
Matt Caswell [Tue, 26 Jul 2022 11:44:09 +0000 (12:44 +0100)] 
Remove some redundant code

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

2 years agoUpdate the tls13encryptiontest for new read record layer
Matt Caswell [Tue, 26 Jul 2022 11:44:28 +0000 (12:44 +0100)] 
Update the tls13encryptiontest for new read record layer

The tls13encryption is an internal test that reaches inside libssl
to test encryption/decryption of records. It needs to be amended for the
new code structure so that it is testing the equivalent things as before.

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

2 years agoImplement a human readable state function for the record layer
Matt Caswell [Fri, 22 Jul 2022 14:38:26 +0000 (15:38 +0100)] 
Implement a human readable state function for the record layer

This allows querying of the record layer to get a human readable state
string out. This resolves two outstanding TODO comments and enables us
to remove the rstate variable from s->rlayer.

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

2 years agoCorrect some formatting errors in tls1_meth.c
Matt Caswell [Fri, 22 Jul 2022 14:04:07 +0000 (15:04 +0100)] 
Correct some formatting errors in tls1_meth.c

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

2 years agoMove SSL_MODE_RELEASE_BUFFERS into the read record layer
Matt Caswell [Fri, 22 Jul 2022 13:30:53 +0000 (14:30 +0100)] 
Move SSL_MODE_RELEASE_BUFFERS into the read record layer

This resolves an outstanding "TODO" item.

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

2 years agoRemove a redundant TODO
Matt Caswell [Fri, 22 Jul 2022 13:23:25 +0000 (14:23 +0100)] 
Remove a redundant TODO

If read_ahead data is left over when a record layer closes down, there is
already code present to push into the "next" BIO. So the TODO removed here
is no longer relevant.

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

2 years agoCleanse the SSLv3 MAC secret when we clean up the read record layer
Matt Caswell [Fri, 22 Jul 2022 13:16:33 +0000 (14:16 +0100)] 
Cleanse the SSLv3 MAC secret when we clean up the read record layer

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

2 years agoMove some fields out of the SSL object and into the record layer object
Matt Caswell [Fri, 22 Jul 2022 11:39:24 +0000 (12:39 +0100)] 
Move some fields out of the SSL object and into the record layer object

Fields such as rrlmethod and rrl are entirely related to the record layer,
and so should be in that object.

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

2 years agoRemove an unnecessary setup of the read buffer
Matt Caswell [Thu, 21 Jul 2022 16:17:05 +0000 (17:17 +0100)] 
Remove an unnecessary setup of the read buffer

Now everything has been moved to the record layer the additional check
for setting up the read buffer is not needed and can be removed.

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

2 years agoClear away some unused fields and cruft in the record layer
Matt Caswell [Thu, 21 Jul 2022 16:01:54 +0000 (17:01 +0100)] 
Clear away some unused fields and cruft in the record layer

Now that the read record layer has moved to the new architecture we can
clear some of the old stuff away.

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

2 years agoRemove some references to rlayer.rstate
Matt Caswell [Thu, 21 Jul 2022 14:39:39 +0000 (15:39 +0100)] 
Remove some references to rlayer.rstate

This also fixes ssl3_pending while we are at it

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

2 years agoEnsure we use a dgram mem BIO for the DTLS record layer
Matt Caswell [Thu, 21 Jul 2022 14:13:46 +0000 (15:13 +0100)] 
Ensure we use a dgram mem BIO for the DTLS record layer

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

2 years agoRemove some more redundant TODO(RECLAYER) comments
Matt Caswell [Wed, 20 Jul 2022 14:22:41 +0000 (15:22 +0100)] 
Remove some more redundant TODO(RECLAYER) comments

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

2 years agoResolve a TODO(RECLAYER) in the SSLv3 code
Matt Caswell [Wed, 20 Jul 2022 14:15:32 +0000 (15:15 +0100)] 
Resolve a TODO(RECLAYER) in the SSLv3 code

We remove some code outside of the record layer which is no longer
relevant since its functions are now performed by the new record layer
code. This removes a TODO(RECLAYER) as a result.

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

2 years agoRemove some TODO(RECLAYER) comments
Matt Caswell [Wed, 20 Jul 2022 13:49:53 +0000 (14:49 +0100)] 
Remove some TODO(RECLAYER) comments

Some TODO(RECLAYER) comments are no longer necessary and can be removed.

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

2 years agoRemove some unnecessary function pointers from OSSL_RECORD_METHOD
Matt Caswell [Tue, 19 Jul 2022 14:49:51 +0000 (15:49 +0100)] 
Remove some unnecessary function pointers from OSSL_RECORD_METHOD

We had some temporary function pointers in OSSL_RECORD_METHOD which were
only necessary during the process of refactoring the read record layer.
These are no longer required so can be removed.

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

2 years agoStandardise some DTLS record layer naming
Matt Caswell [Mon, 27 Jun 2022 16:10:59 +0000 (17:10 +0100)] 
Standardise some DTLS record layer naming

Remove references to dtls1_* and just use dtls_*

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

2 years agoRemove some remaining SSL object references from DTLS record layer
Matt Caswell [Fri, 24 Jun 2022 15:45:14 +0000 (16:45 +0100)] 
Remove some remaining SSL object references from DTLS record layer

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

2 years agoPush unprocessed DTLS records from one record layer object to next
Matt Caswell [Fri, 24 Jun 2022 15:32:06 +0000 (16:32 +0100)] 
Push unprocessed DTLS records from one record layer object to next

We add unprocessed DTLS records to the unprocessed record queue. When
the record layer closes down we write the unprocessed records to the
next record layer object.

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

2 years agoRemove reliance on the SSL object from the DTLS read record layer code
Matt Caswell [Wed, 8 Jun 2022 13:52:44 +0000 (14:52 +0100)] 
Remove reliance on the SSL object from the DTLS read record layer code

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

2 years agoMove some DTLS read code into the read record layer
Matt Caswell [Thu, 2 Jun 2022 15:29:04 +0000 (16:29 +0100)] 
Move some DTLS read code into the read record layer

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

2 years agoRemove some final references to the SSL object in the record layer
Matt Caswell [Wed, 25 May 2022 16:30:33 +0000 (17:30 +0100)] 
Remove some final references to the SSL object in the record layer

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

2 years agoRemove the separation betweeen enc_read_ctx and enc_write_ctx
Matt Caswell [Wed, 25 May 2022 16:19:33 +0000 (17:19 +0100)] 
Remove the separation betweeen enc_read_ctx and enc_write_ctx

Similarly with read_hash and write_hash. In the new model we have a
separate record layer object for reading and writing. Therefore we don't
need to distinguish between reading and writing inside the record layer
object in the encryption and md ctxs.

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

2 years agoEnable the record layer to call the ssl_security callback
Matt Caswell [Wed, 25 May 2022 16:10:38 +0000 (17:10 +0100)] 
Enable the record layer to call the ssl_security callback

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

2 years agoUse a record layer specific message callback
Matt Caswell [Wed, 25 May 2022 15:41:30 +0000 (16:41 +0100)] 
Use a record layer specific message callback

Don't use the message callback from the SSL object. Instead we use a
wrapper callback so that the record layer does not need to be aware of 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/18132)

2 years agoMove early data counting out of the SSL object and into the record layer
Matt Caswell [Wed, 25 May 2022 14:16:48 +0000 (15:16 +0100)] 
Move early data counting out of the SSL object and into the record layer

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

2 years agoMove the sequence number into the OSSL_RECORD_LAYER object
Matt Caswell [Tue, 24 May 2022 15:00:50 +0000 (16:00 +0100)] 
Move the sequence number into the OSSL_RECORD_LAYER object

This removes some references to the SSL object from the record layer.

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

2 years agoRemove use of SSL object for fragment length checking in record layer
Matt Caswell [Mon, 23 May 2022 10:31:53 +0000 (11:31 +0100)] 
Remove use of SSL object for fragment length checking in record layer

Pass the max fragment length to the record layer when it is applicable
to avoid the need to go through 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/18132)

2 years agoRemove use of ossl_statem_in_error() from the record layer
Matt Caswell [Fri, 20 May 2022 15:58:51 +0000 (16:58 +0100)] 
Remove use of ossl_statem_in_error() from the record layer

We remove the dependency on the SSL object. Instead we check if the
record layer has already set an alert code.

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

2 years agoMake the record layer directly aware of EtM
Matt Caswell [Fri, 20 May 2022 15:54:12 +0000 (16:54 +0100)] 
Make the record layer directly aware of EtM

We no longer have to go through the SSL object to discover whether EtM has
been negotiated.

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

2 years agoRemove SSL_USE_EXPLICT_IV() from the record layer methods
Matt Caswell [Thu, 19 May 2022 16:11:13 +0000 (17:11 +0100)] 
Remove SSL_USE_EXPLICT_IV() from the record layer methods

Instead we introduce RLAYER_USE_EXPLICIT_IV(). This removes a dependency
on 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/18132)

2 years agoRemove some use of SSL object from record layer
Matt Caswell [Thu, 19 May 2022 15:58:45 +0000 (16:58 +0100)] 
Remove some use of SSL object from record layer

Remove SSL_IS_TLS13() and hello_retry_request

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

2 years agoUpdate the oqs-provider submodule to a more recent commit
Matt Caswell [Thu, 19 May 2022 14:49:32 +0000 (15:49 +0100)] 
Update the oqs-provider submodule to a more recent commit

Also update the oqsprovider.sh file to not run the preptests.sh script
which is no longer required

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

2 years agoDisallow SSL2_VERSION record version in an SSLv3 record header
Matt Caswell [Wed, 18 May 2022 14:26:04 +0000 (15:26 +0100)] 
Disallow SSL2_VERSION record version in an SSLv3 record header

When validate_record_header() gets called it should be able to rely on
the fact that an SSLv2 record version means that the record was received in
SSLv2 format.

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

2 years agoFix some no-comp compilation failures
Matt Caswell [Wed, 18 May 2022 13:30:24 +0000 (14:30 +0100)] 
Fix some no-comp compilation failures

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

2 years agoAdd support for moving data from one epoch to the next
Matt Caswell [Tue, 17 May 2022 15:16:40 +0000 (16:16 +0100)] 
Add support for moving data from one epoch to the next

Sometimes data read by a record layer in one epoch is actually intended for
the next epoch. For example in a TLS with read_ahead, the read_ahead data
could contain a KeyUpdate message followed by application data encrypted
with new keys. Therefore we implement a mechanism for passing this data
across the epochs.

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

2 years agoAdd a test for read_ahead data crossing a key change
Matt Caswell [Tue, 17 May 2022 13:36:39 +0000 (14:36 +0100)] 
Add a test for read_ahead data crossing a key change

If read_ahead is switched on, it should still work even if the data that
is read cross epochs.

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

2 years agoRemove unneccesary KTLS code from non-KTLS specific files
Matt Caswell [Thu, 12 May 2022 16:21:25 +0000 (17:21 +0100)] 
Remove unneccesary KTLS code from non-KTLS specific files

This also moves other protocol specific code to 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/18132)

2 years agoMove ktls.c into the record layer
Matt Caswell [Thu, 12 May 2022 16:00:59 +0000 (17:00 +0100)] 
Move ktls.c into the record layer

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

2 years agoDistinguish between fatal and non-fatal errors when creating a record layer
Matt Caswell [Thu, 12 May 2022 15:35:52 +0000 (16:35 +0100)] 
Distinguish between fatal and non-fatal errors when creating a record layer

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

2 years agoImplement KTLS in the new read record layer code
Matt Caswell [Tue, 10 May 2022 17:50:00 +0000 (18:50 +0100)] 
Implement KTLS in the new read record layer code

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

2 years agoMove protocol version specific code into separate files
Matt Caswell [Mon, 9 May 2022 11:00:54 +0000 (12:00 +0100)] 
Move protocol version specific code into separate files

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

2 years agoEnsure various SSL options are passed down to the record layer
Matt Caswell [Fri, 6 May 2022 14:10:00 +0000 (15:10 +0100)] 
Ensure various SSL options are passed down to the record layer

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

2 years agoConvert TLSv1.3 code to use the new read side record layer
Matt Caswell [Fri, 29 Apr 2022 16:13:23 +0000 (17:13 +0100)] 
Convert TLSv1.3 code to use the new read side record layer

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

2 years agoConvert SSLv3 code to use the new read side record layer
Matt Caswell [Thu, 28 Apr 2022 15:57:07 +0000 (16:57 +0100)] 
Convert SSLv3 code to use the new read side record layer

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

2 years agoMove Record layer methods code into a sub-directory
Matt Caswell [Tue, 19 Apr 2022 16:15:54 +0000 (17:15 +0100)] 
Move Record layer methods code into a sub-directory

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

2 years agoMove the TLS1.0/1.1/1.2 record crypto code into the new record layer
Matt Caswell [Mon, 18 Apr 2022 07:57:32 +0000 (08:57 +0100)] 
Move the TLS1.0/1.1/1.2 record crypto code into the new record layer

Only done for the read side so far. Still need to do TLS1.3 and SSL3.0.
Also need to separate out KTLS.

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

2 years agoConvert ssl3_get_record to tls_read_record
Matt Caswell [Tue, 12 Apr 2022 13:50:28 +0000 (14:50 +0100)] 
Convert ssl3_get_record to tls_read_record

We move the old ssl3_get_record function to conform with the new record
layer design.

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

2 years agoAdd a DTLSv1_listen() test
Matt Caswell [Mon, 11 Apr 2022 13:37:16 +0000 (14:37 +0100)] 
Add a DTLSv1_listen() test

Add a test to ensure that a connection started via DTLSv1_listen() can
be completed through to handshake success. Previous DTLSv1_listen()
testing only tested the function itself and did not confirm that a
connection can actually be achieved using it.

This is important to test some codepaths being affected by the record layer
refactor.

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

2 years agoTransfer the functionality from ssl3_read_n to the new record layer
Matt Caswell [Thu, 7 Apr 2022 16:35:36 +0000 (17:35 +0100)] 
Transfer the functionality from ssl3_read_n to the new record layer

This transfers the low level function ssl3_read_n to the new record layer.
We temporarily make the read_n function a top level record layer function.
Eventually, in later commits in this refactor, we will remove it as a top
level function and it will just be called from read_record.

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

2 years agoMake settings and options parameters const in recordmethod.h
Matt Caswell [Thu, 7 Apr 2022 16:35:08 +0000 (17:35 +0100)] 
Make settings and options parameters const in recordmethod.h

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

2 years agoAdd a skeleton TLS record method
Matt Caswell [Thu, 7 Apr 2022 13:09:25 +0000 (14:09 +0100)] 
Add a skeleton TLS record method

It doesn't yet do anything. This is a placeholder which will be filled in
by susbsequent commits.

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

2 years agoFix compilation issues in the imported recordmethod.h
Matt Caswell [Thu, 7 Apr 2022 11:38:13 +0000 (12:38 +0100)] 
Fix compilation issues in the imported recordmethod.h

Also, rename the "new" function pointer to "new_record_layer" to avoid a
C++ reserved name

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

2 years agoAdd the recordmethod header from the draft design
Matt Caswell [Thu, 7 Apr 2022 11:30:30 +0000 (12:30 +0100)] 
Add the recordmethod header from the draft design

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

2 years agoUpdate session timeout code with OSSL_TIME
Todd Short [Thu, 11 Aug 2022 13:58:52 +0000 (09:58 -0400)] 
Update session timeout code with OSSL_TIME

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

2 years agoAdd some documentation for X509_gmtime_adj()
Matt Caswell [Wed, 10 Aug 2022 08:53:12 +0000 (09:53 +0100)] 
Add some documentation for X509_gmtime_adj()

Other very similar functions were documented, but this one was missing.

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

2 years agoAdd CODE-OF-CONDUCT.md
Dr. Matthias St. Pierre [Mon, 15 Aug 2022 13:01:11 +0000 (15:01 +0200)] 
Add CODE-OF-CONDUCT.md

Fixes #18820

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

2 years agocms: Create test for for purpose verification in cms application
Lutz Jaenicke [Wed, 15 Jun 2022 17:01:43 +0000 (19:01 +0200)] 
cms: Create test for for purpose verification in cms application

The tests only cover the correct handling of the codesigning purpose in the certificates
in the context of the cms command line tool.
The interpretation of the certificate purpose is tested in the context of the "verify"
app. The correct handling of the cms objects is tested by other tests in 80-test_cms.t.

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

2 years agoX509: add tests for purpose code signing in verify application
Lutz Jaenicke [Wed, 15 Jun 2022 15:31:19 +0000 (17:31 +0200)] 
X509: add tests for purpose code signing in verify application

Correct configuration according to CA Browser forum:
  KU: critical,digitalSignature
  XKU: codeSiging

Note: I did not find any other document formally defining the requirements
for code signing certificates.

Some combinations are explicitly forbidden, some flags can be ignored

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

2 years agoX509: Add "code sign" as purpose for verification of certificates
Lutz Jaenicke [Thu, 14 Oct 2021 13:24:18 +0000 (15:24 +0200)] 
X509: Add "code sign" as purpose for verification of certificates

Code signing certificates have other properties as for example described in
CA Browser Forum documents. This leads to "unsupported certificate purpose" errors when
verifying signed objects.
This patch adds the purpose "codesign" to the table in X.509 certificate verification and
the verification parameter "code_sign" to X509_VERIFY_PARAM.

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

2 years agocrypto/x509/x509_vpm.c: update format of X509_VERIFY_PARAM default_table
Lutz Jaenicke [Wed, 15 Jun 2022 12:25:54 +0000 (14:25 +0200)] 
crypto/x509/x509_vpm.c: update format of X509_VERIFY_PARAM default_table

Put "}," on separate lines as suggested in PR #18567

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

2 years agoClarify documentation in regards to EC key parameters
Tomas Mraz [Thu, 28 Jul 2022 13:45:02 +0000 (15:45 +0200)] 
Clarify documentation in regards to EC key parameters

Also clarify that EVP_PKEY_fromdata ignores parameters that
are unknown or incorrect for given selection.

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

2 years agoAdd testcases for EVP_PKEY_get1_encoded_public_key
Tomas Mraz [Thu, 28 Jul 2022 12:13:06 +0000 (14:13 +0200)] 
Add testcases for EVP_PKEY_get1_encoded_public_key

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