Commit Graph

25177 Commits

Author SHA1 Message Date
Rich Salz
339638b586 Make generated copyright year be "now"
Always use the current year in generating output files, rather than
trying to base is on the modtime of the script or input, as that can
vary depending on the ability of the local OS to keep those accurate.

Fixes #10744

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10776)
2020-01-07 15:53:15 -05:00
Rich Salz
018aaeb478 Refactor -engine documentation
Common wording courtesy Richard Levitte.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/10128)
2020-01-07 18:52:25 +01:00
Dr. Matthias St. Pierre
9484b67dfb Modify the add_seeds_stringlist() macro to fix a preprocessor error
When OpenSSL is configured using `--with-rand-seed=devrandom`, the preprocessor
reports the following error

    crypto/info.c:104:66: error:
            macro "add_seeds_stringlist" passed 3 arguments, but takes just 2
            add_seeds_stringlist("random-device", { DEVRANDOM, NULL });

The reason why the preprocessor complains about three arguments being passed
is that according to [1], balanced braces in macro arguments don't prevent the
comma from acting as an argument separator:

    3.3 Macro Arguments
    ...
    Parentheses within each argument must balance;
    a comma within such parentheses does not end the argument.
    However, there is no requirement for square brackets or braces to balance,
    and they do not prevent a comma from separating arguments.

Also introduced an iteration pointer `p`, because `dev` is not an lvalue:

    crypto/info.c:78:41: error:
            lvalue required as increment operand
            for (; *dev != NULL; dev++) {

[1] https://gcc.gnu.org/onlinedocs/cpp/Macro-Arguments.html

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/10762)
2020-01-07 16:28:37 +01:00
Dr. Matthias St. Pierre
2e912f63a4 Move random-related defines to "crypto/rand.h"
This fixes commit 01036e2afb, which moved the
DEVRANDOM and DEVRANDOM_EGD defines into rand_unix.c. That change introduced
the regression that the compiler complains about missing declarations in
crypto/info.c when OpenSSL is configured using `--with-rand-seed=devrandom`
(resp. `--with-rand-seed=egd`)

Fixes #10759

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/10762)
2020-01-07 16:28:15 +01:00
Richard Levitte
d368d9d2e4 Configuration: synchronise the variables on the build file templates
For some reason, we didn't use some of the possible target attributes
in the Unix Makefile template, and there was a similar but much
smaller lack of use in the Windows makefile template as well.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10753)
2020-01-07 11:58:17 +01:00
Shane Lontis
88b4c61299 Make ECDSA_size() use consistent asn1 encoder.
ECDSA signature lengths are calculated using i2d_ECDSA_SIG().
i2d_ECDSA_SIG() was changed in a previous PR to use a custom ASN1 encoder (using WPACKET)
so that the normal ASN1 encoder does not need to be pulled into the provider boundary.
For consistency ECDSA_size() has been changed to also use i2d_ECDSA_SIG() - this can now
be used directly inside the FIPS provider.

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/10577)
2020-01-07 14:53:38 +10:00
Pauli
5310a4e616 coverity 1201462: check error returns
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10760)
2020-01-07 14:02:52 +10:00
Pauli
756f5c6c7c coverity 1201478: check BIO_indent returns
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10760)
2020-01-07 14:02:52 +10:00
Shane Lontis
1242f3c798 Fix KMAC docs
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/9970)
2020-01-07 09:22:08 +10:00
Richard Levitte
0081ce9b02 Add missing inclusion of "internal/deprecated.h"
A few provider implementations need this to build correctly with a
'no-deprecated' configuration.

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/10766)
2020-01-06 20:25:08 +01:00
kaysond
1cf20ca31b Add -passin arg to ocsp
Fix #10682

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/10718)
2020-01-06 17:11:47 +01:00
Matt Caswell
c72fa2554f Deprecate the low level AES functions
Use of the low level AES functions has been informally discouraged for a
long time. We now formally deprecate them.

Applications should instead use the EVP APIs, e.g. EVP_EncryptInit_ex,
EVP_EncryptUpdate, EVP_EncryptFinal_ex, and the equivalently named decrypt
functions.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/10580)
2020-01-06 15:09:57 +00:00
Matt Caswell
2852c672a8 Don't use the low level AES key wrap APIs in CMS
We should not be using the low level AES APIs in CMS. Instead we should
be using EVP. There was a small amount of use of the low level key
wrap APIs - so we convert that to EVP.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/10580)
2020-01-06 15:09:57 +00:00
Matt Caswell
b1558c0bc8 Don't store an HMAC key for longer than we need
The HMAC_CTX structure stores the original key in case the ctx is reused
without changing the key.

However, HMAC_Init_ex() checks its parameters such that the only code path
where the stored key is ever used is in the case where HMAC_Init_ex is
called with a NULL key and an explicit md is provided which is the same as
the md that was provided previously. But in that case we can actually reuse
the pre-digested key that we calculated last time, so we can refactor the
code not to use the stored key at all.

With that refactor done it is no longer necessary to store the key in the
ctx at all. This means that long running ctx's will not keep the key in
memory for any longer than required. Note though that the digested key
*is* still kept in memory for the duration of the life of the ctx.

Fixes #10743

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10747)
2020-01-06 10:46:05 +00:00
Richard Levitte
60a3399721 EVP: Fix method to determine if a PKEY is legacy or not
For the implementation of EVP_PKEY_CTX_new(), we determined if an
EVP_PKEY wass legacy or not by looking at 'pkey->pkey.ptr'.  It turns
out that this code could get an unassigned EVP_PKEY, with that pointer
being NULL, and the determination proven incorrect.

The check now looks at 'pkey->ameth' instead.

Fixes #10704

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/10758)
2020-01-06 13:34:38 +03:00
Rich Salz
bc24e3ee52 Move -nameopt to openssl.pod
Also clarify the description of the options.

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/10259)
2020-01-06 11:15:46 +08:00
Shane Lontis
0d2bfe52bb Add AES_CBC_HMAC_SHA ciphers to providers.
Also Add ability for providers to dynamically exclude cipher algorithms.
Cipher algorithms are only returned from providers if their capable() method is either NULL,
or the method returns 1.
This is mainly required for ciphers that only have hardware implementations.
If there is no hardware support, then the algorithm needs to be not available.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10146)
2020-01-06 13:02:16 +10:00
Andrew Hoang
26583f6aa8 Fix incorrect return code on ECDSA key verification
ECDSA_do_verify() is a function that verifies a ECDSA signature given a hash and a public EC key. The function is supposed to return 1 on valid signature, 0 on invalid signature and -1 on error. Previously, we returned 0 if the key did not have a verify_sig method. This is actually an error case and not an invalid signature. Consequently, this patch updates the return code to -1.

Fixes #8766

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
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/10693)
2020-01-05 15:50:11 +02:00
fangming.fang
6e49b51406 Fix disabled ecdsa in apps/speed
This came from f3fdfbf78c. run = 1 should be done in pkey_print_message
as well, otherwise other tests printed with pkey_print_message won't run.

Change-Id: I0ba0b05256ad6509ada4735b26d10f8a73fd89ec

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/10710)
2020-01-05 10:35:46 +02:00
Fangming.Fang
3b5a5f995e Fix side channel in ecp_nistz256-armv8.pl
This change addresses a potential side-channel vulnerability in
the internals of nistz256 low level operations for armv8.

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/9239)
2020-01-05 10:20:58 +02:00
Bernd Edlinger
45a405382b Fix side channel in the ecp_nistz256.c reference implementation
This is only used if configured with
./config -DECP_NISTZ256_REFERENCE_IMPLEMENTATION

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9239)
2020-01-05 10:20:58 +02:00
Bernd Edlinger
5578ad1f0b Improve side channel fix in ecp_nistz256-x86_64.pl
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9239)
2020-01-05 10:20:58 +02:00
Bernd Edlinger
1c5bc7b85a Fix side channel in ecp_nistz256-armv4.pl
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9239)
2020-01-05 10:20:58 +02:00
Bernd Edlinger
1645df672f Fix side channel in ecp_nistz256-x86.pl
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9239)
2020-01-05 10:20:58 +02:00
David Benjamin
90b797f00e Avoid leaking intermediate states in point doubling special case.
Cherry picked from
12d9ed670d

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/9239)
2020-01-05 10:20:58 +02:00
Nicola Tuveri
0164bf812f Fix potential SCA vulnerability in some EC_METHODs
This commit addresses a potential side-channel vulnerability in the
internals of some elliptic curve low level operations.
The side-channel leakage appears to be tiny, so the severity of this
issue is rather low.

The issue was reported by David Schrammel and Samuel Weiser.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/9239)
2020-01-05 10:20:58 +02:00
Pauli
75e571b592 coverity 1456638: fix null check
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10748)
2020-01-05 18:05:14 +10:00
Pauli
86723c2a10 coverity 1456639: fix NULL dereference
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10748)
2020-01-05 18:05:14 +10:00
Pauli
4c1e06fc40 coverity 1456640: fix null check
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10748)
2020-01-05 18:05:14 +10:00
Pauli
ff19035e62 coverity 1456642: fix null check
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10748)
2020-01-05 18:05:14 +10:00
Ibrahim M. Ghazal
1fdde9170c Add -iter option to pkcs12 command
Fixes #8194

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/10130)
2020-01-02 18:28:22 +03:00
Matt Caswell
e7b834b6bb Run make update
The New Year has caused various files to appear out of date to "make
update". This causes Travis to fail. Therefore we update those file.

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/10738)
2020-01-02 14:39:34 +00:00
dcruette
2de5a5fbdd Update tls13_enc.c
Fix double + in hkdflabel declaration (FIXES #10675)
CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/10700)
2020-01-02 13:49:41 +01:00
Matt Caswell
5f95fbf399 Temporarily disable the explicit enable-asan build
The explicit enable-asan build fails in the memleak test for unknown
reasons. Therefore we disable it temporarily to get a green Travis.

Other builds that use -fsanitize=address in Travis seem to pass.

[extended tests]

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/10689)
2019-12-27 21:48:53 +01:00
Matt Caswell
20e6631c73 Temporarily disable some Travis external tests
The pyca-cryptography external test has been failing for a long time.
It looks like upstream needs to make some changes to adapt to 3.0.

[extended tests]

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/10689)
2019-12-27 21:48:53 +01:00
Matt Caswell
f798c27958 Don't run test_conf in cross compiled builds
test_conf was failing in travis for mingw builds. We run these on linux
via wine. However due to line break differences the tests were failing.
We just skip these in a cross compiled build.

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/10689)
2019-12-26 12:13:06 +01:00
Bernd Edlinger
f3fdfbf78c Fix a race condition in the speed command
The timer alarm sets run = 0, while the benchmark
does run = 1 in the initialization code.  That is
a race condition, if the timer goes off too early
the benchmark runs forever.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10680)
2019-12-26 10:34:19 +01:00
Richard Levitte
8125006519 Configurations/windows-makefile.tmpl: HTMLDOCS are files, not directories
Remove them using "del", not "rmdir"

Fixes #10553

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/10555)
2019-12-26 00:49:07 +01:00
Richard Levitte
b2b90922c2 Removed now documented stuff from util/missing*.txt
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10683)
2019-12-26 00:45:12 +01:00
Richard Levitte
17fa385d2c util/find-doc-nits: when loading "missing" files, check if documented
It may be that some "missing" manuals have been written since their
insertion in the "missing" files.  Make sure to alert when such manual
references are found.

This works, because we collect all existing manual references into
%name_map first.

Fixes #10681

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10683)
2019-12-26 00:45:12 +01:00
Benjamin Kaduk
3e73f558af Update the krb5 submodule
Bring us up to date with upstream's 1.17.1 release.  Among other
things, it includes commit c2497d46b4bad473e164943d67b58cd1ae261c3a
which fixes several issues that affect running the test suite under
Travis CI.  Hopefully those will work transitively for us as well.

[extended tests]

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10690)
2019-12-25 12:45:32 -08:00
Bernd Edlinger
b2a00f6220 Add some missing cfi frame info in rc4-md5-x86_64.pl
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/10679)
2019-12-23 20:29:26 +01:00
Bernd Edlinger
048fa13e5e Add some missing cfi frame info in poly1305-x86_64.pl
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/10678)
2019-12-23 20:26:19 +01:00
Bernd Edlinger
275a048ffc Add some missing cfi frame info in aesni-gcm-x86_64.pl
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/10677)
2019-12-23 20:23:27 +01:00
Bernd Edlinger
9d079f2744 Add some missing cfi frame info in x25519-x86_64.pl
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/10676)
2019-12-23 17:01:55 +01:00
Bernd Edlinger
665de4d48a Fix aesni_cbc_sha256_enc_avx2 backtrace info
We store a secondary frame pointer info for the debugger
in the red zone.  This fixes a crash in the unwinder when
this function is interrupted.

Additionally the missing cfi function annotation is added
to aesni_cbc_sha256_enc_shaext.

[extended tests]

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10674)
2019-12-23 16:57:42 +01:00
Bernd Edlinger
eff5076a78 Add some missing cfi frame info in ecp_nistz256-x86_64.pl
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/10672)
2019-12-23 16:54:11 +01:00
Matt Caswell
b598b7a485 Fix no-dsa builds
Add a guard in a build.info file for no-dsa builds

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/10644)
2019-12-23 10:22:22 +00:00
Matt Caswell
285c691304 Fix no-dh
The new serializer code broke no-dh builds so we add some more guards to fix it.

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/10644)
2019-12-23 10:22:21 +00:00
Matt Caswell
501fcfb8cf Fix evp_extra_test with no-dh
The new DH test in evp_extra_test.c broke the no-dh build so we add some
guards to fix it.

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/10644)
2019-12-23 10:22:21 +00:00