oweals/openssl.git
8 years agoRemove some old ms/* files
Rich Salz [Tue, 8 Mar 2016 19:02:54 +0000 (14:02 -0500)]
Remove some old ms/* files

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoInclude e_os.h from ec_lcl.h
Richard Levitte [Tue, 8 Mar 2016 18:55:40 +0000 (19:55 +0100)]
Include e_os.h from ec_lcl.h

The EC code recently started using REF_PRINT_COUNT and REF_ASSERT_ISNT.
Those are defined in e_os.h.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix cert leaks in s_server
FdaSilvaYY [Mon, 7 Mar 2016 20:00:02 +0000 (21:00 +0100)]
Fix cert leaks in s_server

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoReuse strndup(), simplify code
Dmitry-Me [Tue, 8 Mar 2016 07:00:15 +0000 (10:00 +0300)]
Reuse strndup(), simplify code

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agomake update
Dr. Stephen Henson [Tue, 8 Mar 2016 17:02:49 +0000 (17:02 +0000)]
make update

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMake DSA_SIG opaque.
Dr. Stephen Henson [Fri, 4 Mar 2016 02:39:50 +0000 (02:39 +0000)]
Make DSA_SIG opaque.

This adds a new accessor function DSA_SIG_get0.
The customisation of DSA_SIG structure initialisation has been removed this
means that the 'r' and 's' components are automatically allocated when
DSA_SIG_new() is called. Update documentation.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix travis builds
Richard Levitte [Tue, 8 Mar 2016 16:27:15 +0000 (17:27 +0100)]
Fix travis builds

Travis doesn't seem to know about 'expr'

Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agomake update
Alessandro Ghedini [Sat, 5 Mar 2016 20:53:32 +0000 (20:53 +0000)]
make update

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConvert CRYPTO_LOCK_X509_* to new multi-threading API
Alessandro Ghedini [Tue, 1 Mar 2016 18:06:15 +0000 (18:06 +0000)]
Convert CRYPTO_LOCK_X509_* to new multi-threading API

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConvert CRYPTO_LOCK_UI to new multi-threading API
Alessandro Ghedini [Mon, 29 Feb 2016 17:12:25 +0000 (17:12 +0000)]
Convert CRYPTO_LOCK_UI to new multi-threading API

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConvert CRYPTO_LOCK_EC_* to new multi-threading API
Alessandro Ghedini [Mon, 29 Feb 2016 16:57:11 +0000 (16:57 +0000)]
Convert CRYPTO_LOCK_EC_* to new multi-threading API

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConvert CRYPTO_LOCK_EVP_PKEY to new multi-threading API
Alessandro Ghedini [Fri, 26 Feb 2016 12:21:15 +0000 (12:21 +0000)]
Convert CRYPTO_LOCK_EVP_PKEY to new multi-threading API

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConvert CRYPTO_LOCK_BIO to new multi-threading API
Alessandro Ghedini [Fri, 26 Feb 2016 11:51:31 +0000 (11:51 +0000)]
Convert CRYPTO_LOCK_BIO to new multi-threading API

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoOnly enable ccache if it's available
Richard Levitte [Mon, 7 Mar 2016 10:22:00 +0000 (11:22 +0100)]
Only enable ccache if it's available

Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoUse ccache for the unified builds
Richard Levitte [Sun, 6 Mar 2016 23:33:35 +0000 (00:33 +0100)]
Use ccache for the unified builds

This may speed up our builds considerably

Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoFor unified builds, make a separate build directory and build there
Richard Levitte [Sun, 6 Mar 2016 22:34:49 +0000 (23:34 +0100)]
For unified builds, make a separate build directory and build there

Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoSPARCv9 assembly pack: unify build rules and argument handling.
Andy Polyakov [Tue, 8 Mar 2016 08:46:19 +0000 (09:46 +0100)]
SPARCv9 assembly pack: unify build rules and argument handling.

Make all scripts produce .S, make interpretation of $(CFLAGS)
pre-processor's responsibility, start accepting $(PERLASM_SCHEME).
[$(PERLASM_SCHEME) is redundant in this case, because there are
no deviataions between Solaris and Linux assemblers. This is
purely to unify .pl->.S handling across all targets.]

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix build; ssltest
Rich Salz [Tue, 8 Mar 2016 14:38:30 +0000 (09:38 -0500)]
Fix build; ssltest

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoTweak some more information in INSTALL
Richard Levitte [Tue, 8 Mar 2016 12:53:07 +0000 (13:53 +0100)]
Tweak some more information in INSTALL

The summary on how to add configs and how Makefile et al wasn't quite
correct any more.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGH787: Fix ALPN
Todd Short [Sat, 5 Mar 2016 13:47:55 +0000 (08:47 -0500)]
GH787: Fix ALPN

* Perform ALPN after the SNI callback; the SSL_CTX may change due to
  that processing
* Add flags to indicate that we actually sent ALPN, to properly error
  out if unexpectedly received.
* clean up ssl3_free() no need to explicitly clear when doing memset
* document ALPN functions

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd an SSL_has_pending() function
Matt Caswell [Fri, 12 Feb 2016 12:03:58 +0000 (12:03 +0000)]
Add an SSL_has_pending() function

This is similar to SSL_pending() but just returns a 1 if there is data
pending in the internal OpenSSL buffers or 0 otherwise (as opposed to
SSL_pending() which returns the number of bytes available). Unlike
SSL_pending() this will work even if "read_ahead" is set (which is the
case if you are using read pipelining, or if you are doing DTLS). A 1
return value means that we have unprocessed data. It does *not* necessarily
indicate that there will be application data returned from a call to
SSL_read(). The unprocessed data may not be application data or there
could be errors when we attempt to parse the records.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd an ability to set the SSL read buffer size
Matt Caswell [Wed, 13 Jan 2016 14:20:25 +0000 (14:20 +0000)]
Add an ability to set the SSL read buffer size

This capability is required for read pipelining. We will only read in as
many records as will fit in the read buffer (and the network can provide
in one go). The bigger the buffer the more records we can process in
parallel.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd cipher query functions
Todd Short [Sat, 5 Mar 2016 14:47:46 +0000 (09:47 -0500)]
Add cipher query functions

Add functions to determine authentication, key-exchange, FIPS and AEAD.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConvert ERR_STRING_DATA to new multi-threading API
Alessandro Ghedini [Sat, 5 Mar 2016 21:31:43 +0000 (21:31 +0000)]
Convert ERR_STRING_DATA to new multi-threading API

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConvert ERR_STATE to new multi-threading API
Alessandro Ghedini [Wed, 2 Mar 2016 17:36:17 +0000 (17:36 +0000)]
Convert ERR_STATE to new multi-threading API

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConvert CRYPTO_LOCK_EX_DATA to new multi-threading API
Alessandro Ghedini [Sat, 5 Mar 2016 21:54:02 +0000 (21:54 +0000)]
Convert CRYPTO_LOCK_EX_DATA to new multi-threading API

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConvert CRYPTO_LOCK_DSO to new multi-threading API
Alessandro Ghedini [Fri, 4 Mar 2016 16:04:37 +0000 (16:04 +0000)]
Convert CRYPTO_LOCK_DSO to new multi-threading API

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConvert CRYPTO_LOCK_{DH,DSA,RSA} to new multi-threading API
Alessandro Ghedini [Fri, 4 Mar 2016 15:43:46 +0000 (15:43 +0000)]
Convert CRYPTO_LOCK_{DH,DSA,RSA} to new multi-threading API

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConvert CRYPTO_LOCK_GET*BYNAME to new multi-threading API
Alessandro Ghedini [Fri, 4 Mar 2016 15:24:26 +0000 (15:24 +0000)]
Convert CRYPTO_LOCK_GET*BYNAME to new multi-threading API

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGH815: The ChaCha20/Poly1305 codepoints are official
Benjamin Kaduk [Tue, 8 Mar 2016 00:00:03 +0000 (18:00 -0600)]
GH815: The ChaCha20/Poly1305 codepoints are official

CCA8, CCA9, CCAA, CCAB, CCAC, CCAD, and CCAE are now present in
https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml
so remove the "as per draft-ietf-tls-chacha20-poly1305-03" note
accordingly.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoGH787: Fix ALPN
Todd Short [Sat, 5 Mar 2016 13:47:55 +0000 (08:47 -0500)]
GH787: Fix ALPN

* Perform ALPN after the SNI callback; the SSL_CTX may change due to
  that processing
* Add flags to indicate that we actually sent ALPN, to properly error
  out if unexpectedly received.
* clean up ssl3_free() no need to explicitly clear when doing memset
* document ALPN functions

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoMake mk1mf recognise the --classic flag
Richard Levitte [Tue, 8 Mar 2016 13:07:40 +0000 (14:07 +0100)]
Make mk1mf recognise the --classic flag

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoFix configurations such as 'dist' and tar building
Richard Levitte [Tue, 8 Mar 2016 10:49:26 +0000 (11:49 +0100)]
Fix configurations such as 'dist' and tar building

For config targets such as 'dist', which doesn't have a BASE template,
we still need to have a default build scheme.

Additionally, the unified Makefile template's target 'tar' wasn't
quite as flexible as the unixmake one.

Finally, .travis-create-release.sh can be somewhat simplified now that
it builds with the unified build scheme.

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoWe've switch to unified build scheme by default, reflect it in travis
Richard Levitte [Tue, 8 Mar 2016 11:06:44 +0000 (12:06 +0100)]
We've switch to unified build scheme by default, reflect it in travis

We want to preserve a couple of classic builds still, the quickest is
to change all --unified to --classic

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoFix engine/asm/e_padlock-x86.pl for newer semantics
Richard Levitte [Tue, 8 Mar 2016 01:31:51 +0000 (02:31 +0100)]
Fix engine/asm/e_padlock-x86.pl for newer semantics

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoChange the INSTALL documentation for unified builds
Richard Levitte [Mon, 7 Mar 2016 23:04:27 +0000 (00:04 +0100)]
Change the INSTALL documentation for unified builds

Because of the unified scheme, building on different platforms is very
similar.  We currently have Unix and OpenVMS on the unified scheme,
which means that a separate INSTALL.VMS is no longer needed.

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoMake unified builds the default on Unix
Richard Levitte [Mon, 7 Mar 2016 19:43:07 +0000 (20:43 +0100)]
Make unified builds the default on Unix

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoAdd the Configure option --classic, to fall back on classic build schemes
Richard Levitte [Mon, 7 Mar 2016 19:41:39 +0000 (20:41 +0100)]
Add the Configure option --classic, to fall back on classic build schemes

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoRevert "unified build scheme: Try to nudge users to try the "unified" build"
Richard Levitte [Mon, 7 Mar 2016 19:18:59 +0000 (20:18 +0100)]
Revert "unified build scheme: Try to nudge users to try the "unified" build"

This reverts commit 242ffb05a2e4aa3fc7ffc131037e077b7e242189.

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoFix building without multiblock support
Matt Caswell [Mon, 7 Mar 2016 23:26:32 +0000 (23:26 +0000)]
Fix building without multiblock support

Not all platforms support multiblock. Building without it fails prior to
this fix.

RT#4396

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoDon't free NCONF obtained values
Viktor Dukhovni [Mon, 7 Mar 2016 01:01:20 +0000 (20:01 -0500)]
Don't free NCONF obtained values

Bug reported by Michel Sales.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRemove kinv/r fields from DSA structure.
Dr. Stephen Henson [Mon, 7 Mar 2016 17:31:00 +0000 (17:31 +0000)]
Remove kinv/r fields from DSA structure.

The kinv/r fields in the DSA structure are not used by OpenSSL internally
and should not be used in general.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGH812: Fix for no-ui build on Windows
Mat [Mon, 7 Mar 2016 21:59:13 +0000 (22:59 +0100)]
GH812: Fix for no-ui build on Windows

Add UI to known algorithms in mkdef.pl

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAppVeyor: Only use the latest VS version
Kurt Roeckx [Mon, 7 Mar 2016 21:40:56 +0000 (22:40 +0100)]
AppVeyor: Only use the latest VS version

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

8 years agoRename the numpipes argument to ssl3_enc/tls1_enc
Matt Caswell [Mon, 7 Mar 2016 12:17:42 +0000 (12:17 +0000)]
Rename the numpipes argument to ssl3_enc/tls1_enc

The numpipes argument to ssl3_enc/tls1_enc is actually the number of
records passed in the array. To make this clearer rename the argument to
|n_recs|.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoRename a function
Matt Caswell [Mon, 7 Mar 2016 12:11:42 +0000 (12:11 +0000)]
Rename a function

Rename the have_whole_app_data_record_waiting() function to include the
ssl3_record prefix...and make it a bit shorter.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoRefactor dasync cipher implementations to improve code reuse
Matt Caswell [Mon, 7 Mar 2016 12:03:48 +0000 (12:03 +0000)]
Refactor dasync cipher implementations to improve code reuse

Move out most of the boiler plate code that is common between aes128-cbc
and aes128-cbc-hmac-sha1 into helper functions to improve code reuse.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoMove the _hidden_* static variables in dasync to be constructed in bind
Matt Caswell [Mon, 7 Mar 2016 11:08:02 +0000 (11:08 +0000)]
Move the _hidden_* static variables in dasync to be constructed in bind

The _hidden_* variables were being created on-the-fly. It is better to
create them once up front during bind to avoid any potential race
conditions.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoFix typo in SSL_pending docs
Matt Caswell [Mon, 7 Mar 2016 10:31:48 +0000 (10:31 +0000)]
Fix typo in SSL_pending docs

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoRename EVP_CIPHER_CTX_cipher_data to EVP_CIPHER_CTX_get_cipher_data
Matt Caswell [Mon, 7 Mar 2016 10:17:27 +0000 (10:17 +0000)]
Rename EVP_CIPHER_CTX_cipher_data to EVP_CIPHER_CTX_get_cipher_data

We had the function EVP_CIPHER_CTX_cipher_data which is newly added for
1.1.0. As we now also need an EVP_CIPHER_CTX_set_cipher_data it makes
more sense for the former to be called EVP_CIPHER_CTX_get_cipher_data.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoFix s_server/s_client handling of the split_send_frag argument
Matt Caswell [Mon, 7 Mar 2016 10:06:42 +0000 (10:06 +0000)]
Fix s_server/s_client handling of the split_send_frag argument

Ensure that a value of 0 is correctly handled for the split_send_frag
argument.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoAdd documentation for the EVP_CIPHER_CTX_cipher_data functions
Matt Caswell [Tue, 16 Feb 2016 14:00:55 +0000 (14:00 +0000)]
Add documentation for the EVP_CIPHER_CTX_cipher_data functions

The new pipeline code added a new function
EVP_CIPHER_CTX_set_cipher_data(). Add documentation for this and the
existing EVP_CIPHER_CTX_cipher_data() function.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoRemove the wrec record layer field
Matt Caswell [Tue, 16 Feb 2016 12:10:53 +0000 (12:10 +0000)]
Remove the wrec record layer field

We used to use the wrec field in the record layer for keeping track of the
current record that we are writing out. As part of the pipelining changes
this has been moved to stack allocated variables to do the same thing,
therefore the field is no longer needed.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoUpdate a comment
Matt Caswell [Tue, 16 Feb 2016 11:58:24 +0000 (11:58 +0000)]
Update a comment

Update a comment that was out of date due to the pipelining changes

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoAdd documentation for new s_server/s_client options
Matt Caswell [Tue, 16 Feb 2016 11:13:33 +0000 (11:13 +0000)]
Add documentation for new s_server/s_client options

Document the new split_send_frag, max_pipelines and read_buf options.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoAdd documentation for SSL_has_pending()
Matt Caswell [Tue, 16 Feb 2016 10:36:18 +0000 (10:36 +0000)]
Add documentation for SSL_has_pending()

A previous commit added the SSL_has_pending() function which provides a
method for knowing whether OpenSSL has buffered, but as yet unprocessed
record data.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoAdd pipelining documentation
Matt Caswell [Mon, 15 Feb 2016 15:45:18 +0000 (15:45 +0000)]
Add pipelining documentation

Add some documentation for all of the SSL/SSL_CTX functions/ctrls for
conrolling read and write pipelining.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoFix erroneous fall thgrough in switch statement
Matt Caswell [Mon, 15 Feb 2016 15:43:28 +0000 (15:43 +0000)]
Fix erroneous fall thgrough in switch statement

Fix an erroenous fall through when setting the max_pipelines value.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoEnsure s_client and s_server work when read_ahead is set
Matt Caswell [Fri, 12 Feb 2016 13:33:45 +0000 (13:33 +0000)]
Ensure s_client and s_server work when read_ahead is set

Previously s_client and s_server relied on using SSL_pending() which does
not take into account read_ahead. For read pipelining to work, read_ahead
gets set automatically. Therefore s_client and s_server have been
converted to use SSL_has_pending() instead.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoAdd an SSL_has_pending() function
Matt Caswell [Fri, 12 Feb 2016 12:03:58 +0000 (12:03 +0000)]
Add an SSL_has_pending() function

This is similar to SSL_pending() but just returns a 1 if there is data
pending in the internal OpenSSL buffers or 0 otherwise (as opposed to
SSL_pending() which returns the number of bytes available). Unlike
SSL_pending() this will work even if "read_ahead" is set (which is the
case if you are using read pipelining, or if you are doing DTLS). A 1
return value means that we have unprocessed data. It does *not* necessarily
indicate that there will be application data returned from a call to
SSL_read(). The unprocessed data may not be application data or there
could be errors when we attempt to parse the records.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoAdd an ability to set the SSL read buffer size
Matt Caswell [Wed, 13 Jan 2016 14:20:25 +0000 (14:20 +0000)]
Add an ability to set the SSL read buffer size

This capability is required for read pipelining. We will only read in as
many records as will fit in the read buffer (and the network can provide
in one go). The bigger the buffer the more records we can process in
parallel.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoLazily initialise the compression buffer
Matt Caswell [Wed, 13 Jan 2016 11:44:04 +0000 (11:44 +0000)]
Lazily initialise the compression buffer

With read pipelining we use multiple SSL3_RECORD structures for reading.
There are SSL_MAX_PIPELINES (32) of them defined (typically not all of these
would be used). Each one has a 16k compression buffer allocated! This
results in a significant amount of memory being consumed which, most of the
time, is not needed.  This change swaps the allocation of the compression
buffer to be lazy so that it is only done immediately before it is actually
used.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoImplement read pipeline support in libssl
Matt Caswell [Tue, 12 Jan 2016 14:52:35 +0000 (14:52 +0000)]
Implement read pipeline support in libssl

Read pipelining is controlled in a slightly different way than with write
pipelining. While reading we are constrained by the number of records that
the peer (and the network) can provide to us in one go. The more records
we can get in one go the more opportunity we have to parallelise the
processing.

There are two parameters that affect this:
* The number of pipelines that we are willing to process in one go. This is
controlled by max_pipelines (as for write pipelining)
* The size of our read buffer. A subsequent commit will provide an API for
adjusting the size of the buffer.

Another requirement for this to work is that "read_ahead" must be set. The
read_ahead parameter will attempt to read as much data into our read buffer
as the network can provide. Without this set, data is read into the read
buffer on demand. Setting the max_pipelines parameter to a value greater
than 1 will automatically also turn read_ahead on.

Finally, the read pipelining as currently implemented will only parallelise
the processing of application data records. This would only make a
difference for renegotiation so is unlikely to have a significant impact.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoAdd dummy pipeline support for aes128_cbc_hmac_sha1
Matt Caswell [Fri, 27 Nov 2015 12:02:25 +0000 (12:02 +0000)]
Add dummy pipeline support for aes128_cbc_hmac_sha1

Add dummy pipline support to dasync for the aes128_cbc_hmac_sha1 cipher.
This is treated as an AEAD cipher.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoAdd pipeline support to s_server and s_client
Matt Caswell [Tue, 22 Sep 2015 10:23:33 +0000 (11:23 +0100)]
Add pipeline support to s_server and s_client

Add the options min_send_frag and max_pipelines to s_server and s_client
in order to control pipelining capabilities. This will only have an effect
if a pipeline capable cipher is used (such as the one provided by the
dasync engine).

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoImplement write pipeline support in libssl
Matt Caswell [Tue, 22 Sep 2015 10:12:50 +0000 (11:12 +0100)]
Implement write pipeline support in libssl

Use the new pipeline cipher capability to encrypt multiple records being
written out all in one go. Two new SSL/SSL_CTX parameters can be used to
control how this works: max_pipelines and split_send_fragment.

max_pipelines defines the maximum number of pipelines that can ever be used
in one go for a single connection. It must always be less than or equal to
SSL_MAX_PIPELINES (currently defined to be 32). By default only one
pipeline will be used (i.e. normal non-parallel operation).

split_send_fragment defines how data is split up into pipelines. The number
of pipelines used will be determined by the amount of data provided to the
SSL_write call divided by split_send_fragment. For example if
split_send_fragment is set to 2000 and max_pipelines is 4 then:
SSL_write called with 0-2000 bytes == 1 pipeline used
SSL_write called with 2001-4000 bytes == 2 pipelines used
SSL_write called with 4001-6000 bytes == 3 pipelines used
SSL_write_called with 6001+ bytes == 4 pipelines used

split_send_fragment must always be less than or equal to max_send_fragment.
By default it is set to be equal to max_send_fragment. This will mean that
the same number of records will always be created as would have been
created in the non-parallel case, although the data will be apportioned
differently. In the parallel case data will be spread equally between the
pipelines.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoUpdate the dasync engine to add a pipeline cipher
Matt Caswell [Tue, 22 Sep 2015 10:11:24 +0000 (11:11 +0100)]
Update the dasync engine to add a pipeline cipher

Implement aes128-cbc as a pipeline capable cipher in the dasync engine.
As dasync is just a dummy engine, it actually just performs the parallel
encrypts/decrypts in serial.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoAdd defines for pipeline capable ciphers
Matt Caswell [Tue, 22 Sep 2015 10:08:25 +0000 (11:08 +0100)]
Add defines for pipeline capable ciphers

Add a flag to indicate that a cipher is capable of performing
"pipelining", i.e. multiple encrypts/decrypts in parallel. Also add some
new ctrls that ciphers will need to implement if they are pipeline capable.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agomake update
Matt Caswell [Mon, 7 Mar 2016 20:21:16 +0000 (20:21 +0000)]
make update

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoTrim Travis config part 3
Emilia Kasper [Mon, 7 Mar 2016 14:15:20 +0000 (15:15 +0100)]
Trim Travis config part 3

- Only build & test two configurations. Make all the
  other build variants buildonly on gcc (clang on osx).
- Don't build with default clang at all on linux.
- Only use gcc-5 and clang-3.6 for the sanitizer builds. Re-running
  e.g. CONFIG_OPTS="shared" with them seems redundant.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRevert "Allow OPENSSL_NO_SOCK in e_os.h even for non-Windows/DOS platforms"
Rich Salz [Mon, 7 Mar 2016 20:32:18 +0000 (15:32 -0500)]
Revert "Allow OPENSSL_NO_SOCK in e_os.h even for non-Windows/DOS platforms"

This reverts commit 963bb62195109fb863dc4d88c7470ce7f9af25ac.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoFix pkeyutl to KDF lnks.
Rich Salz [Sat, 5 Mar 2016 06:13:58 +0000 (01:13 -0500)]
Fix pkeyutl to KDF lnks.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoRemove really old demo's
Rich Salz [Mon, 7 Mar 2016 19:55:44 +0000 (14:55 -0500)]
Remove really old demo's

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoElide OPENSSL_INIT_set_config_filename() for no-stdio build
David Woodhouse [Mon, 22 Feb 2016 16:44:46 +0000 (16:44 +0000)]
Elide OPENSSL_INIT_set_config_filename() for no-stdio build

Strictly speaking, it isn't stdio and file access which offend me here;
it's the fact that UEFI doesn't provide a strdup() function. But the
fact that it's pointless without file access is a good enough excuse for
compiling it out.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoElide DES_read_password() for no-ui build
David Woodhouse [Sun, 21 Feb 2016 16:19:44 +0000 (16:19 +0000)]
Elide DES_read_password() for no-ui build

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMove declaration of X509_aux_print() out of #ifndef OPENSSL_NO_STDIO
David Woodhouse [Sat, 20 Feb 2016 15:23:28 +0000 (15:23 +0000)]
Move declaration of X509_aux_print() out of #ifndef OPENSSL_NO_STDIO

This isn't a file access function; it's still present.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAllow OPENSSL_NO_SOCK in e_os.h even for non-Windows/DOS platforms
David Woodhouse [Sat, 20 Feb 2016 15:07:32 +0000 (15:07 +0000)]
Allow OPENSSL_NO_SOCK in e_os.h even for non-Windows/DOS platforms

UEFI needs this too. Don't keep it only in the Windows/DOS ifdef block.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoISSUE 43: Add BIO_sock_shutdown
Rich Salz [Wed, 2 Mar 2016 21:12:46 +0000 (16:12 -0500)]
ISSUE 43: Add BIO_sock_shutdown

This replaces SHUTDOWN/SHUTDOWN2 with BIO_closesocket.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoMinor update to includes and documentation for ct_test.c
Rob Percival [Mon, 7 Mar 2016 17:58:49 +0000 (17:58 +0000)]
Minor update to includes and documentation for ct_test.c

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRemove OPENSSL_NO_UNIT_TEST guard from ct_test.c
Rob Percival [Mon, 7 Mar 2016 17:58:14 +0000 (17:58 +0000)]
Remove OPENSSL_NO_UNIT_TEST guard from ct_test.c

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUse s->session->peer instead of calling SSL_get_peer_certificate(s)
Rob Percival [Mon, 7 Mar 2016 18:05:53 +0000 (18:05 +0000)]
Use s->session->peer instead of calling SSL_get_peer_certificate(s)

Avoids modifying certificate reference count, and thereby avoids locking.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoLowercase name of SSL_validate_ct as it is an internal function
Rob Percival [Mon, 7 Mar 2016 18:03:34 +0000 (18:03 +0000)]
Lowercase name of SSL_validate_ct as it is an internal function

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoCT code now calls X509_free() after calling SSL_get_peer_certificate()
Rob Percival [Mon, 7 Mar 2016 17:23:39 +0000 (17:23 +0000)]
CT code now calls X509_free() after calling SSL_get_peer_certificate()

Without this, the peer certificate would never be deleted, resulting in
a memory leak.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFixes memory leaks in CT code
Rob Percival [Mon, 7 Mar 2016 12:38:49 +0000 (12:38 +0000)]
Fixes memory leaks in CT code

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix the build tree include directory for afalg engine
Richard Levitte [Mon, 7 Mar 2016 17:58:25 +0000 (18:58 +0100)]
Fix the build tree include directory for afalg engine

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMake OpenSSL::Test::setup() a bit more forgiving
Richard Levitte [Sat, 5 Mar 2016 18:05:25 +0000 (19:05 +0100)]
Make OpenSSL::Test::setup() a bit more forgiving

It was unexpected that OpenSSL::Test::setup() should be called twice
by the same recipe.  However, that may happen if a recipe combines
OpenSSL::Test and OpenSSL::Test::Simple, which can be a sensible thing
to do.  Therefore, we now allow it.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoElide EVP_read_pw_string() and friends for no-ui
David Woodhouse [Sun, 21 Feb 2016 11:36:52 +0000 (11:36 +0000)]
Elide EVP_read_pw_string() and friends for no-ui

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoGH768: Minor grammar nits in CRYPTO_get_ex_new_index.pod
Benjamin Kaduk [Tue, 15 Dec 2015 22:23:51 +0000 (16:23 -0600)]
GH768: Minor grammar nits in CRYPTO_get_ex_new_index.pod

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoUnified - adapt the generation of padlock assembler to use GENERATE
Richard Levitte [Mon, 7 Mar 2016 14:50:52 +0000 (15:50 +0100)]
Unified - adapt the generation of padlock assembler to use GENERATE

This gets rid of the BEGINRAW..ENDRAW sections in engines/build.info.

This also moves the assembler generating perl scripts to take the
output file name as last command line argument, where necessary.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUnified - adapt the generation of bignum assembler to use GENERATE
Richard Levitte [Mon, 7 Mar 2016 14:41:33 +0000 (15:41 +0100)]
Unified - adapt the generation of bignum assembler to use GENERATE

This gets rid of the BEGINRAW..ENDRAW sections in crypto/bn/build.info.

This also moves the assembler generating perl scripts to take the
output file name as last command line argument, where necessary.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUnified - Add the build.info command OVERRIDE, to avoid build file clashes
Richard Levitte [Mon, 7 Mar 2016 13:50:37 +0000 (14:50 +0100)]
Unified - Add the build.info command OVERRIDE, to avoid build file clashes

Should it be needed because the recipes within a RAW section might
clash with those generated by Configure, it's possible to tell it
not to generate them with the use of OVERRIDES, for example:

    SOURCE[libfoo]=foo.c bar.c

    OVERRIDES=bar.o
    BEGINRAW[Makefile(unix)]
    bar.o: bar.c
        $(CC) $(CFLAGS) -DSPECIAL -c -o $@ $<
    ENDRAW[Makefile(unix)]

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUnified - Adapt the Unix and VMS templates to support GENERATE
Richard Levitte [Mon, 7 Mar 2016 13:38:54 +0000 (14:38 +0100)]
Unified - Adapt the Unix and VMS templates to support GENERATE

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUnified - Add the build.info command GENERATE, to generate source files
Richard Levitte [Mon, 7 Mar 2016 13:37:00 +0000 (14:37 +0100)]
Unified - Add the build.info command GENERATE, to generate source files

In some cases, one might want to generate some source files from
others, that's done as follows:

    GENERATE[foo.s]=asm/something.pl $(CFLAGS)
    GENERATE[bar.s]=asm/bar.S

The value of each GENERATE line is a command line or part of it.
Configure places no rules on the command line, except the the first
item muct be the generator file.  It is, however, entirely up to the
build file template to define exactly how those command lines should
be handled, how the output is captured and so on.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd a function to detect if we have async or not
Matt Caswell [Mon, 7 Mar 2016 16:55:39 +0000 (16:55 +0000)]
Add a function to detect if we have async or not

Add the ASYNC_is_capable() function and use it in speed.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGH804: Fix unused-result warnings in dasync
Alessandro Ghedini [Mon, 7 Mar 2016 12:27:52 +0000 (12:27 +0000)]
GH804: Fix unused-result warnings in dasync

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agodocumentation and duplicate goto statements
Billy Brumley [Mon, 29 Feb 2016 20:35:35 +0000 (22:35 +0200)]
documentation and duplicate goto statements

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agomove ifdef statements
Billy Brumley [Mon, 29 Feb 2016 19:01:47 +0000 (21:01 +0200)]
move ifdef statements

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoNIST SP800-56A co-factor ECDH KATs
Billy Brumley [Mon, 29 Feb 2016 14:23:00 +0000 (16:23 +0200)]
NIST SP800-56A co-factor ECDH KATs

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRemove use of CRYPTO_LOCK_INIT in init code
Matt Caswell [Mon, 7 Mar 2016 14:39:22 +0000 (14:39 +0000)]
Remove use of CRYPTO_LOCK_INIT in init code

Swap the use of CRYPTO_LOCK_INIT in the init code to use the new threading
API mechanism for locking.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoSwap the init code to use the new Thread API thread locals
Matt Caswell [Wed, 2 Mar 2016 15:23:57 +0000 (15:23 +0000)]
Swap the init code to use the new Thread API thread locals

The init code was using its own thread local code. Now we have a central
API for it we should use that instead.

Reviewed-by: Richard Levitte <levitte@openssl.org>