oweals/openssl.git
8 years agodescrip.mms.tmpl: in obj2bin, make sure an empty @deps means no empty lines
Richard Levitte [Tue, 20 Sep 2016 23:49:53 +0000 (01:49 +0200)]
descrip.mms.tmpl: in obj2bin, make sure an empty @deps means no empty lines

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 47852e6ae763a40ddc3538c76a02be06fd0595a5)

8 years agoutil/dofile.pl: report if a template couldn't be loaded
Richard Levitte [Tue, 20 Sep 2016 23:49:04 +0000 (01:49 +0200)]
util/dofile.pl: report if a template couldn't be loaded

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit f6be8315cbdb4173008b5917d2b0fc80bb0bf06b)

8 years agoRT3669: dgst can only sign/verify one file.
Rich Salz [Fri, 2 Sep 2016 21:34:31 +0000 (17:34 -0400)]
RT3669: dgst can only sign/verify one file.

Check arg count and print an error message.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 13a461831ab85ec9f55806ebf2df5ffb7f3f357a)

8 years agoapps/apps.c: include sys/socket.h to declare recv()
Richard Levitte [Tue, 20 Sep 2016 16:43:24 +0000 (18:43 +0200)]
apps/apps.c: include sys/socket.h to declare recv()

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit a19228b7f4fc6fcb49713455b3caedbc24fb0b01)

8 years agoDocumentation fixup; no more ECDHParameters
Richard Levitte [Sun, 18 Sep 2016 21:52:30 +0000 (23:52 +0200)]
Documentation fixup; no more ECDHParameters

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 6e836806add140fa9e56d1226d7514fdfa2c803a)

8 years agoCrude VMS build files for demos/bio/
Richard Levitte [Thu, 8 Sep 2016 23:53:38 +0000 (01:53 +0200)]
Crude VMS build files for demos/bio/

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 8c88c88b5ad43bbdf1f6e7602b6ac56c9031b153)

8 years agoCrude Makefile for demos/bio/
Richard Levitte [Thu, 8 Sep 2016 23:01:30 +0000 (01:01 +0200)]
Crude Makefile for demos/bio/

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit f4566dff06d2539dd01f54c817e2b952b64452e4)

8 years agoDon't ignore Makefiles in demos/
Richard Levitte [Thu, 8 Sep 2016 23:01:15 +0000 (01:01 +0200)]
Don't ignore Makefiles in demos/

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit ccf11f7ee49a0825caa407ed481c21b4b5933023)

8 years agoFixup BIO demos for OpenSSL 1.1.x
Richard Levitte [Fri, 9 Sep 2016 07:32:00 +0000 (09:32 +0200)]
Fixup BIO demos for OpenSSL 1.1.x

Call SSL_CTX_new() before doing any configuration.
(or call OPENSSL_ssl_init())

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 54d72ef0f019db383f8e98342b9b77c5da8541e5)

8 years agoFixup BIO demos for OpenSSL 1.1.x
Richard Levitte [Thu, 8 Sep 2016 22:59:00 +0000 (00:59 +0200)]
Fixup BIO demos for OpenSSL 1.1.x

'ECDHParameters = Automatic' isn't accepted.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 3656ea1c2217f38d44f3f34253e7c16f1b40ba77)

8 years agoFixup BIO demos for OpenSSL 1.1.x
Richard Levitte [Thu, 8 Sep 2016 22:58:21 +0000 (00:58 +0200)]
Fixup BIO demos for OpenSSL 1.1.x

Note: server-cmod doesn't seem to do things right...  from loading
cmod.cnf, it tries to load libssl_conf.so.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 16c6deed2c42d4cf4a7676a32b718d6a867f482a)

8 years agoRemove an option related to a deprecated flag
FdaSilvaYY [Sat, 17 Sep 2016 19:29:48 +0000 (21:29 +0200)]
Remove an option related to a deprecated flag

CMS_NOOLDMIMETYPE and PKCS7_NOOLDMIMETYPE  are unused in pkcs7/cms code.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1585)
(cherry picked from commit 28aef3d9558dc2e11ba56576b3a4d3faaef8a9d3)

8 years agoFix various missing option help messages ...
FdaSilvaYY [Sun, 31 Jul 2016 17:02:50 +0000 (19:02 +0200)]
Fix various missing option help messages ...

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1585)
(cherry picked from commit 12d56b2992ebd61e1b30c99ca1898dde42345cf7)

8 years agoConvert num_alloc to a size_t in stack.c and tweak style
Matt Caswell [Thu, 8 Sep 2016 10:06:29 +0000 (11:06 +0100)]
Convert num_alloc to a size_t in stack.c and tweak style

We were casting num_alloc to size_t in lots of places, or just using it in
a context where size_t makes more sense - so convert it. This simplifies
the code a bit.

Also tweak the style in stack.c a bit following on from the previous
commit

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 9205ebeb8e448b2d6948b9e5d78ecf309c0ed33c)

8 years agoPrevent overflows in stack API
Guido Vranken [Thu, 8 Sep 2016 09:43:37 +0000 (10:43 +0100)]
Prevent overflows in stack API

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 9731a9ce7d0f404d21ed418f9bc983b174e130cb)

8 years agoUpdate INSTALL about no-md5 removal
FdaSilvaYY [Mon, 12 Sep 2016 20:42:37 +0000 (22:42 +0200)]
Update INSTALL about no-md5 removal

no-rsa is no longer an option since 7ec8de1

Fix a typo about poly1305

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

8 years agoFix no-ocsp
Richard Levitte [Mon, 19 Sep 2016 13:08:58 +0000 (15:08 +0200)]
Fix no-ocsp

Some compilers complain about unused variables, and some tests do
not run well without OCSP.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 057c676afb2a69b7d2bb9cf6e895e720a2a62b78)

8 years agoHave the configuration options 'no-err' and 'no-async' work again
Richard Levitte [Sat, 17 Sep 2016 19:57:29 +0000 (21:57 +0200)]
Have the configuration options 'no-err' and 'no-async' work again

In an earlier attempt to simplify the processing of disabled options,
'no-err' and 'no-async' stopped working properly.  'err' and 'async'
are directories under 'crypto/', but they are special insofar that
they can't be simply skipped, like all the algorithm directories can,
so they need special treatment among the disablable things.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 66fe388aa410820d80ab1d99730b64b1b56a89d4)

8 years agoSimplify configudata.pm dependency generation
Richard Levitte [Sat, 17 Sep 2016 18:50:56 +0000 (20:50 +0200)]
Simplify configudata.pm dependency generation

While we're at it, correct the fault in windows-makefile.tmpl

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit 41240e68d745972d56dd037caf439d9c5032813f)

8 years agoRemove an useless definition.
FdaSilvaYY [Thu, 15 Sep 2016 18:33:18 +0000 (20:33 +0200)]
Remove an useless definition.

APP_INFO is currently a field of MEM struct.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1583)
(cherry picked from commit 76dc356384b3d8f93f04be05f320a878e4bced52)

8 years agoSimplify the dependencies for remaking configdata.pm
Richard Levitte [Thu, 15 Sep 2016 21:56:03 +0000 (23:56 +0200)]
Simplify the dependencies for remaking configdata.pm

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit c5ad3076a6c076ac9f8449c393dd14c16b737560)

8 years agoRearrange the storage of build file template names in %config
Richard Levitte [Thu, 15 Sep 2016 21:55:24 +0000 (23:55 +0200)]
Rearrange the storage of build file template names in %config

They are now relative paths as well

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit 1967a42eb5192efc552287f78850420082caba7c)

8 years agoUse the registered conf file names as dependencies to build configdata.pm
Richard Levitte [Wed, 14 Sep 2016 20:22:20 +0000 (22:22 +0200)]
Use the registered conf file names as dependencies to build configdata.pm

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit dc660c70b52c552aa4eb9659963bfbe6ab18bec0)

8 years agoRegister the name of the config file each config target was found in
Richard Levitte [Wed, 14 Sep 2016 20:21:41 +0000 (22:21 +0200)]
Register the name of the config file each config target was found in

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit ee9b0bbb4c66812da18939ea96c4625cb001f3bd)

8 years agoRevert "Abort on unrecognised warning alerts"
Matt Caswell [Thu, 15 Sep 2016 19:43:16 +0000 (20:43 +0100)]
Revert "Abort on unrecognised warning alerts"

This reverts commit 77a6be4dfc2ecf406c2559a99bea51317ce0f533.

There were some unexpected side effects to this commit, e.g. in SSLv3 a
warning alert gets sent "no_certificate" if a client does not send a
Certificate during Client Auth. With the above commit this causes the
connection to abort, which is incorrect. There may be some other edge cases
like this so we need to have a rethink on this.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoFinally, make sure vms_term_sock.c is built on VMS
Richard Levitte [Wed, 14 Sep 2016 21:40:27 +0000 (23:40 +0200)]
Finally, make sure vms_term_sock.c is built on VMS

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit d602c2b680aefd3e0d00d090783ef5f912caf06a)

8 years agoRefactor to avoid unnecessary preprocessor logic
Richard Levitte [Thu, 15 Sep 2016 09:20:18 +0000 (11:20 +0200)]
Refactor to avoid unnecessary preprocessor logic

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 51e5133d551b4c132f72fc2ff5bbe076f5a3e052)

8 years agoReformat to fit OpenSSL source code standards
Richard Levitte [Wed, 14 Sep 2016 18:54:30 +0000 (20:54 +0200)]
Reformat to fit OpenSSL source code standards

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit c7bdb6a31ff0fcae66b451d3f80a684ad77f4966)

8 years agoAdd copyright and license on apps/vms_term_sock.[ch]
Richard Levitte [Wed, 14 Sep 2016 18:52:03 +0000 (20:52 +0200)]
Add copyright and license on apps/vms_term_sock.[ch]

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 0d0723e813870c2e7a009ec47e933668a1548531)

8 years agoVSI submission: redirect terminal input through socket
Richard Levitte [Wed, 3 Aug 2016 19:16:43 +0000 (21:16 +0200)]
VSI submission: redirect terminal input through socket

This is needed, because on VMS, select() can only be used on sockets.  being
able to use select() on all kinds of file descriptors is unique to Unix.

So, the solution for VMS is to create a layer that translates input from
standard input to socket communication.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 0d3b65832c6fa94c1d1cfa2f99335f323e3227c1)

8 years agoMake reference to other manpage more explicit
Rich Salz [Wed, 14 Sep 2016 15:13:57 +0000 (11:13 -0400)]
Make reference to other manpage more explicit

Where -curves, etc., are defined: SSL_CONF_cmd

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit ddb30bde105a50d6a79a9662eeaf27e8cb29c606)

8 years agoAdd -h and -help for c_rehash script and app
Rich Salz [Mon, 12 Sep 2016 15:29:22 +0000 (11:29 -0400)]
Add -h and -help for c_rehash script and app

Resolves GH1515 and GH1509.

Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 7d959c358a09244bcaea601121b276529ff437ce)

8 years agoAdd some sanity checks around usage of t_fromb64()
Matt Caswell [Thu, 8 Sep 2016 13:32:27 +0000 (14:32 +0100)]
Add some sanity checks around usage of t_fromb64()

The internal SRP function t_fromb64() converts from base64 to binary. It
does not validate that the size of the destination is sufficiently large -
that is up to the callers. In some places there was such a check, but not
in others.

Add an argument to t_fromb64() to provide the size of the destination
buffer and validate that we don't write too much data. Also add some sanity
checks to the callers where appropriate.

With thanks to Shi Lei for reporting this issue.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 73f0df8331910d6726d45ecaab12bd93cc48b4e2)

8 years agoAdd a test for 'openssl passwd'
Richard Levitte [Tue, 13 Sep 2016 21:23:51 +0000 (23:23 +0200)]
Add a test for 'openssl passwd'

Also, enlarge test group 20 to include openssl commands that aren't
tested otherwise

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 497f3bf9a75a2917e50b16b7985e87c89b86a39b)

8 years agoFix 'openssl passwd' with arguments -1 or -apr1
Richard Levitte [Tue, 13 Sep 2016 20:48:35 +0000 (22:48 +0200)]
Fix 'openssl passwd' with arguments -1 or -apr1

RT#4674

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 9f9f962d96425ed741569460791eee0280fcf942)

8 years agoRemove -xtarget=ultra from solaris(64)-sparcv9-cc builds.
Andy Grundman [Tue, 30 Aug 2016 21:25:10 +0000 (17:25 -0400)]
Remove -xtarget=ultra from solaris(64)-sparcv9-cc builds.

This flag got moved after -xarch=v9 in 1.1.0 and had the unexpected
side effect of the compiler building for 32-bit v8plusa instead of v9.

GH#1521
CLA: none; trivial

Signed-off-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit fa4618a2805e7115cf47d0cf0d15cb7b3c944bba)

8 years agobio.h: fix number of arguments passed to BIO_ptr_ctrl()
Viktor Szakats [Tue, 30 Aug 2016 16:56:49 +0000 (18:56 +0200)]
bio.h: fix number of arguments passed to BIO_ptr_ctrl()

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

8 years agos_client: avoid warning on Windows/MS-DOS systems
Viktor Szakats [Tue, 30 Aug 2016 01:01:16 +0000 (03:01 +0200)]
s_client: avoid warning on Windows/MS-DOS systems

it appears when using gcc/mingw:
```
apps/s_client.c:815:9: warning: variable 'at_eof' set but not used [-Wunused-but-set-variable]
     int at_eof = 0;
         ^~~~~~
```
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1512)
(cherry picked from commit d485640b8083aea895ecf31b4ea6a338ee561b67)

8 years agoConfigure: detect gcc's dependency generation capability more accurately.
Andy Polyakov [Sat, 10 Sep 2016 19:12:56 +0000 (21:12 +0200)]
Configure: detect gcc's dependency generation capability more accurately.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 35c11bfc69e6b90fd1c4c4ca6ad3f500584ca939)

8 years agobn/bn_lcl.h: improve interoperability with clang and Android NDK.
Andy Polyakov [Sat, 10 Sep 2016 16:57:14 +0000 (18:57 +0200)]
bn/bn_lcl.h: improve interoperability with clang and Android NDK.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit cc2cb7bf63c62aaebd387f546a2fd673f367d9a8)

8 years agoutil/shlib_wrap.sh is now auto-generated so tell git to ignore it
Matt Caswell [Sun, 11 Sep 2016 16:47:39 +0000 (12:47 -0400)]
util/shlib_wrap.sh is now auto-generated so tell git to ignore it

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 6462876f8d9f6538ad0fcd70717077d9ae174e56)

8 years agoAbort on unrecognised warning alerts
Matt Caswell [Mon, 12 Sep 2016 10:04:51 +0000 (11:04 +0100)]
Abort on unrecognised warning alerts

A peer continually sending unrecognised warning alerts could mean that we
make no progress on a connection. We should abort rather than continuing if
we receive an unrecognised warning alert.

Thanks to Shi Lei for reporting this issue.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 77a6be4dfc2ecf406c2559a99bea51317ce0f533)

8 years agoAdd enginesdir to libcrypto.pc pkg-config file
David Woodhouse [Sat, 27 Aug 2016 19:33:23 +0000 (20:33 +0100)]
Add enginesdir to libcrypto.pc pkg-config file

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit cdbbf9900253e8006868eba948248b1092a057de)

8 years agoFix EC_KEY_print so it prints out private key information
Tim Hudson [Fri, 9 Sep 2016 20:53:33 +0000 (06:53 +1000)]
Fix EC_KEY_print so it prints out private key information
even when the public key is not present in an EC_KEY

Reviewed-by: Stephen Henson <steve@openssl.org>
(cherry picked from commit 82f52631b21b021787f344733e08bb53f1e7f0ec)

8 years agoIf errno is ENXIO in BSS_new_file(), set BIO_R_NO_SUCH_FILE
Richard Levitte [Thu, 8 Sep 2016 21:39:26 +0000 (23:39 +0200)]
If errno is ENXIO in BSS_new_file(), set BIO_R_NO_SUCH_FILE

VMS sets that errno when the device part of a file spec is malformed
or a logical name that doesn't exist.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit e82e2186e93e9a678dd8c0c5ba084d21d27d4d62)

8 years agoTravis: Do asan and msan with shared libraries
Richard Levitte [Thu, 8 Sep 2016 08:57:31 +0000 (10:57 +0200)]
Travis: Do asan and msan with shared libraries

Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit 047a5da2494abf565f5fb76f5cd92a05cd7fadd4)

8 years agoFix mem leaks during auto-deinit
Matt Caswell [Mon, 5 Sep 2016 13:12:58 +0000 (14:12 +0100)]
Fix mem leaks during auto-deinit

Certain functions are automatically called during auto-deinit in order
to deallocate resources. However, if we have never entered a function which
marks lib crypto as inited then they never get called. This can happen if
the user only ever makes use of a small sub-set of functions that don't hit
the auto-init code.

This commit ensures all such resources deallocated by these functions also
init libcrypto when they are initially allocated.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Ben Laurie <ben@openssl.org>
(cherry picked from commit 135648bcd0e9db029582d3d7627a90a1b566c5d6)

8 years agoEnsure trace recognises X25519
Matt Caswell [Fri, 2 Sep 2016 09:42:36 +0000 (10:42 +0100)]
Ensure trace recognises X25519

Using the -trace option to s_server or s_client was incorrectly printing
UNKNOWN for the X25519 curve.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 2d11f5b2ca863d4bd9e20b224932b247ed85842b)

8 years agoengines/afalg: make it compile with backward compatibility headers.
Andy Polyakov [Sun, 4 Sep 2016 20:53:22 +0000 (22:53 +0200)]
engines/afalg: make it compile with backward compatibility headers.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 4e3997293b3825ed19de20d5484f8c0f66fce534)

8 years agoConfigurations/10-main.cf: AIX "facelift".
Andy Polyakov [Sat, 3 Sep 2016 20:03:55 +0000 (22:03 +0200)]
Configurations/10-main.cf: AIX "facelift".

Improve interchangeability of aix*-gcc targets by linking shared
libraries with -static-libgcc, and address linking problems with
vendor compiler.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit f780eaad5be140cf192191b8d79dc3671443e0b2)

8 years agochacha/asm/chacha-ppc.pl: add missing .text directive.
Andy Polyakov [Fri, 2 Sep 2016 22:46:01 +0000 (00:46 +0200)]
chacha/asm/chacha-ppc.pl: add missing .text directive.

RT#4667

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit abcbf7ed7ea249609d225e43e1bce3af1fa1028c)

8 years agoAdd missing debug strings.
Rich Salz [Wed, 7 Sep 2016 19:40:16 +0000 (15:40 -0400)]
Add missing debug strings.

Found by turning -Wswitch-enum on.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 252cfef151e302dce598503de09fd3a3341810d7)

8 years agoAllow asan, msan and ubsan to be configured with shared libraries
Richard Levitte [Wed, 7 Sep 2016 18:56:20 +0000 (20:56 +0200)]
Allow asan, msan and ubsan to be configured with shared libraries

The background story is that util/shlib_wrap.sh was setting LD_PRELOAD
or similar platform dependent variables, just in case the shared
libraries were built with -rpath.  Unfortunately, this doesn't work
too well with asan, msan or ubsan.

So, the solution is to forbid the combination of shared libraries,
-rpath and any of the sanity analyzers we can configure.

This changes util/shlib_wrap.sh so it only contains the code that sets
LD_PRELOAD when -rpath has been used when configuring.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 342a1a23793cb99921abeabe882adf8652ba715d)

8 years agoAvoid EVP_PKEY_cmp() crash on EC keys without public component
David Woodhouse [Wed, 7 Sep 2016 15:53:18 +0000 (16:53 +0100)]
Avoid EVP_PKEY_cmp() crash on EC keys without public component

Some hardware devices don't provide the public EC_POINT data. The only
way for X509_check_private_key() to validate that the key matches a
given certificate is to actually perform a sign operation and then
verify it using the public key in the certificate.

Maybe that can come later, as discussed in issue 1532. But for now let's
at least make it fail gracefully and not crash.

GH: 1532

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

8 years agoConfigure: Reorganise the checking of disabled options
Richard Levitte [Tue, 6 Sep 2016 18:14:33 +0000 (20:14 +0200)]
Configure: Reorganise the checking of disabled options

The way we figured out what options are crypto algorithms and what are
something other was somewhat sketchy.  This change bases the
distinction on available sdirs instead.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 3e2dd30d665f3a312a45f945ffafb74ff6c420d6)

8 years agoGH1537: Avoid double-free in the EVP_PKEY API
Alex Gaynor [Wed, 7 Sep 2016 13:41:20 +0000 (09:41 -0400)]
GH1537: Avoid double-free in the EVP_PKEY API

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit d65c3615f6c658478503f4862f8055203a98038c)

8 years agoMisc BN fixes
Rich Salz [Mon, 5 Sep 2016 22:08:43 +0000 (18:08 -0400)]
Misc BN fixes

Never output -0; make "negative zero" an impossibility.
Do better checking on BN_rand top/bottom requirements and #bits.
Update doc.
Ignoring trailing garbage in BN_asc2bn.

Port this commit from boringSSL: https://boringssl.googlesource.com/boringssl/+/899b9b19a4cd3fe526aaf5047ab9234cdca19f7d%5E!/
        Ensure |BN_div| never gives negative zero in the no_branch code.

        Have |bn_correct_top| fix |bn->neg| if the input is zero so that we
        don't have negative zeros lying around.

        Thanks to Brian Smith for noticing.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 01c09f9fde5793e0b3712d602b02e2aed4908e8d)

8 years agoCorrect detection of group end in map file when testing symbol presence
Richard Levitte [Mon, 5 Sep 2016 22:48:13 +0000 (00:48 +0200)]
Correct detection of group end in map file when testing symbol presence

Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 77a42b5f177e308233ab108806c48b9590a780e2)

8 years agoUnix build: have the makedepend and cc actions in one recipe
Richard Levitte [Sun, 4 Sep 2016 06:10:22 +0000 (08:10 +0200)]
Unix build: have the makedepend and cc actions in one recipe

In the case of using an independent makedepend, we had split that into
two separate recipes, one depending on the other.  However, there are
cases where the makedepend recipe was always trying, but doesn't
update the time stamp of the .d file because there are no actual
changes, and thereby causing constant updates of the object files.

This change makes one recipe that takes care of both makedepend och
cc, thereby avoiding these extra updates.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit 7e5b8b93f2ffa8300b992d2e79c50f0e5266c61b)

8 years agomodes/asm/ghash-armv4.pl: improve interoperability with Android NDK.
Andy Polyakov [Sat, 27 Aug 2016 18:22:03 +0000 (20:22 +0200)]
modes/asm/ghash-armv4.pl: improve interoperability with Android NDK.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 6cf412c473d8145562b76219ce3da73b201b3255)

8 years agoConfigurations/10-main.conf: fix omittions in commentary.
Andy Polyakov [Wed, 31 Aug 2016 18:50:08 +0000 (20:50 +0200)]
Configurations/10-main.conf: fix omittions in commentary.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit d5a39c12f0331dd0d14dbfcf2b98921be4cbb1da)

8 years agoConfigurations/10-main.conf: remove solaris-x86-cc target.
Andy Polyakov [Wed, 31 Aug 2016 14:13:10 +0000 (16:13 +0200)]
Configurations/10-main.conf: remove solaris-x86-cc target.

Since vendor assembler can't assemble our modules with -KPIC flag,
it, assembly support, was not available as an option. But this
means lack of side-channel resistant code, which is incompatible
with security by todays standards.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 216a0cc4d6a35a21e613f1e7e9eee957768bf9dd)

8 years agoMove 05-test_fuzz.t to 90-test_fuzz.t
Richard Levitte [Thu, 1 Sep 2016 19:05:34 +0000 (21:05 +0200)]
Move 05-test_fuzz.t to 90-test_fuzz.t

This adheres much better to the documentation in test/README

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 377ab6d183453dac5454abf62d5341a559caa264)

8 years agoRevert "INSTALL: add information on option no-fuzz-test"
Richard Levitte [Thu, 1 Sep 2016 11:44:05 +0000 (13:44 +0200)]
Revert "INSTALL: add information on option no-fuzz-test"

This reverts commit 7f9ae88817ddf0aac5c6bd95d9a5af1c54ed5bbf.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit 967e831e88bc45ea32e5b3c762945859996771ff)

8 years agoRevert "Make it possible to disable fuzz testing"
Richard Levitte [Thu, 1 Sep 2016 11:43:40 +0000 (13:43 +0200)]
Revert "Make it possible to disable fuzz testing"

This reverts commit eb40eaed727500bf4a15f848c99e37edd18e142e.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit a5e1f1230e09b249ff94cc48aeffd1b874cb937e)

8 years agoINSTALL: add information on option no-fuzz-test
Richard Levitte [Wed, 31 Aug 2016 19:19:08 +0000 (21:19 +0200)]
INSTALL: add information on option no-fuzz-test

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 7f9ae88817ddf0aac5c6bd95d9a5af1c54ed5bbf)

8 years agoINSTALL: add information on the environment variable BUILDFILE
Richard Levitte [Wed, 31 Aug 2016 19:18:52 +0000 (21:18 +0200)]
INSTALL: add information on the environment variable BUILDFILE

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit ed43fe73ea30eae1506f0f6618a09d6a5819fc28)

8 years agoINSTALL: clarify OPENSSL_LOCAL_CONFIG_DIR
Richard Levitte [Wed, 31 Aug 2016 19:17:33 +0000 (21:17 +0200)]
INSTALL: clarify OPENSSL_LOCAL_CONFIG_DIR

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit bf98d9dab5a03b59ca45333b74ba51f58f57243b)

8 years agoHave Configure's HASH or TABLE produce complete lists
Richard Levitte [Wed, 31 Aug 2016 17:47:35 +0000 (19:47 +0200)]
Have Configure's HASH or TABLE produce complete lists

Because some targets execute perl code that might die, we risk
incomplete lists.  Make it so dying doesn't happen when we're listing
targets.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit d63c12c697faa4e2fa0e5d7565521a5813c86415)

8 years agoConfigure's print_table_entry printed incorrect information
Richard Levitte [Wed, 31 Aug 2016 17:47:08 +0000 (19:47 +0200)]
Configure's print_table_entry printed incorrect information

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 0c0d78b88d0bc4171b577ba3877c7b7ed0e91935)

8 years agoMake it possible to disable fuzz testing
Richard Levitte [Wed, 31 Aug 2016 15:07:44 +0000 (17:07 +0200)]
Make it possible to disable fuzz testing

These tests take a very long time on some platforms, and arent't
always strictly necessary.  This makes it possible to turn them
off.  The necessary binaries are still built, though, in case
someone still wants to do a manual run.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit eb40eaed727500bf4a15f848c99e37edd18e142e)

8 years agocrypto/bn/*: x86[_64] division instruction doesn't handle constants, change constrain...
Andy Polyakov [Sat, 27 Aug 2016 18:47:57 +0000 (20:47 +0200)]
crypto/bn/*: x86[_64] division instruction doesn't handle constants, change constraint from 'g' to 'r'.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 68b4a6e91f5acd42489bb9d1c580acc5ae457cad)

8 years agoThe Perl interpreter might be in a path with spaces, so maybe quote it
Richard Levitte [Tue, 30 Aug 2016 16:41:00 +0000 (18:41 +0200)]
The Perl interpreter might be in a path with spaces, so maybe quote it

Note: some shells do not like the command verb to be quoted, so we avoid
it unless it's actually necessary.

RT#4665

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit f879d5ff38d3c2283db968ea57c7a3207cc05889)

8 years agoCode cleanup UI
Rich Salz [Tue, 30 Aug 2016 17:31:18 +0000 (13:31 -0400)]
Code cleanup UI

Remove NULL check on parameter, and use NULL not ! on buffer.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit bde588df8a4d9f714cefe9cfd1a3931558de4c3c)

8 years agoAdd some CertStatus tests
Matt Caswell [Tue, 30 Aug 2016 13:20:18 +0000 (14:20 +0100)]
Add some CertStatus tests

The previous commit revealed a long standing problem where CertStatus
processing was broken in DTLS. This would have been revealed by better
testing - so add some!

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 767ccc3b77cde82c46ab4af541663f6c80e538d3)

8 years agoEnsure the CertStatus message adds a DTLS message header where needed
Matt Caswell [Tue, 30 Aug 2016 10:32:49 +0000 (11:32 +0100)]
Ensure the CertStatus message adds a DTLS message header where needed

The function tls_construct_cert_status() is called by both TLS and DTLS
code. However it only ever constructed a TLS message header for the message
which obviously failed in DTLS.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit f046afb0663fc4514f7fc5d1724439caa6858932)

8 years agoConfigure: save away the value of OPENSSL_LOCAL_CONFIG_DIR for reconf
Richard Levitte [Mon, 29 Aug 2016 20:11:36 +0000 (22:11 +0200)]
Configure: save away the value of OPENSSL_LOCAL_CONFIG_DIR for reconf

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit ee4cdb7fdbdc46f931cb6e2eca109cc92832eb33)

8 years agoConfigure: Redo the logic for finding build file templates
Richard Levitte [Mon, 29 Aug 2016 19:48:12 +0000 (21:48 +0200)]
Configure: Redo the logic for finding build file templates

Build file templates would be looked up like this if the user gave us
an additional directory to look for configuration files and build file
templates:

    $OPENSSL_LOCAL_CONFIG_DIR/$OSTYPE-Makefile.tmpl
    $SOURCEDIR/Configurations/$OSTYPE-Makefile.tmpl
    $OPENSSL_LOCAL_CONFIG_DIR/Makefile.tmpl
    $SOURCEDIR/Configurations/Makefile.tmpl

So for example, if the user created his own Makefile.tmpl and tried to
use it with a unixly config, it would never be user because we have a
unix-Makefile.tmpl in our Configurations directory.  This is clearly
wrong, and this change makes it look in this order instead:

    $OPENSSL_LOCAL_CONFIG_DIR/$OSTYPE-Makefile.tmpl
    $OPENSSL_LOCAL_CONFIG_DIR/Makefile.tmpl
    $SOURCEDIR/Configurations/$OSTYPE-Makefile.tmpl
    $SOURCEDIR/Configurations/Makefile.tmpl

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 79822c3cd55b9241187123fd016cb3c9a3beffbb)

8 years agoConfigure: clean away temporary section of code
Richard Levitte [Mon, 29 Aug 2016 19:46:29 +0000 (21:46 +0200)]
Configure: clean away temporary section of code

We've done away with Makefile as source of information and now use
configdata.pm exclusively.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit acc63c7d6d4ea28497a6192a3445b40f2af88133)

8 years agoMake it possible for the user to specify a different default build file
Richard Levitte [Mon, 29 Aug 2016 19:45:19 +0000 (21:45 +0200)]
Make it possible for the user to specify a different default build file

Make sure the information is kept for reconfiguration too.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 8b5156d18855f536cf5ceac10f5781e19fa8f1ea)

8 years agoRemove comment tags from structs (coding style)
Rich Salz [Mon, 29 Aug 2016 13:07:38 +0000 (09:07 -0400)]
Remove comment tags from structs (coding style)

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit d196305aa0de1fc38837c27cb1ea6e60af9dd98d)

8 years agoUse uppercase name for PCT_ enum
Rich Salz [Mon, 29 Aug 2016 12:23:25 +0000 (08:23 -0400)]
Use uppercase name for PCT_ enum

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 66117ab0f6c21a7c123becd58bd38a736e551c43)

8 years agoVMS: honor --openssldir setting
Richard Levitte [Fri, 26 Aug 2016 20:34:39 +0000 (22:34 +0200)]
VMS: honor --openssldir setting

Because of a perl operator priority mixup, the --openssldir argument
wasn't honored.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 661a396373fbd2082eee4ad6829336219ec7dac6)

8 years agoRemove trailing zeros
Rich Salz [Fri, 26 Aug 2016 17:07:56 +0000 (13:07 -0400)]
Remove trailing zeros

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit e5f969a82fa81fad8d1721fc0bc915ad3eea927c)

8 years agoImprove the definition of STITCHED_CALL in e_rc4_hmac_md5.c
Richard Levitte [Fri, 26 Aug 2016 07:59:55 +0000 (09:59 +0200)]
Improve the definition of STITCHED_CALL in e_rc4_hmac_md5.c

The definition of STITCHED_CALL relies on OPENSSL_NO_ASM.  However,
when a configuration simply lacks the assembler implementation for RC4
(which is where we have implemented the stitched call), OPENSSL_NO_ASM
isn't implemented.  Better, then, to rely on specific macros that
indicated that RC4 (and MD5) are implemented in assembler.

For this to work properly, we must also make sure Configure adds the
definition of RC4_ASM among the C flags.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit 216e8d91033d237880cff7da0d02d46d47bae41b)

8 years agoRemove note from CHANGES about EC DRBG
Matt Caswell [Thu, 25 Aug 2016 20:55:02 +0000 (21:55 +0100)]
Remove note from CHANGES about EC DRBG

EC DRBG support was added in 7fdcb457 in 2011 and then later removed.
However the CHANGES entry for its original addition was left behind.
This just removes the spurious CHANGES entry.

Reviewed-by: Stephen Henson <steve@openssl.org>
(cherry picked from commit bbf73f84fc42628cb619f9e8e02691530cfeb08e)

8 years agoPrepare for 1.1.0a-dev
Matt Caswell [Thu, 25 Aug 2016 15:30:15 +0000 (16:30 +0100)]
Prepare for 1.1.0a-dev

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoPrepare for 1.1.0 release OpenSSL_1_1_0
Matt Caswell [Thu, 25 Aug 2016 15:29:18 +0000 (16:29 +0100)]
Prepare for 1.1.0 release

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix uninit read in sslapitest
Matt Caswell [Thu, 25 Aug 2016 14:58:53 +0000 (15:58 +0100)]
Fix uninit read in sslapitest

msan detected an uninit read.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoCHANGES: mention Windows UTF-8 opt-in option.
Andy Polyakov [Thu, 25 Aug 2016 10:08:35 +0000 (12:08 +0200)]
CHANGES: mention Windows UTF-8 opt-in option.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoWindows: UTF-8 opt-in for command-line arguments and console input.
Andy Polyakov [Thu, 25 Aug 2016 06:06:26 +0000 (08:06 +0200)]
Windows: UTF-8 opt-in for command-line arguments and console input.

User can make Windows openssl.exe to treat command-line arguments
and console input as UTF-8 By setting OPENSSL_WIN32_UTF8 environment
variable (to any value). This is likely to be required for data
interchangeability with other OSes and PKCS#12 containers generated
with Windows CryptoAPI.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoSupport broken PKCS#12 key generation.
Dr. Stephen Henson [Wed, 24 Aug 2016 17:55:51 +0000 (18:55 +0100)]
Support broken PKCS#12 key generation.

OpenSSL versions before 1.1.0 didn't convert non-ASCII
UTF8 PKCS#12 passwords to Unicode correctly.

To correctly decrypt older files, if MAC verification fails
with the supplied password attempt to use the broken format
which is compatible with earlier versions of OpenSSL.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoDon't switch password formats using global state.
Andy Polyakov [Wed, 24 Aug 2016 17:54:10 +0000 (18:54 +0100)]
Don't switch password formats using global state.

To avoid possible race conditions don't switch password format using
global state in crypto/pkcs12

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix an uninitialised read on an error path
Matt Caswell [Thu, 25 Aug 2016 08:40:17 +0000 (09:40 +0100)]
Fix an uninitialised read on an error path

Found by Coverity.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoNEWS: add a number of the types that were made opaque
Richard Levitte [Thu, 25 Aug 2016 08:06:55 +0000 (10:06 +0200)]
NEWS: add a number of the types that were made opaque

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoUn-delete still documented X509_STORE_CTX_set_verify
Viktor Dukhovni [Wed, 24 Aug 2016 18:53:09 +0000 (14:53 -0400)]
Un-delete still documented X509_STORE_CTX_set_verify

It should not have been removed.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConfigurations/10-main.conf: fix solaris64-*-cc link problems.
Andy Polyakov [Wed, 24 Aug 2016 15:05:05 +0000 (17:05 +0200)]
Configurations/10-main.conf: fix solaris64-*-cc link problems.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoec/asm/ecp_nistz256-x86_64.pl: /cmovb/cmovc/ as nasm doesn't recognize cmovb.
Andy Polyakov [Wed, 24 Aug 2016 15:13:09 +0000 (17:13 +0200)]
ec/asm/ecp_nistz256-x86_64.pl: /cmovb/cmovc/ as nasm doesn't recognize cmovb.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoClarify the error messages in 08f6ae5b28
Matt Caswell [Wed, 24 Aug 2016 12:36:07 +0000 (13:36 +0100)]
Clarify the error messages in 08f6ae5b28

Ensure it is clear to the user why there has been an error.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix no-ec2m
Matt Caswell [Wed, 24 Aug 2016 12:54:05 +0000 (13:54 +0100)]
Fix no-ec2m

The new curves test did not take into account no-ec2m

Reviewed-by: Richard Levitte <levitte@openssl.org>