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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
Richard Levitte [Wed, 4 Nov 2020 11:16:35 +0000 (12:16 +0100)]
Simplify util/err-to-raise
There's no need to enumerate the possible {NAME}err, as they have a
consistent pattern. Also, this script should not be used on the
engines, as they have already converted appropriately.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13320)
Richard Levitte [Wed, 4 Nov 2020 15:28:09 +0000 (16:28 +0100)]
Really deprecate the old NAMEerr() macros
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13320)
Richard Levitte [Sun, 15 Nov 2020 18:20:32 +0000 (19:20 +0100)]
util/find-doc-nits: check podchecker() return value
From the Pod::Checker manual:
> RETURN VALUE
> podchecker returns the number of POD syntax errors found or
> -1 if there were no POD commands at all found in the file.
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/13416)
Richard Levitte [Sun, 15 Nov 2020 08:57:00 +0000 (09:57 +0100)]
util/mkrc.pl: Make sure FILEVERSION and PRODUCTVERSION have four numbers
Partially fixes #13414
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13415)
David Carlier [Mon, 16 Nov 2020 11:02:24 +0000 (11:02 +0000)]
NetBSD build fix.
getentropy shows up wrongly as weak symbol whereas there is no support.
However NetBSD 10.0 will support getrandom.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13408)
Richard Levitte [Sat, 14 Nov 2020 21:38:37 +0000 (22:38 +0100)]
DOC: Fixup the description of the -x509_strict option
POD commands must always be surrounded by blank lines
POD transformers read everything in paragraph mode. The following
lines become *one* command, where the second line becomes part of the
text of the first, including the command itself. In other words,
this:
=item something
=item something else
Translates to this in a man-page:
something =item something else
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/13412)
Shane Lontis [Thu, 12 Nov 2020 07:57:12 +0000 (17:57 +1000)]
Fix dsa securitycheck for fips.
Fixes #12627
Changed security check for DSA verification to match SP800-131Ar2 when
the security strength is < 112.
Fixed compilation error when using config opt 'no-fips-securitychecks'
Removed TODO's from 20-test_cli_fips.t - there is no longer an TODO error.
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13387)
Shane Lontis [Thu, 12 Nov 2020 08:35:14 +0000 (18:35 +1000)]
Add documentation for EVP_PKEY2PKCS8/EVP_PKCS82PKEY
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13388)
Shane Lontis [Wed, 11 Nov 2020 23:04:40 +0000 (09:04 +1000)]
Fixup EVP-MAC-KMAC documentation
Fixes #13232
Added example that shows setup of XOF.
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13385)
Daniel Bevenius [Thu, 12 Nov 2020 08:51:14 +0000 (09:51 +0100)]
REF_PRINT: cast pointer to void to avoid warnings
Currently, when configuring OpenSSL and specifying the --strict-warnings
option there are failures like the following one:
crypto/bio/bio_lib.c: In function 'BIO_up_ref':
include/internal/refcount.h:169:25: error: format '%p' expects argument
of type 'void *', but argument 3 has type 'BIO *'
{aka 'struct bio_st *'} [-Werror=format=]
169 | fprintf(stderr, "%p:%4d:%s\n", b, b->references, a)
| ^~~~~~~~~~~~~
crypto/bio/bio_lib.c:185:5:
note: in expansion of macro'REF_PRINT_COUNT'
185 | REF_PRINT_COUNT("BIO", a);
| ^~~~~~~~~~~~~~~
include/internal/refcount.h:169:27: note: format string is defined here
169 | fprintf(stderr, "%p:%4d:%s\n", b, b->references, a)
| ~^
| |
| void *
cc1: all warnings being treated as errors
This commit adds casts to avoid the warnings.
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13389)
Pauli [Wed, 11 Nov 2020 11:13:12 +0000 (21:13 +1000)]
Document the provider KDF API.
Fixes #11351
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13376)
Richard Levitte [Sat, 17 Oct 2020 06:59:48 +0000 (08:59 +0200)]
test/endecoder_legacy_test.c: new test for legacy comparison
It checks that all of these functions have a corresponding
OSSL_ENCODER implementation, and that the output is the same:
- i2d_{TYPE}PrivateKey
- i2d_{TYPE}PublicKey
- i2d_{TYPE}params
- i2d_{TYPE}_PUBKEY
- PEM_write_bio_{TYPE}PrivateKey
- PEM_write_bio_{TYPE}PublicKey
- PEM_write_bio_{TYPE}Parameters
- PEM_write_bio_{TYPE}_PUBKEY
It also checks that all of these functions have a corresponding
OSSL_DECODER implementation, and that the decoding result matches:
- d2i_{TYPE}PrivateKey()
- d2i_{TYPE}PublicKey(),
- d2i_{TYPE}params(),
- d2i_{TYPE}_PUBKEY(),
- PEM_read_bio_{TYPE}PrivateKey()
- PEM_read_bio_{TYPE}PublicKey()
- PEM_read_bio_{TYPE}params()
- PEM_read_bio_{TYPE}_PUBKEY()
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13262)
Richard Levitte [Fri, 13 Nov 2020 10:05:47 +0000 (11:05 +0100)]
Fix SUPPORT.md for better readability
Most of the text was duplicated, and the second copy had better
section titles that made the intent more prominent.
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/13398)
Richard Levitte [Fri, 13 Nov 2020 09:03:54 +0000 (10:03 +0100)]
Fix a few github file references
https://github.com/openssl/openssl/blob/master/.github/SUPPORT.md ->
https://github.com/openssl/openssl/blob/master/SUPPORT.md
Fixes #13396
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13397)
Rich Salz [Thu, 12 Nov 2020 00:10:22 +0000 (19:10 -0500)]
Remove -C option from x509 command
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13384)
Rich Salz [Wed, 11 Nov 2020 23:03:38 +0000 (18:03 -0500)]
Remove -C from dhparam,dsaparam,ecparam
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13384)
Richard Levitte [Tue, 10 Nov 2020 09:45:07 +0000 (10:45 +0100)]
BIO: Undefine UNICODE in b_addr.c to get POSIX declaration of gai_strerror()
When UNICODE is defined, Windows headers push for WCHAR implementations,
which aren't compatible with POSIX declarations.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13318)
Richard Levitte [Tue, 10 Nov 2020 09:28:16 +0000 (10:28 +0100)]
crypto/provider_core.c: fix a couple of faulty ERR_raise_data() calls
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13318)
Richard Levitte [Wed, 4 Nov 2020 15:14:00 +0000 (16:14 +0100)]
CRYPTO: refactor ERR_raise()+ERR_add_error_data() to ERR_raise_data()
This is not done absolutely everywhere, as there are places where
the use of ERR_add_error_data() is quite complex, but at least the
simple cases are done.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13318)
Richard Levitte [Wed, 4 Nov 2020 11:23:19 +0000 (12:23 +0100)]
Convert all {NAME}err() in crypto/ to their corresponding ERR_raise() call
This includes error reporting for libcrypto sub-libraries in surprising
places.
This was done using util/err-to-raise
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13318)
Richard Levitte [Fri, 25 Sep 2020 18:02:56 +0000 (20:02 +0200)]
EVP: Adapt EVP_PKEY2PKCS8() to better handle provider-native keys
It doesn't downgread the keys to legacy any more. Instead, it uses
OSSL_ENCODER to encode the key to DER, and d2i_PKCS8_PRIV_KEY_INFO()
to make a PKCS8_PRIV_KEY_INFO structure from that.
Fixes #12990
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12995)
David Carlier [Wed, 11 Nov 2020 10:01:22 +0000 (10:01 +0000)]
DragonFlyBSD build fix and update.
getentropy call is not supported however getrandom since the 5.7.x branch is.
current LTS stable is 5.8.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13375)
Shane Lontis [Wed, 11 Nov 2020 05:04:56 +0000 (15:04 +1000)]
Remove unused helper functions EVP_str2ctrl() & EVP_hex2ctrl().
These were added when the EVP_MAC work was being done.
I dont think these lightweight wrappers are required, and it seems better to remove them,
rather than adding documentation.
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13372)
Nicola Tuveri [Wed, 4 Nov 2020 13:39:42 +0000 (15:39 +0200)]
[test/recipes] Split test_fuzz into separate recipes
When using `HARNESS_JOBS` to run the tests in parallel, no matter the
level of parallelism that can be used, the monolithic `test_fuzz` takes
a long time to run, conditioning the duration of the whole build.
This commit splits the single `test_fuzz` recipe into separate recipes
for each fuzzer.
The previous mechanism to select individual fuzz tests using the
`FUZZ_TESTS` environment variable is also dropped (and documentation
updated).
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13307)
XiaokangQian [Fri, 13 Mar 2020 03:27:34 +0000 (03:27 +0000)]
Optimize AES-XTS mode in OpenSSL for aarch64
Aes-xts mode can be optimized by interleaving cipher operation on
several blocks and loop unrolling. Interleaving needs one ideal
unrolling factor, here we adopt the same factor with aes-cbc,
which is described as below:
If blocks number > 5, select 5 blocks as one iteration,every
loop, decrease the blocks number by 5.
If left blocks < 5, treat them as tail blocks.
Detailed implementation has a little adjustment for squeezing
code space.
With this way, for small size such as 16 bytes, the performance is
similar as before, but for big size such as 16k bytes, the performance
improves a lot, even reaches to 2x uplift, for some arches such as A57,
the improvement even reaches more than 2x uplift. We collect many
performance datas on different micro-archs such as thunderx2,
ampere-emag, a72, a75, a57, a53 and N1, all of which reach 0.5-2x uplift.
The following table lists the encryption performance data on aarch64,
take a72, a75, a57, a53 and N1 as examples. Performance value takes the
unit of cycles per byte, takes the format as comparision of values.
List them as below:
A72:
Before optimization After optimization Improve
evp-aes-128-xts@16 8.
899913518 5.
949087263 49.60%
evp-aes-128-xts@64 4.
525512668 3.
389141845 33.53%
evp-aes-128-xts@256 3.
502906908 1.
633573479 114.43%
evp-aes-128-xts@1024 3.
174210419 1.
155952639 174.60%
evp-aes-128-xts@8192 3.
053019303 1.
028134888 196.95%
evp-aes-128-xts@16384 3.
025292462 1.
02021169 196.54%
evp-aes-256-xts@16 9.
971105023 6.
754233758 47.63%
evp-aes-256-xts@64 4.
931479093 3.
786527393 30.24%
evp-aes-256-xts@256 3.
746788153 1.
943975947 92.74%
evp-aes-256-xts@1024 3.
401743802 1.
477394648 130.25%
evp-aes-256-xts@8192 3.
278769327 1.
32950421 146.62%
evp-aes-256-xts@16384 3.
27093296 1.
325276257 146.81%
A75:
Before optimization After optimization Improve
evp-aes-128-xts@16 8.
397965173 5.
126839098 63.80%
evp-aes-128-xts@64 4.
176860631 2.
59817764 60.76%
evp-aes-128-xts@256 3.
069126585 1.
284561028 138.92%
evp-aes-128-xts@1024 2.
805962699 0.
932754655 200.83%
evp-aes-128-xts@8192 2.
725820131 0.
829820397 228.48%
evp-aes-128-xts@16384 2.
71521905 0.
823251591 229.82%
evp-aes-256-xts@16 11.
24790935 7.
383914448 52.33%
evp-aes-256-xts@64 5.
294128847 3.
048641998 73.66%
evp-aes-256-xts@256 3.
861649617 1.
570359905 145.91%
evp-aes-256-xts@1024 3.
537646797 1.
200493533 194.68%
evp-aes-256-xts@8192 3.
435353012 1.
085345319 216.52%
evp-aes-256-xts@16384 3.
437952563 1.
097963822 213.12%
A57:
Before optimization After optimization Improve
evp-aes-128-xts@16 10.
57455446 7.
165438012 47.58%
evp-aes-128-xts@64 5.
418185447 3.
721241202 45.60%
evp-aes-128-xts@256 3.
855184592 1.
747145379 120.66%
evp-aes-128-xts@1024 3.
477199757 1.
253049735 177.50%
evp-aes-128-xts@8192 3.
36768104 1.
091943159 208.41%
evp-aes-128-xts@16384 3.
360373443 1.
088942789 208.59%
evp-aes-256-xts@16 12.
54559459 8.
745489036 43.45%
evp-aes-256-xts@64 6.
542808937 4.
326387568 51.23%
evp-aes-256-xts@256 4.
62668822 2.
119908754 118.25%
evp-aes-256-xts@1024 4.
161716505 1.
557335554 167.23%
evp-aes-256-xts@8192 4.
032462227 1.
377749511 192.68%
evp-aes-256-xts@16384 4.
023293877 1.
371558933 193.34%
A53:
Before optimization After optimization Improve
evp-aes-128-xts@16 18.
07842135 13.
96980808 29.40%
evp-aes-128-xts@64 7.
933818397 6.
07159276 30.70%
evp-aes-128-xts@256 5.
264604704 2.
611155744 101.60%
evp-aes-128-xts@1024 4.
606660117 1.
722713454 167.40%
evp-aes-128-xts@8192 4.
405160115 1.
454379201 202.90%
evp-aes-128-xts@16384 4.
401592028 1.
442279392 205.20%
evp-aes-256-xts@16 20.
07084054 16.
00803726 25.40%
evp-aes-256-xts@64 9.
192647294 6.
883876732 33.50%
evp-aes-256-xts@256 6.
336143161 3.
108140452 103.90%
evp-aes-256-xts@1024 5.
62502952 2.
097960651 168.10%
evp-aes-256-xts@8192 5.
412085608 1.
807294191 199.50%
evp-aes-256-xts@16384 5.
403062591 1.
790135764 201.80%
N1:
Before optimization After optimization Improve
evp-aes-128-xts@16 6.
48147613 4.
209415473 53.98%
evp-aes-128-xts@64 2.
847744115 1.
950757468 45.98%
evp-aes-128-xts@256 2.
085711968 1.
061903238 96.41%
evp-aes-128-xts@1024 1.
842014669 0.
798486302 130.69%
evp-aes-128-xts@8192 1.
760449052 0.
713853939 146.61%
evp-aes-128-xts@16384 1.
760763546 0.
707702009 148.80%
evp-aes-256-xts@16 7.
264142817 5.
265970454 37.94%
evp-aes-256-xts@64 3.
251356212 2.
41176323 34.81%
evp-aes-256-xts@256 2.
380488469 1.
342095742 77.37%
evp-aes-256-xts@1024 2.
08853022 1.
041718215 100.49%
evp-aes-256-xts@8192 2.
027432668 0.
944571334 114.64%
evp-aes-256-xts@16384 2.
00740782 0.
941991415 113.10%
Add more XTS test cases to cover the cipher stealing mode and cases of different
number of blocks.
CustomizedGitHooks: yes
Change-Id: I93ee31b2575e1413764e27b599af62994deb4c96
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/11399)
Pauli [Wed, 4 Nov 2020 12:34:52 +0000 (22:34 +1000)]
apps/passwd: remove the -crypt option.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13313)
Pauli [Tue, 10 Nov 2020 07:05:30 +0000 (17:05 +1000)]
rsa_test: add return value check
Fixes #13361
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13362)
Tomas Mraz [Tue, 3 Nov 2020 17:51:38 +0000 (18:51 +0100)]
Do not prepend $OPENSSL_CONF_INCLUDE to absolute include paths
Also check for malloc failure and do not add '/' when
$OPENSSL_CONF_INCLUDE already ends with directory separator.
Fixes #13302
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13306)
Tomas Mraz [Tue, 3 Nov 2020 17:34:16 +0000 (18:34 +0100)]
Add ossl_is_absolute_path function to detect absolute paths
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13306)
Tomas Mraz [Tue, 3 Nov 2020 17:15:46 +0000 (18:15 +0100)]
Avoid duplicate ends_with_dirsep functions
Refactor them into inline ossl_ends_with_dirsep function in
internal/cryptlib.h.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13306)
Richard Levitte [Sat, 17 Oct 2020 09:45:19 +0000 (11:45 +0200)]
test/recipes/30-test_evp_libctx.t: use fips-and-base.cnf
The FIPS provider module doesn't have any encoders, the base provider
is needed for that.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13167)