oweals/openssl.git
8 years agoClean up the VMS hacks in crypto/rand/randfile.c
Richard Levitte [Fri, 20 May 2016 13:18:22 +0000 (15:18 +0200)]
Clean up the VMS hacks in crypto/rand/randfile.c

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoVMS: setbuf() only takes 32-bit pointers
Richard Levitte [Fri, 20 May 2016 09:12:15 +0000 (11:12 +0200)]
VMS: setbuf() only takes 32-bit pointers

Giving setbuf() a 64-bit pointer isn't faulty, as the argument is
passed by a 64-bit register anyway, so you only get a warning
(MAYLOSEDATA2) pointing out that only the least significant 32 bits
will be used.

However, we know that a FILE* returned by fopen() and such really is a
32-bit pointer (a study of the system header files make that clear),
so we temporarly turn off that warning when calling setbuf().

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoAdd an async io test
Matt Caswell [Thu, 12 May 2016 15:04:10 +0000 (16:04 +0100)]
Add an async io test

This adds an async IO test. There are two test runs. The first one does
a normal handshake with lots of async IO events. The second one does the
same but this time breaks up all the written records into multiple records
of one byte in length. We do this all the way up until the CCS.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoEnsure async IO works with new state machine
Matt Caswell [Thu, 12 May 2016 16:18:32 +0000 (17:18 +0100)]
Ensure async IO works with new state machine

In the new state machine if using nbio and we get the header of a
handshake message is one record with the body in the next, with an nbio
event in the middle, then the connection was failing. This is because
s->init_num was getting reset. We should only reset it after we have
read the whole message.

RT#4394

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoTighten up logic around ChangeCipherSpec.
David Benjamin [Sun, 6 Mar 2016 03:50:44 +0000 (22:50 -0500)]
Tighten up logic around ChangeCipherSpec.

ChangeCipherSpec messages have a defined value. They also may not occur
in the middle of a handshake message. The current logic will accept a
ChangeCipherSpec with value 2. It also would accept up to three bytes of
handshake data before the ChangeCipherSpec which it would discard
(because s->init_num gets reset).

Instead, require that s->init_num is 0 when a ChangeCipherSpec comes in.

RT#4391

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoSimplify SSL BIO buffering logic
Matt Caswell [Tue, 17 May 2016 11:28:14 +0000 (12:28 +0100)]
Simplify SSL BIO buffering logic

The write BIO for handshake messages is bufferred so that we only write
out to the network when we have a complete flight. There was some
complexity in the buffering logic so that we switched buffering on and
off at various points through out the handshake. The only real reason to
do this was historically it complicated the state machine when you wanted
to flush because you had to traverse through the "flush" state (in order
to cope with NBIO). Where we knew up front that there was only going to
be one message in the flight we switched off buffering to avoid that.

In the new state machine there is no longer a need for a flush state so
it is simpler just to have buffering on for the whole handshake. This
also gives us the added benefit that we can simply call flush after every
flight even if it only has one message in it. This means that BIO authors
can implement their own buffering strategies and not have to be aware of
the state of the SSL object (previously they would have to switch off
their own buffering during the handshake because they could not rely on
a flush being received when they really needed to write data out). This
last point addresses GitHub Issue #322.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoFixup READLINE case
Richard Levitte [Fri, 20 May 2016 08:13:14 +0000 (10:13 +0200)]
Fixup READLINE case

RT#4543

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoFix nits in pod files.
Rich Salz [Fri, 20 May 2016 12:11:46 +0000 (08:11 -0400)]
Fix nits in pod files.

Add doc-nit-check to help find future issues.
Make podchecker be almost clean.
Remove trailing whitespace.
Tab expansion

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUse the process_docs script to install docs on Windows and VMS
Richard Levitte [Thu, 19 May 2016 14:33:58 +0000 (16:33 +0200)]
Use the process_docs script to install docs on Windows and VMS

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoDocumentation processor in perl, for platforms that don't have sh
Richard Levitte [Thu, 19 May 2016 13:41:04 +0000 (15:41 +0200)]
Documentation processor in perl, for platforms that don't have sh

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUse correct EOL in headers.
Dr. Stephen Henson [Thu, 19 May 2016 16:22:57 +0000 (17:22 +0100)]
Use correct EOL in headers.

RT#1817

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMove Haiku configuration to separate config file to denote
Andy Polyakov [Sun, 1 May 2016 12:33:19 +0000 (14:33 +0200)]
Move Haiku configuration to separate config file to denote
the fact that it's community-supported target.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd assembly CRYPTO_memcmp.
Andy Polyakov [Sun, 15 May 2016 15:01:15 +0000 (17:01 +0200)]
Add assembly CRYPTO_memcmp.

GH: #102

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agorand/randfile.c: remove _XOPEN_SOURCE definition.
Andy Polyakov [Mon, 16 May 2016 14:44:33 +0000 (16:44 +0200)]
rand/randfile.c: remove _XOPEN_SOURCE definition.

Defintions of macros similar to _XOPEN_SOURCE belong in command line
or in worst case prior first #include directive in source. As for
macros is was allegedly controlling. One can argue that we are
probably better off demanding S_IS* macros but there are systems
that just don't comply, hence this compromise solution...

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoCheck that the obtained public key is valid
Matt Caswell [Mon, 25 Apr 2016 15:44:19 +0000 (16:44 +0100)]
Check that the obtained public key is valid

In the X509 app check that the obtained public key is valid before we
attempt to use it.

Issue reported by Yuan Jochen Kang.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoAdd copyright
Rich Salz [Thu, 19 May 2016 15:31:29 +0000 (11:31 -0400)]
Add copyright

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd copyright to manpages
Rich Salz [Wed, 18 May 2016 15:44:05 +0000 (11:44 -0400)]
Add copyright to manpages

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRemove needless license terms (for docs)
Rich Salz [Wed, 18 May 2016 14:18:54 +0000 (10:18 -0400)]
Remove needless license terms (for docs)

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoEnsure =cut is last line in every file.
Rich Salz [Wed, 18 May 2016 14:16:40 +0000 (10:16 -0400)]
Ensure =cut is last line in every file.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agook was uninitialised on failure.
Ben Laurie [Wed, 18 May 2016 16:20:07 +0000 (17:20 +0100)]
ok was uninitialised on failure.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoWhen strict SCT fails record verification failure
Viktor Dukhovni [Fri, 13 May 2016 04:36:56 +0000 (00:36 -0400)]
When strict SCT fails record verification failure

Since with SSL_VERIFY_NONE, the connection may continue and the
session may even be cached, we should save some evidence that the
chain was not sufficiently verified and would have been rejected
with SSL_VERIFY_PEER.  To that end when a CT callback returs failure
we set the verify result to X509_V_ERR_NO_VALID_SCTS.

Note: We only run the CT callback in the first place if the verify
result is still X509_V_OK prior to start of the callback.

RT #4502

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agomake update
Viktor Dukhovni [Sun, 24 Apr 2016 23:50:45 +0000 (19:50 -0400)]
make update

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoImprove and document low-level PEM read routines
Viktor Dukhovni [Sun, 24 Apr 2016 23:48:50 +0000 (19:48 -0400)]
Improve and document low-level PEM read routines

PEM_read(), PEM_read_bio(), PEM_get_EVP_CIPHER_INFO() and
PEM_do_header().

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoFixes non __GNUC__ compilation
Mat [Wed, 18 May 2016 21:30:52 +0000 (23:30 +0200)]
Fixes non __GNUC__ compilation

adds missing check for defined(__GNUC__)
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1094)

8 years agoFix SRP client key computation
Cynh [Sun, 1 May 2016 13:59:43 +0000 (15:59 +0200)]
Fix SRP client key computation

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matt Caswell <matt@openssl.org>
GH: #1017

8 years agoSmall typo, a tab where there should have been a space
Richard Levitte [Wed, 18 May 2016 20:15:30 +0000 (22:15 +0200)]
Small typo, a tab where there should have been a space

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoCleanup openssl.ec
Richard Levitte [Wed, 18 May 2016 19:11:42 +0000 (21:11 +0200)]
Cleanup openssl.ec

STORE doesn't exist for now

HMAC doesn't have any error codes

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix util/mkerr.pl
Richard Levitte [Wed, 18 May 2016 17:52:34 +0000 (19:52 +0200)]
Fix util/mkerr.pl

- Adjust mkerr.pl to produce the line length we used for source
  reformating.

- Have mkerr.pl keep track of preprocessor directive indentation

  Among others, do not spuriously throw away a #endif at the end of
  header files.

- Make sure mkerr.pl specifies any header inclusion correctly

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoEnsure verify error is set when X509_verify_cert() fails
Viktor Dukhovni [Tue, 17 May 2016 17:40:57 +0000 (13:40 -0400)]
Ensure verify error is set when X509_verify_cert() fails

Set ctx->error = X509_V_ERR_OUT_OF_MEM when verificaiton cannot
continue due to malloc failure.  Also, when X509_verify_cert()
returns <= 0 make sure that the verification status does not remain
X509_V_OK, as a last resort set it it to X509_V_ERR_UNSPECIFIED,
just in case some code path returns an error without setting an
appropriate value of ctx->error.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoClarify negative return from X509_verify_cert()
Viktor Dukhovni [Tue, 17 May 2016 01:38:03 +0000 (21:38 -0400)]
Clarify negative return from X509_verify_cert()

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoMake OPENSSL_die as noreturn
hesiod [Wed, 18 May 2016 17:34:27 +0000 (13:34 -0400)]
Make OPENSSL_die as noreturn

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

8 years agoDocument the esc_2254 command line name option
Richard Levitte [Wed, 18 May 2016 15:39:33 +0000 (17:39 +0200)]
Document the esc_2254 command line name option

RT#1466

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agomake update
Richard Levitte [Wed, 18 May 2016 15:33:53 +0000 (17:33 +0200)]
make update

RT#1466

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMake it possible to have RFC2254 escapes with ASN1_STRING_print_ex()
Richard Levitte [Wed, 18 May 2016 15:14:19 +0000 (17:14 +0200)]
Make it possible to have RFC2254 escapes with ASN1_STRING_print_ex()

Also adds 'esc_2254' to the possible command line name options

RT#1466

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoOID code tidy up.
Dr. Stephen Henson [Wed, 18 May 2016 13:32:16 +0000 (14:32 +0100)]
OID code tidy up.

Tidy up and simplify OBJ_dup() and OBJ_create().

Sanity check added OIDs: don't allow duplicates.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoConsolidate copyright for demos
Rich Salz [Wed, 18 May 2016 13:16:36 +0000 (09:16 -0400)]
Consolidate copyright for demos

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd some error messages for malloc fails
Matt Caswell [Tue, 17 May 2016 14:08:43 +0000 (15:08 +0100)]
Add some error messages for malloc fails

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoBetter checks for malloc failure in various METHOD functions
Matt Caswell [Wed, 4 May 2016 10:28:38 +0000 (11:28 +0100)]
Better checks for malloc failure in various METHOD functions

A number of the METHOD functions weren't properly handling malloc failures.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix some malloc failures in b_addr.c
Matt Caswell [Wed, 4 May 2016 10:14:48 +0000 (11:14 +0100)]
Fix some malloc failures in b_addr.c

There were some unchecked calls to OPENSSL_strdup().

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd some check for malloc failure in the CAPI engine
Matt Caswell [Wed, 4 May 2016 09:49:06 +0000 (10:49 +0100)]
Add some check for malloc failure in the CAPI engine

In the CAPI engine there were some unchecked calls to OPENSSL_strdup().

GH Issue #830

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix ts app help message
FdaSilvaYY [Tue, 10 May 2016 21:39:25 +0000 (23:39 +0200)]
Fix ts app help message

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoLocally declare some variables
FdaSilvaYY [Tue, 10 May 2016 21:39:05 +0000 (23:39 +0200)]
Locally declare some variables

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoFew cleanups in s_client, s_server apps.
FdaSilvaYY [Fri, 18 Mar 2016 18:02:17 +0000 (19:02 +0100)]
Few cleanups in s_client, s_server apps.

Discard useless static engine_id
Add a const qualifier
Fix some spelling

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoFix a NULL dereference in chacha20_poly1305_init_key()
Kazuki Yamaguchi [Tue, 10 May 2016 10:46:08 +0000 (19:46 +0900)]
Fix a NULL dereference in chacha20_poly1305_init_key()

chacha20_poly1305_init_key() dereferences NULL when called with inkey !=
NULL && iv == NULL. This function is called by EVP_EncryptInit_ex()
family, whose documentation allows setting key and iv in separate calls.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoManual fixes after copyright consolidation
Rich Salz [Tue, 17 May 2016 21:38:18 +0000 (17:38 -0400)]
Manual fixes after copyright consolidation

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoX509_STORE_CTX accessors.
Rich Salz [Tue, 17 May 2016 20:06:09 +0000 (16:06 -0400)]
X509_STORE_CTX accessors.

Add some functions that were missing when a number of X509
objects became opaque (thanks, Roumen!)

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoCopyright consolidation 05/10
Rich Salz [Tue, 17 May 2016 19:38:09 +0000 (15:38 -0400)]
Copyright consolidation 05/10

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoCopyright consolidation 09/10
Rich Salz [Tue, 17 May 2016 18:52:22 +0000 (14:52 -0400)]
Copyright consolidation 09/10

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoCopyright consolidation 08/10
Rich Salz [Tue, 17 May 2016 18:51:34 +0000 (14:51 -0400)]
Copyright consolidation 08/10

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoCopyright consolidation 07/10
Rich Salz [Tue, 17 May 2016 18:51:26 +0000 (14:51 -0400)]
Copyright consolidation 07/10

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoCopyright consolidation 06/10
Rich Salz [Tue, 17 May 2016 18:51:04 +0000 (14:51 -0400)]
Copyright consolidation 06/10

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoCopyright consolidation 04/10
Rich Salz [Tue, 17 May 2016 18:24:46 +0000 (14:24 -0400)]
Copyright consolidation 04/10

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoCopyright consolidation 03/10
Rich Salz [Tue, 17 May 2016 18:24:17 +0000 (14:24 -0400)]
Copyright consolidation 03/10

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoCopyright consolidation 02/10
Rich Salz [Tue, 17 May 2016 18:20:24 +0000 (14:20 -0400)]
Copyright consolidation 02/10

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoCopyright consolidation 01/10
Rich Salz [Tue, 17 May 2016 18:18:30 +0000 (14:18 -0400)]
Copyright consolidation 01/10

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoAdd a comment to explain the use of |num_recs|
Matt Caswell [Tue, 17 May 2016 14:27:09 +0000 (15:27 +0100)]
Add a comment to explain the use of |num_recs|

In the SSLV2ClientHello processing code in ssl3_get_record, the value of
|num_recs| will always be 0. This isn't obvious from the code so a comment
is added to explain it.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoFix RSA dasync engine bug
Matt Caswell [Tue, 26 Apr 2016 15:28:26 +0000 (16:28 +0100)]
Fix RSA dasync engine bug

When RSA went opaque a bug was introduced into the dasync engine where
the wrong function was being set for the rsa_priv_dec operation.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoUse the current record offset in ssl3_get_record
Matt Caswell [Tue, 26 Apr 2016 15:07:17 +0000 (16:07 +0100)]
Use the current record offset in ssl3_get_record

The function ssl3_get_record() can obtain multiple records in one go
as long as we are set up for pipelining and all the records are app
data records. The logic in the while loop which reads in each record is
supposed to only continue looping if the last record we read was app data
and we have an app data record waiting in the buffer to be processed. It
was actually checking that the first record had app data and we have an
app data record waiting. This actually amounts to the same thing so wasn't
wrong - but it looks a bit odd because it uses the |rr| array without an
offset.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoThere is only one read buffer
Matt Caswell [Tue, 26 Apr 2016 15:00:09 +0000 (16:00 +0100)]
There is only one read buffer

Pipelining introduced the concept of multiple records being read in one
go. Therefore we work with an array of SSL3_RECORD objects. The pipelining
change erroneously made a change in ssl3_get_record() to apply the current
record offset to the SSL3_BUFFER we are using for reading. This is wrong -
there is only ever one read buffer. This reverts that change. In practice
this should make little difference because the code block in question is
only ever used when we are processing a single record.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoFix typos in apps/enc.c
Kurt Cancemi [Tue, 17 May 2016 05:47:28 +0000 (01:47 -0400)]
Fix typos in apps/enc.c
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoFix some out of date comments
Matt Caswell [Tue, 17 May 2016 10:51:00 +0000 (11:51 +0100)]
Fix some out of date comments

Fix various references to s3_clnt.c and s3_srvr.c which don't exist
any more.

GitHub Issue #765

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRemove repeated condition from if in X509_NAME_oneline
Matt Caswell [Tue, 17 May 2016 10:07:27 +0000 (11:07 +0100)]
Remove repeated condition from if in X509_NAME_oneline

An if checks the value of |type| to see if it is V_ASN1_VISIBLESTRING
twice. We only need to do it once.

GitHub Issue #656

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoCorrect documentation error
Matt Caswell [Mon, 16 May 2016 21:50:12 +0000 (22:50 +0100)]
Correct documentation error

SSL_get_async_wait_fd() was replaced by SSL_get_all_async_fds() and
SSL_get_changed_async_fds().

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agotest/evp_test.c: exercise in-place encryption.
Andy Polyakov [Mon, 9 May 2016 12:18:14 +0000 (14:18 +0200)]
test/evp_test.c: exercise in-place encryption.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoARMv8 assembly pack: add OPENSSL_cleanse.
Andy Polyakov [Sun, 15 May 2016 13:37:46 +0000 (15:37 +0200)]
ARMv8 assembly pack: add OPENSSL_cleanse.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRemove an unneccessary check of cipher
Matt Caswell [Mon, 16 May 2016 13:56:53 +0000 (14:56 +0100)]
Remove an unneccessary check of cipher

Due to short-circuiting we only need to check "cipher" for NULL once.

PR#699

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUse OPENSSL_hexchar2int
Rich Salz [Thu, 12 May 2016 19:52:58 +0000 (15:52 -0400)]
Use OPENSSL_hexchar2int

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUse app_malloc; two missing cases.
Rich Salz [Mon, 16 May 2016 18:58:00 +0000 (14:58 -0400)]
Use app_malloc; two missing cases.

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoconst correctness: make HMAC_size() take a const *
Steffan Karger [Sat, 14 May 2016 09:02:46 +0000 (11:02 +0200)]
const correctness: make HMAC_size() take a const *

CLA: none; trivial

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #1070

8 years agosession tickets: use more sizeof
Kurt Roeckx [Wed, 2 Mar 2016 13:39:14 +0000 (14:39 +0100)]
session tickets: use more sizeof

Reviewed-by: Matt Caswell <matt@openssl.org>
MR: #2153

8 years agoUse AES256 for the default encryption algoritm for TLS session tickets
TJ Saunders [Sat, 27 Feb 2016 18:37:34 +0000 (19:37 +0100)]
Use AES256 for the default encryption algoritm for TLS session tickets

This involves providing more session ticket key data, for both the cipher and
the digest

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matt Caswell <matt@openssl.org>
GH: #515, MR: #2153

8 years agosession tickets: Use sizeof() for the various fields
TJ Saunders [Sat, 27 Feb 2016 18:36:00 +0000 (19:36 +0100)]
session tickets: Use sizeof() for the various fields

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matt Caswell <matt@openssl.org>
GH: #515, MR: #2153

8 years agoDon't load same config file twice.
Dr. Stephen Henson [Sun, 15 May 2016 17:43:03 +0000 (18:43 +0100)]
Don't load same config file twice.

RT#4215

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoDocumentation: Clarify sizes for UI_add_input_string()
Richard Levitte [Mon, 16 May 2016 13:39:50 +0000 (15:39 +0200)]
Documentation: Clarify sizes for UI_add_input_string()

The given sizes to not include the final NUL character.

RT#2622

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoWorkaround an IO::Socket::IP bug
Matt Caswell [Mon, 16 May 2016 15:54:28 +0000 (16:54 +0100)]
Workaround an IO::Socket::IP bug

Workaround an apparent IO:Socket::IP bug where a seemingly valid
server socket is being returned even though a valid connection does not
exist. This causes the tests to intermittently hang. We additionally check
that the peerport looks ok to verify that the returned socket looks usable.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFold threads.h into crypto.h making API public
Viktor Dukhovni [Sun, 15 May 2016 17:02:17 +0000 (13:02 -0400)]
Fold threads.h into crypto.h making API public

Document thread-safe lock creation

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoDon't require any length of password when decrypting
Richard Levitte [Mon, 16 May 2016 15:29:43 +0000 (17:29 +0200)]
Don't require any length of password when decrypting

RT#2534

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoAdd support for RC / WINDRES env variables
Richard Levitte [Mon, 16 May 2016 15:08:13 +0000 (17:08 +0200)]
Add support for RC / WINDRES env variables

RT#2558

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoAdd missing initialiser in e_chil.c
Richard Levitte [Mon, 16 May 2016 13:47:58 +0000 (15:47 +0200)]
Add missing initialiser in e_chil.c

RT#2616

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agodo not remove links found in .git directory
Cristian Stoica [Mon, 16 May 2016 13:10:24 +0000 (16:10 +0300)]
do not remove links found in .git directory

Some setups use links inside .git directory and make clean should not
remove them to avoid breaking git meta-information.

Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
CLA: none; trivial
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1078)

8 years agoWindows: Add CRYPT32.LIB to the libraries to link you app with
Richard Levitte [Thu, 12 May 2016 20:32:12 +0000 (22:32 +0200)]
Windows: Add CRYPT32.LIB to the libraries to link you app with

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

8 years agoDo not access SSL struct directly in TLS1_get_version and TLS1_get_client_version...
Alessandro Ghedini [Mon, 9 May 2016 11:59:26 +0000 (12:59 +0100)]
Do not access SSL struct directly in TLS1_get_version and TLS1_get_client_version macros

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoAdd SSL_client_version() getter function
Alessandro Ghedini [Mon, 9 May 2016 11:58:01 +0000 (12:58 +0100)]
Add SSL_client_version() getter function

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoAdd some documentation of SSL_CTX_set_tlsext_status_type()
Matt Caswell [Fri, 6 May 2016 09:19:35 +0000 (10:19 +0100)]
Add some documentation of SSL_CTX_set_tlsext_status_type()

The previous commit added SSL_CTX_set_tlsext_status_type(). This one adds
some documentation for it.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoPropagate tlsext_status_type from SSL_CTX to SSL
jfigus [Tue, 2 Dec 2014 20:44:49 +0000 (15:44 -0500)]
Propagate tlsext_status_type from SSL_CTX to SSL

To allow OCSP stapling to work with libcurl.

Github PR #200

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoFix NPN protocol name list validation
Kazuki Yamaguchi [Sat, 12 Dec 2015 15:51:06 +0000 (00:51 +0900)]
Fix NPN protocol name list validation

Since 50932c4 "PACKETise ServerHello processing",
ssl_next_proto_validate() incorrectly allows empty protocol name.
draft-agl-tls-nextprotoneg-04[1] says "Implementations MUST ensure that
the empty string is not included and that no byte strings are
truncated."
This patch restores the old correct behavior.

[1] https://tools.ietf.org/html/draft-agl-tls-nextprotoneg-04

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoUnify <TYPE>_up_ref methods signature and behaviour.
FdaSilvaYY [Mon, 7 Mar 2016 21:45:58 +0000 (22:45 +0100)]
Unify <TYPE>_up_ref methods signature and behaviour.

Add a status return value instead of void.
Add some sanity checks on reference counter value.
Update the docs.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoSmall MSVC build fixes.
Richard Levitte [Mon, 16 May 2016 07:48:15 +0000 (09:48 +0200)]
Small MSVC build fixes.

- "/Ox /O2 /Ob2" get's reduced to "/O2", the reason being:

    /Ox = /Ob2 /Og /Oi /Ot /Oy /Gs
    /O2 = /Ob2 /Og /Oi /Ot /Oy /Gs /GF /Gy

- apps/openssl.cnf gets installed.

- always delete files quietly, as they might not be there.

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

8 years agoFix some missing OBJ_dup failure checks.
FdaSilvaYY [Wed, 11 May 2016 22:29:22 +0000 (00:29 +0200)]
Fix some missing OBJ_dup failure checks.

Fix some missing OBJ_dup failure checks.
Merged from
https://boringssl.googlesource.com/boringssl/+/0ce78a757d815c0dde9ed5884229f3a5b2cb3e9c%5E!

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

8 years agoopenssl_{startup,shutdown}.com.in are in the source directory
Richard Levitte [Sat, 14 May 2016 08:51:58 +0000 (10:51 +0200)]
openssl_{startup,shutdown}.com.in are in the source directory

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix various methods declaration in pod file
FdaSilvaYY [Mon, 9 May 2016 16:48:13 +0000 (18:48 +0200)]
Fix various methods declaration in pod file

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

8 years agoIncrement size limit for ClientHello messages
Alessandro Ghedini [Fri, 25 Sep 2015 15:53:58 +0000 (17:53 +0200)]
Increment size limit for ClientHello messages

The current limit of 2^14 bytes is too low (e.g. RFC 5246 specifies the
maximum size of just the extensions field to be 2^16-1), and may cause
bogus failures.

RT#4063

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

8 years agoFix engine cryptodev: pointer to IV
Kirill Marinushkin [Thu, 5 May 2016 18:51:07 +0000 (20:51 +0200)]
Fix engine cryptodev: pointer to IV

Currently point to wrong address

Signed-off-by: Kirill Marinushkin <k.marinushkin@gmail.com>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix OpenSSL_memdup error handling
Insu Yun [Thu, 5 May 2016 15:39:16 +0000 (11:39 -0400)]
Fix OpenSSL_memdup error handling

check source's kdf_ukm, not destination's

use != NULL, instead of implicit checking

don't free internal data structure like pkey_rsa_copy()

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoVMS perl: Fix glob output
Richard Levitte [Fri, 13 May 2016 09:21:06 +0000 (11:21 +0200)]
VMS perl: Fix glob output

In some cases, perl's glob() thinks it needs to return file names with
generation numbers, such as when a file name pattern includes two
periods.  Constructing other file names by simple appending to file
names with generation numbers isn't a good idea, so for the VMS case,
just peal the generation numbers if they are there.
Fortunately, this is easy, as the returned generation number delimiter
will always be a semi-colon.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd some additional NewSessionTicket tests
Matt Caswell [Wed, 11 May 2016 11:32:12 +0000 (12:32 +0100)]
Add some additional NewSessionTicket tests

If the server does not send a session ticket extension, it should not then
send the NewSessionTicket message.

If the server sends the session ticket extension, it MUST then send the
NewSessionTicket message.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoThe NewSessionTicket message is not optional.
David Benjamin [Sun, 6 Mar 2016 00:35:52 +0000 (19:35 -0500)]
The NewSessionTicket message is not optional.

Per RFC 4507, section 3.3:

   This message [NewSessionTicket] MUST be sent if the
   server included a SessionTicket extension in the ServerHello.  This
   message MUST NOT be sent if the server did not include a
   SessionTicket extension in the ServerHello.

The presence of the NewSessionTicket message should be determined
entirely from the ServerHello without probing.

RT#4389

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoFix stack constification definitions.
Dr. Stephen Henson [Fri, 13 May 2016 11:23:52 +0000 (12:23 +0100)]
Fix stack constification definitions.

RT#4471

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoCorrect documentation on digest used.
Dr. Stephen Henson [Thu, 12 May 2016 14:02:04 +0000 (15:02 +0100)]
Correct documentation on digest used.

RT#4302

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoFix signer option and support format SMIME.
Dr. Stephen Henson [Thu, 12 May 2016 16:13:50 +0000 (17:13 +0100)]
Fix signer option and support format SMIME.

Fix -signer option in smime utility to output signer certificates
when verifying.

Add support for format SMIME for -inform and -outform with cms and
smime utilities.

PR#4215

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>