oweals/openssl.git
8 years agounified build scheme: adjust some scripts
Richard Levitte [Fri, 29 Jan 2016 23:03:58 +0000 (00:03 +0100)]
unified build scheme: adjust some scripts

util/mkdef.pl and Makefile.shared needs to know about the source and
the build directories.

Additionally, Makefile.shared needs to know how to build shared
libraries in a directory other than the current one.

Reviewed-by: Ben Laurie <ben@openssl.org>
8 years agounified build scheme: add a design document
Richard Levitte [Mon, 8 Feb 2016 04:11:25 +0000 (05:11 +0100)]
unified build scheme: add a design document

This documents describes the three steps from build.info files via the
%unified_info database to the build-file templates, along with some
examples showing how the data gets processed along the way.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agounified build scheme: add and document the "unified" driving engine
Richard Levitte [Fri, 29 Jan 2016 23:57:33 +0000 (00:57 +0100)]
unified build scheme: add and document the "unified" driving engine

common.tmpl will be used together with the template build file, and is
the engine that connects the information gathered from all the
build.info files with making the build file itself.

This file expects there to be a template section in the build file
template that defines a number perl functions designed to return
strings with appropriate lines for the build system at hand.  The
exact functions, what they can expect as arguments and what output
they're expected to produce is documented in Configurations/README.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoSmall fixes
Richard Levitte [Mon, 8 Feb 2016 20:42:00 +0000 (21:42 +0100)]
Small fixes

- One typo fixed in crypto/bio/b_addr.c
- Add a comment in doc/crypto/BIO_parse_hostserv.pod to explain the
  blank lines with one lonely space each.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoadd missing file p12_lcl.h
Dr. Stephen Henson [Mon, 8 Feb 2016 21:14:50 +0000 (21:14 +0000)]
add missing file p12_lcl.h

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoSuppress DANE TLSA reflection when verification fails
Viktor Dukhovni [Mon, 8 Feb 2016 00:07:57 +0000 (19:07 -0500)]
Suppress DANE TLSA reflection when verification fails

As documented both SSL_get0_dane_authority() and SSL_get0_dane_tlsa()
are expected to return a negative match depth and nothing else when
verification fails.  However, this only happened when verification
failed during chain construction.  Errors in verification of the
constructed chain did not have the intended effect on these functions.

This commit updates the functions to check for verify_result ==
X509_V_OK, and no longer erases any accumulated match information
when chain construction fails.  Sophisticated developers can, with
care, use SSL_set_verify_result(ssl, X509_V_OK) to "peek" at TLSA
info even when verification fail.  They must of course first check
and save the real error, and restore the original error as quickly
as possible.  Hiding by default seems to be the safer interface.

Introduced X509_V_ERR_DANE_NO_MATCH code to signal failure to find
matching TLSA records.  Previously reported via X509_V_ERR_CERT_UNTRUSTED.

This also changes the "-brief" output from s_client to include
verification results and TLSA match information.

Mentioned session resumption in code example in SSL_CTX_dane_enable(3).
Also mentioned that depths returned are relative to the verified chain
which is now available via SSL_get0_verified_chain(3).

Added a few more test-cases to danetest, that exercise the new
code.

Resolved thread safety issue in use of static buffer in
X509_verify_cert_error_string().

Fixed long-stating issue in apps/s_cb.c which always sets verify_error
to either X509_V_OK or "chain to long", code elsewhere (e.g.
s_time.c), seems to expect the actual error.  [ The new chain
construction code is expected to correctly generate "chain
too long" errors, so at some point we need to drop the
work-arounds, once SSL_set_verify_depth() is also fixed to
propagate the depth to X509_STORE_CTX reliably. ]

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFollowing the PKCS#12 update, update crypto/pkcs12/build.info as well
Richard Levitte [Mon, 8 Feb 2016 19:20:43 +0000 (20:20 +0100)]
Following the PKCS#12 update, update crypto/pkcs12/build.info as well

Reviewed-by: Stephen Henson <steve@openssl.org>
8 years agoRemove ancient compatibility defines.
Dr. Stephen Henson [Mon, 8 Feb 2016 19:10:12 +0000 (19:10 +0000)]
Remove ancient compatibility defines.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agomake update
Dr. Stephen Henson [Mon, 8 Feb 2016 17:00:00 +0000 (17:00 +0000)]
make update

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agofix various formatting issues
Dr. Stephen Henson [Fri, 5 Feb 2016 15:43:53 +0000 (15:43 +0000)]
fix various formatting issues

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoOnly use compatibility macros for < 1.1 API.
Dr. Stephen Henson [Fri, 5 Feb 2016 15:43:20 +0000 (15:43 +0000)]
Only use compatibility macros for < 1.1 API.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agorename old functions names in libeay.num
Dr. Stephen Henson [Tue, 12 Jan 2016 00:00:08 +0000 (00:00 +0000)]
rename old functions names in libeay.num

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agouse new function names
Dr. Stephen Henson [Sun, 27 Sep 2015 12:42:04 +0000 (13:42 +0100)]
use new function names

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd p12_sbag.c to Makefile.in
Dr. Stephen Henson [Fri, 5 Feb 2016 15:55:02 +0000 (15:55 +0000)]
Add p12_sbag.c to Makefile.in

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoReorganise functions.
Dr. Stephen Henson [Sun, 27 Sep 2015 12:28:26 +0000 (13:28 +0100)]
Reorganise functions.

Move all PKCS12_SAFEBAG functions into new file p12_sbag.c.

Move MAC functions into p12_mutl.c

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agopkcs12.h header reorganisation.
Dr. Stephen Henson [Sun, 27 Sep 2015 11:51:25 +0000 (12:51 +0100)]
pkcs12.h header reorganisation.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUse new names
Dr. Stephen Henson [Sun, 27 Sep 2015 11:41:53 +0000 (12:41 +0100)]
Use new names

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRename PKCS12 function
Dr. Stephen Henson [Sun, 27 Sep 2015 00:09:27 +0000 (01:09 +0100)]
Rename PKCS12 function

Rename ancient PKCS12 functions to use more logical names. Include
defines from old to new name.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUse accessors in pkcs12 app.
Dr. Stephen Henson [Sat, 26 Sep 2015 23:31:46 +0000 (00:31 +0100)]
Use accessors in pkcs12 app.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agopkcs12 accessors
Dr. Stephen Henson [Sat, 26 Sep 2015 23:33:59 +0000 (00:33 +0100)]
pkcs12 accessors

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agomore PKCS12 opacity
Dr. Stephen Henson [Sat, 26 Sep 2015 12:24:24 +0000 (13:24 +0100)]
more PKCS12 opacity

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoNew PKCS12 accessors, change macros to functions.
Dr. Stephen Henson [Sat, 26 Sep 2015 12:24:00 +0000 (13:24 +0100)]
New PKCS12 accessors, change macros to functions.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMake PKCS12 structures opaque
Dr. Stephen Henson [Sat, 26 Sep 2015 11:26:51 +0000 (12:26 +0100)]
Make PKCS12 structures opaque

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoDeprecate undocumented SSL_cache_hit().
Dr. Stephen Henson [Mon, 8 Feb 2016 16:18:26 +0000 (16:18 +0000)]
Deprecate undocumented SSL_cache_hit().

Deprecate undocumented SSL_cache_hit(). Make SSL_session_reused() into a
real function.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoGH641: Don't care openssl_zmalloc
Rich Salz [Mon, 8 Feb 2016 15:11:56 +0000 (10:11 -0500)]
GH641: Don't care openssl_zmalloc

Don't cast malloc-family return values.
Also found some places where (a) blank line was missing; and (b)
the *wrong* return value was checked.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUse File::Path::rmtree rather than File::Path::remove_tree
Richard Levitte [Mon, 8 Feb 2016 15:44:48 +0000 (16:44 +0100)]
Use File::Path::rmtree rather than File::Path::remove_tree

Just like File::Path::make_path, File::Path::remove_tree didn't show
up before File::Path 2.06 / perl v5.10.1, so we prefer the legacy
function here as well.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoUse File::Path::mkpath rather than File::Path::make_path
Richard Levitte [Mon, 8 Feb 2016 15:27:15 +0000 (16:27 +0100)]
Use File::Path::mkpath rather than File::Path::make_path

File::Path::make_path didn't show up before File::Path 2.06 / perl v5.10.1.
Because we're trying to stay compatible with perl v5.10.0 and up,
it's better to use the legacy interface.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoFix engine key support in utilities.
Dr. Stephen Henson [Mon, 8 Feb 2016 15:06:48 +0000 (15:06 +0000)]
Fix engine key support in utilities.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agobio/b_sock.c: cleanup obsolete stuff.
Andy Polyakov [Thu, 4 Feb 2016 21:01:23 +0000 (22:01 +0100)]
bio/b_sock.c: cleanup obsolete stuff.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agobn/Makefile.in: remove obsolete rules.
Andy Polyakov [Tue, 2 Feb 2016 11:56:21 +0000 (12:56 +0100)]
bn/Makefile.in: remove obsolete rules.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoConfigurations/00-base-templates.conf: harmonize extensions.
Andy Polyakov [Mon, 1 Feb 2016 16:48:14 +0000 (17:48 +0100)]
Configurations/00-base-templates.conf: harmonize extensions.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoavoid crash if hostserv is with host part only
Roumen Petrov [Sat, 6 Feb 2016 12:07:39 +0000 (14:07 +0200)]
avoid crash if hostserv is with host part only

(if priority is set to host)

Signed-off-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGH322 revisited: remove unused function.
Rich Salz [Sat, 6 Feb 2016 18:57:21 +0000 (13:57 -0500)]
GH322 revisited: remove unused function.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoMake TESTS= work with "nmake -f ms/ntdll.mak tests"
Rob Percival [Mon, 18 Jan 2016 10:26:17 +0000 (10:26 +0000)]
Make TESTS= work with "nmake -f ms/ntdll.mak tests"

This works on Linux with Make already, and allows running only specified
tests.

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agodtlsv1listentest includes e_os.h, reflect that in include dirs
Richard Levitte [Mon, 8 Feb 2016 04:58:54 +0000 (05:58 +0100)]
dtlsv1listentest includes e_os.h, reflect that in include dirs

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoHandle SSL_shutdown while in init more appropriately #2
Matt Caswell [Tue, 2 Feb 2016 10:05:43 +0000 (10:05 +0000)]
Handle SSL_shutdown while in init more appropriately #2

Previous commit 7bb196a71 attempted to "fix" a problem with the way
SSL_shutdown() behaved whilst in mid-handshake. The original behaviour had
SSL_shutdown() return immediately having taken no action if called mid-
handshake with a return value of 1 (meaning everything was shutdown
successfully). In fact the shutdown has not been successful.

Commit 7bb196a71 changed that to send a close_notify anyway and then
return. This seems to be causing some problems for some applications so
perhaps a better (much simpler) approach is revert to the previous
behaviour (no attempt at a shutdown), but return -1 (meaning the shutdown
was not successful).

This also fixes a bug where SSL_shutdown always returns 0 when shutdown
*very* early in the handshake (i.e. we are still using SSLv23_method).

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agomore doc fixes
Rich Salz [Mon, 8 Feb 2016 04:14:12 +0000 (23:14 -0500)]
more doc fixes

dgst: using digest instead of specific digest commands
the digest list specified in man dgst may be inaccurate, hence using
digest and referring to the list in digest-commands

'sha' as a digest name is no longer supported

dgst,pkeyutl cmds help cleanup
- In dgst, pkeyutl cmds, some options help was missing.
- fixed a minor typo in openssl.pod, that fixes make install.
- digest-commands was showing ‘sha’, which is not a supported digest
anymore.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoClarify resumed sessions and NULL return.
Dr. Stephen Henson [Sun, 7 Feb 2016 23:20:53 +0000 (23:20 +0000)]
Clarify resumed sessions and NULL return.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoFix memory leak in dtlsv1listentest
Kurt Roeckx [Sat, 6 Feb 2016 19:31:15 +0000 (20:31 +0100)]
Fix memory leak in dtlsv1listentest

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

8 years agoAllocate bio_err before turning on memleak checks
Viktor Dukhovni [Sat, 6 Feb 2016 20:17:11 +0000 (15:17 -0500)]
Allocate bio_err before turning on memleak checks

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoStack documentation.
Dr. Stephen Henson [Tue, 12 Jan 2016 16:21:23 +0000 (16:21 +0000)]
Stack documentation.

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agocommands help cleanup
A J Mohan Rao [Sat, 6 Feb 2016 17:42:35 +0000 (23:12 +0530)]
commands help cleanup

opt_valtype 0 is same as '-' while printing cmd usage
asn1parse/ca/ciphers help cleanup

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoif no comparison function set make sk_sort no op
Dr. Stephen Henson [Sat, 6 Feb 2016 17:07:58 +0000 (17:07 +0000)]
if no comparison function set make sk_sort no op

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agomake update
Dr. Stephen Henson [Sat, 6 Feb 2016 17:53:35 +0000 (17:53 +0000)]
make update

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoAdd documenation for X509_chain_up_ref()
Dr. Stephen Henson [Sat, 6 Feb 2016 16:42:22 +0000 (16:42 +0000)]
Add documenation for X509_chain_up_ref()

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoAdd SSL_get0_verified_chain() to return verified chain of peer
Dr. Stephen Henson [Sat, 6 Feb 2016 03:17:23 +0000 (03:17 +0000)]
Add SSL_get0_verified_chain() to return verified chain of peer

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoDisplay the linking commands that are performed
Richard Levitte [Fri, 5 Feb 2016 11:20:19 +0000 (12:20 +0100)]
Display the linking commands that are performed

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoEnhance and clear the support of linker flags
Richard Levitte [Fri, 5 Feb 2016 10:47:14 +0000 (11:47 +0100)]
Enhance and clear the support of linker flags

Some time ago, we had a ex_libs configuration setting that could be
divided into lflags and ex_libs.  These got divided in two settings,
lflags and ex_libs, and the former was interpreted to be general
linking flags.

Unfortunately, that conclusion wasn't entirely accurate.  Most of
those linking were meant to end up in a very precise position on the
linking command line, just before the spec of libraries the linking
depends on.

Back to the drawing board, we're diving things further, now having
lflags, which are linking flags that aren't depending on command line
position, plib_lflags, which are linking flags that should show up just
before the spec of libraries to depend on, and finally ex_libs, which
is the spec of extra libraries to depend on.

Also, documentation is changed in Configurations/README.  This was
previously forgotten.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoGH587: Extend ECDH tests to more curves. Add more ECDH KATs.
Billy Brumley [Sat, 6 Feb 2016 15:58:27 +0000 (10:58 -0500)]
GH587: Extend ECDH tests to more curves. Add more ECDH KATs.

squelch sign-compare warning

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoAdd BIO_ADDR_clear to libeay.num
Kurt Roeckx [Sat, 6 Feb 2016 13:51:56 +0000 (14:51 +0100)]
Add BIO_ADDR_clear to libeay.num

Reviewed-by: Matt Caswell <matt@openssl.org>
MR: #1874

8 years agoGH634: fix potential memory leak
Insu Yun [Fri, 5 Feb 2016 22:37:49 +0000 (17:37 -0500)]
GH634: fix potential memory leak

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoRT4194: Restore old engine parameter parsing.
Rich Salz [Tue, 22 Dec 2015 13:22:33 +0000 (08:22 -0500)]
RT4194: Restore old engine parameter parsing.

Allow initial engine names as first parameters before flags.
Also add engine param to help summary

Wrote manpage

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoAdd build.info lines for dtlsv1listentest
Richard Levitte [Sat, 6 Feb 2016 04:45:32 +0000 (05:45 +0100)]
Add build.info lines for dtlsv1listentest

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoDon't include sys/socket.h
Kurt Roeckx [Fri, 5 Feb 2016 23:55:12 +0000 (00:55 +0100)]
Don't include sys/socket.h

It's not available on all OSs, e_os.h already does the right thing

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

8 years agoAdd missing static declarations in dtlsv1listentest.c
Viktor Dukhovni [Sat, 6 Feb 2016 02:25:05 +0000 (21:25 -0500)]
Add missing static declarations in dtlsv1listentest.c

Clang rightly does not like extern symbols that are not declared
in any header file, as typically these are not intended for global
visibility and are exposed in error.  This was indeed the case with
various file-scope objects in dtlsv1listentest.c.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUpdate DTLSv1_listen documentation
Matt Caswell [Fri, 5 Feb 2016 20:17:10 +0000 (20:17 +0000)]
Update DTLSv1_listen documentation

Make it clear that if we are unable to get hold of the peer address then
*peer is cleared and the family set to AF_UNSPEC.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoAdd tests for DTLSv1_listen
Matt Caswell [Thu, 21 Jan 2016 12:22:58 +0000 (12:22 +0000)]
Add tests for DTLSv1_listen

Adds a set of tests for the newly rewritten DTLSv1_listen function.
The test pokes various packets at the function and then checks
the return value and the data written out to ensure it is what we
would have expected.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoProvide partial support for fragmented DTLS ClientHellos
Matt Caswell [Wed, 4 Nov 2015 13:53:57 +0000 (13:53 +0000)]
Provide partial support for fragmented DTLS ClientHellos

The recently rewriten DTLSv1_listen code does not support fragmented
ClientHello messages because fragment reassembly requires server state
which is against the whole point of DTLSv1_listen. This change adds some
partial support for fragmented ClientHellos. It requires that the cookie
must be within the initial fragment. That way any non-initial ClientHello
fragments can be dropped and fragment reassembly is not required.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoAdd a BIO_ADDR_clear function
Matt Caswell [Fri, 5 Feb 2016 19:40:44 +0000 (19:40 +0000)]
Add a BIO_ADDR_clear function

Adds a new function BIO_ADDR_clear to reset a BIO_ADDR back to an
unitialised state, and to set the family to AF_UNSPEC.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoGH601: Various spelling fixes.
FdaSilvaYY [Fri, 5 Feb 2016 20:23:54 +0000 (15:23 -0500)]
GH601: Various spelling fixes.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoRT4070: Improve struct/union regexp
Ellinger, Wesley M [Thu, 4 Feb 2016 01:49:53 +0000 (20:49 -0500)]
RT4070: Improve struct/union regexp

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoMake DTLSv1_listen a first class function and change its type
Matt Caswell [Fri, 5 Feb 2016 10:59:42 +0000 (10:59 +0000)]
Make DTLSv1_listen a first class function and change its type

The DTLSv1_listen function exposed details of the underlying BIO
abstraction and did not properly allow for IPv6. This commit changes the
"peer" argument to be a BIO_ADDR and makes it a first class function
(rather than a ctrl) to ensure proper type checking.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRT4292: Remove ===== line
Rich Salz [Fri, 5 Feb 2016 17:41:16 +0000 (12:41 -0500)]
RT4292: Remove ===== line

Also remove two mistakenly checked-in files.

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoRT1596: Add clarifying doc.
Rich Salz [Fri, 5 Feb 2016 14:28:05 +0000 (09:28 -0500)]
RT1596: Add clarifying doc.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoGH628: Add -help to all apps docs.
A J Mohan Rao [Fri, 5 Feb 2016 16:58:45 +0000 (11:58 -0500)]
GH628: Add -help to all apps docs.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoGH628: Add -help to all apps docs.
Rich Salz [Fri, 5 Feb 2016 16:17:00 +0000 (11:17 -0500)]
GH628: Add -help to all apps docs.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoEnsure correct chain depth for policy checks with DANE bare key TA
Viktor Dukhovni [Mon, 1 Feb 2016 02:48:00 +0000 (21:48 -0500)]
Ensure correct chain depth for policy checks with DANE bare key TA

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoLong overdue cleanup of X509 policy tree verification
Viktor Dukhovni [Mon, 1 Feb 2016 02:14:51 +0000 (21:14 -0500)]
Long overdue cleanup of X509 policy tree verification

Replace all magic numbers with #defined constants except in boolean
functions that return 0 for failure and 1 for success.  Avoid a
couple memory leaks in error recovery code paths.  Code style
improvements.

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoVarious RT doc fixes
Rich Salz [Mon, 1 Feb 2016 20:15:06 +0000 (15:15 -0500)]
Various RT doc fixes

RT1556: doc/crypto/threads.pod
RT2024: Missing pages mentioned in crypto.pod
RT2890: Wrong size in ERR_string_error description.
RT3461: Better description of PEM Encryption
        (Jeffrey Walton <noloader@gmail.com>)
        Also, fix up formatting and removed some code examples
        that encourage unsafe patterns, like unencrypted private
        keys (Rich Salz)
RT4240: Document some speed flags (Tomas Mraz <tmraz@redhat.com>)
RT4260: Fix return value doc for X509_REQ_sign and X509_sign
        (Laetitia Baudoin <lbaudoin@google.com>)

Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoenable leak checking for danetest
Dr. Stephen Henson [Fri, 5 Feb 2016 14:50:06 +0000 (14:50 +0000)]
enable leak checking for danetest

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix return code in CRYPTO_mem_leaks_fp()
Dr. Stephen Henson [Fri, 5 Feb 2016 14:36:01 +0000 (14:36 +0000)]
Fix return code in CRYPTO_mem_leaks_fp()

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoIf memory debugging enabled return error on leaks.
Dr. Stephen Henson [Thu, 14 Jan 2016 22:00:03 +0000 (22:00 +0000)]
If memory debugging enabled return error on leaks.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRestore -no_comp switch for backwards compatible behaviour
Viktor Dukhovni [Wed, 3 Feb 2016 21:45:39 +0000 (16:45 -0500)]
Restore -no_comp switch for backwards compatible behaviour

Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoVMS lacks socklen_t, give it one
Richard Levitte [Fri, 5 Feb 2016 13:08:05 +0000 (14:08 +0100)]
VMS lacks socklen_t, give it one

Fortunately, we only use socklen_t internally

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoInitialize variable
Richard Levitte [Fri, 5 Feb 2016 07:37:12 +0000 (08:37 +0100)]
Initialize variable

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoDon't export local symbols on Solaris
Matt Caswell [Wed, 16 Dec 2015 11:17:17 +0000 (11:17 +0000)]
Don't export local symbols on Solaris

Following on from earlier commits to prevent local symbols from being
exported in the shared libraries on Linux, this makes the equivalent changes
for Solaris.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agomake update
Dr. Stephen Henson [Thu, 4 Feb 2016 23:23:02 +0000 (23:23 +0000)]
make update

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoAdd EC_KEY_priv2buf()
Dr. Stephen Henson [Thu, 4 Feb 2016 23:18:57 +0000 (23:18 +0000)]
Add EC_KEY_priv2buf()

Add new function EC_KEY_priv2buf() to allocated and encode private
key octet in one call. Update and simplify ASN.1 and print routines.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoAllocate ASN1_bn_print buffer internally.
Dr. Stephen Henson [Thu, 4 Feb 2016 18:53:07 +0000 (18:53 +0000)]
Allocate ASN1_bn_print buffer internally.

Don't require an application to work out the appropriate buffer size for
ASN1_bn_print(), which is unsafe. Ignore the supplied buffer and allocate
it internally instead.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoUse BN_bn2binpad
Dr. Stephen Henson [Wed, 3 Feb 2016 18:51:02 +0000 (18:51 +0000)]
Use BN_bn2binpad

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agouse enum type for do_EC_KEY_print
Dr. Stephen Henson [Wed, 3 Feb 2016 14:53:15 +0000 (14:53 +0000)]
use enum type for do_EC_KEY_print

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoupdate EC ASN1 and print routines
Dr. Stephen Henson [Mon, 1 Feb 2016 15:46:29 +0000 (15:46 +0000)]
update EC ASN1 and print routines

Update EC ASN.1 and print routines to use EC_KEY_oct2priv and
EC_KEY_priv2oct.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoAdd EC_KEY_oct2priv and EC_KEY_priv2oct
Dr. Stephen Henson [Mon, 1 Feb 2016 15:34:13 +0000 (15:34 +0000)]
Add EC_KEY_oct2priv and EC_KEY_priv2oct

New functions EC_KEY_oct2priv and EC_KEY_priv2oct. These are private key
equivalents of EC_POINT_oct2point and EC_POINT_point2oct which convert
between the private key octet format and EC_KEY.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoAdd ASN1_buf_print to print a buffer in ASN1_bn_print format.
Dr. Stephen Henson [Wed, 27 Jan 2016 14:34:36 +0000 (14:34 +0000)]
Add ASN1_buf_print to print a buffer in ASN1_bn_print format.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoDon't use RDRAND if told not to
Matt Caswell [Thu, 4 Feb 2016 15:24:06 +0000 (15:24 +0000)]
Don't use RDRAND if told not to

Ensure we respect OPENSSL_NO_RDRAND

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoInitialise with -1 rather than 1
Richard Levitte [Thu, 4 Feb 2016 23:00:22 +0000 (00:00 +0100)]
Initialise with -1 rather than 1

A small typo crept in.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoAdd new DTLS-SRTP protection profiles from RFC 7714
Dmitry Sobinov [Sat, 2 Jan 2016 11:32:36 +0000 (22:32 +1100)]
Add new DTLS-SRTP protection profiles from RFC 7714

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoAdd checks for IPv4 and IPv6 in OpenSSL::Test::Utils and use them
Richard Levitte [Thu, 4 Feb 2016 22:22:52 +0000 (23:22 +0100)]
Add checks for IPv4 and IPv6 in OpenSSL::Test::Utils and use them

This uilds on the same way of checking for availability as we do in
TLSProxy.  We use all IP factories we know of, starting with those who
know both IPv6 and IPv4 and ending with the one that only knows IPv4
and cache their possible success as foundation for checking the
available of each IP domain.

80-test_ssl.t has bigger chances of working on platforms that do not
run both IP domains.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUpdate crypto/bio/build.info
Richard Levitte [Thu, 4 Feb 2016 22:34:20 +0000 (23:34 +0100)]
Update crypto/bio/build.info

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix pkeyutl inability to directly access keys on hardware tokens
Mouse [Thu, 14 Jan 2016 04:03:31 +0000 (23:03 -0500)]
Fix pkeyutl inability to directly access keys on hardware tokens

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoChange the transfer perl module so the real module gets properly registered
Richard Levitte [Thu, 4 Feb 2016 18:41:56 +0000 (19:41 +0100)]
Change the transfer perl module so the real module gets properly registered

This is an important move if scripts want to refer to the loaded
module without having perl think it needs to be loaded (again).

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd option to disable async
Todd Short [Thu, 4 Feb 2016 16:41:25 +0000 (11:41 -0500)]
Add option to disable async

Add no-async option to Configure that forces ASYNC_NULL.
Related to RT1979
An embedded system or replacement C library (e.g. musl or uClibc)
may not support the *context APIs that are needed for async operation.

Compiles with musl. Ran unit tests, async tests skipped as expected.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoMake sure getaddrinfo and getnameinfo works as intended on Windows
Richard Levitte [Thu, 4 Feb 2016 16:17:36 +0000 (17:17 +0100)]
Make sure getaddrinfo and getnameinfo works as intended on Windows

Both getaddrinfo() and getnameinfo() have to be preceeded with a call
to BIO_sock_init().

Also, make sure to give gai_strerror() the actual error code.

Reviewed-by: Stephen Henson <steve@openssl.org>
8 years agoIf egd is disabled by default, it should be possible to enable
Richard Levitte [Wed, 3 Feb 2016 20:08:17 +0000 (21:08 +0100)]
If egd is disabled by default, it should be possible to enable

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoAdd ec -check option
Dr. Stephen Henson [Thu, 4 Feb 2016 14:47:40 +0000 (14:47 +0000)]
Add ec -check option

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoFix potential buffer overrun
Dmitry-Me [Thu, 4 Feb 2016 07:11:26 +0000 (10:11 +0300)]
Fix potential buffer overrun

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoUse WSAGetLastError() on windows
Kurt Roeckx [Thu, 4 Feb 2016 14:20:26 +0000 (15:20 +0100)]
Use WSAGetLastError() on windows

Windows doesn't have h_error or hstrerror()

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

8 years agoRestore xmm7 from the correct address on win64
Kurt Roeckx [Wed, 3 Feb 2016 17:54:02 +0000 (18:54 +0100)]
Restore xmm7 from the correct address on win64

Reviewed-by: Richard Levitte <levitte@openssl.org>
RT: #4288, MR: #1831

8 years agoupdate OID tables
Dr. Stephen Henson [Thu, 4 Feb 2016 14:10:52 +0000 (14:10 +0000)]
update OID tables

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoAdd Curve OIDs from draft-josefsson-pkix-newcurves
Dr. Stephen Henson [Wed, 3 Feb 2016 22:41:30 +0000 (22:41 +0000)]
Add Curve OIDs from draft-josefsson-pkix-newcurves

Reviewed-by: Matt Caswell <matt@openssl.org>