openssl.git
6 years agoUpdate tls13_hkdf_expand() to take the length of the data
Matt Caswell [Wed, 5 Jul 2017 10:23:16 +0000 (11:23 +0100)]
Update tls13_hkdf_expand() to take the length of the data

In most scenarios the length of the input data is the hashsize, or 0 if
the data is NULL. However with the new ticket_nonce changes the length can
be different.

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/3852)

6 years agoThe correct key length for a TLSv1.3 SHA384 ciphersuite is 48
Matt Caswell [Wed, 5 Jul 2017 09:45:02 +0000 (10:45 +0100)]
The correct key length for a TLSv1.3 SHA384 ciphersuite is 48

Our test was using 32. The latest ticket nonce changes now validate this
value and so sslapitest was failing.

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/3852)

6 years agoSend and receive the ticket_nonce field in a NewSessionTicket
Matt Caswell [Wed, 5 Jul 2017 07:45:46 +0000 (08:45 +0100)]
Send and receive the ticket_nonce field in a NewSessionTicket

This just adds the processing for sending and receiving the newly added
ticket_nonce field. It doesn't actually use it yet.

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/3852)

6 years agoUpdate the version number for TLSv1.3 draft 21
Matt Caswell [Tue, 4 Jul 2017 10:02:02 +0000 (11:02 +0100)]
Update the version number for TLSv1.3 draft 21

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/3852)

6 years agoFix memory leak when using PSK session files
Matt Caswell [Wed, 5 Jul 2017 09:32:33 +0000 (10:32 +0100)]
Fix memory leak when using PSK session files

We were not freeing the session created when loading a PSK session file.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/3855)

6 years agotest/run_tests.pl: Make sure to exit with a code that's understood universally
Richard Levitte [Fri, 7 Jul 2017 09:11:33 +0000 (11:11 +0200)]
test/run_tests.pl: Make sure to exit with a code that's understood universally

TAP::Parser::Aggregator::has_errors may return any number, not just 0
and 1.  With Perl on VMS, any number from 2 and on is interpreted as a
VMS status, the 3 lower bits are the encoded severity (1 = SUCCESS,
for example), so depending on what has_errors returns, a test failure
might be interpreted as a success.  Therefore, it's better to make
sure the exit code is 0 or 1, nothing else (they are special on VMS,
and mean SUCCESS or FAILURE, to match Unix conventions).

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3880)

6 years agotest/recipes/90-test_shlibload.t: Make sure to handle library renames
Richard Levitte [Fri, 7 Jul 2017 09:10:05 +0000 (11:10 +0200)]
test/recipes/90-test_shlibload.t: Make sure to handle library renames

VMS renames our libraries to fit VMS conventions.  This must be accounted
for when we want to load them.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3880)

6 years agoVMS: When running a sub-MMS, make sure to give it the main MMS' qualifiers
Richard Levitte [Fri, 7 Jul 2017 09:09:19 +0000 (11:09 +0200)]
VMS: When running a sub-MMS, make sure to give it the main MMS' qualifiers

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3880)

6 years agoAdd sha/asm/keccak1600-avx512.pl.
Andy Polyakov [Wed, 5 Jul 2017 17:59:19 +0000 (19:59 +0200)]
Add sha/asm/keccak1600-avx512.pl.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/3861)

6 years agoAddress potential buffer overflows.
Pauli [Fri, 7 Jul 2017 00:17:59 +0000 (10:17 +1000)]
Address potential buffer overflows.

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

6 years agochange return (x) to return x
Pauli [Thu, 6 Jul 2017 21:29:55 +0000 (07:29 +1000)]
change return (x) to return x

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

6 years agoRearrange link line so the libraries come after the source.
Pauli [Fri, 7 Jul 2017 01:44:52 +0000 (11:44 +1000)]
Rearrange link line so the libraries come after the source.
Some linkers like it this way.

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

6 years agoRemove some now-unneeded VMS controls
Rich Salz [Thu, 6 Jul 2017 19:28:35 +0000 (15:28 -0400)]
Remove some now-unneeded VMS controls

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

6 years agoBIO range checking.
Pauli [Thu, 6 Jul 2017 04:11:27 +0000 (14:11 +1000)]
BIO range checking.

Add length limits to avoid problems with sprintf, strcpy and strcat.  This replaces recently removed code but also guards some previously missing function calls (for DOS & Windows).

Reworked the BIO_dump_indent_cb code to reduce temporary storage.

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

6 years agoCleanup RAND_load_file,RAND_write_file
Rich Salz [Wed, 5 Jul 2017 20:08:19 +0000 (16:08 -0400)]
Cleanup RAND_load_file,RAND_write_file

Document an internal assumption that these are only for use with files,
and return an error if not. That made the code much simpler.
Leave it as writing 1024 bytes, even though we don't need more than 256
from a security perspective.  But the amount isn't specified, now, so we
can change it later if we want.

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

6 years agoMemory bounds checking in asn1 code.
Pauli [Thu, 6 Jul 2017 01:39:03 +0000 (11:39 +1000)]
Memory bounds checking in asn1 code.

Check that sprint, strcpy don't overflow.

Avoid some strlen operations when the previous sprintf return value can be used.

Also fix the undefined behaviour `*(long *)x = y` when x isn't a long or character pointer.
ISO/IEC 9899:1999 6.5/7 for the details.

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

6 years agoBounds check string functions in apps.
Pauli [Thu, 6 Jul 2017 00:37:10 +0000 (10:37 +1000)]
Bounds check string functions in apps.
This includes strcat, strcpy and sprintf.

In the x509 app, the code has been cleaned up as well.

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

6 years agoAdd two trivial fixes from old commits
Rich Salz [Wed, 5 Jul 2017 21:12:35 +0000 (17:12 -0400)]
Add two trivial fixes from old commits

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3865)

6 years agoRework the append_buf function
Pauli [Wed, 5 Jul 2017 22:03:58 +0000 (08:03 +1000)]
Rework the append_buf function

It won't overflow the buffer and will allocate new buffers sufficiently large to
hold new strings longer than the expansion factor.

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

6 years agoAvoid buffer overruns in the req command line utility.
Pauli [Wed, 5 Jul 2017 04:40:39 +0000 (14:40 +1000)]
Avoid buffer overruns in the req command line utility.

Clean up some of the formatting "return x" instead of "return (x)" mostly.

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

6 years agoFix crash
Rich Salz [Thu, 15 Jun 2017 22:51:10 +0000 (18:51 -0400)]
Fix crash

[extended tests]

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

6 years agoUndo commit dc00fb9
Rich Salz [Wed, 14 Jun 2017 19:08:39 +0000 (15:08 -0400)]
Undo commit dc00fb9

Original text:
    Document openssl dgst -hmac option

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

6 years agoUndo commit cd359b2
Rich Salz [Wed, 14 Jun 2017 19:07:52 +0000 (15:07 -0400)]
Undo commit cd359b2

Original text:
    Clarify use of |$end0| in stitched x86-64 AES-GCM code.

    There was some uncertainty about what the code is doing with |$end0|
    and whether it was necessary for |$len| to be a multiple of 16 or 96.
    Hopefully these added comments make it clear that the code is correct
    except for the caveat regarding low memory addresses.

    Change-Id: Iea546a59dc7aeb400f50ac5d2d7b9cb88ace9027
    Reviewed-on: https://boringssl-review.googlesource.com/7194
Reviewed-by: Adam Langley <agl@google.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3700)

6 years agoUndo commit 40720ce
Rich Salz [Wed, 14 Jun 2017 17:54:04 +0000 (13:54 -0400)]
Undo commit 40720ce

Comment in the commit:
    /* Ignore NULLs, thanks to Bob Beck <beck@obtuse.com> */

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

6 years agoUndo commit de02ec2
Rich Salz [Wed, 14 Jun 2017 17:53:01 +0000 (13:53 -0400)]
Undo commit de02ec2

Original text:
    Check if a random "file" is really a device file, and treat it
    specially if it is.
    Add a few OpenBSD-specific cases.
    This is part of a large change submitted by Markus Friedl <markus@openbsd.or

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

6 years agoUndo commit 0755217
Rich Salz [Wed, 14 Jun 2017 17:47:17 +0000 (13:47 -0400)]
Undo commit 0755217

Original text:
    Fix Perl problems on sparc64.
    This is part of a large change submitted by Markus Friedl
    <markus@openbsd.org>

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

6 years agoSTORE 'file' scheme loader: fix try_decode_params() to check ambiguity
Richard Levitte [Wed, 5 Jul 2017 18:54:08 +0000 (20:54 +0200)]
STORE 'file' scheme loader: fix try_decode_params() to check ambiguity

The way try_decode_params works in raw more, it would take the first ASN1
that could decode and return a STORE_INFO with the resulting EVP_PKEY.
This change has it go through all the matching ASN1 methods and properly
check if there's more than one match, i.e. an ambiguity.

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/3863)

6 years agoError out when forcing an unsupported TLS version
Benjamin Kaduk [Tue, 9 May 2017 23:39:50 +0000 (18:39 -0500)]
Error out when forcing an unsupported TLS version

If the result of a SSL_{CTX_,}set_{min,max}_proto_version() call
leaves the min and max version identical, and support for that version
is compiled out of the library, return an error.  Such an object has
no hope of successfully completing a handshake, and this error may
be easier to decipher than the resulting handshake failure.

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

6 years agoImprove BN_CTX documentation
Benjamin Kaduk [Wed, 14 Jun 2017 16:47:02 +0000 (11:47 -0500)]
Improve BN_CTX documentation

Since BN_CTX_init() is gone, all calls use BN_CTX_new().  Also,
essentially all consumers will use BN_CTX_start()/BN_CTX_end(),
so make that more clear from the BN_CTX_new() man page.

Document the thread-unsafety of individual BN_CTX objects.

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

6 years agoFix small UI issues
Richard Levitte [Wed, 5 Jul 2017 08:26:25 +0000 (10:26 +0200)]
Fix small UI issues

- in EVP_read_pw_string_min(), the return value from UI_add_* wasn't
  properly checked
- in UI_process(), |state| was never made NULL, which means an error
  when closing the session wouldn't be accurately reported.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/3849)

6 years agoAvoid possible memleak in X509_policy_check()
Richard Levitte [Wed, 5 Jul 2017 09:03:34 +0000 (11:03 +0200)]
Avoid possible memleak in X509_policy_check()

When tree_calculate_user_set() fails, a jump to error failed to
deallocate a possibly allocated |auth_nodes|.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/3850)

6 years agoFix compiler warnings
Pauli [Wed, 5 Jul 2017 03:40:23 +0000 (13:40 +1000)]
Fix compiler warnings

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/3839)

6 years agoUndo commit d420ac2
Rich Salz [Thu, 15 Jun 2017 00:34:37 +0000 (20:34 -0400)]
Undo commit d420ac2

[extended tests]

Original text:
    Use BUF_strlcpy() instead of strcpy().
    Use BUF_strlcat() instead of strcat().
    Use BIO_snprintf() instead of sprintf().
    In some cases, keep better track of buffer lengths.
    This is part of a large change submitted by Markus Friedl <markus@openbsd.org>

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/3701)

6 years agoRemove the TEST_check macro.
Pauli [Tue, 4 Jul 2017 03:44:52 +0000 (13:44 +1000)]
Remove the TEST_check macro.

This macro aborted the process which stopped any later tests from running.

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

6 years agoAdd echo for end of each build phase
Rich Salz [Mon, 3 Jul 2017 17:33:58 +0000 (13:33 -0400)]
Add echo for end of each build phase

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

6 years agoSTORE: fix possible memory leak
Richard Levitte [Tue, 4 Jul 2017 15:18:31 +0000 (17:18 +0200)]
STORE: fix possible memory leak

If scheme is NULL, the allocated res is leaked

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

6 years agoUse the return value from write(2)
Pauli [Mon, 3 Jul 2017 23:56:05 +0000 (09:56 +1000)]
Use the return value from write(2)
This prevents a warning when building with crypto-mdebug.

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

6 years agoBN_pseudo_rand is really BN_rand
Rich Salz [Wed, 21 Jun 2017 12:55:02 +0000 (13:55 +0100)]
BN_pseudo_rand is really BN_rand

And BN_pseudo_rand_range is really BN_rand_range.
Document that we might deprecate those functions.

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

6 years ago'make update' after objects/objects.txt update.
Andy Polyakov [Sat, 24 Jun 2017 19:26:44 +0000 (21:26 +0200)]
'make update' after objects/objects.txt update.

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/3643)

6 years agoobjects/objects.txt: add SHA3 OIDs.
Andy Polyakov [Sun, 18 Jun 2017 21:30:24 +0000 (23:30 +0200)]
objects/objects.txt: add SHA3 OIDs.

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/3643)

6 years agoCorrect documentation for UI_get0_result_string
Richard Levitte [Sat, 1 Jul 2017 16:28:50 +0000 (18:28 +0200)]
Correct documentation for UI_get0_result_string

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/3824)

6 years agosha/keccak1600.c: internalize KeccakF1600 and simplify SHA3_absorb.
Andy Polyakov [Fri, 30 Jun 2017 11:35:59 +0000 (13:35 +0200)]
sha/keccak1600.c: internalize KeccakF1600 and simplify SHA3_absorb.

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
6 years agosha/asm/keccak1600-x86_64.pl: close gap with Keccak Code Package.
Andy Polyakov [Fri, 30 Jun 2017 09:45:34 +0000 (11:45 +0200)]
sha/asm/keccak1600-x86_64.pl: close gap with Keccak Code Package.

[Also typo and readability fixes. Ryzen result is added.]

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
6 years agosha/asm/keccak1600-s390x.pl: typo and readability, minor size optimization.
Andy Polyakov [Fri, 30 Jun 2017 09:42:58 +0000 (11:42 +0200)]
sha/asm/keccak1600-s390x.pl: typo and readability, minor size optimization.

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
6 years agox86_64 assembly pack: fill some blanks in Ryzen results.
Andy Polyakov [Fri, 30 Jun 2017 09:42:00 +0000 (11:42 +0200)]
x86_64 assembly pack: fill some blanks in Ryzen results.

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
6 years agoVarious doc fixes
Rich Salz [Sun, 2 Jul 2017 16:16:38 +0000 (12:16 -0400)]
Various doc fixes

Fix a =head1 section name
Fix a typo in POD label
Remove a spurious =back
Add a missing blank line
Avoid 'legacy' -- use 'deprecated' if still needed if we cannot just reword.
Always do strict checking
Do not warn about missing "RETURN VALUES" unless -s is set.
Change OpenSSL version 1.1 -> 1.1.0

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

6 years agoFix potential crash in tls_construct_finished.
Bernd Edlinger [Wed, 14 Jun 2017 18:25:52 +0000 (20:25 +0200)]
Fix potential crash in tls_construct_finished.

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

6 years agoFix a crash in tls_construct_client_certificate.
Bernd Edlinger [Tue, 13 Jun 2017 05:25:43 +0000 (07:25 +0200)]
Fix a crash in tls_construct_client_certificate.

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

6 years agoFix TLSv1.3 exporter
Matt Caswell [Fri, 30 Jun 2017 09:45:11 +0000 (10:45 +0100)]
Fix TLSv1.3 exporter

We need to use the hashsize in generating the exportsecret not 0! Otherwise
we end up with random garbage for the secret.

It was pure chance that this passed the tests previously. It so happens
that, because we call SSL_export_keying_material() repeatedly for different
scenarios in the test, we end up in the tls13_export_keying_material() at
exactly the same position in the stack each time and therefore end up using
the same random garbage secret each time!

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3810)

6 years agoRemove the possibility to disable the UI module entirely
Richard Levitte [Sat, 1 Jul 2017 10:14:37 +0000 (12:14 +0200)]
Remove the possibility to disable the UI module entirely

Instead, make it possible to disable the console reader that's part of
the UI module.  This makes it possible to use the UI API and other UI
methods in environments where the console reader isn't useful.

To disable the console reader, configure with 'no-ui-console' /
'disable-ui-console'.

'no-ui' / 'disable-ui' is now an alias for  'no-ui-console' /
'disable-ui-console'.

Fixes #3806

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

6 years agoMake sure OSSL_STORE_load() isn't caught in an endless loop
Richard Levitte [Sat, 1 Jul 2017 16:25:43 +0000 (18:25 +0200)]
Make sure OSSL_STORE_load() isn't caught in an endless loop

The post process callback might potentially say "no" to everything (by
constantly returning NULL) and thereby cause an endless loop.  Ensure
that we stop all processing when "eof" is reached.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/3823)

6 years agoFix copyright date for the ARIA evp file.
Pauli [Mon, 3 Jul 2017 02:14:59 +0000 (12:14 +1000)]
Fix copyright date for the ARIA evp file.

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

6 years agoUpdate fuzz corpora
Kurt Roeckx [Sun, 2 Jul 2017 15:40:51 +0000 (17:40 +0200)]
Update fuzz corpora

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

6 years agoSTORE 'file' scheme loader: DNS name in URI is case insensitive
Richard Levitte [Sun, 2 Jul 2017 09:54:40 +0000 (11:54 +0200)]
STORE 'file' scheme loader: DNS name in URI is case insensitive

...  so compare accordingly with "//localhost"

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/3827)

6 years agoWhen apps_startup() fails, exit with a failure code and a message
Richard Levitte [Fri, 30 Jun 2017 18:47:45 +0000 (20:47 +0200)]
When apps_startup() fails, exit with a failure code and a message

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

6 years agoCleanup some copyright stuff
Rich Salz [Thu, 15 Jun 2017 16:03:40 +0000 (12:03 -0400)]
Cleanup some copyright stuff

Remove some incorrect copyright references.
Move copyright to standard place
Add OpenSSL copyright where missing.
Remove copyrighted file that we don't use any more
Remove Itanium assembler for RC4 and MD5 (assembler versions of old and
weak algorithms for an old chip)
Standardize apps/rehash copyright comment; approved by Timo
Put dual-copyright notice on mkcert

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

6 years agoFix build with no-threads no-ec
Dr. Stephen Henson [Fri, 30 Jun 2017 18:55:47 +0000 (19:55 +0100)]
Fix build with no-threads no-ec

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

6 years agoFix atfork flag. Avoid double-negatives :)
Rich Salz [Fri, 30 Jun 2017 17:55:08 +0000 (13:55 -0400)]
Fix atfork flag.  Avoid double-negatives :)

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/3815)

6 years agoMerge Intel copyright notice into standard
Rich Salz [Thu, 15 Jun 2017 16:08:35 +0000 (12:08 -0400)]
Merge Intel copyright notice into standard

This is done with the kind permission of Intel.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3813)

6 years agoAdd ECHO to makefiles for real silence
Rich Salz [Thu, 29 Jun 2017 15:40:19 +0000 (11:40 -0400)]
Add ECHO to makefiles for real silence

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

6 years agoDrop support for OPENSSL_NO_TLS1_3_METHOD
Matt Caswell [Thu, 29 Jun 2017 14:03:14 +0000 (15:03 +0100)]
Drop support for OPENSSL_NO_TLS1_3_METHOD

There are no public TLSv1_3_*method() functions so
OPENSSL_NO_TLS1_3_METHOD doesn't make any sense and should be removed.

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

6 years agoAdd fork handlers, based on pthread_atfork
Rich Salz [Thu, 22 Jun 2017 18:00:06 +0000 (14:00 -0400)]
Add fork handlers, based on pthread_atfork

Only for Unix platforms

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

6 years agoSTORE: Make sure the loader to be registered is complete
Richard Levitte [Thu, 29 Jun 2017 19:47:54 +0000 (21:47 +0200)]
STORE: Make sure the loader to be registered is complete

Most of the loader function pointers are crucial, they must be defined
unconditionally.  Therefore, let's make sure OSSL_STORE_register_loader
refuses to register incomplete loaders

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/3805)

6 years agoSTORE: simplify store_loader_cmp()
Richard Levitte [Thu, 29 Jun 2017 19:46:02 +0000 (21:46 +0200)]
STORE: simplify store_loader_cmp()

We have already made sure that the loader scheme isn't NULL, so
checking if they are NULL or not when comparing registered loaders
is redundant.  We still soft assert it, just to be entirely sure.

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/3805)

6 years agoutil/mkdef.pl: Make symbol version processing Linux only
Richard Levitte [Thu, 29 Jun 2017 19:11:48 +0000 (21:11 +0200)]
util/mkdef.pl: Make symbol version processing Linux only

For Windows, we care which way it is, the resulting file is just a pile
of symbols.  For VMS, we really need to care about the numeric ordering,
and getting the symbols sorted by symbol version too didn't agree with
that.

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

6 years agoutil/mkdef.pl: Add UNIX as a platform
Richard Levitte [Thu, 29 Jun 2017 19:09:52 +0000 (21:09 +0200)]
util/mkdef.pl: Add UNIX as a platform

This allows us to guard Unix specific functions with
#ifndef / #ifdef OPENSSL_SYS_UNIX

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

6 years agoAdd sha/asm/keccak1600-s390x.pl.
Andy Polyakov [Tue, 27 Jun 2017 19:45:18 +0000 (21:45 +0200)]
Add sha/asm/keccak1600-s390x.pl.

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agosha/asm/keccak1600-x86_64.pl: add CFI directives.
Andy Polyakov [Mon, 26 Jun 2017 15:39:43 +0000 (17:39 +0200)]
sha/asm/keccak1600-x86_64.pl: add CFI directives.

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agosha/asm/keccak1600-x86_64.pl: optimize by re-ordering instructions.
Andy Polyakov [Mon, 26 Jun 2017 15:29:24 +0000 (17:29 +0200)]
sha/asm/keccak1600-x86_64.pl: optimize by re-ordering instructions.

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agosha/asm/keccak1600-x86_64.pl: remove redundant moves.
Andy Polyakov [Mon, 26 Jun 2017 15:28:13 +0000 (17:28 +0200)]
sha/asm/keccak1600-x86_64.pl: remove redundant moves.

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agoAdd sha/asm/keccak1600-x86_64.pl.
Andy Polyakov [Mon, 26 Jun 2017 15:27:09 +0000 (17:27 +0200)]
Add sha/asm/keccak1600-x86_64.pl.

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agoAdd internal functions to fetch PEM data from an opened BIO
Richard Levitte [Tue, 6 Dec 2016 13:41:33 +0000 (14:41 +0100)]
Add internal functions to fetch PEM data from an opened BIO

store_attach_pem_bio() creates a STORE_CTX with the 'file' scheme
loader backend in PEM reading mode on an already opened BIO.
store_detach_pem_bio() detaches the STORE_CTX from the BIO and
destroys it (without destroying the BIO).

These two functions can be used in place of STORE_open() and
STORE_close(), and are present as internal support for other OpenSSL
functions.

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

6 years agoMake it possible to tell the file loader to use secure memory
Richard Levitte [Mon, 27 Feb 2017 13:30:00 +0000 (14:30 +0100)]
Make it possible to tell the file loader to use secure memory

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

6 years agoFix double array increment in s_client mysql connect
Steven Danneman [Tue, 27 Jun 2017 22:53:11 +0000 (15:53 -0700)]
Fix double array increment in s_client mysql connect

The packet parsing code for the server version string was incrementing
the array index twice on every iteration. This meant that strings with
an even number of characters would pass, but strings with an odd number
(ex: 5.7.18-0ubuntu0.16.04.1) would cause the pos variable to get out
of sync.

This would cause a later failure with "MySQL packet is broken."

CLA: trivial

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

6 years agoSTORE 'file' scheme loader: refactor the treatment of matches
Richard Levitte [Tue, 27 Jun 2017 21:08:54 +0000 (23:08 +0200)]
STORE 'file' scheme loader: refactor the treatment of matches

Sometimes, 'file_load' couldn't really distinguish if a file handler
matched the data and produced an error or if it didn't match the data
at all.

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

6 years agoSTORE: Add an entry in NEWS and CHANGES
Richard Levitte [Fri, 26 May 2017 16:36:26 +0000 (18:36 +0200)]
STORE: Add an entry in NEWS and CHANGES

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

6 years agoSTORE test recipe: Remove comment refering to OpenConnect
Richard Levitte [Thu, 18 May 2017 14:07:15 +0000 (16:07 +0200)]
STORE test recipe: Remove comment refering to OpenConnect

These tests were inspired by OpenConnect and incorporated
by permission of David Woodhouse under CLA

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

6 years agoAdd documentation for the storeutl app
Richard Levitte [Tue, 13 Dec 2016 12:47:13 +0000 (13:47 +0100)]
Add documentation for the storeutl app

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

6 years agoAdd documentation for STORE functions
Richard Levitte [Tue, 13 Dec 2016 12:46:53 +0000 (13:46 +0100)]
Add documentation for STORE functions

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

6 years agoengine app: print out information on STORE loaders and STORE FILE handlers
Richard Levitte [Sun, 11 Dec 2016 06:06:13 +0000 (07:06 +0100)]
engine app: print out information on STORE loaders and STORE FILE handlers

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

6 years agoSTORE: add ENGINE information to loaders
Richard Levitte [Sun, 11 Dec 2016 06:02:06 +0000 (07:02 +0100)]
STORE: add ENGINE information to loaders

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

6 years agoTest that storeutl with a directory path works as expected
Richard Levitte [Tue, 7 Feb 2017 15:30:31 +0000 (16:30 +0100)]
Test that storeutl with a directory path works as expected

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

6 years agoSTORE 'file' scheme loader: Add directory listing capability
Richard Levitte [Tue, 7 Feb 2017 15:19:40 +0000 (16:19 +0100)]
STORE 'file' scheme loader: Add directory listing capability

This has it recognised when the given path is a directory.  In that
case, the file loader will give back a series of names, all as URI
formatted as possible given the incoming URI.

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

6 years agoSTORE 'file' scheme loader: Add handler for encrypted PKCS#8 data
Richard Levitte [Sat, 11 Feb 2017 00:18:29 +0000 (01:18 +0100)]
STORE 'file' scheme loader: Add handler for encrypted PKCS#8 data

Add a separate handler for encrypted PKCS#8 data.  This uses the new
restart functionality.

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

6 years agoSTORE 'file' scheme loader: refactor file_load to support decoding restart
Richard Levitte [Sat, 11 Feb 2017 00:17:50 +0000 (01:17 +0100)]
STORE 'file' scheme loader: refactor file_load to support decoding restart

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

6 years agoSTORE: Add a OSSL_STORE_INFO type to help support file handler restarts
Richard Levitte [Thu, 8 Dec 2016 13:28:42 +0000 (14:28 +0100)]
STORE: Add a OSSL_STORE_INFO type to help support file handler restarts

Some containers might very simply decode into something new that
deserves to be considered as new (embedded) data.  With the help of a
special OSSL_STORE_INFO type, make that new data available to the
loader functions so they can start over.

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

6 years agoSTORE tests: add PKCS#12 tests
Richard Levitte [Mon, 5 Dec 2016 14:13:01 +0000 (15:13 +0100)]
STORE tests: add PKCS#12 tests

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

6 years agoSTORE 'file' scheme loader: add support for the PKCS#12 container
Richard Levitte [Sat, 11 Feb 2017 00:16:07 +0000 (01:16 +0100)]
STORE 'file' scheme loader: add support for the PKCS#12 container

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

6 years agoSTORE 'file' scheme loader: add support for containers
Richard Levitte [Mon, 5 Dec 2016 22:15:58 +0000 (23:15 +0100)]
STORE 'file' scheme loader: add support for containers

Containers are objects that are containers for a bunch of other
objects with types we recognise but aren't readable in a stream.  Such
containers are read and parsed, and their content is cached, to be
served one object at a time.

This extends the FILE_HANDLER type to include a function to destroy
the cache and a function to simulate the EOF check.

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

6 years agoAdd a test that checks the store utility
Richard Levitte [Sat, 19 Nov 2016 19:24:17 +0000 (20:24 +0100)]
Add a test that checks the store utility

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

6 years agoAdd a simple store utility command
Richard Levitte [Sat, 19 Nov 2016 18:38:23 +0000 (19:38 +0100)]
Add a simple store utility command

This command can be used to view the contents of any supported type of
information fetched from a URI, and output them in PEM format.

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

6 years agoAdd a STORE loader for the "file" scheme
Richard Levitte [Mon, 28 Nov 2016 16:30:21 +0000 (17:30 +0100)]
Add a STORE loader for the "file" scheme

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

6 years agoMake it possible to peek at BIO data through BIO_f_buffer()
Richard Levitte [Fri, 18 Nov 2016 17:18:37 +0000 (18:18 +0100)]
Make it possible to peek at BIO data through BIO_f_buffer()

This is needed for the upcoming "file" scheme STORE loader.

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

6 years agoMake asn1_d2i_read_bio accessible from STORE
Richard Levitte [Fri, 18 Nov 2016 17:17:20 +0000 (18:17 +0100)]
Make asn1_d2i_read_bio accessible from STORE

This is needed for the upcoming "file" scheme STORE loader.

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

6 years agoAdd the STORE module
Richard Levitte [Thu, 8 Dec 2016 14:51:31 +0000 (15:51 +0100)]
Add the STORE module

This STORE module adds the following functionality:

- A function OSSL_STORE_open(), OSSL_STORE_load() and OSSL_STORE_close()
  that accesses a URI and helps loading the supported objects (PKEYs,
  CERTs and CRLs for the moment) from it.
- An opaque type OSSL_STORE_INFO that holds information on each loaded
  object.
- A few functions to retrieve desired data from a OSSL_STORE_INFO
  reference.
- Functions to register and unregister loaders for different URI
  schemes.  This enables dynamic addition of loaders from applications
  or from engines.

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

6 years agoMake it possible to refer to ERR_R_UI_LIB
Richard Levitte [Tue, 6 Dec 2016 03:29:08 +0000 (04:29 +0100)]
Make it possible to refer to ERR_R_UI_LIB

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

6 years agoUpdates following review of SSL_export_key_material() changes
Matt Caswell [Wed, 28 Jun 2017 16:18:27 +0000 (17:18 +0100)]
Updates following review of SSL_export_key_material() changes

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

6 years agoUpdate the SSL_export_keying_material() documentation for TLSv1.3
Matt Caswell [Tue, 27 Jun 2017 15:32:40 +0000 (16:32 +0100)]
Update the SSL_export_keying_material() documentation for TLSv1.3

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

6 years agoAdd an SSL_export_keying_material() test
Matt Caswell [Tue, 27 Jun 2017 15:28:25 +0000 (16:28 +0100)]
Add an SSL_export_keying_material() test

There aren't any test vectors for this, so all we do is test that both
sides of the communication create the same result for different protocol
versions.

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

6 years agoUpdate SSL_export_keying_material() for TLSv1.3
Matt Caswell [Tue, 27 Jun 2017 13:57:15 +0000 (14:57 +0100)]
Update SSL_export_keying_material() for TLSv1.3

Fixes #3680

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