openssl.git
3 years agoUpdates for auto init/deinit review comments
Matt Caswell [Tue, 9 Feb 2016 13:12:34 +0000 (13:12 +0000)]
Updates for auto init/deinit review comments

Fixes for the auto-init/deinit code based on review comments

Reviewed-by: Richard Levitte <levitte@openssl.org>
3 years agoAdd a CHANGES entry for auto-init and de-init
Matt Caswell [Tue, 9 Feb 2016 12:04:03 +0000 (12:04 +0000)]
Add a CHANGES entry for auto-init and de-init

Reviewed-by: Richard Levitte <levitte@openssl.org>
3 years agoCorrect copyright date for internal header file
Matt Caswell [Tue, 9 Feb 2016 11:55:41 +0000 (11:55 +0000)]
Correct copyright date for internal header file

The newly added internal async.h header file had last years date in it.

Reviewed-by: Richard Levitte <levitte@openssl.org>
3 years agoUpdate build.info files for auto-init/de-init
Matt Caswell [Tue, 9 Feb 2016 11:09:10 +0000 (11:09 +0000)]
Update build.info files for auto-init/de-init

Various Makefile.in files have changes for auto-init/de-init. Make the
equivalent changes in build.info.

Reviewed-by: Richard Levitte <levitte@openssl.org>
3 years agoAvoid a race condition in loading config settings
Matt Caswell [Tue, 9 Feb 2016 10:55:21 +0000 (10:55 +0000)]
Avoid a race condition in loading config settings

A race condition can occur when sending config settings to
OPENSSL_INIT_crypto_library_start()

Reviewed-by: Richard Levitte <levitte@openssl.org>
3 years agoProvide documentation for auto-init/auto-deinit
Matt Caswell [Tue, 9 Feb 2016 10:17:59 +0000 (10:17 +0000)]
Provide documentation for auto-init/auto-deinit

Provide some man pages for auto-init/deinit. Also update the INSTALL
documentation for information on the new Configure options implemented as
part of this.

Reviewed-by: Richard Levitte <levitte@openssl.org>
3 years agoAdd an OPENSSL_NO_AUTOERRINIT option
Matt Caswell [Tue, 9 Feb 2016 09:39:07 +0000 (09:39 +0000)]
Add an OPENSSL_NO_AUTOERRINIT option

This option disables automatic loading of the crypto/ssl error strings in
order to keep statically linked executable file size down

Reviewed-by: Richard Levitte <levitte@openssl.org>
3 years agoProvide a thread stop API
Matt Caswell [Tue, 9 Feb 2016 09:13:45 +0000 (09:13 +0000)]
Provide a thread stop API

Add the OPENSSL_INIT_thread_stop() function.

Reviewed-by: Richard Levitte <levitte@openssl.org>
3 years agoClean up the tests for auto-init/de-init
Matt Caswell [Mon, 8 Feb 2016 16:45:35 +0000 (16:45 +0000)]
Clean up the tests for auto-init/de-init

Remove the need to explicitly initialise/deinitialise for the tests

Reviewed-by: Richard Levitte <levitte@openssl.org>
3 years agoGet the apps to use auto-init/de-init
Matt Caswell [Mon, 8 Feb 2016 16:44:58 +0000 (16:44 +0000)]
Get the apps to use auto-init/de-init

Clean up the apps so that we make use of the new auto-init/de-init feature.

Reviewed-by: Richard Levitte <levitte@openssl.org>
3 years agoAuto init/de-init libssl
Matt Caswell [Mon, 8 Feb 2016 16:44:26 +0000 (16:44 +0000)]
Auto init/de-init libssl

Building on the pervious commit to auto initialise and de-initialise libssl

Reviewed-by: Richard Levitte <levitte@openssl.org>
3 years agoAuto init/deinit libcrypto
Matt Caswell [Mon, 8 Feb 2016 16:43:03 +0000 (16:43 +0000)]
Auto init/deinit libcrypto

This builds on the previous commit to auto initialise/deinitialise
libcrypto.

Reviewed-by: Richard Levitte <levitte@openssl.org>
3 years agoProvide framework for auto initialise/deinitialise of the library
Matt Caswell [Tue, 9 Feb 2016 11:26:14 +0000 (11:26 +0000)]
Provide framework for auto initialise/deinitialise of the library

This commit provides the basis and core code for an auto initialisation
and deinitialisation framework for libcrypto and libssl. The intention is
to remove the need (in many circumstances) to call explicit initialise and
deinitialise functions. Explicit initialisation will still be an option,
and if non-default initialisation is needed then it will be required.
Similarly for de-initialisation (although this will be a lot easier since
it will bring all de-initialisation into a single function).

Reviewed-by: Richard Levitte <levitte@openssl.org>
3 years agoFix 90-test_networking.t
Richard Levitte [Tue, 9 Feb 2016 14:11:01 +0000 (15:11 +0100)]
Fix 90-test_networking.t

The previous fix wasn't complete, it was missing a 'use OpenSSL::Test::Utils'

Reviewed-by: Matt Caswell <matt@openssl.org>
3 years agoUse rel2abs() on VMS, rather than realpath()
Richard Levitte [Tue, 9 Feb 2016 09:15:13 +0000 (10:15 +0100)]
Use rel2abs() on VMS, rather than realpath()

It seems realpath() is quite buggy on VMS, or will at least give quite
surprising results.  On the other hand, realpath() is the better on
Unix to clean out clutter like foo/../bar on Unix.

So we make out own function to get the absolute directory for a given
input, and use rel2abs() or realpath() depending on the platform
Configure runs on.

Issue reported by Steven M. Schweda <sms@antinode.info>

Reviewed-by: Andy Polyakov <appro@openssl.org>
3 years agoUpdate 90-test-networking.t to do the same checks as other TLSProxy tests
Richard Levitte [Tue, 9 Feb 2016 10:16:05 +0000 (11:16 +0100)]
Update 90-test-networking.t to do the same checks as other TLSProxy tests

Reviewed-by: Andy Polyakov <appro@openssl.org>
3 years agounified build scheme: adjust test framework for out of source build tree
Richard Levitte [Sat, 30 Jan 2016 00:05:33 +0000 (01:05 +0100)]
unified build scheme: adjust test framework for out of source build tree

To be able to run tests when we've built in a directory other than
the source tree, the testing framework needs a few adjustments.

test/testlib/OpenSSL/Test.pm needs to know where it can find
shlib_wrap.sh, and a number of other tests need to be told a different
place to find engines than what they may be able to figure out on
their own.  Relying to $TOP is not enough, $SRCTOP and $BLDTOP can be
used as an alternative.

As part of this change, top_file and top_dir are removed and
srctop_file, bldtop_file, srctop_dir and bldtop_dir take their place.

Reviewed-by: Ben Laurie <ben@openssl.org>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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

3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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

3 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>
3 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>
3 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>
3 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

3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>