openssl.git
7 years agoUpdate rc5test to use the test infrastructure
Pauli [Fri, 7 Apr 2017 03:27:35 +0000 (13:27 +1000)]
Update rc5test to use the test infrastructure

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

7 years agoUpdate mdc2test to use the test infrastructure
Pauli [Fri, 7 Apr 2017 03:49:26 +0000 (13:49 +1000)]
Update mdc2test to use the test infrastructure

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

7 years ago Update sha1test to use the test infrastructure
Pauli [Sun, 9 Apr 2017 22:20:10 +0000 (08:20 +1000)]
 Update sha1test to use the test infrastructure

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

7 years ago Update sha256t and sha512t to use the test infrastructure
Pauli [Sun, 9 Apr 2017 23:14:49 +0000 (09:14 +1000)]
 Update sha256t and sha512t to use the test infrastructure

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

7 years agoConvert exdata tests to new test framework
Jon Spillett [Wed, 12 Apr 2017 01:40:48 +0000 (11:40 +1000)]
Convert exdata tests to new test framework

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

7 years agoAdded error checking for OBJ_create
Frank Morgner [Mon, 10 Apr 2017 12:15:09 +0000 (14:15 +0200)]
Added error checking for OBJ_create

fixes segmentation fault in case of not enough memory for object creation

CLA: trivial

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

7 years agoConvert clienthellotest for the new test framework
Matt Caswell [Tue, 11 Apr 2017 16:36:01 +0000 (17:36 +0100)]
Convert clienthellotest for the new test framework

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

7 years agoConvert asynciotest for the new test framework
Matt Caswell [Tue, 11 Apr 2017 14:23:07 +0000 (15:23 +0100)]
Convert asynciotest for the new test framework

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

7 years agoConvert bad_dtls_test for the new test framework
Matt Caswell [Tue, 11 Apr 2017 15:26:13 +0000 (16:26 +0100)]
Convert bad_dtls_test for the new test framework

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

7 years agoFix x_int64.c
Richard Levitte [Mon, 10 Apr 2017 20:01:05 +0000 (22:01 +0200)]
Fix x_int64.c

Clearing a misunderstanding.  The routines c2i_uint64_int() and
i2c_uint64_int() expect to receive that internal values are absolute
and with a separate sign flag, and the x_int64.c code handles values
that aren't absolute and have the sign bit embedded.  We therefore
need to convert between absolute and non-absolute values for the
encoding of negative values to be correct.

[extended tests]

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

7 years agoFix int64 test of t_4bytes_4_neg
Richard Levitte [Mon, 10 Apr 2017 19:50:25 +0000 (21:50 +0200)]
Fix int64 test of t_4bytes_4_neg

{ 0x80, 0x00, 0x00, 0x00 } decoded isn't (positive) 0x80000000,
it's (negative) INT32_MIN.

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

7 years agoRemove ECDH(E) ciphers from SSLv3
Todd Short [Tue, 11 Apr 2017 13:02:05 +0000 (09:02 -0400)]
Remove ECDH(E) ciphers from SSLv3

SSLv3 does not support TLS extensions, and thus, cannot provide any
curves for ECDH(E). With the removal of the default (all) list of curves
being used for connections that didn't provide any curves, ECDHE is no
longer possible.

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

7 years agoAdditional check to handle BAD SSL_write retry
Rich Salz [Tue, 11 Apr 2017 15:59:59 +0000 (11:59 -0400)]
Additional check to handle BAD SSL_write retry

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

7 years agoReject decoding of an INT64 with a value >INT64_MAX
Matt Caswell [Mon, 10 Apr 2017 16:33:29 +0000 (17:33 +0100)]
Reject decoding of an INT64 with a value >INT64_MAX

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

7 years agoUpdate dtlstest to use the test infrastructure
Pauli [Mon, 10 Apr 2017 03:45:01 +0000 (13:45 +1000)]
Update dtlstest to use the test infrastructure

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

7 years agoUpdate md2test to use the test infrastructure
Pauli [Fri, 7 Apr 2017 04:09:53 +0000 (14:09 +1000)]
Update md2test to use the test infrastructure

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

7 years agoUpdate rc2test to use the test infrastructure
Pauli [Fri, 7 Apr 2017 03:54:09 +0000 (13:54 +1000)]
Update rc2test to use the test infrastructure

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

7 years agoMake test marcos for true/false checks reliable for all integral types.
Pauli [Sun, 9 Apr 2017 21:13:59 +0000 (07:13 +1000)]
Make test marcos for true/false checks reliable for all integral types.

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

7 years agoAllow an ALPN callback to pretend to not exist
Benjamin Kaduk [Tue, 7 Feb 2017 22:23:16 +0000 (16:23 -0600)]
Allow an ALPN callback to pretend to not exist

RFC 7301 mandates that the server SHALL respond with a fatal
"no_application_protocol" alert when there is no overlap between
the client's supplied list and the server's list of supported protocols.
In commit 062178678f5374b09f00d70796f6e692e8775aca we changed from
ignoring non-success returns from the supplied alpn_select_cb() to
treating such non-success returns as indicative of non-overlap and
sending the fatal alert.

In effect, this is using the presence of an alpn_select_cb() as a proxy
to attempt to determine whether the application has configured a list
of supported protocols.  However, there may be cases in which an
application's architecture leads it to supply an alpn_select_cb() but
have that callback be configured to take no action on connections that
do not have ALPN configured; returning SSL_TLSEXT_ERR_NOACK from
the callback would be the natural way to do so.  Unfortunately, the
aforementioned behavior change also treated SSL_TLSEXT_ERR_NOACK as
indicative of no overlap and terminated the connection; this change
supplies special handling for SSL_TLSEXT_ERR_NOACK returns from the
callback.  In effect, it provides a way for a callback to obtain the
behavior that would have occurred if no callback was registered at
all, which was not possible prior to this change.

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

7 years agoFix util/mkdef.pl
Richard Levitte [Thu, 6 Apr 2017 12:11:19 +0000 (14:11 +0200)]
Fix util/mkdef.pl

The deprecation checking code here didn't work the same way as in
Configure, and used $config{options} to find an --api= option that
was never there.  This is replaced with checking $config{api}, which
is the controlling variable for deprecation.

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

7 years agoAdd a note in CHANGES
Richard Levitte [Wed, 5 Apr 2017 20:38:03 +0000 (22:38 +0200)]
Add a note in CHANGES

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

7 years agoAct on deprecation of LONG and ZLONG, step 3
Richard Levitte [Wed, 5 Apr 2017 15:06:01 +0000 (17:06 +0200)]
Act on deprecation of LONG and ZLONG, step 3

Teach util/mkdef.pl to recognise these lines:

    #if OPENSSL_API_COMPAT < 0xXXXXXXXXL

    #if OPENSSL_API_COMPAT >= 0xXXXXXXXXL

and add corresponding markers in util/*.num

A final 'make update' sets those markers right for LONG and ZLONG.

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

7 years agoAct on deprecation of LONG and ZLONG, step 2
Richard Levitte [Wed, 5 Apr 2017 11:24:14 +0000 (13:24 +0200)]
Act on deprecation of LONG and ZLONG, step 2

Replace all remaining uses of LONG and ZLONG with INT32 / ZINT32.

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

7 years agoAct on deprecation of LONG and ZLONG, step 1
Richard Levitte [Wed, 5 Apr 2017 11:21:06 +0000 (13:21 +0200)]
Act on deprecation of LONG and ZLONG, step 1

Don't compile code that still uses LONG when it's deprecated

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

7 years agoDiscourage the use of LONG and ZLONG, and deprecate it in the future
Richard Levitte [Wed, 5 Apr 2017 10:09:21 +0000 (12:09 +0200)]
Discourage the use of LONG and ZLONG, and deprecate it in the future

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

7 years agoPublish our INT32, UINT32, INT64, UINT64 ASN.1 types and Z variants
Richard Levitte [Wed, 5 Apr 2017 10:07:48 +0000 (12:07 +0200)]
Publish our INT32, UINT32, INT64, UINT64 ASN.1 types and Z variants

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

7 years agorand/rand_lib.c: keep fixing no-engine configuration.
Andy Polyakov [Sat, 8 Apr 2017 20:29:09 +0000 (22:29 +0200)]
rand/rand_lib.c: keep fixing no-engine configuration.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoasn1/x_long.c: remove conditions in inner loops and dependency on BN.
Andy Polyakov [Sat, 8 Apr 2017 16:01:36 +0000 (18:01 +0200)]
asn1/x_long.c: remove conditions in inner loops and dependency on BN.

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

7 years agoappveyor.yml: split {build,test}_scripts to avoid exit code masking.
Andy Polyakov [Fri, 7 Apr 2017 12:27:54 +0000 (14:27 +0200)]
appveyor.yml: split {build,test}_scripts to avoid exit code masking.

Last modification effectively masked test failures, so that builds
were reported successful even if they failed.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoUse 'over 2' for bullet lists.
Rich Salz [Fri, 7 Apr 2017 17:37:47 +0000 (13:37 -0400)]
Use 'over 2' for bullet lists.

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

7 years agoStandardize on =over 4 and check for it.
Rich Salz [Mon, 3 Apr 2017 19:39:09 +0000 (15:39 -0400)]
Standardize on =over 4 and check for it.

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

7 years agoAdd missing =back
Rich Salz [Mon, 3 Apr 2017 19:30:20 +0000 (15:30 -0400)]
Add missing =back

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

7 years agoCheck for L<foo|foo>
Rich Salz [Mon, 3 Apr 2017 19:29:56 +0000 (15:29 -0400)]
Check for L<foo|foo>

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

7 years agoMake default_method mostly compile-time (cont'd)
Rich Salz [Fri, 7 Apr 2017 17:27:53 +0000 (13:27 -0400)]
Make default_method mostly compile-time (cont'd)

Forgot to include this commit as requested by review.

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

7 years agoMake default_method mostly compile-time
Rich Salz [Fri, 7 Apr 2017 16:07:42 +0000 (12:07 -0400)]
Make default_method mostly compile-time

Document thread-safety issues
Have RSA_null return NULL (always fails)

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

7 years agoFix rand_lib.c for no-engine configuration
Richard Levitte [Fri, 7 Apr 2017 14:26:10 +0000 (16:26 +0200)]
Fix rand_lib.c for no-engine configuration

When configured no-engine, we still refered to rand_engine_lock.
Rework the lock init code to avoid that.

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

7 years agoFix a test failure when configured without TLSv1.3
Matt Caswell [Fri, 7 Apr 2017 10:56:27 +0000 (11:56 +0100)]
Fix a test failure when configured without TLSv1.3

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

7 years agoRemove an out of date TODO
Matt Caswell [Fri, 7 Apr 2017 10:23:00 +0000 (11:23 +0100)]
Remove an out of date TODO

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

7 years agoCreate an ENDPOINT enum type for use internally
Matt Caswell [Fri, 7 Apr 2017 10:20:00 +0000 (11:20 +0100)]
Create an ENDPOINT enum type for use internally

We need it for the custom extensions API

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

7 years agoPrefix custom extension API callback types with SSL_
Matt Caswell [Fri, 7 Apr 2017 10:04:38 +0000 (11:04 +0100)]
Prefix custom extension API callback types with SSL_

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

7 years agoVarious style tweaks based on feedback
Matt Caswell [Fri, 7 Apr 2017 09:56:59 +0000 (10:56 +0100)]
Various style tweaks based on feedback

Style updates for the new custom extensions API

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

7 years agoAdd documentation for the new custom extensions API
Matt Caswell [Thu, 6 Apr 2017 16:33:23 +0000 (17:33 +0100)]
Add documentation for the new custom extensions API

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

7 years agoAdd some tests for the new custom extensions API
Matt Caswell [Wed, 5 Apr 2017 16:29:47 +0000 (17:29 +0100)]
Add some tests for the new custom extensions API

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

7 years agoImplement a new custom extensions API
Matt Caswell [Wed, 5 Apr 2017 10:59:23 +0000 (11:59 +0100)]
Implement a new custom extensions API

The old custom extensions API was not TLSv1.3 aware. Extensions are used
extensively in TLSv1.3 and they can appear in many different types of
messages. Therefore we need a new API to be able to cope with that.

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

7 years agoMove the extensions context codes into the public API
Matt Caswell [Tue, 4 Apr 2017 10:40:02 +0000 (11:40 +0100)]
Move the extensions context codes into the public API

This move prepares for the later addition of the new custom extensions
API. The context codes have an additional "SSL_" added to their name to
ensure we don't have name clashes with other applications.

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

7 years agoMove ssl/t1_ext.c to ssl/statem/extensions_cust.c
Matt Caswell [Tue, 4 Apr 2017 10:11:58 +0000 (11:11 +0100)]
Move ssl/t1_ext.c to ssl/statem/extensions_cust.c

Brings all the extensions code together.

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

7 years agoDon't try to clean up RAND from ENGINE
Richard Levitte [Thu, 6 Apr 2017 13:58:38 +0000 (15:58 +0200)]
Don't try to clean up RAND from ENGINE

This is especially harmful since OPENSSL_cleanup() has already called
the RAND cleanup function

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

7 years agoMake getting and setting the RAND default method thread safe
Richard Levitte [Thu, 6 Apr 2017 09:30:03 +0000 (11:30 +0200)]
Make getting and setting the RAND default method thread safe

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

7 years agoe_os2.h: Refine OSSL_SSIZE definition under UEFI environment
Qin Long [Tue, 4 Apr 2017 17:08:16 +0000 (01:08 +0800)]
e_os2.h: Refine OSSL_SSIZE definition under UEFI environment

Under UEFI build environment, we may encounter the OSSL_SSIZE macro
re-definition error in e_os2.h if any module call OpenSSL API directly
by including "openssl/xxxx.h" (caused by the predefined _WIN32/_WIN64
macro, which should have been un-defined under OPENSSL_SYS_UEFI).

Though it's not one recommended usage, this patch could still eliminate
the possible build issue by refining the OSSL_SSIZE definition under
OPENSSL_SYS_UEFI.

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

7 years agoAdd support for MLOCK_ONFAULT to secure arena
Todd Short [Thu, 23 Mar 2017 16:56:22 +0000 (12:56 -0400)]
Add support for MLOCK_ONFAULT to secure arena

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

7 years agoIn rand_cleanup_int(), don't go creating a default method
Richard Levitte [Thu, 6 Apr 2017 08:24:55 +0000 (10:24 +0200)]
In rand_cleanup_int(), don't go creating a default method

If no default method was yet given, RAND_get_rand_method() will set it
up.  Doing so just to clean it away seems pretty silly, so instead,
use the default_RAND_meth variable directly.

This also clears a possible race condition where this will try to init
things, such as ERR or ENGINE when in the middle of a OPENSSL_cleanup.

Fixes #3128

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

7 years agoFix test/asn1_encode_test.c, ASN1_LONG_DATA used inappropriately
Richard Levitte [Wed, 5 Apr 2017 11:37:37 +0000 (13:37 +0200)]
Fix test/asn1_encode_test.c, ASN1_LONG_DATA used inappropriately

It's sheer luck that this was used for the first field only which also
has the same type in all data structures, so the offsets were never wrong

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

7 years agoConfigurations/README: reword bn_ops description.
Andy Polyakov [Mon, 3 Apr 2017 21:41:19 +0000 (23:41 +0200)]
Configurations/README: reword bn_ops description.

Fixes GH#3116.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoConfigure: recognize -framework as linker option [on Apple OSes].
Andy Polyakov [Mon, 3 Apr 2017 20:31:05 +0000 (22:31 +0200)]
Configure: recognize -framework as linker option [on Apple OSes].

This is handy for internal iOS tests, when you have to make it work
in sandbox.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoPBKDF2 computation speedup (15-40%)
Gergely Nagy [Thu, 13 Oct 2016 16:50:31 +0000 (18:50 +0200)]
PBKDF2 computation speedup (15-40%)

This commit contains some optimizations in PKCS5_PBKDF2_HMAC() and
HMAC_CTX_copy() functions which together makes PBKDF2 computations
faster by 15-40% according to my measurements made on x64 Linux with
both asm optimized and no-asm versions of SHA1, SHA256 and SHA512.

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

7 years agoFix faulty check of padding in x_long.c
Richard Levitte [Fri, 31 Mar 2017 19:31:43 +0000 (21:31 +0200)]
Fix faulty check of padding in x_long.c

Bug uncovered by test

[extended tests]

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

7 years agoFix a possible integer overflow in long_c2i
Matt Caswell [Mon, 27 Mar 2017 15:11:11 +0000 (16:11 +0100)]
Fix a possible integer overflow in long_c2i

Credit to OSS-Fuzz for finding this.

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

7 years agoAdd a test of encoding and decoding LONG, INT32, UINT32, INT64 and UINT64
Richard Levitte [Fri, 31 Mar 2017 19:28:20 +0000 (21:28 +0200)]
Add a test of encoding and decoding LONG, INT32, UINT32, INT64 and UINT64

Also Z varieties.

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

7 years agoConvert SSL_SESSION_ASN1 to use size specific integers
Richard Levitte [Thu, 30 Mar 2017 11:33:33 +0000 (13:33 +0200)]
Convert SSL_SESSION_ASN1 to use size specific integers

This increases portability of SSL_SESSION files between architectures
where the size of |long| may vary.  Before this, SSL_SESSION files
produced on a 64-bit long architecture may break on a 32-bit long
architecture.

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

7 years agomake update
Richard Levitte [Thu, 30 Mar 2017 11:33:20 +0000 (13:33 +0200)]
make update

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

7 years agoImplement internal ASN.1 types INT32, UINT32, INT64, UINT64
Richard Levitte [Thu, 30 Mar 2017 11:31:16 +0000 (13:31 +0200)]
Implement internal ASN.1 types INT32, UINT32, INT64, UINT64

Also Z varieties.

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

7 years agoupdate ordinals
Dr. Stephen Henson [Fri, 31 Mar 2017 23:40:15 +0000 (00:40 +0100)]
update ordinals

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

7 years agoDocument new ssl(3) functions and options.
Dr. Stephen Henson [Fri, 31 Mar 2017 16:15:22 +0000 (17:15 +0100)]
Document new ssl(3) functions and options.

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

7 years agoAdd certificate_authorities tests client to server.
Dr. Stephen Henson [Fri, 31 Mar 2017 22:06:15 +0000 (23:06 +0100)]
Add certificate_authorities tests client to server.

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

7 years agoAdd ExpectedServerCANames
Dr. Stephen Henson [Fri, 31 Mar 2017 21:35:28 +0000 (22:35 +0100)]
Add ExpectedServerCANames

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

7 years agoConstify SSL_dup_CA_list()
Dr. Stephen Henson [Fri, 31 Mar 2017 21:30:58 +0000 (22:30 +0100)]
Constify SSL_dup_CA_list()

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

7 years agoPrint CA names in s_server, add -requestCAfile to s_client
Dr. Stephen Henson [Fri, 31 Mar 2017 16:04:28 +0000 (17:04 +0100)]
Print CA names in s_server, add -requestCAfile to s_client

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

7 years agoDon't use client specific functions to retrieve CA list
Dr. Stephen Henson [Mon, 20 Mar 2017 18:33:54 +0000 (18:33 +0000)]
Don't use client specific functions to retrieve CA list

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

7 years agoAdd requestCAfile option
Dr. Stephen Henson [Mon, 20 Mar 2017 18:32:43 +0000 (18:32 +0000)]
Add requestCAfile option

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

7 years agoAdd extensions to debug list
Dr. Stephen Henson [Mon, 20 Mar 2017 18:31:44 +0000 (18:31 +0000)]
Add extensions to debug list

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

7 years agoSSL_CONF support for certificate_authorities
Dr. Stephen Henson [Sat, 18 Mar 2017 13:44:13 +0000 (13:44 +0000)]
SSL_CONF support for certificate_authorities

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

7 years agoNew certificate_authorities functions
Dr. Stephen Henson [Mon, 13 Mar 2017 15:00:36 +0000 (15:00 +0000)]
New certificate_authorities functions

Add functions to add/retrieve the certificate_authorities. The older
client_CA functions mainly just call the new versions now.

Rename fields sice new extension can be generated by client and server.

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

7 years agoEnsure dhparams can handle X9.42 params in DER
Matt Caswell [Mon, 3 Apr 2017 11:42:58 +0000 (12:42 +0100)]
Ensure dhparams can handle X9.42 params in DER

dhparams correctly handles X9.42 params in PEM format. However it failed
to correctly processes them when reading/writing DER format.

Fixes #3102

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

7 years agoAdd missing macros for DHxparams
Matt Caswell [Mon, 3 Apr 2017 11:41:04 +0000 (12:41 +0100)]
Add missing macros for DHxparams

DHparams has d2i_DHparams_fp, d2i_DHxparams_bio etc, but the equivalent
macros for DHxparams were omitted.

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

7 years agoAdd documentation for SSL_get_server_tmp_key()
Matt Caswell [Mon, 3 Apr 2017 14:41:21 +0000 (15:41 +0100)]
Add documentation for SSL_get_server_tmp_key()

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

7 years agoFix calls to SSL_get_server_tmp_key() in TLSv1.3
Matt Caswell [Mon, 3 Apr 2017 14:24:06 +0000 (15:24 +0100)]
Fix calls to SSL_get_server_tmp_key() in TLSv1.3

The macro SSL_get_server_tmp_key() returns information about the temp key
used by the server during a handshake. This was returning NULL for TLSv1.3
and causing s_client to omit this information in its connection summary.

Fixes #3081

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

7 years agoTweak a style issue
Matt Caswell [Mon, 3 Apr 2017 13:22:26 +0000 (14:22 +0100)]
Tweak a style issue

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

7 years agoAdd a test for the problem fixed by the previous commit
Matt Caswell [Mon, 3 Apr 2017 13:18:24 +0000 (14:18 +0100)]
Add a test for the problem fixed by the previous commit

Make sure the server can write normal data after earlier writing early data.

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

7 years agoRestore s->early_data_state with the original value
Tatsuhiro Tsujikawa [Mon, 3 Apr 2017 13:17:58 +0000 (14:17 +0100)]
Restore s->early_data_state with the original value

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

7 years agoUpdate early data test for an even later arrival of CF
Matt Caswell [Thu, 30 Mar 2017 16:38:15 +0000 (17:38 +0100)]
Update early data test for an even later arrival of CF

Commit 9b5c865df introduced a synthetic delay between arrival of EoED and
CF. We actually want to delay the arrival of CF even further to demonstrate
that we can write early data even when "in init".

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

7 years agoDon't handle handshake messages when writing early data on server
Matt Caswell [Thu, 30 Mar 2017 16:35:55 +0000 (17:35 +0100)]
Don't handle handshake messages when writing early data on server

If we have received the EoED message but not yet had the CF then we are
"in init". Despite that we still want to write application data, so suppress
the "in init" check in ssl3_write_bytes() in that scenario.

Fixes #3041

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

7 years agoFix a typo in the SSL_get_max_early_data() declarations
Kazuki Yamaguchi [Thu, 30 Mar 2017 16:54:39 +0000 (01:54 +0900)]
Fix a typo in the SSL_get_max_early_data() declarations

SSL_get_max_early_data() recently added by 3fc8d856105e ("Construct the
ticket_early_data_info extension", 2017-02-17) is supposed to take an
SSL, but it doesn't.

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

7 years agoDisable 15-test_ecparam.t when configured no-ec2m
Richard Levitte [Sun, 2 Apr 2017 09:18:59 +0000 (11:18 +0200)]
Disable 15-test_ecparam.t when configured no-ec2m

This test doesn't actually fail completely, but there's no real
pattern to distinguish which data files should be omitted when no-ec2m
is configured and which should not.

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

7 years agoRemind people to have 'Fixes #XXXX' in the commit message
Richard Levitte [Sun, 2 Apr 2017 09:38:23 +0000 (11:38 +0200)]
Remind people to have 'Fixes #XXXX' in the commit message

It's of course also possible to just add them to the PR description,
but having these lines in the commit messages provide better
automation.

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

7 years agoFixup the github pull request template
Richard Levitte [Sun, 2 Apr 2017 09:28:04 +0000 (11:28 +0200)]
Fixup the github pull request template

When creating a single commit PR, github will now automatically
include the commit comment first in the pull request description, and
add the template content last.  That makes the description section at
the end useless.

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

7 years agocrypto/ppccap.c: SIGILL-free processor capabilities detection on MacOS X.
Andy Polyakov [Sat, 1 Apr 2017 13:28:28 +0000 (15:28 +0200)]
crypto/ppccap.c: SIGILL-free processor capabilities detection on MacOS X.

It seems to be problematic to probe processor capabilities with SIGILL
on MacOS X. The problem should be limited to cases when application code
is debugged, but crashes were reported even during normal execution...

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoConfigure: use 5.10.0, don't require...
Andy Polyakov [Fri, 31 Mar 2017 12:37:10 +0000 (14:37 +0200)]
Configure: use 5.10.0, don't require...

Configure started with 'require 5.10.0', but if executed by older perl
it failed with "might be runaway multi-line // string" instead of
naturally expected "Perl v5.10.0 required--this is only v5.x.y".

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoe_afalg.[ch]: fix --strict-warnings with gcc 4.x and 32-bit build.
Andy Polyakov [Thu, 30 Mar 2017 21:07:26 +0000 (23:07 +0200)]
e_afalg.[ch]: fix --strict-warnings with gcc 4.x and 32-bit build.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agobio/b_print.c: switch to int64_t as "greatest-width integer type".
Andy Polyakov [Thu, 30 Mar 2017 19:44:55 +0000 (21:44 +0200)]
bio/b_print.c: switch to int64_t as "greatest-width integer type".

Originally there was dependency on BN configuration parameters, but
it stemmed from times when "long long" support was optional. Today
we require 64-bit support from compiler, and there is no reason to
have "greatest-width integer" depend on BN configuration.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoFix for #2730. Add CRLDP extension to list of supported extensions
Jon Spillett [Thu, 30 Mar 2017 04:13:44 +0000 (14:13 +1000)]
Fix for #2730. Add CRLDP extension to list of supported extensions

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

7 years agoUpdate SSL_extension_supported()
Matt Caswell [Thu, 30 Mar 2017 23:26:23 +0000 (00:26 +0100)]
Update SSL_extension_supported()

Numerous changes have been made to the supported built-in extensions and
SSL_extension_supported() has not kept up.

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

7 years agoe_os.h: drop now-redundant PRIu64 [and fix OSSLzu].
Andy Polyakov [Wed, 29 Mar 2017 21:25:45 +0000 (23:25 +0200)]
e_os.h: drop now-redundant PRIu64 [and fix OSSLzu].

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

7 years agoapps/*.c: switch to platform-neutral format modifiers in BIO_print calls.
Andy Polyakov [Wed, 29 Mar 2017 21:23:56 +0000 (23:23 +0200)]
apps/*.c: switch to platform-neutral format modifiers in BIO_print calls.

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

7 years agobio/b_print.c: recognize even 'j' format modifier.
Andy Polyakov [Wed, 29 Mar 2017 21:10:08 +0000 (23:10 +0200)]
bio/b_print.c: recognize even 'j' format modifier.

'j' is specified as modifier for "greatest-width integer type", which in
practice means 64 bits on both 32- and 64-bit platforms. Since we rely
on __attribute__((__format__(__printf__,...))) to sanitize BIO_print
format, we can use it to denote [u]int64_t-s in platform-neutral manner.

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

7 years agoFix s_client early data indicator
Matt Caswell [Thu, 30 Mar 2017 15:06:29 +0000 (16:06 +0100)]
Fix s_client early data indicator

s_client was always saying that early_data was rejected even when it was
accepted. This was because it was using the wrong test to detect the end
of the handshake. It was using SSL_in_init() which only tells you whether
it is currently processing/sending/expecting handshake messages. It should
use SSL_is_init_finished() which tells you that no handshake messages are
being processed/sent/expected AND we have completed the handshake. In the
early data case we are not processing/sending handshake messages and we
are expecting early data (not a handshake message) - but the handshake has
not yet completed.

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

7 years agoProvide a test for pause between EoED and CF
Matt Caswell [Thu, 30 Mar 2017 14:26:23 +0000 (15:26 +0100)]
Provide a test for pause between EoED and CF

This tests the bug fixed in the previous commit. We introduce a synthetic
delay between the server receiving EoED and CF and check that we can still
send early data.

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

7 years agoFix early data bug with pause between EoED and CF
Matt Caswell [Thu, 30 Mar 2017 14:24:07 +0000 (15:24 +0100)]
Fix early data bug with pause between EoED and CF

If the server received EoED then SSL_read_early_data() will return
SSL_READ_EARLY_DATA_FINISH. However if the CF has not yet been processed
then SSL_is_init_finished() will still return 0. Therefore we should still
be able to write early data.

Fixes #3041

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

7 years agoAdd SSL_dup description
Jon Spillett [Wed, 29 Mar 2017 09:17:55 +0000 (19:17 +1000)]
Add SSL_dup description

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

7 years agoDocumentation updates
Pauli [Wed, 29 Mar 2017 21:38:30 +0000 (07:38 +1000)]
Documentation updates

Fix capitilistion of list items.
Wrap long lines.
Add full stops to the ends of sentances.
Change ciphersuite to cipher suite in all of doc.

[skip ci]

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

7 years agoAdd a test for the bug fixed in the previous commit
Matt Caswell [Wed, 29 Mar 2017 16:02:25 +0000 (17:02 +0100)]
Add a test for the bug fixed in the previous commit

We want to make sure that if we if are using SSL_MODE_AUTO_RETRY then
if SSL_read_early_data() hits EndOfEarlyData then it doesn't auto retry
and end up with normal data. The same issue could occur with read_ahead
which is what we use in this test.

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