oweals/openssl.git
8 years agoDon't build sanitizer builds with --debug
Emilia Kasper [Fri, 26 Feb 2016 17:35:08 +0000 (18:35 +0100)]
Don't build sanitizer builds with --debug

They're too slow.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix master compile error
Matt Caswell [Fri, 26 Feb 2016 16:50:59 +0000 (16:50 +0000)]
Fix master compile error

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRemove comments saying you must do 'make -f Makefile.in TABLE'
Richard Levitte [Fri, 26 Feb 2016 14:36:33 +0000 (15:36 +0100)]
Remove comments saying you must do 'make -f Makefile.in TABLE'

Since the configs were remade into hash tables, this isn't needed
any more.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMake the table entry printer in Configure aware of ARRAYs
Richard Levitte [Wed, 24 Feb 2016 00:32:51 +0000 (01:32 +0100)]
Make the table entry printer in Configure aware of ARRAYs

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGH680: Reuse strnlen() in strndup()
Dmitry-Me [Mon, 15 Feb 2016 07:12:40 +0000 (10:12 +0300)]
GH680: Reuse strnlen() in strndup()

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoEC_KEY_priv2buf (): check parameter sanity
J Mohan Rao Arisankala [Wed, 24 Feb 2016 07:33:10 +0000 (13:03 +0530)]
EC_KEY_priv2buf (): check parameter sanity

In EC_KEY_priv2buf(), check for pbuf sanity.
If invoked with NULL, gracefully returns the key length.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agocheck with NULL
J Mohan Rao Arisankala [Wed, 24 Feb 2016 00:36:24 +0000 (06:06 +0530)]
check with NULL

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoexplicit check for NULL
J Mohan Rao Arisankala [Wed, 24 Feb 2016 00:30:48 +0000 (06:00 +0530)]
explicit check for NULL

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoCheck method before access and release ctx in error paths
J Mohan Rao Arisankala [Tue, 23 Feb 2016 17:03:28 +0000 (22:33 +0530)]
Check method before access and release ctx in error paths

- In error paths, EVP_MD_CTX allocated by the callee is not released.
- Checking method before accessing

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRT4335: Fix UEFI build of OBJ_NAME_new_index()
David Woodhouse [Mon, 22 Feb 2016 16:29:12 +0000 (16:29 +0000)]
RT4335: Fix UEFI build of OBJ_NAME_new_index()

We are using strcmp() as the cmp_func, where in the EDK2 environment
strcmp actually ends up being the external AsciiStrCmp() function —
an EFI library function defined with the Microsoft ABI.

This means that we can't just assign function pointers to it, since
in GCC-hosted builds the ABI of any function *not* explicitly marked
EFIAPI is the native SysV ABI.

Arguably this stupidity ought to be resolved on the UEFI side, but in
the general case that would mean that we need to provide ABI-compatible
wrappers for *all* the "standard" functions, just in case they're used
like this.

And in fact we already have a workaround here for DEC C. So instead of
playing games with casting function pointers, it's nicer just to use a
simple function to wrap the strcmp() call. That cleans up the DEC C
workaround, *and* it works around the UEFI bogosity at the same time.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoForgotten change of add() call in Configure
Richard Levitte [Fri, 26 Feb 2016 11:25:13 +0000 (12:25 +0100)]
Forgotten change of add() call in Configure

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoFix a mkdef.pl warning
Matt Caswell [Fri, 26 Feb 2016 14:10:17 +0000 (14:10 +0000)]
Fix a mkdef.pl warning

mkdef.pl was issuing the following error:

 Use of uninitialized value within %tag in numeric eq (==) at
 util/mkdef.pl line 560, <IN> line 92

This was because it was treating a __cplusplus "#ifdef" check as a "tag"
but then skipping over the corresponding "#endif". Therefore after
processing a file it still had "left over" tags from processing the
previous file. It was also getting confused by "#if" checks that didn't
match is pre-defined styles.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUnified on VMS - add %disabled in vmsconfig.pm (util/dofile.pl demands it)
Richard Levitte [Fri, 26 Feb 2016 07:46:44 +0000 (08:46 +0100)]
Unified on VMS - add %disabled in vmsconfig.pm (util/dofile.pl demands it)

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoNormalise the include directives in ct_test.c
Richard Levitte [Fri, 26 Feb 2016 07:57:06 +0000 (08:57 +0100)]
Normalise the include directives in ct_test.c

build.info needed a slight update, one more include directory.

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoImplement new multi-threading API
Alessandro Ghedini [Sun, 25 Oct 2015 16:43:55 +0000 (17:43 +0100)]
Implement new multi-threading API

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoConfigure - neater looking add() and add_before()
Richard Levitte [Wed, 24 Feb 2016 23:17:59 +0000 (00:17 +0100)]
Configure - neater looking add() and add_before()

They now default to " " as separator, but that can be overridden by
having a hash with parameters as last argument.  The only currently
recognised parameter is `separator'.

The special separator `undef' will force the result to become a list
rather than a concatenated string.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoUpdate test build/run for unified
Rich Salz [Thu, 25 Feb 2016 21:48:36 +0000 (16:48 -0500)]
Update test build/run for unified

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix memory issues in BIO_*printf functions
Matt Caswell [Thu, 25 Feb 2016 13:09:46 +0000 (13:09 +0000)]
Fix memory issues in BIO_*printf functions

The internal |fmtstr| function used in processing a "%s" format string
in the BIO_*printf functions could overflow while calculating the length
of a string and cause an OOB read when printing very long strings.

Additionally the internal |doapr_outch| function can attempt to write to
an OOB memory location (at an offset from the NULL pointer) in the event of
a memory allocation failure. In 1.0.2 and below this could be caused where
the size of a buffer to be allocated is greater than INT_MAX. E.g. this
could be in processing a very long "%s" format string. Memory leaks can also
occur.

These issues will only occur on certain platforms where sizeof(size_t) >
sizeof(int). E.g. many 64 bit systems. The first issue may mask the second
issue dependent on compiler behaviour.

These problems could enable attacks where large amounts of untrusted data
is passed to the BIO_*printf functions. If applications use these functions
in this way then they could be vulnerable. OpenSSL itself uses these
functions when printing out human-readable dumps of ASN.1 data. Therefore
applications that print this data could be vulnerable if the data is from
untrusted sources. OpenSSL command line applications could also be
vulnerable where they print out ASN.1 data, or if untrusted data is passed
as command line arguments.

Libssl is not considered directly vulnerable. Additionally certificates etc
received via remote connections via libssl are also unlikely to be able to
trigger these issues because of message size limits enforced within libssl.

CVE-2016-0799

Issue reported by Guido Vranken.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agofix "no-engine" build of test fixture
FdaSilvaYY [Thu, 25 Feb 2016 19:55:51 +0000 (20:55 +0100)]
fix "no-engine" build of test fixture

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd some 'no-engine' builds to travis, for test
FdaSilvaYY [Thu, 25 Feb 2016 19:54:40 +0000 (20:54 +0100)]
Add some 'no-engine' builds to travis, for test

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGH715: ENGINE_finish can take NULL
Rich Salz [Thu, 25 Feb 2016 17:09:06 +0000 (12:09 -0500)]
GH715: ENGINE_finish can take NULL

Simplifies calling code.  Also fixed up any !ptr tests that were
nearby, turning them into NULL tests.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix unified build after CT reorg
Rich Salz [Thu, 25 Feb 2016 19:05:35 +0000 (14:05 -0500)]
Fix unified build after CT reorg

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoTests for parsing and printing certificates containing SCTs
Rob Percival [Mon, 22 Feb 2016 16:51:44 +0000 (16:51 +0000)]
Tests for parsing and printing certificates containing SCTs

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd more CT utility routines to be used as part of larger patch.
Adam Eijdenberg [Fri, 4 Dec 2015 18:49:14 +0000 (10:49 -0800)]
Add more CT utility routines to be used as part of larger patch.

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGH463: Fix OPENSSL_NO_OCSP build
Rich Salz [Thu, 25 Feb 2016 05:56:35 +0000 (00:56 -0500)]
GH463: Fix OPENSSL_NO_OCSP build

Fixes github issue 463.  Building the app without OPENSSL_NO_SOCK
isn't supported, so only do OPENSSL_NO_OCSP.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoFix indents
Rich Salz [Thu, 25 Feb 2016 05:12:57 +0000 (00:12 -0500)]
Fix indents

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoBuild fix: remove cleanse_ctr
Rich Salz [Thu, 25 Feb 2016 15:16:42 +0000 (10:16 -0500)]
Build fix: remove cleanse_ctr

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoRT4116: Change cleanse to just memset
Rich Salz [Thu, 25 Feb 2016 13:29:52 +0000 (08:29 -0500)]
RT4116: Change cleanse to just memset

See also the discussion in https://github.com/openssl/openssl/pull/455

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoCVE-2016-0798: avoid memory leak in SRP
Emilia Kasper [Wed, 24 Feb 2016 11:59:59 +0000 (12:59 +0100)]
CVE-2016-0798: avoid memory leak in SRP

The SRP user database lookup method SRP_VBASE_get_by_user had confusing
memory management semantics; the returned pointer was sometimes newly
allocated, and sometimes owned by the callee. The calling code has no
way of distinguishing these two cases.

Specifically, SRP servers that configure a secret seed to hide valid
login information are vulnerable to a memory leak: an attacker
connecting with an invalid username can cause a memory leak of around
300 bytes per connection.

Servers that do not configure SRP, or configure SRP but do not configure
a seed are not vulnerable.

In Apache, the seed directive is known as SSLSRPUnknownUserSeed.

To mitigate the memory leak, the seed handling in SRP_VBASE_get_by_user
is now disabled even if the user has configured a seed.

Applications are advised to migrate to SRP_VBASE_get1_by_user. However,
note that OpenSSL makes no strong guarantees about the
indistinguishability of valid and invalid logins. In particular,
computations are currently not carried out in constant time.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoSolaris DSOs were still named libFOO.so, fixed
Richard Levitte [Wed, 24 Feb 2016 00:45:25 +0000 (01:45 +0100)]
Solaris DSOs were still named libFOO.so, fixed

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoMake it possible to build even if dependency files can't be generated
Richard Levitte [Thu, 25 Feb 2016 13:36:30 +0000 (14:36 +0100)]
Make it possible to build even if dependency files can't be generated

If the local system doesn't have GNU C or clang, and not even
makedepend, the build will stop because the call of 'makedepend'
fails.  This changes so the build won't stop because of such failure.
The result will be empty .d files, and that's ok.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGH742: keep gost specific variable under macro
J Mohan Rao Arisankala [Thu, 25 Feb 2016 03:01:50 +0000 (08:31 +0530)]
GH742: keep gost specific variable under macro

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoGH235: Set error status on malloc failure
Rich Salz [Thu, 25 Feb 2016 05:45:08 +0000 (00:45 -0500)]
GH235: Set error status on malloc failure

Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoGH480: Don't break statements with CPP stuff.
Flavio Medeiros [Sun, 31 Jan 2016 01:14:39 +0000 (20:14 -0500)]
GH480: Don't break statements with CPP stuff.

This is also RT 4137

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoFix typo, reformat comment.
Rich Salz [Wed, 24 Feb 2016 15:59:14 +0000 (10:59 -0500)]
Fix typo, reformat comment.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoRemove unused parameter in ssl_set_masks().
Dr. Stephen Henson [Wed, 17 Feb 2016 15:39:25 +0000 (15:39 +0000)]
Remove unused parameter in ssl_set_masks().

The ssl_set_masks() function no longer depends on the cipher. This
also means there is no need to set the masks for each cipher in
ssl3_choose_cipher.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUpdate documentation of SSL METHODs and ciphers
Viktor Dukhovni [Sun, 21 Feb 2016 21:37:14 +0000 (16:37 -0500)]
Update documentation of SSL METHODs and ciphers

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agocorrect name of GNU shared libraries
Roumen Petrov [Tue, 23 Feb 2016 19:34:16 +0000 (21:34 +0200)]
correct name of GNU shared libraries

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agotest/ectest.c: add regression test for RT#4284.
Andy Polyakov [Sun, 21 Feb 2016 20:05:50 +0000 (21:05 +0100)]
test/ectest.c: add regression test for RT#4284.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoec/asm/ecp_nistz256-*.pl: get corner case logic right.
Andy Polyakov [Sun, 21 Feb 2016 20:04:26 +0000 (21:04 +0100)]
ec/asm/ecp_nistz256-*.pl: get corner case logic right.

RT#4284

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoec/asm/ecp_nistz256-x86_64.pl: get corner case logic right.
Andy Polyakov [Wed, 3 Feb 2016 10:26:11 +0000 (11:26 +0100)]
ec/asm/ecp_nistz256-x86_64.pl: get corner case logic right.

RT#4284

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agotest/recipes/80-test_ca.t: remove_tree->rmtree to make it work with Perl 5.10.
Andy Polyakov [Sun, 21 Feb 2016 20:54:30 +0000 (21:54 +0100)]
test/recipes/80-test_ca.t: remove_tree->rmtree to make it work with Perl 5.10.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agopoly1305/asm/poly1305-armv4.pl: replace ambiguous instruction.
Andy Polyakov [Mon, 22 Feb 2016 16:39:00 +0000 (17:39 +0100)]
poly1305/asm/poly1305-armv4.pl: replace ambiguous instruction.

Different assembler versions disagree on how to interpret #-1 as
argument to vmov.i64, as 0xffffffffffffffff or 0x00000000ffffffff.
So replace it with something they can't disagree on.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRT4339: Fix handling of <internal/bn_conf.h>
David Woodhouse [Sat, 20 Feb 2016 14:40:48 +0000 (14:40 +0000)]
RT4339: Fix handling of <internal/bn_conf.h>

The entire contents of <internal/bn_conf.h> are unwanted in the UEFI
build because we have to do it differently there. To support building
for both 32-bit and 64-bit platforms without re-running the OpenSSL
Configure script, the EDK2 environment defines THIRTY_TWO_BIT or
SIXTY_FOUR_BIT for itself according to the target platform.

The current setup is broken, though. It checks for OPENSSL_SYS_UEFI but
before it's actually defined, since opensslconf.h hasn't yet been
included.

Let's fix that by including opensslconf.h. And also let's move the
bn_conf.h doesn't even need to *exist* in the UEFI build environment.

This is also GH PR736.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoGH735: remove unnecessary allocation
J Mohan Rao Arisankala [Tue, 23 Feb 2016 14:50:50 +0000 (20:20 +0530)]
GH735: remove unnecessary allocation

Removing code, where memory was getting allocated for an unused variable

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoAdd PKCS7_NO_DUAL_CONTENT flag
Rich Salz [Mon, 22 Feb 2016 17:07:06 +0000 (12:07 -0500)]
Add PKCS7_NO_DUAL_CONTENT flag

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoRemove all -march= from configs
Richard Levitte [Mon, 22 Feb 2016 20:02:42 +0000 (21:02 +0100)]
Remove all -march= from configs

These flags are limitting needlessly, are often patched by packagers,
and should be specified on the configuration command line by anyone
who desires for it to be specific rather than forced by us.

This work was already done with mingw when those configs were worked
on, now it gets applied to the remaining configs.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoAdd OPENSSL_PIC back
Richard Levitte [Sun, 21 Feb 2016 19:52:39 +0000 (20:52 +0100)]
Add OPENSSL_PIC back

In the earlier change, where static libraries get built with position
independent code, OPENSSL_PIC was removed by mistake.  This adds it
back.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoRemove unused parameters from internal functions
Rich Salz [Sun, 14 Feb 2016 03:33:56 +0000 (22:33 -0500)]
Remove unused parameters from internal functions

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUse $disabled{shared} in a safer manner
Richard Levitte [Mon, 22 Feb 2016 18:17:55 +0000 (19:17 +0100)]
Use $disabled{shared} in a safer manner

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoThe build files use %disabled, make sure to pass it to them
Richard Levitte [Mon, 22 Feb 2016 18:17:06 +0000 (19:17 +0100)]
The build files use %disabled, make sure to pass it to them

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMemorySanitizer: address false positive
Emilia Kasper [Mon, 22 Feb 2016 15:58:36 +0000 (16:58 +0100)]
MemorySanitizer: address false positive

Explicitly unpoison the result of FD_ZERO

Tests now pass, using -fsanitize=memory

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGH678: Add a few more zalloc
FdaSilvaYY [Sun, 14 Feb 2016 17:44:30 +0000 (18:44 +0100)]
GH678: Add a few more zalloc

Remove some duplicated NULL/zero init.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoRT4334: Check UEFI before __STDC_VERSION__ for <inttypes.h>
David Woodhouse [Mon, 22 Feb 2016 16:54:57 +0000 (16:54 +0000)]
RT4334: Check UEFI before __STDC_VERSION__ for <inttypes.h>

Adding -nostdinc to the EDK2 showed that we were including <inttypes.h>
for some UEFI builds, because the check for __STDC_VERSION__ happens
before the check for OPENSSL_SYS_UEFI. Fix that.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoPartial revert of 1288f26 and fix for no-async
Matt Caswell [Thu, 18 Feb 2016 16:54:16 +0000 (16:54 +0000)]
Partial revert of 1288f26 and fix for no-async

The commit 1288f26 says that it fixes no-async, but instead seems to break
it. Therefore revert that change and fix no-async.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRT4309: Define PRIu64 for UEFI build
David Woodhouse [Mon, 5 Oct 2015 10:24:09 +0000 (11:24 +0100)]
RT4309: Define PRIu64 for UEFI build

Provide an appropriate definition of PRIu64 for the EDK2 build, since
we don't have <inttypes.h> there.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoRT4320/GH705: Fix PEM parsing bug.
Rich Salz [Wed, 17 Feb 2016 21:13:49 +0000 (16:13 -0500)]
RT4320/GH705: Fix PEM parsing bug.

Also removing confusing pointer-alias variable.
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoGH721: Duplicated flags in doc
Rich Salz [Mon, 22 Feb 2016 15:58:20 +0000 (10:58 -0500)]
GH721: Duplicated flags in doc

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoClean away $no_dso since with have $disabled{dso}
Richard Levitte [Mon, 22 Feb 2016 13:12:35 +0000 (14:12 +0100)]
Clean away $no_dso since with have $disabled{dso}

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoClean away $no_asm since with have $disabled{asm}
Richard Levitte [Mon, 22 Feb 2016 13:10:45 +0000 (14:10 +0100)]
Clean away $no_asm since with have $disabled{asm}

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoClean away $no_rfc3779 since we don't appear to use it at all
Richard Levitte [Mon, 22 Feb 2016 13:06:16 +0000 (14:06 +0100)]
Clean away $no_rfc3779 since we don't appear to use it at all

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoClean away $zlib since with have $disabled{zlib}
Richard Levitte [Mon, 22 Feb 2016 13:04:45 +0000 (14:04 +0100)]
Clean away $zlib since with have $disabled{zlib}

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoClean away $no_threads since we have $disabled{threads}
Richard Levitte [Mon, 22 Feb 2016 13:03:23 +0000 (14:03 +0100)]
Clean away $no_threads since we have $disabled{threads}

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoClean away $config{no_shared} since we have $disabled{shared}
Richard Levitte [Mon, 22 Feb 2016 12:52:46 +0000 (13:52 +0100)]
Clean away $config{no_shared} since we have $disabled{shared}

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoExpose %disables to the perl fragments in build.info files.
Richard Levitte [Mon, 22 Feb 2016 12:45:46 +0000 (13:45 +0100)]
Expose %disables to the perl fragments in build.info files.

This way, we can use them as conditions instead of relying to more or
less obscure aliases in %config or variables directly in Configure.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix DSO name on HP/UX
Richard Levitte [Mon, 22 Feb 2016 13:33:38 +0000 (14:33 +0100)]
Fix DSO name on HP/UX

If dlfcn is used, the name was set to lib$(LIBNAME).so when it should
have been just $(LIBNAME).so.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoFix a few typos
Richard Levitte [Mon, 22 Feb 2016 14:57:25 +0000 (15:57 +0100)]
Fix a few typos

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMissed an experimental.
Rich Salz [Mon, 22 Feb 2016 14:40:39 +0000 (09:40 -0500)]
Missed an experimental.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoDon't include all symbols from static libraries when building a DSO
Richard Levitte [Mon, 22 Feb 2016 11:57:08 +0000 (12:57 +0100)]
Don't include all symbols from static libraries when building a DSO

When building a DSO, there's no reason to include all symbols from
static libraries it happens to link with, whichever they may be.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGet back "ssl2" as a deprecated disablable option
Richard Levitte [Mon, 22 Feb 2016 09:42:53 +0000 (10:42 +0100)]
Get back "ssl2" as a deprecated disablable option

Preserved for now for those who have scripts with the option
"no-ssl2".  We warn that it's deprecated, and ignore it otherwise.

In response to RT#4330

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd a "no-pic" build for Travis
Richard Levitte [Mon, 22 Feb 2016 09:01:42 +0000 (10:01 +0100)]
Add a "no-pic" build for Travis

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRewrite CHANGES to add some commentary about the "pic" option
Richard Levitte [Mon, 22 Feb 2016 09:16:50 +0000 (10:16 +0100)]
Rewrite CHANGES to add some commentary about the "pic" option

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoIntroduce the "pic" / "no-pic" config option
Richard Levitte [Mon, 22 Feb 2016 01:09:11 +0000 (02:09 +0100)]
Introduce the "pic" / "no-pic" config option

Building shared libraries or not is not the same as building position
independent code or not.  It's true that if you don't build PIC, you
can't build shared libraries.  However, you may very well want to
build only static libraries but still want PIC code.

Therefore, we introduce a new configuration option "pic", which is
enabled by default or explicitely with "enable-pic", or disabled with
"no-pic" or "disable-pic".  Of course, if "pic" is disabled, "shared"
and "dynamic-engine" are automatically disabled as well.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUse $disabled{"dynamic-engine"} internally
Richard Levitte [Mon, 22 Feb 2016 01:06:05 +0000 (02:06 +0100)]
Use $disabled{"dynamic-engine"} internally

We were kinda sorta using a mix of $disabled{"static-engine" and
$disabled{"dynamic-engine"} in Configure.  Let's avoid confusion,
choose one of them and stick to it.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix incorrect SO name on GNU platforms
Richard Levitte [Mon, 22 Feb 2016 13:26:40 +0000 (14:26 +0100)]
Fix incorrect SO name on GNU platforms

An error was introduced with the setting of SHLIB in DO_GNU_SO.
A common DO_GNU_SO_COMMON that both DO_GNU_SO and DO_GNU_SO_NOCALC use
makes things clearer.

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoDon't use 'parent' in util/dofile.pl
Richard Levitte [Sun, 21 Feb 2016 21:43:29 +0000 (22:43 +0100)]
Don't use 'parent' in util/dofile.pl

Because we're requiring Perl 5.10.0 and the 'parent' didn't appear
before Perl 5.10.1, we need to resort to the older parent module
declaration style, modifying @ISA.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoCheck that any dependency file is newer than Makefile before concatenating
Richard Levitte [Sun, 21 Feb 2016 15:09:36 +0000 (16:09 +0100)]
Check that any dependency file is newer than Makefile before concatenating

On slower file systems, this makes a huge difference

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoDocument the last configuration changes
Richard Levitte [Sat, 20 Feb 2016 16:06:54 +0000 (17:06 +0100)]
Document the last configuration changes

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAvoid GNU make re-exec when adding dependencies to Makefile
Richard Levitte [Sat, 20 Feb 2016 16:29:23 +0000 (17:29 +0100)]
Avoid GNU make re-exec when adding dependencies to Makefile

GNU make will re-exec if (it thinks that) the Makefile has changed.
Just having the target Makefile seems to make it think it has, so we
end up in a look where GNU make re-execs for ever.

The fix is easy, just remove the Makefile target and have the depend
target run the recipe on its own instead of depending on Makefile.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoWork-around for proxy->s_server retry logic
Viktor Dukhovni [Sat, 20 Feb 2016 23:17:28 +0000 (18:17 -0500)]
Work-around for proxy->s_server retry logic

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRemove OBJ_EXT and friends.
Ben Laurie [Sat, 20 Feb 2016 15:27:27 +0000 (15:27 +0000)]
Remove OBJ_EXT and friends.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoMissing extension on dependency, .d file is not always made (e.g. when input
Ben Laurie [Sat, 20 Feb 2016 12:50:30 +0000 (12:50 +0000)]
Missing extension on dependency, .d file is not always made (e.g. when input
is a .s).

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUnified on VMS - install dynamic engines if there are any
Richard Levitte [Fri, 19 Feb 2016 23:10:43 +0000 (00:10 +0100)]
Unified on VMS - install dynamic engines if there are any

Don't check for no_shared

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRun the TLSProxy based tests as long as dynamic engines are built.
Richard Levitte [Fri, 19 Feb 2016 21:13:11 +0000 (22:13 +0100)]
Run the TLSProxy based tests as long as dynamic engines are built.

They depend on this feature because they use the engine ossltest,
which is only available as a dynamic engine.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoBuild dynamic engines even if configured "no-shared"
Richard Levitte [Fri, 19 Feb 2016 21:08:37 +0000 (22:08 +0100)]
Build dynamic engines even if configured "no-shared"

Until now, the engines in engines/ were only built as dynamicaly
loadable ones if shared libraries were built.

We not dissociate the two and can build dynamicaly loadable engines
even if we only build static libcrypto and libssl.  This is controlled
with the option (enable|disable|no)-static-engine, defaulting to
no-static-engine.

Note that the engines in crypto/engine/ (dynamic and cryptodev) will
always be built into libcrypto.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAlways build library object files with shared library cflags
Richard Levitte [Fri, 19 Feb 2016 21:02:41 +0000 (22:02 +0100)]
Always build library object files with shared library cflags

This takes us away from the idea that we know exactly how our static
libraries are going to get used.  Instead, we make them available to
build shareable things with, be it other shared libraries or DSOs.

On the other hand, we also have greater control of when the shared
library cflags.  They will never be used with object files meant got
binaries, such as apps/openssl or test/test*.

With unified, we take this a bit further and prepare for having to
deal with extra cflags specifically to be used with DSOs (dynamic
engines), libraries and binaries (applications).

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMake crypto/buildinf.h depend on configdata.pm rather than Makefile
Richard Levitte [Fri, 19 Feb 2016 23:21:04 +0000 (00:21 +0100)]
Make crypto/buildinf.h depend on configdata.pm rather than Makefile

Depending on Makefile meant that a new attempt to rebuild the Makefile
with "new" dependency data was done all the time, uncontrolled.  Better
to depend on configdata.pm, which truly only changes with reconfiguration.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Ben Laurie <ben@openssl.org>
8 years agoargv was set but unused
Kurt Roeckx [Sun, 14 Feb 2016 19:45:02 +0000 (20:45 +0100)]
argv was set but unused

Also gives an error message when you gave it a parameter it didn't expect.

Reviewed-by: Rich Salz <rsalz@openssl.org>
MR: #2009

8 years agoapps_extra_src changed name to apps_aux_src, rename everywhere
Richard Levitte [Fri, 19 Feb 2016 22:55:30 +0000 (23:55 +0100)]
apps_extra_src changed name to apps_aux_src, rename everywhere

One spot was forgotten.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoVMS static libraries have the extension .OLB, not .LIB
Richard Levitte [Fri, 19 Feb 2016 22:49:05 +0000 (23:49 +0100)]
VMS static libraries have the extension .OLB, not .LIB

Object LiBrary

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUnified 'make depend' has to cleanup after itself
Richard Levitte [Fri, 19 Feb 2016 22:34:25 +0000 (23:34 +0100)]
Unified 'make depend' has to cleanup after itself

It failed to remove lingering Makefile.new

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix Configurations/unix-Makefile.tmpl
Richard Levitte [Fri, 19 Feb 2016 21:23:28 +0000 (22:23 +0100)]
Fix Configurations/unix-Makefile.tmpl

It was turning off output again in two place where it should have
turned it on.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMakefile.shared: limit .dll image base pinning to FIPS builds.
Andy Polyakov [Fri, 19 Feb 2016 12:41:58 +0000 (13:41 +0100)]
Makefile.shared: limit .dll image base pinning to FIPS builds.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoRemove DSA negative integer workaround code.
Dr. Stephen Henson [Thu, 18 Feb 2016 13:18:48 +0000 (13:18 +0000)]
Remove DSA negative integer workaround code.

Remove DSA private key code which tolerates broken implementations which
use negative integers.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoRemove broken DSA private key workarounds.
Dr. Stephen Henson [Thu, 18 Feb 2016 13:09:24 +0000 (13:09 +0000)]
Remove broken DSA private key workarounds.

Remove old code that handled various invalid DSA formats in ancient
software.

This also fixes a double free bug when parsing malformed DSA private keys.

Thanks to Adam Langley (Google/BoringSSL) for discovering this bug using
libFuzzer.

CVE-2016-0705

Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoTLS: reject duplicate extensions
Emilia Kasper [Fri, 19 Feb 2016 16:24:44 +0000 (17:24 +0100)]
TLS: reject duplicate extensions

Adapted from BoringSSL. Added a test.

The extension parsing code is already attempting to already handle this for
some individual extensions, but it is doing so inconsistently. Duplicate
efforts in individual extension parsing will be cleaned up in a follow-up.

Reviewed-by: Stephen Henson <steve@openssl.org>
8 years agogetaddrinfo: zero the hints structure
Emilia Kasper [Fri, 19 Feb 2016 15:23:08 +0000 (16:23 +0100)]
getaddrinfo: zero the hints structure

This silences the memory sanitizer. All fields were already correctly
initialized but the struct padding wasn't, causing an uninitialized read
warning.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoGH712: Missed some no-filenames cases
Viktor Szakats [Fri, 19 Feb 2016 11:26:17 +0000 (12:26 +0100)]
GH712:  Missed some no-filenames cases

crypto.h: honor no-filenames config setting in missing cases

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoMake sure the linked programs have the correct extension
Richard Levitte [Thu, 18 Feb 2016 16:18:55 +0000 (17:18 +0100)]
Make sure the linked programs have the correct extension

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoBig rename fest of MingW shared libraries
Richard Levitte [Tue, 16 Feb 2016 19:37:28 +0000 (20:37 +0100)]
Big rename fest of MingW shared libraries

So far, MingW shared libraries were named like this

  libeay32.dll + libeay32.dll.a
  ssleay32.dll + ssleay32.dll.a

That naming scheme is antiquated, a reminicense of SSLeay.  We're
therefore changing the scheme to something that's more like the rest
of OpenSSL.

There are two factors to remember:

  - Windows libraries have no recorded SOvers, which means that the
    shared library version must be encoded in the name.  According to
    some, it's unwise to encode extra periods in a Windows file name,
    so we convert version number periods to underscores.
  - MingW has multilib ability.  However, DLLs need to reside with the
    binaries that use them, so to allow both 32-bit and 64-bit DLLs to
    reside in the same place, we add '-x64' in the name of the 64-bit
    ones.

The resulting name scheme (for SOver 1.1) is this:

  on x86:
  libcrypto-1_1.dll + libcrypto.dll.a
  libssl-1_1.dll + libssl.dll.a

  on x86_64:
  libcrypto-1_1-x64.dll + libcrypto.dll.a
  libssl-1_1-x64.dll + libssl.dll.a

An observation is that the import lib is the same for both
architectures.  Not to worry, though, as they will be installed in
PREFIX/lib/ for x86 and PREFIX/lib64/ for x86_64.

As a side effect, MingW got its own targets in Makefile.shared.
link_dso.mingw-shared and link_app.mingw-shared are aliases for the
corresponding cygwin-shared targets.  link_shlib.mingw-shared is,
however, a target separated from the cygwin one.

Reviewed-by: Andy Polyakov <appro@openssl.org>