openssl.git
3 years agoinstall: add notes about ignored seed sources in the FIPS provider.
Pauli [Wed, 1 Jul 2020 01:09:38 +0000 (11:09 +1000)]
install: add notes about ignored seed sources in the FIPS provider.

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

3 years agorand: detect if FIPS approved randomness sources are being used.
Pauli [Tue, 30 Jun 2020 03:15:05 +0000 (13:15 +1000)]
rand: detect if FIPS approved randomness sources are being used.

This boils down to the operating system sources and RDRAND.
All other sources are not available in the FIPS module.

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

3 years agoFix trailing whitespace mismatch error when running 02-test_errstr.
Shane Lontis [Wed, 15 Jul 2020 01:49:57 +0000 (11:49 +1000)]
Fix trailing whitespace mismatch error when running 02-test_errstr.

Fixes #12449

On a aix7_ppc32 machine the error was of the form
match 'Previous owner died ' (2147483743) with one of ( 'Previous owner died', 'reason(95)' )
Stripping the trailing whitespace from the system error will address this issue.

Suggested fix by @pauldale.

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

3 years ago99-test_fuzz.t: Clean up and re-organize such that sub-tests could be split easily
Dr. David von Oheimb [Fri, 3 Jul 2020 12:19:43 +0000 (14:19 +0200)]
99-test_fuzz.t: Clean up and re-organize such that sub-tests could be split easily

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

3 years agotest/run_tests.pl: In parallel runs, start those tests first that run longest
Dr. David von Oheimb [Thu, 2 Jul 2020 15:59:55 +0000 (17:59 +0200)]
test/run_tests.pl: In parallel runs, start those tests first that run longest

Also untabify the Perl source file.

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

3 years agox509_vfy.c: Improve key usage checks in internal_verify() of cert chains
Dr. David von Oheimb [Fri, 3 Jul 2020 19:19:55 +0000 (21:19 +0200)]
x509_vfy.c: Improve key usage checks in internal_verify() of cert chains

If a presumably self-signed cert is last in chain we verify its signature
only if X509_V_FLAG_CHECK_SS_SIGNATURE is set. Upon this request we do the
signature verification, but not in case it is a (non-conforming) self-issued
CA certificate with a key usage extension that does not include keyCertSign.

Make clear when we must verify the signature of a certificate
and when we must adhere to key usage restrictions of the 'issuing' cert.
Add some comments for making internal_verify() easier to understand.
Update the documentation of X509_V_FLAG_CHECK_SS_SIGNATURE accordingly.

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

3 years agoConstify X509_check_akid and prefer using X509_get0_serialNumber over X509_get_serial...
Dr. David von Oheimb [Mon, 13 Jul 2020 15:13:48 +0000 (17:13 +0200)]
Constify X509_check_akid and prefer using X509_get0_serialNumber over X509_get_serialNumber

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

3 years agoPrepare for 3.0 alpha 6
Richard Levitte [Thu, 16 Jul 2020 13:23:08 +0000 (15:23 +0200)]
Prepare for 3.0 alpha 6

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
3 years agoPrepare for release of 3.0 alpha 5 openssl-3.0.0-alpha5
Richard Levitte [Thu, 16 Jul 2020 13:22:29 +0000 (15:22 +0200)]
Prepare for release of 3.0 alpha 5

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
3 years agoutil/mktar.pl: Change 'VERSION' to 'VERSION.dat'
Richard Levitte [Thu, 16 Jul 2020 13:08:30 +0000 (15:08 +0200)]
util/mktar.pl: Change 'VERSION' to 'VERSION.dat'

This was forgotten when that file changed name, and that unfortunately
disrupts releases.

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/12464)

3 years agoUpdate copyright year
Richard Levitte [Thu, 16 Jul 2020 12:47:04 +0000 (14:47 +0200)]
Update copyright year

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/12463)

3 years agoDRBG: Fix the renamed functions after the EVP_MAC name reversal
Richard Levitte [Thu, 16 Jul 2020 04:49:45 +0000 (06:49 +0200)]
DRBG: Fix the renamed functions after the EVP_MAC name reversal

[extended tests]

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/12186)

3 years agoRevert "kdf: make function naming consistent."
Matt Caswell [Thu, 18 Jun 2020 08:30:48 +0000 (09:30 +0100)]
Revert "kdf: make function naming consistent."

The commit claimed to make things more consistent. In fact it makes it
less so. Revert back to the previous namig convention.

This reverts commit 765d04c9460a304c8119f57941341a149498b9db.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12186)

3 years agoRevert "The EVP_MAC functions have been renamed for consistency. The EVP_MAC_CTX_*"
Matt Caswell [Thu, 18 Jun 2020 08:26:22 +0000 (09:26 +0100)]
Revert "The EVP_MAC functions have been renamed for consistency.  The EVP_MAC_CTX_*"

The commit claimed to make things more consistent. In fact it makes it
less so. Revert back to the previous namig convention.

This reverts commit d9c2fd51e2e278bc3f7793a104ff7b4879f6d63a.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12186)

3 years agoAdd latest changes and news in CHANGES.md and NEWS.md
Richard Levitte [Thu, 16 Jul 2020 07:34:00 +0000 (09:34 +0200)]
Add latest changes and news in CHANGES.md and NEWS.md

- Reworked test perl framwork for parallel tests
- Reworked ERR codes to make better space for system errors
- Deprecation of the ENGINE API

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/12461)

3 years agocapabilities: make capability selection case insensitive.
Pauli [Tue, 14 Jul 2020 23:16:30 +0000 (09:16 +1000)]
capabilities: make capability selection case insensitive.

Everything else to do with algorithm selection and properties is case
insensitive.

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

3 years agolibcrypto.num: engine deprecation updates
Pauli [Tue, 14 Jul 2020 12:04:29 +0000 (22:04 +1000)]
libcrypto.num: engine deprecation updates

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

3 years agodoc: remove unused engine tracing option
Pauli [Tue, 14 Jul 2020 11:33:14 +0000 (21:33 +1000)]
doc: remove unused engine tracing option

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

3 years agotrace: condition out engine related tracing
Pauli [Tue, 14 Jul 2020 11:32:52 +0000 (21:32 +1000)]
trace: condition out engine related tracing

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

3 years agoDocument that ENGINE_add_conf_module() was deprecated.
Pauli [Tue, 14 Jul 2020 00:29:56 +0000 (10:29 +1000)]
Document that ENGINE_add_conf_module() was deprecated.

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

3 years agoDocument that exdata for ENGINES is deprecated.
Pauli [Tue, 14 Jul 2020 00:29:24 +0000 (10:29 +1000)]
Document that exdata for ENGINES is deprecated.

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

3 years agoDocument that the ENGINE_[sg]_ex_data() calls are reprecated.
Pauli [Tue, 14 Jul 2020 00:28:49 +0000 (10:28 +1000)]
Document that the ENGINE_[sg]_ex_data() calls are reprecated.

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

3 years agoRAND: document that the ENGINE RAND override is deprecated.
Pauli [Tue, 14 Jul 2020 00:27:39 +0000 (10:27 +1000)]
RAND: document that the ENGINE RAND override is deprecated.

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

3 years agoENGINESDIR: document that this configuration is deprecated.
Pauli [Tue, 14 Jul 2020 00:27:07 +0000 (10:27 +1000)]
ENGINESDIR: document that this configuration is deprecated.

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

3 years agodoc: document that the engine initialisation options are deprecated.
Pauli [Tue, 14 Jul 2020 00:25:38 +0000 (10:25 +1000)]
doc: document that the engine initialisation options are deprecated.

They can't be removed yet for API compatibility reasons.

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

3 years agodeprecate engines in provider code
Pauli [Mon, 13 Jul 2020 23:40:47 +0000 (09:40 +1000)]
deprecate engines in provider code

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

3 years agodeprecate engines in libcrypto
Pauli [Mon, 13 Jul 2020 23:40:29 +0000 (09:40 +1000)]
deprecate engines in libcrypto

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

3 years agoapps: deprecate engines
Pauli [Mon, 13 Jul 2020 23:40:04 +0000 (09:40 +1000)]
apps: deprecate engines

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

3 years agodeprecate engine from public header files
Pauli [Mon, 13 Jul 2020 23:39:47 +0000 (09:39 +1000)]
deprecate engine from public header files

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

3 years agodeprecate engine tests
Pauli [Mon, 13 Jul 2020 23:39:20 +0000 (09:39 +1000)]
deprecate engine tests

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

3 years agodeprecate engines in SSL
Pauli [Mon, 13 Jul 2020 23:38:42 +0000 (09:38 +1000)]
deprecate engines in SSL

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

3 years ago deprecate engines
Pauli [Mon, 13 Jul 2020 23:38:22 +0000 (09:38 +1000)]
 deprecate engines

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

3 years agoFix indentation for engine.h
Pauli [Mon, 13 Jul 2020 00:51:03 +0000 (10:51 +1000)]
Fix indentation for engine.h

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

3 years agodoc: deprecate ENGINE documentation
Pauli [Thu, 25 Jun 2020 01:30:13 +0000 (11:30 +1000)]
doc: deprecate ENGINE documentation

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

3 years agoapps: document the deprecation of the -engine option
Pauli [Thu, 25 Jun 2020 01:27:51 +0000 (11:27 +1000)]
apps: document the deprecation of the -engine option

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

3 years agoengine: document the engine app as deprecated
Pauli [Thu, 25 Jun 2020 01:20:49 +0000 (11:20 +1000)]
engine: document the engine app as deprecated

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

3 years agoapps/list: deprecate engine support
Pauli [Thu, 25 Jun 2020 00:40:20 +0000 (10:40 +1000)]
apps/list: deprecate engine support

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

3 years agodeprecate engines in 3.0
Pauli [Thu, 25 Jun 2020 00:36:29 +0000 (10:36 +1000)]
deprecate engines in 3.0

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

3 years agoAdd SSL_get[01]_peer_certificate()
Todd Short [Thu, 11 Apr 2019 14:47:13 +0000 (10:47 -0400)]
Add SSL_get[01]_peer_certificate()

Deprecate SSL_get_peer_certificte() and replace with
SSL_get1_peer_certificate().
Add SSL_get0_peer_certificate.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/8730)

3 years agoConfigure: fix minor typo in apitable comment
Daniel Bevenius [Thu, 9 Jul 2020 05:28:19 +0000 (07:28 +0200)]
Configure: fix minor typo in apitable comment

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

3 years agoAdd FIPS related configuration data to the default openssl application configuration...
Shane Lontis [Wed, 1 Jul 2020 04:37:32 +0000 (14:37 +1000)]
Add FIPS related configuration data to the default openssl application configuration file

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

3 years agoMake -provider_name and -section_name optional
Rich Salz [Mon, 29 Jun 2020 01:11:48 +0000 (21:11 -0400)]
Make -provider_name and -section_name optional

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12311)

3 years agoUse defaults FIPSKEY if not given on command line
Rich Salz [Tue, 23 Jun 2020 00:49:51 +0000 (20:49 -0400)]
Use defaults FIPSKEY if not given on command line

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12311)

3 years agoAdd AES_CBC_CTS ciphers to providers
Shane Lontis [Mon, 8 Jun 2020 04:33:27 +0000 (14:33 +1000)]
Add AES_CBC_CTS ciphers to providers

Added Algorithm names AES-128-CBC-CTS, AES-192-CBC-CTS and AES-256-CBC-CTS.
CS1, CS2 and CS3 variants are supported.
Only single shot updates are supported.
The cipher returns the mode EVP_CIPH_CBC_MODE (Internally it shares the aes_cbc cipher code). This
would allow existing code that uses AES_CBC to switch to the CTS variant without breaking code that
tests for this mode. Because it shares the aes_cbc code the cts128.c functions could not be used directly.
The cipher returns the flag EVP_CIPH_FLAG_CTS.
EVP_CIPH_FLAG_FIPS & EVP_CIPH_FLAG_NON_FIPS_ALLOW have been deprecated.

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

3 years agoEnable WinCE build without deceiving _MSC_VER.
aSoujyuTanaka [Sat, 11 Apr 2020 19:10:57 +0000 (04:10 +0900)]
Enable WinCE build without deceiving _MSC_VER.

Reviewed-by: Mark J. Cox <mark@awe.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11526)

3 years agoTo generate makefile with correct parameters for WinCE.
aSoujyuTanaka [Sat, 11 Apr 2020 19:00:17 +0000 (04:00 +0900)]
To generate makefile with correct parameters for WinCE.

Reviewed-by: Mark J. Cox <mark@awe.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11526)

3 years agoDisable optimiization of BN_num_bits_word() for VS2005 ARM compiler due to
aSoujyuTanaka [Sat, 11 Apr 2020 18:58:44 +0000 (03:58 +0900)]
Disable optimiization of BN_num_bits_word() for VS2005 ARM compiler due to
its miscompilation of the function.
https://mta.openssl.org/pipermail/openssl-users/2018-August/008465.html

Reviewed-by: Mark J. Cox <mark@awe.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11526)

3 years agoChanged uintptr_t to size_t. WinCE6 doesn't seem it have the definition.
aSoujyuTanaka [Sat, 11 Apr 2020 18:58:02 +0000 (03:58 +0900)]
Changed uintptr_t to size_t. WinCE6 doesn't seem it have the definition.

Reviewed-by: Mark J. Cox <mark@awe.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11526)

3 years agoDRBG: rename the DRBG taxonomy.
Pauli [Sat, 4 Jul 2020 00:48:19 +0000 (10:48 +1000)]
DRBG: rename the DRBG taxonomy.

The existing wording didn't capture the reality of the default setup, this new
nomenclature attempts to improve the situation.

Reviewed-by: Mark J. Cox <mark@awe.com>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12366)

3 years agoConfigurations: make Makefile tmpl files non-links
Daniel Bevenius [Thu, 9 Jul 2020 05:26:38 +0000 (07:26 +0200)]
Configurations: make Makefile tmpl files non-links

This commit updates Configurations/README.md and turns the Makefile
templates into non-links.

The motivation for this is that not all template exist in the directory
leading to 404 Not found errors when accessed.

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

3 years ago[test] ectest: check custom generators
Billy Brumley [Tue, 9 Jun 2020 10:16:15 +0000 (13:16 +0300)]
[test] ectest: check custom generators

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

3 years agoProviderized libssl fallout: cleanup init
Benjamin Kaduk [Thu, 2 Jul 2020 19:14:52 +0000 (12:14 -0700)]
Providerized libssl fallout: cleanup init

Since libssl is entirely using fetched cipher/digest implementations
from providers, we don't need to register the libcrypto cipher/digest
implementations in ossl_init_ssl_base().

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

3 years agoBN: Check endianness in run-time, in BN_native2bn() and BN_bn2nativepad()
Richard Levitte [Thu, 9 Jul 2020 06:40:50 +0000 (08:40 +0200)]
BN: Check endianness in run-time, in BN_native2bn() and BN_bn2nativepad()

The code relied on B_ENDIAN being defined on all big-endian platform,
which turned out to not always be the case.

Fixes #12387

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/12390)

3 years agoAdd and use internal header that implements endianness check
Richard Levitte [Thu, 9 Jul 2020 06:37:46 +0000 (08:37 +0200)]
Add and use internal header that implements endianness check

This moves test/ossl_test_endian.h to include/internal/endian.h and
thereby makes the macros in there our standard way to check endianness
in run-time.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/12390)

3 years agoDOC: install documentation without execution permissions.
Richard Levitte [Mon, 6 Jul 2020 08:35:18 +0000 (10:35 +0200)]
DOC: install documentation without execution permissions.

Fixes #12350

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

3 years agoocsp.h: Fix backward compatibility decl for OCSP_parse_url() by including http.h
Dr. David von Oheimb [Thu, 9 Jul 2020 06:00:59 +0000 (08:00 +0200)]
ocsp.h: Fix backward compatibility decl for OCSP_parse_url() by including http.h

Fixes #12386

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

3 years agoFix wrong fipsinstall key used in test
Shane Lontis [Thu, 9 Jul 2020 13:04:02 +0000 (23:04 +1000)]
Fix wrong fipsinstall key used in test

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

3 years agoMakefile template: fix incorrect treatment of produced document files
Richard Levitte [Mon, 6 Jul 2020 09:35:25 +0000 (11:35 +0200)]
Makefile template: fix incorrect treatment of produced document files

Documentation files were treated as programs when assigning to the
make variables HTMLDOCS{1,3,5,7} and MANDOCS{1,3,5,7}, which is is
incorrect on POSIX sub-systems where executables have an extension
(.exe).

Fixes #11937

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

3 years agoAdd multiple fixes for ffc key generation using invalid p,q,g parameters.
Shane Lontis [Thu, 9 Jul 2020 03:43:10 +0000 (13:43 +1000)]
Add multiple fixes for ffc key generation using invalid p,q,g parameters.

Fixes #11864

- The dsa keygen assumed valid p, q, g values were being passed. If this is not correct then it is
  possible that dsa keygen can either hang or segfault.
  The fix was to do a partial validation of p, q, and g inside the keygen.
- Fixed a potential double free in the dsa keypair test in the case when in failed (It should never fail!).
  It freed internal object members without setting them to NULL.
- Changed the FFC key validation to accept 1024 bit keys in non fips mode.
- Added tests that use both the default provider & fips provider to test these cases.

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

3 years agoFix CID 1454808: Error handling issues NEGATIVE_RETURNS (PKCS7_dataDecode())
Shane Lontis [Mon, 6 Jul 2020 23:50:34 +0000 (09:50 +1000)]
Fix CID 1454808:  Error handling issues NEGATIVE_RETURNS (PKCS7_dataDecode())

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

3 years agoFix CID 1454806: NEGATIVE_RETURNS (cms_enc.c)
Shane Lontis [Mon, 6 Jul 2020 23:46:37 +0000 (09:46 +1000)]
Fix CID 1454806:   NEGATIVE_RETURNS (cms_enc.c)

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

3 years agoFix CID 1465213: Integer handling issues (evp_extra_test.c)
Shane Lontis [Mon, 6 Jul 2020 07:35:23 +0000 (17:35 +1000)]
Fix CID 1465213: Integer handling issues (evp_extra_test.c)

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

3 years agoFix CID 1463883 Dereference after null check (in ess_find_cert_v2())
Shane Lontis [Mon, 6 Jul 2020 06:13:48 +0000 (16:13 +1000)]
Fix CID 1463883 Dereference after null check (in ess_find_cert_v2())

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

3 years agoFix CID 1465214 Resource leak (in file_load.c)
Shane Lontis [Mon, 6 Jul 2020 04:31:32 +0000 (14:31 +1000)]
Fix CID 1465214 Resource leak (in file_load.c)

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

3 years agoFix CID 1465215 : Explicit null dereferenced (in test)
Shane Lontis [Mon, 6 Jul 2020 04:16:09 +0000 (14:16 +1000)]
Fix CID 1465215 : Explicit null dereferenced (in test)

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

3 years agoFix CID #1465216 Resource leak in property_fetch
Shane Lontis [Mon, 6 Jul 2020 04:08:58 +0000 (14:08 +1000)]
Fix CID #1465216 Resource leak in property_fetch

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

3 years agoEnsure we excluse ec2m curves if ec2m is disabled
Matt Caswell [Wed, 1 Jul 2020 11:20:49 +0000 (12:20 +0100)]
Ensure we excluse ec2m curves if ec2m is disabled

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

3 years agoAdd a test to check having a provider loaded without a groups still works
Matt Caswell [Fri, 26 Jun 2020 19:49:19 +0000 (20:49 +0100)]
Add a test to check having a provider loaded without a groups still works

As long as we have at least one provider loaded which offers some
groups, it doesn't matter if we have others loaded that don't.

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

3 years agoFix an incorrect error flow in add_provider_groups
Matt Caswell [Fri, 26 Jun 2020 19:44:27 +0000 (20:44 +0100)]
Fix an incorrect error flow in add_provider_groups

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

3 years agoFix OSSL_PROVIDER_get_capabilities()
Matt Caswell [Fri, 26 Jun 2020 19:40:11 +0000 (20:40 +0100)]
Fix OSSL_PROVIDER_get_capabilities()

It is not a failure to call OSSL_PROVIDER_get_capabilities() with a
provider loaded that has no capabilities.

Fixes #12286

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

3 years agoAdd support to zeroize plaintext in S3 record layer
Martin Elshuber [Tue, 23 Jun 2020 10:14:41 +0000 (12:14 +0200)]
Add support to zeroize plaintext in S3 record layer

Some applications want even all plaintext copies beeing
zeroized. However, currently plaintext residuals are kept in rbuf
within the s3 record layer.

This patch add the option SSL_OP_CLEANSE_PLAINTEXT to its friends to
optionally enable cleansing of decrypted plaintext data.

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

3 years ago[test][15-test_genec] Improve EC tests with genpkey
Nicola Tuveri [Sun, 28 Jun 2020 17:03:53 +0000 (20:03 +0300)]
[test][15-test_genec] Improve EC tests with genpkey

Test separately EC parameters and EC key generation.

Some curves only support explicit params encoding.

For some curves we have had cases in which generating the parameters
under certain conditions failed, while generating and serializing a key
under the same conditions did not.
See <https://github.com/openssl/openssl/issues/12306> for more details.

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

3 years ago[apps/genpkey] exit status should not be 0 on output errors
Nicola Tuveri [Fri, 26 Jun 2020 22:42:49 +0000 (01:42 +0300)]
[apps/genpkey] exit status should not be 0 on output errors

If the key is to be serialized or printed as text and the framework
returns an error, the app should signal the failure to the user using
a non-zero exit status.

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

3 years ago[EC][ASN1] Detect missing OID when serializing EC parameters and keys
Nicola Tuveri [Sun, 28 Jun 2020 21:53:46 +0000 (00:53 +0300)]
[EC][ASN1] Detect missing OID when serializing EC parameters and keys

The following built-in curves do not have an assigned OID:

- Oakley-EC2N-3
- Oakley-EC2N-4

In general we shouldn't assume that an OID is always available.

This commit detects such cases, raises an error and returns appropriate
return values so that the condition can be detected and correctly
handled by the callers, when serializing EC parameters or EC keys with
the default `ec_param_enc:named_curve`.

Fixes #12306

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

3 years agoimprove SSL_CTX_set_tlsext_ticket_key_cb ref impl
Glenn Strauss [Fri, 5 Jun 2020 21:14:08 +0000 (17:14 -0400)]
improve SSL_CTX_set_tlsext_ticket_key_cb ref impl

improve reference implementation code in
  SSL_CTX_set_tlsext_ticket_key_cb man page

change EVP_aes_128_cbc() to EVP_aes_256_cbc(), with the implication
of requiring longer keys.  Updating this code brings the reference
implementation in line with implementation in openssl committed in 2016:
commit 05df5c20
Use AES256 for the default encryption algoritm for TLS session tickets

add comments where user-implementation is needed to complete code

CLA: trivial

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12063)

3 years agoEnsure TLS padding is added during encryption on the provider side
Matt Caswell [Fri, 26 Jun 2020 17:22:18 +0000 (18:22 +0100)]
Ensure TLS padding is added during encryption on the provider side

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

3 years agoConvert SSLv3 handling to use provider side CBC/MAC removal
Matt Caswell [Fri, 26 Jun 2020 12:05:18 +0000 (13:05 +0100)]
Convert SSLv3 handling to use provider side CBC/MAC removal

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

3 years agoEnsure any allocated MAC is freed in the provider code
Matt Caswell [Tue, 23 Jun 2020 15:47:31 +0000 (16:47 +0100)]
Ensure any allocated MAC is freed in the provider code

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

3 years agoDecreate the length after decryption for the stitched ciphers
Matt Caswell [Tue, 23 Jun 2020 13:34:45 +0000 (14:34 +0100)]
Decreate the length after decryption for the stitched ciphers

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

3 years agoEnsure the sslcorrupttest checks all errors on the queue
Matt Caswell [Mon, 22 Jun 2020 15:02:12 +0000 (16:02 +0100)]
Ensure the sslcorrupttest checks all errors on the queue

sslcorrupttest was looking for a "decryption failed or bad record mac"
error in the queue. However if there were multiple errors on the queue
then it would fail to find it. We modify the test to check all errors.

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

3 years agoEnsure GCM "update" failures return 0 on error
Matt Caswell [Mon, 22 Jun 2020 15:01:31 +0000 (16:01 +0100)]
Ensure GCM "update" failures return 0 on error

EVP_CipherUpdate is supposed to return 1 for success or 0 for error.
However for GCM ciphers it was sometimes returning -1 for error.

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

3 years agoEnsure cipher_generic_initkey gets passed the actual provider ctx
Matt Caswell [Mon, 22 Jun 2020 14:04:50 +0000 (15:04 +0100)]
Ensure cipher_generic_initkey gets passed the actual provider ctx

We were not correctly passing the provider ctx down the chain during
initialisation of a new cipher ctx. Instead the provider ctx got set to
NULL.

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

3 years agoMake the NULL cipher TLS aware
Matt Caswell [Mon, 22 Jun 2020 09:51:48 +0000 (10:51 +0100)]
Make the NULL cipher TLS aware

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

3 years agoChange ChaCha20-Poly1305 to be consistent with out ciphers
Matt Caswell [Fri, 19 Jun 2020 16:26:49 +0000 (17:26 +0100)]
Change ChaCha20-Poly1305 to be consistent with out ciphers

Other ciphers return the length of the Payload for TLS as a result of an
EVP_DecryptUpdate() operation - but  ChaCha20-Poly1305 did not. We change
it so that it does.

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

3 years agoMake libssl start using the TLS provider CBC support
Matt Caswell [Wed, 17 Jun 2020 16:16:22 +0000 (17:16 +0100)]
Make libssl start using the TLS provider CBC support

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

3 years agoAdd provider support for TLS CBC padding and MAC removal
Matt Caswell [Wed, 27 May 2020 16:20:18 +0000 (17:20 +0100)]
Add provider support for TLS CBC padding and MAC removal

The previous commits separated out the TLS CBC padding code in libssl.
Now we can use that code to directly support TLS CBC padding and MAC
removal in provided ciphers.

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

3 years agoRemove SSL dependencies from tls_pad.c
Matt Caswell [Wed, 10 Jun 2020 14:34:04 +0000 (15:34 +0100)]
Remove SSL dependencies from tls_pad.c

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

3 years agoSplit the padding/mac removal functions out into a separate file
Matt Caswell [Wed, 10 Jun 2020 14:11:28 +0000 (15:11 +0100)]
Split the padding/mac removal functions out into a separate file

We split these functions out into a separate file because we are
preparing to make this file shared between libssl and providers.

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

3 years agoMove MAC removal responsibility to the various protocol "enc" functions
Matt Caswell [Wed, 3 Jun 2020 16:42:01 +0000 (17:42 +0100)]
Move MAC removal responsibility to the various protocol "enc" functions

For CBC ciphersuites using Mac-then-encrypt we have to be careful about
removing the MAC from the record in constant time. Currently that happens
immediately before MAC verification. Instead we move this responsibility
to the various protocol "enc" functions so that MAC removal is handled at
the same time as padding removal.

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

3 years agoTEST: update 02-test_errstr.t to have better tests
Richard Levitte [Wed, 1 Jul 2020 21:13:49 +0000 (23:13 +0200)]
TEST: update 02-test_errstr.t to have better tests

We now check that if libcrypto hasn't loaded the string for some particular
system error, it gives us "reason(nnn)" instead, where 'nnn' is the system
error number in decimal.

We go through all possible error macros that perl serves us, not only the
POSIX ones.

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

3 years agoSSL: fix misuse of ERR_LIB_SYS
Richard Levitte [Wed, 1 Jul 2020 20:17:01 +0000 (22:17 +0200)]
SSL: fix misuse of ERR_LIB_SYS

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

3 years agoTEST: fix test/errtest.c
Richard Levitte [Mon, 29 Jun 2020 10:43:40 +0000 (12:43 +0200)]
TEST: fix test/errtest.c

test/errtest.c used the system error code 1 for EPERM.  However, EPERM
may be coded differently on different systems, so we switch to using
EPERM instead.  However, because we know that the ERR sub-system
truncates system error codes that occupy more than 24 bits, we check
that the reason code in the recorded error matches our EPERM, and skip
the test if not.

To be safe (even though the error string for that code is well defined
in POSIX), we also use strerror() to retrieve the string for that
error code instead of using a hard coded value.

Fixes #12276
Fixes #12217
Fixes #12354

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

3 years agoERR: special case system errors
Richard Levitte [Mon, 29 Jun 2020 10:18:24 +0000 (12:18 +0200)]
ERR: special case system errors

Because system errors can be any positive number that fits in an 'int'
according to POSIX, we can't reasonably expect them to be in the 1..127
range, even though that's the most usual.

Instead of packing them into the OpenSSL error code structure, we
recognise them as a special case and mark them as such by storing them
in our error queue with the highest bit set.  We make OpenSSL specific
error records have their highest bit cleared, and in doing so, we
shift down the library section of the code by one bit.  This still
leaves a very large section for the reason codes.

Of course, we must adapt the error code and reason string extraction
and printing functions accordingly.

With this, we also thrown away the pre-loaded array of system error
strings, and extract them from the system when needed instead, i.e.
when we create error strings.

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

3 years agoERR: refactor global error codes
Richard Levitte [Mon, 29 Jun 2020 10:08:27 +0000 (12:08 +0200)]
ERR: refactor global error codes

Some ERR_R_ codes overlapped other ERR_R_ codes:

- ERR_R_BUF_LIB vs ERR_R_PASSED_INVALID_ARGUMENT
- ERR_R_DSA_LIB vs ERR_R_INTERRUPTED_OR_CANCELLED

Looking back at history, this was originally not an issue, because
the ERR_R_ codes that weren't ERR_LIB_ aliases had bit 2**6 set.
However, new codes without that bit came in, and we got the overlap
that is mentioned above.

To get rid of the overlap, we repartition the codes as follows:

- ERR_R_{name}_LIB that are aliases for ERR_LIB_{name} are confined to
  the range 1..63.
- Other ERR_R_ codes are confined to 64..99

We also expand the reason codes to 24 bits of data, where the 4 top
bits are for reason code flags.  We also allocate a "fatal" flag
ERR_RFLAG_FATAL.  The reason code ERR_R_FATAL stops acting as a flag,
but is coded in such a way that it still serves as one for code that
happens to use it as such.

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

3 years agoCORE: perform post-condition in algorithm_do_this() under all circumstances
Richard Levitte [Fri, 3 Jul 2020 12:12:54 +0000 (14:12 +0200)]
CORE: perform post-condition in algorithm_do_this() under all circumstances

When ossl_provider_query_operation() returned NULL, the post-condition
callback wasn't called, and could make algorithm_do_this() falsely
tell the caller that there was an error.  Because of this, a provider
that answered with NULL for a particular operation identity would
effectively block the same query on all following providers.

Fixes #12293

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

3 years agoFix many MarkDown issues in {NOTES*,README*,HACKING,LICENSE}.md files
Dr. David von Oheimb [Wed, 10 Jun 2020 15:49:25 +0000 (17:49 +0200)]
Fix many MarkDown issues in {NOTES*,README*,HACKING,LICENSE}.md files

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

3 years agoRename NOTES*, README*, VERSION, HACKING, LICENSE to .md or .txt
Dr. David von Oheimb [Wed, 10 Jun 2020 12:15:28 +0000 (14:15 +0200)]
Rename NOTES*, README*, VERSION, HACKING, LICENSE to .md or .txt

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

3 years agoutil/markdownlint.rb: Add two rule exceptions: MD023 and MD026
Dr. David von Oheimb [Thu, 11 Jun 2020 09:28:02 +0000 (11:28 +0200)]
util/markdownlint.rb: Add two rule exceptions: MD023 and MD026

exclude_rule 'MD023' # Headers must start at the beginning of the line
exclude_rule 'MD026' # Trailing punctuation in header

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

3 years agoapps: remove NULL check imn release_engine since ENGINE_free also does it.
Pauli [Fri, 3 Jul 2020 00:11:33 +0000 (10:11 +1000)]
apps: remove NULL check imn release_engine since ENGINE_free also does it.

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

3 years agocoverity 1464983: null pointer dereference
Pauli [Sun, 28 Jun 2020 22:39:42 +0000 (08:39 +1000)]
coverity 1464983: null pointer dereference

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