openssl.git
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>
8 years agoMisc small fixes.
Richard Levitte [Mon, 15 Feb 2016 21:13:41 +0000 (22:13 +0100)]
Misc small fixes.

Better libclean that removes the exact files that have been built,
nothing more and nothing less.

Corrected typo

A couple of editorial changes.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoTry removing installation directories after having uninstalled files
Richard Levitte [Mon, 15 Feb 2016 21:12:24 +0000 (22:12 +0100)]
Try removing installation directories after having uninstalled files

Of course, if there are remaining files in a directory, it won't be removed.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoSmall rename fest in unified, obj2dynlib -> obj2dso
Richard Levitte [Mon, 15 Feb 2016 17:45:54 +0000 (18:45 +0100)]
Small rename fest in unified, obj2dynlib -> obj2dso

Since we're using the acronym DSO everywhere else and that's a common
name for that kind of object, we might as well do so here as well.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoRemake the installation of shared libraries in unix-Makefile.tmpl
Richard Levitte [Mon, 15 Feb 2016 17:39:49 +0000 (18:39 +0100)]
Remake the installation of shared libraries in unix-Makefile.tmpl

Instead of having the installation recipe rely on special knowledge,
feed it with information, including what shared library files belong
together.  For Cygwin and Mingw, that's the .dll and its import
library .dll.a.  For Unixen, it's the shared library file name with SO
version and the one without.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoBig rename fest of engine DSO names, from libFOO.so to FOO.so
Richard Levitte [Mon, 15 Feb 2016 17:29:09 +0000 (18:29 +0100)]
Big rename fest of engine DSO names, from libFOO.so to FOO.so

The engine DSOs were named as if they were shared libraries, and could
end up having all sorts of fancy names:

  Cygwin: cygFOO.dll
  Mingw:  FOOeay32.dll
  Unix:   libFOO.so / libFOO.sl / libFOO.dylib / ...

This may be confusing, since they look like libraries one should link
with at link time, when they're just DSOs.

It's therefore time to rename them, and do it consistently on all
platforms:

  Cygwin & Mingw: FOO.dll
  Unix:           FOO.{so,sl,dylib,...}

Interestingly enough, the MSVC and VMS builds always did it this way.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoSimplify the generation of ld scripts for Linux and Solaris
Richard Levitte [Mon, 15 Feb 2016 17:19:49 +0000 (18:19 +0100)]
Simplify the generation of ld scripts for Linux and Solaris

Because we know for certain that the link_shlib targets are used
exclusively for shared libraries (libcrypto and libssl) and that they
must have an associated .num file, we don't need to check the library
name to produce an ld script.  Just do it unconditionally.

link_shlib.linux-shared can be simplified further, as most of it is
exactly the same as $(DO_GNU_SO) with just one variable modification.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoBig rename fest in makefile.shared: link_a / link_o -> link_shlib / link_dso
Richard Levitte [Mon, 15 Feb 2016 17:02:52 +0000 (18:02 +0100)]
Big rename fest in makefile.shared: link_a / link_o -> link_shlib / link_dso

Originally, the Makefile.shared targets described what they used as
input for a shared object, be it a shared library or a DSO.  It turned
out, however, that the link_o targets were used exclusively for
engines and the link_a targets were for libcrypto and libssl.

This rename fest turns and indication on the kind of input the targets
get to the intention with using them.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoCentralise the shared library / dso name info in unix-Makefile.tmpl
Richard Levitte [Mon, 15 Feb 2016 16:42:14 +0000 (17:42 +0100)]
Centralise the shared library / dso name info in unix-Makefile.tmpl

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoLet Configure figure out the diverse shared library and DSO extensions
Richard Levitte [Mon, 15 Feb 2016 16:20:15 +0000 (17:20 +0100)]
Let Configure figure out the diverse shared library and DSO extensions

Then it can pass around the information where it belongs.  The
Makefile templates pick it up along with other target data, the
DSO module gets to pick up the information through
crypto/include/internal/dso_conf.h

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoVMS fixed in unified build
Richard Levitte [Fri, 19 Feb 2016 08:53:05 +0000 (09:53 +0100)]
VMS fixed in unified build

- install_sw had a display of text that belongs under the install target
- previous layout installed architecture dependent files in
  dev:['prefix'.'arch'.LIB], dev:['prefix'.'arch'.EXE] and
  dev:['prefix'.'arch'.ENGINES].  Changed to dev:['prefix'.LIB.'arch'],
  dev:['prefix'.EXE.'arch'] and dev:['prefix'.ENGINES.'arch'] instead.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoUnified - don't install the ossltest engine
Richard Levitte [Fri, 19 Feb 2016 09:39:12 +0000 (10:39 +0100)]
Unified - don't install the ossltest engine

This is done with a simple file name comparison.  We could think of
something more elegant in the future.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoUnified - do a better job when uninstalling
Richard Levitte [Fri, 19 Feb 2016 09:38:15 +0000 (10:38 +0100)]
Unified - do a better job when uninstalling

Some directories weren't removed.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoRethink the uplink / applink story
Richard Levitte [Thu, 18 Feb 2016 17:43:56 +0000 (18:43 +0100)]
Rethink the uplink / applink story

Adding uplink and applink to some builds was done by "magic", the
configuration for "mingw" only had a macro definition, the Configure
would react to its presence by adding the uplink source files to
cpuid_asm_src, and crypto/build.info inherited dance to get it
compiled, and Makefile.shared made sure applink.o would be
appropriately linked in.  That was a lot under the hood.

To replace this, we create a few template configurations in
Configurations/00-base-templates.conf, inherit one of them in the
"mingw" configuration, the rest is just about refering to the
$target{apps_aux_src} / $target{apps_obj} in the right places.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoVMS: rather use a quick file comparison than DIFF
Richard Levitte [Fri, 19 Feb 2016 01:35:33 +0000 (02:35 +0100)]
VMS: rather use a quick file comparison than DIFF

VMS DIFF tries to calculate all the differences, which is slower than
just reading the files and stopping at the first difference.  The
latter doesn't exist as a command, so the problem is solved with perl
and File::Compare (has been in core perl since very early version 5).

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoVMS: produce dependency files just like you produce object files
Richard Levitte [Fri, 19 Feb 2016 01:34:20 +0000 (02:34 +0100)]
VMS: produce dependency files just like you produce object files

We need to do the same dance as when object files are created.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoFix casing on VMS
Richard Levitte [Fri, 19 Feb 2016 01:32:22 +0000 (02:32 +0100)]
Fix casing on VMS

DCL may be in extended parsing style, which makes it less case
insensitive, so when removing a string from another, make sure to get
casing correctly.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoDon't use config.timestamp, we already have configdata.pm
Richard Levitte [Fri, 19 Feb 2016 01:30:51 +0000 (02:30 +0100)]
Don't use config.timestamp, we already have configdata.pm

The benefit with using configdata.pm is that Configure writes it for
us.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoAutomatic 'make depend' for the unified build scheme
Richard Levitte [Thu, 18 Feb 2016 18:41:57 +0000 (19:41 +0100)]
'make depend' for the unified build scheme

This isn't the fully featured combination of compiler generated
dependency files and Makefile include directives, but a cheaper
variant of the same.

The dependency files are generated automatically, but then we have the
usual "depend" target.  However, we depend on it in the bigger phony
targets that are the most likely to be used.  That make this feature
automatic enough.

A side effect is that we can't use the build file's timestamp to check
if reconfiguring might be in order.  In its place, we use a flag file
that depends on Configure and the build file template and depend on it
in spots where it makes sense to check for the need to reconfigure.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix uninstall_sw for the unixmake scheme
Richard Levitte [Thu, 18 Feb 2016 21:38:21 +0000 (22:38 +0100)]
Fix uninstall_sw for the unixmake scheme

The uninstall_sw target tried to 'make uninstall' in all subdirs.
Change it to only go into $(INSTALL_SUBS), just like install_sw does.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoSet EXE_EXT environment variable when testing
Richard Levitte [Thu, 18 Feb 2016 19:50:35 +0000 (20:50 +0100)]
Set EXE_EXT environment variable when testing

When cross compiling, we may end up with someting like apps/openssl.exe
and a number of test/*.exe.  However, util/shlib_wrap.sh doesn't know
what the executable extension should be, if any, so we need to make
sure it has access to that information when testing, since
OpenSSL::Test uses that script to execute all programs.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRemove all special make depend flags, as well as OPENSSL_DOING_MAKEDEPEND
Richard Levitte [Thu, 18 Feb 2016 12:17:15 +0000 (13:17 +0100)]
Remove all special make depend flags, as well as OPENSSL_DOING_MAKEDEPEND

All those flags existed because we had all the dependencies versioned
in the repository, and wanted to have it be consistent, no matter what
the local configuration was.  Now that the dependencies are gone from
the versioned Makefile.ins, it makes much more sense to use the exact
same flags as when compiling the object files.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoDon't treat .d (depend) files separately from object files
Richard Levitte [Thu, 18 Feb 2016 12:04:05 +0000 (13:04 +0100)]
Don't treat .d (depend) files separately from object files

.d (.MMS in the VMS world) files with just dependencies are built from
exactly the same conditions as the object files.  Therefore, the rules
for them can be built at the same time as the rules for the
corresponding object files.

This removes the requirement for a src2dep function in the build file
templates, and for common.tmpl to call it.  In the end, the existence
of depend files is entirely up to the build file.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix the makedepend constructor in unix-Makefile.tmpl
Richard Levitte [Thu, 18 Feb 2016 10:02:42 +0000 (11:02 +0100)]
Fix the makedepend constructor in unix-Makefile.tmpl

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix {TLS,CIPHER}_DEBUG compiles.
Rich Salz [Thu, 18 Feb 2016 12:59:41 +0000 (07:59 -0500)]
Fix {TLS,CIPHER}_DEBUG compiles.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agodocumentation: RSA_new_method argument
Roumen Petrov [Sat, 13 Feb 2016 08:41:49 +0000 (10:41 +0200)]
documentation: RSA_new_method argument

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