openssl.git
6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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>
6 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>
6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 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)

6 years agoAdd support for SSL_SESSION_is_resumable()
Matt Caswell [Tue, 21 Mar 2017 13:50:31 +0000 (13:50 +0000)]
Add support for SSL_SESSION_is_resumable()

Provide a way to test whether the SSL_SESSION object can be used to resume a
sesion or not.

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

6 years agoRemove TLS1.3 TODO around testing for session id length
Matt Caswell [Tue, 21 Mar 2017 13:48:52 +0000 (13:48 +0000)]
Remove TLS1.3 TODO around testing for session id length

TLSv1.3 will do the same thing as TLSv1.2 with tickets with regards to session
ids, i.e. it will create a synthetic session id when the session is established,
so it is reasonable to check the session id length, even in TLSv1.3.

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

6 years agoFix unit-tests when no-srp configured
Rich Salz [Wed, 26 Apr 2017 15:21:29 +0000 (11:21 -0400)]
Fix unit-tests when no-srp configured

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

6 years agoConvert modular exponentiation tests to new framework
Rich Salz [Wed, 26 Apr 2017 13:11:50 +0000 (09:11 -0400)]
Convert modular exponentiation tests to new framework

Updated due to test framework changes
Updates after code review
Missed some checks

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

6 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: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3316)

6 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: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3316)

6 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: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3316)

6 years agoDon't overwrite the alert value if there is no alert to send
Matt Caswell [Wed, 26 Apr 2017 08:08:00 +0000 (09:08 +0100)]
Don't overwrite the alert value if there is no alert to send

The function tls_early_post_process_client_hello() was overwriting the
passed "al" parameter even if it was successful. The caller of that
function, tls_post_process_client_hello(), sets "al" to a sensible default
(HANDSHAKE_FAILURE), but this was being overwritten to be INTERNAL_ERROR.
The result is a "no shared cipher" error (and probably other similar errors)
were being reported back to the client with an incorrect INTERNAL_ERROR
alert.

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

6 years agoevp_test.c: Add PrivPubKeyPair tests
Rich Salz [Wed, 26 Apr 2017 00:50:59 +0000 (20:50 -0400)]
evp_test.c: Add PrivPubKeyPair tests

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

6 years agotest: don't make it more complicated than necessary.
Andy Polyakov [Mon, 24 Apr 2017 22:21:28 +0000 (00:21 +0200)]
test: don't make it more complicated than necessary.

Original rationale behind using write in testutil was to accommodate
no-stdio builds. But is there evidence that no-stdio users would have
write or pre-defined meaning for file descriptors 1 and 2? Correct
answer is to provide way for no-stdio users who want to exercise
tests to plug in own BIO, not to make assumption that they have write.
And since we don't have to make such assumption, we can as well go
for simplest that works with standard library as specified by C
language standard.

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agomake update
Dr. Stephen Henson [Tue, 25 Apr 2017 19:16:29 +0000 (20:16 +0100)]
make update

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

6 years agoUpdate documentation
Dr. Stephen Henson [Tue, 25 Apr 2017 16:28:08 +0000 (17:28 +0100)]
Update documentation

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

6 years agoAdd PSS certificate signature tests
Dr. Stephen Henson [Mon, 24 Apr 2017 23:10:33 +0000 (00:10 +0100)]
Add PSS certificate signature tests

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

6 years agoAdd certificates with PSS signatures
Dr. Stephen Henson [Mon, 24 Apr 2017 21:17:45 +0000 (22:17 +0100)]
Add certificates with PSS signatures

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

6 years agoAdd custom sig_info setting for RSA-PSS
Dr. Stephen Henson [Mon, 24 Apr 2017 23:09:55 +0000 (00:09 +0100)]
Add custom sig_info setting for RSA-PSS

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

6 years agoUse X509_get_signature_info() when checking security levels.
Dr. Stephen Henson [Mon, 24 Apr 2017 18:16:16 +0000 (19:16 +0100)]
Use X509_get_signature_info() when checking security levels.

Make signature security level checking more flexible by using
X509_get_signaure_info(): some signature methods (e.g. PSS, ED25519)
do not indicate the signing digest (if any) in the signature OID.

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

6 years agoAdd support for custom signature parameters
Dr. Stephen Henson [Fri, 21 Apr 2017 14:56:34 +0000 (15:56 +0100)]
Add support for custom signature parameters

Many signature types define the digest and public key type by a single OID
such as ecdsa_with_sha256.

Some types (RSA-PSS for example) use a single OID to indicate the signature
scheme and additional parameters are encoded in the AlgorithmIdentifier.

Add an X509_SIG_INFO structure to contain details about the signature type:
specifically the digest algorithm, public key algorithm, security bits and
various flags. This supports both existing algorithms and more complex
types.

Add accessors for the structure and a special case that retrieves signature
information from a certificate.

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

6 years agoTapify libtestutil a bit better
Richard Levitte [Tue, 25 Apr 2017 19:13:26 +0000 (21:13 +0200)]
Tapify libtestutil a bit better

This includes better signals of skips and subtests according to TAP 12,
and flushing stdout and stderr at the end of every test function to
make sure we get the output in good order.

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

6 years agoAdd include path '..' for libtestutil
Richard Levitte [Tue, 25 Apr 2017 12:55:50 +0000 (14:55 +0200)]
Add include path '..' for libtestutil

Since it uses some of the apps/ stuff and some of them include e_os.h...

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

6 years agoSwitch command-line utils to new nameopt API.
Dmitry Belyavskiy [Tue, 25 Apr 2017 16:25:42 +0000 (12:25 -0400)]
Switch command-line utils to new nameopt API.

The CA names should be printed according to user's decision
print_name instead of set of BIO_printf
dump_cert_text instead of set of BIO_printf
Testing cyrillic output of X509_CRL_print_ex
Write and use X509_CRL_print_ex
Reduce usage of X509_NAME_online
Using X509_REQ_print_ex instead of X509_REQ_print
Fix nameopt processing.
Make dump_cert_text nameopt-friendly
Move nameopt getter/setter to apps/apps.c

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

6 years agoIgnore all .a files, not just the top ones
Richard Levitte [Tue, 25 Apr 2017 16:29:04 +0000 (18:29 +0200)]
Ignore all .a files, not just the top ones

Reviewed-by: Rich Salz <rsalz@openssl.org>
6 years agoAdd documentation for the -sctp option in command line apps
Matt Caswell [Tue, 25 Apr 2017 13:37:25 +0000 (14:37 +0100)]
Add documentation for the -sctp option in command line apps

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

6 years agoCorrect some badly formated preprocessor lines
Richard Levitte [Tue, 25 Apr 2017 13:35:41 +0000 (15:35 +0200)]
Correct some badly formated preprocessor lines

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

6 years agoAdd guards around one of use of IPPROTO_SCTP where it was missing
Richard Levitte [Tue, 25 Apr 2017 13:35:09 +0000 (15:35 +0200)]
Add guards around one of use of IPPROTO_SCTP where it was missing

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

6 years agoTAPify testutil
Richard Levitte [Wed, 19 Apr 2017 08:34:54 +0000 (10:34 +0200)]
TAPify testutil

With the perl test framework comes the output format TAP
(Test Anything Protocol, see http://testanything.org/) with
extra extension for subtests.  This change extends that same
output format to any test program using testutil.

In this implementation, each test program is seen as a full test that
can be used as a subtest.  The perl framework passes on the subtest
level to the test programs with the environment variable
HARNESS_OSSL_LEVEL.  Furthermore, and series of tests added with
ADD_ALL_TESTS is regarded as another subtest level.

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

6 years agoopenssl enc: Don't unbuffer stdin
Bernard Spil [Mon, 24 Apr 2017 16:43:49 +0000 (18:43 +0200)]
openssl enc: Don't unbuffer stdin

 - unbuffer causes single-byte reads from stdin and poor performance

Fixes #3281
CLA: trivial

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

6 years agoFix doc-nits issue
Matt Caswell [Mon, 24 Apr 2017 14:36:02 +0000 (15:36 +0100)]
Fix doc-nits issue

BIO_lookup_ex() should be in the NAME section

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

6 years agoAddress review feedback for the SCTP changes
Matt Caswell [Mon, 24 Apr 2017 13:15:49 +0000 (14:15 +0100)]
Address review feedback for the SCTP changes

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

6 years agoFix issue in 18-dtls-renegotiate.conf.in
Matt Caswell [Mon, 24 Apr 2017 12:58:07 +0000 (13:58 +0100)]
Fix issue in 18-dtls-renegotiate.conf.in

Don't skip all tests if SCTP is disabled!

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

6 years agoDocument BIO_lookup_ex()
Matt Caswell [Mon, 24 Apr 2017 10:46:09 +0000 (11:46 +0100)]
Document BIO_lookup_ex()

We also change the enum type to an int.

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

6 years agoFix some variable references in init_client
Matt Caswell [Mon, 24 Apr 2017 10:45:42 +0000 (11:45 +0100)]
Fix some variable references in init_client

We were incorrectly using "res" when we meant "ai"

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

6 years agoAdd SCTP testing for 04-client_auth.conf
Matt Caswell [Mon, 24 Apr 2017 10:19:05 +0000 (11:19 +0100)]
Add SCTP testing for 04-client_auth.conf

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

6 years agoAdd SCTP testing for 11-dtls_resumption.conf
Matt Caswell [Mon, 24 Apr 2017 10:03:11 +0000 (11:03 +0100)]
Add SCTP testing for 11-dtls_resumption.conf

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

6 years agoAdd SCTP testing to 07-dtls-protocol-version.conf
Matt Caswell [Mon, 24 Apr 2017 09:16:21 +0000 (10:16 +0100)]
Add SCTP testing to 07-dtls-protocol-version.conf

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

6 years agoAdd SCTP testing to 18-dtls-renegotiate.conf
Matt Caswell [Mon, 24 Apr 2017 08:43:17 +0000 (09:43 +0100)]
Add SCTP testing to 18-dtls-renegotiate.conf

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

6 years agoAdd SCTP testing to 16-dtls-certstatus.conf
Matt Caswell [Mon, 24 Apr 2017 08:42:53 +0000 (09:42 +0100)]
Add SCTP testing to 16-dtls-certstatus.conf

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

6 years agoAdd support to test_ssl_new for testing with DTLS over SCTP
Matt Caswell [Mon, 24 Apr 2017 08:42:28 +0000 (09:42 +0100)]
Add support to test_ssl_new for testing with DTLS over SCTP

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

6 years agoFix problem with SCTP close_notify alerts
Matt Caswell [Fri, 21 Apr 2017 15:56:06 +0000 (16:56 +0100)]
Fix problem with SCTP close_notify alerts

In SCTP the code was only allowing a send of a close_notify alert if the
socket is dry. If the socket isn't dry then it was attempting to save away
the close_notify alert to resend later when it is dry and then it returned
success. However because the application then thinks that the close_notify
alert has been successfully sent it never re-enters the DTLS code to
actually resend the alert. A much simpler solution is to just fail with a
retryable error in the event that the socket isn't dry. That way the
application knows to retry sending the close_notify alert.

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