oweals/openssl.git
7 years agoUpdate PR#3925 tls1.3-draft-18
Roelof duToit [Thu, 13 Jul 2017 18:09:19 +0000 (14:09 -0400)]
Update PR#3925

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3925)

7 years agoRetry SSL_read on ERROR_WANT_READ.
Roelof duToit [Thu, 13 Jul 2017 17:07:26 +0000 (13:07 -0400)]
Retry SSL_read on ERROR_WANT_READ.
This resolves the retry issue in general, but also the specific case where a TLS 1.3 server sends a post-handshake NewSessionTicket message prior to appdata.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3925)

7 years agoAdd tests for version/ciphersuite sanity checks
Matt Caswell [Wed, 26 Apr 2017 10:43:05 +0000 (11:43 +0100)]
Add tests for version/ciphersuite sanity checks

The previous commits added sanity checks for where the max enabled protocol
version does not have any configured ciphersuites. We should check that we
fail in those circumstances.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3334)

7 years agoAdd a ciphersuite config sanity check for servers
Matt Caswell [Wed, 26 Apr 2017 10:28:20 +0000 (11:28 +0100)]
Add a ciphersuite config sanity check for servers

Ensure that there are ciphersuites enabled for the maximum supported
version we will accept in a ClientHello.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3334)

7 years agoAdd a ciphersuite config sanity check for clients
Matt Caswell [Wed, 26 Apr 2017 09:38:32 +0000 (10:38 +0100)]
Add a ciphersuite config sanity check for clients

Ensure that there are ciphersuites enabled for the maximum supported
version we are claiming in the ClientHello.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3334)

7 years agoAdd a test for resumption after HRR
Matt Caswell [Mon, 20 Mar 2017 18:21:54 +0000 (18:21 +0000)]
Add a test for resumption after HRR

Make sure we actually test resumption where an HRR has occurred.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2996)
(cherry picked from commit 1763ab10291eec361d8e56519582d710158e1e8e)

7 years agoFix resumption after HRR
Matt Caswell [Mon, 20 Mar 2017 18:03:34 +0000 (18:03 +0000)]
Fix resumption after HRR

Commit 6b1bb98fa moved the processing of ClientHello extensions into the
state machine post-processing stage. After processing s->init_num is reset
to 0, so by post-processing we cannot rely on its value. Unfortunately we
were using it to handle the PSK extension. This causes the handshake to
fail.

We were using init_num to figure out the length of ClientHello2 so we can
remove it from the handshake_buffer. The handshake_buffer holds the
transcript of all the messages sent so far. For PSK processing though we
only want to add in a partial ClientHello2. This commit changes things so
we just work out where ClientHello2 starts, working forward from the
beginning of handshake_buffer.

Fixes #2983

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2996)
(cherry picked from commit 77815a026cbedbb7b9a89558612f69e6294fe1ea)

7 years agoFix typo in ASYNC_WAIT_CTX_new.pod doc
Paul Yang [Thu, 16 Mar 2017 08:58:30 +0000 (16:58 +0800)]
Fix typo in ASYNC_WAIT_CTX_new.pod doc

For the function that get the changed fds, it should be
'ASYNC_WAIT_CTX_get_changed_fds()' instead of 'ASYNC_WAIT_CTX_fds_have_changed()'.

CLA: trivial

Signed-off-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2966)

7 years agoSimplify code around next_proto.len by changing 'len' data type.
FdaSilvaYY [Mon, 5 Dec 2016 23:42:01 +0000 (00:42 +0100)]
Simplify code around next_proto.len by changing 'len' data type.

clean an useless static qualifier and a dead comment.

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

7 years agoRemove documentation of deleted function
Benjamin Kaduk [Tue, 28 Feb 2017 22:39:01 +0000 (16:39 -0600)]
Remove documentation of deleted function

It's even removing a BUGS entry!

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2797)

7 years agoRemove unused typedefs from indent config
Benjamin Kaduk [Tue, 28 Feb 2017 22:00:23 +0000 (16:00 -0600)]
Remove unused typedefs from indent config

Some things were not removed from util/indent.pro when they were removed
from the code.

grep '^-T' util/indent.pro | awk '{print $2} > /tmp/a
grep -rF -f /tmp/a --exclude CHANGES --exclude 'INSTALL' --exclude 'LICENSE' --exclude 'NEWS' --exclude 'NOTES*' --exclude 'README*' --exclude indent.pro --exclude-dir corpora -o -h *|sort|uniq>/tmp/b
comm -23 <(sort /tmp/a) /tmp/b >/tmp/c
grep -v -E '(LHASH_OF|STACK_OF)' /tmp/c > /tmp/d
grep -v -Ff /tmp/d util/indent.pro > util/indent.pro

Manually adjusted to retain time_t and the ossl_*intmax_t types.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2797)

7 years agoRemove some unused PEM structures
Benjamin Kaduk [Tue, 28 Feb 2017 21:51:38 +0000 (15:51 -0600)]
Remove some unused PEM structures

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2797)

7 years agoRename the test_stack recipe file name to be consistent with the rest of the
Pauli [Thu, 16 Mar 2017 04:16:00 +0000 (14:16 +1000)]
Rename the test_stack recipe file name to be consistent with the rest of the
tests.

[skip ci]

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

7 years agoFixed a crash in print_notice.
Bernd Edlinger [Tue, 14 Mar 2017 14:10:52 +0000 (15:10 +0100)]
Fixed a crash in print_notice.

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

7 years agoRemove dead code
Benjamin Kaduk [Tue, 14 Mar 2017 22:53:46 +0000 (17:53 -0500)]
Remove dead code

tls1_get_curvelist() does not read from its third parameter, so
the assignments prior to function call were dead code and can be removed.

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

7 years agoTighten up client status_request processing
Benjamin Kaduk [Tue, 14 Mar 2017 23:57:43 +0000 (18:57 -0500)]
Tighten up client status_request processing

Instead of making a positive comparison against the invalid value
that our server would send, make a negative check against the only
value that is not an error.

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

7 years agoForgotten 'make update'
Richard Levitte [Wed, 15 Mar 2017 20:20:11 +0000 (21:20 +0100)]
Forgotten 'make update'

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoVMS: turning off CALL_DEBUG isn't possible on Alpha
Richard Levitte [Wed, 15 Mar 2017 16:10:48 +0000 (17:10 +0100)]
VMS: turning off CALL_DEBUG isn't possible on Alpha

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2962)

7 years agoAdd EC_KEY_get0_engine()
Richard Levitte [Wed, 15 Mar 2017 13:11:34 +0000 (14:11 +0100)]
Add EC_KEY_get0_engine()

Just as for DH, DSA and RSA, this gives the engine associated with the
key.

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

7 years agoRewrite the documentation for sk_TYPE_find() and sk_TYPE_find_ex() to better
Pauli [Wed, 15 Mar 2017 04:29:08 +0000 (14:29 +1000)]
Rewrite the documentation for sk_TYPE_find() and sk_TYPE_find_ex() to better
describe the vagaries in their behaviour.

[skip ci]

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

7 years agoUnit tests for crypto/stack.
Pauli [Tue, 14 Mar 2017 02:37:26 +0000 (12:37 +1000)]
Unit tests for crypto/stack.

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

7 years agoFix a hang in tests that use sessionfile
Matt Caswell [Wed, 15 Mar 2017 00:54:04 +0000 (00:54 +0000)]
Fix a hang in tests that use sessionfile

The logic for testing whether the sessionfile has been created or not
was faulty and could result in race conditions. If you "lose" the tests
hang waiting for a session file that's never going to arrive.

Fixes #2950

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2955)

7 years agoNOTES.WIN: mention Strawberry Perl as option.
Andy Polyakov [Tue, 14 Mar 2017 20:29:24 +0000 (21:29 +0100)]
NOTES.WIN: mention Strawberry Perl as option.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agotest/recipes/03-test_internal_*: call setup() first.
Andy Polyakov [Tue, 14 Mar 2017 14:23:39 +0000 (15:23 +0100)]
test/recipes/03-test_internal_*: call setup() first.

Strawberry Perl bailed out running test\run_tests.pl insisting on
setup() being called explicitly.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoClear alpn_selected_len for clients, too
Benjamin Kaduk [Wed, 15 Mar 2017 00:17:15 +0000 (19:17 -0500)]
Clear alpn_selected_len for clients, too

Zero out the length alongside the NULLing of the pointer, to
bring parity between the selected and proposed fields..

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

7 years agoVMS: don't use /DSF, turn off CALL_DEBUG instead
Richard Levitte [Wed, 15 Mar 2017 01:52:20 +0000 (02:52 +0100)]
VMS: don't use /DSF, turn off CALL_DEBUG instead

It turns out that /DSF didn't do any good for our purposes.  Instead,
remove the CALL_DEBUG flag from any image we link.  This ensures that
we can have debugging information in the image files, but don't
automatically end up in a debugging session upon image activation.

Unfortunately, this means the CALL_DEBUG must be turned on when there
is a need to run with the debugger activated, and to turn it off when
done.  This has been documented in NOTES.VMS.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2957)

7 years agoAdd Python Cryptography.io external test suite
Jon Spillett [Thu, 9 Mar 2017 00:50:55 +0000 (10:50 +1000)]
Add Python Cryptography.io external test suite

Add python cryptography testing instructions too

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

7 years agoAdd additional RSA-PSS and RSA-OAEP tests.
Dr. Stephen Henson [Tue, 14 Mar 2017 19:02:10 +0000 (19:02 +0000)]
Add additional RSA-PSS and RSA-OAEP tests.

Import test data from:
ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip

This is a set of RSA-PSS and RSA-OAEP test vectors including some edge cases
with unusual key sizes.

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

7 years agoRe-enable some BoringSSL tests
Matt Caswell [Tue, 14 Mar 2017 17:29:11 +0000 (17:29 +0000)]
Re-enable some BoringSSL tests

The previous 2 commits fixed some issues in the Boring tests. This
re-enables those tests.

[extended tests]

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2942)

7 years agoSSL_get_peer_cert_chain() does not work after a resumption
Matt Caswell [Tue, 14 Mar 2017 17:27:46 +0000 (17:27 +0000)]
SSL_get_peer_cert_chain() does not work after a resumption

After a resumption it is documented that SSL_get_peer_cert_chain() will
return NULL. In BoringSSL it still returns the chain. We don't support that
so we should update the shim to call SSL_get_peer_certificate() instead
when checking whether a peer certificate is available.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2942)

7 years agoEnsure we set the session id context in ossl_shim
Matt Caswell [Tue, 14 Mar 2017 17:26:46 +0000 (17:26 +0000)]
Ensure we set the session id context in ossl_shim

OpenSSL requires that we set the session id context. BoringSSL apparently
does not require this, so wasn't setting it.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2942)

7 years agoDe-obfuscate
Benjamin Kaduk [Tue, 14 Mar 2017 22:14:30 +0000 (17:14 -0500)]
De-obfuscate

No need to break out of the loop and repeat the loop termination
condition when we can just return.

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

7 years agoVMS: throw away [.util]shareable_image_wrap.c.in and add replacement scripts
Richard Levitte [Tue, 14 Mar 2017 21:09:57 +0000 (22:09 +0100)]
VMS: throw away [.util]shareable_image_wrap.c.in and add replacement scripts

[.util]shareable_image_wrap.c.in was never useful because lib$spawn()
insisted on combining stdout and stderr into one.

Instead, we introduce two scripts that create and destroy a temporary
environment where the local shareable images become available,
[.util]local_shlib.com and [.util]unlocal_shlib.com.  They also define
DBG$IMAGE_DSF_PATH, which is require so the debugger can find the Debug
Symbol Files.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2947)

7 years agoVMS: Change debug linking method to generate a separate Debug Symbol File
Richard Levitte [Tue, 14 Mar 2017 21:00:13 +0000 (22:00 +0100)]
VMS: Change debug linking method to generate a separate Debug Symbol File

That makes it possible to run images without automagically ending up
in a debug session, while still being able to debug when required.

All .DSF files must reside in the same directory to be useful.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2947)

7 years ago.travis.yml: make git submodule update conditional.
Andy Polyakov [Mon, 13 Mar 2017 11:13:07 +0000 (12:13 +0100)]
.travis.yml: make git submodule update conditional.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoAdd test for -nameout output
Rich Salz [Tue, 14 Mar 2017 18:53:35 +0000 (14:53 -0400)]
Add test for -nameout output

Using a cert with Cyrillic characters, kindly supplied by Dmitry Belyavsky

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

7 years agoUpdate master Travis to Trusty
Emilia Kasper [Tue, 14 Mar 2017 15:40:34 +0000 (16:40 +0100)]
Update master Travis to Trusty

This gets us a newer Clang, and newer Go.
1.1.0 already runs on Trusty without issues.

To do this, we need to disable afalgeng in the -Werror build.

afalgeng isn't compatible with the -Werror build on
Travis Trusty due to kernel header mismatch.

(See also 97043e46aa7083c787a1efd72ac31ca97ed41610)

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoFix a -Wsign-compare warning
Benjamin Kaduk [Tue, 14 Mar 2017 16:37:42 +0000 (11:37 -0500)]
Fix a -Wsign-compare warning

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

7 years agoFix some -Wshadow warnings
Benjamin Kaduk [Tue, 14 Mar 2017 16:36:07 +0000 (11:36 -0500)]
Fix some -Wshadow warnings

Found using various (old-ish) versions of gcc.

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

7 years agoRather use -out parameter than redirect stdout
Richard Levitte [Tue, 14 Mar 2017 16:01:19 +0000 (17:01 +0100)]
Rather use -out parameter than redirect stdout

On some platforms, setting stdout to binary mode isn't quite enough,
which makes the result unusable.  With -out, we have better control.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2939)

7 years agoFix 12 Boring tests involving NULL-SHA ciphersuites
Matt Caswell [Tue, 14 Mar 2017 14:16:19 +0000 (14:16 +0000)]
Fix 12 Boring tests involving NULL-SHA ciphersuites

The Boring runner attempts to enable the NULL-SHA ciphersuite using the
cipherstring "DEFAULT:NULL-SHA". However in OpenSSL DEFAULT permanently
switches off NULL ciphersuites, so we fix this up to be "ALL:NULL-SHA"
instead. We can't change the runner so we have to change the shim to
detect this.

(Merged from https://github.com/openssl/openssl/pull/2933)
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
7 years agoPort remaining old DTLS tests
Emilia Kasper [Tue, 14 Mar 2017 13:56:22 +0000 (14:56 +0100)]
Port remaining old DTLS tests

We already test DTLS protocol versions. For good measure, add some
DTLS tests with client auth to the new test framework, so that we can
remove the old tests without losing coverage.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoPort SRP tests to the new test framework
Emilia Kasper [Tue, 14 Mar 2017 12:48:54 +0000 (13:48 +0100)]
Port SRP tests to the new test framework

Also add negative tests for password mismatch.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoUpdate ossl_config.json for later BoringSSL commit
Matt Caswell [Tue, 14 Mar 2017 10:18:21 +0000 (10:18 +0000)]
Update ossl_config.json for later BoringSSL commit

Update the list of suppressions so that we can run a later BoringSSL set
of tests. This also adds an ErrorMap to greatly reduce the number of
failing tests. The remaining tests that still fail are just disabled for
now.

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

7 years agoMake the Boring tests pass
Matt Caswell [Tue, 14 Mar 2017 09:59:51 +0000 (09:59 +0000)]
Make the Boring tests pass

The boring tests are currently failing because they send a PSK extension
which isn't in the last place. This is not allowed in the latest TLS1.3
specs. However the Boring tests we have are based on an old commit that
pre-date when that rule first appeared.

The proper solution is to update the tests to a later commit. But for now
to get travis to go green we disable the failing tests.

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

7 years agoAdd the presence of ARIA to the change log.
Pauli [Tue, 14 Mar 2017 04:08:02 +0000 (14:08 +1000)]
Add the presence of ARIA to the change log.

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

7 years agoAdded a test case for RSA_padding_add_PKCS1_PSS_mgf1.
Bernd Edlinger [Thu, 2 Mar 2017 12:15:22 +0000 (13:15 +0100)]
Added a test case for RSA_padding_add_PKCS1_PSS_mgf1.

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

7 years agoFix a crash or unbounded allocation in RSA_padding_add_PKCS1_PSS_mgf1
Bernd Edlinger [Mon, 27 Feb 2017 11:40:35 +0000 (12:40 +0100)]
Fix a crash or unbounded allocation in RSA_padding_add_PKCS1_PSS_mgf1
and RSA_verify_PKCS1_PSS_mgf1 with 512-bit RSA vs. sha-512.

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

7 years agoBetter way to recognise mingw64 in config script
Richard Levitte [Mon, 13 Mar 2017 20:25:37 +0000 (21:25 +0100)]
Better way to recognise mingw64 in config script

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2922)

7 years agopoly1305/asm/poly1305-x86_64.pl: add poly1305_blocks_vpmadd52_4x.
Andy Polyakov [Sun, 12 Mar 2017 14:37:16 +0000 (15:37 +0100)]
poly1305/asm/poly1305-x86_64.pl: add poly1305_blocks_vpmadd52_4x.

As hinted by its name new subroutine processes 4 input blocks in
parallel. It still operates on 256-bit registers and is just
another step toward full-blown AVX512IFMA procedure.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agopoly1305/asm/poly1305-armv8.pl: ilp32-specific poly1305_init fix.
Andy Polyakov [Sun, 12 Mar 2017 14:32:59 +0000 (15:32 +0100)]
poly1305/asm/poly1305-armv8.pl: ilp32-specific poly1305_init fix.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agocrypto/x86*cpuid.pl: move extended feature detection.
Andy Polyakov [Sun, 12 Mar 2017 13:45:06 +0000 (14:45 +0100)]
crypto/x86*cpuid.pl: move extended feature detection.

Exteneded feature flags were not pulled on AMD processors, as result
a number of extensions were effectively masked on Ryzen. Original fix
for x86_64cpuid.pl addressed this problem, but messed up processor
vendor detection. This fix moves extended feature detection past
basic feature detection where it belongs. 32-bit counterpart is
harmonized too.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoDocument in CHANGES that config now recognises 64-bit mingw
Richard Levitte [Mon, 13 Mar 2017 12:20:55 +0000 (13:20 +0100)]
Document in CHANGES that config now recognises 64-bit mingw

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2917)

7 years agoRecognise mingw64 in config script
Richard Levitte [Mon, 13 Mar 2017 08:09:43 +0000 (09:09 +0100)]
Recognise mingw64 in config script

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

7 years agoFix some doc nits
Rich Salz [Sat, 11 Mar 2017 17:48:32 +0000 (12:48 -0500)]
Fix some doc nits

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

7 years agoFix out-of-memory condition in conf
Matt Caswell [Fri, 10 Mar 2017 10:51:35 +0000 (10:51 +0000)]
Fix out-of-memory condition in conf

conf has the ability to expand variables in config files. Repeatedly doing
this can lead to an exponential increase in the amount of memory required.
This places a limit on the length of a value that can result from an
expansion.

Credit to OSS-Fuzz for finding this problem.

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

7 years agoHandle find-doc-nits script rename
Rich Salz [Sat, 11 Mar 2017 15:28:45 +0000 (10:28 -0500)]
Handle find-doc-nits script rename

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoFix many doc L<> errors
Rich Salz [Sat, 11 Mar 2017 13:56:44 +0000 (08:56 -0500)]
Fix many doc L<> errors

Add 2017 copyright year
Add missing typedef to NAME
Remove ec(7) and bn(7) doc links
Remove .pod link errors, bogus links, make a few typo corrections
Fix some typo's in links and some missing items.
Don't link to C runtime functions (See OPENSSL_malloc for example/precedent)
Document ASN1_tag2str(), add a few typedef's that were missing from NAME
Update doc-nits target; addresses
    https://github.com/openssl/openssl/pull/1900#issuecomment-259943891,
Merge check-doc-links into find-doc-nits; if run regularly, would have found
    https://github.com/openssl/openssl/pull/2825

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

7 years agoUI docs: Rephrase the UI method function return value description
Richard Levitte [Sat, 11 Mar 2017 09:51:04 +0000 (10:51 +0100)]
UI docs: Rephrase the UI method function return value description

It seems the =item isn't supposed to have pure numbers, or so tells me
perldoc.

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

7 years agoFix UI_get0_action_string()
Richard Levitte [Fri, 10 Mar 2017 23:54:52 +0000 (00:54 +0100)]
Fix UI_get0_action_string()

It shouldn't try to return an action description for UIT_PROMPT type
UI strings.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2904)

7 years agoDocument UI_METHOD and UI_STRING, both useful for UI_METHOD creators
Richard Levitte [Fri, 10 Mar 2017 23:51:53 +0000 (00:51 +0100)]
Document UI_METHOD and UI_STRING, both useful for UI_METHOD creators

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

7 years agoUse the callbacks from the SSL object instead of the SSL_CTX object
Pauli [Tue, 7 Mar 2017 05:36:16 +0000 (15:36 +1000)]
Use the callbacks from the SSL object instead of the SSL_CTX object

... in functions dealing with the SSL object rather than the context.

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

7 years agoEncourage having external tests in multiple test recipes
Richard Levitte [Fri, 10 Mar 2017 19:42:12 +0000 (20:42 +0100)]
Encourage having external tests in multiple test recipes

This will make the individual external tests more easily selectable /
deselectable through the usual test selection mechanism.

This also moves external tests to group 95.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2902)

7 years agoAvoid questionable use of the value of a pointer
Bernd Edlinger [Fri, 10 Mar 2017 14:10:41 +0000 (15:10 +0100)]
Avoid questionable use of the value of a pointer

that refers to space
deallocated by a call to the free function in tls_decrypt_ticket.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2897)
(cherry picked from commit 13ed1afa923f4ffb553e389de08f26e9ce84e8a2)

7 years agoSplit test/recipes/03_test_internal.t into individual tests
Richard Levitte [Fri, 10 Mar 2017 19:18:56 +0000 (20:18 +0100)]
Split test/recipes/03_test_internal.t into individual tests

This allows a finer granularity when selecting which tests to run, and
makes the tests more vidible.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2901)

7 years agoDocument how to select / deselect test group numbers
Richard Levitte [Fri, 10 Mar 2017 07:32:58 +0000 (08:32 +0100)]
Document how to select / deselect test group numbers

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2892)

7 years agoAdd HelloRetryRequest text to s_client/s_server
Todd Short [Fri, 10 Mar 2017 16:51:17 +0000 (11:51 -0500)]
Add HelloRetryRequest text to s_client/s_server

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

7 years agoFix some RSA documentation
Matt Caswell [Fri, 10 Mar 2017 15:49:04 +0000 (15:49 +0000)]
Fix some RSA documentation

RSA_private_encrypt(), RSA_public_decrypt(), RSA_public_encrypt() and
RSA_private_decrypt() are declared with a "const" from parameter, but
this is not reflected in the docs.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2899)

7 years agoUse the new TLSv1.3 certificate_required alert where appropriate
Matt Caswell [Fri, 10 Mar 2017 15:09:24 +0000 (15:09 +0000)]
Use the new TLSv1.3 certificate_required alert where appropriate

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2898)

7 years agoAdd a test to check that if a PSK extension is not last then we fail
Matt Caswell [Fri, 10 Mar 2017 13:54:32 +0000 (13:54 +0000)]
Add a test to check that if a PSK extension is not last then we fail

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2896)

7 years agoCheck that the PSK extension is last
Matt Caswell [Fri, 10 Mar 2017 13:53:53 +0000 (13:53 +0000)]
Check that the PSK extension is last

We need to check that the PSK extension in a ClientHello is the last one.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2896)

7 years agoFixup previous merge.
Bernd Edlinger [Wed, 22 Feb 2017 07:14:07 +0000 (08:14 +0100)]
Fixup previous merge.

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

7 years agoMake it possible to select or deselect test groups by number
Richard Levitte [Thu, 9 Mar 2017 18:08:03 +0000 (19:08 +0100)]
Make it possible to select or deselect test groups by number

Examples of possible expressions (adapt to your platform):

    make test TESTS=-99
    make test TESTS=10
    make test TESTS=-9?
    make test TESTS=-[89]0
    make test TESTS=[89]0

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2887)

7 years agoMake the output of enc -ciphers identical even if run several times in a session.
Pauli [Wed, 8 Mar 2017 23:42:25 +0000 (09:42 +1000)]
Make the output of enc -ciphers identical even if run several times in a session.

This amounts to moving the column counter so it isn't a function local static variable and reinitialising it each time.

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

7 years agoExit the loop on failure
Jon Spillett [Wed, 1 Mar 2017 04:22:21 +0000 (14:22 +1000)]
Exit the loop on failure

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

7 years agoAdd some TLS13 values to s_client/s_server
Todd Short [Wed, 8 Mar 2017 18:49:44 +0000 (13:49 -0500)]
Add some TLS13 values to s_client/s_server

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

7 years agoLimit the output of the enc -ciphers command to just the ciphers enc can
Pauli [Wed, 8 Mar 2017 01:18:55 +0000 (11:18 +1000)]
Limit the output of the enc -ciphers command to just the ciphers enc can
process.  This means no AEAD ciphers and no XTS mode.

Update the test script that uses this output to test cipher suites to not
filter out the now missing cipher modes.

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

7 years agothis change will prevent undefined behavior when src and dst are equal (memcpy),...
Roberto Guimaraes [Sun, 26 Feb 2017 23:47:40 +0000 (15:47 -0800)]
this change will prevent undefined behavior when src and dst are equal (memcpy), effectively allowing setting length only in both functions.

CLA: trivial

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

7 years agoFix no-comp
Matt Caswell [Tue, 7 Mar 2017 09:58:27 +0000 (09:58 +0000)]
Fix no-comp

The value of SSL3_RT_MAX_ENCRYPTED_LENGTH normally includes the compression
overhead (even if no compression is negotiated for a connection). Except in
a build where no-comp is used the value of SSL3_RT_MAX_ENCRYPTED_LENGTH does
not include the compression overhead.

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

7 years agoFix the number of tests to skip if TLSv1.3 is disabled
Matt Caswell [Tue, 7 Mar 2017 16:21:38 +0000 (16:21 +0000)]
Fix the number of tests to skip if TLSv1.3 is disabled

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2875)

7 years agoAdd a test for records not on the record boundary
Matt Caswell [Tue, 7 Mar 2017 12:03:10 +0000 (12:03 +0000)]
Add a test for records not on the record boundary

Test that we check that key change messages appear on a record boundary.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2875)

7 years agoCheck TLSv1.3 ServerHello, Finished and KeyUpdates are on record boundary
Matt Caswell [Tue, 7 Mar 2017 10:21:58 +0000 (10:21 +0000)]
Check TLSv1.3 ServerHello, Finished and KeyUpdates are on record boundary

In TLSv1.3 the above messages signal a key change. The spec requires that
the end of these messages must align with a record boundary. We can detect
this by checking for decrypted but as yet unread record data sitting in
OpenSSL buffers at the point where we process the messages.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2875)

7 years agoProvide a function to test whether we have unread records pending
Matt Caswell [Fri, 3 Mar 2017 12:41:39 +0000 (12:41 +0000)]
Provide a function to test whether we have unread records pending

Also updates SSL_has_pending() to use it. This actually fixes a bug in
SSL_has_pending() which is supposed to return 1 if we have any processed
or unprocessed data sitting in OpenSSL buffers. However it failed to return
1 if we had processed non-application data pending.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2875)

7 years agoRemove doc reference to non-existant GCM example
Pauli [Mon, 6 Mar 2017 22:45:48 +0000 (08:45 +1000)]
Remove doc reference to non-existant GCM example

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2866)

7 years agoGet pointer type right in BIO_ssl_shutdown()
Rich Salz [Thu, 16 Feb 2017 16:13:47 +0000 (11:13 -0500)]
Get pointer type right in BIO_ssl_shutdown()

Also, restore 1.0.2 behavior of looping over all BIO's in the chain.
Thanks to Joseph Bester for finding this and suggesting a fix to the
crash.

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

7 years agocrypto/x86_64cpuid.pl: move extended feature detection upwards.
Andy Polyakov [Sun, 5 Mar 2017 19:38:36 +0000 (20:38 +0100)]
crypto/x86_64cpuid.pl: move extended feature detection upwards.

Exteneded feature flags were not pulled on AMD processors, as result a
number of extensions were effectively masked on Ryzen. It should have
been reported for Excavator since it implements AVX2 extension, but
apparently nobody noticed or cared...

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agotest: add chacha_internal_test.
Andy Polyakov [Sat, 4 Mar 2017 22:11:16 +0000 (23:11 +0100)]
test: add chacha_internal_test.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoIncrease the password buffer size to APP_PASS_LEN.
Pauli [Tue, 7 Mar 2017 00:12:05 +0000 (10:12 +1000)]
Increase the password buffer size to APP_PASS_LEN.

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

7 years agoUnix Makefile: Have manual generation use the same perl script as Windows and VMS
Richard Levitte [Mon, 6 Mar 2017 20:17:32 +0000 (21:17 +0100)]
Unix Makefile: Have manual generation use the same perl script as Windows and VMS

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2863)

7 years agoutil/process_docs.pl: make it possible to add a suffix to man docs
Richard Levitte [Mon, 6 Mar 2017 20:16:35 +0000 (21:16 +0100)]
util/process_docs.pl: make it possible to add a suffix to man docs

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2863)

7 years agoAdd a test to check that we correctly handle record overflows
Matt Caswell [Mon, 6 Mar 2017 16:56:42 +0000 (16:56 +0000)]
Add a test to check that we correctly handle record overflows

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2861)

7 years agoTweak the TLSv1.3 record overflow limits
Matt Caswell [Mon, 6 Mar 2017 15:13:25 +0000 (15:13 +0000)]
Tweak the TLSv1.3 record overflow limits

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2861)

7 years agoFix double free in cookie generation.
Kurt Roeckx [Sun, 5 Mar 2017 20:00:11 +0000 (21:00 +0100)]
Fix double free in cookie generation.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
GH: #2850

7 years agoRemove some duplicate manpage entries
Rich Salz [Fri, 3 Mar 2017 20:03:42 +0000 (15:03 -0500)]
Remove some duplicate manpage entries

[skip ci]

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

7 years agoAdd documentation on platform specific checks
Richard Levitte [Mon, 6 Mar 2017 10:19:49 +0000 (11:19 +0100)]
Add documentation on platform specific checks

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2851)

7 years agoAdd a platform specific configuration checker
Richard Levitte [Sun, 5 Mar 2017 20:51:18 +0000 (21:51 +0100)]
Add a platform specific configuration checker

For each platform, we may need to perform some basic checks to see
that available tools perform as we expect them.

For the moment, the added checkers test that Perl gives the expected
path format.  This should help MingW users to see if they run an
appropriate Perl implementation, for example.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2851)

7 years agoFix an endless loop in rsa_builtin_keygen.
Rich Salz [Mon, 6 Mar 2017 14:54:17 +0000 (09:54 -0500)]
Fix an endless loop in rsa_builtin_keygen.

And add a test case.

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

7 years agoFix no-ec
Matt Caswell [Mon, 6 Mar 2017 10:16:07 +0000 (10:16 +0000)]
Fix no-ec

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

7 years agoFix a test failure with no-tls1_1
Matt Caswell [Mon, 6 Mar 2017 10:03:53 +0000 (10:03 +0000)]
Fix a test failure with no-tls1_1

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

7 years agoFix no-psk
Matt Caswell [Mon, 6 Mar 2017 09:51:54 +0000 (09:51 +0000)]
Fix no-psk

Fixes #2847

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