Rich Salz [Mon, 12 Aug 2019 19:50:51 +0000 (15:50 -0400)]
Add merge-err-lines script
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9441)
Rich Salz [Tue, 30 Jul 2019 19:40:23 +0000 (15:40 -0400)]
Deprecate XXXerr() macros
Actually, for transition, they're not really deprecated. Remove the
"1 ||" from the ifdef line (in include/openssl/err.h) when ready to
do this in production/"for real"
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9441)
Rich Salz [Wed, 24 Jul 2019 15:40:07 +0000 (11:40 -0400)]
Add script convert XXerr to ERR_raise
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9441)
Richard Levitte [Sat, 14 Sep 2019 14:35:08 +0000 (16:35 +0200)]
Modify providers that keep track of underlying algorithms
With some provider implementations, there are underlying ciphers,
digests and macs. For some of them, the name was retrieved from the
method, but since the methods do not store those any more, we add
different mechanics.
For code that needs to pass on the name of a cipher or diges via
parameters, we simply locally store the name that was used when
fetching said cipher or digest. This will ensure that any underlying
code that needs to fetch that same cipher or digest does so with the
exact same name instead of any random name from the set of names
associated with the algorithm.
For code that needs to check what kind of algorithm was passed, we
provide EVP_{type}_is_a(), that returns true if the given method has
the given name as one of its names.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9897)
Richard Levitte [Sat, 14 Sep 2019 14:22:19 +0000 (16:22 +0200)]
In provider implemented methods, save the name number, not the name string
Multiple names per implementation is already supported in the namemap,
but hasn't been used yet. However, as soon as we have multiple names,
we will get an issue with what name should be saved in the method.
The solution is to not save the name itself, but rather the number
it's associated with. This number is supposed to be unique for each
set of names, and we assume that algorithm names are globally unique,
i.e. there can be no name overlap between different algorithm types.
Incidently, it was also found that the 'get' function used by
ossl_construct_method() doesn't need all the parameters it was given;
most of what it needs, it can now get through the data structure given
by the caller of ossl_construct_method(). As a consequence,
ossl_construct_method() itself doesn't need all the parameters it was
given either.
There are some added internal functions that are expected to disappear
as soon as legacy code is removed, such as evp_first_name() and
ossl_namemap_num2name().
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9897)
Shane Lontis [Thu, 19 Sep 2019 11:21:39 +0000 (21:21 +1000)]
Fix Solaris compile errors in provider ciphers
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9941)
Jon Spillett [Thu, 19 Sep 2019 11:14:21 +0000 (21:14 +1000)]
Add option grouping capability to apps
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9920)
Shane Lontis [Thu, 19 Sep 2019 10:10:25 +0000 (20:10 +1000)]
Add aes_ocb cipher to providers
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9320)
Shane Lontis [Thu, 19 Sep 2019 05:38:51 +0000 (15:38 +1000)]
Add sm4 ciphers to default provider
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9935)
Brian Chen [Tue, 7 May 2019 08:05:44 +0000 (04:05 -0400)]
Update fuzzing README for recent clang versions
Recent clang versions ship with libfuzzer, so there's no need to build
libfuzzer yourself. They also have a dedicated -fsanitize=fuzzer-no-link
flag and no longer support the sanitize flags described in the fuzzing
README. Update it to reflect all this.
Fixes #8768.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
GH: #8891
Patrick Steuer [Wed, 18 Sep 2019 13:46:39 +0000 (15:46 +0200)]
Fix strict-warnings build
..which was broken for s390 due to
1c3ace68.
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/9937)
Patrick Steuer [Wed, 18 Sep 2019 18:43:02 +0000 (20:43 +0200)]
Fix aes ofb, cfb and cfb8 for s390x
..which was broken since
e1178600.
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/9939)
Shane Lontis [Wed, 18 Sep 2019 12:13:59 +0000 (22:13 +1000)]
Add SEED ciphers to default provider
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9932)
Richard Levitte [Wed, 18 Sep 2019 09:49:55 +0000 (11:49 +0200)]
Refactor TLS1-PRF to create the MAC contexts early
The TLS1-PRF implementation fetched the digest(s) for the underlying
MAC, just to get their names and pass those down to the MAC, which in
turn would fetch those same digests again.
This change circumvents this by fetching the MAC (or MACs in the
MD5-SHA1 special case) and create the MAC contexts for them directly
when this PRF receives the relevant parameters, thus only having to
pass EVP_MAC_CTX pointers around.
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/9930)
Shane Lontis [Wed, 18 Sep 2019 08:55:11 +0000 (18:55 +1000)]
Add cast5 ciphers to default provider
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9929)
Pauli [Mon, 16 Sep 2019 22:46:49 +0000 (08:46 +1000)]
Change PARAMETER NAMES links to PARAMETERS
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9905)
Pauli [Mon, 16 Sep 2019 22:45:38 +0000 (08:45 +1000)]
Use PARAMETERS instead of PARAMETER NAMES for the heading for consistency.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9905)
Pauli [Mon, 16 Sep 2019 22:44:15 +0000 (08:44 +1000)]
Fix links to functions.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9905)
Pauli [Sun, 15 Sep 2019 23:07:32 +0000 (09:07 +1000)]
Cleanup KDF section 1 documentation.
Remove reference to EVP_KDF_ctrl_str and replace it with EVP_KDF_CTX_set_params.
Add missing links, and specify two extra KDFs.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9905)
Pauli [Sun, 15 Sep 2019 22:59:10 +0000 (08:59 +1000)]
Clean up KDF documentation in section 7.
The EVP_KDF_ctrl function doesn't exist anymore and have been replaced by
EVP_KDF_CTX_set_params.
The EVP_KDF_new_id function doesn't exist either and EVP_KDF_new should be
used instead.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9905)
Alistair Francis [Thu, 29 Aug 2019 20:56:21 +0000 (13:56 -0700)]
Add support for io_pgetevents_time64 syscall
32-bit architectures that are y2038 safe don't include syscalls that use
32-bit time_t. Instead these architectures have suffixed syscalls that
always use a 64-bit time_t. In the case of the io_getevents syscall the
syscall has been replaced with the io_pgetevents_time64 syscall instead.
This patch changes the io_getevents() function to use the correct
syscall based on the avaliable syscalls and the time_t size. We will
only use the new 64-bit time_t syscall if the architecture is using a
64-bit time_t. This is to avoid having to deal with 32/64-bit
conversions and relying on a 64-bit timespec struct on 32-bit time_t
platforms. As of Linux 5.3 there are no 32-bit time_t architectures
without __NR_io_getevents. In the future if a 32-bit time_t architecture
wants to use the 64-bit syscalls we can handle the conversion.
This fixes build failures on 32-bit RISC-V.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9819)
Shane Lontis [Wed, 18 Sep 2019 05:57:08 +0000 (15:57 +1000)]
Add IDEA ciphers to default provider
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9917)
Shane Lontis [Wed, 18 Sep 2019 05:26:19 +0000 (15:26 +1000)]
Fix Compiler error/warning for windows icl build
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9907)
Shane Lontis [Wed, 18 Sep 2019 05:20:30 +0000 (15:20 +1000)]
Fix Coverity CID:
1453685 'unreachable code' in aes_xts code.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/9902)
Richard Levitte [Thu, 12 Sep 2019 11:27:52 +0000 (13:27 +0200)]
crypto/bn/build.info: Correct use of SSE2 definition
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9879)
Jon Spillett [Mon, 2 Sep 2019 00:06:29 +0000 (10:06 +1000)]
apps/pkcs12: print multiple PKCS#12 safeBag attribute values if present
Currently the pkcs12 app will only ever print the first value of a multi-value
attribute. This is OK for some attributes (e.g. friendlyName, localKeyId) but
may miss values for other attributes.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/9751)
Shane Lontis [Tue, 17 Sep 2019 03:34:47 +0000 (13:34 +1000)]
Fix Solaris aes_hw_t4 compile issue
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9910)
Bernd Edlinger [Fri, 13 Sep 2019 08:45:29 +0000 (10:45 +0200)]
Fix building statically without any dso support
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9895)
Richard Levitte [Thu, 12 Sep 2019 22:06:46 +0000 (00:06 +0200)]
Unify all assembler file generators
They now generally conform to the following argument sequence:
script.pl "$(PERLASM_SCHEME)" [ C preprocessor arguments ... ] \
$(PROCESSOR) <output file>
However, in the spirit of being able to use these scripts manually,
they also allow for no argument, or for only the flavour, or for only
the output file. This is done by only using the last argument as
output file if it's a file (it has an extension), and only using the
first argument as flavour if it isn't a file (it doesn't have an
extension).
While we're at it, we make all $xlate calls the same, i.e. the $output
argument is always quoted, and we always die on error when trying to
start $xlate.
There's a perl lesson in this, regarding operator priority...
This will always succeed, even when it fails:
open FOO, "something" || die "ERR: $!";
The reason is that '||' has higher priority than list operators (a
function is essentially a list operator and gobbles up everything
following it that isn't lower priority), and since a non-empty string
is always true, so that ends up being exactly the same as:
open FOO, "something";
This, however, will fail if "something" can't be opened:
open FOO, "something" or die "ERR: $!";
The reason is that 'or' has lower priority that list operators,
i.e. it's performed after the 'open' call.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9884)
Richard Levitte [Thu, 12 Sep 2019 22:05:26 +0000 (00:05 +0200)]
build.info: For all assembler generators, remove all arguments
Since the arguments are now generated in the build file templates,
they should be removed from the build.info files.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9884)
Richard Levitte [Thu, 12 Sep 2019 21:58:07 +0000 (23:58 +0200)]
Build files: Unify standard arguments for assembler generating scrips
- Make the last argument always be the output file.
- Make the first argument always be the flavour, even if there is no
flavour (i.e. it might become the empty string).
- Make the next to last argument to be $(PROCESSOR) if that one has a
value.
- Remaining arguments are C prepropressor arguments.
Perl scripts that should handle this may use the following code:
$output = pop;
$flavour = shift;
if ($ARGV[$#ARGV] eq '386') {
# Do 386 specific things
} else {
# Do whatever else, with the knowledge the @ARGV contains
# C preprocessor arguments
}
Some scripts don't care about anything than $output, and that's ok.
Some scripts do care, but handle it a little differently, and that's
ok too (notably, the x86 scripts call asm_init() with the first and
the last argument after having popped $output).
As long as they handle the argument order right, they are going to
be fine.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9884)
ManishPatidar1 [Mon, 9 Sep 2019 13:32:56 +0000 (19:02 +0530)]
clearing the ecx private key memory
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9830)
Pauli [Mon, 16 Sep 2019 03:22:56 +0000 (13:22 +1000)]
Avoid mentioning ctrl_str in the MAC documentation.
Change to mentioning params instead.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9908)
Pauli [Mon, 16 Sep 2019 01:15:25 +0000 (11:15 +1000)]
Use "PARAMETERS" in the documentation headings.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9906)
Shane Lontis [Sun, 15 Sep 2019 10:06:28 +0000 (20:06 +1000)]
Add blowfish ciphers to default provider
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9887)
Shane Lontis [Sun, 15 Sep 2019 09:55:10 +0000 (19:55 +1000)]
Add fips module integrity check
Add environment variable for setting CONF .include path
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9769)
Shane Lontis [Sun, 15 Sep 2019 09:33:04 +0000 (19:33 +1000)]
Fix compile error detected by Solaris build
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9901)
Shane Lontis [Sun, 15 Sep 2019 09:29:02 +0000 (19:29 +1000)]
Fix aesni_xts compile error
Block copy bug..
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9900)
Jan-Frederik Rieckers [Fri, 13 Sep 2019 17:34:14 +0000 (19:34 +0200)]
Fix small typo in doc for X509_STORE_CTX_new
CLA: trivial
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9894)
Pauli [Sat, 14 Sep 2019 23:44:14 +0000 (09:44 +1000)]
Fix examples in the section 7 KDF man pages.
All of the examples called EVP_KDF_set_params() when they should have been
calling EVP_KDF_CTX_set_params().
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9898)
Andreas Kretschmer [Thu, 5 Sep 2019 11:21:03 +0000 (13:21 +0200)]
fix CRMF symmetric key handling
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9774)
Pauli [Fri, 13 Sep 2019 09:37:40 +0000 (19:37 +1000)]
Use param types instead of native types in the param descriptions
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9891)
Pauli [Fri, 13 Sep 2019 09:35:37 +0000 (19:35 +1000)]
Use param types for parameter descriptions. Mention a size_t limit to those where it makes sense.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9891)
Pauli [Fri, 13 Sep 2019 09:32:28 +0000 (19:32 +1000)]
Add wording to limit the 'size' parameter to no more than can be specified using a size_t variable
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9891)
Shane Lontis [Fri, 13 Sep 2019 23:27:49 +0000 (09:27 +1000)]
Add aes_xts cipher to providers
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9327)
Shane Lontis [Fri, 13 Sep 2019 23:11:28 +0000 (09:11 +1000)]
Fix S390X bad size_t that causes memory trash in legacy ciphers
This caused a SEGV inside tls13_enc() when using chacha_poly.
The tls code assigns the iv_length to a size_t (even though it is an int).
This is actually really bad since it could be -1, which will then trash the iv buffer.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/9890)
Rich Salz [Thu, 12 Sep 2019 17:06:04 +0000 (13:06 -0400)]
ERR: Change get_error_values() to use an enum
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9870)
Bernd Edlinger [Mon, 9 Sep 2019 17:12:25 +0000 (19:12 +0200)]
Fix potential memory leaks with BN_to_ASN1_INTEGER
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9833)
Pauli [Thu, 12 Sep 2019 08:12:47 +0000 (18:12 +1000)]
Define the MAC parameter types without using C type names to avoid confusion.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9875)
Richard Levitte [Thu, 1 Aug 2019 10:03:57 +0000 (12:03 +0200)]
Document the deprecation of ERR_STATE and ERR_get_state()
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9462)
Richard Levitte [Fri, 26 Jul 2019 16:11:55 +0000 (18:11 +0200)]
Deprecate ERR_get_state()
Internally, we still need this function, so we make it internal and
then add a new ERR_get_state() that simply calls the internal variant,
unless it's "removed" by configuration.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9462)
Richard Levitte [Thu, 25 Jul 2019 19:57:48 +0000 (21:57 +0200)]
Deprecate the public definition of ERR_STATE
The intention is to make it opaque later on.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9462)
Richard Levitte [Sun, 25 Aug 2019 08:46:22 +0000 (10:46 +0200)]
confdata.pm.in: New template for configdata.pm
To have the configdata.pm text embedded in Configure was kind of ugly,
and becomes clearer if put into a template file, configdata.pm.in. We
can then use OpenSSL::Template to generate it.
We also modify configdata.pm to be the build file generator, and run
it from Configure. The benefit with that is that developers who
tinker and play with the build file can do a "factory reset" without
having to go through the configuration process, i.e. they can re-use
the config data the already have.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9693)
Richard Levitte [Sun, 25 Aug 2019 08:44:41 +0000 (10:44 +0200)]
util/dofile.pl, util/perl/OpenSSL/Template.pm: move parts of dofile.pl
We make a module OpenSSL::Template from the central parts of
util/dofile.pl, and also reduce the amount of ugly code with more
proper use of Text::Template. OpenSSL::Template is a simply subclass
of Text::Template.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9693)
Richard Levitte [Thu, 5 Sep 2019 07:14:03 +0000 (09:14 +0200)]
Add a CHANGES entry for the recent ERR changes
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9756)
Richard Levitte [Thu, 5 Sep 2019 06:51:12 +0000 (08:51 +0200)]
Document the deprecation of ERR_func_error_string()
Also, correct the output template for ERR_error_string() and
ERR_error_string_n().
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9756)
Richard Levitte [Wed, 4 Sep 2019 20:14:21 +0000 (22:14 +0200)]
Modernise ERR_print_errors_cb()
ERR_print_errors_cb() used functionality that isn't suitable any more,
as that functionality couldn't integrate the error record function
name strings. We therefore refactor it a bit to use better adapted
methods.
Fixes #9756
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9756)
Richard Levitte [Wed, 4 Sep 2019 20:04:08 +0000 (22:04 +0200)]
Modernise the ERR functionality further (new functions and deprecations)
ERR_func_error_string() essentially returns NULL, and since all
function codes are now removed for all intents and purposes, this
function has fallen out of use and cannot be modified to suit the
data, since its only function is to interpret an error code.
To compensate for the loss of error code, we instead provide new
functions that extracts the function name strings from an error
record:
- ERR_get_error_func()
- ERR_peek_error_func()
- ERR_peek_last_error_func()
Similarly, the once all encompasing functions
ERR_peek_last_error_line_data(), ERR_peek_error_line_data() and
ERR_get_error_line_data() lack the capability of getting the function
name string, so we deprecate those and add these functions to replace
them:
- ERR_get_error_all()
- ERR_peek_error_all()
- ERR_peek_last_error_all()
Finally, we adjust a few lines of code that used the now deprecated
functions.
Fixes #9756
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9756)
Richard Levitte [Wed, 4 Sep 2019 19:55:58 +0000 (21:55 +0200)]
include/openssl/err.h: Depend on OPENSSL_NO_FILENAMES, not OPENSSL_NO_ERR
The configuration option 'no-err' is documented to be used to avoid
loading error related string tables. For some reason, it was also
used to define if ERR_PUT_error() would pass the source file name and
line information or not.
The configuration option 'no-filenames' is documented to be used to
avoid passing the source file name and line anywhere. So, the
definition of ERR_PUT_error() should depend on OPENSSL_NO_FILENAMES
rather than OPENSSL_NO_ERR.
Furthermore, the definition of OPENSSL_FILE and OPENSSL_LINE depends
on if OPENSSL_NO_FILENAMES is defined or not, so there was never any
need to do extra macro gymnastics in include/openssl/err.h, so we
simply remove it and use OPENSSL_FILE and OPENSSL_LINE directly.
Finally, the macro OPENSSL_FUNC is unaffected by all these
configuration options, so it should be used in all macros that call
ERR_set_debug().
Fixes #9756
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9756)
Richard Levitte [Wed, 4 Sep 2019 19:51:17 +0000 (21:51 +0200)]
include/openssl/macros.h: Remove the PEDANTIC OPENSSL_FUNC definition
There was a section to define OPENSSL_FUNC that depended on PEDANTIC
being defined. That is an internal build macro that should never
appear in a public header. The solution was simple, replace it with
a check of __STRICT_ANSI__.
Fixes #9756
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9756)
Richard Levitte [Wed, 4 Sep 2019 19:45:56 +0000 (21:45 +0200)]
util/mkerr.pl: make it not depend on the function code
The output C code was made to use ERR_func_error_string() to see if a
string table was already loaded or not. Since this function returns
NULL always, this check became useless.
Change it to use ERR_reason_error_string() instead, as there's no
reason to believe we will get rid of reason strings, ever.
To top it off, we rebuild all affected C sources.
Fixes #9756
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9756)
Tomas Mraz [Thu, 12 Sep 2019 10:27:36 +0000 (12:27 +0200)]
BIO_f_zlib: Properly handle BIO_CTRL_PENDING and BIO_CTRL_WPENDING calls.
There can be data to write in output buffer and data to read that were
not yet read in the input stream.
Fixes #9866
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9877)
Richard Levitte [Wed, 11 Sep 2019 09:16:53 +0000 (11:16 +0200)]
Travis and Appveyor: use HARNESS_VERBOSE_FAILURE rather than HARNESS_VERBOSE
This allows for shorter logs, and also logs that only show the details
for tests that fail.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9862)
Richard Levitte [Wed, 11 Sep 2019 09:05:11 +0000 (11:05 +0200)]
Rework test/run_tests.pl to support selective verbosity and TAP copy
This includes a complete rework of how we use TAP::Harness, by adding
a TAP::Parser subclass that allows additional callbacks to be passed
to perform what we need. The TAP::Parser callbacks we add are:
ALL to print all the TAP output to a file (conditionally)
to collect all the TAP output to an array (conditionally)
EOF to print all the collected TAP output (if there is any)
if any subtest failed
To get TAP output to file, the environment variable HARNESS_TAP_COPY
must be defined, with a file name as value. That file will be
overwritten unconditionally.
To get TAP output displayed on failure, the make variable VERBOSE_FAILURE
or VF must be defined with a non-emoty value.
Additionally, the output of test recipe names has been changed to only
display its basename.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9862)
Richard Levitte [Wed, 11 Sep 2019 09:02:24 +0000 (11:02 +0200)]
util/perl/OpenSSL/Test.pm: Disable stdout/stderr redirection on non-verbosity
... except on VMS, where output from executed programs doesn't seem to be
captured properly by Test::Harness or TAP::Harness.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9862)
Richard Levitte [Sat, 31 Aug 2019 07:30:43 +0000 (09:30 +0200)]
doc/man3/OSSL_PARAM.pod: add details about multiple elements with same key
Usually, each element in an OSSL_PARAM array will have a unique key.
However, there may be some rare cases when a responder will handle
multiple elements with the same key. This adds a short passage
explaining this case.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9741)
Richard Levitte [Sat, 31 Aug 2019 07:30:15 +0000 (09:30 +0200)]
doc/man3/OSSL_PARAM.pod: remove a comment that isn't true any more
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9741)
Richard Levitte [Sat, 31 Aug 2019 07:29:33 +0000 (09:29 +0200)]
doc/man3/OSSL_PARAM.pod: conform to man-page standards
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9741)
Richard Levitte [Fri, 7 Jun 2019 08:52:25 +0000 (10:52 +0200)]
test/evp_test.c: try fetching algorithms
Instead of relying on implicit fetches, try explicit fetches when available.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9121)
Richard Levitte [Mon, 9 Sep 2019 10:49:15 +0000 (12:49 +0200)]
Update the bundled external perl module Text-Template to version 1.56
Fixes #9287
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9828)
Richard Levitte [Mon, 9 Sep 2019 10:13:37 +0000 (12:13 +0200)]
Clarify the status of bundled external perl modules
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9826)
Richard Levitte [Mon, 9 Sep 2019 09:51:01 +0000 (11:51 +0200)]
Rework the perl fallback functionality
The module with_fallback.pm was kind of clunky and required a transfer
module. This change replaces if with a much more generic pragma type
module, which simply appends given directories to @INC (as opposed to
the 'lib' pragma, which prepends the directories to @INC).
This also supports having a file MODULES.txt with sub-directories to
modules. This ensures that we don't have to spray individual module
paths throughout our perl code, but can have them collected in one
place.
(do note that there is a 'fallback' module on CPAN. However, it isn't
part of the core perl, and it has no support the any MODULES.txt kind
of construct)
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9826)
Matt Caswell [Wed, 11 Sep 2019 14:03:39 +0000 (15:03 +0100)]
Avoid passing NULL to memcpy
It is undefined behaviour to send NULL as either the src, or dest params
in memcpy.
In pkey_kdf.c we had a check to ensure that the src address is non-NULL.
However in some situations it is possible that the dest address could also
be NULL. Specifically in the case where the datalen is 0 and we are using
a newly allocated BUF_MEM.
We add a check of datalen to avoid the undefined behaviour.
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9868)
Matt Caswell [Wed, 11 Sep 2019 10:52:47 +0000 (11:52 +0100)]
Pass the correct ctx to provider KDF functions
Make sure we pass the provider side ctx and not the libcrypto side ctx.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9865)
Matt Caswell [Wed, 11 Sep 2019 09:17:00 +0000 (10:17 +0100)]
Fix no-engine
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9863)
Matt Caswell [Wed, 11 Sep 2019 09:04:23 +0000 (10:04 +0100)]
Fix no-dsa
Also fixes no-dh
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9861)
Paul Yang [Thu, 12 Sep 2019 08:57:23 +0000 (16:57 +0800)]
Fix test error if scrypt is disabled
Fix no-scrypt.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9840)
Dr. Matthias St. Pierre [Wed, 11 Sep 2019 08:40:18 +0000 (10:40 +0200)]
crypto/threads_win.c: fix preprocessor indentation
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9832)
Dr. Matthias St. Pierre [Thu, 30 May 2019 16:37:29 +0000 (18:37 +0200)]
drbg: fix issue where DRBG_CTR fails if NO_DF is used (2nd attempt)
Since commit
7c226dfc434d a chained DRBG does not add additional
data anymore when reseeding from its parent. The reason is that
the size of the additional data exceeded the allowed size when
no derivation function was used.
This commit provides an alternative fix: instead of adding the
entire DRBG's complete state, we just add the DRBG's address
in memory, thereby providing some distinction between the different
DRBG instances.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9832)
Dr. Matthias St. Pierre [Thu, 30 May 2019 16:52:39 +0000 (18:52 +0200)]
drbg: add fork id to additional data on UNIX systems
Provides a little extra fork-safety on UNIX systems, adding to the
fact that all DRBGs reseed automatically when the fork_id changes.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9832)
Dr. Matthias St. Pierre [Mon, 27 May 2019 19:03:09 +0000 (21:03 +0200)]
drbg: ensure fork-safety without using a pthread_atfork handler
When the new OpenSSL CSPRNG was introduced in version 1.1.1,
it was announced in the release notes that it would be fork-safe,
which the old CSPRNG hadn't been.
The fork-safety was implemented using a fork count, which was
incremented by a pthread_atfork handler. Initially, this handler
was enabled by default. Unfortunately, the default behaviour
had to be changed for other reasons in commit
b5319bdbd095, so
the new OpenSSL CSPRNG failed to keep its promise.
This commit restores the fork-safety using a different approach.
It replaces the fork count by a fork id, which coincides with
the process id on UNIX-like operating systems and is zero on other
operating systems. It is used to detect when an automatic reseed
after a fork is necessary.
To prevent a future regression, it also adds a test to verify that
the child reseeds after fork.
CVE-2019-1549
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9832)
Shane Lontis [Wed, 11 Sep 2019 07:52:30 +0000 (17:52 +1000)]
Add EVP_CIPHER_CTX_tag_length()
There is no deprecated CTRL support for this new field.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9698)
Pauli [Mon, 9 Sep 2019 01:42:22 +0000 (11:42 +1000)]
Usages of KDFs converted to use the name macros
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9814)
Pauli [Mon, 9 Sep 2019 01:42:00 +0000 (11:42 +1000)]
Register KDF's using their name macros rather than strings
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9814)
Pauli [Mon, 9 Sep 2019 01:39:10 +0000 (11:39 +1000)]
Make FIPS provider use KDF name for PBKDF2
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9814)
Pauli [Mon, 9 Sep 2019 01:37:11 +0000 (11:37 +1000)]
Update tests to (mostly) use KDF names
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9814)
Pauli [Mon, 9 Sep 2019 01:36:48 +0000 (11:36 +1000)]
Convert SSL functions to use KDF names not SN_ strings
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9814)
Pauli [Mon, 9 Sep 2019 01:35:25 +0000 (11:35 +1000)]
Add macros for the KDF algorithm names.
This avoids the problems with PBKDF2 and SCRYPT not being of the same form
as the rest.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9814)
Pauli [Mon, 9 Sep 2019 00:14:32 +0000 (10:14 +1000)]
Coverity
1453629 and
1453638: Error handling issues (NEGATIVE_RETURNS)
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/9805)
Pauli [Sun, 8 Sep 2019 08:39:11 +0000 (18:39 +1000)]
Coverity
1453634: Resource leaks (RESOURCE_LEAK)
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/9805)
Pauli [Sun, 8 Sep 2019 22:04:45 +0000 (08:04 +1000)]
Coverity
1453633: Error handling issues (CHECKED_RETURN)
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/9805)
Pauli [Sun, 8 Sep 2019 08:37:13 +0000 (18:37 +1000)]
Coverity
1453632 &
1453635: Null pointer dereferences (FORWARD_NULL)
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/9805)
Pauli [Sun, 8 Sep 2019 08:33:12 +0000 (18:33 +1000)]
Coverity
1453630: Null pointer dereferences (FORWARD_NULL)
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/9805)
Pauli [Sun, 8 Sep 2019 08:29:58 +0000 (18:29 +1000)]
Coverity
1453628: Null pointer dereferences (REVERSE_INULL)
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/9805)
Pauli [Sun, 8 Sep 2019 08:28:56 +0000 (18:28 +1000)]
Coverity
1453627: Null pointer dereferences (REVERSE_INULL)
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/9805)
Pauli [Sun, 8 Sep 2019 08:25:34 +0000 (18:25 +1000)]
Coverity
1414465: Resource leaks (RESOURCE_LEAK)
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/9805)
Bernd Edlinger [Sat, 31 Aug 2019 22:16:28 +0000 (00:16 +0200)]
Fix a padding oracle in PKCS7_dataDecode and CMS_decrypt_set1_pkey
An attack is simple, if the first CMS_recipientInfo is valid but the
second CMS_recipientInfo is chosen ciphertext. If the second
recipientInfo decodes to PKCS #1 v1.5 form plaintext, the correct
encryption key will be replaced by garbage, and the message cannot be
decoded, but if the RSA decryption fails, the correct encryption key is
used and the recipient will not notice the attack.
As a work around for this potential attack the length of the decrypted
key must be equal to the cipher default key length, in case the
certifiate is not given and all recipientInfo are tried out.
The old behaviour can be re-enabled in the CMS code by setting the
CMS_DEBUG_DECRYPT flag.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9777)
Bernd Edlinger [Fri, 6 Sep 2019 19:54:13 +0000 (21:54 +0200)]
Fix a potential crash in rand_unix.c
Due to the dynamic allocation that was added to rand_pool_add_begin
this function could now return a null pointer where it was previously
guaranteed to succeed. But the return value of this function does
not need to be checked by design.
Move rand_pool_grow from rand_pool_add_begin to rand_pool_bytes_needed.
Make an allocation error persistent to avoid falling back to less secure
or blocking entropy sources.
Fixes:
a6a66e4511ee ("Make rand_pool buffers more dynamic in their sizing.")
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9687)
Bernd Edlinger [Sat, 24 Aug 2019 09:38:32 +0000 (11:38 +0200)]
Fix a strict warnings error in rand_pool_acquire_entropy
There was a warning about unused variables in this config:
./config --strict-warnings --with-rand-seed=rdcpu
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9687)
Billy Brumley [Mon, 9 Sep 2019 08:29:09 +0000 (11:29 +0300)]
[test] ECC: check the bounds for auto computing cofactor
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/9821)