oweals/openssl.git
7 years agoRemove OPENSSL_indirect_call()
Benjamin Kaduk [Tue, 28 Feb 2017 22:32:51 +0000 (16:32 -0600)]
Remove OPENSSL_indirect_call()

It's undocumented and unused in the tree.  The idea seems to have
never gained much traction, and can be removed without breaking
ABI compatibility.

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

7 years agoDon't free in cleanup routine
Benjamin Kaduk [Tue, 28 Feb 2017 22:09:53 +0000 (16:09 -0600)]
Don't free in cleanup routine

Cleanse instead, and free in the free routine.

Seems to have been introduced in commit
846ec07d904f9cc81d486db0db14fb84f61ff6e5 when EVP_CIPHER_CTX was made
opaque.

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

7 years agocrypto/des: remove unreferenced rcp_enc.c module.
Andy Polyakov [Tue, 28 Feb 2017 13:15:30 +0000 (14:15 +0100)]
crypto/des: remove unreferenced rcp_enc.c module.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Stephen Henson <steve@openssl.org>
7 years agoCode health: Remove base address setting for mingw
Richard Levitte [Tue, 28 Feb 2017 17:24:02 +0000 (18:24 +0100)]
Code health: Remove base address setting for mingw

Base address setting was done for the sake of FIPS.  Since FIPS references
have been removed, we clean away this one as well.

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

7 years agoFix handling of EVP_PKEY_CTRL_PKCS7_ENCRYPT/DECRYPT with OPENSSL_NO_CMS.
Bernd Edlinger [Tue, 28 Feb 2017 08:48:32 +0000 (09:48 +0100)]
Fix handling of EVP_PKEY_CTRL_PKCS7_ENCRYPT/DECRYPT with OPENSSL_NO_CMS.

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

7 years agoAdd AGL's "beer mug" PEM file as another test input
Benjamin Kaduk [Thu, 23 Feb 2017 22:22:10 +0000 (16:22 -0600)]
Add AGL's "beer mug" PEM file as another test input

AGL has a history of pointing out the idiosynchronies/laxness of the
openssl PEM parser in amusing ways.  If we want this functionality to
stay present, we should test that it works.

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

7 years agoAdd test corpus for PEM reading
Benjamin Kaduk [Thu, 23 Feb 2017 20:28:32 +0000 (14:28 -0600)]
Add test corpus for PEM reading

Generate a fresh certificate and DSA private key in their respective PEM
files.  Modify the resulting ASCII in various ways so as to produce input
files that might be generated by non-openssl programs (openssl always
generates "standard" PEM files, with base64 data in 64-character lines
except for a possible shorter last line).

Exercise various combinations of line lengths, leading/trailing
whitespace, non-base64 characters, comments, and padding, for both
unencrypted and encrypted files.  (We do not have any other test coverage
that uses encrypted files, as far as I can see, and the parser enforces
different rules for the body of encrypted files.)

Add a recipe to parse these test files and verify that they contain the
expected string or are rejected, according to the expected status.
Some of the current behavior is perhaps suboptimal and could be revisited.

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

7 years agoCode health: Quick note in changes and the OPENSSL_GLOBAL et al changes
Richard Levitte [Tue, 28 Feb 2017 16:36:02 +0000 (17:36 +0100)]
Code health: Quick note in changes and the OPENSSL_GLOBAL et al changes

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

7 years agoCode health: With the VAX C-ism gone, OPENSSL_GLOBAL can be removed too
Richard Levitte [Tue, 28 Feb 2017 16:27:20 +0000 (17:27 +0100)]
Code health: With the VAX C-ism gone, OPENSSL_GLOBAL can be removed too

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

7 years agoCode health: Remove another VAX C-ism, globaldef and globalref
Richard Levitte [Tue, 28 Feb 2017 15:43:09 +0000 (16:43 +0100)]
Code health: Remove another VAX C-ism, globaldef and globalref

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

7 years agoCode health: make update
Richard Levitte [Tue, 28 Feb 2017 19:00:56 +0000 (20:00 +0100)]
Code health: make update

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

7 years agoCode health: Remove VAX exceptions in util/mkdef.pl
Richard Levitte [Tue, 28 Feb 2017 19:00:42 +0000 (20:00 +0100)]
Code health: Remove VAX exceptions in util/mkdef.pl

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

7 years agoCode health: Remove unused VAX transfer vector for engines
Richard Levitte [Tue, 28 Feb 2017 18:57:33 +0000 (19:57 +0100)]
Code health: Remove unused VAX transfer vector for engines

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

7 years agoExdata test was never enabled.
Rich Salz [Tue, 28 Feb 2017 15:53:28 +0000 (10:53 -0500)]
Exdata test was never enabled.

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

7 years agoRemove memcpy unrolling in bn_lib.c
Emilia Kasper [Tue, 28 Feb 2017 17:12:25 +0000 (18:12 +0100)]
Remove memcpy unrolling in bn_lib.c

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
7 years agoRemove support for HMAC_TEST_PRIVATE_KEY_FORMAT
Emilia Kasper [Tue, 28 Feb 2017 15:53:35 +0000 (16:53 +0100)]
Remove support for HMAC_TEST_PRIVATE_KEY_FORMAT

This is a bogus, undocumented format that was intended for testing; I
don't think anyone is using it.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoRemove GENCB_TEST compile flag
Rich Salz [Tue, 28 Feb 2017 17:08:54 +0000 (12:08 -0500)]
Remove GENCB_TEST compile flag

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

7 years agoFix test_ssl_new when compiled with no-tls1_2 or no-dtls1_2
Matt Caswell [Tue, 28 Feb 2017 15:53:55 +0000 (15:53 +0000)]
Fix test_ssl_new when compiled with no-tls1_2 or no-dtls1_2

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

7 years agoFix sslapitest when compiled with no-tls1_2
Matt Caswell [Tue, 28 Feb 2017 15:53:35 +0000 (15:53 +0000)]
Fix sslapitest when compiled with no-tls1_2

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

7 years agoRevert rc4test removal, it performs additional tests not in evptests.txt
Dr. Stephen Henson [Tue, 28 Feb 2017 15:58:46 +0000 (15:58 +0000)]
Revert rc4test removal, it performs additional tests not in evptests.txt

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

7 years agoRemove some commented out code in the tests
Matt Caswell [Tue, 28 Feb 2017 12:47:42 +0000 (12:47 +0000)]
Remove some commented out code in the tests

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

7 years agoRemove some commented out code in libssl
Matt Caswell [Tue, 28 Feb 2017 12:47:22 +0000 (12:47 +0000)]
Remove some commented out code in libssl

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

7 years agoRemove some commented out code in libcrypto
Matt Caswell [Tue, 28 Feb 2017 14:55:35 +0000 (14:55 +0000)]
Remove some commented out code in libcrypto

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

7 years agoRemove some commented out code in the apps
Matt Caswell [Tue, 28 Feb 2017 12:46:56 +0000 (12:46 +0000)]
Remove some commented out code in the apps

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

7 years agoRemove more redundant tests: md4, md5, rmd, rc4, p5_crpt2
Dr. Stephen Henson [Tue, 28 Feb 2017 15:11:48 +0000 (15:11 +0000)]
Remove more redundant tests: md4, md5, rmd, rc4, p5_crpt2

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

7 years agoRemove a pointless "#ifndef" from bf_enc.c
Matt Caswell [Tue, 28 Feb 2017 15:14:04 +0000 (15:14 +0000)]
Remove a pointless "#ifndef" from bf_enc.c

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

7 years agoRemove bf_cbc.c
Matt Caswell [Tue, 28 Feb 2017 13:31:41 +0000 (13:31 +0000)]
Remove bf_cbc.c

It is never built and the code is duplicated in bf_enc.c.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2778)

7 years agoUpdate year, wording tweak
Rich Salz [Mon, 27 Feb 2017 17:36:37 +0000 (12:36 -0500)]
Update year, wording tweak

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

7 years agoRemove the file r160test.c
Matt Caswell [Tue, 28 Feb 2017 13:23:37 +0000 (13:23 +0000)]
Remove the file r160test.c

It is empty and is not compiled

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

7 years agoRemove wp_test.c: exactly the same tests are in evptests.txt
Dr. Stephen Henson [Tue, 28 Feb 2017 14:18:27 +0000 (14:18 +0000)]
Remove wp_test.c: exactly the same tests are in evptests.txt

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

7 years agoRemove dead code in bn
Matt Caswell [Tue, 28 Feb 2017 10:08:51 +0000 (10:08 +0000)]
Remove dead code in bn

There are a number of symbols in bn which are internal only and never used
by anything. They should be removed.

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

7 years agoRemove some #if 0 code in ssl, crypto/bio
Todd Short [Tue, 28 Feb 2017 14:04:29 +0000 (09:04 -0500)]
Remove some #if 0 code in ssl, crypto/bio

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

7 years agoCode health: Stop using timeb.h / ftime() (VMS only)
Richard Levitte [Tue, 28 Feb 2017 13:07:08 +0000 (14:07 +0100)]
Code health: Stop using timeb.h / ftime() (VMS only)

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

7 years agoCode health: Remove obvious VAX C fixups
Richard Levitte [Tue, 28 Feb 2017 13:06:14 +0000 (14:06 +0100)]
Code health: Remove obvious VAX C fixups

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

7 years agoMore Configure cleanup. Remove
Emilia Kasper [Tue, 28 Feb 2017 13:54:07 +0000 (14:54 +0100)]
More Configure cleanup. Remove
- util/incore
- util/fipslink.pl
- the unused "baseaddr" configure switch

Reviewed-by: Stephen Henson <steve@openssl.org>
7 years agoClean up references to FIPS
Emilia Kasper [Tue, 28 Feb 2017 11:30:28 +0000 (12:30 +0100)]
Clean up references to FIPS

This removes the fips configure option. This option is broken as the
required FIPS code is not available.

FIPS_mode() and FIPS_mode_set() are retained for compatibility, but
FIPS_mode() always returns 0, and FIPS_mode_set() can only be used to
turn FIPS mode off.

Reviewed-by: Stephen Henson <steve@openssl.org>
7 years agoRemove BN_DEBUG_TRIX
Emilia Kasper [Tue, 28 Feb 2017 12:25:06 +0000 (13:25 +0100)]
Remove BN_DEBUG_TRIX

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoRemove debugging leftovers in apps/opt.c
Emilia Kasper [Tue, 28 Feb 2017 10:47:10 +0000 (11:47 +0100)]
Remove debugging leftovers in apps/opt.c

Reviewed-by: Stephen Henson <steve@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAvoid buffer underflow in evp_test.
Pauli [Mon, 27 Feb 2017 04:26:16 +0000 (14:26 +1000)]
Avoid buffer underflow in evp_test.

The second loop in the remove_space function doesn't check for walking
back off of the start of the string while setting white space to 0.

This fix exits this loop once the pointer is before the (updated) beginning
of the string.

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

7 years agoRemove unnecessary memset after PR #2583 avoids accessing
Bernd Edlinger [Mon, 13 Feb 2017 12:21:34 +0000 (13:21 +0100)]
Remove unnecessary memset after PR #2583 avoids accessing
the uninitialized session_id now.

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

7 years agoMove the CHIL engine to demos/engines
Richard Levitte [Tue, 28 Feb 2017 13:47:55 +0000 (14:47 +0100)]
Move the CHIL engine to demos/engines

Moving out of the way, Makefile to be added

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

7 years agoRemove some dead code from libssl
Matt Caswell [Tue, 28 Feb 2017 10:52:09 +0000 (10:52 +0000)]
Remove some dead code from libssl

There are a small number of functions in libssl that are internal only
and never used by anything.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2770)

7 years agoCode cleanup: remove the VMS specific reimplementation of gmtime
Richard Levitte [Tue, 28 Feb 2017 07:15:31 +0000 (08:15 +0100)]
Code cleanup: remove the VMS specific reimplementation of gmtime

This reimplementation was necessary before VMS C V7.1.  Since that's
the minimum version we support in this OpenSSL version, the
reimplementation is no longer needed.

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

7 years agoRemove dead code in crypto/pkcs7
Emilia Kasper [Tue, 28 Feb 2017 10:37:22 +0000 (11:37 +0100)]
Remove dead code in crypto/pkcs7

Reviewed-by: Stephen Henson <steve@openssl.org>
7 years agoRemove methtest.c
Emilia Kasper [Tue, 28 Feb 2017 10:33:38 +0000 (11:33 +0100)]
Remove methtest.c

This file tests code that doesn't exist.

Reviewed-by: Stephen Henson <steve@openssl.org>
7 years agoRemove ancient demoCA directory
Dr. Stephen Henson [Tue, 28 Feb 2017 05:17:11 +0000 (05:17 +0000)]
Remove ancient demoCA directory

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

7 years agoRenumber to avoid a error code clash
Richard Levitte [Mon, 27 Feb 2017 22:34:29 +0000 (23:34 +0100)]
Renumber to avoid a error code clash

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

7 years agoTrace support for TLS 1.3 certificate request message
Dr. Stephen Henson [Wed, 22 Feb 2017 17:26:04 +0000 (17:26 +0000)]
Trace support for TLS 1.3 certificate request message

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

7 years agoInitial incomplete TLS 1.3 certificate request support.
Dr. Stephen Henson [Wed, 22 Feb 2017 17:26:44 +0000 (17:26 +0000)]
Initial incomplete TLS 1.3 certificate request support.

This adds partial support for TLS 1.3 certificate request message.

The request context and extensions are currently ignored on receive
and set to zero length on send.

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

7 years agoAdjust the default value of the private key size
Adrian Vollmer [Mon, 27 Feb 2017 14:51:21 +0000 (15:51 +0100)]
Adjust the default value of the private key size

...in the man page to reflect the actual default (2048 instead of 512)

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

7 years agopoly1305/asm/poly1305-x86_64.pl: minor AVX512 optimization.
Andy Polyakov [Sat, 25 Feb 2017 17:37:24 +0000 (18:37 +0100)]
poly1305/asm/poly1305-x86_64.pl: minor AVX512 optimization.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agocrypto/x86_64cpuid.pl: add CFI annotations.
Andy Polyakov [Sat, 25 Feb 2017 21:17:21 +0000 (22:17 +0100)]
crypto/x86_64cpuid.pl: add CFI annotations.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agowhrlpool/asm/wp-x86_64.pl: add CFI annotations.
Andy Polyakov [Sat, 25 Feb 2017 21:16:57 +0000 (22:16 +0100)]
whrlpool/asm/wp-x86_64.pl: add CFI annotations.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agocamellia/asm/cmll-x86_64.pl: add CFI annotations.
Andy Polyakov [Sat, 25 Feb 2017 21:16:38 +0000 (22:16 +0100)]
camellia/asm/cmll-x86_64.pl: add CFI annotations.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agopoly1305/asm/poly1305-x86_64.pl: add CFI annotations.
Andy Polyakov [Sat, 25 Feb 2017 18:37:02 +0000 (19:37 +0100)]
poly1305/asm/poly1305-x86_64.pl: add CFI annotations.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agochacha/asm/chacha-x86_64.pl: add CFI annotations.
Andy Polyakov [Sat, 25 Feb 2017 18:36:43 +0000 (19:36 +0100)]
chacha/asm/chacha-x86_64.pl: add CFI annotations.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd missing blank lines and cosmetic improvements
Dr. Stephen Henson [Sun, 26 Feb 2017 16:04:31 +0000 (16:04 +0000)]
Add missing blank lines and cosmetic improvements

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

7 years agoTLS 1.3 support for ssl_print_ticket()
Dr. Stephen Henson [Sun, 26 Feb 2017 13:40:03 +0000 (13:40 +0000)]
TLS 1.3 support for ssl_print_ticket()

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

7 years agoprint out alpn extension
Dr. Stephen Henson [Sun, 26 Feb 2017 03:14:53 +0000 (03:14 +0000)]
print out alpn extension

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

7 years agoAdd ffdhe groups to trace output
Dr. Stephen Henson [Sun, 26 Feb 2017 01:16:30 +0000 (01:16 +0000)]
Add ffdhe groups to trace output

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

7 years agoPrint numerical value of named roups
Dr. Stephen Henson [Wed, 22 Feb 2017 17:25:17 +0000 (17:25 +0000)]
Print numerical value of named roups

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

7 years agoAdd entry for PSK extension
Dr. Stephen Henson [Wed, 22 Feb 2017 17:24:42 +0000 (17:24 +0000)]
Add entry for PSK extension

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

7 years agoAdd trace entries for remaining TLS 1.3 ciphersuites
Dr. Stephen Henson [Wed, 22 Feb 2017 17:24:18 +0000 (17:24 +0000)]
Add trace entries for remaining TLS 1.3 ciphersuites

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

7 years agoPrint signature type to out, not bio_err
Dr. Stephen Henson [Tue, 21 Feb 2017 18:43:46 +0000 (18:43 +0000)]
Print signature type to out, not bio_err

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

7 years agoAdd a null UI method
Richard Levitte [Sat, 25 Feb 2017 23:17:43 +0000 (00:17 +0100)]
Add a null UI method

There are cases when, if you pass a NULL UI_METHOD, the called
function will use an internal default.  This is well and good, but
there may be cases when this is undesirable and one would rather send
in a UI that does absolutely nothing (sort of a /dev/null).  UI_null()
is the UI_METHOD for this purpose.

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

7 years agopoly1305/asm/poly1305-x86_64.pl: add VPMADD52 code path.
Andy Polyakov [Thu, 29 Dec 2016 23:00:16 +0000 (00:00 +0100)]
poly1305/asm/poly1305-x86_64.pl: add VPMADD52 code path.

This is initial and minimal single-block implementation.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agopoly1305/asm/poly1305-x86_64.pl: switch to vpermdd in table expansion.
Andy Polyakov [Sun, 25 Dec 2016 12:10:00 +0000 (13:10 +0100)]
poly1305/asm/poly1305-x86_64.pl: switch to vpermdd in table expansion.

Effectively it's minor size optimization, 5-6% per affected subroutine.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agopoly1305/asm/poly1305-x86_64.pl: optimize AVX512 code path.
Andy Polyakov [Sun, 25 Dec 2016 12:05:35 +0000 (13:05 +0100)]
poly1305/asm/poly1305-x86_64.pl: optimize AVX512 code path.

On pre-Skylake best optimization strategy was balancing port-specific
instructions, while on Skylake minimizing the sheer amount appears
more sensible.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd tests for SHA1 and EC point compression
Dr. Stephen Henson [Sat, 25 Feb 2017 00:40:55 +0000 (00:40 +0000)]
Add tests for SHA1 and EC point compression

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

7 years agoFor TLS 1.3 reject SHA1 TLS signatures
Dr. Stephen Henson [Sat, 25 Feb 2017 00:25:04 +0000 (00:25 +0000)]
For TLS 1.3 reject SHA1 TLS signatures

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

7 years agoReject compressed point format with TLS 1.3
Dr. Stephen Henson [Fri, 24 Feb 2017 20:43:02 +0000 (20:43 +0000)]
Reject compressed point format with TLS 1.3

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

7 years agoEC certificate with compression point
Dr. Stephen Henson [Fri, 24 Feb 2017 17:29:59 +0000 (17:29 +0000)]
EC certificate with compression point

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

7 years agoAdd SuiteB support to tls_choose_sigalg()
Dr. Stephen Henson [Fri, 24 Feb 2017 16:39:57 +0000 (16:39 +0000)]
Add SuiteB support to tls_choose_sigalg()

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

7 years agoAdd Suite B tests
Dr. Stephen Henson [Fri, 24 Feb 2017 15:47:54 +0000 (15:47 +0000)]
Add Suite B tests

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

7 years agoAdd P-384 root and P-384, P-256 EE certificates.
Dr. Stephen Henson [Sat, 18 Feb 2017 13:38:37 +0000 (13:38 +0000)]
Add P-384 root and P-384, P-256 EE certificates.

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

7 years agoX509 time: tighten validation per RFC 5280
Emilia Kasper [Fri, 17 Feb 2017 18:00:15 +0000 (19:00 +0100)]
X509 time: tighten validation per RFC 5280

- Reject fractional seconds
- Reject offsets
- Check that the date/time digits are in valid range.
- Add documentation for X509_cmp_time

GH issue 2620

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years ago.travis.yml: introduce concept of "extended tests"
Andy Polyakov [Mon, 6 Feb 2017 10:14:05 +0000 (11:14 +0100)]
.travis.yml: introduce concept of "extended tests"

Since CI is engaged on per merge request basis, it can be wasteful to
run each request through all the tests, especially those resource
consuming. Idea is to mark most of tests as "extended" and provide a
way to opt-in by marking last commit with [extended tests] tag. It's
still not as optimal as one could wish, as decision to skip a test
still requires machine time, and it's taken in configured environment,
i.e. with updates and additional packages installed...

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

7 years ago.travis.yml: make package pulls conditional.
Andy Polyakov [Thu, 26 Jan 2017 00:02:43 +0000 (01:02 +0100)]
.travis.yml: make package pulls conditional.

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

7 years agoAdd -Wundef to --strict-warnings options.
Bernd Edlinger [Thu, 23 Feb 2017 13:52:23 +0000 (14:52 +0100)]
Add -Wundef to --strict-warnings options.

Avoid a -Wundef warning in refcount.h
Avoid a -Wundef warning in o_str.c
Avoid a -Wundef warning in testutil.h
Include internal/cryptlib.h before openssl/stack.h
to avoid use of undefined symbol OPENSSL_API_COMPAT.

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

7 years agoTidy up certificate type handling.
Dr. Stephen Henson [Thu, 23 Feb 2017 22:12:28 +0000 (22:12 +0000)]
Tidy up certificate type handling.

The certificate types used to be held in a fixed length array or (if
it was too long) a malloced buffer. This was done to retain binary
compatibility. The code can be simplified now SSL is opaque by always
using a malloced buffer.

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

7 years agoIncrease the size of the stack buffer to prevent an overflow.
Pauli [Thu, 23 Feb 2017 03:46:01 +0000 (13:46 +1000)]
Increase the size of the stack buffer to prevent an overflow.

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

7 years agoFix potential memory leak in ASN1_TIME_to_generalizedtime()
Todd Short [Fri, 17 Feb 2017 16:36:13 +0000 (11:36 -0500)]
Fix potential memory leak in ASN1_TIME_to_generalizedtime()

If ret is allocated, it may be leaked on error.

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

7 years agoFix duplicate error codes
Kurt Roeckx [Thu, 23 Feb 2017 22:10:01 +0000 (23:10 +0100)]
Fix duplicate error codes

Reviewed-by: Matt Caswell <matt@openssl.org>
GH: #2732

7 years agoImplement SSL_read_ex() and SSL_write_ex() as documented.
Kurt Roeckx [Sat, 19 Nov 2016 19:15:35 +0000 (20:15 +0100)]
Implement SSL_read_ex() and SSL_write_ex() as documented.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
GH: #1964

7 years agoAdd an sslapitest for early callback
Benjamin Kaduk [Mon, 13 Feb 2017 18:42:43 +0000 (12:42 -0600)]
Add an sslapitest for early callback

Make sure that we can stop handshake processing and resume it later.
Also check that the cipher list and compression methods are sane.
Unfortunately, we don't have the client-side APIs needed to force
a specific (known) session ID to be sent in the ClientHello, so
that accessor cannot be tested here.

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

7 years agoLet test handshakes stop on certain errors
Benjamin Kaduk [Mon, 13 Feb 2017 21:10:54 +0000 (15:10 -0600)]
Let test handshakes stop on certain errors

Certain callback APIs allow the callback to request async processing
by trickling a particular error value up the stack to the application
as an error return from the handshake function.  In those cases,
SSL_want() returns a code specific to the type of async processing
needed.

The create_ssl_connection() helper function for the tests is very
helpful for several things, including creating API tests.  However,
it does not currently let us test the async processing functionality
of these callback interfaces, because the special SSL error codes
are treated as generic errors and the helper continues to loop until
it reaches its maximum iteration count.

Add a new parameter, 'want', that indicates an expected/desired
special SSL error code, so that the helper will terminate when
either side reports that error, giving control back to the calling
function and allowing the test to proceed.

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

7 years agoUse correct variable in test diagnostic
Benjamin Kaduk [Mon, 13 Feb 2017 20:14:06 +0000 (14:14 -0600)]
Use correct variable in test diagnostic

create_ssl_connection() prints out the results if SSL_accept() and/or
SSL_connect() fail, but was reusing the client return value when printing
about SSL_accept() failures.

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

7 years agoAdopt test to changed behavior
Benjamin Kaduk [Thu, 9 Feb 2017 23:21:42 +0000 (17:21 -0600)]
Adopt test to changed behavior

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

7 years agoTests for SSL early callback
Benjamin Kaduk [Tue, 31 Jan 2017 22:06:30 +0000 (16:06 -0600)]
Tests for SSL early callback

Plumb things through in the same place as the SNI callback, since
we recommend that the early callback replace (and supplement) the
SNI callback, and add a few test cases.

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

7 years agoAdd SSL_CTX early callback
Benjamin Kaduk [Mon, 23 Jan 2017 23:03:16 +0000 (17:03 -0600)]
Add SSL_CTX early callback

Provide a callback interface that gives the application the ability
to adjust the nascent SSL object at the earliest stage of ClientHello
processing, immediately after extensions have been collected but
before they have been processed.

This is akin to BoringSSL's "select_certificate_cb" (though it is not
API compatible), and as the name indicates, one major use is to examine
the supplied server name indication and select what certificate to
present to the client.  However, it can also be used to make more
sweeping configuration changes to the SSL object according to the
selected server identity and configuration.  That may include adjusting
the permitted TLS versions, swapping out the SSL_CTX object (as is
traditionally done in a tlsext_servername_callback), changing the
server's cipher list, and more.

We also wish to allow an early callback to indicate that it needs to perform
additional work asynchronously and resume processing later.  To that effect,
refactor the second half of tls_process_client_hello() into a subroutine to be
called at the post-processing stage (including the early callback itself), to
allow the callback to result in remaining in the same work stage for a later
call to succeed.  This requires allocating for and storing the CLIENTHELLO_MSG
in the SSL object to be preserved across such calls, but the storage is
reclaimed after ClientHello processing finishes.

Information about the CliehtHello is available to the callback by means of
accessor functions that can only be used from the early callback.  This allows
extensions to make use of the existing internal parsing machinery without
exposing structure internals (e.g., of PACKET), so that applications do not
have to write fragile parsing code.

Applications are encouraged to utilize an early callback and not use
a servername_callback, in order to avoid unexpected behavior that
occurs due to the relative order of processing between things like
session resumption and the historical servername callback.

Also tidy up nearby style by removing unnecessary braces around one-line
conditional bodies.

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

7 years agoPrepare for WORK_MORE_C
Benjamin Kaduk [Mon, 6 Feb 2017 21:33:28 +0000 (15:33 -0600)]
Prepare for WORK_MORE_C

Add the new enum value and case statements as appropriate.

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

7 years agoTests for SSL_bytes_to_cipher_list()
Benjamin Kaduk [Mon, 30 Jan 2017 18:59:59 +0000 (12:59 -0600)]
Tests for SSL_bytes_to_cipher_list()

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

7 years agoRefactor SSL_bytes_to_cipher_list()
Benjamin Kaduk [Tue, 31 Jan 2017 01:20:14 +0000 (19:20 -0600)]
Refactor SSL_bytes_to_cipher_list()

Split off the portions that mutate the SSL object into a separate
function that the state machine calls, so that the public API can
be a pure function.  (It still needs the SSL parameter in order
to determine what SSL_METHOD's get_cipher_by_char() routine to use,
though.)

Instead of returning the stack of ciphers (functionality that was
not used internally), require using the output parameter, and add
a separate output parameter for the SCSVs contained in the supplied
octets, if desired.  This lets us move to the standard return value
convention.  Also make both output stacks optional parameters.

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

7 years agoExport SSL_bytes_to_cipher_list()
Benjamin Kaduk [Mon, 30 Jan 2017 17:24:17 +0000 (11:24 -0600)]
Export SSL_bytes_to_cipher_list()

Move ssl_bytes_to_cipher_list() to ssl_lib.c and create a public
wrapper around it.  This lets application early callbacks easily get
SSL_CIPHER objects from the raw ciphers bytes without having to
reimplement the parsing code.  In particular, they do not need to
know the details of the sslv2 format ClientHello's ciphersuite
specifications.

Document the new public function, including the arguably buggy behavior
of modifying the supplied SSL object.  On the face of it, such a function
should be able to be pure, just a direct translation of wire octets to
internal data structures.

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

7 years agoLet ssl_get_cipher_by_char yield not-valid ciphers
Benjamin Kaduk [Mon, 6 Feb 2017 17:30:16 +0000 (11:30 -0600)]
Let ssl_get_cipher_by_char yield not-valid ciphers

Now that we have made SCSVs into more of a first-class object, provide
a way for the bytes-to-SSL_CIPHER conversion to actually return them.
Add a flag 'all' to ssl_get_cipher_by_char to indicate that we want
all the known ciphers, not just the ones valid for encryption.  This will,
in practice, let the caller retrieve the SCSVs.

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

7 years agoAdd more first-class support for SCSVS
Benjamin Kaduk [Fri, 3 Feb 2017 23:17:21 +0000 (17:17 -0600)]
Add more first-class support for SCSVS

Just as we have a table of ssl3_ciphers, add a table of ssl3_scsvs, to contain
SSL_CIPHER objects for these non-valid ciphers.  This will allow for unified
handling of such indicators, especially as we are preparing to pass them around
between functions.

Since the 'valid' field is not set for the SCSVs, they should not be used
for anything requiring a cryptographic cipher (as opposed to something
being stuck in a cipher-shaped hole in the TLS wire protocol).

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

7 years agoMove CLIENTHELLO_MSG up in the header
Benjamin Kaduk [Mon, 23 Jan 2017 23:00:47 +0000 (17:00 -0600)]
Move CLIENTHELLO_MSG up in the header

We'll be adding a field of this type to struct ssl_st in a subsequent
commit, and need the type definition to be in scope already.
Also move up the RAW_EXTENSION definition that it depends on.

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

7 years agoStore the number of extensions in CLIENTHELLO_MSG
Benjamin Kaduk [Mon, 23 Jan 2017 22:59:23 +0000 (16:59 -0600)]
Store the number of extensions in CLIENTHELLO_MSG

Keep track of the length of the pre_proc_exts array.

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

7 years agooutput number of exts from tls_collect_extensions()
Benjamin Kaduk [Mon, 23 Jan 2017 22:56:43 +0000 (16:56 -0600)]
output number of exts from tls_collect_extensions()

Modify the API of tls_collect_extensions() to be able to output the number of
extensions that are known (i.e., the length of its 'res' output).  This number
can never be zero on a successful return due to the builtin extensions list,
but use a separate output variable so as to not overload the return value
semantics.

Having this value easily available will give consumers a way to avoid repeating
the calculation.

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

7 years agoCheck for the presence of _WIN32 rather than its value.
Richard Levitte [Thu, 23 Feb 2017 13:41:20 +0000 (14:41 +0100)]
Check for the presence of _WIN32 rather than its value.

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