oweals/openssl.git
7 years agoFix inconsistent check of UNSAFE_LEGACY_RENEGOTIATION
Todd Short [Mon, 22 May 2017 15:24:59 +0000 (11:24 -0400)]
Fix inconsistent check of UNSAFE_LEGACY_RENEGOTIATION

The check for SSL3_FLAGS_ALLOW_UNSAFE_LEGACY_RENEGOTIATION is
inconsistent. Most places check SSL->options, one place is checking
SSL_CTX->options; fix that.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
GH: #3523

7 years agoFix use of "can_load()" in run_tests.pl.
Rainer Jung [Thu, 25 May 2017 21:58:14 +0000 (23:58 +0200)]
Fix use of "can_load()" in run_tests.pl.

CLA: Trivial

Fixes #3563.

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

7 years agotest/evp_test.c: improve output in case of errors.
Andy Polyakov [Thu, 25 May 2017 11:48:32 +0000 (13:48 +0200)]
test/evp_test.c: improve output in case of errors.

Recently introduced TEST_* macros print variables' symbolic names.
In order to make error output more readable rename some variables.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agomodes/ocb128.c: address undefined behaviour warning.
Andy Polyakov [Thu, 25 May 2017 16:08:09 +0000 (18:08 +0200)]
modes/ocb128.c: address undefined behaviour warning.

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

7 years agoaria/aria.c: address undefined behaviour warning in small-footprint path.
Andy Polyakov [Tue, 23 May 2017 12:33:20 +0000 (14:33 +0200)]
aria/aria.c: address undefined behaviour warning in small-footprint path.

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

7 years agoAdd missing commas in pod files
Kurt Roeckx [Thu, 25 May 2017 17:24:11 +0000 (19:24 +0200)]
Add missing commas in pod files

Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #3557

7 years agoFix BoringSSL alert related test failures
Matt Caswell [Thu, 25 May 2017 10:26:18 +0000 (11:26 +0100)]
Fix BoringSSL alert related test failures

Commit bd990e2535 changed our handling of alerts. Some of the BoringSSl
tests were expecting specific errors to be created if bad alerts were sent.
Those errors have now changed as a result of that commit, so the BoringSSL
test config needs to be updated to match.

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

7 years agoDocument that HMAC() with a NULL md is not thread safe
Matt Caswell [Thu, 25 May 2017 14:18:22 +0000 (15:18 +0100)]
Document that HMAC() with a NULL md is not thread safe

Fixes #3541

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

7 years agoUpdates CHANGES and NEWS for new release
Matt Caswell [Thu, 25 May 2017 10:00:29 +0000 (11:00 +0100)]
Updates CHANGES and NEWS for new release

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

7 years agoDocument that PKCS#12 functions assume UTF-8 for passwords
David Woodhouse [Wed, 24 May 2017 11:18:14 +0000 (12:18 +0100)]
Document that PKCS#12 functions assume UTF-8 for passwords

Part of issue #3531

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

7 years agoClarify what character encoding is used in the returned UI strings
Richard Levitte [Tue, 23 May 2017 17:52:54 +0000 (19:52 +0200)]
Clarify what character encoding is used in the returned UI strings

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

7 years agoFix va_arg all in test_error_c90
Rich Salz [Tue, 23 May 2017 13:24:12 +0000 (09:24 -0400)]
Fix va_arg all in test_error_c90

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

7 years agoRevise evp_test parser; make like bn_test
Rich Salz [Fri, 12 May 2017 18:19:51 +0000 (14:19 -0400)]
Revise evp_test parser; make like bn_test

Re-order and comment on the functions

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

7 years agoAdd titles to groups of EVP tests
Rich Salz [Tue, 23 May 2017 14:01:37 +0000 (10:01 -0400)]
Add titles to groups of EVP tests

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

7 years agoFix line numbering for errors.
Rich Salz [Tue, 23 May 2017 12:59:49 +0000 (08:59 -0400)]
Fix line numbering for errors.

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

7 years agoDon't use one shot API for SSLv3.
Dr. Stephen Henson [Tue, 23 May 2017 11:56:51 +0000 (12:56 +0100)]
Don't use one shot API for SSLv3.

SSLv3 (specifically with client auth) cannot use one shot APIs: the digested
data and the master secret are handled in separate update operations. So
in the special case of SSLv3 use the streaming API.

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

7 years agoFix typo in doc/man3/EVP_EncrypInit.pod
Paul Yang [Mon, 22 May 2017 15:18:45 +0000 (23:18 +0800)]
Fix typo in doc/man3/EVP_EncrypInit.pod

In the example section.

CLA: trivial

Signed-off-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3520)

7 years agoRevert "Integration build a small memory image"
Rich Salz [Mon, 22 May 2017 17:09:58 +0000 (13:09 -0400)]
Revert "Integration build a small memory image"

This reverts commit e2580e70d5c644c5dadd33ffa8bb23223959b87a.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Updates https://github.com/openssl/openssl/pull/3268)

7 years agoAdd an error to the stack on failure in dtls1_write_bytes()
Matt Caswell [Mon, 22 May 2017 11:36:11 +0000 (12:36 +0100)]
Add an error to the stack on failure in dtls1_write_bytes()

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

7 years agoConvert existing usage of assert() to ossl_assert() in libssl
Matt Caswell [Mon, 22 May 2017 11:33:42 +0000 (12:33 +0100)]
Convert existing usage of assert() to ossl_assert() in libssl

Provides consistent output and approach.

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

7 years agoFix some style issues in returns
Matt Caswell [Mon, 22 May 2017 11:33:29 +0000 (12:33 +0100)]
Fix some style issues in returns

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

7 years agoReplace instances of OPENSSL_assert() with soft asserts in libssl
Matt Caswell [Fri, 19 May 2017 08:35:19 +0000 (09:35 +0100)]
Replace instances of OPENSSL_assert() with soft asserts in libssl

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

7 years agoAdd a macro for testing assertion in both debug and production builds
Matt Caswell [Fri, 19 May 2017 08:30:37 +0000 (09:30 +0100)]
Add a macro for testing assertion in both debug and production builds

If we have an assert then in a debug build we want an abort() to occur.
In a production build we want the function to return an error.

This introduces a new macro to assist with that. The idea is to replace
existing use of OPENSSL_assert() with this new macro. The problem with
OPENSSL_assert() is that it aborts() on an assertion failure in both debug
and production builds. It should never be a library's decision to abort a
process (we don't get to decide when to kill the life support machine or
the nuclear reactor control system). Additionally if an attacker can
cause a reachable assert to be hit then this can be a source of DoS attacks
e.g. see CVE-2017-3733, CVE-2015-0293, CVE-2011-4577 and CVE-2002-1568.

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

7 years agoReformat the string output to be more in line with the decisions made in #3465
Pauli [Sun, 21 May 2017 22:22:19 +0000 (08:22 +1000)]
Reformat the string output to be more in line with the decisions made in #3465

Don't highlight excess when comparing unequal length strings.

Clean up the NULL / empty string display.

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

7 years agoBring the memory output inline with the suggestions in #3465.
Pauli [Sun, 21 May 2017 22:39:44 +0000 (08:39 +1000)]
Bring the memory output inline with the suggestions in #3465.

Excess bytes, when one block is longer than the other, are not explicitly
highlighted.

The NULL / zero length block output has been cleaned up.

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

7 years agoFixed merge nonsense
Alex Gaynor [Thu, 20 Apr 2017 22:47:53 +0000 (18:47 -0400)]
Fixed merge nonsense

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

7 years agoNewlines!
Alex Gaynor [Mon, 10 Apr 2017 21:11:01 +0000 (17:11 -0400)]
Newlines!

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

7 years agoUpdate the test to assert that the SCT is from an X.509 extension
Alex Gaynor [Sat, 8 Apr 2017 13:33:17 +0000 (09:33 -0400)]
Update the test to assert that the SCT is from an X.509 extension

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

7 years agoStyle fixes and use the source parameter so the OCSP path works
Alex Gaynor [Sat, 8 Apr 2017 13:21:19 +0000 (09:21 -0400)]
Style fixes and use the source parameter so the OCSP path works

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

7 years agoThis is an int
Alex Gaynor [Sat, 8 Apr 2017 00:58:50 +0000 (20:58 -0400)]
This is an int

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

7 years agoDon't use a for-loop decleration
Alex Gaynor [Sat, 8 Apr 2017 00:56:12 +0000 (20:56 -0400)]
Don't use a for-loop decleration

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

7 years agoFixed #3020 -- set entry type on SCTs from X.509 and OCSP extensions
Alex Gaynor [Sat, 8 Apr 2017 00:49:27 +0000 (20:49 -0400)]
Fixed #3020 -- set entry type on SCTs from X.509 and OCSP extensions

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

7 years agoIntegration build a small memory image
Pauli [Mon, 22 May 2017 11:56:42 +0000 (07:56 -0400)]
Integration build a small memory image

Modify one of the integration builds so that that the
OPENSSL_SMALL_MEMORY option is compiled. There doesn't appear to be an
automatic build with this option set.

I think the options in the modified build are covered elsewhere (without
the small memory) but a new job might still be preferable.

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

7 years agoFix the mem_sec "small arena"
Todd Short [Sun, 21 May 2017 14:21:06 +0000 (10:21 -0400)]
Fix the mem_sec "small arena"

Fix the small arena test to just check for the symptom of the infinite
loop (i.e. initialized set on failure), rather than the actual infinite
loop. This avoids some valgrind errors.

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

7 years agotest/secmemtest.c: clarify limitations for huge secure memory arena test.
Andy Polyakov [Sun, 21 May 2017 09:16:34 +0000 (11:16 +0200)]
test/secmemtest.c: clarify limitations for huge secure memory arena test.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoFix srp app missing NULL termination with password callback
Diego Santa Cruz [Tue, 16 May 2017 14:05:19 +0000 (16:05 +0200)]
Fix srp app missing NULL termination with password callback

The password_callback() function does not necessarily NULL terminate
the password buffer, the caller must use the returned length but the
srp app uses this function as if it was doing NULL termination.

This made the -passin and -passout options of "openssl srp"
fail inexpicably and randomly or even crash.

Fixed by enlarging the buffer by one, so that the maximum password length
remains unchanged, and adding NULL termination upon return.

[Rearrange code for coding style compliance in process.]

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

7 years ago-inkey can be an identifier, not just a file
Rich Salz [Sun, 21 May 2017 01:44:31 +0000 (21:44 -0400)]
-inkey can be an identifier, not just a file

update pkcs12, smime, ts apps.

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

7 years agotest/run_tests.pl: don't mask test failures.
Andy Polyakov [Sat, 20 May 2017 10:35:58 +0000 (12:35 +0200)]
test/run_tests.pl: don't mask test failures.

Switch to TAP::Harness inadvertently masked test failures.
Test::Harness::runtests was terminating with non-zero exit code in case
of failure[s], while TAP::Harness apparently holds caller responsible
for doing so.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agotest/test_test.c: fix wrong BN test [and rearrange tests a little bit].
Andy Polyakov [Fri, 19 May 2017 17:37:35 +0000 (19:37 +0200)]
test/test_test.c: fix wrong BN test [and rearrange tests a little bit].

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

7 years agoTweak sec_mem tests
Todd Short [Fri, 12 May 2017 20:46:39 +0000 (16:46 -0400)]
Tweak sec_mem tests

Remove assertion when mmap() fails.
Only run the 1<<31 limit test on Linux

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

7 years agomove comments to same line as fields
Dr. Stephen Henson [Fri, 19 May 2017 20:43:05 +0000 (21:43 +0100)]
move comments to same line as fields

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

7 years agoAdd test data for EVP_DigestSign/EVP_DigestVerify tests.
Dr. Stephen Henson [Sat, 13 May 2017 16:38:08 +0000 (17:38 +0100)]
Add test data for EVP_DigestSign/EVP_DigestVerify tests.

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

7 years agoAdd test support for "oneshot" versions EVP_DigestSign, EVP_DigestVerify.
Dr. Stephen Henson [Mon, 15 May 2017 20:27:43 +0000 (21:27 +0100)]
Add test support for "oneshot" versions EVP_DigestSign, EVP_DigestVerify.

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

7 years agoAdd tests in evp_test for EVP_Digest{Sign,Verify}{Init,Update,Final}
Dr. Stephen Henson [Fri, 12 May 2017 23:44:02 +0000 (00:44 +0100)]
Add tests in evp_test for EVP_Digest{Sign,Verify}{Init,Update,Final}

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

7 years agoMove engines/afalg to engines
Rich Salz [Sat, 20 May 2017 01:27:58 +0000 (21:27 -0400)]
Move engines/afalg to engines

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

7 years agoremove duplicate tests
Dr. Stephen Henson [Thu, 11 May 2017 23:31:18 +0000 (00:31 +0100)]
remove duplicate tests

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

7 years agoAdd tests
Dr. Stephen Henson [Fri, 12 May 2017 00:11:00 +0000 (01:11 +0100)]
Add tests

Import test data from sha1test.c, sha256t.c and sha512t.c which is
from RFC6234 section 8.5

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

7 years agoAdd support for multiple update calls in evp_test
Dr. Stephen Henson [Thu, 11 May 2017 18:28:09 +0000 (19:28 +0100)]
Add support for multiple update calls in evp_test

Allow multiple "Input" lines to call the update function multiple times.
Add "Ncopy" keyword to copy the input buffer. So for example:

Input = "a"
Ncopy = 1024

Will create a buffer consisting of 1024 "a" characters.

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

7 years agoFix return code in tls1_mac
Matt Caswell [Fri, 19 May 2017 09:28:43 +0000 (10:28 +0100)]
Fix return code in tls1_mac

The return code from tls1_mac is supposed to be a boolean 0 for fail, 1 for
success. In one place we returned -1 on error. This would cause code calling
the mac function to erroneously see this as a success (because a non-zero
value is being treated as success in all call sites).

Fortunately, AFAICT, the place that returns -1 can only happen on an
internal error so is not under attacker control. Additionally this code only
appears in master. In 1.1.0 the return codes are treated differently.
Therefore there are no security implications.

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

7 years agoReformat the output of BIGNUMS where test cases fail.
Pauli [Sun, 14 May 2017 22:49:36 +0000 (08:49 +1000)]
Reformat the output of BIGNUMS where test cases fail.

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

7 years agoFix endless loop on srp app when listing users
Diego Santa Cruz [Wed, 17 May 2017 08:17:59 +0000 (10:17 +0200)]
Fix endless loop on srp app when listing users

With the -list option the srp app loops on the main while() endlessly,
whether users were given on the command line or not. The loop should
be stopped when in list mode and there are no more users.

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

7 years agoFix ASN1_TIME_to_generalizedtime to take a const ASN1_TIME
Matt Caswell [Tue, 2 May 2017 10:08:33 +0000 (11:08 +0100)]
Fix ASN1_TIME_to_generalizedtime to take a const ASN1_TIME

Fixes #1526

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

7 years agoMake SSL_is_server() accept a const SSL
Matt Caswell [Tue, 2 May 2017 10:00:50 +0000 (11:00 +0100)]
Make SSL_is_server() accept a const SSL

Fixes #1526

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

7 years agoTry to be more consistent about the alerts we send
Matt Caswell [Tue, 16 May 2017 16:28:23 +0000 (17:28 +0100)]
Try to be more consistent about the alerts we send

We are quite inconsistent about which alerts get sent. Specifically, these
alerts should be used (normally) in the following circumstances:

SSL_AD_DECODE_ERROR = The peer sent a syntactically incorrect message
SSL_AD_ILLEGAL_PARAMETER = The peer sent a message which was syntactically
correct, but a parameter given is invalid for the context
SSL_AD_HANDSHAKE_FAILURE = The peer's messages were syntactically and
semantically correct, but the parameters provided were unacceptable to us
(e.g. because we do not support the requested parameters)
SSL_AD_INTERNAL_ERROR = We messed up (e.g. malloc failure)

The standards themselves aren't always consistent but I think the above
represents the best interpretation.

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

7 years agoFix EXT_RETURN usage for add_key_share()
Matt Caswell [Thu, 18 May 2017 09:05:02 +0000 (10:05 +0100)]
Fix EXT_RETURN usage for add_key_share()

add_key_share() is a helper function used during key_share extension
construction. It is expected to be a simple boolean success/fail return.
It shouldn't be using the new EXT_RETURN type but it was partially converted
anyway. This changes it back.

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

7 years agoFix typo in INSTALL file
Paul Yang [Mon, 15 May 2017 13:01:53 +0000 (21:01 +0800)]
Fix typo in INSTALL file

recocognised -> recognised

CLA: trivial

Signed-off-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3470)

7 years agoFix compile error/warning in packettest.c
Todd Short [Tue, 9 May 2017 14:19:10 +0000 (10:19 -0400)]
Fix compile error/warning in packettest.c

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

7 years agoAdd a test for a missing sig algs extension
Matt Caswell [Tue, 16 May 2017 11:05:57 +0000 (12:05 +0100)]
Add a test for a missing sig algs extension

Check that a missing sig algs extension succeeds if we are resuming.

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

7 years agoAllow a missing sig algs extension if resuming
Matt Caswell [Tue, 16 May 2017 11:04:00 +0000 (12:04 +0100)]
Allow a missing sig algs extension if resuming

The current TLSv1.3 spec says:

'If a server is authenticating via a certificate and the client has not
sent a "signature_algorithms" extension, then the server MUST abort the
handshake with a "missing_extension" alert (see Section 8.2).'

If we are resuming then we are not "authenticating via a certificate" but
we were still aborting with the missing_extension alert if sig algs was
missing.

This commit ensures that we only send the alert if we are not resuming.

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

7 years agoAdd a new unsolicited extension error code and add enum tag
Matt Caswell [Wed, 17 May 2017 09:31:46 +0000 (10:31 +0100)]
Add a new unsolicited extension error code and add enum tag

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

7 years agoAdd tests for unsolicited extensions
Matt Caswell [Tue, 9 May 2017 15:42:01 +0000 (16:42 +0100)]
Add tests for unsolicited extensions

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

7 years agoFail if we receive a response to an extension that we didn't request
Matt Caswell [Tue, 9 May 2017 12:44:25 +0000 (13:44 +0100)]
Fail if we receive a response to an extension that we didn't request

We already did this on an ad-hoc per extension basis (for some extensions).
This centralises it and makes sure we do it for all extensions.

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

7 years agoRemove notification settings from appveyor.yml
Richard Levitte [Wed, 17 May 2017 06:28:55 +0000 (08:28 +0200)]
Remove notification settings from appveyor.yml

Notifications can be (and should be) configured on account basis on
the CI web site.  This avoids getting emails to openssl-commits for
personal accounts that also build OpenSSL stuff.

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

7 years agoDon't allow fragmented alerts
Matt Caswell [Mon, 15 May 2017 10:24:24 +0000 (11:24 +0100)]
Don't allow fragmented alerts

An alert message is 2 bytes long. In theory it is permissible in SSLv3 -
TLSv1.2 to fragment such alerts across multiple records (some of which
could be empty). In practice it make no sense to send an empty alert
record, or to fragment one. TLSv1.3 prohibts this altogether and other
libraries (BoringSSL, NSS) do not support this at all. Supporting it adds
significant complexity to the record layer, and its removal is unlikely
to cause inter-operability issues.

The DTLS code for this never worked anyway and it is not supported at a
protocol level for DTLS. Similarly fragmented DTLS handshake records only
work at a protocol level where at least the handshake message header
exists within the record. DTLS code existed for trying to handle fragmented
handshake records smaller than this size. This code didn't work either so
has also been removed.

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

7 years agoUse BIO not FILE for test file
Rich Salz [Mon, 15 May 2017 18:49:37 +0000 (14:49 -0400)]
Use BIO not FILE for test file

Allow multiple file arguments.
Split bntests.txt into separate files.

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

7 years agoDocument the history of BIO_gets() on BIO_fd().
Tomas Mraz [Fri, 12 May 2017 08:26:13 +0000 (10:26 +0200)]
Document the history of BIO_gets() on BIO_fd().

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

7 years agoDocument that BIO_gets() preserves '\n'.
Tomas Mraz [Wed, 23 Nov 2016 08:33:55 +0000 (09:33 +0100)]
Document that BIO_gets() preserves '\n'.

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

7 years agoDo not eat trailing '\n' in BIO_gets for fd BIO.
Tomas Mraz [Tue, 15 Nov 2016 09:10:32 +0000 (10:10 +0100)]
Do not eat trailing '\n' in BIO_gets for fd BIO.

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

7 years agoINSTALL: Remind people to read more if they added configuration options
Richard Levitte [Mon, 15 May 2017 12:59:38 +0000 (14:59 +0200)]
INSTALL: Remind people to read more if they added configuration options

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

7 years agoINSTALL: clarify a bit more how Configure treats "unknown" options
Richard Levitte [Mon, 15 May 2017 12:16:17 +0000 (14:16 +0200)]
INSTALL: clarify a bit more how Configure treats "unknown" options

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

7 years agoUpdate one CI test to use randomised ordering.
Pauli [Mon, 8 May 2017 22:13:35 +0000 (08:13 +1000)]
Update one CI test to use randomised ordering.

[extended tests]

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

7 years agoRandomise the ordering of the C unit tests.
Pauli [Fri, 5 May 2017 03:29:40 +0000 (13:29 +1000)]
Randomise the ordering of the C unit tests.

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

7 years agoReview feedback; use single main, #ifdef ADD_TEST
Rich Salz [Sat, 6 May 2017 11:59:18 +0000 (07:59 -0400)]
Review feedback; use single main, #ifdef ADD_TEST

Suppose OPENSSL_USE_NODELETE (via Nick Reilly)

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

7 years agoConvert shlibloadtest to new framework
Rich Salz [Fri, 5 May 2017 21:39:13 +0000 (17:39 -0400)]
Convert shlibloadtest to new framework

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

7 years agoAdd "Title" directive to evp_test
Rich Salz [Fri, 12 May 2017 14:03:09 +0000 (10:03 -0400)]
Add "Title" directive to evp_test

Reviewed-by: Stephen Henson <steve@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3454)

7 years agoClean up SSL_OP_* a bit
Todd Short [Wed, 10 May 2017 15:44:55 +0000 (11:44 -0400)]
Clean up SSL_OP_* a bit

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

7 years agoUse scalar, not length; fixes test_evp
Rich Salz [Fri, 12 May 2017 00:42:32 +0000 (20:42 -0400)]
Use scalar, not length; fixes test_evp

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

7 years agoRemove filename argument to x86 asm_init.
David Benjamin [Wed, 10 May 2017 18:24:56 +0000 (14:24 -0400)]
Remove filename argument to x86 asm_init.

The assembler already knows the actual path to the generated file and,
in other perlasm architectures, is left to manage debug symbols itself.
Notably, in OpenSSL 1.1.x's new build system, which allows a separate
build directory, converting .pl to .s as the scripts currently do result
in the wrong paths.

This also avoids inconsistencies from some of the files using $0 and
some passing in the filename.

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

7 years agoRename evptests.txt to evppkey.txt
Rich Salz [Thu, 11 May 2017 16:43:49 +0000 (12:43 -0400)]
Rename evptests.txt to evppkey.txt

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

7 years agoSplit test/evptests.txt into separate files.
Rich Salz [Thu, 11 May 2017 16:17:38 +0000 (12:17 -0400)]
Split test/evptests.txt into separate files.

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

7 years agoFix infinite loops in secure memory allocation.
Todd Short [Thu, 11 May 2017 19:48:10 +0000 (15:48 -0400)]
Fix infinite loops in secure memory allocation.

Issue 1:

sh.bittable_size is a size_t but i is and int, which can result in
freelist == -1 if sh.bittable_size exceeds an int.

This seems to result in an OPENSSL_assert due to invalid allocation
size, so maybe that is "ok."

Worse, if sh.bittable_size is exactly 1<<31, then this becomes an
infinite loop (because 1<<31 is a negative int, so it can be shifted
right forever and sticks at -1).

Issue 2:

CRYPTO_secure_malloc_init() sets secure_mem_initialized=1 even when
sh_init() returns 0.

If sh_init() fails, we end up with secure_mem_initialized=1 but
sh.minsize=0. If you then call secure_malloc(), which then calls,
sh_malloc(), this then enters an infite loop since 0 << anything will
never be larger than size.

Issue 3:

That same sh_malloc loop will loop forever for a size greater
than size_t/2 because i will proceed (assuming sh.minsize=16):
i=16, 32, 64, ..., size_t/8, size_t/4, size_t/2, 0, 0, 0, 0, ....
This sequence will never be larger than "size".

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

7 years agoClean away needless VMS check
Richard Levitte [Thu, 11 May 2017 18:34:08 +0000 (20:34 +0200)]
Clean away needless VMS check

BIO_socket_ioctl is only implemented on VMS for VMS version 7.0 and
up, but since we only support version 7.1 and up, there's no need to
check the VMS version.

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

7 years agoCleanup - use e_os2.h rather than stdint.h
Richard Levitte [Thu, 11 May 2017 18:20:07 +0000 (20:20 +0200)]
Cleanup - use e_os2.h rather than stdint.h

Not exactly everywhere, but in those source files where stdint.h is
included conditionally, or where it will be eventually

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

7 years agotestutil: Fix non-standard subtest output
Richard Levitte [Thu, 11 May 2017 17:32:43 +0000 (19:32 +0200)]
testutil: Fix non-standard subtest output

In some cases, testutil outputs subtests like this:

    1..6 # Subtest: progname

The standard set by Test::More (because there really is no actual
standard yet) gives this display:

    # Subtest: progname
    1..6

Until the standard is actually agreed upon, let's do it like
Test::More.

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

7 years agoevp_test: use the test file name as the test title
Richard Levitte [Thu, 11 May 2017 17:13:49 +0000 (19:13 +0200)]
evp_test: use the test file name as the test title

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

7 years agotestutil: add the possibility to set the current test title
Richard Levitte [Thu, 11 May 2017 17:12:48 +0000 (19:12 +0200)]
testutil: add the possibility to set the current test title

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

7 years agoFix gcc-7 warnings.
Bernd Edlinger [Thu, 11 May 2017 14:21:37 +0000 (16:21 +0200)]
Fix gcc-7 warnings.
- Mostly missing fall thru comments
- And uninitialized value used in sslapitest.c

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

7 years agoUnclash clashing reason codes in ssl.h
Richard Levitte [Thu, 11 May 2017 15:29:47 +0000 (17:29 +0200)]
Unclash clashing reason codes in ssl.h

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

7 years agoUse compare_mem wrapper
Rich Salz [Mon, 8 May 2017 18:46:57 +0000 (14:46 -0400)]
Use compare_mem wrapper

Add file/line# to test error message.
Also remove expected/got fields since TEST structure prints them.

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

7 years agoAddress some feedback
Rich Salz [Mon, 1 May 2017 00:38:39 +0000 (20:38 -0400)]
Address some feedback

Report test detail error.

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

7 years agoConvert of evp_test to framework
Rich Salz [Wed, 26 Apr 2017 19:33:43 +0000 (15:33 -0400)]
Convert of evp_test to framework

Also, allow multiple files on commandline (for future splitup of
evptests.txt)

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

7 years agoFix regression in openssl req -x509 behaviour.
Tomas Mraz [Thu, 11 May 2017 12:25:17 +0000 (14:25 +0200)]
Fix regression in openssl req -x509 behaviour.

Allow conversion of existing requests to certificates again.
Fixes the issue #3396

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

7 years agoRemove dead code.
Pauli [Thu, 11 May 2017 00:45:38 +0000 (10:45 +1000)]
Remove dead code.

The second BN_is_zero test can never be true.

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

7 years agoAdd some extra comments following alert changes
Matt Caswell [Thu, 11 May 2017 11:45:16 +0000 (12:45 +0100)]
Add some extra comments following alert changes

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

7 years agoAdd some checks for trailing data after extension blocks
Matt Caswell [Thu, 11 May 2017 10:31:57 +0000 (11:31 +0100)]
Add some checks for trailing data after extension blocks

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

7 years agoSend a missing_extension alert if key_share/supported groups not present
Matt Caswell [Thu, 11 May 2017 09:55:54 +0000 (10:55 +0100)]
Send a missing_extension alert if key_share/supported groups not present

Only applies if we're not doing psk.

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

7 years agoTLSv1.3 alert and handshake messages can never be 0 length
Matt Caswell [Thu, 11 May 2017 09:34:25 +0000 (10:34 +0100)]
TLSv1.3 alert and handshake messages can never be 0 length

We abort if we read a message like this.

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

7 years agoTLSv1.3 alerts cannot be fragmented and only one per record
Matt Caswell [Thu, 11 May 2017 09:16:34 +0000 (10:16 +0100)]
TLSv1.3 alerts cannot be fragmented and only one per record

We should be validating that.

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

7 years agoCheck that a TLSv1.3 encrypted message has an app data content type
Matt Caswell [Thu, 11 May 2017 09:16:08 +0000 (10:16 +0100)]
Check that a TLSv1.3 encrypted message has an app data content type

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

7 years agoSend an illegal parameter alert if the update type in a KeyUpdate is wrong
Matt Caswell [Thu, 11 May 2017 09:14:17 +0000 (10:14 +0100)]
Send an illegal parameter alert if the update type in a KeyUpdate is wrong

Previously we sent a decode_error alert.

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