openssl.git
2 years agoaes_v8_xts_encrypt is present only on 64bit arm builds
Tomas Mraz [Tue, 10 Aug 2021 07:00:22 +0000 (09:00 +0200)]
aes_v8_xts_encrypt is present only on 64bit arm builds

Fixes #16273

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

2 years agoOmitted signature_algorithms extension alerts updated
Dmitry Belyavskiy [Wed, 4 Aug 2021 13:40:24 +0000 (15:40 +0200)]
Omitted signature_algorithms extension alerts updated

Fixes #15484

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

2 years agoMacOS: Add an include of <CommonCrypto/CommonCryptoError.h>
David Bohman [Fri, 6 Aug 2021 22:23:00 +0000 (15:23 -0700)]
MacOS: Add an include of <CommonCrypto/CommonCryptoError.h>

The include is added before <CommonCrypto/CommonRandom.h>,
as required by older releases of the macOS developer tools.

Fixes #16248

CLA: trivial

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

2 years agodoc: remove errant claim that these are not FIPS okay
Pauli [Fri, 6 Aug 2021 01:17:03 +0000 (11:17 +1000)]
doc: remove errant claim that these are not FIPS okay

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

2 years agodoc: Fix ECX FIPS documentation
Pauli [Thu, 5 Aug 2021 23:16:38 +0000 (09:16 +1000)]
doc: Fix ECX FIPS documentation

Both Ed448 and Ed25519 were omitted from the signature list.
X448 and X25519 were flagged as not FIPS valid which wasn't correct.

Fixes #16234

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

2 years agoAvoid freeing the conf lhashes in X509_V3_EXT*_add_conf
Tomas Mraz [Thu, 5 Aug 2021 10:44:58 +0000 (12:44 +0200)]
Avoid freeing the conf lhashes in X509_V3_EXT*_add_conf

Fixes #16226

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

2 years agoFix CMP app TLS connection not respecting vpm options like -crl_check
Dr. David von Oheimb [Thu, 5 Aug 2021 09:19:07 +0000 (11:19 +0200)]
Fix CMP app TLS connection not respecting vpm options like -crl_check

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

2 years agoFix test case for a2i_IPADDRESS
Amir Mohammadi [Wed, 4 Aug 2021 05:14:29 +0000 (09:44 +0430)]
Fix test case for a2i_IPADDRESS

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

2 years agoTest case for a2i_IPADDRESS
Christian Heimes [Sat, 15 Aug 2020 18:01:49 +0000 (20:01 +0200)]
Test case for a2i_IPADDRESS

Unit test to show that a2i_IPADDRESS("1.2.3.4.test.example") ignores
trailing data.

See: https://github.com/openssl/openssl/issues/12649
See: https://bugs.python.org/issue41556
Signed-off-by: Christian Heimes <christian@python.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16201)

2 years agoFix ipv4_from_asc behavior on invalid Ip addresses
Amir Mohammadi [Wed, 4 Aug 2021 05:13:49 +0000 (09:43 +0430)]
Fix ipv4_from_asc behavior on invalid Ip addresses

sscanf() call in ipv4_from_asc does not check that
the string is terminated immediately after the last digit.

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

2 years agoX509_STORE_CTX_get_error: Fix some minor documentation issues
Tomas Mraz [Wed, 4 Aug 2021 17:27:48 +0000 (19:27 +0200)]
X509_STORE_CTX_get_error: Fix some minor documentation issues

Original PR by Eric Valcik
(https://github.com/openssl/openssl/pull/12302)

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

2 years agoFix VS2019 compile error C4703: potentially uninitialized local pointer variable...
Kelvin Lee [Thu, 10 Sep 2020 05:58:13 +0000 (15:58 +1000)]
Fix VS2019 compile error C4703: potentially uninitialized local pointer variable used.

encode_key2text.c(689): error C4703: potentially uninitialized local pointer variable 'modulus_label' used
encode_key2text.c(691): error C4703: potentially uninitialized local pointer variable 'exponent_label' used

CLA: trivial

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

2 years agocms: Fix handling of -rctform option
Tomas Mraz [Wed, 4 Aug 2021 12:55:30 +0000 (14:55 +0200)]
cms: Fix handling of -rctform option

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

2 years agocms: Do not try to check binary format on stdin
Tomas Mraz [Wed, 4 Aug 2021 12:51:49 +0000 (14:51 +0200)]
cms: Do not try to check binary format on stdin

Fixes #16195

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

2 years agoreq: Avoid segfault when -modulus is used
Tomas Mraz [Wed, 4 Aug 2021 09:36:24 +0000 (11:36 +0200)]
req: Avoid segfault when -modulus is used

Fixes #16196

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

2 years ago[doc/man3] documentation: BN_cmp manpage updates
Billy Brumley [Wed, 4 Aug 2021 07:45:52 +0000 (10:45 +0300)]
[doc/man3] documentation: BN_cmp manpage updates

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

2 years agotest: add -macopt hexkey: to dgst command tests
Pauli [Wed, 4 Aug 2021 23:25:56 +0000 (09:25 +1000)]
test: add -macopt hexkey: to dgst command tests

Comparison checksum generated using 1.1.1f.

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

2 years agoctrls: add missing control string translation for key -> priv for HMAC
Pauli [Wed, 4 Aug 2021 03:30:44 +0000 (13:30 +1000)]
ctrls: add missing control string translation for key -> priv for HMAC

Fixes #16200

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

2 years agoevp_test: add TLS 1.3 KDF test suite
Pauli [Wed, 4 Aug 2021 00:11:30 +0000 (10:11 +1000)]
evp_test: add TLS 1.3 KDF test suite

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

2 years agotest: add test cases for TLS 1.3 KDF
Pauli [Tue, 3 Aug 2021 12:42:23 +0000 (22:42 +1000)]
test: add test cases for TLS 1.3 KDF

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

2 years agoupdate doc/build.info
Pauli [Tue, 3 Aug 2021 01:33:38 +0000 (11:33 +1000)]
update doc/build.info

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

2 years agofips: add power up test for TLS 1.3 KDF
Pauli [Tue, 3 Aug 2021 01:22:49 +0000 (11:22 +1000)]
fips: add power up test for TLS 1.3 KDF

The power up known answer test for the TLS 1.3 KDF does just the first step
to derive the "client_early_traffic_secret" using the two modes of the KDF.

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

2 years agodoc: add TLS 1.3 KDF to the FIPS provider list of algorithms.
Pauli [Tue, 3 Aug 2021 05:42:13 +0000 (15:42 +1000)]
doc: add TLS 1.3 KDF to the FIPS provider list of algorithms.

Fix link to TLS1 PRF.

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

2 years agodoc: reorder the string and int extract/expand param values
Pauli [Tue, 3 Aug 2021 12:29:03 +0000 (22:29 +1000)]
doc: reorder the string and int extract/expand param values

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

2 years agodoc: add links to new KDF
Pauli [Mon, 2 Aug 2021 11:44:06 +0000 (21:44 +1000)]
doc: add links to new KDF

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

2 years agodoc: add documentation for TLS13_KDF
Pauli [Mon, 2 Aug 2021 11:44:38 +0000 (21:44 +1000)]
doc: add documentation for TLS13_KDF

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

2 years agoprovider: add TLS13_KDF to the default and FIPS providers
Pauli [Mon, 2 Aug 2021 06:19:29 +0000 (16:19 +1000)]
provider: add TLS13_KDF to the default and FIPS providers

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

2 years agotls/prov: move the TLS 1.3 KDF code to providers
Pauli [Mon, 2 Aug 2021 06:16:35 +0000 (16:16 +1000)]
tls/prov: move the TLS 1.3 KDF code to providers

This function needs to be power up tested as part of the FIPS validation and
thus it needs to be inside the provider boundary.  This is realised by
introducing a new KDF "TLS13-KDF" which does the required massaging of
parameters but is otherwise functionally equivalent to HKDF.

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

2 years agodoc: add missing link directive in X942 KDF
Pauli [Mon, 2 Aug 2021 02:18:42 +0000 (12:18 +1000)]
doc: add missing link directive in X942 KDF

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

2 years agoCI: remove spurious blank lines
Pauli [Wed, 4 Aug 2021 01:06:44 +0000 (11:06 +1000)]
CI: remove spurious blank lines

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

2 years agoci: specific gcc explicitly on the basic-gcc CI build
Pauli [Thu, 29 Jul 2021 05:24:20 +0000 (15:24 +1000)]
ci: specific gcc explicitly on the basic-gcc CI build

GitHub Actions default to clang not gcc so this is necessary now.

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

2 years agoci: separate the config dump from the configuration command
Pauli [Thu, 29 Jul 2021 03:37:30 +0000 (13:37 +1000)]
ci: separate the config dump from the configuration command

This avoids using the shell's `&&` and shortens the lines a bit.

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

2 years agoDocument necessary error code processing
Dmitry Belyavskiy [Fri, 30 Jul 2021 14:03:55 +0000 (16:03 +0200)]
Document necessary error code processing

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16187)

2 years agoAdd oid_section to sysdefault.cnf to test adding new oids
Tomas Mraz [Tue, 3 Aug 2021 16:00:02 +0000 (18:00 +0200)]
Add oid_section to sysdefault.cnf to test adding new oids

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

2 years agoPrevent recursive call of OPENSSL_INIT_LOAD_CONFIG
Tomas Mraz [Tue, 3 Aug 2021 15:29:04 +0000 (17:29 +0200)]
Prevent recursive call of OPENSSL_INIT_LOAD_CONFIG

If objects are added in a config file the OPENSSL_INIT_LOAD_CONFIG
will be called recursively which results in hang in RUN_ONCE.

Fixes #16186

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

2 years agoapps/pkeyutl.c: call ERR_print_errors() on all errors, including Signature Verificati...
Dr. David von Oheimb [Tue, 3 Aug 2021 12:40:08 +0000 (14:40 +0200)]
apps/pkeyutl.c: call ERR_print_errors() on all errors, including Signature Verification Failure

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

2 years agoUse copy.pl to install the fips module on Windows
Tomas Mraz [Tue, 3 Aug 2021 10:23:43 +0000 (12:23 +0200)]
Use copy.pl to install the fips module on Windows

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

2 years agoWindows, VMS: Do install_fips on install if fips is enabled
Tomas Mraz [Tue, 3 Aug 2021 09:35:58 +0000 (11:35 +0200)]
Windows, VMS: Do install_fips on install if fips is enabled

Also fix some inconsistencies and minor bugs related to the
install_fips target on Windows and VMS.

Fixes #16194

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

2 years agodoc: replace markdown backticks with perlpod syntax
Beat Bolli [Fri, 30 Jul 2021 16:40:27 +0000 (18:40 +0200)]
doc: replace markdown backticks with perlpod syntax

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

2 years agodoc: use the documented =item markers
Beat Bolli [Fri, 30 Jul 2021 16:39:51 +0000 (18:39 +0200)]
doc: use the documented =item markers

The generated lists[1] look weird when using a dash as the list item
character. Perlpod documents[2] '*' for unordered lists and '1.' (note
the period) for ordered lists. Use these characters instead.

[1] e.g. https://www.openssl.org/docs/manmaster/man7/migration_guide.html#New-Algorithms
[2] https://perldoc.perl.org/perlpod

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

2 years agoAdd config_diagnostics to our configuration files.
Pauli [Wed, 28 Jul 2021 23:55:09 +0000 (09:55 +1000)]
Add config_diagnostics to our configuration files.

The change to a more configuration based approach to enable FIPS mode
operation highlights a shortcoming in the default should do something
approach we've taken for bad configuration files.

Currently, a bad configuration file will be automatically loaded and
once the badness is detected, it will silently stop processing the
configuration and continue normal operations. This is good for remote
servers, allowing changes to be made without bricking things. It's bad
when a user thinks they've configured what they want but got something
wrong and it still appears to work.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/16171)

2 years agoIf we have passed the private key, don't copy it implicitly
Dmitry Belyavskiy [Mon, 2 Aug 2021 15:00:51 +0000 (17:00 +0200)]
If we have passed the private key, don't copy it implicitly

Fixes #16197

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

2 years agoRedefine getpid() -> _getpid() only for MSVC
Tanzinul Islam [Sat, 31 Jul 2021 17:28:34 +0000 (18:28 +0100)]
Redefine getpid() -> _getpid() only for MSVC

This was introduced in 814b5133e for MSVC. C++Builder doesn't need it.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/16192)

2 years agochanges: remove duplicate entry
Pauli [Fri, 30 Jul 2021 00:38:33 +0000 (10:38 +1000)]
changes: remove duplicate entry

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/16180)

2 years agodoc: document that config_diagnostics is sensible but involves risk
Pauli [Thu, 29 Jul 2021 01:39:01 +0000 (11:39 +1000)]
doc: document that config_diagnostics is sensible but involves risk

Also:

- add this option to the sample configurations in the documentation.
- note that it is a sensible choice when using FIPS via config

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

2 years agodemo: add GMAC demonstration program
Pauli [Tue, 20 Jul 2021 05:04:49 +0000 (15:04 +1000)]
demo: add GMAC demonstration program

Test vector from NIST's GCM mode suite.

Fixes #14123

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/16113)

2 years agoFix dtls timeout dead code
yangyangtiantianlonglong [Sun, 25 Jul 2021 03:43:16 +0000 (11:43 +0800)]
Fix dtls timeout dead code

Delete dtls timeout dead code in dtls1_handle_timeout

Fix: #15559

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

2 years agoPrepare for 3.0 beta 3
Matt Caswell [Thu, 29 Jul 2021 14:50:46 +0000 (15:50 +0100)]
Prepare for 3.0 beta 3

Reviewed-by: Richard Levitte <levitte@openssl.org>
2 years agoPrepare for release of 3.0 beta 2 openssl-3.0.0-beta2
Matt Caswell [Thu, 29 Jul 2021 14:50:29 +0000 (15:50 +0100)]
Prepare for release of 3.0 beta 2

Reviewed-by: Richard Levitte <levitte@openssl.org>
2 years agomake update
Matt Caswell [Thu, 29 Jul 2021 14:50:27 +0000 (15:50 +0100)]
make update

Reviewed-by: Richard Levitte <levitte@openssl.org>
2 years agoUpdate copyright year
Matt Caswell [Thu, 29 Jul 2021 14:41:35 +0000 (15:41 +0100)]
Update copyright year

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

2 years agoUpdate fingerprints.txt
Matt Caswell [Thu, 29 Jul 2021 10:09:05 +0000 (11:09 +0100)]
Update fingerprints.txt

Add Paul Dale as an approved release signer.

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

2 years agoAdd missing session timeout calc
Todd Short [Fri, 23 Jul 2021 13:25:09 +0000 (09:25 -0400)]
Add missing session timeout calc

Fixes #16142

Add missing session timeout calculation in `ssl_get_new_session()`

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

2 years agotest: add a comment indication that a bad MAC is intentional
Pauli [Tue, 27 Jul 2021 23:52:23 +0000 (09:52 +1000)]
test: add a comment indication that a bad MAC is intentional

This permits negative testing of FIPS module load failure.

Also changed the MAC to all zeros to make it even clearer.

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

2 years agoAdd some testing for the case where the FIPS provider fails to load
Matt Caswell [Tue, 27 Jul 2021 15:36:41 +0000 (16:36 +0100)]
Add some testing for the case where the FIPS provider fails to load

Ensure we get correct behaviour in the event that an attempt is made
to load the fips provider but it fails to load.

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

2 years agoDon't try and load the config file while already loading the config file
Matt Caswell [Tue, 27 Jul 2021 15:59:59 +0000 (16:59 +0100)]
Don't try and load the config file while already loading the config file

Calls to the API function EVP_default_properties_enable_fips() will
automatically attempt to load the default config file if it is not
already loaded. Therefore this function should not be called from inside
code to process the config file.

Fixes #16165

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

2 years agoEnsure any default_properties still apply even in the event of a provider load failure
Matt Caswell [Tue, 27 Jul 2021 15:36:24 +0000 (16:36 +0100)]
Ensure any default_properties still apply even in the event of a provider load failure

We don't treat a failure to load a provider as a fatal error. If it is fatal then
we give up attempting to load the config file - including reading any default
properties. Additionally if an attempt has been made to load a provider then we
disable fallback loading.

Fixes #16166

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

2 years agoDon't leak the OSSL_LIB_CTX in the event of a failure to load the FIPS module
Matt Caswell [Tue, 27 Jul 2021 15:31:20 +0000 (16:31 +0100)]
Don't leak the OSSL_LIB_CTX in the event of a failure to load the FIPS module

Ensure we free the OSSL_LIB_CTX on the error path.

Fixes #16163

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

2 years agoci: disable async for the SH4 build and reenable the associated test
Pauli [Mon, 26 Jul 2021 02:54:50 +0000 (12:54 +1000)]
ci: disable async for the SH4 build and reenable the associated test

The platform doesn't seem to have support for this.

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

2 years agoci: get rid of no-asm flag to m68k cross compiles
Pauli [Mon, 26 Jul 2021 01:57:48 +0000 (11:57 +1000)]
ci: get rid of no-asm flag to m68k cross compiles

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

2 years agoci: add the param conversion tests to the cross compiles.
Pauli [Mon, 26 Jul 2021 01:54:12 +0000 (11:54 +1000)]
ci: add the param conversion tests to the cross compiles.

There was a failure because an "inf" values was being read as a "NaN" not an
infinity.

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

2 years agoQEMU: include test runs for most cross compilation targets
Pauli [Fri, 23 Jul 2021 01:48:32 +0000 (11:48 +1000)]
QEMU: include test runs for most cross compilation targets

For the cross compiles where the tests couldn't be run, most are capable
of being run when statically linked.  For these, a shared with FIPS build
but not test run is also included to maximise compilation coverage.
The builds take a couple of minutes so the impact of these extra jobs
isn't great.

The test failures for test_includes, test_store and test_x509_store
across several platforms are related the the OPENSSL_DIR_read() call.
This gets a "Value too large for defined data type" error calling the
standard library's readdir() wrapper.  That is, the failure is during
the translation from the x86-64 structure to the 32 bit structure.
I've tried tweaking the include defines to use larger fields but couldn't
figure out how to make it work.  The most prudent fix is to ignore these
tests for these platforms.

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

2 years agotest: handle not a number (NaN) values in the param conversion test.
Pauli [Mon, 26 Jul 2021 01:53:23 +0000 (11:53 +1000)]
test: handle not a number (NaN) values in the param conversion test.

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

2 years agoAdd a test case for EVP_MD_meth_dup() and EVP_CIPHER_meth_dup()
Matt Caswell [Tue, 27 Jul 2021 09:32:49 +0000 (10:32 +0100)]
Add a test case for EVP_MD_meth_dup() and EVP_CIPHER_meth_dup()

Check that EVP_MD_meth_free() and EVP_CIPHER_meth_free() does actually
free the data.

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

2 years agoFix EVP_MD_meth_dup and EVP_CIPHER_meth_dup
Matt Caswell [Mon, 26 Jul 2021 14:53:25 +0000 (15:53 +0100)]
Fix EVP_MD_meth_dup and EVP_CIPHER_meth_dup

Make sure the origin is set correctly when duping an EVP_MD or EVP_CIPHER.

Fixes #16157

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

2 years agoMark the EVP_PKEY_METHOD arg as const on some EVP_PKEY_meth_get_*() funcs
Matt Caswell [Tue, 20 Jul 2021 15:18:04 +0000 (16:18 +0100)]
Mark the EVP_PKEY_METHOD arg as const on some EVP_PKEY_meth_get_*() funcs

Most EVP_PKEY_meth_get_*() functions mark the EVP_PKEY_METHOD argument as
const. But 3 did not. We fix those to be consistent.

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

2 years agoKTLS: AES-CCM in TLS-1.3 is broken on 5.x kernels, disable it
Tomas Mraz [Tue, 20 Jul 2021 11:08:31 +0000 (13:08 +0200)]
KTLS: AES-CCM in TLS-1.3 is broken on 5.x kernels, disable it

Fixes #16089

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

2 years agoTest ktls in non-default options CI build
Tomas Mraz [Tue, 20 Jul 2021 10:23:24 +0000 (12:23 +0200)]
Test ktls in non-default options CI build

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

2 years agoDrop no-ktls from runchecker daily build as it has no effect
Tomas Mraz [Tue, 20 Jul 2021 10:22:57 +0000 (12:22 +0200)]
Drop no-ktls from runchecker daily build as it has no effect

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

2 years agoECDSA_SIG_set0(): Clarify documentation and fix formatting errors
Tomas Mraz [Thu, 22 Jul 2021 07:32:56 +0000 (09:32 +0200)]
ECDSA_SIG_set0(): Clarify documentation and fix formatting errors

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

2 years agoECDSA_SIG_set0: r and s parameters cannot be NULL
Tomas Mraz [Wed, 21 Jul 2021 14:42:55 +0000 (16:42 +0200)]
ECDSA_SIG_set0: r and s parameters cannot be NULL

Fixes #7731

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

2 years agoDOCS: Move the description of EVP_PKEY_get0_description()
Richard Levitte [Tue, 13 Jul 2021 09:15:29 +0000 (11:15 +0200)]
DOCS: Move the description of EVP_PKEY_get0_description()

It appears to have been misplaced

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

2 years agoEVP: Add EVP_PKEY_get0_provider() and EVP_PKEY_CTX_get0_provider()
Richard Levitte [Tue, 13 Jul 2021 08:40:45 +0000 (10:40 +0200)]
EVP: Add EVP_PKEY_get0_provider() and EVP_PKEY_CTX_get0_provider()

Fixes #16058

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

2 years agoFix potential problems with EVP_PKEY_CTX_new() with engine set
Tomas Mraz [Thu, 22 Jul 2021 13:01:53 +0000 (15:01 +0200)]
Fix potential problems with EVP_PKEY_CTX_new() with engine set

If an engine is non-NULL in EVP_PKEY_CTX_new() call an assert might
have been incorrectly triggered or the engine might be finished
without being inited.

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

2 years agodo_sigver_init: Add missing ERR_clear_last_mark()
Tomas Mraz [Thu, 22 Jul 2021 13:25:32 +0000 (15:25 +0200)]
do_sigver_init: Add missing ERR_clear_last_mark()

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

2 years agoci: QEMU based cross compiled testing
Pauli [Thu, 22 Jul 2021 09:13:41 +0000 (19:13 +1000)]
ci: QEMU based cross compiled testing

With a little set up, Debian provides an ability to use QEMU to execute
programs compiled for other architectures. Using this, most of our cross
compilation CI builds can be executed.

This PR does this.

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

2 years agoci: reinstate the passwd tests for the no-cached-fetch run.
Pauli [Thu, 22 Jul 2021 00:56:29 +0000 (10:56 +1000)]
ci: reinstate the passwd tests for the no-cached-fetch run.

By selectively skipping the high round test cases, the out of memory problem
can be avoided.

partially fixes #16127

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

2 years agoMakefile: Avoid changing LIBDIR based on whether it already exists
jenda1 [Tue, 20 Jul 2021 14:32:49 +0000 (16:32 +0200)]
Makefile: Avoid changing LIBDIR based on whether it already exists

unix-Makefile.tmpl checks if the target LIBDIR exists on the build
machine or not and based on the result modify the final LIBDIR.
This should be avoided, build results should not depend on the build
machine root filesystem layout. It makes the build results unstable.

The fix simply removes the dir existence test from the unix-Makefile.tmpl.

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

2 years agoDSA/RSA_print(): Fix potential memory leak
Tomas Mraz [Wed, 21 Jul 2021 16:45:01 +0000 (18:45 +0200)]
DSA/RSA_print(): Fix potential memory leak

Fixes #10777

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

2 years agoAdd a test for custom EVP_PKEY_METHODs
Matt Caswell [Tue, 20 Jul 2021 15:18:58 +0000 (16:18 +0100)]
Add a test for custom EVP_PKEY_METHODs

Adds a test for using custom EVP_PKEY_METHODs without an ENGINE. As part
of this we also test having a custom EVP_PKEY_METHOD that wraps a built-in
EVP_PKEY_METHOD. We do this for both legacy and provided keys.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16118)

2 years agoFix custom EVP_PKEY_METHOD implementations where no engine is present
Matt Caswell [Mon, 19 Jul 2021 15:17:50 +0000 (16:17 +0100)]
Fix custom EVP_PKEY_METHOD implementations where no engine is present

It is possible to have a custom EVP_PKEY_METHOD implementation without
having an engine. In those cases we were failing to use that custom
implementation.

Fixes #16088

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16118)

2 years agoUpdate our EVP_PKEY_METHODs to get low level keys via public APIs
Matt Caswell [Tue, 20 Jul 2021 08:58:53 +0000 (09:58 +0100)]
Update our EVP_PKEY_METHODs to get low level keys via public APIs

It is possible to call built-in EVP_PKEY_METHOD functions with a provided
key. For example this might occur if a custom EVP_PKEY_METHOD is in use
that wraps a built-in EVP_PKEY_METHOD. Therefore our EVP_PKEY_METHOD
functions should not assume that we are using a legacy key. Instead we
get the low level key using EVP_PKEY_get0_RSA() or other similar functions.
This "does the right thing" if the key is actually provided.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16118)

2 years agoOSSL_HTTP_open(): Fix memory leak on TLS connect failure via proxy
Dr. David von Oheimb [Tue, 20 Jul 2021 09:19:39 +0000 (11:19 +0200)]
OSSL_HTTP_open(): Fix memory leak on TLS connect failure via proxy

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

2 years agoci: omit tests that consume too much memory
Pauli [Wed, 21 Jul 2021 09:25:22 +0000 (19:25 +1000)]
ci: omit tests that consume too much memory

The SSL API tests and the passwd command test trigger memory leakage in the
address sanitizer.

Fixes #16116

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

2 years agotls_process_{client,server}_certificate(): allow verify_callback return > 1
Dr. David von Oheimb [Wed, 27 Jan 2021 21:13:30 +0000 (22:13 +0100)]
tls_process_{client,server}_certificate(): allow verify_callback return > 1

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

2 years agoSSL_CTX_set_cert_verify_callback.pod: various corrections and clarifications
Dr. David von Oheimb [Fri, 22 Jan 2021 21:34:56 +0000 (22:34 +0100)]
SSL_CTX_set_cert_verify_callback.pod: various corrections and clarifications

- Make clear the callback is called whenever a peer certificate has been received,
  which is independent of the verification mode.
- Make clear that a return value > 1 always leads to handshake failure.
- Make clear that in server mode also return values <= 0 lead to handshake failure.
- For client mode replace the incorrect formulation "if B<SSL_VERIFY_PEER> is set"
  by what is actually implemented: "if the verification mode is not B<SSL_VERIFY_NONE>".
- Refer to X509_STORE_CTX_set_error() rather than to internal error variable.

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

2 years agoAdd testcases for SSL_key_update() corner case calls
yangyangtiantianlonglong [Thu, 15 Jul 2021 12:15:36 +0000 (20:15 +0800)]
Add testcases for SSL_key_update() corner case calls

Test that SSL_key_update() is not allowed if there are writes pending.
Test that there is no reset of the packet pointer in ssl3_setup_read_buffer().

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

2 years agotest: include all DRBG tests in FIPS mode
Pauli [Fri, 16 Jul 2021 01:58:46 +0000 (11:58 +1000)]
test: include all DRBG tests in FIPS mode

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/16096)

2 years agodocs: update CTR DRBG documentation to not mention the lack of a derivation function...
Pauli [Fri, 16 Jul 2021 01:54:14 +0000 (11:54 +1000)]
docs: update CTR DRBG documentation to not mention the lack of a derivation function in FIPS

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/16096)

2 years agoerr: remove the derivation function is mandatory for FIPS error message since it...
Pauli [Fri, 16 Jul 2021 01:52:30 +0000 (11:52 +1000)]
err: remove the derivation function is mandatory for FIPS error message since it's no longer used and newly introduced

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/16096)

2 years agodrbg: allow the ctr derivation function to be disabled in FIPS mode
Pauli [Fri, 16 Jul 2021 01:38:23 +0000 (11:38 +1000)]
drbg: allow the ctr derivation function to be disabled in FIPS mode

Word from the lab is:

    The use of the derivation function is optional if either an approved
    RBG or an entropy source provides full entropy output when entropy
    input is requested by the DRBG mechanism. Otherwise, the derivation
    function shall be used.

So our disallowing it's use was more than required.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/16096)

2 years agoFix a read buffer overrun in X509_aux_print().
Ingo Schwarze [Sun, 18 Jul 2021 15:48:06 +0000 (17:48 +0200)]
Fix a read buffer overrun in X509_aux_print().

The ASN1_STRING_get0_data(3) manual explitely cautions the reader
that the data is not necessarily NUL-terminated, and the function
X509_alias_set1(3) does not sanitize the data passed into it in any
way either, so we must assume the return value from X509_alias_get0(3)
is merely a byte array and not necessarily a string in the sense
of the C language.

I found this bug while writing manual pages for X509_print_ex(3)
and related functions.  Theo Buehler <tb@openbsd.org> checked my
patch to fix the same bug in LibreSSL, see

http://cvsweb.openbsd.org/src/lib/libcrypto/asn1/t_x509a.c#rev1.9

As an aside, note that the function still produces incomplete and
misleading results when the data contains a NUL byte in the middle
and that error handling is consistently absent throughout, even
though the function provides an "int" return value obviously intended
to be 1 for success and 0 for failure, and even though this function
is called by another function that also wants to return 1 for success
and 0 for failure and even does so in many of its code paths, though
not in others.  But let's stay focussed.  Many things would be nice
to have in the wide wild world, but a buffer overflow must not be
allowed to remain in our backyard.

CLA: trivial

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

2 years agodoc: fix OPENSSL_VERSION_NUMBER length in the synopsis
Petr Gotthard [Sun, 18 Jul 2021 12:19:11 +0000 (14:19 +0200)]
doc: fix OPENSSL_VERSION_NUMBER length in the synopsis

The number has 8 digits (not 9). It is a single integer `0xMNN00PP0L`.

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

2 years agodemos: update readme file with pbkdf2 and scrypt examples.
Pauli [Mon, 19 Jul 2021 03:17:02 +0000 (13:17 +1000)]
demos: update readme file with pbkdf2 and scrypt examples.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/16109)

2 years agodemos: add Makefile support for pbkdf2 and scrypt KDF demos
Pauli [Mon, 19 Jul 2021 03:00:38 +0000 (13:00 +1000)]
demos: add Makefile support for pbkdf2 and scrypt KDF demos

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/16109)

2 years agodemo: add scrypt demonstration program
Pauli [Mon, 19 Jul 2021 03:00:23 +0000 (13:00 +1000)]
demo: add scrypt demonstration program

Using test vector from RTC 7914

Fixes #14108

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/16109)

2 years agodemo: add pbkdf2 demonstration program
Pauli [Mon, 19 Jul 2021 03:00:06 +0000 (13:00 +1000)]
demo: add pbkdf2 demonstration program

Using test vector from RTC 7914

Fixes #14107

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/16109)

2 years agotest: fix use after scope problem in ACVP test
Pauli [Sat, 17 Jul 2021 14:47:09 +0000 (00:47 +1000)]
test: fix use after scope problem in ACVP test

Repeat after me:
    thou shall not use an auto scope variable as a parameter
    that is used out of scope.

Fixes GitHub CI #6305

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/16103)

2 years agoFix some minor record layer issues
Matt Caswell [Thu, 15 Jul 2021 13:08:56 +0000 (14:08 +0100)]
Fix some minor record layer issues

Various comments referred to s->packet and s->packet_length instead of
s->rlayer.packet and s->rlayer.packet_length. Also fixed is a spot where
RECORD_LAYER_write_pending() should have been used. Based on the review
comments in #16077.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/16086)

2 years agoFix signed/unsigned comparison warnings in sslapitest
Matt Caswell [Wed, 14 Jul 2021 14:36:12 +0000 (15:36 +0100)]
Fix signed/unsigned comparison warnings in sslapitest

Fixes build failures if using enable-ktls in conjunction with --strict-warnings

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