oweals/openssl.git
7 years agoRemove OLD_STR_TO_KEY compile option
Rich Salz [Wed, 14 Jun 2017 16:05:25 +0000 (12:05 -0400)]
Remove OLD_STR_TO_KEY compile option

This flag was added in 1992 and only documented in the CHANGES file.

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

7 years agoFix possible crash in X931 code.
Bernd Edlinger [Tue, 13 Jun 2017 20:34:30 +0000 (22:34 +0200)]
Fix possible crash in X931 code.

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

7 years agoFix another possible crash in rsa_ossl_mod_exp.
Bernd Edlinger [Tue, 13 Jun 2017 20:08:03 +0000 (22:08 +0200)]
Fix another possible crash in rsa_ossl_mod_exp.

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

7 years agoFix a possible crash in dsa_builtin_paramgen2.
Bernd Edlinger [Tue, 13 Jun 2017 19:22:45 +0000 (21:22 +0200)]
Fix a possible crash in dsa_builtin_paramgen2.

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

7 years agoFix crash in ecdh_simple_compute_key.
Bernd Edlinger [Tue, 13 Jun 2017 16:08:40 +0000 (18:08 +0200)]
Fix crash in ecdh_simple_compute_key.

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

7 years agoFix a possible crash in the error handling.
Bernd Edlinger [Tue, 13 Jun 2017 17:00:35 +0000 (19:00 +0200)]
Fix a possible crash in the error handling.

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

7 years agoUpdate copyright on progs.h
Rich Salz [Tue, 13 Jun 2017 12:51:13 +0000 (08:51 -0400)]
Update copyright on progs.h

The generating script got updated, but the generated file did not.

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

7 years agoFix a memleak in ec_copy_parameters.
Bernd Edlinger [Tue, 13 Jun 2017 05:22:50 +0000 (07:22 +0200)]
Fix a memleak in ec_copy_parameters.

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

7 years agoperlasm/ppc-xlate.pl: add PowerISA 3.0B instructions.
Andy Polyakov [Fri, 9 Jun 2017 20:07:38 +0000 (22:07 +0200)]
perlasm/ppc-xlate.pl: add PowerISA 3.0B instructions.

[As well as few extra instructions from earlier spec.]

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoMake SNI behavior more clear in s_client doc & help
Paul Yang [Tue, 13 Jun 2017 12:18:55 +0000 (20:18 +0800)]
Make SNI behavior more clear in s_client doc & help

Update s_client -help and pod file.

Signed-off-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3654)

7 years agoRework writing crypto/err/openssl.txt
Richard Levitte [Mon, 12 Jun 2017 22:32:05 +0000 (00:32 +0200)]
Rework writing crypto/err/openssl.txt

Reading the prologue of this file conserved the "# Function codes"
line, and then duplicated it when rewriting this file, adding a new
"# Function codes" line everytime there's an update.

Better then to skip over all comment lines and have the prologue
defined in mkerr.pl, just the same as we do with the other affected
files.

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

7 years agoAdd -module option to util/mkerr.pl
Richard Levitte [Mon, 12 Jun 2017 18:06:56 +0000 (20:06 +0200)]
Add -module option to util/mkerr.pl

Sometimes, one might only want to rework a subset of all the internal
error codes.  -module allows the caller to specify exactly which
library modules to rewrite.

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

7 years agoClean up a bundle of codingstyle stuff in apps directory
Paul Yang [Mon, 12 Jun 2017 17:24:02 +0000 (01:24 +0800)]
Clean up a bundle of codingstyle stuff in apps directory

Mostly braces and NULL pointer check and also copyright year bump

Signed-off-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3657)

7 years agoFix a memleak in tls13_generate_secret.
Bernd Edlinger [Mon, 12 Jun 2017 17:30:10 +0000 (19:30 +0200)]
Fix a memleak in tls13_generate_secret.

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

7 years agoPut message strings in state files
Rich Salz [Wed, 7 Jun 2017 20:29:15 +0000 (16:29 -0400)]
Put message strings in state files

Add "*" as indicator meaning the function/reason is removed, so put an
empty string in the function/reason string table; this preserves backward
compatibility by keeping the #define's.

In state files, trailing backslash means text is on the next line.

Add copyright to state files

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

7 years agoFix memleak in EVP_DigestSignFinal/VerifyFinal.
Bernd Edlinger [Mon, 12 Jun 2017 16:05:19 +0000 (18:05 +0200)]
Fix memleak in EVP_DigestSignFinal/VerifyFinal.

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

7 years agoRefactor functions in testdsa.h
Paul Yang [Mon, 12 Jun 2017 02:38:15 +0000 (10:38 +0800)]
Refactor functions in testdsa.h

To reduce duplicate code

Signed-off-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3656)

7 years agoAdd sslapitest for SSL_early_get1_extensions_present()
Benjamin Kaduk [Fri, 17 Mar 2017 14:39:01 +0000 (09:39 -0500)]
Add sslapitest for SSL_early_get1_extensions_present()

Call it from the early callback used for testing these functions, and verify
the expected contents of the ClientHello

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

7 years agoAdd SSL_early_get1_extensions_present()
Benjamin Kaduk [Thu, 16 Mar 2017 22:17:16 +0000 (17:17 -0500)]
Add SSL_early_get1_extensions_present()

It is an API to be used from the early callback that indicates what
extensions were present in the ClientHello, and in what order.
This can be used to eliminate unneeded calls to SSL_early_get0_ext()
(which itself scales linearly in the number of extensions supported
by the library).

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

7 years agoTLS 1.3 client sigalgs test no longer needs TLS 1.2
Benjamin Kaduk [Wed, 5 Apr 2017 18:32:18 +0000 (13:32 -0500)]
TLS 1.3 client sigalgs test no longer needs TLS 1.2

Per the TODO comment, we now have proper certificate selection for
TLS 1.3 client certificates, so this test can move into its own
block.  (It cannot merge with the previous block, as it requires EC.)

Verified that the test passes when configured with enable-tls1_3
no-tls1 no-tls1_1 no-tls1_2.

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

7 years agodrop some no-longer-relevant TODO(TLS1.3) entries
Benjamin Kaduk [Thu, 23 Mar 2017 16:00:08 +0000 (11:00 -0500)]
drop some no-longer-relevant TODO(TLS1.3) entries

We prevent compression both when the server is parsing the ClientHello
and when the client is constructing the ClientHello.  A 1.3 ServerHello
has no way to hand us back a compression method, and we already check
that the server does not try to give us back a compression method that
we did not request, so these checks seem sufficient.

Weaken the INSTALL note slightly, as we do now expect to interoperate
with other implementations.

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

7 years agoRemove leading space-before-tab
Rich Salz [Sun, 11 Jun 2017 21:10:30 +0000 (17:10 -0400)]
Remove leading space-before-tab

Reviewed-by: Kurt Roceckx <kurt@openssl.org>
7 years agoimprove comment: use "optimization" for clarity
Josh Soref [Sun, 14 May 2017 09:17:30 +0000 (09:17 +0000)]
improve comment: use "optimization" for clarity
The previous word was a misspelling of nicety

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

7 years agoIntroduce ASN1_TIME_set_string_X509 API
Rich Salz [Sun, 11 Jun 2017 20:36:07 +0000 (16:36 -0400)]
Introduce ASN1_TIME_set_string_X509 API

Make funcs to deal with non-null-term'd string
in both asn1_generalizedtime_to_tm() and asn1_utctime_to_tm().

Fixes issue #3444.

This one is used to enforce strict format (RFC 5280) check and to
convert GeneralizedTime to UTCTime.

apps/ca has been changed to use the new API.

Test cases and documentation are updated/added

Signed-off-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3566)

7 years agodoc/man3: use the documented coding style in the example code
Beat Bolli [Fri, 18 Nov 2016 23:10:05 +0000 (00:10 +0100)]
doc/man3: use the documented coding style in the example code

Adjust brace placement, whitespace after keywords, indentation and empty
lines after variable declarations according to
https://www.openssl.org/policies/codingstyle.html.

Indent literal sections by exactly one space.

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

7 years agoFix spelling errors in manpages
Josh Soref [Fri, 19 May 2017 00:16:38 +0000 (00:16 +0000)]
Fix spelling errors in manpages

spelling: algorithm
spelling: anyway
spelling: assigned
spelling: authenticated
spelling: callback
spelling: certificate
spelling: compatibility
spelling: configuration
spelling: digest
spelling: encrypted
spelling: function
spelling: output
spelling: receive
spelling: renegotiation
spelling: signing
spelling: similar
spelling: string

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

7 years agoIf-guard to avoid null ptr deref in statem_srvr.c
Rich Salz [Sun, 11 Jun 2017 17:44:56 +0000 (13:44 -0400)]
If-guard to avoid null ptr deref in statem_srvr.c

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

7 years agoRemove needless type casting.
Rich Salz [Sat, 10 Jun 2017 19:25:56 +0000 (15:25 -0400)]
Remove needless type casting.

CLA: trivial

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

7 years agoFix possible usage of NULL pointers in apps/spkac.c
Paul Yang [Fri, 9 Jun 2017 18:22:22 +0000 (02:22 +0800)]
Fix possible usage of NULL pointers in apps/spkac.c

Check return value of NETSCAPE_SPKI_new() and
NETSCAPE_SPKI_b64_encode(), and also clean up coding style incidentally.

Signed-off-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3647)

7 years agoFix memory leaks in CTLOG_new_from_base64
Benjamin Kaduk [Fri, 9 Jun 2017 17:31:11 +0000 (13:31 -0400)]
Fix memory leaks in CTLOG_new_from_base64

Move the call to ct_base64_decode(), which allocates, until after
the check for NULL output parameter.

Also place a cap on the number of padding characters used to decrement
the output length -- any more than two '='s is not permitted in a
well-formed base64 text.  Prior to this change, ct_base64_decode() would
return a length of -1 along with allocated storage for an input of
"====".

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

7 years agomark V_ASN1_PRIMATIVE_TAG as compat
Josh Soref [Sun, 14 May 2017 14:53:54 +0000 (14:53 +0000)]
mark V_ASN1_PRIMATIVE_TAG as compat

This incorrectly spelled item exists for compatibility purposes

CLA: Trivial

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

7 years agofix check of broken implementations of GOST ciphersuites
Pichulin Dmitrii [Fri, 9 Jun 2017 17:04:00 +0000 (13:04 -0400)]
fix check of broken implementations of GOST ciphersuites

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

7 years agoFix speed command for alternation of ciphers and digests.
Jonathan Protzenko [Wed, 17 May 2017 16:09:01 +0000 (09:09 -0700)]
Fix speed command for alternation of ciphers and digests.

CLA: trivial

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

7 years agoAdd support for using engine-backed keys in spkac
Luke Faraone [Tue, 16 May 2017 01:23:17 +0000 (18:23 -0700)]
Add support for using engine-backed keys in spkac

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

7 years agoFix a bundle of trailing spaces in several files
Paul Yang [Tue, 6 Jun 2017 15:35:43 +0000 (23:35 +0800)]
Fix a bundle of trailing spaces in several files

Signed-off-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3622)

7 years agoList undocumented macros
Rich Salz [Thu, 8 Jun 2017 19:57:50 +0000 (15:57 -0400)]
List undocumented macros

The search is approximate; look only for those that look like
functions.

[skip ci]

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

7 years agoRemove stale note from s_server.pod
Benjamin Kaduk [Thu, 8 Jun 2017 20:55:30 +0000 (15:55 -0500)]
Remove stale note from s_server.pod

Modern browsers are now, well, pretty modern.

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

7 years agoIgnore -named_curve auto value to improve backwards compatibility
Tomas Mraz [Mon, 22 May 2017 14:20:21 +0000 (16:20 +0200)]
Ignore -named_curve auto value to improve backwards compatibility

Fixes #3490

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

7 years agoFix a read off the end of the input buffer
Rich Salz [Thu, 8 Jun 2017 20:05:52 +0000 (16:05 -0400)]
Fix a read off the end of the input buffer

when building with OPENSSL_SMALL_FOOTPRINT defined.

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

7 years agoUse memset to clear SRP_CTX instead of NULL and zero assignments
Diego Santa Cruz [Tue, 16 May 2017 08:35:49 +0000 (10:35 +0200)]
Use memset to clear SRP_CTX instead of NULL and zero assignments

This uses memset() to clear all of the SRP_CTX when free'ing or
initializing it as well as in error paths instead of having a series
of NULL and zero assignments as it is safer.

It also changes SSL_SRP_CTX_init() to reset all the SRP_CTX to zero
in case or error, previously it could retain pointers to freed
memory, potentially leading to a double free.

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

7 years agoMake SRP_CTX.info ownership and lifetime be the same as SRP_CTX.login.
Diego Santa Cruz [Mon, 15 May 2017 08:35:45 +0000 (10:35 +0200)]
Make SRP_CTX.info ownership and lifetime be the same as SRP_CTX.login.

Ownership and lifetime rules of SRP_CTX.info are confusing and different
from those of SRP_CTX.login, making it difficult to use correctly.
This makes the ownership and lifetime be the same as those of SRP_CTX.login,
thet is a copy is made when setting it and is freed when SRP_CTX is freed.

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

7 years agoClean up s_server documentation
Matt Caswell [Wed, 7 Jun 2017 10:43:03 +0000 (11:43 +0100)]
Clean up s_server documentation

List the options in the same order and in the same style as the output from
"openssl s_server -help"

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/3628)

7 years agoRemove doc of non-existent functions
Rich Salz [Thu, 8 Jun 2017 19:18:38 +0000 (15:18 -0400)]
Remove doc of non-existent functions

Fix test for "documenting private functions"
And add -p flag to doc-nits recipe
Mark when things were deprecated, if doc'd as such

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

7 years agosha/asm/keccak1600-armv4.pl: switch to more efficient bit interleaving algorithm.
Andy Polyakov [Wed, 7 Jun 2017 15:57:17 +0000 (17:57 +0200)]
sha/asm/keccak1600-armv4.pl: switch to more efficient bit interleaving algorithm.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agosha/keccak1600.c: switch to more efficient bit interleaving algorithm.
Andy Polyakov [Wed, 7 Jun 2017 15:55:15 +0000 (17:55 +0200)]
sha/keccak1600.c: switch to more efficient bit interleaving algorithm.

[Also bypass sizeof(void *) == 8 check on some platforms.]

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd back support for SHA224 based sig algs
Matt Caswell [Thu, 8 Jun 2017 16:15:45 +0000 (17:15 +0100)]
Add back support for SHA224 based sig algs

This used to work but was inadvertently removed as part of the TLSv1.3
work. This adds it back.

Fixes #3633

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

7 years agoWindows: rearrange programs cleanup
Richard Levitte [Thu, 8 Jun 2017 06:02:26 +0000 (08:02 +0200)]
Windows: rearrange programs cleanup

The list of programs hit nmake's maximum line length, so we split up the
line in smaller chunks.

Fixes #3634

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

7 years agoFix possible memory over-read in apps/s_client.c
Rich Salz [Thu, 8 Jun 2017 13:26:20 +0000 (09:26 -0400)]
Fix possible memory over-read in apps/s_client.c

a buffer returned from BIO_gets is not checked for it's length before
reading its contents.

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3630)

7 years agoFix #340: Parse ASN1_TIME to struct tm
Todd Short [Wed, 3 May 2017 20:16:51 +0000 (16:16 -0400)]
Fix #340: Parse ASN1_TIME to struct tm

This works with ASN1_UTCTIME and ASN1_GENERALIZED_TIME

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

7 years agodoc: use /* ... */ comments in code examples
Beat Bolli [Mon, 3 Apr 2017 17:52:33 +0000 (19:52 +0200)]
doc: use /* ... */ comments in code examples

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

7 years agodoc/man3: fix SSL_SESSSION typos
Beat Bolli [Thu, 30 Mar 2017 17:40:04 +0000 (19:40 +0200)]
doc/man3: fix SSL_SESSSION typos

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

7 years agoSSL_CTX_set_verify.pod: move a typedef in front of its first usage
Beat Bolli [Fri, 20 Jan 2017 19:04:25 +0000 (20:04 +0100)]
SSL_CTX_set_verify.pod: move a typedef in front of its first usage

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

7 years agodoc/man3: unindent a few unintended code blocks
Beat Bolli [Fri, 20 Jan 2017 19:03:36 +0000 (20:03 +0100)]
doc/man3: unindent a few unintended code blocks

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

7 years agodoc/man3: reformat the function prototypes in the synopses
Beat Bolli [Fri, 20 Jan 2017 18:58:49 +0000 (19:58 +0100)]
doc/man3: reformat the function prototypes in the synopses

I tried hard to keep the lines at 80 characters or less, but in a few
cases I had to punt and just indented the subsequent lines by 4 spaces.

A few well-placed typedefs for callback functions would really help, but
these would be part of the API, so that's probably for later.

I also took the liberty of inserting empty lines in overlong blocks to
provide some visual space.

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

7 years agoERR_put_error.pod: fix the name of function ERR_add_error_vdata()
Beat Bolli [Thu, 19 Jan 2017 23:43:48 +0000 (00:43 +0100)]
ERR_put_error.pod: fix the name of function ERR_add_error_vdata()

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

7 years agodoc/man3: remove a duplicate BIO_do_accept() call
Beat Bolli [Wed, 18 Jan 2017 22:49:43 +0000 (23:49 +0100)]
doc/man3: remove a duplicate BIO_do_accept() call

The SSL server example in BIO_f_ssl.pod contains two copies of the
BIO_do_accept() call. Remove the second one.

Signed-off-by: Beat Bolli <dev@drbeat.li>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1956)

7 years agodoc/man3: use the documented coding style in the example code
Beat Bolli [Fri, 18 Nov 2016 23:10:05 +0000 (00:10 +0100)]
doc/man3: use the documented coding style in the example code

Adjust brace placement, whitespace after keywords, indentation and empty
lines after variable declarations according to
https://www.openssl.org/policies/codingstyle.html.

Indent literal sections by exactly one space.

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

7 years agomake error tables const and separate header file
Rich Salz [Wed, 7 Jun 2017 19:12:03 +0000 (15:12 -0400)]
make error tables const and separate header file

Run perltidy on util/mkerr
Change some mkerr flags, write some doc comments
Make generated tables "const" when genearting lib-internal ones.
Add "state" file for mkerr
Renerate error tables and headers
Rationalize declaration of ERR_load_XXX_strings
Fix out-of-tree build
Add -static; sort flags/vars for options.
Also tweak code output
Moved engines/afalg to engines (from master)
Use -static flag
Standard engine #include's of errors
Don't linewrap err string tables unless necessary

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

7 years agoAdd a lock around the OBJ_NAME table
Rich Salz [Wed, 7 Jun 2017 15:23:37 +0000 (11:23 -0400)]
Add a lock around the OBJ_NAME table

Various initialization functions modify this table, which can cause heap
corruption in the absence of external synchronization.

Some stats are modified from OPENSSL_LH_retrieve, where callers aren't
expecting to have to take out an exclusive lock. Switch to using atomic
operations for those stats.

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

7 years agoFix #2400 Add NO_RENEGOTIATE option
Todd Short [Wed, 10 May 2017 20:46:14 +0000 (16:46 -0400)]
Fix #2400 Add NO_RENEGOTIATE option

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

7 years agoAlways flush the BIO when we send any alert
Todd Short [Fri, 12 May 2017 13:05:11 +0000 (09:05 -0400)]
Always flush the BIO when we send any alert

At the moment we flush the write BIO if we send a fatal alert, but not a
warning one. This can mean the warning is never sent if we never do another
write and subsequently flush the BIO. Instead we should just always flush
after writing an alert.

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

7 years agoHandle the server refusing to reneg in a reneg_setup
Todd Short [Fri, 12 May 2017 13:02:41 +0000 (09:02 -0400)]
Handle the server refusing to reneg in a reneg_setup

During setup of a reneg test the server can refuse to start reneg.
If that happens we should let the client continue and then fail.

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

7 years agosha/asm/keccak1600-armv4.pl: add NEON code path.
Andy Polyakov [Mon, 5 Jun 2017 09:09:37 +0000 (11:09 +0200)]
sha/asm/keccak1600-armv4.pl: add NEON code path.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agosha/asm/keccak1600-armv4.pl: add SHA3_absorb and SHA3_squeeze.
Andy Polyakov [Thu, 1 Jun 2017 19:05:59 +0000 (21:05 +0200)]
sha/asm/keccak1600-armv4.pl: add SHA3_absorb and SHA3_squeeze.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agosha/asm/keccak1600-armv4.pl: optimization based on profiler feedback.
Andy Polyakov [Wed, 31 May 2017 12:29:58 +0000 (14:29 +0200)]
sha/asm/keccak1600-armv4.pl: optimization based on profiler feedback.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd sha/asm/keccak1600-armv4.pl.
Andy Polyakov [Wed, 31 May 2017 10:13:36 +0000 (12:13 +0200)]
Add sha/asm/keccak1600-armv4.pl.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoFix coding style
Paul Yang [Tue, 6 Jun 2017 10:43:14 +0000 (18:43 +0800)]
Fix coding style

Signed-off-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3614)

7 years agoFix doc nits in X509_check_private_key.pod
Paul Yang [Sun, 4 Jun 2017 19:56:07 +0000 (03:56 +0800)]
Fix doc nits in X509_check_private_key.pod

remove the tailing dot

Signed-off-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3614)

7 years agoSet local variable to 0 to avoid build error
Paul Yang [Sun, 4 Jun 2017 19:41:19 +0000 (03:41 +0800)]
Set local variable to 0 to avoid build error

Signed-off-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3614)

7 years agoAdd test cases for X509_check_private_key
Paul Yang [Sun, 4 Jun 2017 19:16:40 +0000 (03:16 +0800)]
Add test cases for X509_check_private_key

To test X509_check_private_key and relatives.

Add a CSR and corresponding RSA private key to test
X509_REQ_check_private_key function.

Signed-off-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3614)

7 years agoDocument X509_check_private_key and relative
Paul Yang [Sun, 4 Jun 2017 19:14:15 +0000 (03:14 +0800)]
Document X509_check_private_key and relative

Document two private key check functions:

X509_check_private_key
X509_REQ_check_private_key

Signed-off-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3614)

7 years agoMove and update RSA-PSS documentation.
Dr. Stephen Henson [Tue, 6 Jun 2017 12:37:41 +0000 (13:37 +0100)]
Move and update RSA-PSS documentation.

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

7 years agoFix define to match documentation
Dr. Stephen Henson [Tue, 6 Jun 2017 11:51:01 +0000 (12:51 +0100)]
Fix define to match documentation

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

7 years agoDocument default client -psk_identity
Rich Salz [Fri, 2 Jun 2017 20:05:37 +0000 (16:05 -0400)]
Document default client -psk_identity

Document that -psk is required to use PSK cipher
[skip ci]

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

7 years agoAvoid failing s_server when client's psk_identity is unexpected
Daniel Kahn Gillmor [Fri, 2 Jun 2017 01:01:27 +0000 (21:01 -0400)]
Avoid failing s_server when client's psk_identity is unexpected

s_server has traditionally been very brittle in PSK mode.  If the
client offered any PSK identity other than "Client_identity" s_server
would simply abort.

This is breakage for breakage's sake, and unlike most other parts of
s_server, which tend to allow more flexible connections.

This change accomplishes two things:

 * when the client's psk_identity does *not* match the identity
   expected by the server, just warn, don't fail.

 * allow the server to expect instead a different psk_identity from
   the client besides "Client_identity"

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3605)

7 years agoUse common STANZA for bn and exp tests
Rich Salz [Mon, 5 Jun 2017 17:32:05 +0000 (13:32 -0400)]
Use common STANZA for bn and exp tests

Standardize file:line messages
Reduce buff size; move to end of STANZA
Add some Title entries (with blank line after)
Add Title to some BN test files.

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

7 years agosha/keccak1600.c: add #ifdef KECCAK1600_ASM.
Andy Polyakov [Thu, 1 Jun 2017 19:06:26 +0000 (21:06 +0200)]
sha/keccak1600.c: add #ifdef KECCAK1600_ASM.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agosha/keccak1600.c: reduce temporary storage utilization even futher.
Andy Polyakov [Mon, 5 Jun 2017 09:07:55 +0000 (11:07 +0200)]
sha/keccak1600.c: reduce temporary storage utilization even futher.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agosha/keccak1600.c: add another 1x variant.
Andy Polyakov [Sat, 3 Jun 2017 20:07:05 +0000 (22:07 +0200)]
sha/keccak1600.c: add another 1x variant.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agosha/keccak1600.c: add ARM-specific "reference" tweaks.
Andy Polyakov [Wed, 31 May 2017 10:12:44 +0000 (12:12 +0200)]
sha/keccak1600.c: add ARM-specific "reference" tweaks.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoec/asm/ecp_nistz256-x86_64.pl: minor sqr_montx cleanup.
Andy Polyakov [Sat, 3 Jun 2017 19:08:57 +0000 (21:08 +0200)]
ec/asm/ecp_nistz256-x86_64.pl: minor sqr_montx cleanup.

Drop some redundant instructions in reduction in ecp_nistz256_sqr_montx.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoFix ex_data and session_dup issues
Todd Short [Wed, 26 Apr 2017 18:05:49 +0000 (14:05 -0400)]
Fix ex_data and session_dup issues

Code was added in commit b3c31a65 that overwrote the last ex_data value
using CRYPTO_dup_ex_data() causing a memory leak, and potentially
confusing the ex_data dup() callback.

In ssl_session_dup(), fix error handling (properly reference and up-ref
shared data) and new-up the ex_data before calling CRYPTO_dup_ex_data();
all other structures that dup ex_data have the destination ex_data new'd
before the dup.

Fix up some of the ex_data documentation.

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

7 years agoAdd text pointing to full change list.
Rich Salz [Fri, 2 Jun 2017 14:30:44 +0000 (10:30 -0400)]
Add text pointing to full change list.

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

7 years agoWork around Travis "virtual memory exhausted" error
Matt Caswell [Thu, 1 Jun 2017 16:35:23 +0000 (17:35 +0100)]
Work around Travis "virtual memory exhausted" error

One particular build was running out of memory. By swapping to debug mode
we reduce the optimisation level which should reduce the amount of memory
required.

[extended tests]

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

7 years agoLeft shift of a negative number is undefined behaviour
Matt Caswell [Thu, 1 Jun 2017 15:37:46 +0000 (16:37 +0100)]
Left shift of a negative number is undefined behaviour

Fix undefined behaviour in curve25519.c. Prior to this running with
ubsan produces errors like this:

crypto/ec/curve25519.c:3871:18: runtime error: left shift of negative
value -22867

[extended tests]

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

7 years agoAdded mysql as starttls protocol.
Keigo Tanaka [Sat, 13 May 2017 00:50:49 +0000 (09:50 +0900)]
Added mysql as starttls protocol.

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

7 years agoRemove unnecessary if condition from apps.c
Aashil Patel [Thu, 1 Jun 2017 00:05:14 +0000 (20:05 -0400)]
Remove unnecessary if condition from apps.c

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

7 years agoAdd -p (public only) flag to find-doc-nits
Rich Salz [Thu, 1 Jun 2017 20:26:26 +0000 (16:26 -0400)]
Add -p (public only) flag to find-doc-nits

Report if any non-public items are documented.
Add util/private.num that lists items that aren't in the public
(lib*.num) files that we do want to document.

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

7 years agoOnly release thread-local key if we created it.
Rich Salz [Wed, 31 May 2017 16:14:55 +0000 (12:14 -0400)]
Only release thread-local key if we created it.

Thanks to Jan Alexander Steffens for finding the bug and confirming the
fix.

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

7 years agoAdd some OID's from X.520
Erwann Abalea [Wed, 31 May 2017 15:54:02 +0000 (11:54 -0400)]
Add some OID's from X.520

CLA: trivial

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

7 years agoAdd UI functionality to duplicate the user data
Richard Levitte [Sun, 28 May 2017 07:35:11 +0000 (09:35 +0200)]
Add UI functionality to duplicate the user data

This can be used by engines that need to retain the data for a longer time
than just the call where this user data is passed.

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

7 years agoFix coding style in apps/passwd file
Paul Yang [Wed, 31 May 2017 14:46:30 +0000 (22:46 +0800)]
Fix coding style in apps/passwd file

Reformat some indents and braces based on OpenSSL coding style spec.

Signed-off-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3586)

7 years agoCLA: trivial
HorimotoYasuhiro [Mon, 29 May 2017 11:08:26 +0000 (20:08 +0900)]
CLA: trivial

Fix coding style

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

7 years agoWait longer for the server in TLSProxy to start
Matt Caswell [Wed, 31 May 2017 09:27:32 +0000 (10:27 +0100)]
Wait longer for the server in TLSProxy to start

In a recent PR (#3566) it seems that TLSProxy gave up trying to connect to
the server process too quickly. This meant the test failed even though the
server *did* eventually start. Currently we try 3 times to connect with a
0.1 second pause between each attempt. That is probably too aggressive.

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

7 years agoClear sensitive data in ED25519_sign
Dr. Stephen Henson [Thu, 25 May 2017 13:53:32 +0000 (14:53 +0100)]
Clear sensitive data in ED25519_sign

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

7 years agoAdd Ed25519 documentation
Dr. Stephen Henson [Sun, 30 Apr 2017 12:42:35 +0000 (13:42 +0100)]
Add Ed25519 documentation

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

7 years agono-ec fix
Dr. Stephen Henson [Wed, 26 Apr 2017 17:46:31 +0000 (18:46 +0100)]
no-ec fix

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

7 years agoAdd Ed25519 verify test.
Dr. Stephen Henson [Fri, 21 Apr 2017 12:36:15 +0000 (13:36 +0100)]
Add Ed25519 verify test.

Add Ed25519 certificate verify test using certificate from
draft-ietf-curdle-pkix-04 and custom generated root certificate.

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

7 years agoAdd custom sig_info_set for ED25519
Dr. Stephen Henson [Tue, 25 Apr 2017 19:34:58 +0000 (20:34 +0100)]
Add custom sig_info_set for ED25519

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

7 years agomake errors
Dr. Stephen Henson [Sat, 20 May 2017 02:06:26 +0000 (03:06 +0100)]
make errors

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