openssl.git
3 years agoFix EVP_CIPHER_CTX_set_padding for legacy path
Shane Lontis [Wed, 18 Nov 2020 09:49:19 +0000 (19:49 +1000)]
Fix EVP_CIPHER_CTX_set_padding for legacy path

Fixes #13057

When using an engine, there is no cipher->prov so a call to
EVP_CIPHER_CTX_set_padding() returns an error when
evp_do_ciph_ctx_setparams() is called. For the legacy path it needs to
avoid doing the call and just return 1.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/13437)

3 years agoEVP: don't touch the lock for evp_pkey_downgrade
Daniel Bevenius [Wed, 11 Nov 2020 04:23:11 +0000 (05:23 +0100)]
EVP: don't touch the lock for evp_pkey_downgrade

This commit tries to address a locking issue in evp_pkey_reset_unlocked
which can occur when it is called from evp_pkey_downgrade.

evp_pkey_downgrade will acquire a lock for pk->lock and if successful
then call evp_pkey_reset_unlocked. evp_pkey_reset_unlocked will call
memset on pk, and then create a new lock and set pk->lock to point to
that new lock. I believe there are two problems with this.

The first is that after the call to memset, another thread would try to
acquire a lock for NULL as that is what the value of pk->lock would be
at that point.

The second issue is that after the new lock has been assigned to
pk->lock, that lock is different from the one currently locked so
another thread trying to acquire the lock will succeed which can lead to
strange behaviour. More details and a reproducer can be found in the
Refs link below.

This changes the evp_pkey_reset_unlocked to not touch the lock
and the creation of a new lock is done in EVP_PKEY_new.

Refs:
https://github.com/danbev/learning-libcrypto/blob/master/notes/issues.md#openssl-investigationtroubleshooting
https://github.com/nodejs/node/issues/29817

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

3 years agoDocumentation improvements for EVP_DigestInit_ex and related functions
Tomas Mraz [Wed, 18 Nov 2020 15:22:08 +0000 (16:22 +0100)]
Documentation improvements for EVP_DigestInit_ex and related functions

Documenting when EVP_MD_CTX_reset() is implicitly called and when
type can be set to NULL.

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

3 years agoFix regression in EVP_DigestInit_ex: crash when called with NULL type
Tomas Mraz [Fri, 13 Nov 2020 14:57:27 +0000 (15:57 +0100)]
Fix regression in EVP_DigestInit_ex: crash when called with NULL type

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

3 years agoAdd test for no reset after DigestFinal_ex and DigestFinalXOF
Tomas Mraz [Fri, 13 Nov 2020 13:16:35 +0000 (14:16 +0100)]
Add test for no reset after DigestFinal_ex and DigestFinalXOF

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

3 years agoEVP_DigestFinalXOF must not reset the EVP_MD_CTX
Tomas Mraz [Fri, 13 Nov 2020 12:42:31 +0000 (13:42 +0100)]
EVP_DigestFinalXOF must not reset the EVP_MD_CTX

It does not do it in legacy path and 1.1.1 so that must not change.

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

3 years agoFix no-posix-io
Matt Caswell [Tue, 24 Nov 2020 15:22:25 +0000 (15:22 +0000)]
Fix no-posix-io

The "multi" variable should only be used within HTTP_DAEMON guards.
However there were a few spots where this was not the case, which
causes no-posix-io builds to fail.

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

3 years agoAPPS: Modify apps/cmp.c to use set_base_ui_method() for its -batch option
Richard Levitte [Wed, 25 Nov 2020 13:13:30 +0000 (14:13 +0100)]
APPS: Modify apps/cmp.c to use set_base_ui_method() for its -batch option

Fixes #13511

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

3 years agoAPPS: Make it possible for apps to set the base (fallback) UI_METHOD
Richard Levitte [Wed, 25 Nov 2020 13:10:29 +0000 (14:10 +0100)]
APPS: Make it possible for apps to set the base (fallback) UI_METHOD

The apps UI method acts as a proxy that bases its activity on a base
(was called fallback) UI_METHOD, which defaults to UI_OpenSSL() under
normal circumstances.

However, some apps might want to have it based on another UI_METHOD,
such as UI_null() to avoid prompting (typical for a -batch run).  The
new function set_base_ui_method() allows them to do precisely this.

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

3 years agoPrepare for 3.0 alpha 10
Matt Caswell [Thu, 26 Nov 2020 14:53:26 +0000 (14:53 +0000)]
Prepare for 3.0 alpha 10

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
3 years agoPrepare for release of 3.0 alpha 9 openssl-3.0.0-alpha9
Matt Caswell [Thu, 26 Nov 2020 14:53:04 +0000 (14:53 +0000)]
Prepare for release of 3.0 alpha 9

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
3 years agoUpdate copyright year
Matt Caswell [Thu, 26 Nov 2020 14:18:57 +0000 (14:18 +0000)]
Update copyright year

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

3 years agoDOC: Add note on how to terminate an OSSL_PARAM array
Richard Levitte [Mon, 23 Nov 2020 02:03:28 +0000 (03:03 +0100)]
DOC: Add note on how to terminate an OSSL_PARAM array

The examples are also updated to have correct terminators.

doc/man3/OSSL_PARAM.pod is deliberately written with no help from the
constructor macros described in OSSL_PARAM_int.pod.  Therefore, use of
OSSL_PARAM_END isn't shown directly here, only leaving a link to its
man-page to indicate that there is that option.

Fixes #11280

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13478)

3 years agoFix no-rc2
Matt Caswell [Tue, 24 Nov 2020 14:45:07 +0000 (14:45 +0000)]
Fix no-rc2

Skip a test that relies on RC2 being present in a no-rc2 build.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13496)

3 years agoRemove deprecation warning suppression from genpkey
Matt Caswell [Mon, 2 Nov 2020 11:04:06 +0000 (11:04 +0000)]
Remove deprecation warning suppression from genpkey

genpkey was supressing deprecation warnings in order to support ENGINE
functionality. We move all of that into a separate file so that we don't
need to suppress the warnings anymore.

Fixes #13118

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

3 years agoapps/cmp.c: fix crash with -batch option on OPENSSL_NO_UI_CONSOLE
Dr. David von Oheimb [Tue, 24 Nov 2020 15:16:08 +0000 (16:16 +0100)]
apps/cmp.c: fix crash with -batch option on OPENSSL_NO_UI_CONSOLE

Also make clear we cannot use get_ui_method() at this point.

Fixes #13494

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

3 years agoapps/cmp.c: Improve description of key loaded due to -newkew option
Dr. David von Oheimb [Wed, 25 Nov 2020 10:36:27 +0000 (11:36 +0100)]
apps/cmp.c: Improve description of key loaded due to -newkew option

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

3 years agore-encrypt 81-test_cmp_cli_data/Mock/signer.p12 with AES-256-CBC (avoiding DES)
Dr. David von Oheimb [Tue, 24 Nov 2020 15:16:57 +0000 (16:16 +0100)]
re-encrypt 81-test_cmp_cli_data/Mock/signer.p12 with AES-256-CBC (avoiding DES)

Fixes #13494

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

3 years agoRe-enable testing of ciphersuites
Matt Caswell [Tue, 10 Nov 2020 17:04:02 +0000 (17:04 +0000)]
Re-enable testing of ciphersuites

Commit be9d82bb3 inadvertently disabled ciphersuite testing. This masked
some issues. Therefore we fix this testing.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13378)

3 years agoFix RC4-MD5 based ciphersuites
Matt Caswell [Wed, 11 Nov 2020 11:07:12 +0000 (11:07 +0000)]
Fix RC4-MD5 based ciphersuites

The RC4-MD5 ciphersuites were not removing the length of the MAC when
calculating the length of decrypted TLS data. Since RC4 is a streamed
cipher that doesn't use padding we separate out the concepts of fixed
length TLS data to be removed, and TLS padding.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13378)

3 years agoEnsure Stream ciphers know how to remove a TLS MAC
Matt Caswell [Tue, 10 Nov 2020 16:01:11 +0000 (16:01 +0000)]
Ensure Stream ciphers know how to remove a TLS MAC

We previously updated the block ciphers to know how to remove a TLS
MAC when using Encrypt-then-MAC. We also need to do the same for stream
ciphers.

Fixes #13363

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13378)

3 years agoTest that OSSL_STORE can load various types of params
Matt Caswell [Wed, 18 Nov 2020 12:07:43 +0000 (12:07 +0000)]
Test that OSSL_STORE can load various types of params

There have been instances where OSSL_STORE got confused between DSA and
DH params (e.g. see issue #13046) due the DER encoding of DH and DSA params
looking identical. Therefore we test that we get the types that we expect.

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

3 years agoTest various deprecated PEM_read_bio_* APIs
Matt Caswell [Tue, 17 Nov 2020 17:18:08 +0000 (17:18 +0000)]
Test various deprecated PEM_read_bio_* APIs

Add tests for various deprecated PEM_read_bio_*() functions to ensure
they can still read the various files.

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

3 years agoDon't forget the datatype when decoding a PEM file
Matt Caswell [Thu, 5 Nov 2020 17:28:59 +0000 (17:28 +0000)]
Don't forget the datatype when decoding a PEM file

The OSSL_STORE code was forgetting the datatype that we read from the
PEM header when decoding the DER.

Fixes #13046

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

3 years agoAPPS: Guard use of IPv6 functions and constants with a check of AF_INET6
Richard Levitte [Mon, 23 Nov 2020 08:12:47 +0000 (09:12 +0100)]
APPS: Guard use of IPv6 functions and constants with a check of AF_INET6

Fixes #13482

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

3 years agoUndeprecate the -dsaparam option in the dhparam app
Matt Caswell [Mon, 23 Nov 2020 12:01:34 +0000 (12:01 +0000)]
Undeprecate the -dsaparam option in the dhparam app

The -dsaparam option was deprecated because it was previously using
deprecated functions in order to operate. This is no longer the case
and therefore does not need to be deprecated.

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

3 years agoAdd missing ERR_load_KDF_strings(3) to util/missingcrypto111.txt as well.
Richard Levitte [Fri, 20 Nov 2020 12:41:46 +0000 (13:41 +0100)]
Add missing ERR_load_KDF_strings(3) to util/missingcrypto111.txt as well.

This partially reverts commit a308acb2c2809cb9ac30e8e987b2bdfb21f096e0.

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

3 years agoERR: Rebuild all generated error headers and source files
Richard Levitte [Thu, 12 Nov 2020 09:36:47 +0000 (10:36 +0100)]
ERR: Rebuild all generated error headers and source files

This is the result of 'make errors ERROR_REBUILD=-rebuild'

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

3 years agoModify the ERR init functions to use the internal ERR string loaders
Richard Levitte [Thu, 12 Nov 2020 08:19:24 +0000 (09:19 +0100)]
Modify the ERR init functions to use the internal ERR string loaders

This deprecates all the ERR_load_ functions, and moves their definition to
separate C source files that can easily be removed when those functions are
finally removed.

This also reduces include/openssl/kdferr.h to include cryptoerr_legacy.h,
moves the declaration of ERR_load_ERR_strings() from include/openssl/err.h
to include/openssl/cryptoerr_legacy.h, and finally removes the declaration
of ERR_load_DSO_strings(), which was entirely internal anyway.

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

3 years agoERR: Modify util/mkerr.pl to produce internal err string loaders
Richard Levitte [Thu, 12 Nov 2020 08:12:41 +0000 (09:12 +0100)]
ERR: Modify util/mkerr.pl to produce internal err string loaders

This also modifies the .ec L statement to take a third file, which is
the internal header file to declare internal things.  This is only
useful for our internal declarations and will not affect engines.

Fixes #10527

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

3 years agoTurn on Github CI
Matt Caswell [Mon, 23 Nov 2020 16:10:57 +0000 (16:10 +0000)]
Turn on Github CI

As an interim measure until we work out our longer term CI strategy
this PR enables some basic CI tests using the Github CI capability.

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

3 years agoFix double-free in decoder_pkey.c
Petr Gotthard [Sun, 22 Nov 2020 16:50:53 +0000 (17:50 +0100)]
Fix double-free in decoder_pkey.c

Fix for the issue #13472. The decoderctx has to be initialized in every
cycle as its constructor may not be called due to lazy evaluation of
the if-condition.

CLA: trivial

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

3 years agoTEST: Make our test data binary
Richard Levitte [Mon, 23 Nov 2020 01:26:34 +0000 (02:26 +0100)]
TEST: Make our test data binary

Our test data (test/data.txt and test/data2.txt) are text files, but
declaring them binary means that there will be no line ending
transformation done on them.  This is necessary for testing on
non-Unix platforms, where certain tests could otherwise give results
that don't match expected results.

Fixes #13474

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

3 years agoMove some libssl global variables into SSL_CTX
Matt Caswell [Fri, 20 Nov 2020 17:23:57 +0000 (17:23 +0000)]
Move some libssl global variables into SSL_CTX

disabled_enc_mask et al were global. Now that cipher loading is done
individually for each SSL_CTX, based on the libctx configured for that
SSL_CTX this means that some things will be disabled for one SSL_CTX but
not for another. The global variables set up the potential for different
SSL_CTXs to trample on each other. We move these variables into the SSL_CTX
structure.

Fixes #12040

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

3 years agoAdd a test for the dhparam CLI application
Matt Caswell [Thu, 22 Oct 2020 09:23:43 +0000 (10:23 +0100)]
Add a test for the dhparam CLI application

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13231)

3 years agoRemove some unneeded variables from dhparam
Matt Caswell [Wed, 14 Oct 2020 15:28:01 +0000 (16:28 +0100)]
Remove some unneeded variables from dhparam

Previously changes left some variables behind that were no longer needed.
We now remove them.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13231)

3 years agoAdd encoder support to dhparam
Matt Caswell [Thu, 1 Oct 2020 08:19:28 +0000 (09:19 +0100)]
Add encoder support to dhparam

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13231)

3 years agoConvert dhparam to be fully based on EVP
Matt Caswell [Tue, 29 Sep 2020 15:32:11 +0000 (16:32 +0100)]
Convert dhparam to be fully based on EVP

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13231)

3 years agoSupport for Android NDK r22-beta1
Fred Hornsey [Wed, 18 Nov 2020 04:20:43 +0000 (22:20 -0600)]
Support for Android NDK r22-beta1

I think builds using standalone toolchain are fine so I left them alone,
but `Configure` will fail if using the NDK directly because the
`platforms` and `sysroot` directories were removed.

If `sysroot` is missing, omit the `--sysroot` and `-gcc-toolchain`
arguments and use the triplet form clang command.

Also since `platforms` was being used for the default API level, use
`meta/platforms.json` instead if needed.

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

3 years agoRSA: Fix guard mixup
Richard Levitte [Thu, 19 Nov 2020 07:13:00 +0000 (08:13 +0100)]
RSA: Fix guard mixup

A OSSL_DEPRECATEDIN_0_9_8 function was surrounded by a
OPENSSL_NO_DEPRECATED_3_0 guard.

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

3 years agox509_vfy.c: Remove superfluous assignment to 'ret' in check_chain()
Ankita Shetty [Fri, 20 Nov 2020 09:15:35 +0000 (10:15 +0100)]
x509_vfy.c: Remove superfluous assignment to 'ret' in check_chain()

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

3 years agoutil/fix-deprecation: DEPRECATEDIN conversion util for public headers
Richard Levitte [Sun, 25 Oct 2020 06:09:04 +0000 (07:09 +0100)]
util/fix-deprecation: DEPRECATEDIN conversion util for public headers

Use this for quick and easy conversion of old-style to new-style deprecation:

    perl util/fix-deprecation \
         < include/openssl/rsa.h > include/openssl/rsa.h.new
    mv include/openssl/rsa.h.new include/openssl/rsa.h

This is not a perfect utility, but it does the job.  It doesn't try to
re-indent, that's left for manual post processing.

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

3 years agoossl_cmp_certreq_new(): Fix POPO key mismatch in case newPkey is just public key
Dr. David von Oheimb [Fri, 13 Nov 2020 20:45:46 +0000 (21:45 +0100)]
ossl_cmp_certreq_new(): Fix POPO key mismatch in case newPkey is just public key

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

3 years agoCMP: prevent misleading PKIStatusInfo output if not response available
Dr. David von Oheimb [Fri, 13 Nov 2020 20:32:31 +0000 (21:32 +0100)]
CMP: prevent misleading PKIStatusInfo output if not response available

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

3 years agoapps/cmp.c: Improve diagnostics on -server URL parse error
Dr. David von Oheimb [Fri, 13 Nov 2020 07:39:14 +0000 (08:39 +0100)]
apps/cmp.c: Improve diagnostics on -server URL parse error

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

3 years agoapps/cmp.c: Add diagnostics on config file section(s) used
Dr. David von Oheimb [Thu, 12 Nov 2020 19:35:50 +0000 (20:35 +0100)]
apps/cmp.c: Add diagnostics on config file section(s) used

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

3 years agoapps.c: re-enable loading single certs and CRLs over HTTP
Dr. David von Oheimb [Fri, 13 Nov 2020 17:47:03 +0000 (18:47 +0100)]
apps.c: re-enable loading single certs and CRLs over HTTP

Fixes #13403

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

3 years agoSSL: Change SSLerr() to ERR_raise()
Richard Levitte [Thu, 19 Nov 2020 07:37:18 +0000 (08:37 +0100)]
SSL: Change SSLerr() to ERR_raise()

This was probably due to a merge

Fixes #13449

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

3 years agoFix crash in genpkey app when -pkeyopt digest:name is used for DH or DSA.
Shane Lontis [Wed, 18 Nov 2020 01:32:33 +0000 (11:32 +1000)]
Fix crash in genpkey app when -pkeyopt digest:name is used for DH or DSA.

By the time the keygen is called the references to strings inside the
gen ctx are floating pointers. A strdup solves this problem.

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

3 years agoHaiku system build fix.
David Carlier [Wed, 18 Nov 2020 10:21:45 +0000 (10:21 +0000)]
Haiku system build fix.

overriding ar and flags from BASE_common mainly.

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

3 years agotest RNG: set state to uninitialised as part of uninstantiate call.
Pauli [Wed, 4 Nov 2020 03:05:46 +0000 (13:05 +1000)]
test RNG: set state to uninitialised as part of uninstantiate call.

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

3 years agodisassociate test RNG from the DRBGs
Pauli [Mon, 2 Nov 2020 02:03:31 +0000 (12:03 +1000)]
disassociate test RNG from the DRBGs

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

3 years agoprov: move the entropy source out of the FIPS provider
Pauli [Fri, 30 Oct 2020 05:54:03 +0000 (15:54 +1000)]
prov: move the entropy source out of the FIPS provider

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

3 years agotest: changes resulting from moving the entropy source out of the FIPS provider
Pauli [Fri, 30 Oct 2020 05:53:47 +0000 (15:53 +1000)]
test: changes resulting from moving the entropy source out of the FIPS provider

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

3 years agorand: move the entropy source out of the FIPS provider
Pauli [Fri, 30 Oct 2020 05:53:22 +0000 (15:53 +1000)]
rand: move the entropy source out of the FIPS provider

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

3 years agodoc: Documentation changes for moving the entropy source out of the fips provider
Pauli [Fri, 30 Oct 2020 05:39:10 +0000 (15:39 +1000)]
doc: Documentation changes for moving the entropy source out of the fips provider

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

3 years agoAdd a test for setting, popping and clearing error marks
Matt Caswell [Fri, 6 Nov 2020 12:53:01 +0000 (12:53 +0000)]
Add a test for setting, popping and clearing error marks

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13335)

3 years agoAllow multiple nested marks
Matt Caswell [Fri, 6 Nov 2020 11:43:44 +0000 (11:43 +0000)]
Allow multiple nested marks

Previously we only ever allowed one mark to be set against an error in the
statck. If we attempted to nest them, then we would end up clearing all
the errors in the stack when we popped to the mark.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13335)

3 years agoFix some warnings from clang 10 in params.c
Pauli [Wed, 11 Nov 2020 11:52:32 +0000 (21:52 +1000)]
Fix some warnings from clang 10 in params.c

clang 10 was emitting warnings similar to the following from params.c:

crypto/params.c:411:40: error: implicit conversion from 'long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-int-float-conversion]
            if (d >= INT64_MIN && d <= INT64_MAX && d == (int64_t)d) {

Also fixed some other conversion problems when sizeof(double) == 4.

Alternative to #13366

Fixes #13365

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

3 years agoapps/pkcs12: Clean up the order in which many options are presented
Dr. David von Oheimb [Mon, 10 Aug 2020 12:23:46 +0000 (14:23 +0200)]
apps/pkcs12: Clean up the order in which many options are presented

Also do a minor extension on the documentation of the -passcerts option

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

3 years agoe_loader_attic.c: Improve result handling of file_load_try_decode()
Dr. David von Oheimb [Sat, 6 Jun 2020 11:59:25 +0000 (13:59 +0200)]
e_loader_attic.c: Improve result handling of file_load_try_decode()

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

3 years agoAllow for PKCS#12 input without MAC in p12_kiss.c and e_loader_attic.c
Dr. David von Oheimb [Mon, 11 May 2020 13:51:34 +0000 (15:51 +0200)]
Allow for PKCS#12 input without MAC in p12_kiss.c and e_loader_attic.c

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

3 years agoe_loader_attic.c: Remove redundant 'pass phrase' sub-string from try_decode_PKCS12()
Dr. David von Oheimb [Sat, 6 Jun 2020 12:00:21 +0000 (14:00 +0200)]
e_loader_attic.c: Remove redundant 'pass phrase' sub-string from try_decode_PKCS12()

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

3 years agoapps/storeutl: Add error output in case of parse/decryption/mac errors in input files
Dr. David von Oheimb [Mon, 11 May 2020 13:50:36 +0000 (15:50 +0200)]
apps/storeutl: Add error output in case of parse/decryption/mac errors in input files

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

3 years agoapps/pkcs12: Really do not perform MAC in case -nomac
Dr. David von Oheimb [Mon, 11 May 2020 13:49:34 +0000 (15:49 +0200)]
apps/pkcs12: Really do not perform MAC in case -nomac

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

3 years agoapps/pkcs12: Do not prompt for password in case -nomac and -noenc/-nodes
Dr. David von Oheimb [Mon, 11 May 2020 13:48:52 +0000 (15:48 +0200)]
apps/pkcs12: Do not prompt for password in case -nomac and -noenc/-nodes

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

3 years agoMinor improvements of doc for ca and x509 app
Dr. David von Oheimb [Mon, 14 Sep 2020 17:17:28 +0000 (19:17 +0200)]
Minor improvements of doc for ca and x509 app

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

3 years agoapps/pkcs12: Retain test output files
David von Oheimb [Thu, 14 Dec 2017 13:02:27 +0000 (14:02 +0100)]
apps/pkcs12: Retain test output files

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

3 years agoMinor cleanup of error output for various apps
David von Oheimb [Thu, 14 Dec 2017 10:10:33 +0000 (11:10 +0100)]
Minor cleanup of error output for various apps

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

3 years agoapps/ca: Minor code and doc cleanup
David von Oheimb [Thu, 14 Dec 2017 07:04:00 +0000 (08:04 +0100)]
apps/ca: Minor code and doc cleanup

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

3 years agoDeprecate RSA harder
Richard Levitte [Sun, 4 Oct 2020 14:34:31 +0000 (16:34 +0200)]
Deprecate RSA harder

This deprecates all functions that deal with the types RSA and RSA_METHOD

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13096)

3 years agoRename internal drbg_ functions so they have an ossl_ prefix.
Pauli [Mon, 16 Nov 2020 02:18:56 +0000 (12:18 +1000)]
Rename internal drbg_ functions so they have an ossl_ prefix.

These functions are: drbg_enable_locking(), drbg_get_ctx_params(),
drbg_lock(), drbg_set_ctx_params() and drbg_unlock().

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

3 years agoRename SHA3 internal functions so they have an ossl_ prefix
Pauli [Mon, 16 Nov 2020 02:14:26 +0000 (12:14 +1000)]
Rename SHA3 internal functions so they have an ossl_ prefix

These are: keccak_kmac_init(), sha3_final(), sha3_init(), sha3_reset() and
sha3_update().

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

3 years agorename sha1_ctrl to ossl_sha1_ctrl.
Pauli [Mon, 16 Nov 2020 02:08:30 +0000 (12:08 +1000)]
rename sha1_ctrl to ossl_sha1_ctrl.

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

3 years agoProvide side RNG functions renamed to have an ossl_ prefix.
Pauli [Mon, 16 Nov 2020 02:04:56 +0000 (12:04 +1000)]
Provide side RNG functions renamed to have an ossl_ prefix.

These are: prov_crngt_cleanup_entropy(), prov_crngt_get_entropy(),
prov_pool_acquire_entropy(), prov_pool_add_nonce_data(),
prov_rand_drbg_free() and prov_rand_drbg_new().

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

3 years agorename mac_key_* to ossl_mac_key_*
Pauli [Mon, 16 Nov 2020 02:00:34 +0000 (12:00 +1000)]
rename mac_key_* to ossl_mac_key_*

mac_key_free(), mac_key_new(), mac_key_up_ref().

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

3 years agorename md5_block_asm_data_order to ossl_md5_block_asm_data_order
Pauli [Mon, 16 Nov 2020 01:57:52 +0000 (11:57 +1000)]
rename md5_block_asm_data_order to ossl_md5_block_asm_data_order

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

3 years agoRename md5_sha1_* ossl_md5_sha1_*
Pauli [Mon, 16 Nov 2020 01:52:39 +0000 (11:52 +1000)]
Rename md5_sha1_* ossl_md5_sha1_*

md5_sha1_init(), md5_sha1_update(), md5_sha1_final() and md5_sha1_ctrl().

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

3 years agoDOC: Fix example in OSSL_PARAM_int.pod
Richard Levitte [Tue, 17 Nov 2020 08:55:49 +0000 (09:55 +0100)]
DOC: Fix example in OSSL_PARAM_int.pod

This fixes an incorrect NULL check.

Fixes #11162

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

3 years agoSwap to FIPS186-2 DSA generation outside of the FIPS module
Matt Caswell [Fri, 23 Oct 2020 11:35:00 +0000 (12:35 +0100)]
Swap to FIPS186-2 DSA generation outside of the FIPS module

Inside the FIPS module we continue to use FIPS186-4. We prefer FIPS186-2
in the default provider for backwards compatibility reasons.

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

3 years agoSwap to DH_PARAMGEN_TYPE_GENERATOR as the default outside of the FIPS module
Matt Caswell [Thu, 22 Oct 2020 12:54:11 +0000 (13:54 +0100)]
Swap to DH_PARAMGEN_TYPE_GENERATOR as the default outside of the FIPS module

The documentation claimed this was already the default but it wasn't. This
was causing the dhparam application to change behaviour when compared to
1.1.1

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

3 years agoAdapt ssltest_old to not use deprecated DH APIs
Matt Caswell [Mon, 2 Nov 2020 16:59:15 +0000 (16:59 +0000)]
Adapt ssltest_old to not use deprecated DH APIs

There are non-deprecated replacements so we should use those instead.

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

3 years agoExtend the auto DH testing to check DH sizes
Matt Caswell [Thu, 29 Oct 2020 17:18:54 +0000 (17:18 +0000)]
Extend the auto DH testing to check DH sizes

Check that the size of the DH parameters we select changes according to
the size of the certificate key or symmetric cipher (if no certificate).

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

3 years agoAdd some additional test certificates/keys
Matt Caswell [Thu, 29 Oct 2020 16:46:56 +0000 (16:46 +0000)]
Add some additional test certificates/keys

Add certs with 1024, 3072, 4096 and 8192 bit RSA keys

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

3 years agoAdd a CHANGES.md entry for the "tmp_dh" functions/macros
Matt Caswell [Fri, 23 Oct 2020 15:44:35 +0000 (16:44 +0100)]
Add a CHANGES.md entry for the "tmp_dh" functions/macros

Describe the tmp_dh deprecations, and what applications should do instead.

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

3 years agoAdd a test for the various ways of setting temporary DH params
Matt Caswell [Wed, 21 Oct 2020 15:00:48 +0000 (16:00 +0100)]
Add a test for the various ways of setting temporary DH params

We support a number of different ways of setting temporary DH params. We
should test that they all work correctly.

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

3 years agoDocument some SSL DH related functions/macros
Matt Caswell [Wed, 21 Oct 2020 14:07:01 +0000 (15:07 +0100)]
Document some SSL DH related functions/macros

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

3 years agoReturn sensible values for some SSL ctrls
Matt Caswell [Wed, 21 Oct 2020 14:06:28 +0000 (15:06 +0100)]
Return sensible values for some SSL ctrls

Some ctrls were always returning 0 even if they were successful.

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

3 years agoOnly disabled what we need to in a no-dh build
Matt Caswell [Fri, 16 Oct 2020 15:35:44 +0000 (16:35 +0100)]
Only disabled what we need to in a no-dh build

no-dh disables the low level API for DH. However, since we're now using
the high level EVP API in most places we don't need to disable quite so
much.

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

3 years agoImplement a replacement for SSL_set_tmp_dh()
Matt Caswell [Thu, 15 Oct 2020 15:45:54 +0000 (16:45 +0100)]
Implement a replacement for SSL_set_tmp_dh()

The old function took a DH as a parameter. In the new version we pass
an EVP_PKEY instead. Similarly for the SSL_CTX version of this function.

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

3 years agoRemove deprecated functionality from s_server
Matt Caswell [Wed, 14 Oct 2020 16:30:17 +0000 (17:30 +0100)]
Remove deprecated functionality from s_server

This will be added back in by a later commit

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

3 years agoDisable the DHParameters config option in a no-deprecated build
Matt Caswell [Wed, 14 Oct 2020 16:13:45 +0000 (17:13 +0100)]
Disable the DHParameters config option in a no-deprecated build

This option calls SSL_set_tmp_dh() which does not exist in a no-deprecated
build. We need to implement an alternative.

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

3 years agoRemove DH usage from tls_process_cke_dhe
Matt Caswell [Wed, 14 Oct 2020 15:19:16 +0000 (16:19 +0100)]
Remove DH usage from tls_process_cke_dhe

We instead set the encoded public key directly in the EVP_PKEY object.

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

3 years agoRemove DH usage in tls_construct_server_key_exchange()
Matt Caswell [Wed, 14 Oct 2020 15:12:05 +0000 (16:12 +0100)]
Remove DH usage in tls_construct_server_key_exchange()

We get DH related parameters directly from the EVP_PKEY instead of
downgrading to a DH object first.

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

3 years agoAvoid the use of a DH object in tls_construct_cke_dhe()
Matt Caswell [Wed, 14 Oct 2020 15:01:56 +0000 (16:01 +0100)]
Avoid the use of a DH object in tls_construct_cke_dhe()

There is no need for us to downgrade the EVP_PKEY into a DH object
for this function so we rewrite things to avoid it.

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

3 years agoDeprecate SSL_CTRL_SET_TMP_DH and other related ctrls
Matt Caswell [Wed, 14 Oct 2020 14:06:28 +0000 (15:06 +0100)]
Deprecate SSL_CTRL_SET_TMP_DH and other related ctrls

These ctrls pass around a DH object which is now deprecated, so we
deprecate the ctrls themselves.

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

3 years agoConvert TLS ServerKeyExchange processing to use an EVP_PKEY
Matt Caswell [Wed, 14 Oct 2020 12:41:32 +0000 (13:41 +0100)]
Convert TLS ServerKeyExchange processing to use an EVP_PKEY

Previously we were constructing a DH object and then assigning it to an
EVP_PKEY. Instead we construct an EVP_PKEY directly.

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

3 years agoConvert TLS auto DH parameters to use EVP_PKEY
Matt Caswell [Wed, 14 Oct 2020 08:25:35 +0000 (09:25 +0100)]
Convert TLS auto DH parameters to use EVP_PKEY

Previously a DH object was constructed and then assigned to an EVP_PKEY.
Instead we now construct the EVP_PKEY directly instead.

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

3 years agoDOC: Rewrite the section on reporting errors in doc/man3/ERR_put_error.pod
Richard Levitte [Sat, 14 Nov 2020 10:58:17 +0000 (11:58 +0100)]
DOC: Rewrite the section on reporting errors in doc/man3/ERR_put_error.pod

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13320)

3 years agoCONF: Convert one last CONFerr() to ERR_raise()
Richard Levitte [Sat, 14 Nov 2020 10:58:03 +0000 (11:58 +0100)]
CONF: Convert one last CONFerr() to ERR_raise()

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13320)