]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
8 months ago04-test_encoder_decoder.t: Add } omitted in a backport
Tomas Mraz [Fri, 29 Nov 2024 17:55:13 +0000 (18:55 +0100)] 
04-test_encoder_decoder.t: Add } omitted in a backport

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

8 months agoFix EVP_PKEY_print_private() so that it works with non default providers.
slontis [Wed, 20 Nov 2024 01:39:35 +0000 (12:39 +1100)] 
Fix EVP_PKEY_print_private() so that it works with non default providers.

At some point in time it was decided that the EC keymanagers ec_export()
function would only allow the selection to be both the public + private
parts. If just the private element is selected it returns an error.
Many openssl commandline apps use EVP_PKEY_print_private() which passes
EVP_PKEY_PRIVATE_KEY to the encoder. This selection propagates to
encoder_construct_pkey(). For external providers (such as the fips
provider this will call the keymanagers export() with the selection set
to just the private part.

So we either need to
1) change the selection in EVP_PKEY_print_private() or
2) modify the selection used in the export used in
   encoder_construct_pkey
3) Change the ec_export to allow this.

I have chosen 2) but I am not sure if this is the correct thing to do
or whether it should conditionally do this when the output_type ==
'text'.

Issue was reported by Ilia Okomin (Oracle).

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

(cherry picked from commit 79c98fc6ccab49f02528e06cc046ac61f841a753)

8 months agodie() in .tmpl file should not be silently ignored.
Alexandr Nedvedicky [Tue, 26 Nov 2024 08:05:09 +0000 (09:05 +0100)] 
die() in .tmpl file should not be silently ignored.

call to die() in perl templates is currently ignored.
any error printed by die() commad appears in template
output.

In order to make sure die() terminates processing we
must ensure we emite `undef` value. This is ensured
by adding a `BROKEN` callback to `fill_in()` Template
method. The callback must return undef to stop processing.

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

(cherry picked from commit 578760bb6aae6a9d7f3805eea66bab124d06c9b0)

8 months agoDocument expected BIO operations for libssl
David Benjamin [Mon, 25 Nov 2024 16:01:17 +0000 (11:01 -0500)] 
Document expected BIO operations for libssl

If your custom BIO does not implement BIO_CTRL_FLUSH, it won't work, but
this is not document anywhere.

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

(cherry picked from commit 847a23757f7cbebaa882e15087efb926113a0670)

8 months agoSkip Asymmetric RSA corruption test for >=3.5 FIPS provider
Tomas Mraz [Mon, 25 Nov 2024 09:58:56 +0000 (10:58 +0100)] 
Skip Asymmetric RSA corruption test for >=3.5 FIPS provider

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

(cherry picked from commit e50d4bac9d9018f09427f4600062a7415c1bdfc8)

8 months agoopenssl-pkeyutl.pod.in: improve description of -rawin and -digest options
Dr. David von Oheimb [Wed, 30 Oct 2024 19:37:38 +0000 (20:37 +0100)] 
openssl-pkeyutl.pod.in: improve description of -rawin and -digest options

Fixes #25827

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

(cherry picked from commit e26d56d2198fd4a0f7fbd62471a30af05539e38d)

8 months agoopenssl-pkeyutl.pod.in: add that -sign is default op, update claim on hash needed...
Dr. David von Oheimb [Tue, 29 Oct 2024 18:20:59 +0000 (19:20 +0100)] 
openssl-pkeyutl.pod.in: add that -sign is default op, update claim on hash needed for -sign/-verify, etc.

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

(cherry picked from commit 20c20b985a6c6d1f7b758a865fc96530c7b0c7b0)

8 months agoFix potential memory leak on failure of ecx_gen_init()
Niels Dossche [Wed, 20 Nov 2024 18:57:38 +0000 (19:57 +0100)] 
Fix potential memory leak on failure of ecx_gen_init()

When ecx_gen_set_params() returns 0, it could have duplicated the memory
for the parameter OSSL_KDF_PARAM_PROPERTIES already in gctx->propq,
leading to a memory leak.

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

(cherry picked from commit 98be2e8fb60aaece2e4c3d42e87671fe22c081a2)

8 months agoFix potential memory leak on failure of dsa_gen_init()
Niels Dossche [Wed, 20 Nov 2024 19:22:43 +0000 (20:22 +0100)] 
Fix potential memory leak on failure of dsa_gen_init()

When dsa_gen_set_params()  returns 0, it could have duplicated the memory for the parameter
OSSL_PKEY_PARAM_FFC_DIGEST already in gctx->mdname, leading to a memory leak.

Allocated here: https://github.com/openssl/openssl/blob/47a80fd2034cd4314d3b4958539dcd3106087109/providers/implementations/keymgmt/dsa_kmgmt.c#L524
Can return 0 here: https://github.com/openssl/openssl/blob/47a80fd2034cd4314d3b4958539dcd3106087109/providers/implementations/keymgmt/dsa_kmgmt.c#L529-L536

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

(cherry picked from commit d7e8f6f7816f2be3ab5e498d180424940fd58695)

8 months agoMark OPENSSL_armcap_P .hidden in arm asm
Kai Pastor [Sat, 23 Sep 2023 18:22:03 +0000 (20:22 +0200)] 
Mark OPENSSL_armcap_P .hidden in arm asm

Fixes #25601
Fixes #22414

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

(cherry picked from commit e131868678085f29adf90db8bd8058e9f2c8c6b0)

8 months agobuild_wincrypt_test.c: Fix compilation with MSVC
Mathias Berchtold [Fri, 21 Apr 2023 23:16:39 +0000 (17:16 -0600)] 
build_wincrypt_test.c: Fix compilation with MSVC

Fixes issue https://github.com/openssl/openssl/issues/20805

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(cherry picked from commit b5a635dc2113e1bc807ea358a670146c813df989)

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

8 months agosm2_sig_verify(): Do not call BN_CTX_end() without BN_CTX_start()
Tomas Mraz [Tue, 19 Nov 2024 10:09:58 +0000 (11:09 +0100)] 
sm2_sig_verify(): Do not call BN_CTX_end() without BN_CTX_start()

In case of memory allocation failure this
could happen.

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

(cherry picked from commit 93bfe97c5be0ca575411b39c9dec1103caa82f51)

8 months agoci.yml: Remove remaining hack for self-hosted worker
Tomas Mraz [Fri, 15 Nov 2024 17:01:38 +0000 (18:01 +0100)] 
ci.yml: Remove remaining hack for self-hosted worker

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/25964)

8 months agoremove ternary from runs-on, security repo is hosted on github.com
Dmitry Misharov [Wed, 13 Nov 2024 14:35:43 +0000 (15:35 +0100)] 
remove ternary from runs-on, security repo is hosted on github.com

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

(cherry picked from commit 5c5b8d2d7c59fc48981861629bb0b75a03497440)

8 months agoman ECDSA_sign(3): fix wrong variable names
Alicja Kario [Mon, 11 Nov 2024 13:33:46 +0000 (14:33 +0100)] 
man ECDSA_sign(3): fix wrong variable names

the parameters in the function definitions use `siglen` not `sig_len`,
this fixes the doc text.

Signed-off-by: Alicja Kario <hkario@redhat.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25927)

(cherry picked from commit eaf4da97c9b9c09a407b9f1a47ad7dd99c05884c)

8 months agoapps/speed.c: Fix the benchmarking for AEAD ciphers
Mohammed Alhabib [Fri, 8 Nov 2024 11:40:49 +0000 (14:40 +0300)] 
apps/speed.c: Fix the benchmarking for AEAD ciphers

Fixed the benchmarking for the evp aead interface for ccm, gcm, ocb, and siv,
where decryption fails when executing
`openssl speed -evp aes-128-ccm -decrypt` and
`openssl speed -evp aes-128-gcm -decrypt`.

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

8 months agoFix error handling in CMS_EncryptedData_encrypt
Bernd Edlinger [Thu, 7 Sep 2023 16:05:44 +0000 (18:05 +0200)] 
Fix error handling in CMS_EncryptedData_encrypt

That caused several memory leaks in case of error.
Also when the CMS object that is created by CMS_EncryptedData_encrypt
is not used in the normal way, but instead just deleted
by CMS_ContentInfo_free some memory was lost.

Fixes #21985

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

8 months agoBugfixes for params to legacy control translations for EC parameters
Vladimirs Ambrosovs [Wed, 1 Nov 2023 11:18:14 +0000 (13:18 +0200)] 
Bugfixes for params to legacy control translations for EC parameters

param->ctrl translation: Fix fix_ecdh_cofactor()

In POST_PARAMS_TO_CTRL state the fix_ecdh_cofactor() function should
return value in ctx->p1

param->ctrl translation: fix evp_pkey_ctx_setget_params_to_ctrl
 return

Since some of the ctrl operations may return 0 as valid value
(e.g. ecdh_cofactor value 0 is valid setting), before colling
POST_PARAMS_TO_CTRL, we need to check return value for 0 as well
otherwise the evp_pkey_ctx_setget_params_to_ctrl function fails
without a chance to fix the return value

param->ctrl translation: Set ecdh_cofactor default action_type GET

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

(cherry picked from commit 2aaef03339a88e5d693f278406a889657b10fd2d)

8 months agoAdjust naming authority formatting when printing out admission extension
oleg.hoefling [Mon, 28 Oct 2024 08:23:59 +0000 (09:23 +0100)] 
Adjust naming authority formatting when printing out admission extension

Indent namingAuthority section with two spaces to match the parent
node.

Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25814)

(cherry picked from commit 85a52f7292cb57662f823e4ac1a303f56d0531bf)

8 months agoFix memory leak on failure in copy_issuer()
Niels Dossche [Tue, 5 Nov 2024 15:11:56 +0000 (16:11 +0100)] 
Fix memory leak on failure in copy_issuer()

When sk_GENERAL_NAME_reserve() fails, ialt is not freed.
Add the freeing operation in the common error path.

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

(cherry picked from commit fa856b0ce0f527d2f80c10c8c288201ace4a9efa)

8 months agoFix smime-type for AuthEnvelopedData
Jakub Zelenka [Tue, 17 Sep 2024 13:21:33 +0000 (14:21 +0100)] 
Fix smime-type for AuthEnvelopedData

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

(cherry picked from commit 4c8c37e5720ac08cb777499a92b48fdae5aace9a)

8 months agoFix uses of `EVP_PKEY_Q_keygen` with `size_t` variadic argument
ArtSin [Mon, 4 Nov 2024 08:56:52 +0000 (12:56 +0400)] 
Fix uses of `EVP_PKEY_Q_keygen` with `size_t` variadic argument

Fix cases where `int` argument was passed instead of `size_t`.

CLA: trivial

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

(cherry picked from commit ccaa754b5f66cc50d8ecbac48b38268e2acd715e)

8 months agoFix the default_md example in the ca docs
Matt Caswell [Mon, 4 Nov 2024 09:00:32 +0000 (09:00 +0000)] 
Fix the default_md example in the ca docs

We should not have an example showing the default_md as md5.

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

(cherry picked from commit d1669a14d129c9b12c8ef5ccd3545273e50aad0f)

9 months agoFix incorrect openssl-smime doc sample command for encrypt
Zheyu Shen [Wed, 30 Oct 2024 08:34:12 +0000 (08:34 +0000)] 
Fix incorrect openssl-smime doc sample command for encrypt

Original documented sample command causes error. PEM recipient cert argument needs to go last.

CLA: trivial

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

(cherry picked from commit 1d160dbf39fbdba89389ddff54e45bacf278b04a)

9 months agofix: util/check-format-commit.sh - fix ending check
Richard Levitte [Sun, 27 Oct 2024 10:15:21 +0000 (11:15 +0100)] 
fix: util/check-format-commit.sh - fix ending check

Look at the end result instead of the file name it's stored in

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

(cherry picked from commit 4c29044a83e1926a31ebb5ab8e01fabd0c9e240a)

9 months agoFix ambiguous output of Signature Algorithms
Bernd Edlinger [Thu, 24 Oct 2024 20:29:48 +0000 (22:29 +0200)] 
Fix ambiguous output of Signature Algorithms

Signature Algorithms are printed in a SIG+HASH format.
In some cases this is ambiguous like brainpool and RSA-PSS.
And the name of ed25519 and ed448 must be spelled in lower case,
so that the output can be used as a -sigalgs parameter value.

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

(cherry picked from commit f30d6ba455e06572250e75132045eedde5d1daf0)

9 months agocheck-format-commit.sh: various improvements; check unstaged changes on empty commit...
Dr. David von Oheimb [Fri, 11 Oct 2024 06:12:38 +0000 (08:12 +0200)] 
check-format-commit.sh: various improvements; check unstaged changes on empty commit range

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

(cherry picked from commit 80026e5d9e934907f5847d69ca0d8189765af6f3)

9 months agocheck-format-commit.sh: make awk patterns more robust for MacOS and certain flavors...
Dr. David von Oheimb [Thu, 10 Oct 2024 20:13:42 +0000 (22:13 +0200)] 
check-format-commit.sh: make awk patterns more robust for MacOS and certain flavors of Linux

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

(cherry picked from commit 380ea5974cc5fec47dd5ee6280e34a1b3d0313c5)

9 months agocheck-format-commit: call fewer unneeded processes
Beat Bolli [Sat, 17 Aug 2024 15:34:14 +0000 (17:34 +0200)] 
check-format-commit: call fewer unneeded processes

`wc` does not output a file name if the input is stdin.

`awk` reads its file argument; there's no need for `cat`.

`sort -u` outputs unique lines. It should be supported on all platforms,
as it's specified by POSIX.

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

(cherry picked from commit 0d6544cdf845f7950c50680059c976cb507b6e45)

9 months agoFix typos found by codespell
Dimitri Papadopoulos [Sun, 21 Jul 2024 09:32:06 +0000 (11:32 +0200)] 
Fix typos found by codespell

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24949)

(cherry picked from commit 7d91d5ba35a69808f6083695ed1f83570ae0a43e restricted to util/check-format-commit.sh)

9 months agofix: util/check-format-commit.sh to handle one-line diff hunks
Richard Levitte [Tue, 16 Jul 2024 03:28:30 +0000 (05:28 +0200)] 
fix: util/check-format-commit.sh to handle one-line diff hunks

For multi-line hunks, 'git diff -U0' outputs a pair of START,COUNT
indicators to show where the hunk starts and ends.  However, if the hunk is
just one line, only START is output, with the COUNT of 1 being implied.
Typically, this happens for copyright change hunks, like this:

    --- a/crypto/evp/evp_err.c
    +++ b/crypto/evp/evp_err.c
    @@ -3 +3 @@
    - * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.
    + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved.

This is normal unified diff output, and our script must adapt.

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

(cherry picked from commit 7821b7b9774d481ae92610e2d132ea34d4aaf407)

9 months agoConvert check-format-commits.sh to use allowlist
Neil Horman [Fri, 12 Jul 2024 11:25:20 +0000 (07:25 -0400)] 
Convert check-format-commits.sh to use allowlist

Initially check-format-commits.sh tried to check everything, using a
banlist to exlude files not appropriate for checking.

Its becoming clear that that approach isn't workable, given that the
number of files that we should not check far outweighs the number of
files that we should check.

Ideally we should be checking .c files, .h files and their .in
counterparts, everything else should be excluded (at least for now)

convert the script to using an allowlist, only checking the above list,
and ignoring everything else

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/24865)

(cherry picked from commit 42230f294ae97cbd50052038499e091d0060ba8e)

9 months agofeat: enhance util/check-format-commit.sh to be able to handle a commit range
Richard Levitte [Thu, 11 Jul 2024 10:40:29 +0000 (12:40 +0200)] 
feat: enhance util/check-format-commit.sh to be able to handle a commit range

Additionally, the 'git diff' call is modified to not show context lines, as
it's confusing to have style nits displayed on lines the author of the
commits hasn't touched.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24856)

(cherry picked from commit c2083f4ec608b14b48a43c5d56798a01f1cf4931)

9 months agoignore various files in commit checker
Neil Horman [Wed, 10 Jul 2024 18:04:46 +0000 (14:04 -0400)] 
ignore various files in commit checker

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

(cherry picked from commit 861e1f450c808bdf675bbf0d3e17303a3f16d06c)

9 months agoDependabot update
dependabot[bot] [Thu, 24 Oct 2024 17:45:24 +0000 (17:45 +0000)] 
Dependabot update

CLA: trivial

(deps): Bump actions/setup-python

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.2.0 to 5.3.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5.2.0...v5.3.0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25795)

(cherry picked from commit 06aa41a5f529fc2081793c8bfb36c7e2727665d5)

9 months agoNEWS.md: Fix the latest version
Tomas Mraz [Tue, 22 Oct 2024 12:46:31 +0000 (14:46 +0200)] 
NEWS.md: Fix the latest version

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/25769)

9 months agoTRACE: automatically respect disabled categories
Dr. David von Oheimb [Wed, 9 Oct 2024 20:05:19 +0000 (22:05 +0200)] 
TRACE: automatically respect disabled categories

by fixing OSSL_trace_begin() to return NULL when given category is not enabled

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

(cherry picked from commit 72d3e9bac41302e5bc00db1bef014b0ca810d2cf)

9 months agoAdd CHANGES.md and NEWS.md entries for CVE-2024-9143
Tomas Mraz [Fri, 18 Oct 2024 11:51:37 +0000 (13:51 +0200)] 
Add CHANGES.md and NEWS.md entries for CVE-2024-9143

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/25734)

(cherry picked from commit 233034bc5a294b26d37186dc68d7d6d8357d889a)

9 months agofix: let util/mkbuildinf.pl use SOURCE_DATE_EPOCH, even if it's zero
Richard Levitte [Tue, 15 Oct 2024 12:25:34 +0000 (14:25 +0200)] 
fix: let util/mkbuildinf.pl use SOURCE_DATE_EPOCH, even if it's zero

Doing this allows reproducible builds, for those who want this.

Fixes #25475

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

(cherry picked from commit 7b36037e2201ea6927458c1b5fc31502d0747b6f)

9 months agoDependabot update
dependabot[bot] [Tue, 15 Oct 2024 17:29:43 +0000 (17:29 +0000)] 
Dependabot update

CLA: trivial

(deps): Bump coverallsapp/github-action

Bumps [coverallsapp/github-action](https://github.com/coverallsapp/github-action) from 2.3.0 to 2.3.2.
- [Release notes](https://github.com/coverallsapp/github-action/releases)
- [Commits](https://github.com/coverallsapp/github-action/compare/v2.3.0...v2.3.2)

---
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>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25701)

(cherry picked from commit e524ac548a628e4cef9fd5e722720c0fd48f41a8)

9 months agoHarden BN_GF2m_poly2arr against misuse.
Viktor Dukhovni [Wed, 18 Sep 2024 15:02:40 +0000 (01:02 +1000)] 
Harden BN_GF2m_poly2arr against misuse.

The BN_GF2m_poly2arr() function converts characteristic-2 field
(GF_{2^m}) Galois polynomials from a representation as a BIGNUM bitmask,
to a compact array with just the exponents of the non-zero terms.

These polynomials are then used in BN_GF2m_mod_arr() to perform modular
reduction.  A precondition of calling BN_GF2m_mod_arr() is that the
polynomial must have a non-zero constant term (i.e. the array has `0` as
its final element).

Internally, callers of BN_GF2m_poly2arr() did not verify that
precondition, and binary EC curve parameters with an invalid polynomial
could lead to out of bounds memory reads and writes in BN_GF2m_mod_arr().

The precondition is always true for polynomials that arise from the
standard form of EC parameters for characteristic-two fields (X9.62).
See the "Finite Field Identification" section of:

    https://www.itu.int/ITU-T/formal-language/itu-t/x/x894/2018-cor1/ANSI-X9-62.html

The OpenSSL GF(2^m) code supports only the trinomial and pentanomial
basis X9.62 forms.

This commit updates BN_GF2m_poly2arr() to return `0` (failure) when
the constant term is zero (i.e. the input bitmask BIGNUM is not odd).

Additionally, the return value is made unambiguous when there is not
enough space to also pad the array with a final `-1` sentinel value.
The return value is now always the number of elements (including the
final `-1`) that would be filled when the output array is sufficiently
large.  Previously the same count was returned both when the array has
just enough room for the final `-1` and when it had only enough space
for non-sentinel values.

Finally, BN_GF2m_poly2arr() is updated to reject polynomials whose
degree exceeds `OPENSSL_ECC_MAX_FIELD_BITS`, this guards against
CPU exhausition attacks via excessively large inputs.

The above issues do not arise in processing X.509 certificates.  These
generally have EC keys from "named curves", and RFC5840 (Section 2.1.1)
disallows explicit EC parameters.  The TLS code in OpenSSL enforces this
constraint only after the certificate is decoded, but, even if explicit
parameters are specified, they are in X9.62 form, which cannot represent
problem values as noted above.

Initially reported as oss-fuzz issue 71623.

A closely related issue was earlier reported in
<https://github.com/openssl/openssl/issues/19826>.

Severity: Low, CVE-2024-9143

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25639)

(cherry picked from commit 8e008cb8b23ec7dc75c45a66eeed09c815b11cd2)

9 months agodoc backport: clean up and move doc of OPENSSL_TRACE from man1/openssl.pod to man7...
Dr. David von Oheimb [Wed, 25 Sep 2024 10:18:12 +0000 (12:18 +0200)] 
doc backport: clean up and move doc of OPENSSL_TRACE from man1/openssl.pod to man7/openssl-env.pod

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

9 months agoreplace various calls to sprintf() by BiO_snprintf() to avoid compiler warnings,...
Dr. David von Oheimb [Tue, 24 Sep 2024 19:24:39 +0000 (21:24 +0200)] 
replace various calls to sprintf() by BiO_snprintf() to avoid compiler warnings, e.g., on MacOS

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

(cherry picked from commit 2c536c8b1554da273103235adabf946fb7f5a041)

9 months agoFix memory leak in tls_parse_ctos_psk()
Niels Dossche [Wed, 9 Oct 2024 13:42:37 +0000 (15:42 +0200)] 
Fix memory leak in tls_parse_ctos_psk()

`sess` is not NULL at this point, and is freed on the success path, but
not on the error path. Fix this by going to the `err` label such that
`SSL_SESSION_free(sess)` is called.

CLA: trivial

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

(cherry picked from commit b2474b287fbc7a24f0aa15e6808c6e3ef8287f23)

9 months agoFix potential double free through SRP_user_pwd_set1_ids()
Niels Dossche [Wed, 9 Oct 2024 21:00:13 +0000 (23:00 +0200)] 
Fix potential double free through SRP_user_pwd_set1_ids()

If SRP_user_pwd_set1_ids() fails during one of the duplications, or id
is NULL, then the old pointer values are still stored but they are now dangling.
Later when SRP_user_pwd_free() is called these are freed again,
leading to a double free.

Although there are no such uses in OpenSSL as far as I found,
it's still a public API.

CLA: trivial

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

(cherry picked from commit 792b2c8da283d4230caa761ea6f5d050cb5795e7)

9 months agoAvoid undefined behaviour with the <ctype.h> functions.
Taylor R Campbell [Wed, 29 Mar 2023 05:48:44 +0000 (05:48 +0000)] 
Avoid undefined behaviour with the <ctype.h> functions.

fix https://github.com/openssl/openssl/issues/25112

As defined in the C standard:

   In all cases the argument is an int, the value of which shall
   be representable as an unsigned char or shall equal the value
   of the macro EOF.  If the argument has any other value, the
   behavior is undefined.

This is because they're designed to work with the int values returned
by getc or fgetc; they need extra work to handle a char value.

If EOF is -1 (as it almost always is), with 8-bit bytes, the allowed
inputs to the ctype.h functions are:

   {-1, 0, 1, 2, 3, ..., 255}.

However, on platforms where char is signed, such as x86 with the
usual ABI, code like

   char *p = ...;
   ... isspace(*p) ...

may pass in values in the range:

   {-128, -127, -126, ..., -2, -1, 0, 1, ..., 127}.

This has two problems:

1. Inputs in the set {-128, -127, -126, ..., -2} are forbidden.

2. The non-EOF byte 0xff is conflated with the value EOF = -1, so
   even though the input is not forbidden, it may give the wrong
   answer.

Casting char inputs to unsigned char first works around this, by
mapping the (non-EOF character) range {-128, -127, ..., -1} to {128,
129, ..., 255}, leaving no collisions with EOF.  So the above
fragment needs to be:

   char *p = ...;
   ... isspace((unsigned char)*p) ...

This patch inserts unsigned char casts where necessary.  Most of the
cases I changed, I compile-tested using -Wchar-subscripts -Werror on
NetBSD, which defines the ctype.h functions as macros so that they
trigger the warning when the argument has type char.  The exceptions
are under #ifdef __VMS or #ifdef _WIN32.  I left alone calls where
the input is int where the cast would obviously be wrong; and I left
alone calls where the input is already unsigned char so the cast is
unnecessary.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25113)

(cherry picked from commit 99548cd16e9dfd850a3958e417b9e02950f208f4)

9 months agodoc: EVP_KDF document the semantic meaning of output
Dimitri John Ledkov [Fri, 4 Oct 2024 22:41:44 +0000 (23:41 +0100)] 
doc: EVP_KDF document the semantic meaning of output

Explicitely document what semantic meaning do various EVP_KDF
algorithms produce.

PBKDF2 produces cryptographic keys that are subject to cryptographic
security measures, for example as defined in NIST SP 800-132.

All other algorithms produce keying material, not subject to explicit
output length checks in any known standards.

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

(cherry picked from commit 6f08353a4b816fc04ab53880855b0d79c833e777)

9 months agoIncrease limit for CRL download
Dmitry Belyavskiy [Fri, 4 Oct 2024 15:07:38 +0000 (17:07 +0200)] 
Increase limit for CRL download

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

(cherry picked from commit cdbe47bf3c02979183d1f66b42c511a18a63c61d)

9 months agoDocumenting CRL download usage and restrictions
Dmitry Belyavskiy [Fri, 4 Oct 2024 15:06:38 +0000 (17:06 +0200)] 
Documenting CRL download usage and restrictions

Fixes #25603

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

(cherry picked from commit e647220c00bb1da0518f8a31ed07b2a0977a3c9e)

9 months agoevp_libctx_test: fix provider compat CI regression
Pauli [Mon, 7 Oct 2024 23:38:26 +0000 (10:38 +1100)] 
evp_libctx_test: fix provider compat CI regression

The regression was introduced by #25522.

Fixes #25632

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

(cherry picked from commit 73e720c3a5164d28ffbcbf06aa88ecdfd8b2fe7f)

9 months agoFix potential memory leak in save_statusInfo()
Niels Dossche [Thu, 3 Oct 2024 14:58:30 +0000 (16:58 +0200)] 
Fix potential memory leak in save_statusInfo()

If sk_ASN1_UTF8STRING_push() fails then the duplicated string will leak
memory. Add a ASN1_UTF8STRING_free() to fix this.

CLA: trivial

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

(cherry picked from commit 0a2a8d970f408af595fd699b2675ba45a26c169b)

9 months agoFix potential memory leak in PKCS7_signatureVerify()
Niels Dossche [Wed, 2 Oct 2024 19:53:52 +0000 (21:53 +0200)] 
Fix potential memory leak in PKCS7_signatureVerify()

Fixes #25594

The code jumps to an error block when EVP_VerifyUpdate fails.
This error block does not free abuf.
In the success path the abuf memory is freed.
Move the free operation to the error block.

CLA: trivial

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

(cherry picked from commit d8b7a6eae9383fced785b9f4e2f24da0dc0a082d)

9 months agoAdd some documentation to describe the encap/decap requirements
Neil Horman [Fri, 27 Sep 2024 13:33:35 +0000 (09:33 -0400)] 
Add some documentation to describe the encap/decap requirements

Document the fact that we now require unwrappedlen/wrappedlen to be set
to the size of the unwrapped/wrapped buffers

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

(cherry picked from commit 1c1223ff535944de880a23cbf0ef9bba6092b0d9)

9 months agoAdjust tests to fetch the output len for EVP_PKEY_[en|de]cap
Neil Horman [Tue, 24 Sep 2024 17:54:14 +0000 (13:54 -0400)] 
Adjust tests to fetch the output len for EVP_PKEY_[en|de]cap

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

(cherry picked from commit 796b2caa9e2f0c1cc0a5421d553178ff80c06d51)

9 months agoUpdate rsasve_recover to properly store outlen on success
Neil Horman [Mon, 23 Sep 2024 18:14:18 +0000 (14:14 -0400)] 
Update rsasve_recover to properly store outlen on success

Outlen was never validated in this function prior to use, nor is it set
to the decrypted value on sucess.  Add both of those operations

Fixes #25509

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

(cherry picked from commit 0f9516855e3139ef999b58f2fa551afb3b6c2b15)

10 months agoUse the correct length value for input salt
Simo Sorce [Mon, 30 Sep 2024 13:25:48 +0000 (09:25 -0400)] 
Use the correct length value for input salt

In this function the salt can be either a zero buffer of exactly mdlen
length, or an arbitrary salt of prevsecretlen length.
Although in practice OpenSSL will always pass in a salt of mdlen size
bytes in the current TLS 1.3 code, the openssl kdf command can pass in
arbitrary values (I did it for testing), and a future change in the
higher layer code could also result in unmatched lengths.

If prevsecretlen is > mdlen this will cause incorrect salt expansion, if
prevsecretlen < mdlen this could cause a crash or reading random
information. Inboth case the generated output would be incorrect.

Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25579)

(cherry picked from commit 5c91f70ba8f07eeeb02b6c285479e4482443a6fe)

10 months agodocs: document options added in openssl-fipsinstall 3.1+
Dimitri John Ledkov [Mon, 30 Sep 2024 09:46:28 +0000 (10:46 +0100)] 
docs: document options added in openssl-fipsinstall 3.1+

Document new command line options added in 3.1.0

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

(cherry picked from commit 1b52b24aa4deb76831a56afb0aa7a101877cd457)

10 months agodocs: add HISTORY section to openssl-fipsinstall (3.0+)
Dimitri John Ledkov [Mon, 30 Sep 2024 09:45:28 +0000 (10:45 +0100)] 
docs: add HISTORY section to openssl-fipsinstall (3.0+)

Documents when the command was added.

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

(cherry picked from commit 634d84324a463317cea52510c62d8bafc2ff1eb0)

10 months agoBackport CMS test fix for FIPS DH/ECDH SHA1.
slontis [Mon, 30 Sep 2024 04:09:08 +0000 (14:09 +1000)] 
Backport CMS test fix for FIPS DH/ECDH SHA1.

Related to PR #25517

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

(cherry picked from commit 0300691dd1384bc21eb9175f854bd280944eb41c)

10 months agoFix examples in EVP_PKEY_encapsulate/decapsulate documentation
Зишан Мирза [Thu, 12 Sep 2024 14:01:21 +0000 (16:01 +0200)] 
Fix examples in EVP_PKEY_encapsulate/decapsulate documentation

Fixes #25448

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

(cherry picked from commit 4f899849ceec7cd8e45da9aa1802df782cf80202)

10 months agoRemove double engine reference in ossl_ec_key_dup()
Зишан Мирза [Mon, 16 Sep 2024 21:20:58 +0000 (23:20 +0200)] 
Remove double engine reference in ossl_ec_key_dup()

Fixes #25260

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

(cherry picked from commit ffc5a29608fdbd346e340a65a43ebadc90bd4a33)

10 months agoFix NULL ptr dereference on EC_POINT *point
Shawn C [Thu, 19 Sep 2024 17:14:09 +0000 (17:14 +0000)] 
Fix NULL ptr dereference on EC_POINT *point

Use non-usual params of pkcs11 module will trigger a null ptr deref bug. Fix it for #25493

CLA: trivial

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

(cherry picked from commit 8ac42a5f418cbe2797bc423b694ac5af605b5c7a)

10 months ago80-test_cmp_http_data/test_connection.csv: disable tests using 'localhost' or '::1'
Dr. David von Oheimb [Tue, 24 Sep 2024 17:17:03 +0000 (19:17 +0200)] 
80-test_cmp_http_data/test_connection.csv: disable tests using 'localhost' or '::1'

This is a trivial 'backport' of commit 1ef3032eacab60f2ed5dcfc93caeee0134351d2d fixing #22467

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

(cherry picked from commit 0158f84b3e26091300702d53f550734228c1cbfc)

10 months agodoc/man{1,3}: fix details on IPv6 host addresses and of whitespace in no_proxy
David von Oheimb [Thu, 1 Aug 2024 19:36:02 +0000 (21:36 +0200)] 
doc/man{1,3}: fix details on IPv6 host addresses and of whitespace in no_proxy

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/25533)

(cherry picked from commit 28970d1d36f851b3731707f839b90870b2c0f349)

10 months agoOSSL_HTTP_adapt_proxy(): fix handling of escaped IPv6 host addresses and of whitespac...
David von Oheimb [Thu, 1 Aug 2024 19:33:18 +0000 (21:33 +0200)] 
OSSL_HTTP_adapt_proxy(): fix handling of escaped IPv6 host addresses and of whitespace in no_proxy

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/25533)

(cherry picked from commit b59b74fd07ed541df9d555dc62ca6dd3ac97365b)

10 months agoOSSL_HTTP_open(): fix completion with default port for IPv6 host addresses
David von Oheimb [Thu, 1 Aug 2024 19:25:44 +0000 (21:25 +0200)] 
OSSL_HTTP_open(): fix completion with default port for IPv6 host addresses

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/25533)

(cherry picked from commit a78da17491c4d9a8230508d13c047c4da736cc25)

10 months agohttp_server.{c,h}: make clear that IPv4 or IPv6 is used by http_server_init()
David von Oheimb [Wed, 31 Jul 2024 17:36:16 +0000 (19:36 +0200)] 
http_server.{c,h}: make clear that IPv4 or IPv6 is used by http_server_init()

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/25533)

(cherry picked from commit 4c91e96390ab6bdbd73decca0a342c679b583e68)

10 months agohttp_server.c: fix checks of error return code in http_server_init()
David von Oheimb [Wed, 31 Jul 2024 17:32:44 +0000 (19:32 +0200)] 
http_server.c: fix checks of error return code in http_server_init()

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/25533)

(cherry picked from commit 755dca7b02cab01c228cd4ace3a254fec0a055eb)

10 months agoBIO_s_accept.pod: fix whitespace nits: '<=0' -> '<= 0'
David von Oheimb [Wed, 31 Jul 2024 17:32:07 +0000 (19:32 +0200)] 
BIO_s_accept.pod: fix whitespace nits: '<=0' -> '<= 0'

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/25533)

(cherry picked from commit f85fb6196019fbfe8e024e96e2537367293b7b24)

10 months agoThe canonical localhost IPv6 address is [::1] not [::]
Tomas Mraz [Wed, 23 Aug 2023 20:24:45 +0000 (22:24 +0200)] 
The canonical localhost IPv6 address is [::1] not [::]

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/25533)

(cherry picked from commit 945df058801cdb14af58f3529068955cb1af4828)

10 months agohttp_server.c: allow clients to connect with IPv6
Dr. David von Oheimb [Tue, 23 May 2023 19:54:26 +0000 (21:54 +0200)] 
http_server.c: allow clients to connect with IPv6

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

(cherry picked from commit 9190c84259454ffbd9517d77a561b3942ec32e20)

10 months agocheck-format.pl: do checks regarding statement/block after for() also on {OSSL_,...
Dr. David von Oheimb [Tue, 24 Sep 2024 20:00:59 +0000 (22:00 +0200)] 
check-format.pl: do checks regarding statement/block after for() also on {OSSL_,}LIST_FOREACH{,_*}

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

(cherry picked from commit 91ec19e92e6cf8fd3b1699dc140460b9ffa14b58)

10 months agodocument the format of DSA signature
Vladimir Kotal [Wed, 6 Mar 2024 14:37:58 +0000 (15:37 +0100)] 
document the format of DSA signature

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

(cherry picked from commit e7abc2118f5d06d560b6de978f178e4b0537f06b)

10 months agodoc/man3/OSSL_PARAM.pod: Correct the type of data_type
Alex Shaindlin [Wed, 18 Sep 2024 09:29:19 +0000 (12:29 +0300)] 
doc/man3/OSSL_PARAM.pod: Correct the type of data_type

CLA: trivial

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/25486)

(cherry picked from commit f5a8f65b8069b8c6119e7d2ca2a25219b95afdc1)

10 months agoClarify Tag Length Setting in OCB Mode
erbsland-dev [Tue, 10 Sep 2024 17:20:17 +0000 (19:20 +0200)] 
Clarify Tag Length Setting in OCB Mode

Fixes #8331: Updated the description for setting the tag length in OCB mode to remove the misleading “when encrypting” and “during encryption” phrasing. This change emphasizes that setting a custom tag length requires a call with NULL, applicable to both encryption and decryption contexts.

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

(cherry picked from commit 1299699a90967c3a0b236e552d92dc307d0d6da3)

10 months agoFix big-endian Power10 chacha20 implementation
Paul E. Murphy [Tue, 17 Sep 2024 15:22:58 +0000 (15:22 +0000)] 
Fix big-endian Power10 chacha20 implementation

Some of the BE specific permutes were incorrect. Fix them.

This passes all tests on a P10/ppc64 debian unstable host.

Fixes #25451

CLA: trivial

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

(cherry picked from commit daead12df04e2257bd5f2f8441a3c2965ef102ee)

10 months agoBuild: Fix circular object deps with old GCC
Orgad Shaneh [Thu, 12 Sep 2024 20:23:46 +0000 (23:23 +0300)] 
Build: Fix circular object deps with old GCC

When both -o and -MT are used, GCC 4.1 prints the object file twice in
the dependency file. e.g.:

foo.o foo.o: foo.c

If the file name is long, then the second occurrence moves to the next
line. e.g.:

ssl/statem/libssl-shlib-statem_dtls.o \
  ssl/statem/libssl-shlib-statem_dtls.o: ../ssl/statem/statem_dtls.c \

add-depends script scans one line at a time, so when the first line is
processed, the object file becomes a dependency itself.

Fix by removing -MT altogether.

This also fixes makedepend for nonstop platform.

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

(cherry picked from commit 6288aa440c1ba111eaf52cf79659a25329205022)

10 months agoAdd Missing Error Messages for AES-OCB Tag Length Validation
erbsland-dev [Tue, 10 Sep 2024 19:24:59 +0000 (21:24 +0200)] 
Add Missing Error Messages for AES-OCB Tag Length Validation

Related to #8331
Addressing found issues by adding specific error messages to improve
feedback when tag length checks fail for the `EVP_CTRL_AEAD_SET_TAG`
parameter in the AES-OCB algorithm.

- Added PROV_R_INVALID_TAG_LENGTH error to indicate when the current tag
  length exceeds the maximum tag length of the algorithm.
- Added `PROV_R_INVALID_TAG_LENGTH` error to indicate when the current tag
  length in the context does not match a custom tag length provided as
  a parameter.
- Added `ERR_R_PASSED_INVALID_ARGUMENT` error to handle cases where an
  invalid pointer is passed in encryption mode.

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

(cherry picked from commit 645edf50f0274448174d9739543bf01b1708b2f5)

10 months agofix small footprint builds on arm
Gerd Hoffmann [Mon, 9 Sep 2024 15:09:34 +0000 (17:09 +0200)] 
fix small footprint builds on arm

Building with '-D OPENSSL_SMALL_FOOTPRINT' for aarch64 fails due to
'gcm_ghash_4bit' being undeclared.  Fix that by not setting the function
pointer when building with OPENSSL_SMALL_FOOTPRINT, matching openssl
behavior on x86.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25419)

(cherry picked from commit 2a53df6947e195ac08bc04c9d2fec1fed977668f)

10 months agodocument provider dependency handling
Michael Baentsch [Mon, 15 Jul 2024 04:54:48 +0000 (06:54 +0200)] 
document provider dependency handling

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

(cherry picked from commit e8498dc6455fc36f70dc3a0ca1ef82b34c088a90)

10 months agorehash.c: handle possible null pointer returned by OPENSSL_strdup
XZ-X [Mon, 22 Jul 2024 05:38:00 +0000 (01:38 -0400)] 
rehash.c: handle possible null pointer returned by OPENSSL_strdup

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

(cherry picked from commit a5cd06f7fff3b4484946812191097b5e080b7610)

10 months agoAdd note for non-interactive use of `s_client`
erbsland-dev [Wed, 28 Aug 2024 19:54:12 +0000 (21:54 +0200)] 
Add note for non-interactive use of `s_client`

Fixes #8018

Documented the potential issue of premature connection closure in
non-interactive environments, such as cron jobs, when using `s_client`.

Added guidance on using the `-ign_eof` option and input redirection to
ensure proper handling of `stdin` and completion of TLS session data exchange.

Highlight potential issues with the `-ign_eof` flag and provide solutions for
graceful disconnection in SMTP and HTTP/1.1 scenarios to avoid indefinite hangs.

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

(cherry picked from commit 26521fdcf4047d6b6c5a7cf14ac34323a6197266)

10 months agoRefactor Password Variables to Use `const char[]` Arrays
erbsland-dev [Sun, 1 Sep 2024 20:55:12 +0000 (22:55 +0200)] 
Refactor Password Variables to Use `const char[]` Arrays

- Converted password declaration from `char*` to `const char[]`.
- Updated `memcpy` and `return` statements accordingly to use `sizeof` instead of predefined lengths.
- Renamed `key_password` into `weak_password` to match test name.

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

(cherry picked from commit d52e92f835d8f64e207747cefe12cd1fc0423326)

10 months agoRefactor Callback Tests for Improved Memory Management
erbsland-dev [Fri, 30 Aug 2024 14:35:38 +0000 (16:35 +0200)] 
Refactor Callback Tests for Improved Memory Management

Refactor the callback test code to replace global variables with local structures, enhancing memory management and reducing reliance on redundant cleanup logic.

Using a local struct containing a magic number and result flag to ensure the correct handling of user data and to verify that the callback function is invoked at least once during the test.

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

(cherry picked from commit 9808ccc53f066f5aedcd6ea847f790ea64e72e76)

10 months agoFix Edge Cases in Password Callback Handling
erbsland-dev [Fri, 30 Aug 2024 08:56:58 +0000 (10:56 +0200)] 
Fix Edge Cases in Password Callback Handling

Fixes #8441: Modify the password callback handling to reserve one byte in the buffer for a null terminator, ensuring compatibility with legacy behavior that puts a terminating null byte at the end.

Additionally, validate the length returned by the callback to ensure it does not exceed the given buffer size. If the returned length is too large, the process now stops gracefully with an appropriate error, enhancing robustness by preventing crashes from out-of-bounds access.

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

(cherry picked from commit 5387b71acb833f1f635ab4a20ced0863747ef5c1)

10 months agoAdd test for BIO password callback functionality
erbsland-dev [Thu, 29 Aug 2024 21:08:46 +0000 (23:08 +0200)] 
Add test for BIO password callback functionality

Related to #8441

This commit introduces a test suite for the password callback mechanism used when reading or writing encrypted and PEM or DER encoded keys via a BIO in OpenSSL. The test is designed to cover various edge cases, particularly focusing on scenarios where the password callback might return unexpected or malformed data from user code.

By simulating different callback behaviors, including negative returns, zero-length passwords, passwords that exactly fill the buffer and wrongly reported lengths. Also testing for the correct behaviour of binary passwords that contain a null byte in the middle.

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

(cherry picked from commit fa6ae88a47a37678e8f8567ec2622bef515ac286)

10 months agoFix compile err when building VC-CLANG-WIN64-CLANGASM-ARM target
Zhiqing Xie [Thu, 25 Jul 2024 02:25:01 +0000 (10:25 +0800)] 
Fix compile err when building VC-CLANG-WIN64-CLANGASM-ARM target

The error happens with MSVC v143,C++ Clang Compiler for Windows(16.0.5)

Error is "brackets expression not supported on this target" in libcrypto-shlib-bsaes-armv8.obj.asm

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

(cherry picked from commit d20cf21b20559b3974a9dcadfe79bb047bfaab16)

10 months agoDependabot update
dependabot[bot] [Thu, 29 Aug 2024 17:50:32 +0000 (17:50 +0000)] 
Dependabot update

CLA: trivial

(deps): Bump actions/setup-python

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.1.1 to 5.2.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5.1.1...v5.2.0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25328)

(cherry picked from commit 8af4c02ea952ca387691c4a077c260ba045fe285)

10 months agoblank line required to display code in `openssl-ts.pod.in`
Pablo Rodríguez [Fri, 30 Aug 2024 14:56:03 +0000 (16:56 +0200)] 
blank line required to display code in `openssl-ts.pod.in`

CLA:trivial

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

(cherry picked from commit 6fd9bc65689cf62854797927121a580bed1565c4)

10 months agoFix inaccurate comment about default nonce length in demos/cipher/aesccm.c
Alessandro Chitarrini [Thu, 29 Aug 2024 10:59:54 +0000 (12:59 +0200)] 
Fix inaccurate comment about default nonce length in demos/cipher/aesccm.c

Fixes #25270

CLA: trivial

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

(cherry picked from commit f2b7a00fbb372b0ea32f2cfea865ab407641b1fa)

10 months agoRecycle the TLS key that holds thread_event_handler
Zhihao Yuan [Tue, 27 Aug 2024 01:48:36 +0000 (18:48 -0700)] 
Recycle the TLS key that holds thread_event_handler

Fixes #25278

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

(cherry picked from commit 36840ab577d547a35cbc7c72396dc7931712eb6e)

10 months agoClarify EVP_CipherUpdate() authenticated bytes behavior
erbsland-dev [Mon, 22 Jul 2024 08:26:17 +0000 (10:26 +0200)] 
Clarify EVP_CipherUpdate() authenticated bytes behavior

Fixes #8310: Document that the number of authenticated bytes returned by EVP_CipherUpdate() varies with the cipher used. Mention that stream ciphers like ChaCha20 can handle 1 byte at a time, while OCB mode requires processing data one block at a time. Ensure it's clear that passing unpadded data in one call is safe.

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

(cherry picked from commit d15077d336e4b6144f8a5fdb0c1bb58ca9d3552f)

10 months agothreads_win: fix improper cast to long * instead of LONG *
Georgi Valkov [Tue, 3 Sep 2024 07:13:34 +0000 (10:13 +0300)] 
threads_win: fix improper cast to long * instead of LONG *

InterlockedExchangeAdd expects arguments of type LONG *, LONG
but the int arguments were improperly cast to long *, long

Note:
- LONG is always 32 bit
- long is 32 bit on Win32 VC x86/x64 and MingW-W64
- long is 64 bit on cygwin64

Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25360)

(cherry picked from commit b0ed90cc30a573acb9b27186babc616be482afcb)

10 months agoFix memleak in rsa_cms_sign error path
Daniel Gustafsson [Fri, 12 Jul 2024 18:49:16 +0000 (20:49 +0200)] 
Fix memleak in rsa_cms_sign error path

If the call to X509_ALGOR_set0 fails then the allocated ASN1_STRING
variable passed as parameter leaks.  Fix by explicitly freeing like
how all other codepaths with X509_ALGOR_set0 do.

Fixes #22680

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

(cherry picked from commit 5efc57caf229748fd4f85b05463f96b11679100d)

11 months agoPrepare for 3.1.8
Tomas Mraz [Tue, 3 Sep 2024 12:58:06 +0000 (14:58 +0200)] 
Prepare for 3.1.8

Reviewed-by: Neil Horman <nhorman@openssl.org>
Release: yes

11 months agoPrepare for release of 3.1.7 openssl-3.1.7
Tomas Mraz [Tue, 3 Sep 2024 12:57:51 +0000 (14:57 +0200)] 
Prepare for release of 3.1.7

Reviewed-by: Neil Horman <nhorman@openssl.org>
Release: yes

11 months agomake update
Tomas Mraz [Tue, 3 Sep 2024 12:57:49 +0000 (14:57 +0200)] 
make update

Reviewed-by: Neil Horman <nhorman@openssl.org>
Release: yes

11 months agoCopyright year updates
Tomas Mraz [Tue, 3 Sep 2024 12:55:43 +0000 (14:55 +0200)] 
Copyright year updates

Reviewed-by: Neil Horman <nhorman@openssl.org>
Release: yes

11 months agoAdd CVE-2024-5535 to CHANGES and NEWS
Tomas Mraz [Tue, 3 Sep 2024 10:24:58 +0000 (12:24 +0200)] 
Add CVE-2024-5535 to CHANGES and NEWS

Reviewed-by: Neil Horman <nhorman@openssl.org>
Release: yes
(cherry picked from commit 0c3d66a46eda9353f80e1846642b9090a8eac999)

11 months agoUpdated CHANGES and NEWS for CVE-2024-6119 fix
Viktor Dukhovni [Wed, 10 Jul 2024 09:50:57 +0000 (19:50 +1000)] 
Updated CHANGES and NEWS for CVE-2024-6119 fix

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(cherry picked from commit cf384d35aa7142cc3b5de19f64d3972e77d3ff74)