aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-03-07Add an SSL_has_pending() functionMatt Caswell6-4/+444
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>
2016-03-07Add an ability to set the SSL read buffer sizeMatt Caswell10-10/+53
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>
2016-03-07Lazily initialise the compression bufferMatt Caswell6-31/+9
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>
2016-03-07Implement read pipeline support in libsslMatt Caswell6-312/+472
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>
2016-03-07Add dummy pipeline support for aes128_cbc_hmac_sha1Matt Caswell3-10/+221
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>
2016-03-07Add pipeline support to s_server and s_clientMatt Caswell2-2/+68
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>
2016-03-07Implement write pipeline support in libsslMatt Caswell11-240/+471
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>
2016-03-07Update the dasync engine to add a pipeline cipherMatt Caswell7-71/+275
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>
2016-03-07Add defines for pipeline capable ciphersMatt Caswell1-0/+9
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>
2016-03-07make updateMatt Caswell1-2/+3
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-07Trim Travis config part 3Emilia Kasper1-12/+5
- 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>
2016-03-07Revert "Allow OPENSSL_NO_SOCK in e_os.h even for non-Windows/DOS platforms"Rich Salz1-1/+4
This reverts commit 963bb62195109fb863dc4d88c7470ce7f9af25ac. Reviewed-by: Tim Hudson <tjh@openssl.org>
2016-03-07Fix pkeyutl to KDF lnks.Rich Salz2-2/+2
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2016-03-07Remove really old demo'sRich Salz60-11367/+0
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-07Elide OPENSSL_INIT_set_config_filename() for no-stdio buildDavid Woodhouse2-0/+4
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>
2016-03-07Elide DES_read_password() for no-ui buildDavid Woodhouse2-0/+5
Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-07Move declaration of X509_aux_print() out of #ifndef OPENSSL_NO_STDIODavid Woodhouse1-1/+1
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>
2016-03-07Allow OPENSSL_NO_SOCK in e_os.h even for non-Windows/DOS platformsDavid Woodhouse1-4/+1
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>
2016-03-07ISSUE 43: Add BIO_sock_shutdownRich Salz7-25/+15
This replaces SHUTDOWN/SHUTDOWN2 with BIO_closesocket. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-07Minor update to includes and documentation for ct_test.cRob Percival1-2/+2
Reviewed-by: Emilia Käsper <emilia@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-07Remove OPENSSL_NO_UNIT_TEST guard from ct_test.cRob Percival1-1/+1
Reviewed-by: Emilia Käsper <emilia@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-07Use s->session->peer instead of calling SSL_get_peer_certificate(s)Rob Percival1-4/+2
Avoids modifying certificate reference count, and thereby avoids locking. Reviewed-by: Emilia Käsper <emilia@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-07Lowercase name of SSL_validate_ct as it is an internal functionRob Percival3-3/+3
Reviewed-by: Emilia Käsper <emilia@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-07CT code now calls X509_free() after calling SSL_get_peer_certificate()Rob Percival1-0/+2
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>
2016-03-07Fixes memory leaks in CT codeRob Percival2-6/+6
Reviewed-by: Emilia Käsper <emilia@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-07Fix the build tree include directory for afalg engineRichard Levitte1-1/+1
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-07Make OpenSSL::Test::setup() a bit more forgivingRichard Levitte1-2/+8
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>
2016-03-07Elide EVP_read_pw_string() and friends for no-uiDavid Woodhouse3-1/+5
Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2016-03-07GH768: Minor grammar nits in CRYPTO_get_ex_new_index.podBenjamin Kaduk1-4/+5
Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2016-03-07Unified - adapt the generation of padlock assembler to use GENERATERichard Levitte2-8/+4
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>
2016-03-07Unified - adapt the generation of bignum assembler to use GENERATERichard Levitte15-91/+115
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>
2016-03-07Unified - Add the build.info command OVERRIDE, to avoid build file clashesRichard Levitte3-1/+25
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>
2016-03-07Unified - Adapt the Unix and VMS templates to support GENERATERichard Levitte2-0/+52
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-07Unified - Add the build.info command GENERATE, to generate source filesRichard Levitte4-14/+80
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>
2016-03-07Add a function to detect if we have async or notMatt Caswell6-33/+46
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>
2016-03-07GH804: Fix unused-result warnings in dasyncAlessandro Ghedini1-2/+4
Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-03-07documentation and duplicate goto statementsBilly Brumley2-4/+32
Reviewed-by: Kurt Roeckx <kurt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-07move ifdef statementsBilly Brumley2-3/+3
Reviewed-by: Kurt Roeckx <kurt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-07NIST SP800-56A co-factor ECDH KATsBilly Brumley2-2/+4407
Reviewed-by: Kurt Roeckx <kurt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-07Remove use of CRYPTO_LOCK_INIT in init codeMatt Caswell3-6/+9
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>
2016-03-07Swap the init code to use the new Thread API thread localsMatt Caswell1-97/+11
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>
2016-03-07Swap the init code to use CRYPTO_ONCEMatt Caswell2-215/+93
The init code was using its own "once" implementation. Now that we have the new thread API we should use that instead. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-07make updateDr. Stephen Henson1-2/+2
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-07Update documentationDr. Stephen Henson1-23/+0
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-07Make PKCS8_PRIV_KEY_INFO opaque.Dr. Stephen Henson10-151/+57
Make PKCS8_PRIV_KEY_INFO opaque. Several accessor functions already exist for this structure. Two new ones were added to handle attributes. The old handling of broken formats has been removed and the corresponding structures simplified. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-07Add support to ASYNC_WAIT_CTX to speedAndrea Grandi1-18/+97
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-03-07Remove unnecessary memset() to 0 and check for NULL before OPENSSL_free()Andrea Grandi1-25/+7
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-03-07Fix the error with RSA and the daysnc engine in async mode.Andrea Grandi1-152/+211
Move RSA struct in the job local struct. The change is applied also to other crypto operations (e.g. DSA) to make things consistent. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-03-07Add support for async jobs in OpenSSL speedAndrea Grandi1-454/+1064
Summary of the changes: * Move the calls to the crypto operations inside wrapper functions. This is required because ASYNC_start_job takes a function as an argument. * Add new function run_benchmark() that manages the jobs for all the operations. In the POSIX case it uses a select() to receive the events from the engine and resume the jobs that are paused, while in the WIN case it uses PeekNamedPipe() * Add new option argument async_jobs to enable and specify the number of async jobs Example: openssl speed -engine dasync -elapsed -async_jobs 32 rsa2048 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-03-07Rework the default cipherlist.Emilia Kasper4-65/+127
- Always prefer forward-secure handshakes. - Consistently order ECDSA above RSA. - Next, always prefer AEADs to non-AEADs, irrespective of strength. - Within AEADs, prefer GCM > CHACHA > CCM for a given strength. - Prefer TLS v1.2 ciphers to legacy ciphers. - Remove rarely used DSS, IDEA, SEED, CAMELLIA, CCM from the default list to reduce ClientHello bloat. Reviewed-by: Rich Salz <rsalz@openssl.org>