openssl.git
13 months agoImprove the performance of d2i_AutoPrivateKey and friends
Matt Caswell [Wed, 1 Mar 2023 17:03:48 +0000 (17:03 +0000)]
Improve the performance of d2i_AutoPrivateKey and friends

Probe first to see if we have a PKCS8 file to improve decoder performance.

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

13 months agoDocument remaining obsolete SSL_OP_NETSCAPE_*_BUG
Tobias Nießen [Mon, 6 Mar 2023 22:51:17 +0000 (22:51 +0000)]
Document remaining obsolete SSL_OP_NETSCAPE_*_BUG

SSL_OP_NETSCAPE_CA_DN_BUG became obsolete in 3c33c6f6b1086435 and
support for SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG was removed by
7a4dadc3a6a487db. The definitions are still listed under "OBSOLETE
OPTIONS retained for compatibility" in ssl.h.in, so this commit adds
them to the list of obsolete options in doc/man3.

Refs: https://github.com/nodejs/node/pull/46954

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

13 months agoAdd missing assignment to EVP_get_digestbynid()
ndossche [Tue, 7 Mar 2023 12:27:15 +0000 (13:27 +0100)]
Add missing assignment to EVP_get_digestbynid()

The assignment of the result of EVP_get_digestbynid() did not happen
which made the fallback not actually perform the fallback.

CLA: trivial

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

13 months agodoc/man3/X509_STORE_CTX_get_error.pod: make order consistent, add some missing entries
Dr. David von Oheimb [Mon, 27 Feb 2023 18:22:33 +0000 (19:22 +0100)]
doc/man3/X509_STORE_CTX_get_error.pod: make order consistent, add some missing entries

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

13 months agoSegmentation fault in parent rng cleanup
afshinpir [Wed, 8 Mar 2023 03:42:00 +0000 (16:42 +1300)]
Segmentation fault in parent rng cleanup

CLA: trivial
When `cleanup_entropy()` is called to cleanup parent by calling
provided `OSSL_FUNC_rand_clear_seed_fn` method, incorrect random
context is passed to the method. So accessing that context creates
a segmentation fault. Parent context should be passed rather than
DRBG's own context.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20454)

13 months agoUpdated `rsa_has()` for correct validation
afshinpir [Wed, 8 Mar 2023 07:31:54 +0000 (20:31 +1300)]
Updated `rsa_has()` for correct validation

CLA: trivial
In RSA, `(n,e)` and `(n,d)` identify public key and private key.
Modulus `n` is the common part. So I updated `rsa_has()` to validate
these pairs correctly. `OSSL_KEYMGMT_SELECT_KEYPAIR` is common part
for both public and private key, so I changed it to check `n` of
RSA and for `OSSL_KEYMGMT_SELECT_PUBLIC_KEY`, `e` is checked. Before
this change, if `selection` was `OSSL_KEYMGMT_SELECT_PRIVATE_KEY` and
only `e` and `d` was in the RSA structure, the function returns 1
while it was incorrect.

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

13 months agoFix size_t/int mismatch in cms_ec.c and rsa_sig.c
Tomas Mraz [Wed, 8 Mar 2023 10:17:31 +0000 (11:17 +0100)]
Fix size_t/int mismatch in cms_ec.c and rsa_sig.c

Fixes #20435

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

13 months agoaes/asm/bsaes-armv7.pl: Replace adrl with add
Kornel Dulęba [Wed, 8 Mar 2023 10:28:41 +0000 (11:28 +0100)]
aes/asm/bsaes-armv7.pl: Replace adrl with add

"adrl" is a pseudo-instruction used to calculate an address relative
to PC. It's not recognized by clang resulting in a compilation error.
I've stumbled upon it when trying to integrate the bsaes-armv7 assmebly
logic into FreeBSD kernel, which uses clang as it's default compiler.
Note that this affect the build only if BSAES_ASM_EXTENDED_KEY is
defined, which is not the default option in OpenSSL.

The solution here is to replace it with an add instruction.
This mimics what has already been done in !BSAES_ASM_EXTENDED_KEY logic.
Because of that I've marked this as trivial CLA.

CLA: trivial
Signed-off-by: Kornel Dulęba <mindal@semihalf.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20458)

13 months agoRemove duplicate code
zhangzhilei [Sun, 12 Mar 2023 07:39:34 +0000 (15:39 +0800)]
Remove duplicate code

since this code is also under GCM_HW_SET_KEY_CTR_FN macro

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

13 months agoAdd missing copyright header
Pauli [Wed, 8 Mar 2023 22:59:25 +0000 (09:59 +1100)]
Add missing copyright header

This file was only recently introduced and the missing header slipped through
the review process.

Fixes #20461

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

13 months agodoc: document that prediction resistance comes with a hidden cost
Pauli [Tue, 7 Mar 2023 23:09:11 +0000 (10:09 +1100)]
doc: document that prediction resistance comes with a hidden cost

In the default setup, using prediction resistance cascades to a reseeding
of all DRBGs.  The cost for this will be excessive for highly threaded
applications.

Fixes #20414

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

13 months agoapps/x509 etc.: allow private key input when public key is expected
Dr. David von Oheimb [Fri, 26 Aug 2022 18:40:48 +0000 (20:40 +0200)]
apps/x509 etc.: allow private key input when public key is expected

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

13 months agotest/smime-certs/{mksmime-certs.sh,ca.cnf}: simplify and speed up cert generation
Dr. David von Oheimb [Thu, 25 Aug 2022 16:09:09 +0000 (18:09 +0200)]
test/smime-certs/{mksmime-certs.sh,ca.cnf}: simplify and speed up cert generation

Also remove inconsistent key usages from non-RSA certs.

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

13 months agoapps/{dsa,ec,rsa,pkey}.c: harmonize coding w.r.t. 'pubin' variable
Dr. David von Oheimb [Sat, 24 Sep 2022 11:44:47 +0000 (13:44 +0200)]
apps/{dsa,ec,rsa,pkey}.c: harmonize coding w.r.t. 'pubin' variable

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

13 months agoFix how util/wrap.pl is used in OpenSSL::Util::fixup_cmd()
Richard Levitte [Mon, 6 Mar 2023 07:49:08 +0000 (08:49 +0100)]
Fix how util/wrap.pl is used in OpenSSL::Util::fixup_cmd()

The mechanism was pretty tentative and wasn't well tested for diverse
situations.

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

13 months agoFix util/wrap.pl.in for VMS usage
Richard Levitte [Wed, 1 Mar 2023 15:27:50 +0000 (16:27 +0100)]
Fix util/wrap.pl.in for VMS usage

In the name of consistency, make sure that this same script is used
across more platforms, in this case VMS.  This removes the need for
util/local_shlib.com.in and util/unlocal_shlib.com.in, which were
under-used anyway.

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

13 months agoRun the punycode-test over the fuzz corpora during test.
Kurt Roeckx [Wed, 8 Feb 2023 17:48:30 +0000 (18:48 +0100)]
Run the punycode-test over the fuzz corpora during test.

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

13 months agofips: Use salt >= 16 bytes in PBKDF2 selftest
Clemens Lang [Fri, 3 Mar 2023 11:22:03 +0000 (12:22 +0100)]
fips: Use salt >= 16 bytes in PBKDF2 selftest

NIST SP 800-132 [1] section 5.1 says "[t]he length of the
randomly-generated portion of the salt shall be at least
128 bits", which implies that the salt for PBKDF2 must be at least 16
bytes long (see also Appendix A.2.1).

The FIPS 140-3 IG [2] section 10.3.A requires that "the lengths and the
properties of the Password and Salt parameters, as well as the desired
length of the Master Key used in a CAST shall be among those supported
by the module in the approved mode."

As a consequence, the salt length in the self test must be at least 16
bytes long for FIPS 140-3 compliance. Switch the self test to use the
only test vector from RFC 6070 that uses salt that is long enough to
fulfil this requirement. Since RFC 6070 does not provide expected
results for PBKDF2 with HMAC-SHA256, use the output from [3], which was
generated with python cryptography, which was tested against the RFC
6070 vectors with HMAC-SHA1.

 [1]: https://doi.org/10.6028/NIST.SP.800-132
 [2]: https://csrc.nist.gov/CSRC/media/Projects/cryptographic-module-validation-program/documents/fips%20140-3/FIPS%20140-3%20IG.pdf
 [3]: https://github.com/brycx/Test-Vector-Generation/blob/master/PBKDF2/pbkdf2-hmac-sha2-test-vectors.md

Signed-off-by: Clemens Lang <cllang@redhat.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20429)

13 months agoAdd option to FIPS module to enforce EMS check during KDF TLS1_PRF.
slontis [Wed, 8 Feb 2023 07:22:43 +0000 (17:22 +1000)]
Add option to FIPS module to enforce EMS check during KDF TLS1_PRF.

Fixes #19989

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

13 months agoS390X: Accelerate keccak XOF
Juergen Christ [Fri, 3 Mar 2023 13:36:08 +0000 (14:36 +0100)]
S390X: Accelerate keccak XOF

The keccak XOF used for KMAC can be simplified by using klmd.  This speeds up
XOF processing in cases where more than one result block is needed.

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

13 months agotest//bio_dgram_test.c: Skip test when BIO_bind() fails
Richard Levitte [Tue, 7 Mar 2023 14:21:16 +0000 (15:21 +0100)]
test//bio_dgram_test.c: Skip test when BIO_bind() fails

This test isn't supposed to test BIO_bind() itself, so we can be a bit
sloppy and assume that it fails because the attempted binding is not
supported on the platform where this is run.  For example, BIO_bind()
fails when it's given an IPv6 address and the platform where this is
run doesn't support that address family.

In a case like this, it's sensible enough to simply skip the test when
BIO_bind() fails.

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

13 months agobss_dgram.c: Use BIO_ADDR_sockaddr() and BIO_ADDR_sockaddr_size()
Richard Levitte [Tue, 7 Mar 2023 14:18:18 +0000 (15:18 +0100)]
bss_dgram.c: Use BIO_ADDR_sockaddr() and BIO_ADDR_sockaddr_size()

Especially, it's important to use BIO_ADDR_sockaddr_size() instead of
taking sizeof(addr), as BIO_ADDR is a union of several sockaddr variants
with different sizes, and some sendto() implementations are very picky
that the size is correct for the indicated sockaddr family.

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

13 months agoDOCS: provider-keymgmt(7) - params for EVP_PKEY_get_default_digest_{name,nid}()
Richard Levitte [Fri, 3 Mar 2023 13:18:43 +0000 (14:18 +0100)]
DOCS: provider-keymgmt(7) - params for EVP_PKEY_get_default_digest_{name,nid}()

This describes them in detail in provider-keymgmt(7).

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

13 months agostream_frame_new(): Add missing allocation check
Tomas Mraz [Wed, 1 Mar 2023 09:28:58 +0000 (10:28 +0100)]
stream_frame_new(): Add missing allocation check

Reported by Marc Schönefeld.

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

13 months agotest_rstream_random(): Test adding final empty frame
Tomas Mraz [Tue, 28 Feb 2023 19:25:53 +0000 (20:25 +0100)]
test_rstream_random(): Test adding final empty frame

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

13 months agoTest new ossl_quic_rstream API calls
Tomas Mraz [Mon, 5 Dec 2022 19:52:14 +0000 (20:52 +0100)]
Test new ossl_quic_rstream API calls

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

13 months agoImprove the QUIC_RSTREAM implementation
Tomas Mraz [Wed, 30 Nov 2022 18:30:30 +0000 (19:30 +0100)]
Improve the QUIC_RSTREAM implementation

Add API calls to avoid copying data when reading
These are ossl_quic_rstream_get_record() and
ossl_quic_rstream_release_record().

Add side storage for the stream frame data.
When there are too many packets referenced by the
receiving stream the function ossl_quic_rstream_move_to_rbuf()
can be called to move the data to a ring buffer.

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

13 months agoVMS knows POSIX threads too!
Richard Levitte [Mon, 6 Mar 2023 07:55:34 +0000 (08:55 +0100)]
VMS knows POSIX threads too!

include/internal/thread_arch.h didn't indicate this, now it does.

This also removes ossl_crypto_mem_barrier(), because we isn't used
anywhere, and doesn't build with compilers that don't support the GNU
extension __asm__.

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

13 months agoImprove the performance of EVP_PKCS82PKEY_ex
Matt Caswell [Wed, 1 Mar 2023 11:14:25 +0000 (11:14 +0000)]
Improve the performance of EVP_PKCS82PKEY_ex

We can easily find out the keytype which should significantly improve
the performance of this function because we don't have to try every loaded
decoder.

Partial fix for #20399

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

13 months agoTest that there are no errors on the stack for rejected early data
Matt Caswell [Mon, 27 Feb 2023 18:38:03 +0000 (18:38 +0000)]
Test that there are no errors on the stack for rejected early data

If we reject early data then it is normal for decryption operations to
fail. We should ensure there are no spurious errors on the stack in that
case. This adds a test for that scenario.

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

13 months agoRemove spurious error queue entries on early data
Matt Caswell [Mon, 27 Feb 2023 18:43:20 +0000 (18:43 +0000)]
Remove spurious error queue entries on early data

Early data decryption is expected to fail sometimes. If it does we should
not leave spurious error entries on the queue.

Fixes #20377

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

13 months agoFix cast.
Pauli [Thu, 2 Mar 2023 23:14:39 +0000 (10:14 +1100)]
Fix cast.

Fixes #20424

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

13 months agoAdd "make help" option
Todd Short [Tue, 28 Feb 2023 23:42:56 +0000 (18:42 -0500)]
Add "make help" option

Based on kubernetes controller Makefile help.

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

13 months agoFix typo in base provider example code
HansHoogerwerf [Wed, 1 Mar 2023 09:02:37 +0000 (10:02 +0100)]
Fix typo in base provider example code

CLA: trivial

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

13 months agoTidy up aarch64 feature detection code in armcap.c
Tom Cosgrove [Sun, 12 Feb 2023 20:26:23 +0000 (20:26 +0000)]
Tidy up aarch64 feature detection code in armcap.c

Make the SIGILL-based code easier to read, and don't use it on Apple Silicon.

Also fix "error: 'HWCAP(2)_*' macro redefined" warnings on FreeBSD.

Fixes #20188

Change-Id: I5618bbe9444cc40cb5705c6ccbdc331c16bab794

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

13 months agoCoverity 1521557: Error handling issues
Pauli [Wed, 1 Mar 2023 01:22:49 +0000 (12:22 +1100)]
Coverity 1521557: Error handling issues

Check the return from DSA_set0_key and generate an error on failure.
Technically a false positive since the function always returns success.

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

13 months agoInclude supported branches in coveralls
Pauli [Mon, 27 Feb 2023 00:05:48 +0000 (11:05 +1100)]
Include supported branches in coveralls

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

13 months agoBump coverallsapp/github-action from 1.2.3 to 1.2.4
dependabot[bot] [Wed, 1 Mar 2023 18:10:31 +0000 (18:10 +0000)]
Bump coverallsapp/github-action from 1.2.3 to 1.2.4

Bumps [coverallsapp/github-action](https://github.com/coverallsapp/github-action) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/coverallsapp/github-action/releases)
- [Commits](https://github.com/coverallsapp/github-action/compare/v1.2.3...v1.2.4)

---
updated-dependencies:
- dependency-name: coverallsapp/github-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
CLA: trivial

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

13 months agoBump coverallsapp/github-action from 1.1.3 to 1.2.3
dependabot[bot] [Wed, 1 Mar 2023 09:35:19 +0000 (09:35 +0000)]
Bump coverallsapp/github-action from 1.1.3 to 1.2.3

Bumps [coverallsapp/github-action](https://github.com/coverallsapp/github-action) from 1.1.3 to 1.2.3.
- [Release notes](https://github.com/coverallsapp/github-action/releases)
- [Commits](https://github.com/coverallsapp/github-action/compare/1.1.3...v1.2.3)

---
updated-dependencies:
- dependency-name: coverallsapp/github-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
CLA: trivial

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

13 months agoAdd fuzz test for v3name
Hardik Shah [Mon, 13 Feb 2023 02:49:23 +0000 (08:19 +0530)]
Add fuzz test for v3name

v3name_fuzzer build modifications

create 99-test_fuzz_v3name_fuzzer.t

test corpus for cve-2023-0286

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20274)

13 months agoRemove ossl_rsa_pss_params_30_set_maskgenalg().
slontis [Fri, 17 Feb 2023 03:00:12 +0000 (13:00 +1000)]
Remove ossl_rsa_pss_params_30_set_maskgenalg().

This is an unused internal function. It should be added back
in if there is a need to set this value to something other than
NID_mgf1 (which is not likely).

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

13 months agoUpdate AES documentation excluding AES SIV from the FIPS provider
Pauli [Mon, 27 Feb 2023 08:31:58 +0000 (19:31 +1100)]
Update AES documentation excluding AES SIV from the FIPS provider

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

13 months agoRemove AES SIV ciphers from the FIPS provider
Pauli [Mon, 27 Feb 2023 08:20:53 +0000 (19:20 +1100)]
Remove AES SIV ciphers from the FIPS provider

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

13 months agoDon't do AES SIV tests with the FIPS provider
Pauli [Mon, 27 Feb 2023 08:29:58 +0000 (19:29 +1100)]
Don't do AES SIV tests with the FIPS provider

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

13 months agoEnsure we use a non-zero time for tickets in early data
Matt Caswell [Mon, 27 Feb 2023 11:54:29 +0000 (11:54 +0000)]
Ensure we use a non-zero time for tickets in early data

Our tests run so quickly that the ticket age is virtually zero. This may
not show up problems in the age calculations, so we artificially add some
age to the tickets in some runs.

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

13 months agoFix early_data age calculation
Matt Caswell [Mon, 27 Feb 2023 11:18:26 +0000 (11:18 +0000)]
Fix early_data age calculation

The ticket_age/age_add values use ms granualarity. We were incorrectly
treating them as seconds and so the ticket was always being rejected for
early data. We also clarify a comment which could have been the source of
the confusion.

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

13 months agoFix FFC mdprop setting bugs.
slontis [Mon, 27 Feb 2023 06:35:41 +0000 (16:35 +1000)]
Fix FFC mdprop setting bugs.

Coverage testing showed that ossl_ffc_params_fromdata() was not setting
OSSL_PKEY_PARAM_FFC_DIGEST_PROPS.
Adding a negative test also showed that ossl_ffc_params_copy() did not
do a shallow copy of the digest or digest property.

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

13 months agoFix potential infinite loops in ECDSA signing.
slontis [Mon, 27 Feb 2023 03:53:25 +0000 (13:53 +1000)]
Fix potential infinite loops in ECDSA signing.

Similiar checks to the DSA code have been added for ECDSA also.
This should not be a problem when using named groups.

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

13 months agoFix infinite loops in DSA sign code.
slontis [Mon, 27 Feb 2023 03:48:24 +0000 (13:48 +1000)]
Fix infinite loops in DSA sign code.

Fixes #20268

Values such as q=1 or priv=0 caused infinite loops when calling
DSA_sign() without these changes.

There are other cases where bad domain parameters may have caused
infinite loops where the retry counter has been added. The simpler case
of priv=0 also hits this case. q=1 caused an infinite loop in the setup.

The max retry value has been set to an arbitrary value of 8 (it is
unlikely to ever do a single retry for valid values).

The minimum q bits was set to an arbitrary value of 128 (160 is still
used for legacy reasons when using 512 bit keys).

Thanks @guidovranken for detecting this, and @davidben for his
insightful analysis.

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

13 months agoec: Use .machine "any" explicitly in ecp_nistp521-ppc64
Robin Lee [Sun, 26 Feb 2023 05:56:14 +0000 (13:56 +0800)]
ec: Use .machine "any" explicitly in ecp_nistp521-ppc64

Since GCC commit e154242724b084380e3221df7c08fcdbd8460674 the flag "-many"
is sometimes not passed to the assembler. Use .machine "any" just like
ecp_nistz256-ppc64 to prevent compile errors when built with some
configurations of GCC.

CLA: trivial

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

13 months agoUpdate FIPS provider documentation to note that fips=yes is mandatory
Pauli [Sun, 26 Feb 2023 23:14:43 +0000 (10:14 +1100)]
Update FIPS provider documentation to note that fips=yes is mandatory

This was in the notes section but an earlier comment about it not being
mandatory was missed.

Fixes #20376

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/20382)

13 months agoFix incomplete error check on RSA_public_decrypt()
ndossche [Thu, 9 Feb 2023 08:49:47 +0000 (09:49 +0100)]
Fix incomplete error check on RSA_public_decrypt()

According to the documentation and my analysis tool RSA_public_decrypt()
can return -1 on error, but this is not checked. Fix it by changing the
error condition.

CLA: trivial

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

13 months agoFix incomplete error check on ASN1_item_i2d()
ndossche [Thu, 9 Feb 2023 10:39:58 +0000 (11:39 +0100)]
Fix incomplete error check on ASN1_item_i2d()

According to the documentation and my analysis tool
ASN1_item_i2d() can return a negative value on error,
but this is not checked. Fix it by changing the error check condition.

CLA: trivial

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

13 months agoDocument the list of RAND algorithms in the default and fips providers.
slontis [Wed, 22 Feb 2023 23:09:57 +0000 (09:09 +1000)]
Document the list of RAND algorithms in the default and fips providers.

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

13 months agoAdd provider pre-fetching documentation
slontis [Wed, 22 Feb 2023 00:11:33 +0000 (10:11 +1000)]
Add provider pre-fetching documentation

Clearly document that implicit fetching is slower when using providers,
and explain prefetching. Added to crypto.pod and migration_guide.pod
links to it.

Add a link to EVP_default_properties_enable_fips() in crypto.pod.

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

13 months agoAdd documentation for "NULL" cipher and digest algorithms.
slontis [Wed, 22 Feb 2023 02:15:47 +0000 (12:15 +1000)]
Add documentation for "NULL" cipher and digest algorithms.

Fixes #20340

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

13 months agoAdded a fuzzer for SMIME
Alex Gaynor [Sun, 19 Feb 2023 04:43:41 +0000 (23:43 -0500)]
Added a fuzzer for SMIME

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20332)

14 months agoutil/find-doc-nits: improve error diagnostics on missing man section numbers in links
Dr. David von Oheimb [Fri, 24 Feb 2023 13:04:10 +0000 (14:04 +0100)]
util/find-doc-nits: improve error diagnostics on missing man section numbers in links

Reviewed-by: Hugo Landau <hlandau@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/20369)

14 months agoCMS_add0_cert.pod: add missing man section numbers in recently added L<fun()> refs
Dr. David von Oheimb [Fri, 24 Feb 2023 13:03:19 +0000 (14:03 +0100)]
CMS_add0_cert.pod: add missing man section numbers in recently added L<fun()> refs

Reviewed-by: Hugo Landau <hlandau@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/20369)

14 months agoAdd OSSL_FUNC_keymgmt_im/export_types function that gets the provider context
Ingo Franzki [Wed, 8 Feb 2023 16:26:20 +0000 (17:26 +0100)]
Add OSSL_FUNC_keymgmt_im/export_types function that gets the provider context

The provider functions OSSL_FUNC_keymgmt_import_types() and
OSSL_FUNC_keymgmt_export_types() do not get the provider context passed.
This makes it difficult for providers to implement these functions unless
its a static implementation returning a truly constant OSSL_PARAM array.
Some providers may have a need to return an OSSL_PARAM array that is
dependent on the provider configuration, or anything else that is contained
in its provider context.

Add extended variants of these functions that get the provider context passed.
The functions should still return a static and constant OSSL_PARAM array, but
may use the provider context to select the array to return dependent on its
context. The returned array must be constant at least until the provider is
unloaded.

Providers can implement only the original functions, or only the extended
functions, or both. Implementing at least one of those functions is required
if also the respective OSSL_FUNC_keymgmt_import() or OSSL_FUNC_keymgmt_export()
function is implemented. If an extended function is available, it is called by
evp_keymgmt_import_types() or evp_keymgmt_export_types(), otherwise the original
function is called.

This makes the code backward compatible. Existing providers will only implement
the original functions, so these functions will continued to be called.
Newer providers can choose to implement the extended functions, and thus can
benefit from the provider context being passed to the implementation.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20255)

14 months agoCMS_add0_cert: if cert already present, do not throw error but ignore it
Dr. David von Oheimb [Mon, 12 Sep 2022 18:50:28 +0000 (20:50 +0200)]
CMS_add0_cert: if cert already present, do not throw error but ignore it

Also add checks on failing cert/CRL up_ref calls; improve coding style.

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

14 months agoCMS_add1_crl(): prevent double free on failure of CMS_add0_crl()
Dr. David von Oheimb [Fri, 10 Feb 2023 08:53:43 +0000 (09:53 +0100)]
CMS_add1_crl(): prevent double free on failure of CMS_add0_crl()

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

14 months agofirst cut at sigalg loading
Michael Baentsch [Mon, 26 Sep 2022 15:32:05 +0000 (17:32 +0200)]
first cut at sigalg loading

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

14 months agotest/recipes/01-test_symbol_presence.t: check for duplicate symbols in static libs
Richard Levitte [Sat, 18 Feb 2023 10:22:39 +0000 (11:22 +0100)]
test/recipes/01-test_symbol_presence.t: check for duplicate symbols in static libs

This checks that all symbols are unique across all public static libraries.
This includes a bit of refacftoring to avoid repeating code too much.

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

14 months agoAdd help for pkeyopt values for the genpkey commandline app.
slontis [Thu, 15 Dec 2022 02:13:55 +0000 (12:13 +1000)]
Add help for pkeyopt values for the genpkey commandline app.

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

14 months agoSkip subdirectories in SSL_add_dir_cert_subjects_to_stack()
olszomal [Tue, 21 Feb 2023 13:20:24 +0000 (14:20 +0100)]
Skip subdirectories in SSL_add_dir_cert_subjects_to_stack()

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

14 months agoFixes #20278: Fixed double free bug in crypto/http/http_client.c
Jeeban Sethi [Tue, 21 Feb 2023 16:01:43 +0000 (21:31 +0530)]
Fixes #20278: Fixed double free bug in crypto/http/http_client.c

CLA: trivial

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

14 months agoTest that QUIC has the ciphersuites that we expect
Matt Caswell [Thu, 26 Jan 2023 18:23:32 +0000 (18:23 +0000)]
Test that QUIC has the ciphersuites that we expect

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

14 months agoDon't send ciphersuites twice in QUIC
Matt Caswell [Thu, 26 Jan 2023 17:53:30 +0000 (17:53 +0000)]
Don't send ciphersuites twice in QUIC

QUIC TLS was sending some ciphersuites twice in the ClientHello. This
was due to us declaring some TLSv1.3 ciphersuites in the list intended to
describe the TLSv1.2 ciphersuites supported by the SSL_METHOD.

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

14 months agoCI: add Clang 16
Sam James [Tue, 21 Feb 2023 00:37:57 +0000 (00:37 +0000)]
CI: add Clang 16

Clang 16 will be released shortly (beginning of March).

Signed-off-by: Sam James <sam@gentoo.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20346)

14 months agoFix potential NULL pointer dereference in function evp_pkey_asn1_ctrl
zhailiangliang [Wed, 15 Feb 2023 02:43:01 +0000 (10:43 +0800)]
Fix potential NULL pointer dereference in function evp_pkey_asn1_ctrl

CLA: trivial

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

14 months agoAdd const to some test tserver functions
Matt Caswell [Mon, 6 Feb 2023 15:56:33 +0000 (15:56 +0000)]
Add const to some test tserver functions

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

14 months agoRename various functions OSSL_QUIC_FAULT -> QTEST_FAULT
Matt Caswell [Mon, 6 Feb 2023 15:34:05 +0000 (15:34 +0000)]
Rename various functions OSSL_QUIC_FAULT -> QTEST_FAULT

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

14 months agoDon't declare SSL_CONNECTION twice
Matt Caswell [Thu, 26 Jan 2023 15:19:40 +0000 (15:19 +0000)]
Don't declare SSL_CONNECTION twice

It causes problems with some compilation options

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

14 months agoEnsure calling BIO_recvmmsg() with a dgram pair reports errors
Matt Caswell [Thu, 26 Jan 2023 14:55:28 +0000 (14:55 +0000)]
Ensure calling BIO_recvmmsg() with a dgram pair reports errors

When calling BIO-recvmmsg() and using a dgram pair we were failing to
raise an error in the case that a problem occurs. This means that the
reason behind a failure cannot be detected and all problems are treated
as fatal even if they may not be.

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

14 months agoAdd a helper function to prepend a frame to a packet
Matt Caswell [Tue, 17 Jan 2023 15:16:42 +0000 (15:16 +0000)]
Add a helper function to prepend a frame to a packet

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

14 months agoAdd explanatory comments to say what happens during resizing of buffers
Matt Caswell [Wed, 11 Jan 2023 16:08:53 +0000 (16:08 +0000)]
Add explanatory comments to say what happens during resizing of buffers

Explain that buffers are over allocated to being with, so a resize is a
logical resize only. Buffer addresses never change.

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

14 months agoAdd a qtest_check_server_transport_err helper function
Matt Caswell [Wed, 11 Jan 2023 16:04:25 +0000 (16:04 +0000)]
Add a qtest_check_server_transport_err helper function

Allows tests to check that a given transport error was received by the
server.

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

14 months agoExtend the corruption test to truncate a datagram
Matt Caswell [Wed, 11 Jan 2023 15:14:52 +0000 (15:14 +0000)]
Extend the corruption test to truncate a datagram

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

14 months agoAdd the capability to listen for datagrams
Matt Caswell [Tue, 10 Jan 2023 18:55:05 +0000 (18:55 +0000)]
Add the capability to listen for datagrams

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

14 months agoDon't treat the Tserver as connected until the handshake is confirmed
Matt Caswell [Tue, 10 Jan 2023 17:52:18 +0000 (17:52 +0000)]
Don't treat the Tserver as connected until the handshake is confirmed

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

14 months agoAdd a test for a corrupted packet
Matt Caswell [Tue, 10 Jan 2023 16:22:20 +0000 (16:22 +0000)]
Add a test for a corrupted packet

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

14 months agoEnable the fault injector to add faults to post-encryption packets
Matt Caswell [Mon, 12 Dec 2022 16:52:50 +0000 (16:52 +0000)]
Enable the fault injector to add faults to post-encryption packets

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

14 months agoExpand some comments in the header file
Matt Caswell [Fri, 9 Dec 2022 17:00:46 +0000 (17:00 +0000)]
Expand some comments in the header file

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

14 months agoRaise a protocol error if we have not received transport params from peer
Matt Caswell [Wed, 7 Dec 2022 16:55:21 +0000 (16:55 +0000)]
Raise a protocol error if we have not received transport params from peer

If we complete the TLS handshake but transport params were not received
then this is a protcol error and we should fail.

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

14 months agoAdd a test for a server that doesn't provide transport params
Matt Caswell [Tue, 6 Dec 2022 16:44:09 +0000 (16:44 +0000)]
Add a test for a server that doesn't provide transport params

Check that we fail if the server has failed to provide transport params.

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

14 months agoImplement the QUIC Fault injector support for TLS handshake messages
Matt Caswell [Fri, 2 Dec 2022 15:52:21 +0000 (15:52 +0000)]
Implement the QUIC Fault injector support for TLS handshake messages

Provide helper functions to listen for TLS handshake messages being sent,
as well as the ability to change the contents of those messages as well as
resizing them.

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

14 months agoAdd the ability to mutate TLS handshake messages before they are written
Matt Caswell [Fri, 2 Dec 2022 14:38:46 +0000 (14:38 +0000)]
Add the ability to mutate TLS handshake messages before they are written

We add callbacks so that TLS handshake messages can be modified by the test
framework before they are passed to the handshake hash, possibly encrypted
and written to the network. This enables us to simulate badly behaving
endpoints.

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

14 months agoAdd a test where an unknown frame type is received
Matt Caswell [Thu, 1 Dec 2022 11:52:48 +0000 (11:52 +0000)]
Add a test where an unknown frame type is received

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

14 months agoEnable QUIC test server to find out the termination reason
Matt Caswell [Thu, 1 Dec 2022 16:37:47 +0000 (16:37 +0000)]
Enable QUIC test server to find out the termination reason

We enable querying of the termination reason which is useful for tests.

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

14 months agoTreat unknown frames as a protocol error
Matt Caswell [Thu, 1 Dec 2022 16:36:08 +0000 (16:36 +0000)]
Treat unknown frames as a protocol error

From RFC9000, section 19.21 "An extension to QUIC that wishes to use a new
type of frame MUST first ensure that a peer is able to understand the
frame". So if we receive an unknown frame type from a peer we should treat
it as a protocol violation. In fact we ignore it, and ignore all the
contents of the rest of the packet and continue on regardless.

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

14 months agoDon't raise an error on retryable read in a BIO_s_dgram_pair()
Matt Caswell [Thu, 1 Dec 2022 14:16:02 +0000 (14:16 +0000)]
Don't raise an error on retryable read in a BIO_s_dgram_pair()

This results in spurious errors appearing on the queue in normal
operation, e.g. calling SSL_tick() with a QUIC connection will succeed,
but an error will end up on the queue anyway.

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

14 months agoImplement the QUIC Fault injector support for plaintext packets
Matt Caswell [Wed, 30 Nov 2022 16:41:31 +0000 (16:41 +0000)]
Implement the QUIC Fault injector support for plaintext packets

Provider helper functions to listen for plaintext packets being sent, as
well as the ability to change the contents of those packets as well as
resizing them.

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

14 months agoAdd a skeleton quicfaultstest
Matt Caswell [Wed, 30 Nov 2022 14:21:00 +0000 (14:21 +0000)]
Add a skeleton quicfaultstest

Also includes helper support to create a QUIC connection inside a test.

We wil use quicfaultstest to deliberately inject faulty datagrams/packets
to test how we handle them.

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

14 months agoAdd the ability to mutate QUIC packets before they are written
Matt Caswell [Tue, 29 Nov 2022 16:04:23 +0000 (16:04 +0000)]
Add the ability to mutate QUIC packets before they are written

We add callbacks so that QUIC packets can be modified by the test
framework before they are encrypted and written to the network. This
enables us to simulate badly behaving endpoints.

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

14 months agoupdate documentation to note that EdDSA is not FIPS approved
Pauli [Mon, 20 Feb 2023 22:20:43 +0000 (09:20 +1100)]
update documentation to note that EdDSA is not FIPS approved

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

14 months agoupdate changes entry to note EdDSA is not FIPS approved
Pauli [Mon, 20 Feb 2023 22:20:22 +0000 (09:20 +1100)]
update changes entry to note EdDSA is not FIPS approved

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

14 months agoRevert "Put EdDSA back as approved algorithms."
Pauli [Mon, 20 Feb 2023 22:11:44 +0000 (09:11 +1100)]
Revert "Put EdDSA back as approved algorithms."

This reverts commit 09627a8ceb69e19d2855b36228f44a3660af177a.

NIST isn't allowing EdDSA at this stage after all, so flag it as not
FIPS approved in the FIPS provider.  Guidance for FIPS 140-3 is expected
later this month:

    The use of EdDSA still remains non-approved.

    Before the FIPS 186-5 and SP 800-186 algorithms / curves can be
    used in the approved mode, the CMVP will need to do (at least)
    the following:

    * Incorporate FIPS 186-5 and SP 800-186 into SP 800-140C/D;

    * Update IG 10.3.A to incorporate self-test requirements for the
      new algorithms/curves.

    * Write a new IG on this transition to clarify the issues raised in
      this thread and elsewhere and provide a clear transition schedule.

    The CMVP is working on all three of these items and hope to have
    drafts public by the end of March.

    Since security relevant changes are not permitted for new 140-2
    submissions, and under the assumption that this transition away
    from FIPS 186-4 algorithms will be 'soft' and not move modules to
    the historical list, we do not plan on writing 140-2 guidance for
    this transition.

It seems unlikely that all of these requirements will be completed before
we submit.

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

14 months agoAdd a test for no initialisation of the default config file
Matt Caswell [Mon, 20 Feb 2023 17:22:57 +0000 (17:22 +0000)]
Add a test for no initialisation of the default config file

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

14 months agoOnly call OPENSSL_init_crypto on fetch if using the default libctx
Matt Caswell [Mon, 20 Feb 2023 14:47:20 +0000 (14:47 +0000)]
Only call OPENSSL_init_crypto on fetch if using the default libctx

There is no point in calling OPENSSL_init_crypto() unless we are actually
going to be using the default libctx.

Fixes #20315

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