oweals/openssl.git
7 years agoAdd some badly formatted compression methods tests
Matt Caswell [Mon, 8 May 2017 13:48:35 +0000 (14:48 +0100)]
Add some badly formatted compression methods tests

Test that sending a non NULL compression method fails in TLSv1.3 as well
as other similar tests.

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

7 years agoVerify that only NULL compression is sent in TLSv1.3 ClientHello
Matt Caswell [Mon, 8 May 2017 13:47:33 +0000 (14:47 +0100)]
Verify that only NULL compression is sent in TLSv1.3 ClientHello

It is illegal in a TLSv1.3 ClientHello to send anything other than the
NULL compression method. We should send an alert if we find anything else
there. Previously we were ignoring this error.

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

7 years agoFix an s_server infinite loop
Matt Caswell [Wed, 26 Apr 2017 13:00:35 +0000 (14:00 +0100)]
Fix an s_server infinite loop

Commit c4666bfa changed s_server so that it asked libssl rather than the
underlying socket whether an error is retryable or not on the basis that
libssl has more information. That is true unfortunately the method used
was wrong - it only checks libssl's own internal state rather than both
libssl and the BIO. Should use SSL_get_error() instead.

This issue can cause an infinite loop because some errors could appear as
retryable when in fact they are not.

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

7 years agoAdd unit test for PEM_FLAG_ONLY_B64
Benjamin Kaduk [Wed, 12 Apr 2017 21:24:43 +0000 (16:24 -0500)]
Add unit test for PEM_FLAG_ONLY_B64

Get some trivial test coverage that this flag does what it claims to.

[extended tests]

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

7 years agoMake PEM_read_{,bio_}PrivateKey use secmem
Benjamin Kaduk [Fri, 19 Feb 2016 23:36:52 +0000 (17:36 -0600)]
Make PEM_read_{,bio_}PrivateKey use secmem

We now have a version of PEM_read_bytes that can use temporary
buffers allocated from the secure heap; use them to handle this
sensitive information.

Note that for PEM_read_PrivateKey, the i/o still goes through
stdio since the input is a FILE pointer.  Standard I/O performs
additional buffering, which cannot be changed to use the OpenSSL
secure heap for temporary storage.  As such, it is recommended
to use BIO_new_file() and PEM_read_bio_PrivateKey() instead.

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

7 years agoAdd PEM_bytes_read_bio_secmem()
Benjamin Kaduk [Mon, 29 Feb 2016 21:47:12 +0000 (15:47 -0600)]
Add PEM_bytes_read_bio_secmem()

Split the PEM_bytes_read_bio() implementation out into a
pem_bytes_read_bio_flags() helper, to allow it to pass PEM_FLAG_SECURE
as needed.  Adjust the cleanup to properly use OPENSSL_secure_free()
when needed, and reimplement PEM_bytes_read() as a wrapper around
the _flags helper.

Add documentation for PEM_bytes_read_bio() and the new secmem variant.

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

7 years agoAdd PEM_read_bio_ex
Benjamin Kaduk [Fri, 19 Feb 2016 03:24:27 +0000 (21:24 -0600)]
Add PEM_read_bio_ex

The extended function includes a 'flags' argument to allow callers
to specify different requested behaviors.  In particular, callers can
request that temporary storage buffers are allocated from the secure heap,
which could be relevant when loading private key material.

Refactor PEM_read_bio to use BIO_mems instead of BUFs directly,
use some helper routines to reduce the overall function length, and make
some of the checks more reasonable.

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

7 years agoAdded a new Makefile in demos/evp directory
Meena Vyas [Mon, 8 May 2017 13:23:01 +0000 (23:23 +1000)]
Added a new Makefile in demos/evp directory
Fixed compilation warning in file aesgcm.c

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

7 years agoUpdate the message callback documentation
Matt Caswell [Fri, 5 May 2017 10:56:45 +0000 (11:56 +0100)]
Update the message callback documentation

Update the message callback documentation to cover the new inner content
type capability. Also major update of the documentation which was very out
of date.

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

7 years agoAdd support to SSL_trace() for inner content types
Matt Caswell [Fri, 5 May 2017 10:55:55 +0000 (11:55 +0100)]
Add support to SSL_trace() for inner content types

When using the -trace option with TLSv1.3 all records appear as "application
data". This adds the ability to see the inner content type too.

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

7 years agoRemove support for OPENSSL_SSL_TRACE_CRYPTO
Matt Caswell [Mon, 8 May 2017 08:32:58 +0000 (09:32 +0100)]
Remove support for OPENSSL_SSL_TRACE_CRYPTO

This trace option does not appear in Configure as a separate option and is
undocumented. It can be switched on using "-DOPENSSL_SSL_TRACE_CRYPTO",
however this does not compile in master or in any 1.1.0 released version.

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

7 years agoUpdates to supported_groups following review feedback
Matt Caswell [Mon, 8 May 2017 09:54:38 +0000 (10:54 +0100)]
Updates to supported_groups following review feedback

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

7 years agoAdd a test for supported_groups in the EE message
Matt Caswell [Fri, 5 May 2017 09:30:07 +0000 (10:30 +0100)]
Add a test for supported_groups in the EE message

Check we send supported_groups in EE if there is a group we prefer instead
of the one sent in the key_share.

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

7 years agoSend the supported_groups extension in EE where applicable
Matt Caswell [Fri, 5 May 2017 09:27:14 +0000 (10:27 +0100)]
Send the supported_groups extension in EE where applicable

The TLSv1.3 spec says that a server SHOULD send supported_groups in the
EE message if there is a group that it prefers to the one used in the
key_share. Clients MAY act on that. At the moment we don't do anything
with it on the client side, but that may change in the future.

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

7 years agotest/recipes/95-test_*.t : correct skip_all syntax
Richard Levitte [Sat, 6 May 2017 08:29:16 +0000 (10:29 +0200)]
test/recipes/95-test_*.t : correct skip_all syntax

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

7 years agoRearrange test/recipes/95-test_*.t to use skip_all
Richard Levitte [Fri, 5 May 2017 21:08:55 +0000 (23:08 +0200)]
Rearrange test/recipes/95-test_*.t to use skip_all

The conditions to skip these recipes entirely don't show in a
non-verbose test harness output.  We prefer to know, so use skip_all,
as it is a little bit more verbose.

[extended tests]

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

7 years agoConversion of the EC tests to use the framework.
Pauli [Fri, 28 Apr 2017 04:06:11 +0000 (14:06 +1000)]
Conversion of the EC tests to use the framework.
Some refactoring done as well.

The prime_field_tests() function needs splitting and refactoring still.

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

7 years agosha/sha512.c: fix formatting.
Andy Polyakov [Tue, 2 May 2017 08:50:58 +0000 (10:50 +0200)]
sha/sha512.c: fix formatting.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoperlasm/x86_64-xlate.pl: work around problem with hex constants in masm.
Andy Polyakov [Thu, 4 May 2017 13:54:29 +0000 (15:54 +0200)]
perlasm/x86_64-xlate.pl: work around problem with hex constants in masm.

Perl, multiple versions, for some reason occasionally takes issue with
letter b[?] in ox([0-9a-f]+) regex. As result some constants, such as
0xb1 came out wrong when generating code for MASM. Fixes GH#3241.

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

7 years agoRemove some out of date text inadvertently left behind
Matt Caswell [Thu, 4 May 2017 15:15:17 +0000 (16:15 +0100)]
Remove some out of date text inadvertently left behind

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

7 years agoRemove outdated and unsupported CHIL engine
Rich Salz [Thu, 4 May 2017 19:45:57 +0000 (15:45 -0400)]
Remove outdated and unsupported CHIL engine

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

7 years agoFix pathname errors in errcode file
Rich Salz [Thu, 4 May 2017 16:45:15 +0000 (12:45 -0400)]
Fix pathname errors in errcode file

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

7 years agoFix tests of TEST tests, as it were
Rich Salz [Thu, 4 May 2017 16:03:57 +0000 (12:03 -0400)]
Fix tests of TEST tests, as it were

Fix warning/bug in rc5test
Remove useless/warning-only test from dsatest.

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

7 years agoTest framework output improvement.
Pauli [Tue, 2 May 2017 04:46:02 +0000 (14:46 +1000)]
Test framework output improvement.

Format the test failure output more nicely.

More vertical space is used to make things a little clearer.  Tests are expected
to pass so this doesn't impact the normal case.

Strings and memory comparisons highlight differences.

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

7 years agotest/exptest.c: stop marking progress with a period
Richard Levitte [Thu, 4 May 2017 03:26:07 +0000 (05:26 +0200)]
test/exptest.c: stop marking progress with a period

Because we now have TAP output for every mod_exp round, there's no
more need to mark the round with outputting a period.

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

7 years agoUpdates to serverinfo fix based on review feedback
Matt Caswell [Thu, 4 May 2017 14:17:53 +0000 (15:17 +0100)]
Updates to serverinfo fix based on review feedback

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

7 years agoAdd a test for loading serverinfo data from memory
Matt Caswell [Thu, 4 May 2017 10:28:08 +0000 (11:28 +0100)]
Add a test for loading serverinfo data from memory

The previous commit fixed a bug which occurs when serverinfo is loaded
from memory (not from a file). This adds a test for loading serverinfo
from memory.

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

7 years agoFix SSL_CTX_use_serverinfo_ex() et al to properly handle V1 data
Matt Caswell [Thu, 4 May 2017 09:21:39 +0000 (10:21 +0100)]
Fix SSL_CTX_use_serverinfo_ex() et al to properly handle V1 data

SSL_CTX_use_serverinfo_ex() et al were always processing data as if it was
V2 format, even if it was V1. This bug was masked because, although we had
a test which loaded V1 serverinfo data from a file, the function
SSL_CTX_use_serverinfo_file() transparently converts V1 data to V2 before
calling SSL_CTX_use_serverinfo_ex().

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

7 years agoRevert "Fix clang compile time error"
Matt Caswell [Thu, 4 May 2017 09:28:00 +0000 (10:28 +0100)]
Revert "Fix clang compile time error"

This reverts commit 1608d658af4163d2096cb469705d4ba96067877b.

This is the wrong fix for this issue. The next commit provides a better
fix.

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

7 years agoDon't leave stale errors on queue if DSO_dsobyaddr() fails
Matt Caswell [Thu, 4 May 2017 11:51:18 +0000 (12:51 +0100)]
Don't leave stale errors on queue if DSO_dsobyaddr() fails

The init code uses DSO_dsobyaddr() to leak a reference to ourselves to
ensure we remain loaded until atexit() time. In some circumstances that
can fail and leave stale errors on the error queue.

Fixes #3372

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

7 years agoFix an uninit read in igetest
Matt Caswell [Thu, 4 May 2017 13:47:59 +0000 (14:47 +0100)]
Fix an uninit read in igetest

Introduced by commit 0e534337b

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

7 years agoFix clang compile time error
Todd Short [Wed, 3 May 2017 14:26:17 +0000 (10:26 -0400)]
Fix clang compile time error

|version| "could" be used uninitialized here, not really, but the
compiler doesn't understand the flow

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

7 years agoFix curly braces on util/mkrc.pl
Rich Salz [Tue, 2 May 2017 19:54:03 +0000 (15:54 -0400)]
Fix curly braces on util/mkrc.pl

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

7 years agoRun perltidy, use strict+warnings on mkrc.pl
Rich Salz [Tue, 2 May 2017 19:38:37 +0000 (15:38 -0400)]
Run perltidy, use strict+warnings on mkrc.pl

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

7 years agoPerltidy ck_errf
Rich Salz [Tue, 2 May 2017 19:28:33 +0000 (15:28 -0400)]
Perltidy ck_errf

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

7 years agoRemove some unused scripts
Rich Salz [Tue, 2 May 2017 19:24:47 +0000 (15:24 -0400)]
Remove some unused scripts

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

7 years agoUpdate tls13secretstest test vectors for TLSv1.3 draft-20
Matt Caswell [Wed, 3 May 2017 13:09:05 +0000 (14:09 +0100)]
Update tls13secretstest test vectors for TLSv1.3 draft-20

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

7 years agoUpdate the TLSv1.3 version indicator for draft-20
Matt Caswell [Wed, 3 May 2017 11:16:05 +0000 (12:16 +0100)]
Update the TLSv1.3 version indicator for draft-20

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

7 years agoUpdate the HKDF labels for draft-20
Matt Caswell [Wed, 3 May 2017 11:11:41 +0000 (12:11 +0100)]
Update the HKDF labels for draft-20

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

7 years agoLimit padded record to max plaintext
Todd Short [Wed, 3 May 2017 15:24:21 +0000 (11:24 -0400)]
Limit padded record to max plaintext

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

7 years agoUpdate the documentation for "Groups" and "Curves"
Matt Caswell [Wed, 3 May 2017 15:39:57 +0000 (16:39 +0100)]
Update the documentation for "Groups" and "Curves"

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

7 years agoAdd the -groups option to s_server/s_client
Matt Caswell [Wed, 3 May 2017 15:39:32 +0000 (16:39 +0100)]
Add the -groups option to s_server/s_client

This should have been added before but was missed.

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

7 years agoUpdate serverinfo documentation based on feedback received
Matt Caswell [Wed, 3 May 2017 13:41:43 +0000 (14:41 +0100)]
Update serverinfo documentation based on feedback received

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

7 years agoClarify serverinfo usage with Certificate messages
Matt Caswell [Tue, 25 Apr 2017 11:42:17 +0000 (12:42 +0100)]
Clarify serverinfo usage with Certificate messages

Ensure that serverinfo only gets added for the first Certificate in a list.

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

7 years agoDocument the new SSL_CTX_use_serverinfo_ex() function
Matt Caswell [Tue, 18 Apr 2017 16:53:54 +0000 (17:53 +0100)]
Document the new SSL_CTX_use_serverinfo_ex() function

Also document other releated changes to the serverinfo capability.

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

7 years agoAdd an SSL_ prefix to SERVERINFOV2 and SERVERINFOV1
Matt Caswell [Tue, 18 Apr 2017 16:53:29 +0000 (17:53 +0100)]
Add an SSL_ prefix to SERVERINFOV2 and SERVERINFOV1

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

7 years agoAdd a test for CT in TLSv1.3
Matt Caswell [Thu, 13 Apr 2017 15:55:45 +0000 (16:55 +0100)]
Add a test for CT in TLSv1.3

This also tests the SERVERINFO2 file format.

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

7 years agoAdd a SERVERINFOV2 format test file
Matt Caswell [Mon, 10 Apr 2017 15:19:16 +0000 (16:19 +0100)]
Add a SERVERINFOV2 format test file

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

7 years agoOnly send custom extensions where we have received one in the ClientHello
Matt Caswell [Mon, 10 Apr 2017 15:18:26 +0000 (16:18 +0100)]
Only send custom extensions where we have received one in the ClientHello

We already did this for ServerHello and EncryptedExtensions. We should be
doing it for Certificate and HelloRetryRequest as well.

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

7 years agoExtend the SERVERINFO file format to include an extensions context
Matt Caswell [Mon, 10 Apr 2017 15:13:20 +0000 (16:13 +0100)]
Extend the SERVERINFO file format to include an extensions context

This enables us to know what messages the extensions are relevant for in
TLSv1.3. The new file format is not compatible with the previous one so
we call it SERVERINFOV2.

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

7 years agoAdded support for ESSCertIDv2
Marek Klein [Tue, 1 Mar 2016 16:32:10 +0000 (16:32 +0000)]
Added support for ESSCertIDv2

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

7 years agoUpdate igetest to use the test framework.
Pauli [Thu, 20 Apr 2017 04:23:10 +0000 (14:23 +1000)]
Update igetest to use the test framework.

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

7 years agoConvert uses of snprintf to BIO_snprintf
Rich Salz [Tue, 2 May 2017 16:22:26 +0000 (12:22 -0400)]
Convert uses of snprintf to BIO_snprintf

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

7 years agoFix some error path logic in i2v_AUTHORITY_INFO_ACCESS and i2v_GENERAL_NAME
Matt Caswell [Tue, 2 May 2017 12:47:31 +0000 (13:47 +0100)]
Fix some error path logic in i2v_AUTHORITY_INFO_ACCESS and i2v_GENERAL_NAME

Fixes #1653 reported by Guido Vranken

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

7 years agoFix comment around safari fingerprint check
Matt Caswell [Tue, 2 May 2017 15:26:00 +0000 (16:26 +0100)]
Fix comment around safari fingerprint check

Fixes #2442

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

7 years agoFix URL links in comment
Rich Salz [Tue, 2 May 2017 14:53:10 +0000 (10:53 -0400)]
Fix URL links in comment

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

7 years agoAdd some man page cross-references
Rich Salz [Tue, 2 May 2017 13:08:08 +0000 (09:08 -0400)]
Add some man page cross-references

The old/deprecated servername callback should refer back to the
new/preferred early callback mechanism, as well as indicate that
it is superseded by the early callback.

The early callback should also mention the API for turning the
raw cipherlist octets from the client into usable data structures.

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

7 years agoConvert danetest, ssl_test_ctx_test
Rich Salz [Tue, 2 May 2017 12:32:26 +0000 (08:32 -0400)]
Convert danetest, ssl_test_ctx_test

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

7 years agoTLS1.3 Padding
Todd Short [Wed, 5 Apr 2017 16:35:25 +0000 (12:35 -0400)]
TLS1.3 Padding

Add padding callback for application control
Standard block_size callback
Documentation and tests included
Configuration file/s_client/s_srver option

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

7 years agoFix time offset calculation.
Todd Short [Thu, 16 Feb 2017 21:08:02 +0000 (16:08 -0500)]
Fix time offset calculation.

ASN1_GENERALIZEDTIME and ASN1_UTCTIME may be specified using offsets,
even though that's not supported within certificates.

To convert the offset time back to GMT, the offsets are supposed to be
subtracted, not added. e.g. 1759-0500 == 2359+0100 == 2259Z.

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

7 years agoFix a stack smash
Rich Salz [Mon, 1 May 2017 18:38:49 +0000 (14:38 -0400)]
Fix a stack smash

It occurs when memory compares are made that are larger
than the on stack temporary buffers (either malloced or supplied).

Rework the test test so it doesn't use a macro with a branch.

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

7 years agoRemove duplicates from clang_devteam_warnings
Benjamin Kaduk [Mon, 1 May 2017 17:39:20 +0000 (12:39 -0500)]
Remove duplicates from clang_devteam_warnings

Since the clang_devteam_warnings are appended to the gcc_devteam_warnings
when strict-warnings are requested, any items present in both the gcc
and clang variables will be duplicated in the cflags used for clang builds.
Remove the extra copy from the clang-specific flags in favor of the
gcc_devteam_warnings that are used for all strict-warnings builds.

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

7 years agoAddress some -Wold-style-declaration warnings
Benjamin Kaduk [Fri, 14 Apr 2017 16:53:04 +0000 (11:53 -0500)]
Address some -Wold-style-declaration warnings

gcc's -Wextra pulls in -Wold-style-declaration, which triggers when a
declaration has a storage-class specifier as a non-initial qualifier.
The ISO C formal grammar requires the storage-class to be the first
component of the declaration, if present.

Seeint as the register storage-class specifier does not really have any effect
anymore with modern compilers, remove it entirely while we're here, instead of
fixing up the order.

Interestingly, the gcc devteam warnings do not pull in -Wextra, though
the clang ones do.

[extended tests]

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

7 years agoAdd -Wextra to gcc devteam warnings
Benjamin Kaduk [Tue, 18 Apr 2017 15:48:11 +0000 (10:48 -0500)]
Add -Wextra to gcc devteam warnings

clang already has it; let's flip the switch and deal with the fallout.
Exclude -Wunused-parameter, as we have many places where we keep unused
parameters to conform to a uniform vtable-like interface.
Also exclude -Wmissing-field-initializers; it's okay to rely on
the standard-mandated behavior of filling out with 0/NULL.

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

7 years agotest/asn1_encode_test.c: test "next negative minimum" corner case.
Andy Polyakov [Fri, 28 Apr 2017 19:14:36 +0000 (21:14 +0200)]
test/asn1_encode_test.c: test "next negative minimum" corner case.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoasn1/a_int.c: fix "next negative minimum" corner case in c2i_ibuf.
Andy Polyakov [Fri, 28 Apr 2017 08:06:35 +0000 (10:06 +0200)]
asn1/a_int.c: fix "next negative minimum" corner case in c2i_ibuf.

"Next" refers to negative minimum "next" to one presentable by given
number of bytes. For example, -128 is negative minimum presentable by
one byte, and -256 is "next" one.

Thanks to Kazuki Yamaguchi for report, GH#3339

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoCheck fflush on BIO_ctrl call
Rich Salz [Fri, 28 Apr 2017 18:14:59 +0000 (14:14 -0400)]
Check fflush on BIO_ctrl call

Bug found and fix suggested by Julian RĂ¼th.
Push error if fflush fails

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

7 years agoUpdate the pyca-cryptography submodule to version 1.8.1
Richard Levitte [Fri, 28 Apr 2017 15:52:45 +0000 (17:52 +0200)]
Update the pyca-cryptography submodule to version 1.8.1

It was released a couple of days after our latest update

[extended tests]

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

7 years agoEnsure blank lines between tests.
Rich Salz [Fri, 28 Apr 2017 14:00:09 +0000 (10:00 -0400)]
Ensure blank lines between tests.

Also add a comment describing the file format.

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

7 years agoRefactor crltest.c to separate the test cases into individual functions.
Pauli [Thu, 27 Apr 2017 04:08:31 +0000 (14:08 +1000)]
Refactor crltest.c to separate the test cases into individual functions.

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

7 years agotestutil: Remove test_puts_std{out,err}, they are superfluous
Richard Levitte [Fri, 28 Apr 2017 13:40:55 +0000 (15:40 +0200)]
testutil: Remove test_puts_std{out,err}, they are superfluous

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

7 years agotestutil: Add OpenSSL error stack printing wrapper TEST_openssl_errors
Richard Levitte [Fri, 28 Apr 2017 12:48:13 +0000 (14:48 +0200)]
testutil: Add OpenSSL error stack printing wrapper TEST_openssl_errors

Also added a internal error printing callback to be used both with
ERR_print_errors_cb() and with CRYPTO_mem_leaks_cb

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

7 years agotestutil: Add commodity printing functions test_printf_std{out,err}
Richard Levitte [Fri, 28 Apr 2017 12:46:18 +0000 (14:46 +0200)]
testutil: Add commodity printing functions test_printf_std{out,err}

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

7 years agotestutil: make subtest_level() internal
Richard Levitte [Fri, 28 Apr 2017 12:42:46 +0000 (14:42 +0200)]
testutil: make subtest_level() internal

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

7 years agotestutil: Move printing function declarations to "internal" header
Richard Levitte [Fri, 28 Apr 2017 12:37:19 +0000 (14:37 +0200)]
testutil: Move printing function declarations to "internal" header

These functions aren't meant to be used directly by the test programs,
reflect that by making the declarations a little harder to reach, but
still available enough if there's a need to override them.

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

7 years agoAdd checks on return code when applying some settings.
FdaSilvaYY [Fri, 7 Apr 2017 17:15:38 +0000 (19:15 +0200)]
Add checks on return code when applying some settings.
Remove hardcoded bound checkings.

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

7 years agoOutput prog name within error message
FdaSilvaYY [Fri, 7 Apr 2017 07:02:06 +0000 (09:02 +0200)]
Output prog name within error message

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

7 years agoAdd a 'max_send_frag' option to configure maximum size of send fragments
FdaSilvaYY [Thu, 6 Apr 2017 21:47:18 +0000 (23:47 +0200)]
Add a 'max_send_frag' option to configure maximum size of send fragments

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

7 years agoFix s_client when no-dtls
Todd Short [Wed, 26 Apr 2017 18:42:14 +0000 (14:42 -0400)]
Fix s_client when no-dtls

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

7 years agoFix a pedantic gcc-7 warning.
Bernd Edlinger [Wed, 26 Apr 2017 23:00:08 +0000 (01:00 +0200)]
Fix a pedantic gcc-7 warning.

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

7 years agoTLSProxy: When in debug mode, show the exact subprocess commands
Richard Levitte [Fri, 28 Apr 2017 07:20:05 +0000 (09:20 +0200)]
TLSProxy: When in debug mode, show the exact subprocess commands

When you want to debug a test that goes wrong, it's useful to know
exactly what subprocess commands are run.

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

7 years agoRemove (broken) diagnostic print
Rich Salz [Thu, 27 Apr 2017 15:38:17 +0000 (11:38 -0400)]
Remove (broken) diagnostic print

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

7 years agofuzz/{client,server}.c: omit _time64 "overload method".
Andy Polyakov [Wed, 26 Apr 2017 13:52:57 +0000 (15:52 +0200)]
fuzz/{client,server}.c: omit _time64 "overload method".

Approach was opportunistic in Windows context from its inception
and on top of that it was proven to be error-prone at link stage.
Correct answer is to introduce library-specific time function that
we can control in platform-neutral manner.  Meanwhile we just let
be attempts to override time on Windows.

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

7 years agoEnsure s_client sends an SNI extension by default
Matt Caswell [Mon, 13 Feb 2017 13:26:37 +0000 (13:26 +0000)]
Ensure s_client sends an SNI extension by default

Enforcement of an SNI extension in the initial ClientHello is becoming
increasingly common (e.g. see GitHub issue #2580). This commit changes
s_client so that it adds SNI be default, unless explicitly told not to via
the new "-noservername" option.

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

7 years agoAdd parentheses on public macros where appropriate.
Bernd Edlinger [Fri, 31 Mar 2017 21:00:35 +0000 (23:00 +0200)]
Add parentheses on public macros where appropriate.
Fixes #3063.

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

7 years agoRemove unnecessary loop in pkey_rsa_decrypt.
Bernd Edlinger [Wed, 26 Apr 2017 07:59:18 +0000 (09:59 +0200)]
Remove unnecessary loop in pkey_rsa_decrypt.

It is not necessary to remove leading zeros here because
RSA_padding_check_PKCS1_OAEP_mgf1 appends them again. As this was not done
in constant time, this might have leaked timing information.

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

7 years agoFix ISO C function/object pointer issue
Rich Salz [Wed, 26 Apr 2017 20:43:54 +0000 (16:43 -0400)]
Fix ISO C function/object pointer issue

Showed up on GCC with strict warnings.

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

7 years agoConvert sslapitest to test framework
Rich Salz [Wed, 26 Apr 2017 17:24:37 +0000 (13:24 -0400)]
Convert sslapitest to test framework

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

7 years agoConvert bntest to TEST_ framework
Rich Salz [Wed, 26 Apr 2017 16:39:46 +0000 (12:39 -0400)]
Convert bntest to TEST_ framework

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

7 years agoReturn success in custom_ext_parse_old_cb_wrap if parse_cb is NULL
Graham Edgecombe [Tue, 25 Apr 2017 18:36:10 +0000 (19:36 +0100)]
Return success in custom_ext_parse_old_cb_wrap if parse_cb is NULL

This fixes a segfault if a NULL parse_cb is passed to
SSL_CTX_add_{client,server}_custom_ext, which was supported in the
pre-1.1.1 implementation.

This behaviour is consistent with the other custom_ext_*_old_cb_wrap
functions, and with the new SSL_CTX_add_custom_ext function.

CLA: trivial

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

7 years agoConvert dtls_mtu_test, dtlsv1listentest
Rich Salz [Wed, 26 Apr 2017 16:20:44 +0000 (12:20 -0400)]
Convert dtls_mtu_test, dtlsv1listentest

Also converted most of ssltestlib but left the packet_dump output
as-is (for now).

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

7 years agoFix no-ec
Dr. Stephen Henson [Wed, 26 Apr 2017 16:08:22 +0000 (17:08 +0100)]
Fix no-ec

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

7 years agoDon't treat PACKET_remaining() as boolean
Tatsuhiro Tsujikawa [Fri, 21 Apr 2017 13:10:32 +0000 (22:10 +0900)]
Don't treat PACKET_remaining() as boolean

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

7 years agoBreak before && operator
Tatsuhiro Tsujikawa [Wed, 19 Apr 2017 12:12:34 +0000 (21:12 +0900)]
Break before && operator

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

7 years agoCall init and finalization functions per extension message
Tatsuhiro Tsujikawa [Tue, 18 Apr 2017 14:59:39 +0000 (23:59 +0900)]
Call init and finalization functions per extension message

Previously, init and finalization function for extensions are called
per extension block, rather than per message.  This commit changes
that behaviour, and now they are called per message.  The parse
function is still called per extension block.

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

7 years agoClarify that SSL_CTX_remove_session() marks a session as non-resumable
Matt Caswell [Wed, 26 Apr 2017 14:16:18 +0000 (15:16 +0100)]
Clarify that SSL_CTX_remove_session() marks a session as non-resumable

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

7 years agoMore SSL_SESSION documentation tweaks based on feedback
Matt Caswell [Wed, 26 Apr 2017 14:14:03 +0000 (15:14 +0100)]
More SSL_SESSION documentation tweaks based on feedback

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

7 years agoTweak SSL_get_session.pod wording
Matt Caswell [Thu, 23 Mar 2017 11:56:46 +0000 (11:56 +0000)]
Tweak SSL_get_session.pod wording

Based on feedback received.

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

7 years agoAlways duplicate the session on NewSessionTicket in TLSv1.3
Matt Caswell [Thu, 23 Mar 2017 11:22:26 +0000 (11:22 +0000)]
Always duplicate the session on NewSessionTicket in TLSv1.3

Because NST messages arrive post-handshake, the session may have already
gone into the cache. Once in the cache a session must be immutable -
otherwise you could get multi-thread issues.

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

7 years agoDocumentation updates for TLSv1.3 sessions
Matt Caswell [Tue, 21 Mar 2017 13:51:03 +0000 (13:51 +0000)]
Documentation updates for TLSv1.3 sessions

Add documentation for SSL_SESSION_is_resumable(). Also describe the interaction
of the various session functions and TLSv1.3 post-handshake sessions.

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