openssl.git
5 months agoDo not define L_ENDIAN (for now) when we guessed linux64-loongarch64
Xi Ruoyao [Fri, 24 Nov 2023 08:14:05 +0000 (16:14 +0800)]
Do not define L_ENDIAN (for now) when we guessed linux64-loongarch64

In 160f48941d14 I made L_ENDIAN defined when the system is guessed to be
linux64-loongarch64.  Unfortunately now I found it problematic:

1. This should be added into Configurations/10-main.conf, not here.
   Having it here causes a different configuration when
   linux64-loongarch64 is explicitly specified than guessed.
2. With LTO enabled, this causes many test failures on
   linux64-loongarch64 due to #12247.

So I think we should remove it for now (master and 3.2 branch), and
reintroduce it to Configurations/10-main.conf when we finally sort
out #12247.

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

5 months agoQUIC TSERVER: Fix erroneously static variable
Hugo Landau [Mon, 27 Nov 2023 07:57:32 +0000 (07:57 +0000)]
QUIC TSERVER: Fix erroneously static variable

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

5 months agoMake scsv read-only
Hugo Landau [Mon, 27 Nov 2023 07:55:55 +0000 (07:55 +0000)]
Make scsv read-only

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

5 months agoMake nid_to_group read-only
Hugo Landau [Mon, 27 Nov 2023 07:52:54 +0000 (07:52 +0000)]
Make nid_to_group read-only

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

5 months agoMake bitmask table read only
Hugo Landau [Mon, 27 Nov 2023 07:52:24 +0000 (07:52 +0000)]
Make bitmask table read only

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

5 months agoMake ssl_cert_info read-only
Hugo Landau [Mon, 27 Nov 2023 07:51:33 +0000 (07:51 +0000)]
Make ssl_cert_info read-only

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

5 months agoOnly include winsock2.h for struct timeval if needed
Hugo Landau [Fri, 24 Nov 2023 10:03:30 +0000 (10:03 +0000)]
Only include winsock2.h for struct timeval if needed

Fixes #22811

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/22813)

(cherry picked from commit ba58e9f1e22dd9ee2e37078640dcbe9f520a555d)

5 months agoQUIC SRT GEN: Minor updates
Hugo Landau [Thu, 23 Nov 2023 15:50:03 +0000 (15:50 +0000)]
QUIC SRT GEN: Minor updates

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

5 months agoQUIC SRT GEN: Add SRT generator
Hugo Landau [Thu, 2 Nov 2023 15:41:23 +0000 (15:41 +0000)]
QUIC SRT GEN: Add SRT generator

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

5 months agox86_64-xlate.pl: Fix build with icx and nvc compilers
Tomas Mraz [Mon, 13 Nov 2023 11:17:43 +0000 (12:17 +0100)]
x86_64-xlate.pl: Fix build with icx and nvc compilers

Fixes #22594

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

5 months agoPreferNoDHEKEX changelog and history anticipating inclusion in OpenSSL version 3.3.
Markus Minichmayr [Wed, 22 Nov 2023 16:43:27 +0000 (17:43 +0100)]
PreferNoDHEKEX changelog and history anticipating inclusion in OpenSSL version 3.3.

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

5 months agoDocument `SSL_OP_PREFER_NO_DHE_KEX` option.
Markus Minichmayr [Tue, 21 Nov 2023 22:50:54 +0000 (23:50 +0100)]
Document `SSL_OP_PREFER_NO_DHE_KEX` option.

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

5 months agoAdd option `SSL_OP_PREFER_NO_DHE_KEX`, allowing the server to prefer non-dhe psk...
Markus Minichmayr [Tue, 21 Nov 2023 19:42:12 +0000 (20:42 +0100)]
Add option `SSL_OP_PREFER_NO_DHE_KEX`, allowing the server to prefer non-dhe psk key exchange over psk with dhe (config file option `PreferNoDHEKEX`, server option `prefer_no_dhe_kex`).

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

5 months agoWhen abidiff fails print out the XML diff
Tomas Mraz [Fri, 10 Nov 2023 15:06:16 +0000 (16:06 +0100)]
When abidiff fails print out the XML diff

This can be useful for fixing the CI if needed
without the necessity to run abidw locally.

Also rename the CI job to make its purpose clearer.

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

5 months agoopenssl-speed: support KMAC128 & KMAC256, refactor mac setup/teardown
James Muir [Fri, 17 Nov 2023 23:02:51 +0000 (18:02 -0500)]
openssl-speed: support KMAC128 & KMAC256, refactor mac setup/teardown

Add ability to measure performance of the two kmac algorithms, and
reduce code duplication in mac testing by introducing mac_setup() and
mac_teardown().  Also, start accepting "cmac" as an algorithm string
(similar to how "hmac" is accepted).

We can now compare the performance of KMAC128, KMAC256 (mac algs) to
KECCAK-KMAC128, KECCAK-KMAC256 (digest/xof algs).

Fixes #22619

Testing:

  $ LD_LIBRARY_PATH=. ./apps/openssl speed kmac cmac hmac

  $ LD_LIBRARY_PATH=. ./apps/openssl speed kmac256
  $ LD_LIBRARY_PATH=. ./apps/openssl speed -evp KECCAK-KMAC256

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

5 months agoIANA has assigned numbers for 2 hybrid PQ KEX widely used in tests
Dmitry Belyavskiy [Thu, 23 Nov 2023 09:22:36 +0000 (10:22 +0100)]
IANA has assigned numbers for 2 hybrid PQ KEX widely used in tests

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

5 months agoSHA3_squeeze(): The next argument is int
Tomas Mraz [Mon, 20 Nov 2023 16:46:26 +0000 (17:46 +0100)]
SHA3_squeeze(): The next argument is int

Amend the assembler so it uses only 32bit value.

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

5 months agokeccak1600-armv4.pl: Further fix for the DigestSqueeze() support
Tomas Mraz [Thu, 16 Nov 2023 16:52:39 +0000 (17:52 +0100)]
keccak1600-armv4.pl: Further fix for the DigestSqueeze() support

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

5 months agoCross Compiles CI: Run evp tests on pull requests
Tomas Mraz [Thu, 16 Nov 2023 12:02:20 +0000 (13:02 +0100)]
Cross Compiles CI: Run evp tests on pull requests

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

5 months agocontributing-doc: give example commit message with "CLA: trivial"
James Muir [Mon, 20 Nov 2023 18:14:12 +0000 (13:14 -0500)]
contributing-doc: give example commit message with "CLA: trivial"

The text "CLA: trivial" should go at the bottom of the commit message.
Also, update the force-push command to include the repository and
branch, which can avoid unexpected force-push results.

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22775)

5 months agoAdapt C compiler detection for VSI C on x86_64
Richard Levitte [Tue, 21 Nov 2023 13:36:37 +0000 (14:36 +0100)]
Adapt C compiler detection for VSI C on x86_64

VSI C on OpenVMS for x86_64 has a bit more information than on other
hardware.  This is no doubt because it's based on LLVM which leaves an
opening for cross compilation.

VSI C on Itanium:

    $ CC/VERSION
    VSI C V7.4-001 on OpenVMS IA64 V8.4-2L3

VSI C on x86_64:

    $ CC/VERSION
    VSI C x86-64 X7.4-843 (GEM 50XB9) on OpenVMS x86_64 V9.2-1

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

5 months agospeed: make hmac(sha256) the default hmac
James Muir [Tue, 21 Nov 2023 05:09:38 +0000 (00:09 -0500)]
speed: make hmac(sha256) the default hmac

prefer hmac(sha256) rather than hmac(md5).  Also, drop the "skip_hmac"
label.  If we are supposed to do hmac(hash_func) and hash_func cannot
be found, then error out immediately.

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

5 months agoFix a possible memory leak in SM2 provider
Huiyue Xu [Wed, 22 Nov 2023 01:55:27 +0000 (09:55 +0800)]
Fix a possible memory leak in SM2 provider

ctx->propq that strdup from input parameter propq in sm2sig_newctx,
is not released. It should be released in sm2sig_freectx and copied
to dstctx in sm2sig_dupctx. And dstctx->id and dstctx->propq should
be set NULL to avoid releasing id/propq of srcctx when err occurs.

Signed-off-by: Huiyue Xu <xuhuiyue@huawei.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22796)

5 months agoUpdate fuzz corpora
Hugo Landau [Thu, 23 Nov 2023 14:50:03 +0000 (14:50 +0000)]
Update fuzz corpora

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

5 months agoQUIC SRTM: Switch to using AES-128-ECB
Hugo Landau [Tue, 14 Nov 2023 11:03:46 +0000 (11:03 +0000)]
QUIC SRTM: Switch to using AES-128-ECB

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

5 months agoQUIC SRTM: Harden SRTM in event of allocation failure
Hugo Landau [Fri, 3 Nov 2023 18:18:36 +0000 (18:18 +0000)]
QUIC SRTM: Harden SRTM in event of allocation failure

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

5 months agoQUIC SRTM: Update fuzz corpora
Hugo Landau [Fri, 3 Nov 2023 15:38:27 +0000 (15:38 +0000)]
QUIC SRTM: Update fuzz corpora

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

5 months agoQUIC SRTM: Amend glossary
Hugo Landau [Fri, 3 Nov 2023 14:14:14 +0000 (14:14 +0000)]
QUIC SRTM: Amend glossary

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

5 months agoQUIC SRTM: Add test
Hugo Landau [Fri, 3 Nov 2023 12:23:14 +0000 (12:23 +0000)]
QUIC SRTM: Add test

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

5 months agoFuzzing: Fix helper shebang on NixOS
Hugo Landau [Fri, 3 Nov 2023 11:56:40 +0000 (11:56 +0000)]
Fuzzing: Fix helper shebang on NixOS

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

5 months agoQUIC SRTM: Add fuzzer for SRTM
Hugo Landau [Fri, 3 Nov 2023 11:56:29 +0000 (11:56 +0000)]
QUIC SRTM: Add fuzzer for SRTM

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

5 months agoQUIC SRTM: Add SRTM
Hugo Landau [Fri, 3 Nov 2023 11:56:14 +0000 (11:56 +0000)]
QUIC SRTM: Add SRTM

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

5 months agoMake CHANGES.md header more appropriate
Hugo Landau [Mon, 20 Nov 2023 15:07:09 +0000 (15:07 +0000)]
Make CHANGES.md header more appropriate

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

(cherry picked from commit d330fef1f1446c968e31803778bc7b3d067c7e99)

5 months agoAmend NEWS.md to be more like release notes
Hugo Landau [Mon, 20 Nov 2023 14:06:42 +0000 (14:06 +0000)]
Amend NEWS.md to be more like release notes

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

(cherry picked from commit 5e07ea4f82b5250d64183ddda2b56ebf37df126a)

5 months agodoc: fix description of mac "block-size" parameter
James Muir [Fri, 17 Nov 2023 22:58:24 +0000 (17:58 -0500)]
doc: fix description of mac "block-size" parameter

The macro for "block-size" is OSSL_MAC_PARAM_BLOCK_SIZE, and this
parameter is not settable.  Refer to the "customization string" rather
than the "custom value" (in the Blake2 spec, this is called the
personalization string).

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

5 months agodoc: better description of KECCAK-KMAC XOF
James Muir [Mon, 13 Nov 2023 19:28:23 +0000 (14:28 -0500)]
doc: better description of KECCAK-KMAC XOF

KECCAK-KMAC-128 and KECCAK-KMAC-256 are extendable output functions
that have been defined because they are convenient for implementing
KMAC.  Give definitions for them so that users aren't left to figure
that out themselves.  KECCAK-KMAC-128 is very similar to SHAKE-128,
and KECCAK-KMAC-256 is very similar to SHAKE-256.

Related to #22619.

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

5 months agoUpdate the provider documentation
Matt Caswell [Fri, 10 Nov 2023 15:33:21 +0000 (15:33 +0000)]
Update the provider documentation

Make the documentation match reality. Add lots of missing algorithms.

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

5 months agoUpdate OpenSSL logos
James Muir [Sun, 5 Nov 2023 03:06:06 +0000 (23:06 -0400)]
Update OpenSSL logos

Add two new files

  doc/images/openssl-square.svg
  doc/images/openssl-square-nontransparent.png

and update the existing file

  doc/images/openssl.svg

The "square" versions of the logo write "Open" and "SSL" on separate
lines, so that less horizontal space is used.

The png file (nontransparent, white background) can be used to update
the profile picture for the OpenSSL organization on GitHub.

For the existing logo, openssl.svg, the subtitle "Cryptography and
SSL/TLS Toolkit" has been dropped and the text-elements have been
converted to paths (so they are no longer dependent on what fonts the
renderer provides).

The svg files were provided by Anton A.

Part of https://github.com/openssl/project/issues/262

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

5 months agoFix possible memleak in PKCS7_add0_attrib_signing_time
Bernd Edlinger [Tue, 14 Nov 2023 01:42:42 +0000 (02:42 +0100)]
Fix possible memleak in PKCS7_add0_attrib_signing_time

When PKCS7_add_signed_attribute fails, the ASN1_TIME
object may be leaked when it was not passed in as
input parameter.

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

5 months agoFix a possible use-after-free in custom_exts_free
Bernd Edlinger [Mon, 20 Nov 2023 09:05:49 +0000 (10:05 +0100)]
Fix a possible use-after-free in custom_exts_free

This may happen when ssl_cert_dup calls custom_exts_copy, where
a possible memory allocation error causes custom_exts_free
to be called twice: once in the error handling of custom_exts_copy
and a second time in the error handling of ssl_cert_dup.

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

5 months agoFix a possible memleak in CMS_sign_receipt
Bernd Edlinger [Fri, 17 Nov 2023 06:12:42 +0000 (07:12 +0100)]
Fix a possible memleak in CMS_sign_receipt

When an error happens after cms_encode_Receipt
the ASN1_OCTET_STRING object "os" may be leaked.

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

5 months agoFix a possible memleak in PKCS7_add_attrib_smimecap
Bernd Edlinger [Wed, 15 Nov 2023 19:32:59 +0000 (20:32 +0100)]
Fix a possible memleak in PKCS7_add_attrib_smimecap

When PKCS7_add_signed_attribute fails, the ASN1_STRING
object may be leaked.

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

5 months agoFix a possible memory leak in dane_tlsa_add
Bernd Edlinger [Wed, 15 Nov 2023 18:46:17 +0000 (19:46 +0100)]
Fix a possible memory leak in dane_tlsa_add

Several error cases leak either the X509 object
or the pkey or the danetls_record object.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22743)

5 months agoFix typo in variable name
Anders Jansson [Sat, 18 Nov 2023 22:40:33 +0000 (23:40 +0100)]
Fix typo in variable name

Fix spelling $cppfags2 => $cppflags2 in file Configurations/windows-makefile.tmpl

CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22771)

5 months agoMove freeing of an old record layer to dtls1_clear_sent_buffer
Matt Caswell [Thu, 9 Nov 2023 14:45:33 +0000 (14:45 +0000)]
Move freeing of an old record layer to dtls1_clear_sent_buffer

When we are clearing the sent messages queue we should ensure we free any
old write record layers that are no longer in use. Previously this logic
was in dtls1_hm_fragment_free() - but this can end up freeing the current
record layer under certain error conditions.

Fixes #22664

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

5 months agozero data in hm_fragment on alloc
Neil Horman [Thu, 9 Nov 2023 13:13:58 +0000 (08:13 -0500)]
zero data in hm_fragment on alloc

if we allocate a new hm_frament in dtls1_buffer_message with
dtls1_hm_fragment_new, the returned fragment contains uninitalized data in the
msg_header field.  If an error then occurs, and we free the fragment,
dtls_hm_fragment_free interrogates the msg_header field (which is garbage), and
potentially references undefined values, or worse, accidentally references
available memory that is not owned, leading to various corruptions.

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

5 months agoaugment quic demos to support ipv4/6 connections
Neil Horman [Tue, 31 Oct 2023 15:54:03 +0000 (11:54 -0400)]
augment quic demos to support ipv4/6 connections

Because the quicserver utility supports expressly listening in ipv4/6
mode, its possible/likely that the server will listen on an ipv4
address, while the clients will connect via ipv6, leading to connection
failures.

Augment quic demo clients to afford them the same -6 option that the
server has so that connection family can be co-ordinated

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22577)

6 months agoNOTES-WINDOWS: fix named anchor links in table of contents
Matthias St. Pierre [Tue, 14 Nov 2023 10:34:43 +0000 (11:34 +0100)]
NOTES-WINDOWS: fix named anchor links in table of contents

Those links were probably broken by some changes to the sanitizer
of the [github/markup] module.

[github/markup]: https://github.com/github/markup/#github-markup

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

6 months agoBump actions/github-script from 6 to 7
dependabot[bot] [Wed, 15 Nov 2023 10:14:21 +0000 (10:14 +0000)]
Bump actions/github-script from 6 to 7

Bumps [actions/github-script](https://github.com/actions/github-script) from 6 to 7.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

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

6 months agoConfigure: do not check for an absolute prefix in cross-builds
Viktor Szakats [Fri, 27 Aug 2021 12:22:15 +0000 (12:22 +0000)]
Configure: do not check for an absolute prefix in cross-builds

The check is always made according to the host platform's rules, which may
not be true for true when the target platform is different, e.g. when
cross-building for Windows on a Linux machine. So skip this check when
used together with the `--cross-compile-prefix=` option.

Fixes https://github.com/openssl/openssl/issues/9520

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

6 months agoUpdate ci and ABI xml files to validate function parameters
Neil Horman [Mon, 13 Nov 2023 09:19:18 +0000 (04:19 -0500)]
Update ci and ABI xml files to validate function parameters

libabigail is currenly only validating symbol presence and version
information in ci.  We should also be validating function parameters,
types, etc.  To do this we need to build the library with -g so the
dwarf information is available for libabigail to interrogate

while we're at it, also add a script to re-generate the xml that abidiff
uses for comparison during ci runs, to make updates easier

Fixes #22712

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

6 months agoCorrect tag len check when determining how much space we have in the pkt
Matt Caswell [Mon, 13 Nov 2023 11:27:54 +0000 (11:27 +0000)]
Correct tag len check when determining how much space we have in the pkt

If the available space is equal to the tag length then we have no available
space for plaintext data.

Fixes #22699

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

6 months agoAdd some additional tests for the new fc "consumed" params
Matt Caswell [Mon, 13 Nov 2023 14:39:53 +0000 (14:39 +0000)]
Add some additional tests for the new fc "consumed" params

Check that the "consumed" parameter is working as expected.

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

6 months agoKeep track of connection credit as we add stream data
Matt Caswell [Mon, 13 Nov 2023 14:16:57 +0000 (14:16 +0000)]
Keep track of connection credit as we add stream data

If a single packet contains data from multiple streams we need to keep track
of the cummulative connection level credit consumed across all of the
streams. Once the connection level credit has been consumed we must stop
adding stream data.

Fixes #22706

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

6 months agoFix SHA3_squeeze on armv4.
slontis [Tue, 14 Nov 2023 01:40:09 +0000 (11:40 +1000)]
Fix SHA3_squeeze on armv4.

For armv4 - Only the first 4 parameters can be passed via registers
(r0..r3).

As all of the general registers are already used,
r11 was used to store the 'next' param.
R11 is now pushed/poped on entry/exit.

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

6 months agodemos: tidy up makefiles, fix warnings
James Muir [Fri, 10 Nov 2023 19:02:00 +0000 (14:02 -0500)]
demos: tidy up makefiles, fix warnings

Update makefiles so that consistent patterns are used.  Object files
are compiled from source using an implicit rule (but using our
CFLAGS); for linking, we give an explicit rule.  Ensure that "make
test" works in each subdirectory (even if it does not actually run any
applications).  The top-level demo makefile now works.

The makefiles are not make-agnostic.  e.g. they use the variable $(RM)
in "clean" recipes, which is defined in gnu-make but may not be
defined in others.

Part of #17806

Testing:

  $ cd demo
  $ make test

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

6 months agoImport repro from #22708 as a test case
наб [Mon, 13 Nov 2023 01:19:51 +0000 (02:19 +0100)]
Import repro from #22708 as a test case

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

6 months agoFix BLAKE2s reporting the same EVP_MD_get_size() as BLAKE2b (64)
наб [Sun, 12 Nov 2023 23:44:06 +0000 (00:44 +0100)]
Fix BLAKE2s reporting the same EVP_MD_get_size() as BLAKE2b (64)

Fixes: commit 6d1e730a1ea2c64bdffa88c6b3bee4c3f5bed602 ("Implement
 BLAKE2s with the same macro as BLAKE2b")
Closes: #22708
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22710)

6 months agoREADME: add link to OpenSSL 3.2 manual pages
Matthias St. Pierre [Sat, 4 Nov 2023 23:18:08 +0000 (00:18 +0100)]
README: add link to OpenSSL 3.2 manual pages

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

6 months agoppc64: Fix SHA3_squeeze
Rohan McLure [Tue, 14 Nov 2023 03:14:33 +0000 (14:14 +1100)]
ppc64: Fix SHA3_squeeze

Fix the conditional on the 'next' parameter passed into SHA3_squeeze.

Reported-by: David Benjamin <davidben@davidben.net>
Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22722)

6 months agoDocument the exporter change in CHANGES.md and NEWS.md
Richard Levitte [Mon, 6 Nov 2023 10:09:38 +0000 (11:09 +0100)]
Document the exporter change in CHANGES.md and NEWS.md

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

6 months agoAdd exporters for CMake
Richard Levitte [Wed, 3 May 2023 10:36:09 +0000 (12:36 +0200)]
Add exporters for CMake

CMake's older package finder, FindOpenSSL.cmake, does a best guess effort
and doesn't always get it right.

By CMake's own documentation, that's what such modules are (best effort
attempts), and package producers are (strongly) encouraged to help out by
producing and installing <PackageName>Config.cmake files to get a more
deterministic configuration.

The resulting OpenSSLConfig.cmake tries to mimic the result from CMake's
FindOpenSSL.cmake, by using the same variable and imported target names.
It also adds a few extra variables of its own, such as:

    OPENSSL_MODULES_DIR     Indicates the default installation directory
                            for OpenSSL loadable modules, such as providers.
    OPENSSL_RUNTIME_DIR     Indicates the default runtime directory, where
                            for example the openssl program is located.
    OPENSSL_PROGRAM         Is the full directory-and-filename of the
                            openssl program.

The imported targets OpenSSL::Crypto and OpenSSL::SSL are as precisely
specified as possible, so for example, they are specified with the both the
import library and the DLL on Windows, which should make life easier on that
platform.

For the moment, one of the following must be done in your CMake project for
this CMake configuration to take priority over CMake's FindOpenSSL.cmake:

-   The variable CMAKE_FIND_PACKAGE_PREFER_CONFIG must be set to true prior
    to the 'find_package(OpenSSL)' call.
-   The 'find_package' call itself must use the "Full Signature".  If you
    don't know any better, simply add the 'CONFIG' option, i.e. from this
    example:

        find_package(OpenSSL 3.0 REQUIRED)

    to this:

        find_package(OpenSSL 3.0 REQUIRED CONFIG)

Just as with the 'pkg-config' exporters, two variants of the .cmake files
are produced:

- Those in 'exporters/' are installed in the location that 'pkg-config'
  itself prefers for installed packages.
- Those in the top directory are to be used when it's desirable to build
  directly against an OpenSSL build tree.

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

6 months agoClean up exporters, specifically those we have for pkg-config
Richard Levitte [Wed, 3 May 2023 10:29:00 +0000 (12:29 +0200)]
Clean up exporters, specifically those we have for pkg-config

The pkg-config exporters were a special hack, all in
Configurations/unix-Makefile.tmpl, and this was well and good as long
as that was the only main package interface configuration system that we
cared about.

Things have changed, though, so we move the pkg-config production to be
templatable in a more flexible manner.  Additional templates for other
interface configuration systems can then be added fairly easily.

Two variants of the .pc files are produced:

- Those in 'exporters/' are installed in the location that 'pkg-config'
  itself prefers for installed packages.
- Those in the top directory are to be used when it's desirable to build
  directly against an OpenSSL build tree.

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

6 months agoExclude more in the fuzz introspector report
Kurt Roeckx [Sun, 12 Nov 2023 09:26:33 +0000 (10:26 +0100)]
Exclude more in the fuzz introspector report

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

6 months agoRearrange some CI jobs
Tomas Mraz [Fri, 10 Nov 2023 16:28:16 +0000 (17:28 +0100)]
Rearrange some CI jobs

Those less useful should be in daily or on-push runs.

Those more likely triggering CI failure that do not
take too much time should be in main on pull request CI.

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

6 months agoCorrect 50-nonstop.conf to support QUIC tests under SPT threading models.
Randall S. Becker [Fri, 10 Nov 2023 20:24:22 +0000 (20:24 +0000)]
Correct 50-nonstop.conf to support QUIC tests under SPT threading models.

This fix also separates the FLOSS from SPT configurations which should not
have been conflated in the 3.0 series.

Related-to: #22588
Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22697)

(cherry picked from commit e3c38759608bb48d70ddfdaa1c88bcd86069952d)

6 months agoEnable AES and SHA3 optimisations on Apple Silicon M3-based macOS systems
Tom Cosgrove [Wed, 8 Nov 2023 22:45:55 +0000 (22:45 +0000)]
Enable AES and SHA3 optimisations on Apple Silicon M3-based macOS systems

AES gets a performance enhancement of 19-36%, similar to the M1 and M2.

SHA3 gets an improvement of 4-7% on buffers 256 bytes or larger.

Tested on an M3 Pro, but the CPU cores are the same on M3 and M3 Max.

Change-Id: I2bf40bbde824823bb8cf2efd1bd945da9f23a703

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

6 months agoForce Nonstop to use fcntl(F_GETFL) in BIO_sock_nbio
Neil Horman [Fri, 10 Nov 2023 20:31:23 +0000 (15:31 -0500)]
Force Nonstop to use fcntl(F_GETFL) in BIO_sock_nbio

In tracking down a hang, we found that nonstop platforms were falling
into the if #ifdef FIONBIO clause in the implementation of
BIO_sock_nbio.  While the platform defines this macro, sockets set with
this continued to operate in blocking mode.  Given that the platform
also support O_NONBLOCK, adjust the ifdef to have the nonstop platform
use that method to ensure that sockets enter blocking mode

Related-To #22588

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

6 months agoset_client_ciphersuite(): Fix for potential UB if session->cipher is NULL
Alexey Fofanov [Wed, 18 Oct 2023 11:23:22 +0000 (14:23 +0300)]
set_client_ciphersuite(): Fix for potential UB if session->cipher is NULL

This currently cannot happen without an application overriding
the session with some bogus data so this is an ossl_assert()
check.

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

6 months agoAugment rand argument parsing to allow scaling
Neil Horman [Sun, 5 Nov 2023 22:51:38 +0000 (17:51 -0500)]
Augment rand argument parsing to allow scaling

Instead of just accepting a number of bytes, allows openssl rand to
accept a k|m|g suffix to scale to kbytes/mbytes/gbytes

Fixes #22622

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

6 months agoProperly limit the variable output size for BLAKE2
Tomas Mraz [Wed, 8 Nov 2023 09:14:08 +0000 (10:14 +0100)]
Properly limit the variable output size for BLAKE2

The upper limit of the output size is the default output size of
the respective algorithm variants.

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

6 months agoFix CI breakage due to ABIDIFF failure
Tomas Mraz [Fri, 10 Nov 2023 15:00:18 +0000 (16:00 +0100)]
Fix CI breakage due to ABIDIFF failure

Also sync libcrypto.num and libssl.num with 3.2 branch and
fix the EVP_DigestSqueeze symbol version.

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

6 months agoSupport EVP_DigestSqueeze() for in the digest provider for s390x.
Holger Dengler [Wed, 27 Sep 2023 13:40:47 +0000 (15:40 +0200)]
Support EVP_DigestSqueeze() for in the digest provider for s390x.

The new EVP_DigestSqueeze() API requires changes to all keccak-based
digest provider implementations. Update the s390x-part of the SHA3
digest provider.

Squeeze for SHA3 is not supported, so add an empty function pointer
(NULL).

Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22221)

6 months agoFix state handling of keccak_final for s390x.
Holger Dengler [Wed, 27 Sep 2023 13:43:18 +0000 (15:43 +0200)]
Fix state handling of keccak_final for s390x.

The digest life-cycle state diagram has been updated for XOF. Fix the
state handling in s390x_keccac_final() according to the updated state
diagram.

Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22221)

6 months agoFix state handling of shake_final for s390x.
Holger Dengler [Wed, 27 Sep 2023 13:37:29 +0000 (15:37 +0200)]
Fix state handling of shake_final for s390x.

The digest life-cycle state diagram has been updated for XOF. Fix the
state handling in s390x_shake_final() according to the updated state
diagram.

Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22221)

6 months agoFix state handling of sha3_final for s390x.
Holger Dengler [Wed, 27 Sep 2023 13:36:59 +0000 (15:36 +0200)]
Fix state handling of sha3_final for s390x.

The digest life-cycle state diagram has been updated for XOF. Fix the
state handling in s390x_sha3_final() according to the updated state
diagram.

Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22221)

6 months agoFix state handling of sha3_absorb for s390x.
Holger Dengler [Wed, 27 Sep 2023 13:36:23 +0000 (15:36 +0200)]
Fix state handling of sha3_absorb for s390x.

The digest life-cycle state diagram has been updated for XOF. Fix the
state handling in s390x_sha3_aborb() according to the updated state
diagram.

Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22221)

6 months agoAdd xof state handing for generic sha3 absorb.
Holger Dengler [Wed, 27 Sep 2023 19:54:34 +0000 (21:54 +0200)]
Add xof state handing for generic sha3 absorb.

The digest life-cycle diagram specifies state transitions to `updated`
(aka XOF_STATE_ABSORB) only from `initialised` and `updated`. Add this
checking to the generic sha3 absorb implementation.

Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22221)

6 months agoSupport multiple calls of low level SHA3_squeeze() for s390x.
Holger Dengler [Wed, 27 Sep 2023 09:18:18 +0000 (11:18 +0200)]
Support multiple calls of low level SHA3_squeeze() for s390x.

The low level SHA3_Squeeze() function needed to change slightly so
that it can handle multiple squeezes. Support this on s390x
architecture as well.

Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22221)

6 months agoAdd EVP_DigestSqueeze() API.
slontis [Fri, 21 Jul 2023 05:05:38 +0000 (15:05 +1000)]
Add EVP_DigestSqueeze() API.

Fixes #7894

This allows SHAKE to squeeze multiple times with different output sizes.

The existing EVP_DigestFinalXOF() API has been left as a one shot
operation. A similar interface is used by another toolkit.

The low level SHA3_Squeeze() function needed to change slightly so
that it can handle multiple squeezes. This involves changing the
assembler code so that it passes a boolean to indicate whether
the Keccak function should be called on entry.
At the provider level, the squeeze is buffered, so that it only requests
a multiple of the blocksize when SHA3_Squeeze() is called. On the first
call the value is zero, on subsequent calls the value passed is 1.

This PR is derived from the excellent work done by @nmathewson in
https://github.com/openssl/openssl/pull/7921

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

6 months agocms demos: print signingTime attributes
James Muir [Fri, 3 Nov 2023 17:15:04 +0000 (13:15 -0400)]
cms demos: print signingTime attributes

Add a makefile for the cms demos, and add a routine to cms_ver.c to
print any signingTime attributes from the CMS_ContentInfo object.
This provides an example that could be extended if an application
wants to examine the purported signing times.

Part of #8026

Testing:

  $ cd demos/cms
  $ make test

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

6 months agoapps/list.c: Check the result of inserting a provider into provider's stack
Alexey Fofanov [Wed, 18 Oct 2023 11:23:22 +0000 (14:23 +0300)]
apps/list.c: Check the result of inserting a provider into provider's stack

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

(cherry picked from commit 15b83e04a5e125ab873ace1e474790a4a5b44647)

6 months agoFix a possible memory leak of ssl->s3.tmp.psk
Bernd Edlinger [Mon, 6 Nov 2023 09:44:27 +0000 (10:44 +0100)]
Fix a possible memory leak of ssl->s3.tmp.psk

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

6 months agoAfter a stream has implicit length don't add more stream related frames
Matt Caswell [Wed, 8 Nov 2023 10:15:25 +0000 (10:15 +0000)]
After a stream has implicit length don't add more stream related frames

Once we have decided that a stream has an implicit length then we should
treat the packet as full and not try to add any more stream related frames
to the packet.

Fixes #22658

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

6 months agoAdd config tests for including provider config files
Veronika Hanulíková [Thu, 12 Oct 2023 12:38:06 +0000 (14:38 +0200)]
Add config tests for including provider config files

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

6 months agoAdd CHANGES.md and NEWS.md entry for CVE-2023-5678
Tomas Mraz [Tue, 7 Nov 2023 14:22:00 +0000 (15:22 +0100)]
Add CHANGES.md and NEWS.md entry for CVE-2023-5678

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

(cherry picked from commit 4ee71b4c302a06c24b46a5def1cff2096bd57f0b)

6 months agoSync CHANGES.md and NEWS.md with 3.1 branch
Tomas Mraz [Tue, 7 Nov 2023 14:14:34 +0000 (15:14 +0100)]
Sync CHANGES.md and NEWS.md with 3.1 branch

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

(cherry picked from commit 2d0d3edb04ab0fa53e30e3cbdd114de9933d5361)

6 months agoQUIC TXP: Handle padding correctly for ACK_ONLY archetype
Hugo Landau [Fri, 3 Nov 2023 15:13:51 +0000 (15:13 +0000)]
QUIC TXP: Handle padding correctly for ACK_ONLY archetype

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

6 months agoQUIC TXP: Fix use of implicit-length STREAM frames in presence of PATH_REPSONSE frames
Hugo Landau [Fri, 3 Nov 2023 14:53:10 +0000 (14:53 +0000)]
QUIC TXP: Fix use of implicit-length STREAM frames in presence of PATH_REPSONSE frames

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

6 months agoadd locking around fake_now
Neil Horman [Fri, 3 Nov 2023 16:56:40 +0000 (12:56 -0400)]
add locking around fake_now

fake_now in the quictestlib is read/written by potentially many threads,
and as such should have a surrounding lock to prevent WAR/RAW errors as
caught by tsan:

2023-11-03T16:27:23.7184999Z ==================
2023-11-03T16:27:23.7185290Z WARNING: ThreadSanitizer: data race (pid=18754)
2023-11-03T16:27:23.7185720Z   Read of size 8 at 0x558f6f9fe970 by main thread:
2023-11-03T16:27:23.7186726Z     #0 qtest_create_quic_connection_ex <null> (quicapitest+0x14aead) (BuildId: d06f7b04830b55de9c8482b398a1781472d1c7d5)
2023-11-03T16:27:23.7187665Z     #1 qtest_create_quic_connection <null> (quicapitest+0x14b220) (BuildId: d06f7b04830b55de9c8482b398a1781472d1c7d5)
2023-11-03T16:27:23.7188567Z     #2 test_quic_write_read quicapitest.c (quicapitest+0x150ee2) (BuildId: d06f7b04830b55de9c8482b398a1781472d1c7d5)
2023-11-03T16:27:23.7189561Z     #3 run_tests <null> (quicapitest+0x2237ab) (BuildId: d06f7b04830b55de9c8482b398a1781472d1c7d5)
2023-11-03T16:27:23.7190294Z     #4 main <null> (quicapitest+0x223d2b) (BuildId: d06f7b04830b55de9c8482b398a1781472d1c7d5)
2023-11-03T16:27:23.7190720Z
2023-11-03T16:27:23.7190902Z   Previous write of size 8 at 0x558f6f9fe970 by thread T1:
2023-11-03T16:27:23.7191607Z     #0 qtest_create_quic_connection_ex <null> (quicapitest+0x14aecf) (BuildId: d06f7b04830b55de9c8482b398a1781472d1c7d5)
2023-11-03T16:27:23.7192505Z     #1 run_server_thread quictestlib.c (quicapitest+0x14b1d6) (BuildId: d06f7b04830b55de9c8482b398a1781472d1c7d5)
2023-11-03T16:27:23.7193361Z     #2 thread_run quictestlib.c (quicapitest+0x14cadf) (BuildId: d06f7b04830b55de9c8482b398a1781472d1c7d5)
2023-11-03T16:27:23.7193848Z
2023-11-03T16:27:23.7194220Z   Location is global 'fake_now.0' of size 8 at 0x558f6f9fe970 (quicapitest+0x1af4970)
2023-11-03T16:27:23.7194636Z
2023-11-03T16:27:23.7194816Z   Thread T1 (tid=18760, running) created by main thread at:
2023-11-03T16:27:23.7195465Z     #0 pthread_create <null> (quicapitest+0xca12d) (BuildId: d06f7b04830b55de9c8482b398a1781472d1c7d5)
2023-11-03T16:27:23.7196317Z     #1 qtest_create_quic_connection_ex <null> (quicapitest+0x14adcb) (BuildId: d06f7b04830b55de9c8482b398a1781472d1c7d5)
2023-11-03T16:27:23.7197214Z     #2 qtest_create_quic_connection <null> (quicapitest+0x14b220) (BuildId: d06f7b04830b55de9c8482b398a1781472d1c7d5)
2023-11-03T16:27:23.7198111Z     #3 test_quic_write_read quicapitest.c (quicapitest+0x150ee2) (BuildId: d06f7b04830b55de9c8482b398a1781472d1c7d5)
2023-11-03T16:27:23.7198940Z     #4 run_tests <null> (quicapitest+0x2237ab) (BuildId: d06f7b04830b55de9c8482b398a1781472d1c7d5)
2023-11-03T16:27:23.7199661Z     #5 main <null> (quicapitest+0x223d2b) (BuildId: d06f7b04830b55de9c8482b398a1781472d1c7d5)
2023-11-03T16:27:23.7200083Z
2023-11-03T16:27:23.7200862Z SUMMARY: ThreadSanitizer: data race (/home/runner/work/openssl/openssl/test/quicapitest+0x14aead) (BuildId: d06f7b04830b55de9c8482b398a1781472d1c7d5) in qtest_create_quic_connection_ex

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

6 months agoCorrect order of ossl_condvar_signal in quic_multistream_test
Neil Horman [Fri, 3 Nov 2023 16:12:38 +0000 (12:12 -0400)]
Correct order of ossl_condvar_signal in quic_multistream_test

quic_multistream test was issuing a signal on a condvar after dropping
the corresponding mutex, not before, leading to potential race
conditions in the reading of the associated data

Fixes #22588

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

6 months agoAdd unit test for #22644
Pauli [Mon, 6 Nov 2023 20:44:49 +0000 (07:44 +1100)]
Add unit test for #22644

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

6 months agoFix bug in priority queue remove function
Pauli [Mon, 6 Nov 2023 20:32:18 +0000 (07:32 +1100)]
Fix bug in priority queue remove function

The short circuit in the remove function when the element is the last in the
heap, failed to add the removed slot back to the freelist.

Fixes #22644

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

6 months agoapps/rehash.c: avoid printf format warning [-Wformat]
Matthias St. Pierre [Wed, 25 Oct 2023 09:05:58 +0000 (11:05 +0200)]
apps/rehash.c: avoid printf format warning [-Wformat]

The `aarch64-linux-android33-clang` cross-compiler (v14.0.6)
complains twice about an unsupported '%n' format specifier,
preventing a successful `--strict-warnings` build:

    error: '%n' specifier not supported on this platform [-Werror,-Wformat]
                BIO_snprintf(buf, buflen, "%s%s%n%08x.%s%d",

This is a false positive, because BIO_snprintf() implements its
own format parsing (which is implemented in the _dopr() function).

This commit fixes the problem by rewriting the code to dispense with
the dubious '%n' format specifier. As a side-effect, the code becomes
a little bit more comprehensible and self-explaining.

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

6 months agoCHANGES.md: note BLAKE2s supports BLAKE2b-like "size" setting
наб [Tue, 31 Oct 2023 19:36:31 +0000 (20:36 +0100)]
CHANGES.md: note BLAKE2s supports BLAKE2b-like "size" setting

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

6 months agoDocument BLAKE2's variable size
наб [Thu, 19 Oct 2023 22:01:28 +0000 (00:01 +0200)]
Document BLAKE2's variable size

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

6 months agoImplement BLAKE2s with the same macro as BLAKE2b
наб [Thu, 19 Oct 2023 16:31:33 +0000 (18:31 +0200)]
Implement BLAKE2s with the same macro as BLAKE2b

This avoids code duplication and provides variable-size support
for BLAKE2s like 786b9a8

Test data obtained with libb2 with the following programs:

==> b2.c <==
#include <blake2.h>
#include <unistd.h>

int main() {
char buf[16] = {};
blake2s(buf, 0, 0, 16, 0, 0);
write(1, buf, 16);
}

==> b3.c <==
#include <blake2.h>
#include <unistd.h>

int main() {
char buf[10] = {};
blake2s(buf, "\x61", 0, 10, 1, 0);
write(1, buf, 10);
}

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

6 months agoLift BLAKE2B provider definition into a macro
наб [Wed, 18 Oct 2023 16:40:07 +0000 (18:40 +0200)]
Lift BLAKE2B provider definition into a macro

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

6 months agoFix a possible memory leak in custom_ext_add
Bernd Edlinger [Mon, 6 Nov 2023 10:03:05 +0000 (11:03 +0100)]
Fix a possible memory leak in custom_ext_add

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

6 months agoquic http3 demo: minor updates
James Muir [Sun, 29 Oct 2023 19:24:08 +0000 (15:24 -0400)]
quic http3 demo: minor updates

-update run command to include LD_LIBRARY_PATH
-suggest installing libnghttp3-dev on Ubuntu
-drop "-f" from clean recipe (it is already included in $(RM))

Part of https://github.com/openssl/project/issues/253

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