]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
3 weeks agoutil/find-doc-nits: do not check files in submodules in check_env_vars
Eugene Syromiatnikov [Fri, 29 Aug 2025 07:11:23 +0000 (09:11 +0200)] 
util/find-doc-nits: do not check files in submodules in check_env_vars

The reports about undocumented environment variables coming from files
in submodules are superfluous;  get the list of directories
from .gitmodules and exclude them from processing.

Resolves: https://github.com/openssl/openssl/issues/28109
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28378)

3 weeks agoMake the Unix build process more repeatable
Enji Cooper [Fri, 5 Sep 2025 03:22:00 +0000 (20:22 -0700)] 
Make the Unix build process more repeatable

Before this change all manpages would contain the date when pod2man was
run. This resulted in outputs that differed between builds--or
potentially across a single build if the host clock "ticked" to the next
day when the build was being run.

This commit modifies the manpage generation process as follows:
- The date all manpages were generated will be normalized to a single
  date.
- The release date specified in `VERSION.dat` is used instead of the
  date/time when `pod2man` was executed OR--in the event a date isn't
  specified in `VERSION.dat`--the time when the Makefiles were last
  regenerated.

Embedding a consistent date into the generated manpages helps ensure that
the build process as a whole is more repeatable and helps ensure that
release versions of OpenSSL create artifacts consistent with the date
that the official release was cut.

Co-authored-by: Richard Levitte <levitte@openssl.org>
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
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/28449)

3 weeks agoopenssl-enc.pod.in: We actually use PKCS#7 padding
Sergey G. Brester [Wed, 27 Aug 2025 22:26:11 +0000 (00:26 +0200)] 
openssl-enc.pod.in: We actually use PKCS#7 padding

PKCS#5 padding is a subset for 8-bytes block ciphers only.

CLA: trivial

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

3 weeks agogithub/workflows: Replace deprecated apt-get --force-yes
Norbert Pocs [Thu, 4 Sep 2025 08:02:55 +0000 (10:02 +0200)] 
github/workflows: Replace deprecated apt-get --force-yes

It is replaced by a few flags starting with '--allow-'. Currently:
--allow-unauthenticated
--allow-downgrades
--allow-remove-essential
--allow-change-held-packages

Signed-off-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28435)

3 weeks agoRISC-V: Use address for vlenb CSR
Hongren Zheng [Tue, 2 Sep 2025 14:00:10 +0000 (22:00 +0800)] 
RISC-V: Use address for vlenb CSR

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

3 weeks agoAdd a helper function to delete the extension list
David Benjamin [Sun, 31 Aug 2025 22:09:52 +0000 (18:09 -0400)] 
Add a helper function to delete the extension list

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
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/28398)

3 weeks agoClear the extension list when removing the last extension
David Benjamin [Sun, 31 Aug 2025 21:25:40 +0000 (17:25 -0400)] 
Clear the extension list when removing the last extension

The extensions list in a certificate, CRL, and CRL entry is defined as:

    ... extensions      [3]  EXPLICIT Extensions OPTIONAL ...
    ... crlEntryExtensions      Extensions OPTIONAL ...
    ... crlExtensions           [0]  EXPLICIT Extensions OPTIONAL ...

    Extensions  ::=  SEQUENCE SIZE (1..MAX) OF Extension

This means that a present but empty extensions list is actually invalid.
Rather, if you have no extensions to encode, you are meant to omit the
list altogether. Fix the delete_ext functions to handle this correctly.

This would mostly be moot, as an application adding extensions only to
delete them all would be unusual. However, #13658 implemented a slightly
roundabout design where, to omit SKID/AKID, the library first puts them
in and then the command-line tool detects some placeholder values and
deletes the extension again.

Fixes #28397

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
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/28398)

3 weeks agoFix typo in BN_generate_prime docs
Viperinius [Sun, 31 Aug 2025 16:09:11 +0000 (16:09 +0000)] 
Fix typo in BN_generate_prime docs

CLA: trivial

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

3 weeks agoupdate compiler-zoo github actions workflow
Dmitry Misharov [Thu, 28 Aug 2025 13:54:54 +0000 (15:54 +0200)] 
update compiler-zoo github actions workflow

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

3 weeks agodoc: Update documentation of SSL_CTX_set_dh_auto()
Ryan Hooper [Thu, 28 Aug 2025 13:12:39 +0000 (09:12 -0400)] 
doc: Update documentation of SSL_CTX_set_dh_auto()

Update the documentation of the dh_tmp_auto argument in
regards to its behavior when the argument value is 2.

Fixes #27606

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

3 weeks agodocs: Be case specific with links to man headers
Norbert Pocs [Wed, 27 Aug 2025 13:45:45 +0000 (15:45 +0200)] 
docs: Be case specific with links to man headers

Signed-off-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28356)

3 weeks agoremove ossl_prov_cipher_load_from_params()
Pauli [Thu, 28 Aug 2025 04:50:50 +0000 (14:50 +1000)] 
remove ossl_prov_cipher_load_from_params()

This function is no longer used or needed and it's internal so it can be
removed safely.

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

3 weeks agolegacy mac: convert to generated param name decoding
Pauli [Mon, 25 Aug 2025 05:50:41 +0000 (15:50 +1000)] 
legacy mac: convert to generated param name decoding

Also fix a mismatch between advertised settables and what was actually
processed.

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

3 weeks agolegacy mac: rename files to enable generated param decoders
Pauli [Mon, 25 Aug 2025 05:48:02 +0000 (15:48 +1000)] 
legacy mac: rename files to enable generated param decoders

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

3 weeks agodgst and mac apps: Added new ways for obtaining a MAC key
Igor Ustinov [Sat, 2 Aug 2025 16:53:13 +0000 (19:53 +0300)] 
dgst and mac apps: Added new ways for obtaining a MAC key

Resolves #24584

It is now possible to obtain a MAC key from an environment variable,
a file or read it from the standard input.

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

3 weeks agoFix unnecessary casts between int and size_t
Frederik Wedel-Heinen [Thu, 16 Jan 2025 09:27:31 +0000 (10:27 +0100)] 
Fix unnecessary casts between int and size_t

Also update a check for a negative int length value
in mem_write().

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

3 weeks agoX509_STORE_CTX_new.pod: change 'trust value' to 'trust id'
Dr. David von Oheimb [Mon, 9 Dec 2024 21:07:33 +0000 (22:07 +0100)] 
X509_STORE_CTX_new.pod: change 'trust value' to 'trust id'

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

3 weeks agox509_vfy.c: extend documenting comment for X509_STORE_CTX_purpose_inherit()
Dr. David von Oheimb [Mon, 9 Dec 2024 21:03:30 +0000 (22:03 +0100)] 
x509_vfy.c: extend documenting comment for X509_STORE_CTX_purpose_inherit()

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

3 weeks agox509_trust.c: add documenting comment for obj_trust()
Dr. David von Oheimb [Mon, 9 Dec 2024 21:02:58 +0000 (22:02 +0100)] 
x509_trust.c: add documenting comment for obj_trust()

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

3 weeks agoX509_STORE_CTX_purpose_inherit(): replace magic constant '0' by 'X509_TRUST_DEFAULT'
Dr. David von Oheimb [Sat, 7 Dec 2024 18:00:46 +0000 (19:00 +0100)] 
X509_STORE_CTX_purpose_inherit(): replace magic constant '0' by 'X509_TRUST_DEFAULT'

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

3 weeks ago25-test_verify.t: add test for trusted root excluding key usage KeyCertSign
Dr. David von Oheimb [Tue, 21 Mar 2023 13:21:45 +0000 (14:21 +0100)] 
25-test_verify.t: add test for trusted root excluding key usage KeyCertSign

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

3 weeks agoopenssl-verification-options.pod: improve description of certificate validation
Dr. David von Oheimb [Tue, 28 Feb 2023 11:10:35 +0000 (12:10 +0100)] 
openssl-verification-options.pod: improve description of certificate validation

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

3 weeks agoopenssl-verification-options.pod: better explain trust anchors and chain building
Dr. David von Oheimb [Sat, 9 Jul 2022 11:20:06 +0000 (13:20 +0200)] 
openssl-verification-options.pod: better explain trust anchors and chain building

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

3 weeks agoopenssl-verification-options.pod: Move reference to changes brought by OpenSSL 1...
Dr. David von Oheimb [Sat, 26 Jun 2021 13:50:34 +0000 (15:50 +0200)] 
openssl-verification-options.pod: Move reference to changes brought by OpenSSL 1.1.0 to HISTORY section

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

3 weeks agoasn1_parse.c: Fixed typo in comment
Pkeane22 [Sun, 7 Sep 2025 21:09:27 +0000 (17:09 -0400)] 
asn1_parse.c: Fixed typo in comment

Changed "15" to "14" on the comment line in ASN1_tag2str.

CLA: trivial

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

3 weeks agoapps: remove chopup_args()
Eugene Syromiatnikov [Thu, 4 Sep 2025 14:37:02 +0000 (16:37 +0200)] 
apps: remove chopup_args()

The last (and only?) user has been removed in commit eca471391378 "APPS:
Drop interactive mode in the 'openssl' program".

Complements: eca471391378 "APPS: Drop interactive mode in the 'openssl' program"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28441)

3 weeks agoAdd SM2 implementation in generic riscv64 asm
geliyaz [Wed, 2 Jul 2025 07:33:08 +0000 (15:33 +0800)] 
Add SM2 implementation in generic riscv64 asm

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

4 weeks agoapps: use app_malloc_array()
Eugene Syromiatnikov [Thu, 4 Sep 2025 15:59:33 +0000 (17:59 +0200)] 
apps: use app_malloc_array()

Replace app_malloc() calls where app_malloc_array() ones where
appropriate.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28444)

4 weeks agoapps: introduce app_malloc_array()
Eugene Syromiatnikov [Thu, 4 Sep 2025 15:57:18 +0000 (17:57 +0200)] 
apps: introduce app_malloc_array()

Similar to app_malloc(), provides a wrapper for OPENSSL_malloc_array()
that bails out when a NULL pointer is returned.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28444)

4 weeks agohmac: stop using secure memory for the HMAC key
Pauli [Mon, 1 Sep 2025 22:48:06 +0000 (08:48 +1000)] 
hmac: stop using secure memory for the HMAC key

Secure memory is design for long term storage of private material.
HMAC keys are not this.

Secure memory use was introduced in July 2020 by commit
3fddbb264e87a8cef2903cbd7b02b8e1a39a2a99.

Fixes #28346

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

4 weeks agoslh-dsa: omit test of import PCT
Pauli [Thu, 4 Sep 2025 21:24:19 +0000 (07:24 +1000)] 
slh-dsa: omit test of import PCT

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28447)

4 weeks agoimport pct: remove import PCTs for most algorithms
Pauli [Thu, 4 Sep 2025 21:23:28 +0000 (07:23 +1000)] 
import pct: remove import PCTs for most algorithms

This coveres DH, EC, RSA and SLH-DSA.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28447)

4 weeks agointerop-test.yml: Install new openssl version alongside the old
Tomas Mraz [Fri, 5 Sep 2025 10:14:31 +0000 (12:14 +0200)] 
interop-test.yml: Install new openssl version alongside the old

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

4 weeks agointerop-tests.yml: Fix also the soversion in the RPM spec file
Tomas Mraz [Fri, 5 Sep 2025 07:20:11 +0000 (09:20 +0200)] 
interop-tests.yml: Fix also the soversion in the RPM spec file

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

4 weeks agoOnly unlock in rsa_get_blinding when locking was successful
two-heart [Thu, 4 Sep 2025 10:20:53 +0000 (12:20 +0200)] 
Only unlock in rsa_get_blinding when locking was successful

CLA: trivial

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

4 weeks agoAdd missing unlock to ossl_provider_new
two-heart [Thu, 4 Sep 2025 09:18:01 +0000 (11:18 +0200)] 
Add missing unlock to ossl_provider_new

unlock on the early return path

CLA: trivial

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

4 weeks agoRefactor cache_objects() loop and object type handling
olszomal [Tue, 2 Sep 2025 10:02:36 +0000 (12:02 +0200)] 
Refactor cache_objects() loop and object type handling

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

4 weeks agoUpdate the test for debuginfo
Matt Caswell [Wed, 3 Sep 2025 07:53:21 +0000 (08:53 +0100)] 
Update the test for debuginfo

Ensure we are testing against libcrypto.so.4

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

4 weeks agoSkip pyca cryptography tests for now
Matt Caswell [Tue, 2 Sep 2025 14:59:13 +0000 (15:59 +0100)] 
Skip pyca cryptography tests for now

These tests fail because they are not compatible with 4.0

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

4 weeks agoFix the doc-nits history check
Matt Caswell [Tue, 2 Sep 2025 14:37:53 +0000 (15:37 +0100)] 
Fix the doc-nits history check

Fix the script now that we are at version 4.0

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

4 weeks agoMake update following 4.0 version change
Matt Caswell [Tue, 2 Sep 2025 14:22:37 +0000 (15:22 +0100)] 
Make update following 4.0 version change

Update the ordinal numbers

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

4 weeks agoThe next version to be released from master is 4.0
Matt Caswell [Tue, 2 Sep 2025 14:06:48 +0000 (15:06 +0100)] 
The next version to be released from master is 4.0

Now that the 3.6 branch has been created, correct the master branch so
that it is clear that the next release from that branch will be 4.0

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

4 weeks agotls: explicitly clear the secure extensions on free
Pauli [Tue, 2 Sep 2025 02:30:00 +0000 (12:30 +1000)] 
tls: explicitly clear the secure extensions on free

Secure memory clears anyway but best to be explicit about it.

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

4 weeks agoX509_VERIFY_PARAM_get0(): add check to defend on out-of-bound table access
Dr. David von Oheimb [Thu, 28 Aug 2025 16:33:06 +0000 (18:33 +0200)] 
X509_VERIFY_PARAM_get0(): add check to defend on out-of-bound table access

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

4 weeks agodemos/certs: properly handle "$@"
Eugene Syromiatnikov [Mon, 1 Sep 2025 14:45:25 +0000 (16:45 +0200)] 
demos/certs: properly handle "$@"

There is little reason $@ should be used unquoted;  also, "$@"
should be used instead of $* in order to pass the script arguments
to a function.

Fixes: bcd92754d56a "demos: fix cert scripts"
Fixes: 79b184fb4b65 "Extend certificate creation examples to include CRL generation and sample"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28405)

4 weeks agoapps/ocsp.c: avoid using NULL resp
Eugene Syromiatnikov [Mon, 1 Sep 2025 14:42:15 +0000 (16:42 +0200)] 
apps/ocsp.c: avoid using NULL resp

There are some code paths where resp is used without a previous check
for being non-NULL (specifically, OCSP_response_create() can return
NULL, and do_responder() can return -1, that would also lead to resp
being NULL).  Avoid hitting NULL dereferences by wrapping the code that
uses resp in "if (resp != NULL)".

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665155
References: https://github.com/openssl/project/issues/1362
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28405)

4 weeks agocrypto/x509/t_req.c: avoid exts leaking on error paths
Eugene Syromiatnikov [Mon, 1 Sep 2025 14:34:34 +0000 (16:34 +0200)] 
crypto/x509/t_req.c: avoid exts leaking on error paths

If an error occurred and jump to the "err" label is performed after
exts has been allocated, it can leak.  Avoid that by adding
sk_X509_EXTENSION_pop_free() on the error path and setting exts to NULL
after sk_X509_EXTENSION_pop_free() in the normal handling.

Fixes: ae880ae6719e "Fix error handling in X509_REQ_print_ex"
Fixes: 87c49f622e7f "Support for parsing of certificate extensions in PKCS#10 requests: these are"
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665161
References: https://github.com/openssl/project/issues/1362
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28405)

4 weeks agotest/radix/quic_bindings.c: move locking after child_script_info assignment
Eugene Syromiatnikov [Mon, 1 Sep 2025 12:38:10 +0000 (14:38 +0200)] 
test/radix/quic_bindings.c: move locking after child_script_info assignment

Coverity complains that some child_script_info field accesses are guarded
by the mutexes, while others are not;  placate it by performing the assignment
before taking the lock.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665151
References: https://github.com/openssl/project/issues/1362
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28405)

4 weeks agodoc/man1/openssl-enc.pod.in: document 'k' handling for -bufsize
Eugene Syromiatnikov [Mon, 1 Sep 2025 12:08:08 +0000 (14:08 +0200)] 
doc/man1/openssl-enc.pod.in: document 'k' handling for -bufsize

Apparently, '-bufsize' option parser can handle the 'k' suffix
(and treat is as the value being provided in the multiples of 1024).
Document that.

Complements: d02b48c63a58 "Import of old SSLeay release: SSLeay 0.8.1b"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28405)

4 weeks agoapps/enc.c: avoid signed integer overflow on bufsize assignment
Eugene Syromiatnikov [Mon, 1 Sep 2025 12:05:33 +0000 (14:05 +0200)] 
apps/enc.c: avoid signed integer overflow on bufsize assignment

The calculated option value, while being long-typed, is not checked
for fitting into int-sized bufsize.  Avoid overflow by throwing error
if it is bigger than INT_MAX and document that behaviour.

Fixes: 7e1b7485706c "Big apps cleanup (option-parsing, etc)"
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665149
References: https://github.com/openssl/project/issues/1362
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28405)

4 weeks agotest/bioprinttest.c: fix UB in %n result handling
Eugene Syromiatnikov [Mon, 1 Sep 2025 11:26:44 +0000 (13:26 +0200)] 
test/bioprinttest.c: fix UB in %n result handling

Per paragraph 3 of section 6.5.16.1 "Simple assignment" of ISO 9899:1999 TC3:

    If the value being stored in an object is read from another object
    that overlaps in any way the storage of the first object, then the overlap
    shall be exact and the two objects shall have qualified or unqualified
    versions of a compatible type;  otherwise, the behavior is undefined.

And that is what exactly violated when one field of the union is
assigned to another;  avoid that by introducing separate local variable
where the cast value is stored and then compared.

Fixes: 9deaf8383338 "test/bioprinttest.c: add some checks for integer and string printing"
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665144
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665145
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665146
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665147
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665148
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665150
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665152
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665153
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665156
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665157
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665158
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665159
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665160
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665162
References: https://github.com/openssl/project/issues/1362
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28405)

4 weeks agoremove ossl_prov_digest_load_from_params()
Pauli [Thu, 28 Aug 2025 04:48:59 +0000 (14:48 +1000)] 
remove ossl_prov_digest_load_from_params()

This is no longer used or needed and is internal, so away it goes.

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

4 weeks agokmac: avoid using ossl_prov_digest_load_from_params()
Pauli [Thu, 28 Aug 2025 04:48:51 +0000 (14:48 +1000)] 
kmac: avoid using ossl_prov_digest_load_from_params()

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

4 weeks agopvkkdf: avoid using ossl_prov_digest_load_from_params()
Pauli [Thu, 28 Aug 2025 04:48:31 +0000 (14:48 +1000)] 
pvkkdf: avoid using ossl_prov_digest_load_from_params()

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

4 weeks agopbkdf2: avoid using ossl_prov_digest_load_from_params()
Pauli [Thu, 28 Aug 2025 04:48:10 +0000 (14:48 +1000)] 
pbkdf2: avoid using ossl_prov_digest_load_from_params()

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

4 weeks agohkdf: avoid using ossl_prov_digest_load_from_params()
Pauli [Thu, 28 Aug 2025 04:47:52 +0000 (14:47 +1000)] 
hkdf: avoid using ossl_prov_digest_load_from_params()

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

4 weeks agoFIPS: Don't allow SHA512-224 and SHA512-256 for ECDSA/DSA signatures
slontis [Fri, 29 Aug 2025 04:11:59 +0000 (14:11 +1000)] 
FIPS: Don't allow SHA512-224 and SHA512-256 for ECDSA/DSA signatures

These algorithms do not have OIDS (Note that RSA does have OIDS),
and are not valid values for FIPS.
Note that this was only possible if the "ECDSA" algorithm is fetched.
Note that "ECDSA-SHA512-256" and "ECDSA-SHA512-224" are not currently
fetchable.

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

4 weeks agoslh-dsa: enter FIPS error state if pairwise test fails
Pauli [Sun, 31 Aug 2025 07:21:42 +0000 (17:21 +1000)] 
slh-dsa: enter FIPS error state if pairwise test fails

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

4 weeks agoPrepare for 3.7 28419/head
openssl-machine [Tue, 2 Sep 2025 13:07:27 +0000 (13:07 +0000)] 
Prepare for 3.7

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Release: yes

4 weeks agomake update
openssl-machine [Tue, 2 Sep 2025 13:07:15 +0000 (13:07 +0000)] 
make update

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Release: yes

4 weeks agoCopyright year updates
openssl-machine [Tue, 2 Sep 2025 13:05:45 +0000 (13:05 +0000)] 
Copyright year updates

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Release: yes

4 weeks agoRelease news and changelog for version 3.6
Norbert Pocs [Mon, 1 Sep 2025 12:38:51 +0000 (14:38 +0200)] 
Release news and changelog for version 3.6

Release: yes

Signed-off-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28403)

5 weeks agoMake update
Dmitry Belyavskiy [Thu, 28 Aug 2025 16:42:24 +0000 (18:42 +0200)] 
Make update

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

5 weeks agoImplement EVP_KDF_CTX_set_SKEY
Simo Sorce [Fri, 10 Jan 2025 22:20:59 +0000 (17:20 -0500)] 
Implement EVP_KDF_CTX_set_SKEY

This allows to use a SKEY as input to a KDF derive operation.

Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28369)

5 weeks agoImplement EVP_PKEY_derive_SKEY
Dmitry Belyavskiy [Fri, 15 Nov 2024 15:21:04 +0000 (16:21 +0100)] 
Implement EVP_PKEY_derive_SKEY

Signed-off-by: Dmitry Belyavskiy <beldmit@gmail.com>
Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28369)

5 weeks agoImplement EVP_KDF_derive_SKEY
Dmitry Belyavskiy [Fri, 10 Jan 2025 11:40:25 +0000 (12:40 +0100)] 
Implement EVP_KDF_derive_SKEY

Signed-off-by: Dmitry Belyavskiy <beldmit@gmail.com>
Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28369)

5 weeks agoWe use evp_skey_alloc from several source files
Dmitry Belyavskiy [Thu, 28 Aug 2025 16:29:46 +0000 (18:29 +0200)] 
We use evp_skey_alloc from several source files

It shouldn't be static

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

5 weeks agoCorrectly dealing with refcount in EVP_SKEY
Dmitry Belyavskiy [Fri, 29 Aug 2025 13:42:04 +0000 (15:42 +0200)] 
Correctly dealing with refcount in EVP_SKEY

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

5 weeks agoImplementation of EVP_SKEY_import_SKEYMGMT
Dmitry Belyavskiy [Fri, 29 Aug 2025 11:52:55 +0000 (13:52 +0200)] 
Implementation of EVP_SKEY_import_SKEYMGMT

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

5 weeks agoAdd GENERIC SKEYMGMT to the legacy provider
Dmitry Belyavskiy [Wed, 27 Aug 2025 14:16:54 +0000 (16:16 +0200)] 
Add GENERIC SKEYMGMT to the legacy provider

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

5 weeks agoDesign document of using opaque object as symmetric key
Dmitry Belyavskiy [Thu, 27 Jul 2023 10:12:40 +0000 (12:12 +0200)] 
Design document of using opaque object as symmetric key

Signed-off-by: Dmitry Belyavskiy <beldmit@gmail.com>
Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28369)

5 weeks agoFix typos and whitespace
Leonabcd123 [Thu, 28 Aug 2025 08:46:13 +0000 (11:46 +0300)] 
Fix typos and whitespace

Added "the" before "use"
Add missing whitespace
Removed unnecessary apostrophe in FIPS.md

CLA: trivial

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28362)

5 weeks agoDocument the OSSL_SELF_TEST_TYPE_PCT_IMPORT failure state
Pauli [Fri, 29 Aug 2025 02:47:35 +0000 (12:47 +1000)] 
Document the OSSL_SELF_TEST_TYPE_PCT_IMPORT failure state

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

5 weeks agoml-kem: convert to transient error state on import failure in FIPS provider
Pauli [Fri, 29 Aug 2025 02:43:09 +0000 (12:43 +1000)] 
ml-kem: convert to transient error state on import failure in FIPS provider

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

5 weeks agoml-dsa: convert to transient error state on import failure in FIPS provider
Pauli [Fri, 29 Aug 2025 02:43:01 +0000 (12:43 +1000)] 
ml-dsa: convert to transient error state on import failure in FIPS provider

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

5 weeks agoecx: convert to transient error state on import failure in FIPS provider
Pauli [Fri, 29 Aug 2025 02:42:46 +0000 (12:42 +1000)] 
ecx: convert to transient error state on import failure in FIPS provider

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

5 weeks agoec: convert to transient error state on import failure in FIPS provider
Pauli [Fri, 29 Aug 2025 02:42:35 +0000 (12:42 +1000)] 
ec: convert to transient error state on import failure in FIPS provider

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

5 weeks agodh: convert to transient error state on import failure in FIPS provider
Pauli [Fri, 29 Aug 2025 02:42:17 +0000 (12:42 +1000)] 
dh: convert to transient error state on import failure in FIPS provider

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

5 weeks agorsa: convert to transient error state on import failure in FIPS provider
Pauli [Fri, 29 Aug 2025 02:42:00 +0000 (12:42 +1000)] 
rsa: convert to transient error state on import failure in FIPS provider

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

5 weeks agoAdd OSSL_SELF_TEST_TYPE_PCT_IMPORT transient error state
Pauli [Fri, 29 Aug 2025 02:41:22 +0000 (12:41 +1000)] 
Add OSSL_SELF_TEST_TYPE_PCT_IMPORT transient error state

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

5 weeks agoadd new error
Pauli [Fri, 29 Aug 2025 02:37:45 +0000 (12:37 +1000)] 
add new error

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

5 weeks agotest/bioprinttest.c: move the %n result to the field that is later checked
Eugene Syromiatnikov [Fri, 29 Aug 2025 17:45:07 +0000 (19:45 +0200)] 
test/bioprinttest.c: move the %n result to the field that is later checked

The test_n test implicitly assumed a certain union layout, as the %n was
writing to the union field in accordance with the length modifier being
tested, but comparison of the expected value was dan agains the val field,
and that is incorrect, especially on big-endian architectures.  Fix that
by explicitly assigning the result to the val field of the union and
updating the expected values where the resulting value overflows
into negative.

Fixes: 9deaf8383338 "test/bioprinttest.c: add some checks for integer and string printing"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28388)

5 weeks agotest/bioprinttest.c: fix sloppy length modifier usage in int_data
Eugene Syromiatnikov [Fri, 29 Aug 2025 17:39:53 +0000 (19:39 +0200)] 
test/bioprinttest.c: fix sloppy length modifier usage in int_data

Some test vectors used in int_data have mismatching (or, more
spercifically) missing length modifiers in conversion specifiers;
most of the time it has gone unnoticed, but on some architectures where
64-bit arguments supplied differently (sugh as mips and armv7) it led
to garbage being retrieved instead of the expected values.  Fix it
by properly providing proper length modifiers.

Fixes: 9deaf8383338 "test/bioprinttest.c: add some checks for integer and string printing"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28388)

5 weeks agoslh-dsa: add a PCT for key import when in FIPS mode
Pauli [Thu, 14 Aug 2025 04:57:19 +0000 (14:57 +1000)] 
slh-dsa: add a PCT for key import when in FIPS mode

Fixes #28182

Co-Authored-By: slontis <shane.lontis@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28276)

5 weeks agotest/bioprinttest.c: add some checks for integer and string printing
Eugene Syromiatnikov [Tue, 5 Aug 2025 13:27:44 +0000 (15:27 +0200)] 
test/bioprinttest.c: add some checks for integer and string printing

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28177)

5 weeks agotest/bioprinttest.c: check the output against libc's one as well
Eugene Syromiatnikov [Tue, 5 Aug 2025 13:27:06 +0000 (15:27 +0200)] 
test/bioprinttest.c: check the output against libc's one as well

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28177)

5 weeks agotest/bioprinttest.c: constify test vectors
Eugene Syromiatnikov [Tue, 5 Aug 2025 13:26:42 +0000 (15:26 +0200)] 
test/bioprinttest.c: constify test vectors

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28177)

5 weeks agotest/bioprinttest.c: use the whole buffer for checks
Eugene Syromiatnikov [Thu, 14 Aug 2025 07:58:01 +0000 (09:58 +0200)] 
test/bioprinttest.c: use the whole buffer for checks

There is no need to decrement the size of buffer by 1, snprintf should
terminate the output with a \0.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28177)

5 weeks agocrypto/bio/bio_print.c: handle the case of 0 with zero precision
Eugene Syromiatnikov [Fri, 15 Aug 2025 14:35:11 +0000 (16:35 +0200)] 
crypto/bio/bio_print.c: handle the case of 0 with zero precision

Per [1]:

    The result of converting zero with an explicit precision of zero
    shall be no characters.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28177)

5 weeks agocrypto/bio/bio_print.c: improve the precision handling in fmtint
Eugene Syromiatnikov [Fri, 15 Aug 2025 14:28:11 +0000 (16:28 +0200)] 
crypto/bio/bio_print.c: improve the precision handling in fmtint

Per [1]:

    * A negative precision is taken as if the precision were omitted.
    * The default precision is 1.
    * For d, i, o, u, x, and X conversion specifiers, if a precision
      is specified, the '0' flag shall be ignored.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28177)

5 weeks agocrypto/bio/bio_print.c: bring back the length modifier support for %n
Eugene Syromiatnikov [Fri, 15 Aug 2025 14:07:24 +0000 (16:07 +0200)] 
crypto/bio/bio_print.c: bring back the length modifier support for %n

For some reason, it has been removed in commit 15b337fa58ba "bio/b_print.c:
switch to int64_t as "greatest-width integer type".", despite being a part
of the standard in both ANSI C and POSIX.1-2001.  Bring it back for all
the supported length modifiers.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28177)

5 weeks agocrypto/bio/bio_print.c: make %n in line with other libc implementations
Eugene Syromiatnikov [Fri, 15 Aug 2025 14:00:50 +0000 (16:00 +0200)] 
crypto/bio/bio_print.c: make %n in line with other libc implementations

The standard[1] is pretty vague in its definition of the %n specifier
by using "the number of bytes written to the output so far", without
actually elaborating, whether only the actually written bytes, or the bytes
that would be written (but discarded) are used;  the consensus across
implementations, however, seems to gravitate towards the latter.  Track
the virtual "write position" separately and use its value when %n format
is occurred.  That also means that we cannot finish the output early
upon reach of the end of buffer (unless we made sure that no %n specifiers
occur in the remainder of the format string).

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28177)

5 weeks agocrypto/bio/bio_print.c: avoid integer overflow when reading width/precision
Eugene Syromiatnikov [Tue, 5 Aug 2025 12:51:22 +0000 (14:51 +0200)] 
crypto/bio/bio_print.c: avoid integer overflow when reading width/precision

Both width and precision are "decimal digit strings" of unspecified size,
but we can realistically cap it at INT_MAX.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28177)

5 weeks agocrypto/bio/bio_print.c: always terminate output with \0
Eugene Syromiatnikov [Wed, 27 Aug 2025 08:48:20 +0000 (10:48 +0200)] 
crypto/bio/bio_print.c: always terminate output with \0

Man page states that the result is terminated with \0 on error, however,
when the jump to the "out" label is performed in _dopr, writing out \0
is skipped.  Rearrange the end of the routine to make the "out" part
include the overflow calculation and the final \0 writing.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28177)

5 weeks agocrypto/bio/bio_print.c: consolidating print arguments in a structure
Eugene Syromiatnikov [Fri, 15 Aug 2025 12:18:11 +0000 (14:18 +0200)] 
crypto/bio/bio_print.c: consolidating print arguments in a structure

buffer/sbuffer/maxlen/currlen are passed together between _dopr, fmt*,
and doapr_outch;  consolidate them together in a structure and pass
it instead.  A preparatory commit before introducing a separate "write
position" parameter, that is also to be passed around.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28177)

5 weeks agocrypto/bio/bio_print.c: reset max to zero if empty precision string is provided
Eugene Syromiatnikov [Thu, 14 Aug 2025 17:15:09 +0000 (19:15 +0200)] 
crypto/bio/bio_print.c: reset max to zero if empty precision string is provided

Per [1]:

    a null digit string is treated as zero.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28177)

5 weeks agocrypto/bio/bio_print.c: add 't' (ptrdiff_t) length modifier
Eugene Syromiatnikov [Thu, 14 Aug 2025 17:04:32 +0000 (19:04 +0200)] 
crypto/bio/bio_print.c: add 't' (ptrdiff_t) length modifier

As specified by POSIX.1-2001 and C99.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28177)

5 weeks agocrypto/bio/bio_print.c: fix space padding calculation
Eugene Syromiatnikov [Tue, 5 Aug 2025 13:19:12 +0000 (15:19 +0200)] 
crypto/bio/bio_print.c: fix space padding calculation

Sign, prefix, and zero padding should count towards precision.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28177)

5 weeks agocrypto/bio/bio_print.c: '-' flag has priority over '0'
Eugene Syromiatnikov [Tue, 5 Aug 2025 13:21:32 +0000 (15:21 +0200)] 
crypto/bio/bio_print.c: '-' flag has priority over '0'

Per [1]:

    If the '0' and '-' flags both appear, the '0' flag is ignored.

[1] https://pubs.opengroup.org/onlinepubs/9799919799//functions/printf.html

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28177)

5 weeks agocrypto/bio/bio_print.c: avoid superfluous zero padding in %#o
Eugene Syromiatnikov [Tue, 5 Aug 2025 13:14:51 +0000 (15:14 +0200)] 
crypto/bio/bio_print.c: avoid superfluous zero padding in %#o

Zero prefix in the alternative octal form count towards precision,
per [1]:

    For o conversion, it **shall increase the precision**...

[1] https://pubs.opengroup.org/onlinepubs/9799919799//functions/printf.html

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28177)