openssl.git
2 years agobn/asm/x86_64-mont5.pl: unify gather procedure in hardly used path
Andy Polyakov [Tue, 26 Jan 2016 15:50:10 +0000 (16:50 +0100)]
bn/asm/x86_64-mont5.pl: unify gather procedure in hardly used path
and reorganize/harmonize post-conditions.

Additional hardening following on from CVE-2016-0702

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agocrypto/bn/x86_64-mont5.pl: constant-time gather procedure.
Andy Polyakov [Mon, 25 Jan 2016 22:41:01 +0000 (23:41 +0100)]
crypto/bn/x86_64-mont5.pl: constant-time gather procedure.

At the same time remove miniscule bias in final subtraction.
Performance penalty varies from platform to platform, and even with
key length. For rsa2048 sign it was observed to be 4% for Sandy
Bridge and 7% on Broadwell.

CVE-2016-0702

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agobn/asm/rsaz-avx2.pl: constant-time gather procedure.
Andy Polyakov [Mon, 25 Jan 2016 22:25:40 +0000 (23:25 +0100)]
bn/asm/rsaz-avx2.pl: constant-time gather procedure.

Performance penalty is 2%.

CVE-2016-0702

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agobn/asm/rsax-x86_64.pl: constant-time gather procedure.
Andy Polyakov [Mon, 25 Jan 2016 22:06:45 +0000 (23:06 +0100)]
bn/asm/rsax-x86_64.pl: constant-time gather procedure.

Performance penalty is 2% on Linux and 5% on Windows.

CVE-2016-0702

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agobn/bn_exp.c: constant-time MOD_EXP_CTIME_COPY_FROM_PREBUF.
Andy Polyakov [Mon, 25 Jan 2016 19:38:38 +0000 (20:38 +0100)]
bn/bn_exp.c: constant-time MOD_EXP_CTIME_COPY_FROM_PREBUF.

Performance penalty varies from platform to platform, and even
key length. For rsa2048 sign it was observed to reach almost 10%.

CVE-2016-0702

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agoUnified - have configdata.pm depend on a few more things
Richard Levitte [Sun, 28 Feb 2016 00:13:17 +0000 (01:13 +0100)]
Unified - have configdata.pm depend on a few more things

Reviewed-by: Andy Polyakov <appro@openssl.org>
2 years agoGH762: Reuse strdup()
Dmitry-Me [Mon, 29 Feb 2016 08:55:13 +0000 (11:55 +0300)]
GH762: Reuse strdup()

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
2 years agoGH764: s_server: trace option fall through
J Mohan Rao Arisankala [Mon, 29 Feb 2016 16:53:18 +0000 (22:23 +0530)]
GH764: s_server: trace option fall through

in s_server cmd:
specifying -trace option, falls through and turn-on security_debug

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
2 years agoGH758: e_dasync_err.h: honor no-filenames option
Viktor Szakats [Sun, 28 Feb 2016 20:35:22 +0000 (21:35 +0100)]
GH758: e_dasync_err.h: honor no-filenames option

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
2 years agoFix BN_hex2bn/BN_dec2bn NULL ptr/heap corruption
Matt Caswell [Mon, 22 Feb 2016 10:27:18 +0000 (10:27 +0000)]
Fix BN_hex2bn/BN_dec2bn NULL ptr/heap corruption

In the BN_hex2bn function the number of hex digits is calculated using
an int value |i|. Later |bn_expand| is called with a value of |i * 4|.
For large values of |i| this can result in |bn_expand| not allocating any
memory because |i * 4| is negative. This leaves ret->d as NULL leading
to a subsequent NULL ptr deref. For very large values of |i|, the
calculation |i * 4| could be a positive value smaller than |i|. In this
case memory is allocated to ret->d, but it is insufficiently sized
leading to heap corruption. A similar issue exists in BN_dec2bn.

This could have security consequences if BN_hex2bn/BN_dec2bn is ever
called by user applications with very large untrusted hex/dec data. This is
anticipated to be a rare occurrence.

All OpenSSL internal usage of this function uses data that is not expected
to be untrusted, e.g. config file data or application command line
arguments. If user developed applications generate config file data based
on untrusted data then it is possible that this could also lead to security
consequences. This is also anticipated to be a rare.

Issue reported by Guido Vranken.

CVE-2016-0797

Reviewed-by: Andy Polyakov <appro@openssl.org>
2 years agoremove unused variables
Dr. Stephen Henson [Mon, 29 Feb 2016 14:33:44 +0000 (14:33 +0000)]
remove unused variables

Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoFix use before init warnings in asynctest
Matt Caswell [Mon, 29 Feb 2016 13:07:28 +0000 (13:07 +0000)]
Fix use before init warnings in asynctest

If the tests fail early before an ASYNC_WAIT_CTX is created then there
can be a use before init problem in asynctest.

Reviewed-by: Richard Levitte <levitte@openssl.org>
2 years agoClarify ASYNC_WAIT_CTX_clear_fd() docs
Matt Caswell [Mon, 29 Feb 2016 12:15:27 +0000 (12:15 +0000)]
Clarify ASYNC_WAIT_CTX_clear_fd() docs

Clarify that the "cleanup" routing does not get called if you invoke
ASYNC_WAIT_CTX_clear_fd() directly.

Reviewed-by: Richard Levitte <levitte@openssl.org>
2 years agoRefactor the async wait fd logic
Matt Caswell [Mon, 25 Jan 2016 15:28:57 +0000 (15:28 +0000)]
Refactor the async wait fd logic

Implementation experience has shown that the original plan for async wait
fds was too simplistic. Originally the async logic created a pipe internally
and user/engine code could then get access to it via API calls. It is more
flexible if the engine is able to create its own fd and provide it to the
async code.

Another issue is that there can be a lot of churn in the fd value within
the context of (say) a single SSL connection leading to continually adding
and removing fds from (say) epoll. It is better if we can provide some
stability of the fd value across a whole SSL connection. This is
problematic because an engine has no concept of an SSL connection.

This commit refactors things to introduce an ASYNC_WAIT_CTX which acts as a
proxy for an SSL connection down at the engine layer.

Reviewed-by: Richard Levitte <levitte@openssl.org>
2 years agoWorkaround for VisualStudio 2015 bug
Matt Caswell [Tue, 23 Feb 2016 15:27:05 +0000 (15:27 +0000)]
Workaround for VisualStudio 2015 bug

VisualStudio 2015 has a bug where an internal compiler error was occurring.
By reordering the DEFINE_STACK_OF declarations for SSL_CIPHER and SSL_COMP
until after the ssl3.h include everything seems ok again.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2 years agoAdd forgotten change of check of disabled-dynamic-engine
Richard Levitte [Sun, 28 Feb 2016 16:03:26 +0000 (17:03 +0100)]
Add forgotten change of check of disabled-dynamic-engine

Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agoAdd CHANGES entry for X25519
Dr. Stephen Henson [Sun, 28 Feb 2016 22:43:30 +0000 (22:43 +0000)]
Add CHANGES entry for X25519

Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agomake update
Dr. Stephen Henson [Sun, 28 Feb 2016 18:00:46 +0000 (18:00 +0000)]
make update

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoRemove unused code.
Dr. Stephen Henson [Sun, 21 Feb 2016 16:22:43 +0000 (16:22 +0000)]
Remove unused code.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoChange BORINGSSL defines to OPENSSL
Dr. Stephen Henson [Sat, 20 Feb 2016 14:24:06 +0000 (14:24 +0000)]
Change BORINGSSL defines to OPENSSL

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoInitial adaptations for Curve25519 code.
Dr. Stephen Henson [Sat, 20 Feb 2016 14:19:28 +0000 (14:19 +0000)]
Initial adaptations for Curve25519 code.

Fix "mixed declarations and code" warnings.
Use OpenSSL headers.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoPlace under OpenSSL license.
Emilia Kasper [Wed, 24 Feb 2016 16:18:10 +0000 (16:18 +0000)]
Place under OpenSSL license.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Stephen Henson <steve@openssl.org>
2 years agoAdd X25519 code from BoringSSL.
Dr. Stephen Henson [Sat, 20 Feb 2016 13:56:47 +0000 (13:56 +0000)]
Add X25519 code from BoringSSL.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoTLS support for X25519
Dr. Stephen Henson [Thu, 25 Feb 2016 17:46:14 +0000 (17:46 +0000)]
TLS support for X25519

Add X25519 to TLS supported curve list.
Reject attempts to configure keys which cannot be used
for signing.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoadd ecdhx25519 option to speed
Dr. Stephen Henson [Fri, 12 Feb 2016 14:11:47 +0000 (14:11 +0000)]
add ecdhx25519 option to speed

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoskip inappropriate X25519 tests
Dr. Stephen Henson [Tue, 23 Feb 2016 14:35:33 +0000 (14:35 +0000)]
skip inappropriate X25519 tests

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoAdd X25519 test vectors from RFC7748 6.1
Dr. Stephen Henson [Tue, 2 Feb 2016 19:07:18 +0000 (19:07 +0000)]
Add X25519 test vectors from RFC7748 6.1
Check sign/verify blocked with X25519

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoAdd X25519 curve to list
Dr. Stephen Henson [Tue, 2 Feb 2016 15:23:00 +0000 (15:23 +0000)]
Add X25519 curve to list

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoAdd no signing flag.
Dr. Stephen Henson [Tue, 23 Feb 2016 15:02:34 +0000 (15:02 +0000)]
Add no signing flag.

Add a flag to EC_METHOD for curves which do not support signing.
New function EC_KEY_can_sign() returns 1 is key can be used for signing.
Return an explicit error is an attempt is made to sign with
no signing curves.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoAdd new EC_METHOD for X25519.
Dr. Stephen Henson [Tue, 2 Feb 2016 14:50:10 +0000 (14:50 +0000)]
Add new EC_METHOD for X25519.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoAdd group_order_bits to EC_METHOD.
Dr. Stephen Henson [Mon, 1 Feb 2016 18:52:41 +0000 (18:52 +0000)]
Add group_order_bits to EC_METHOD.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoAdd custom_data field for EC_POINT, EC_KEY.
Dr. Stephen Henson [Mon, 1 Feb 2016 18:22:35 +0000 (18:22 +0000)]
Add custom_data field for EC_POINT, EC_KEY.

In some cases the EC_POINT and EC_KEY BIGNUM components are suboptimal
or inappropriate. Add an "custom_data" field which curves can populate with
a custom structure to suit their needs.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoExtract compression form in EC_KEY_oct2key().
Dr. Stephen Henson [Wed, 17 Feb 2016 15:05:27 +0000 (15:05 +0000)]
Extract compression form in EC_KEY_oct2key().

Extract compression form in EC_KEY_oct2key() instead of manually in the
ASN.1 code. For custom curves do not assume the initial octet is the
compression form: it isn't for X25519 et al.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoExtended EC_METHOD customisation support.
Dr. Stephen Henson [Mon, 1 Feb 2016 18:15:57 +0000 (18:15 +0000)]
Extended EC_METHOD customisation support.

Add support for optional overrides of various private key operations
in EC_METHOD.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoEC_METHOD customisation operations.
Dr. Stephen Henson [Mon, 1 Feb 2016 17:57:01 +0000 (17:57 +0000)]
EC_METHOD customisation operations.

Extend EC_METHOD to permit additional customisation of private key and
ECDH operations.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoRename OIDs.
Dr. Stephen Henson [Mon, 22 Feb 2016 14:27:09 +0000 (14:27 +0000)]
Rename OIDs.

Use standard X25519 and X448 names for OIDs. Delete EdDSA OIDs: for now they
wont be used and EdDSA may use a different format.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2 years agoGH715: Missed some null-check-removals. follow commits 412bafdcf5, and 7c96dbcdab
FdaSilvaYY [Sun, 28 Feb 2016 15:01:41 +0000 (16:01 +0100)]
GH715: Missed some null-check-removals. follow commits 412bafdcf5, and 7c96dbcdab

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
2 years agoFix mk1mf build
Rich Salz [Sun, 28 Feb 2016 17:24:49 +0000 (12:24 -0500)]
Fix mk1mf build

Removing certs broke the mk1mf build.

Reviewed-by: Richard Levitte <levitte@openssl.org>
2 years agoGH715: Missed some null-check-removals.
Rich Salz [Thu, 25 Feb 2016 21:34:27 +0000 (16:34 -0500)]
GH715: Missed some null-check-removals.

Reviewed-by: Richard Levitte <levitte@openssl.org>
2 years agoRT4351: Update doc for OPENSSL_cleanse
Jeffrey Walton [Sat, 27 Feb 2016 01:44:35 +0000 (20:44 -0500)]
RT4351: Update doc for OPENSSL_cleanse

Reviewed-by: Richard Levitte <levitte@openssl.org>
2 years agoVMS - don't exit out of a MMS recipe
Richard Levitte [Sun, 28 Feb 2016 08:31:46 +0000 (09:31 +0100)]
VMS - don't exit out of a MMS recipe

Exiting out of a recipe more than necessary leaves an ugly message.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agoMake generation of dependency files more efficient when possible
Richard Levitte [Sat, 27 Feb 2016 23:20:50 +0000 (00:20 +0100)]
Make generation of dependency files more efficient when possible

When building with GNU C, clang or VMS C, it's more efficient to
generate dependency file and object file in one call rather than two.
Have the dependency output in a temporary file and compare it with the
previous one if available to see if replacement is waranted, thereby
avoiding unnecessary reconstruction of Makefile / descrip.mms.

Github issue #750

Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agoRT4354: Add some cross-refs
Jeffrey Walton [Sat, 27 Feb 2016 22:08:50 +0000 (17:08 -0500)]
RT4354: Add some cross-refs

Stack Overflow has a number of questions related to mutual authentication,
the client and its certificate. Those visiting the man pages for functions
like SSL_CTX_use_certificate and SSL_CTX_load_verify_locations don't
receive the benefit of a cross reference to SSL_CTX_set_client_CA_list.

Reviewed-by: Richard Levitte <levitte@openssl.org>
2 years agousing macro inside the case.
J Mohan Rao Arisankala [Sat, 27 Feb 2016 03:35:51 +0000 (09:05 +0530)]
using macro inside the case.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agofix build with no-srtp
J Mohan Rao Arisankala [Sat, 27 Feb 2016 03:20:07 +0000 (08:50 +0530)]
fix build with no-srtp

- srtp_profiles variable is defined when building with SRTP, keeping
the variable usage also under ifndef OPENSSL_NO_SRTP
- alpn help option was kept under ifndef OPENSSL_NO_SRTP

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agoct_test.c doesn't need to include from source top, only testutil.c does
Richard Levitte [Sat, 27 Feb 2016 19:34:47 +0000 (20:34 +0100)]
ct_test.c doesn't need to include from source top, only testutil.c does

The INCLUDE statement can handle setting extra include directories for
individual object files, let's use it.

Reviewed-by: Andy Polyakov <appro@openssl.org>
2 years agoRemove last remains of old config strings
Richard Levitte [Sat, 27 Feb 2016 20:23:01 +0000 (21:23 +0100)]
Remove last remains of old config strings

Reviewed-by: Andy Polyakov <appro@openssl.org>
2 years agomodes/asm/ghash-x86_64.pl: refine GNU assembler version detection.
Andy Polyakov [Wed, 24 Feb 2016 19:07:06 +0000 (20:07 +0100)]
modes/asm/ghash-x86_64.pl: refine GNU assembler version detection.

Even though AVX support was added in GAS 2.19 vpclmulqdq was apparently
added in 2.20.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agochacha/asm/chacha-*.pl: fix typos in tail processing.
Andy Polyakov [Sun, 21 Feb 2016 20:16:36 +0000 (21:16 +0100)]
chacha/asm/chacha-*.pl: fix typos in tail processing.

RT#4323

Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agoReformat and update EC_KEY_new manual page.
Dr. Stephen Henson [Sat, 27 Feb 2016 13:06:17 +0000 (13:06 +0000)]
Reformat and update EC_KEY_new manual page.

Add some missing parentheses and reformat.

Document EC_KEY_oct2key(), EC_KEY_key2buf(), EC_KEY_oct2priv(),
EC_KEY_priv2oct() and EC_KEY_priv2buf()

Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agoRT2275: use BIO_sock_nbio()
Rich Salz [Sat, 27 Feb 2016 18:24:28 +0000 (13:24 -0500)]
RT2275: use BIO_sock_nbio()

Now that BIO_sock_nbio is available, use it in the apps.

Reviewed-by: Richard Levitte <levitte@openssl.org>
2 years agoRemove some old files.
Rich Salz [Sat, 27 Feb 2016 17:32:42 +0000 (12:32 -0500)]
Remove some old files.

I read the PROBLEMS, and they're outdated; nothing I'd put in the
online FAQ, for example.  Test-builds work without using these files.
Had to remove the rehash.time stuff from Makefile.in

Reviewed-by: Richard Levitte <levitte@openssl.org>
2 years agoKeep a cache of files that already have a recipe, in common.tmpl
Richard Levitte [Sat, 27 Feb 2016 18:12:14 +0000 (19:12 +0100)]
Keep a cache of files that already have a recipe, in common.tmpl

We don't want recipes for the same files generated more than once

Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agoFreeBSD, at least, can restrict symbols in a shared library - so use the
Ben Laurie [Sat, 27 Feb 2016 16:19:34 +0000 (16:19 +0000)]
FreeBSD, at least, can restrict symbols in a shared library - so use the
Linux target that does that.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
2 years agotestutil.c includes e_os.h.
Ben Laurie [Sat, 27 Feb 2016 12:44:31 +0000 (12:44 +0000)]
testutil.c includes e_os.h.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agoGH753: More spelling fix
FdaSilvaYY [Fri, 26 Feb 2016 19:30:15 +0000 (20:30 +0100)]
GH753: More spelling fix

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2 years agoApply default after having checked the given config target is valid
Richard Levitte [Sat, 27 Feb 2016 09:23:15 +0000 (10:23 +0100)]
Apply default after having checked the given config target is valid

Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agoDrop support for printing SSLv2 ciphers names.
Kurt Roeckx [Sun, 21 Feb 2016 18:57:43 +0000 (19:57 +0100)]
Drop support for printing SSLv2 ciphers names.

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

2 years agoUpdate and clarify EC_POINT documentation.
Dr. Stephen Henson [Sat, 27 Feb 2016 00:16:23 +0000 (00:16 +0000)]
Update and clarify EC_POINT documentation.

Reformat EC_POINT_new.pod and add parentheses to function names.
Clarify the octet form.
Add documentation for EC_POINT_oct2buf().

Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agoRemove Ubsec engine
Matt Caswell [Fri, 26 Feb 2016 16:21:55 +0000 (16:21 +0000)]
Remove Ubsec engine

The ubsec engine is now considered obsolete and therefore has been
removed.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agoMoves SCT struct typedef into ossl_typ.h
Rob Percival [Thu, 25 Feb 2016 16:24:10 +0000 (16:24 +0000)]
Moves SCT struct typedef into ossl_typ.h

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agoFix for potential deferencing of null pointer in o2i_SCT_signature
Rob Percival [Wed, 24 Feb 2016 15:11:36 +0000 (15:11 +0000)]
Fix for potential deferencing of null pointer in o2i_SCT_signature

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agoPublic API for Certificate Transparency
Rob Percival [Thu, 25 Feb 2016 18:11:16 +0000 (18:11 +0000)]
Public API for Certificate Transparency

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
2 years agoGH752 ct_test uses testutil, so include that
Rob Percival [Fri, 26 Feb 2016 19:20:51 +0000 (19:20 +0000)]
GH752 ct_test uses testutil, so include that

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
2 years agoRevert "EC_KEY_priv2buf (): check parameter sanity"
Rich Salz [Fri, 26 Feb 2016 19:11:46 +0000 (14:11 -0500)]
Revert "EC_KEY_priv2buf (): check parameter sanity"

This reverts commit acae59bb29ddc769743ab4a8ae373b5ff2f42b57.

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>