Nicola Tuveri [Tue, 12 Jun 2018 01:27:28 +0000 (04:27 +0300)]
Deprecate DSA_sign_setup() in the documentation
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6460)
Richard Levitte [Tue, 12 Jun 2018 07:27:18 +0000 (09:27 +0200)]
Make ck_errf.pl ignore commented out error generation
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6461)
Richard Levitte [Tue, 12 Jun 2018 06:57:43 +0000 (08:57 +0200)]
.travis.yml: give make update exit code meaning again
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6461)
Richard Levitte [Tue, 12 Jun 2018 06:56:21 +0000 (08:56 +0200)]
make errors: use the new util/ck_errf.pl options
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6461)
Richard Levitte [Tue, 12 Jun 2018 06:53:14 +0000 (08:53 +0200)]
util/ck_errf.pl: add functionality that brings it closer to util/mkerr.pl
There was no option to give other config files than the default
crypto/err/openssl.ec, and yet it tried to check the errors generated
in engines (and failing, of course).
Also added the same '-internal' option as util/mkerr.pl.
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6461)
Guido Vranken [Mon, 11 Jun 2018 17:38:54 +0000 (19:38 +0200)]
Reject excessively large primes in DH key generation.
CVE-2018-0732
Signed-off-by: Guido Vranken <guidovranken@gmail.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6457)
Richard Levitte [Mon, 11 Jun 2018 14:26:19 +0000 (16:26 +0200)]
util/ck_errf.pl: add detection of unknown libcrypto and libssl libs
The list of known libs are readily available in crypto/err/openssl.ec,
so lets use it to figure out if all error function codes belong to
known libs.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6455)
David von Oheimb [Mon, 11 Jun 2018 09:02:57 +0000 (11:02 +0200)]
export data_dir of Test.pm, which was forgotten in #5928
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6451)
Matt Caswell [Fri, 8 Jun 2018 16:18:03 +0000 (17:18 +0100)]
Remodel the if sequence for handling alerts
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6370)
Matt Caswell [Fri, 18 May 2018 08:08:19 +0000 (09:08 +0100)]
Don't send a warning alert in TLSv1.3
TLSv1.3 ignores the alert level, so we should suppress sending of
warning only alerts.
Fixes #6211
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6370)
Matt Caswell [Fri, 18 May 2018 08:07:42 +0000 (09:07 +0100)]
Fix TLSv1.3 alert handling
In TLSv1.3 we should ignore the severity level of an alert according to
the spec.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6370)
Richard Levitte [Mon, 11 Jun 2018 08:33:09 +0000 (10:33 +0200)]
VMS: have mkdef.pl parse lettered versions properly
Fixes #6449
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6450)
(cherry picked from commit
9a236d5a7158d38b933656cacc31dfd4ff4fcc08)
Todd Short [Wed, 6 Jun 2018 21:28:13 +0000 (17:28 -0400)]
Add support for RSA-PSS to X509_certificate_type()
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6430)
Andy Polyakov [Fri, 8 Jun 2018 13:02:39 +0000 (15:02 +0200)]
bn/asm/sparcv9-mont.pl: iron another glitch in squaring code path.
This module is used only with odd input lengths, i.e. not used in normal
PKI cases, on contemporary processors. The problem was "illuminated" by
fuzzing tests.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6440)
Andy Polyakov [Fri, 8 Jun 2018 09:38:22 +0000 (11:38 +0200)]
rand/rand_unix.c: bypass DSO_global_lookup on ELF systems.
If built with no-dso, syscall_random remains "blind" to getentropy.
Since it's possible to detect symbol availability on ELF-based systems
without involving DSO module, bypass it.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/6436)
Andy Polyakov [Fri, 8 Jun 2018 09:03:32 +0000 (11:03 +0200)]
rand/rand_unix.c: omit error from DSO_global_lookup.
If built with no-dso, DSO_global_lookup leaves "unsupported" message
in error queue. Since there is a fall-back code, it's unnecessary
distraction.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/6436)
Dmitry Belyavskiy [Fri, 8 Jun 2018 13:14:16 +0000 (09:14 -0400)]
New GOST identificators
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6438)
Dmitry Belyavskiy [Wed, 9 May 2018 15:30:41 +0000 (18:30 +0300)]
Documentation for missing s_client/s_server options
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6209)
Matt Caswell [Fri, 8 Jun 2018 10:20:34 +0000 (11:20 +0100)]
Fix no-ec
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6437)
Andy Polyakov [Sun, 3 Jun 2018 18:47:54 +0000 (20:47 +0200)]
Configurations/*.conf: ios targets face-lift.
Move ios targets to 15-ios.conf and modernize by deploying xcrun.
This excuses user from looking for paths and setting environment
variables. [Thanks to @0neday for hint.]
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6410)
Mingtao Yang [Wed, 6 Jun 2018 16:34:18 +0000 (09:34 -0700)]
modes/ocb128.c: Reset nonce-dependent variables on setiv
Upon a call to CRYPTO_ocb128_setiv, either directly on an OCB_CTX or
indirectly with EVP_CTRL_AEAD_SET_IVLEN, reset the nonce-dependent
variables in the OCB_CTX.
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/6420)
Andy Polyakov [Thu, 7 Jun 2018 12:04:34 +0000 (14:04 +0200)]
chacha/asm/chacha-ppc.pl: fix big-endian build.
It's kind of a "brown-bag" bug, as I did recognize the problem and
verified an ad-hoc solution, but failed to follow up with cross-checks
prior filing previous merge request.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6435)
Matt Caswell [Fri, 1 Jun 2018 14:06:52 +0000 (15:06 +0100)]
Add a test for the raw private/public key getters
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6394)
Matt Caswell [Fri, 1 Jun 2018 13:30:50 +0000 (14:30 +0100)]
Add function for setting the EVP_PKEY_ASN1_METHOD raw key getter functions
EVP_PKEY_asn1_set_get_priv_key() and EVP_PKEY_asn1_set_get_pub_key()
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6394)
Matt Caswell [Fri, 1 Jun 2018 13:14:09 +0000 (14:14 +0100)]
Document the raw key getter functions
EVP_PKEY_get_raw_private_key() and EVP_PKEY_get_raw_public_key()
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6394)
Matt Caswell [Fri, 1 Jun 2018 11:22:28 +0000 (12:22 +0100)]
Add support getting raw private/public keys
Only applies to algorithms that support it. Both raw private and public
keys can be obtained for X25519,
Ed25519, X448, Ed448. Raw private keys
only can be obtained for HMAC, Poly1305 and SipHash
Fixes #6259
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6394)
Marcus Huewe [Fri, 11 May 2018 10:24:56 +0000 (12:24 +0200)]
Do not free a session before calling the remove_session_cb
If the remove_session_cb accesses the session's data (for instance,
via SSL_SESSION_get_protocol_version), a potential use after free
can occur. For this, consider the following scenario when adding
a new session via SSL_CTX_add_session:
- The session cache is full
(SSL_CTX_sess_number(ctx) > SSL_CTX_sess_get_cache_size(ctx))
- Only the session cache has a reference to ctx->session_cache_tail
(that is, ctx->session_cache_tail->references == 1)
Since the cache is full, remove_session_lock is called to remove
ctx->session_cache_tail from the cache. That is, it
SSL_SESSION_free()s the session, which free()s the data. Afterwards,
the free()d session is passed to the remove_session_cb. If the callback
accesses the session's data, we have a use after free.
The free before calling the callback behavior was introduced in
commit
e4612d02c53cccd24fa97b08fc01250d1238cca1 ("Remove sessions
from external cache, even if internal cache not used.").
CLA: trivial
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6222)
Richard Levitte [Tue, 5 Jun 2018 13:58:43 +0000 (15:58 +0200)]
Document UTF-8 expectation for pass phrases passed to OSSL_STORE
After some discussion, it was concluded that the better idea is to
stipulate that the pass phrases passed to the OSSL_STORE API are
expected to be UTF-8 encoded, and that all objects made accessible
through OSSL_STORE URIs should adhere to this expectation (at the
discretion of the loaders).
Email ref:
https://mta.openssl.org/pipermail/openssl-project/2018-June/000771.html
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6416)
Matt Caswell [Thu, 7 Jun 2018 09:00:44 +0000 (10:00 +0100)]
Reformulate the if condition in tls_process_new_session_ticket
Improves readability
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6415)
Matt Caswell [Tue, 5 Jun 2018 11:23:28 +0000 (12:23 +0100)]
Don't store the ticket nonce in the session
We generate the secrets based on the nonce immediately so there is no
need to keep the nonce.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6415)
Matt Caswell [Fri, 1 Jun 2018 15:52:34 +0000 (16:52 +0100)]
Fix TLSv1.3 ticket nonces
All tickets on a connection need to have a unique nonce. When this was
originally implemented we only ever sent one ticket on the conneciton so
this didn't matter. We were just using the value 0. Now we can get multiple
tickets to we need to start doing the ticket nonce properly.
Fixes #6387
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6415)
Matt Caswell [Wed, 6 Jun 2018 10:54:32 +0000 (11:54 +0100)]
Fix EAP-FAST
Commit
61fb59238d broke EAP-FAST support. This fixes it.
Fixes #6395
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6428)
Matt Caswell [Wed, 6 Jun 2018 08:51:12 +0000 (09:51 +0100)]
Fix no-dsa
Broken by
0336df2fa.
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6427)
Andy Polyakov [Tue, 5 Jun 2018 18:00:46 +0000 (20:00 +0200)]
crypto/ppccap.c: wire new ChaCha20_ctr32_vsx.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6419)
Andy Polyakov [Tue, 5 Jun 2018 17:59:19 +0000 (19:59 +0200)]
chacha/asm/chacha-ppc.pl: improve performance by 40/80% on POWER8/9.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6419)
Andy Polyakov [Tue, 5 Jun 2018 17:57:42 +0000 (19:57 +0200)]
perlasm/ppc-xlate.pl: add vmrg[eo]w instructions.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6419)
Andy Polyakov [Tue, 5 Jun 2018 17:55:55 +0000 (19:55 +0200)]
sha/asm/sha512p8-ppc.pl: fix build on Mac OS X.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6419)
Georg Schmidt [Wed, 30 May 2018 23:42:39 +0000 (01:42 +0200)]
Issue warnings for large DSA and RSA keys
Issue a warning when generating DSA or RSA keys of size greater than
OPENSSL_DSA_MAX_MODULUS_BITS resp. OPENSSL_RSA_MAX_MODULUS_BITS.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/6380)
Rich Salz [Tue, 5 Jun 2018 15:17:59 +0000 (11:17 -0400)]
Improve wording
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6413)
Richard Levitte [Tue, 5 Jun 2018 07:37:14 +0000 (09:37 +0200)]
crypto/sm2/sm2_za.c: include internal/numbers.h
Needed for the platforms that don't define UINT16_MAX.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6414)
Matt Caswell [Thu, 31 May 2018 15:30:33 +0000 (16:30 +0100)]
Rebuild error codes
There were a large number of error codes that were unused (probably a
copy&paste from somewhere else). Since these have never been made public
we should remove then and rebuild the error codes.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6386)
Matt Caswell [Thu, 31 May 2018 14:53:30 +0000 (15:53 +0100)]
Use lowercase for internal SM2 symbols
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6386)
Matt Caswell [Thu, 31 May 2018 14:38:36 +0000 (15:38 +0100)]
Remove non-existant functions from libcrypto.num
These were never made public so can just be deleted.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6386)
Matt Caswell [Thu, 31 May 2018 13:43:14 +0000 (14:43 +0100)]
More more on SM2 error codes and tidy up
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6386)
Matt Caswell [Thu, 31 May 2018 12:49:47 +0000 (13:49 +0100)]
Improve use of the test framework in the SM2 internal tests
Also general clean up of those tests
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6386)
Matt Caswell [Thu, 31 May 2018 12:10:12 +0000 (13:10 +0100)]
Further work on SM2 error codes
Also does some reformatting to tidy things up
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6386)
Matt Caswell [Thu, 31 May 2018 12:09:39 +0000 (13:09 +0100)]
Add test recipes for internal SM2 tests
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6386)
Jack Lloyd [Thu, 17 May 2018 20:08:33 +0000 (16:08 -0400)]
Set SM2 error codes
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6386)
Jack Lloyd [Fri, 6 Apr 2018 13:45:41 +0000 (09:45 -0400)]
Make SM2 functions private
Address issue #5670
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6386)
Andy Polyakov [Sat, 2 Jun 2018 13:25:50 +0000 (15:25 +0200)]
sha/asm/sha512p8-ppc.pl: improve POWER9 performance by ~10%.
Biggest part, ~7%, of improvement resulted from omitting constants'
table index increment in each round. And minor part from rescheduling
instructions. Apparently POWER9 (and POWER8) manage to dispatch
instructions more efficiently if they are laid down as if they have
no latency...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6406)
Andy Polyakov [Sat, 2 Jun 2018 12:14:28 +0000 (14:14 +0200)]
chacha/asm/chacha-ppc.pl: improve POWER8 performance by 15%.
This comes at cost of minor 2.5% regression on G4, which is reasonable
trade-off. [Further improve compliance with ABI requirements.]
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6406)
Andy Polyakov [Sat, 2 Jun 2018 12:03:27 +0000 (14:03 +0200)]
PPC assembly pack: correct POWER9 results.
As it turns out originally published results were skewed by "turbo"
mode. VM apparently remains oblivious to dynamic frequency scaling,
and reports that processor operates at "base" frequency at all times.
While actual frequency gets increased under load.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6406)
Andy Polyakov [Sun, 20 May 2018 10:13:16 +0000 (12:13 +0200)]
{arm64|x86_64}cpuid.pl: add special 16-byte case to OPENSSL_memcmp.
OPENSSL_memcmp is a must in GCM decrypt and general-purpose loop takes
quite a portion of execution time for short inputs, more than GHASH for
few-byte inputs according to profiler. Special 16-byte case takes it off
top five list in profiler output.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6312)
Andy Polyakov [Sun, 20 May 2018 10:02:39 +0000 (12:02 +0200)]
modes/gcm128.c: coalesce calls to GHASH.
On contemporary platforms assembly GHASH processes multiple blocks
faster than one by one. For TLS payloads shorter than 16 bytes, e.g.
alerts, it's possible to reduce hashing operation to single call.
And for block lengths not divisible by 16 - fold two final calls to
one. Improvement is most noticeable with "reptoline", because call to
assembly GHASH is indirect.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6312)
Andy Polyakov [Sun, 20 May 2018 09:54:24 +0000 (11:54 +0200)]
evp/e_aes.c: replace calls to one-liners with references in GCM.
Even though calls can be viewed as styling improvement, they do come
with cost. It's not big cost and shows only on short inputs, but it is
measurable, 2-3% on some platforms.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6312)
Kurt Roeckx [Sat, 2 Jun 2018 16:15:32 +0000 (18:15 +0200)]
Fix checking the return value of getentropy()
Reviewed-by: Andy Polyakov <appro@openssl.org>
GH: #6405
Kurt Roeckx [Sat, 2 Jun 2018 15:54:29 +0000 (17:54 +0200)]
Remove support for calling getrandom(), we now always call getentropy()
Only Linux and FreeBSD provide getrandom(), but they both also provide
getentropy() since the same version and we already tried to call that.
Reviewed-by: Andy Polyakov <appro@openssl.org>
GH: #6405
Kurt Roeckx [Sat, 2 Jun 2018 15:50:16 +0000 (17:50 +0200)]
Look up availability of getentropy() at runtime.
This will actually support most OSs, and at least adds support for
Solaris and OSX
Fixes: #6403
Reviewed-by: Andy Polyakov <appro@openssl.org>
GH: #6405
Kurt Roeckx [Sat, 2 Jun 2018 13:22:13 +0000 (15:22 +0200)]
Add support for KERN_ARND to get random bytes on NetBSD
Reviewed-by: Andy Polyakov <appro@openssl.org>
GH: #6405
Ken Goldman [Sat, 2 Jun 2018 20:17:32 +0000 (16:17 -0400)]
Document failure return for ECDSA_SIG_new
ECDSA_SIG_new() returns NULL on error.
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6398)
Rich Salz [Sat, 2 Jun 2018 18:57:34 +0000 (14:57 -0400)]
Make OS/X more explicit, to avoid questions
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6404)
Richard Levitte [Thu, 24 May 2018 18:44:45 +0000 (20:44 +0200)]
STORE: split off the description of the 'file' scheme loader
This includes a quick recommendation on how to name loader docmentation.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6350)
Richard Levitte [Thu, 31 May 2018 09:12:34 +0000 (11:12 +0200)]
ENGINE_pkey_asn1_find_str(): don't assume an engine implements ASN1 method
Just because an engine implements algorithm methods, that doesn't mean
it also implements the ASN1 method. Therefore, be careful when looking
for an ASN1 method among all engines, don't try to use one that doesn't
exist.
Fixes #6381
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6383)
(cherry picked from commit
1ac3cd6277f880fac4df313702d5e3b3814e56e2)
(cherry picked from commit
13b578ada3106a4ce9b836f167ee520539f5fa8f)
Matt Caswell [Tue, 29 May 2018 15:09:02 +0000 (16:09 +0100)]
Don't call setsockopt with an invalid fd
This is probably a "should not happen" scenario, but better check anyway.
Found by Coverity.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6373)
Matt Caswell [Tue, 29 May 2018 15:05:10 +0000 (16:05 +0100)]
Fix a memory leak in an error path
Found by Coverity
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6373)
Matt Caswell [Tue, 29 May 2018 15:01:30 +0000 (16:01 +0100)]
Free a variable
Fix a memory leak in storeutl.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6373)
Matt Caswell [Tue, 29 May 2018 14:59:25 +0000 (15:59 +0100)]
Free a variable on an error path
Issue found by Coverity.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6373)
Matt Caswell [Tue, 29 May 2018 14:58:47 +0000 (15:58 +0100)]
Only set TCP_NODELAY if the protocol is TCP
This doesn't apply if we're doing DTLS, or using UNIX domain sockets.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6373)
Matt Caswell [Tue, 29 May 2018 15:27:25 +0000 (16:27 +0100)]
EVP_MD_size() can return an error
Fix some instances where we weren't checking the error return.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6373)
Matt Caswell [Tue, 29 May 2018 13:55:45 +0000 (14:55 +0100)]
Remove some logically dead code
Found by coverity. This is an artifact left over from the original
decaf import which generated the source code for different curves. For
curve 448 this is dead.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6373)
Matt Caswell [Tue, 29 May 2018 13:33:12 +0000 (14:33 +0100)]
Remove some logically dead code
Issues found by Coverity
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6373)
Richard Levitte [Thu, 31 May 2018 04:51:25 +0000 (06:51 +0200)]
apps: when the 'compat' nameopt has been set, leave it be
XN_FLAG_COMPAT has a unique property, its zero for value. This means
it needs special treatment; if it has been set (which can only be
determined indirectly) and set alone (*), no other flags should be
set.
(*) if any other nameopt flag has been set by the user, compatibility
mode is blown away.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6382)
Yihong Wang [Wed, 16 May 2018 06:34:28 +0000 (23:34 -0700)]
Reduce minimal out length in CRYPTO_128_unwrap_pad
In `aes_wrap_cipher()`, the minimal out buff length is `(inlen - 8)`.
Since it calls `CRYPTO_128_unwrap_pad()` underneath, it makes sense to
reduce the minimal out length in `CRYPTO_128_unwrap_pad()` to align to
its caller.
Signed-off-by: Yihong Wang <yh.wang@ibm.com>
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6266)
User [Wed, 16 May 2018 17:59:36 +0000 (13:59 -0400)]
bn/bn_exp.c: mitigation of the One-and-Done side-channel attack.
The One&Done attack, which is described in a paper to appear in the
USENIX Security'18 conference, uses EM emanations to recover the values
of the bits that are obtained using BN_is_bit_set while constructing
the value of the window in BN_mod_exp_consttime. The EM signal changes
slightly depending on the value of the bit, and since the lookup of a
bit is surrounded by highly regular execution (constant-time Montgomery
multiplications) the attack is able to isolate the (very brief) part of
the signal that changes depending on the bit. Although the change is
slight, the attack recovers it successfully >90% of the time on several
phones and IoT devices (all with ARM processors with clock rates around
1GHz), so after only one RSA decryption more than 90% of the bits in
d_p and d_q are recovered correctly, which enables rapid recovery of
the full RSA key using an algorithm (also described in the paper) that
modifies the branch-and-prune approach for a situation in which the
exponents' bits are recovered with errors, i.e. where we do not know
a priori which bits are correctly recovered.
The mitigation for the attack is relatively simple - all the bits of
the window are obtained at once, along with other bits so that an
entire integer's worth of bits are obtained together using masking and
shifts, without unnecessarily considering each bit in isolation. This
improves performance somewhat (one call to bn_get_bits is faster than
several calls to BN_is_bit_set), so the attacker now gets one signal
snippet per window (rather than one per bit) in which the signal is
affected by all bits in the integer (rather than just the one bit).
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6276)
Andy Polyakov [Sun, 27 May 2018 12:04:48 +0000 (14:04 +0200)]
chacha/asm/chacha-ppc.pl: optimize AltiVec/VMX code path.
32-bit vector rotate instruction was defined from beginning, it
not being used from the start must be a brain-slip...
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6363)
Andy Polyakov [Sun, 27 May 2018 12:03:00 +0000 (14:03 +0200)]
perlasm/ppc-xlate.pl: add new instructions and clean up.
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6363)
Andy Polyakov [Mon, 21 May 2018 12:26:54 +0000 (14:26 +0200)]
apps/speed.c: address asan failure with small -bytes and large -misalign.
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6311)
Andy Polyakov [Sat, 19 May 2018 13:43:11 +0000 (15:43 +0200)]
apps/speed.c: add -aead flag.
Goal is to exercise AEAD ciphers in TLS-like sequence, i.e. 13-byte
AAD followed by payload. Update doc/man1/speed.pod accordingly.
[While we are at it, address even some styling and readability issues.]
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6311)
Andy Polyakov [Sat, 19 May 2018 13:53:29 +0000 (15:53 +0200)]
apps/speed.c: clean up SIGARM handling.
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6311)
Richard Levitte [Wed, 30 May 2018 12:25:46 +0000 (14:25 +0200)]
OSSL_STORE: don't test file: URIs on Mingw
Under a mingw shell, the command line path conversion either mangles
file: URIs to something useless (file;C:\...) or not at all (which
can't be opened by the Windows C RTL unless we're really lucky), so we
simply skip testing them in that environment.
Fixes #6369
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6376)
Mingtao Yang [Fri, 9 Feb 2018 18:23:18 +0000 (10:23 -0800)]
Add APIs for custom X509_LOOKUP_METHOD creation
OpenSSL 1.1.0 made the X509_LOOKUP_METHOD structure opaque, so
applications that were previously able to define a custom lookup method
are not able to be ported.
This commit adds getters and setters for each of the current fields of
X509_LOOKUP_METHOD, along with getters and setters on several associated
opaque types (such as X509_LOOKUP and X509_OBJECT).
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6152)
Dmitry Belyavskiy [Thu, 3 May 2018 15:31:47 +0000 (18:31 +0300)]
Text description of GOST signature algorithms
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6168)
Dmitry Belyavskiy [Thu, 3 May 2018 15:31:01 +0000 (18:31 +0300)]
Send GOST SignatureAlgorithms when TLS 1.2 in use
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6168)
Dmitry Belyavskiy [Thu, 3 May 2018 14:25:48 +0000 (17:25 +0300)]
Bugfix: GOST2012 certificates for GOST ciphersuites were broken.
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6168)
Todd Short [Tue, 22 May 2018 14:48:04 +0000 (10:48 -0400)]
Replace strdup() with OPENSSL_strdup()
It's freed with OPENSSL_free()
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6331)
Todd Short [Fri, 18 May 2018 18:54:01 +0000 (14:54 -0400)]
Fix no-sm2 with clang
Return immediately upon discovery of bad message digest.
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6298)
Matt Caswell [Thu, 24 May 2018 15:13:43 +0000 (16:13 +0100)]
Test that a ^ 0 mod -1 is always 0
Check all functions that do this.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6355)
Matt Caswell [Thu, 24 May 2018 15:12:52 +0000 (16:12 +0100)]
The result of a ^ 0 mod -1 is 0 not 1
Thanks to Guido Vranken and OSSFuzz for finding this issue.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6355)
Matt Caswell [Tue, 22 May 2018 14:18:01 +0000 (15:18 +0100)]
Update the "Connected Commands" section of s_client/s_server docs
Fixes #6307
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/6330)
Matt Caswell [Tue, 29 May 2018 12:22:05 +0000 (13:22 +0100)]
Prepare for 1.1.1-pre8-dev
Reviewed-by: Richard Levitte <levitte@openssl.org>
Matt Caswell [Tue, 29 May 2018 12:20:01 +0000 (13:20 +0100)]
Prepare for 1.1.1-pre7 release
Reviewed-by: Richard Levitte <levitte@openssl.org>
Matt Caswell [Tue, 29 May 2018 12:07:08 +0000 (13:07 +0100)]
Update copyright year
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6371)
Dr. Matthias St. Pierre [Mon, 28 May 2018 20:46:21 +0000 (22:46 +0200)]
ECDSA_SIG: restore doc comments which were deleted accidentally
amends
0396401d1c3f
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6366)
Dr. Matthias St. Pierre [Sun, 27 May 2018 07:08:08 +0000 (09:08 +0200)]
ECDSA_SIG: add simple getters for commonly used struct members
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6290)
Dr. Matthias St. Pierre [Sun, 27 May 2018 07:01:28 +0000 (09:01 +0200)]
RSA: add simple getters for commonly used struct members
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6290)
Dr. Matthias St. Pierre [Sun, 27 May 2018 06:57:55 +0000 (08:57 +0200)]
DSA: add simple getters for commonly used struct members
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6290)
Dr. Matthias St. Pierre [Sun, 27 May 2018 07:07:07 +0000 (09:07 +0200)]
DH: fix: add simple getters for commonly used struct members
amends
6db7fadf0975
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6290)
Dr. Matthias St. Pierre [Wed, 16 May 2018 20:53:41 +0000 (22:53 +0200)]
util/libcrypto.num: fix symbol collision between 1.1.0 and master
In commit
6decf9436f7, fourteen public symbols were removed from
util/libcrypto.num on the master branch and the following symbols
renumbered. Unfortunately, the symbols `OCSP_resp_get0_signer` and
`X509_get0_authority_key_id` were not adjusted accordingly on the
OpenSSL_1_1_0-stable branch. This commit fixes the collision by
doing a 'double swap'.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6278)
Bernd Edlinger [Sat, 26 May 2018 15:08:03 +0000 (17:08 +0200)]
Try to work around ubuntu gcc-5 ubsan build failure
[extended tests]
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6360)
Nick Mathewson [Thu, 24 May 2018 19:23:15 +0000 (15:23 -0400)]
Improve the example getpass() implementation to show an error return
Also, modernize the code, so that it isn't trying to store a size_t
into an int, and then check the int's sign. :/
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6271)