oweals/openssl.git
8 years agoFix possible memory leak on BUF_MEM_grow_clean failure
FdaSilvaYY [Thu, 21 Jan 2016 22:09:57 +0000 (23:09 +0100)]
Fix possible memory leak on BUF_MEM_grow_clean failure

Simplify BUF_MEM init. code

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #580

8 years agoRefactor file writing - make configdata.pm the info center for "reconf"
Richard Levitte [Sun, 27 Dec 2015 01:27:30 +0000 (02:27 +0100)]
Refactor file writing - make configdata.pm the info center for "reconf"

Now that configdata.pm is the centre of information, use that instead
of Makefile to figure out reconfiguration parameters.  This will help
future development with different Makefile file names.

The code to read necessary configuration data from Makefile is retained
for an easy transition to configdata.pm based information gathering.  It
will be removed later on.

This change includes moving the variable $cross_compile_prefix to %config.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoString configs are truly deprecated, not even somewhat supported any more
Richard Levitte [Sat, 23 Jan 2016 10:43:35 +0000 (11:43 +0100)]
String configs are truly deprecated, not even somewhat supported any more

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRemove extra unused variable in util/dofile.pl
Richard Levitte [Sat, 23 Jan 2016 11:35:30 +0000 (12:35 +0100)]
Remove extra unused variable in util/dofile.pl

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix store with opaque data
Todd Short [Thu, 21 Jan 2016 19:26:53 +0000 (14:26 -0500)]
Fix store with opaque data

When experimental-store is enabled, it does not compile due to the
change to opaque data structures.

Change CRYPTO_add() to EVP_PKEY_up_ref() as needed.

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@openssl.org>
RT: #4263, GH: #579

8 years agofree item after sk_push fail
mrpre [Tue, 1 Sep 2015 12:42:06 +0000 (20:42 +0800)]
free item after sk_push fail

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoDisable jpake if psk is disabled.
Ben Laurie [Thu, 31 Dec 2015 16:45:00 +0000 (16:45 +0000)]
Disable jpake if psk is disabled.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoRefactor file writing - rewrite crypto/opensslconf.h.in as template
Richard Levitte [Mon, 18 May 2015 23:40:54 +0000 (01:40 +0200)]
Refactor file writing - rewrite crypto/opensslconf.h.in as template

The turn has come to have crypto/opensslconf.h.in get run through
util/dofile.pl.  The consequence is that a large number of variables
get moved to the %config table.

Also, the string variables $openssl_*, which were populated with cpp
lines, all being of the form "#define SOMETHING", were converted into
ARRAY refs in %config values, containing just the list of macros to be
defined.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRefactor file writing - Adapt util/mkdef.pl to use configdata.pm
Richard Levitte [Mon, 11 Jan 2016 23:17:12 +0000 (00:17 +0100)]
Refactor file writing - Adapt util/mkdef.pl to use configdata.pm

For this adaptation, the variables $options and $version needed to
move to %config in Configure, and why not move all other variables
holding diverse version numbers at the same time?

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRefactor file writing - information on our use of Perl and Perl modules
Richard Levitte [Thu, 21 Jan 2016 13:43:51 +0000 (14:43 +0100)]
Refactor file writing - information on our use of Perl and Perl modules

This includes a start on how to install missing modules.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRefactor file writing - adapt util/dofile.pl to use with_fallback
Richard Levitte [Fri, 22 Jan 2016 11:40:49 +0000 (12:40 +0100)]
Refactor file writing - adapt util/dofile.pl to use with_fallback

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoBundle the non core Perl module Text::Template
Richard Levitte [Fri, 22 Jan 2016 11:25:14 +0000 (12:25 +0100)]
Bundle the non core Perl module Text::Template

Because we're using Text::Template and we know it's a non core Perl
module, we choose to bundle it into our source, for convenience.

external/perl/Downloaded.txt document what modules we choose to bundle
this way and exactly where we downloaded it from.

With this changes comes the transfer module for with_fallback.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRefactor file writing - arrange for use of bundled Perl modules as fallback
Richard Levitte [Fri, 22 Jan 2016 11:37:31 +0000 (12:37 +0100)]
Refactor file writing - arrange for use of bundled Perl modules as fallback

For our own convenience, we need a mechanism to be able to fall back
on bundled Perl modules.  It's a minimal package that's called like
this:

    use with_fallback qw(Module1 Module2 ...);

For each module, it will try to require them from the system
installation, and failing that, it will temporarly add external/perl
and try to require transfer::{ModuleName}.  It requires that each
bundled Perl modules is accompanied by a small transfer module
(external/perl/transfer/ModuleName.pm in our example) that knows
exactly what to load.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRefactor file writing - introduce template driven file writing
Richard Levitte [Mon, 18 May 2015 20:35:23 +0000 (22:35 +0200)]
Refactor file writing - introduce template driven file writing

apps/CA.pl and tools/c_rehash are built from template files.  So far,
this was done by Configure, which created its own problems as it
forced everyone to reconfigure just because one of the template files
had changed.
Instead, have those files created as part of the normal build in apps/
and in tools/.

Furthermore, this prepares for a future where Configure may produce
entirely other build files than Makefile, and the latter can't be
guaranteed to be the holder of all information for other scripts.
Instead, configdata.pm (described below) becomes the center of
configuration information.

This introduces a few new things:

%config         a hash table to hold all kinds of configuration data
                that can be used by any other script.
configdata.pm   a perl module that Configure writes.  It currently
                holds the hash tables %config and %target.
util/dofile.pl  a script that takes a template on STDIN and outputs
                the result after applying configuration data on it.
                It's supposed to be called like this:

                        perl -I$(TOP) -Mconfigdata < template > result

                or

                        perl -I$(TOP) -Mconfigdata templ1 templ2 ... > result

                Note: util/dofile.pl requires Text::Template.

As part of this changed, remove a number of variables that are really
just copies of entries in %target, and use %target directly.  The
exceptions are $target{cflags} and $target{lflags}, they do get copied
to $cflags and $lflags.  The reason for this is that those variable
potentially go through a lot of changes and would rather deserve a
place in %config.  That, however, is for another commit.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRefactor config - consolidate and refresh print_table_entry
Richard Levitte [Mon, 18 May 2015 10:53:38 +0000 (12:53 +0200)]
Refactor config - consolidate and refresh print_table_entry

It's time for print_table_entry to get a bit of refreshment.  The way it
was put together, we needed to maintain the list of known configuration
keys of interest twice, in different shapes.  This is error prone, so
move the list of strings to a common list for all printing cases, and
use simple formatting of lines to do the actual printout based on that
list.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix quoting error in SRP printf
Andy Isaacson [Fri, 22 Jan 2016 20:06:21 +0000 (15:06 -0500)]
Fix quoting error in SRP printf

The code is trying to interpolate the value of the BASE_SECTION macro,
but due to excess escaping, it instead prints the string "BASE_SECTION".

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoFixed typo in the SSL_CTX_set_security_level
Alex Gaynor [Tue, 19 Aug 2014 01:56:04 +0000 (18:56 -0700)]
Fixed typo in the SSL_CTX_set_security_level

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoCleanup .gitignore
Richard Levitte [Fri, 22 Jan 2016 12:06:26 +0000 (13:06 +0100)]
Cleanup .gitignore

Some things to ignore need to be properly rooted, and use a bit more
precision on ignoring 'lib', as that maybe be a perfectly valid
directory name to add into git elsewhere in the source tree.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConfigurations - no_asm_filler is long gone, don't use it
Richard Levitte [Fri, 22 Jan 2016 11:49:28 +0000 (12:49 +0100)]
Configurations - no_asm_filler is long gone, don't use it

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix build failure with CIPHER_DEBUG
Alessandro Ghedini [Tue, 19 Jan 2016 21:15:33 +0000 (21:15 +0000)]
Fix build failure with CIPHER_DEBUG

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoisalist(1) is obsolete; use isainfo(1)
mmiyashi [Mon, 27 Jul 2015 22:07:59 +0000 (17:07 -0500)]
isalist(1) is obsolete; use isainfo(1)

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUpdated OSSL_DYNAMIC_VERSION/OSSL_DYNAMIC_OLDEST
Michał Trojnara [Thu, 14 Jan 2016 10:43:21 +0000 (11:43 +0100)]
Updated OSSL_DYNAMIC_VERSION/OSSL_DYNAMIC_OLDEST

Change to reflect changes in dynamic_fns

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agodsatest: use the correct BIO to print the test error
Marcus Meissner [Thu, 3 Dec 2015 14:19:53 +0000 (15:19 +0100)]
dsatest: use the correct BIO to print the test error

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agofew typo fixes
FdaSilvaYY [Sun, 17 Jan 2016 16:02:02 +0000 (17:02 +0100)]
few typo fixes

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoRemove outdated conftest.c
Rich Salz [Fri, 22 Jan 2016 16:33:16 +0000 (11:33 -0500)]
Remove outdated conftest.c

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoRefactor config - @MK1MF_Builds out, general build scheme in
Richard Levitte [Mon, 18 May 2015 12:31:49 +0000 (14:31 +0200)]
Refactor config - @MK1MF_Builds out, general build scheme in

Time to get rid of @MK1MF_Builds and introduce a more flexible
'build_scheme' configuration key.  Its value may be a string or an
array of strings, meaning we need to teach resolve_config how to
handle ARRAY referenses.

The build scheme is a word that selects a function to create the
appropriate result files for a certain configuration.  Currently valid
build schemes aer "mk1mf" and "unixmake", the plan is however to add
at least one other for a more universal build scheme.

Incidently, this also adds the functions 'add' and 'add_before', which
can be used in a configuration, so instead of having to repeatedly
write a sub like this:

key1 => sub { join(" ", @_, "myvalues"); },
key2 => sub { join(" ", "myvalues", @_); },

one could write this:

key1 => add(" ", "myvalues"),
key2 => add_before(" ", "myvalues"),

The good point with 'add' and 'add_before' is that they handle
inheritances where the values are a misture of scalars and ARRAYs.  If
there are any ARRAY to be found, the resulting value will be an ARRAY,
otherwise it will be a scalar with all the incoming valued joined
together with the separator given as first argument to add/add_before.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRefactor config - move templates and template docs to Configurations
Richard Levitte [Mon, 18 May 2015 00:54:28 +0000 (02:54 +0200)]
Refactor config - move templates and template docs to Configurations

Move the documentation of the target configuration form to
Configurations/README.

Move initial assembler object templates to
Configurations/00-BASE-templates.conf.

Furthermore, remove all variables containing the names of the
non-assembler object files and make a BASE template of them instead.
The  values from this templates are used as defaults as is.  The
remaining manipulation of data when assembler modules are used is done
only when $no_asm is false.

While doing this, clean out some other related variables that aren't
used anywhere.

Also, we had to move the resolution of the chosen target a bit, or the
function 'asm' would never catch a true $no_asm...  this hasn't
mattered before we've moved it all to the BASE template, but now it
does.

At the same time, add the default for the 'unistd' key to the BASE
template.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRefresh the thinking of --prefix and --openssldir
Richard Levitte [Wed, 20 Jan 2016 17:11:51 +0000 (18:11 +0100)]
Refresh the thinking of --prefix and --openssldir

--prefix is now exclusively used for software and manual installation.
--openssldir is not exclusively used as a default location for certs,
keys and the default openssl.cnf.

This change is made to bring clarity, to have the two less
intertwined, and to be more compatible with the usual ways of software
installation.

Please change your habits and scripts to use --prefix rather than
--openssldir for installation location now.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoRT3863 ECC: Add missing NULL check. Set a flag
Billy Brumley [Thu, 21 Jan 2016 12:06:57 +0000 (14:06 +0200)]
RT3863 ECC: Add missing NULL check. Set a flag

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoRefactor config - throw away the last remains of '--test-sanity'
Richard Levitte [Thu, 21 Jan 2016 00:23:43 +0000 (01:23 +0100)]
Refactor config - throw away the last remains of '--test-sanity'

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoRefactor config - consolidate handling of disabled stuff
Richard Levitte [Mon, 18 May 2015 09:03:47 +0000 (11:03 +0200)]
Refactor config - consolidate handling of disabled stuff

It's time to refactor the handling of %disabled so that all
information of value is in the same place.  We have so far had a few
cascading disable rules in form of code, far away from %disabled.
Instead, bring that information to the array @disable_cascade, which
is a list of pairs of the form 'test => descendents'.  The test part
can be a string, and it's simply checked if that string is a key in
%disabled, or it can be a CODEref to do a more complex test.  If the
test comes true, then all descendents are disabled.  This check is
performed until there are no more things that need to be disabled.

Also, $default_depflags is constructed from the information in
%disabled instead of being a separate string.  While a string of its
own is visually appealing, it's much too easy to forget to update it
when something is changed in %disabled.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoRefactor config - rewrite handling of "reconf"
Richard Levitte [Mon, 18 May 2015 01:33:55 +0000 (03:33 +0200)]
Refactor config - rewrite handling of "reconf"

The way the "reconf"/"reconfigure" argument is handled is overly
complicated.  Just grep for it first, and if it is there in the
current arguments, get the old command line arguments from Makefile.

While we're at it, make the Makefile variable CONFIGURE_ARGS hold the
value as a perl list of strings.  This makes things much safer in case
one of the arguments would contain a space.  Since CONFIGURE_ARGS is
used for nothing else, there's no harm in this.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoMultiple -trusted/-untrusted/-CRLfile options in verify
Viktor Dukhovni [Sat, 16 Jan 2016 06:15:02 +0000 (01:15 -0500)]
Multiple -trusted/-untrusted/-CRLfile options in verify

It is sometimes useful (especially in automated tests) to supply
multiple trusted or untrusted certificates via separate files rather
than have to prepare a single file containing them all.

To that end, change verify(1) to accept these options zero or more
times.  Also automatically set -no-CAfile and -no-CApath when
-trusted is specified.

Improve verify(1) documentation, which could still use some work.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRefactor apps load_certs/load_crls to work incrementally
Viktor Dukhovni [Sat, 16 Jan 2016 05:08:38 +0000 (00:08 -0500)]
Refactor apps load_certs/load_crls to work incrementally

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoMore X509_verify_cert() tests via verify(1).
Viktor Dukhovni [Thu, 14 Jan 2016 23:10:27 +0000 (18:10 -0500)]
More X509_verify_cert() tests via verify(1).

Still need tests for trusted-first and tests that probe construction
of alternate chains.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoReject when explicit trust EKU are set and none match.
Viktor Dukhovni [Fri, 15 Jan 2016 08:49:11 +0000 (03:49 -0500)]
Reject when explicit trust EKU are set and none match.

Returning untrusted is enough for for full chains that end in
self-signed roots, because when explicit trust is specified it
suppresses the default blanket trust of self-signed objects.

But for partial chains, this is not enough, because absent a similar
trust-self-signed policy, non matching EKUs are indistinguishable
from lack of EKU constraints.

Therefore, failure to match any trusted purpose must trigger an
explicit reject.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoCommit pre-generated test_verify certs
Viktor Dukhovni [Fri, 15 Jan 2016 21:12:42 +0000 (16:12 -0500)]
Commit pre-generated test_verify certs

These can be re-generated via:

        cd test/certs; ./setup.sh

if need be.  The keys are all RSA 2048-bit keys, but it is possible
to change that via environment variables.

    cd test/certs
    rm -f *-key.pem *-key2.pem
    OPENSSL_KEYALG=rsa OPENSSL_KEYBITS=3072 ./setup.sh

    cd test/certs
    rm -f *-key.pem *-key2.pem
    OPENSSL_KEYALG=ecdsa OPENSSL_KEYBITS=secp384r1 ./setup.sh

    ...

Keys are re-used if already present, so the environment variables
are only used when generating any keys that are missing.  Hence
the "rm -f"

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoScripts to generate verify test certs
Viktor Dukhovni [Fri, 15 Jan 2016 08:48:27 +0000 (03:48 -0500)]
Scripts to generate verify test certs

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoCheck Suite-B constraints with EE DANE records
Viktor Dukhovni [Sun, 17 Jan 2016 21:50:52 +0000 (16:50 -0500)]
Check Suite-B constraints with EE DANE records

When DANE-EE(3) matches or either of DANE-EE/PKIX-EE fails, we don't
build a chain at all, but rather succeed or fail with just the leaf
certificate.  In either case also check for Suite-B violations.

As unlikely as it may seem that anyone would enable both DANE and
Suite-B, we should do what the application asks.

Took the opportunity to eliminate the "cb" variables in x509_vfy.c,
just call ctx->verify_cb(ok, ctx)

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoRefactor config - split read_config into read_config and resolve_config
Richard Levitte [Mon, 18 May 2015 00:57:24 +0000 (02:57 +0200)]
Refactor config - split read_config into read_config and resolve_config

Split the read_config function into read_config that ONLY reads the
configuration files but doesn't try to resolve any of the
inheritances, and resolve_config which resolves the inheritance chain
of a given target.  Move them to the bottom of Configure, with the
rest of the helpers.

Have a new small hash table, %target, which will hold the values for
the target the user requested.  This also means that all access to the
current target data can be reduced from '$table{$target}->{key}' to a
mere '$target{key}'.

While we're at it, the old string formatted configurations are getting
obsolete, so they may as well get deprecated entirely.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRefactor config - throw away '--test-sanity'
Richard Levitte [Mon, 18 May 2015 10:51:16 +0000 (12:51 +0200)]
Refactor config - throw away '--test-sanity'

Get rid of the --test-sanity option.  Since we no longer have string
based configurations, we don't have the problem with miscounting
colons any more.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRefactor config - a small cosmetic touchup of Configure
Richard Levitte [Mon, 18 May 2015 00:46:21 +0000 (02:46 +0200)]
Refactor config - a small cosmetic touchup of Configure

Start simple, removed some unused variables and change all '<<EOF' to
'<<"EOF"'.  The latter is because some code colorizers (notably, in
emacs) cannot recognise the here document end marker unless it's
quoted and therefore assume the rest of the file is part of the here
document.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd an engine destructor to eng_cryptodev.
Richard Levitte [Tue, 19 Jan 2016 00:27:12 +0000 (01:27 +0100)]
Add an engine destructor to eng_cryptodev.

Reviewed-by: Ben Laurie <ben@openssl.org>
8 years agoAdapt BSD cryptodev engine to opaque EVP_MD_CTX, EVP_CIPHER_CTX, etc
Richard Levitte [Mon, 18 Jan 2016 23:46:42 +0000 (00:46 +0100)]
Adapt BSD cryptodev engine to opaque EVP_MD_CTX, EVP_CIPHER_CTX, etc

Reviewed-by: Ben Laurie <ben@openssl.org>
8 years agoRemove update tags
Rich Salz [Mon, 18 Jan 2016 16:50:36 +0000 (11:50 -0500)]
Remove update tags

Also remove depend/local_depend.
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoConsolidate "make update"
Rich Salz [Sun, 17 Jan 2016 21:53:53 +0000 (16:53 -0500)]
Consolidate "make update"

Rename 'update' to 'generate'.  Rather than recurse, just explicitly
call the three generate targets directly.
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoHandle SSL_shutdown while in init more appropriately
Matt Caswell [Mon, 7 Dec 2015 16:50:38 +0000 (16:50 +0000)]
Handle SSL_shutdown while in init more appropriately

Calling SSL_shutdown while in init previously gave a "1" response, meaning
everything was successfully closed down (even though it wasn't). Better is
to send our close_notify, but fail when trying to receive one.

The problem with doing a shutdown while in the middle of a handshake is
that once our close_notify is sent we shouldn't really do anything else
(including process handshake/CCS messages) until we've received a
close_notify back from the peer. However the peer might send a CCS before
acting on our close_notify - so we won't be able to read it because we're
not acting on CCS messages!

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agomake EVP_PKEY opaque
Dr. Stephen Henson [Tue, 19 Jan 2016 00:21:12 +0000 (00:21 +0000)]
make EVP_PKEY opaque

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRemove the GOST engine
Matt Caswell [Tue, 19 Jan 2016 12:06:33 +0000 (12:06 +0000)]
Remove the GOST engine

The GOST engine is now out of date and is removed by this commit. An up
to date GOST engine is now being maintained in an external repository.

See:
https://wiki.openssl.org/index.php/Binaries

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix BSD -rpath parameter
Richard Levitte [Tue, 19 Jan 2016 19:35:41 +0000 (20:35 +0100)]
Fix BSD -rpath parameter

For BSD systems, Configure adds a shared_ldflags including a reference
to the Makefile variable LIBRPATH, but since it must be passed down to
Makefile.shared, care must be taken so the value of LIBRPATH doesn't
get expanded too early, or it ends up giving an empty string.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoAPI compat for SSLeay_add_ssl_algorithms
Viktor Dukhovni [Tue, 19 Jan 2016 17:42:31 +0000 (12:42 -0500)]
API compat for SSLeay_add_ssl_algorithms

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoValidate ClientHello session_id field length and send alert on failure
Alessandro Ghedini [Thu, 8 Oct 2015 17:56:03 +0000 (19:56 +0200)]
Validate ClientHello session_id field length and send alert on failure

RT#4080

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoprf redirection build fixes
Dr. Stephen Henson [Tue, 19 Jan 2016 15:17:41 +0000 (15:17 +0000)]
prf redirection build fixes

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoUpdate license year range to 2016
Prayag Verma [Mon, 18 Jan 2016 03:19:09 +0000 (08:49 +0530)]
Update license year range to 2016

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoSupport disabling any or all TLS or DTLS versions
Viktor Dukhovni [Mon, 18 Jan 2016 18:10:21 +0000 (13:10 -0500)]
Support disabling any or all TLS or DTLS versions

Some users want to disable SSL 3.0/TLS 1.0/TLS 1.1, and enable just
TLS 1.2.  In the future they might want to disable TLS 1.2 and
enable just TLS 1.3, ...

This commit makes it possible to disable any or all of the TLS or
DTLS protocols.  It also considerably simplifies the SSL/TLS tests,
by auto-generating the min/max version tests based on the set of
supported protocols (425 explicitly written out tests got replaced
by two loops that generate all 425 tests if all protocols are
enabled, fewer otherwise).

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd documentation for EVP_PKEY_TLS1_PRF
Dr. Stephen Henson [Tue, 19 Jan 2016 13:59:09 +0000 (13:59 +0000)]
Add documentation for EVP_PKEY_TLS1_PRF

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoadd TLS1-PRF tests
Dr. Stephen Henson [Tue, 19 Jan 2016 13:59:05 +0000 (13:59 +0000)]
add TLS1-PRF tests

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoAdd TLS1-PRF test support to evp_test
Dr. Stephen Henson [Tue, 19 Jan 2016 13:59:00 +0000 (13:59 +0000)]
Add TLS1-PRF test support to evp_test

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agouse TLS PRF
Dr. Stephen Henson [Tue, 19 Jan 2016 13:58:51 +0000 (13:58 +0000)]
use TLS PRF

Modify libssl to use EVP_PKEY TLS PRF.

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoAdd TLS PRF method.
Dr. Stephen Henson [Tue, 19 Jan 2016 13:57:19 +0000 (13:57 +0000)]
Add TLS PRF method.

Add EVP_PKEY algorithm for TLS1 PRF.

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoFix GOST2012-NULL-GOST12
Dmitry Belyavsky [Tue, 19 Jan 2016 11:36:43 +0000 (11:36 +0000)]
Fix GOST2012-NULL-GOST12

Fix a typo in the definition of the GOST2012-NULL-GOST12 ciphersuite.

RT#4213

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoDrop cached certificate signature validity flag
Viktor Dukhovni [Sun, 17 Jan 2016 07:33:14 +0000 (02:33 -0500)]
Drop cached certificate signature validity flag

It seems risky in the context of cross-signed certificates when the
same certificate might have multiple potential issuers.  Also rarely
used, since chains in OpenSSL typically only employ self-signed
trust-anchors, whose self-signatures are not checked, while untrusted
certificates are generally ephemeral.

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoDon't use "grep -q", "-q" is not POSIX, and fails on Solaris.
Kristian Amlie [Mon, 18 Jan 2016 14:18:56 +0000 (15:18 +0100)]
Don't use "grep -q", "-q" is not POSIX, and fails on Solaris.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd some extra Cygwin targets as aliases for Cygwin-x86
Richard Levitte [Sun, 17 Jan 2016 17:03:04 +0000 (18:03 +0100)]
Add some extra Cygwin targets as aliases for Cygwin-x86

Cygwin was used for x86 before, so let's keep it around for those who
still use it (it make Configure reconf possible).
Cygwin-i[3456]86 for those that might generate and pass a target name
directly to Configure.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdjust the configuration target name from Cygwin-i686 to Cygwin-x86
Richard Levitte [Sun, 17 Jan 2016 16:48:53 +0000 (17:48 +0100)]
Adjust the configuration target name from Cygwin-i686 to Cygwin-x86

This is to reflect that it's not limited to just i686.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix configuration system to support different architectures on Cygwin.
Corinna Vinschen [Sun, 17 Jan 2016 15:42:38 +0000 (16:42 +0100)]
Fix configuration system to support different architectures on Cygwin.

This patch allows to recognize the architectures supported by Cygwin
and to choose the right configuration from there.  Drop -march to
use default architecture on 32 bit x86.

Drop pre-Cygwin-1.3 recognition since it's long gone and there's no
valid configuration for this anymore.

Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoDon't strip object files on Cygwin
Corinna Vinschen [Sat, 16 Jan 2016 18:36:15 +0000 (19:36 +0100)]
Don't strip object files on Cygwin

  Building for the Cygwin distro requires to be able to build debuginfo
  files.  This in turn requires to build object files without stripping.
  The stripping is performed by the next step after building which creates
  the debuginfo files.

Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUse POSIX functions on Cygwin, not Win32 function
Corinna Vinschen [Sat, 16 Jan 2016 18:30:48 +0000 (19:30 +0100)]
Use POSIX functions on Cygwin, not Win32 function

Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix build break; restore missing target
Rich Salz [Mon, 18 Jan 2016 02:56:10 +0000 (21:56 -0500)]
Fix build break; restore missing target

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix function declarations.
Rich Salz [Sun, 17 Jan 2016 22:36:17 +0000 (17:36 -0500)]
Fix function declarations.

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoAccessor update; fix API, document one.
Rich Salz [Sun, 17 Jan 2016 19:39:57 +0000 (14:39 -0500)]
Accessor update; fix API, document one.

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoRemove some old makefile targets
Rich Salz [Fri, 15 Jan 2016 20:01:30 +0000 (15:01 -0500)]
Remove some old makefile targets

Remove lint, tags, dclean, tests.
This is prep for a new makedepend scheme.
This is temporary pending unified makefile, and might help it.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd some accessors.
Rich Salz [Sun, 17 Jan 2016 15:34:26 +0000 (10:34 -0500)]
Add some accessors.

Author: Remi Gacogne <rgacogne-github@coredump.fr>
GH334: Add an OCSP_SINGLERESP_get0_id() accessor to the OCSP_CERTID of
a OCSP_SINGLERESP. It is possible to do it the other way around using
OCSP_resp_find(), but this is more efficient when you have a tree indexed
by OCSP_CERTID, like haproxy does. (This is also RT4251)

Author: Marek Klein <kleinmrk@gmail.com>
GH556: OCSP_resp_get_produced_at() accessor to the producedAt of a
OCSP_BASICRESP
GH555: TS_STATUS_INFO_get_status(), TS_STATUS_INFO_get_text() and
TS_STATUS_INFO_get_failure_info() accessors for a TS_STATUS_INFO

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoRT4247: Add missing patch
Rich Salz [Sun, 17 Jan 2016 04:24:44 +0000 (23:24 -0500)]
RT4247: Add missing patch

Missed the camellia EVP update.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoThe TLSProxy tests can't run if no-engine has been configured
Richard Levitte [Sat, 16 Jan 2016 23:25:44 +0000 (00:25 +0100)]
The TLSProxy tests can't run if no-engine has been configured

Make sure they detect that.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agofix no-engine build
Dr. Stephen Henson [Sat, 16 Jan 2016 16:11:34 +0000 (16:11 +0000)]
fix no-engine build

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoStart a new line after each sentence-ending period.
Viktor Dukhovni [Sat, 16 Jan 2016 20:43:14 +0000 (15:43 -0500)]
Start a new line after each sentence-ending period.

This avoids explicit double spaces between sentences.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMake SSL_dane_enable() requirement more clear.
Viktor Dukhovni [Sat, 16 Jan 2016 20:29:44 +0000 (15:29 -0500)]
Make SSL_dane_enable() requirement more clear.

Also s/s/ssl/ as appropriate in the code example.

Suggested by Claus Assmann.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoBetter invalid SNI name error handling
Viktor Dukhovni [Sat, 16 Jan 2016 18:25:17 +0000 (13:25 -0500)]
Better invalid SNI name error handling

Also report an SSL_dane_enable error when the basedomain is an
invalid SNI name.  Avoid side-effects when such a name is valid
with X509_VERIFY_PARAM_set1_host(), as e.g. with an empty name, by
setting the SNI name first.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoEmpty SNI names are not valid
Viktor Dukhovni [Sat, 16 Jan 2016 17:57:24 +0000 (12:57 -0500)]
Empty SNI names are not valid

While empty inputs to SSL_set1_host() clear the reference identifier
list.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRT4247: Fix EVP_CIPHER_CTX opaque on sparc
Rich Salz [Sat, 16 Jan 2016 03:37:11 +0000 (22:37 -0500)]
RT4247: Fix EVP_CIPHER_CTX opaque on sparc

Via Rainer Jung

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agofree up gost ciphers
Dr. Stephen Henson [Thu, 14 Jan 2016 22:13:37 +0000 (22:13 +0000)]
free up gost ciphers

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoAdd lookup_certs for a trusted stack.
Dr. Stephen Henson [Thu, 14 Jan 2016 23:56:50 +0000 (23:56 +0000)]
Add lookup_certs for a trusted stack.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoNGX-2040 - fix wildcard match on punycode/IDNA DNS names
Zi Lin [Fri, 15 Jan 2016 19:31:11 +0000 (14:31 -0500)]
NGX-2040 - fix wildcard match on punycode/IDNA DNS names

- bugfix: should not treat '--' as invalid domain substring.
- '-' should not be the first letter of a domain

Signed-off-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix typo
Rich Salz [Fri, 15 Jan 2016 16:41:27 +0000 (11:41 -0500)]
Fix typo

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoUpdate Windows installation instructions
Matt Caswell [Thu, 14 Jan 2016 20:19:23 +0000 (20:19 +0000)]
Update Windows installation instructions

The windows installation instructions were very out of date. Substantial
update to the text. Remove a lot of historical stuff that isn't relevant
any more, and merge the win64 and win32 instructions into one file.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRename INSTALL.W32 to INSTALL.WIN
Matt Caswell [Thu, 14 Jan 2016 20:16:40 +0000 (20:16 +0000)]
Rename INSTALL.W32 to INSTALL.WIN

Also remove the INSTALL.W64 file. Next commit will update INSTALL.WIN to
cover both.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoSmall fixup, an extra line slipped in
Richard Levitte [Thu, 14 Jan 2016 21:05:09 +0000 (22:05 +0100)]
Small fixup, an extra line slipped in

The previous 'Relax the requirements for a debug build' commit had
an extra line of code that shouldn't have been there.  This fixes it.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoCosmetic polish for last-resort depth 0 check
Viktor Dukhovni [Thu, 14 Jan 2016 20:03:15 +0000 (15:03 -0500)]
Cosmetic polish for last-resort depth 0 check

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAvoid the r modifier for s/// (perl)
Richard Levitte [Thu, 14 Jan 2016 19:22:36 +0000 (20:22 +0100)]
Avoid the r modifier for s/// (perl)

It seems that the r modifier for s/// is fairly new.  It's reported
not to exist in perl 5.10.1, so it's better to avoid it when
possible.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoFix last-resort depth 0 check when the chain has multiple certificates
Viktor Dukhovni [Thu, 14 Jan 2016 19:34:50 +0000 (14:34 -0500)]
Fix last-resort depth 0 check when the chain has multiple certificates

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd a no-egd option to disable EGD-related code
Benjamin Kaduk [Wed, 13 Jan 2016 00:02:16 +0000 (18:02 -0600)]
Add a no-egd option to disable EGD-related code

The entropy-gathering daemon is used only on a small number of machines.
Provide a configure knob so that EGD support can be disabled by default
but re-enabled on those systems that do need it.

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoMake SSL_set_debug deprecated in 1.1
Rich Salz [Thu, 14 Jan 2016 17:16:00 +0000 (12:16 -0500)]
Make SSL_set_debug deprecated in 1.1

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoAlways initialize X509_STORE_CTX get_crl pointer
Viktor Dukhovni [Thu, 14 Jan 2016 17:23:35 +0000 (12:23 -0500)]
Always initialize X509_STORE_CTX get_crl pointer

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoEditorial
Viktor Dukhovni [Thu, 14 Jan 2016 16:54:39 +0000 (11:54 -0500)]
Editorial

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoIn __cwd, make sure the given directory is seen as such and not a file
Richard Levitte [Thu, 14 Jan 2016 16:38:52 +0000 (17:38 +0100)]
In __cwd, make sure the given directory is seen as such and not a file

On Unixly platforms, this doesn't matter.  On VMS, it does.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRelax the requirements for a debug build
Richard Levitte [Thu, 14 Jan 2016 16:03:58 +0000 (17:03 +0100)]
Relax the requirements for a debug build

We required that a target be named 'debug-something' or to have at
least one of the configuration items debug_cflags and debug_lflags for
--debug to be accepted.

However, there are targets with no such markings but that will still
have debugging capabilities.  This is particularly true for mk1mf
builds, where the extra flags for debugging are figured out later on
by util/mk1mf.pl.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRT4232: Extra space in help message.
Rich Salz [Thu, 14 Jan 2016 04:11:01 +0000 (23:11 -0500)]
RT4232: Extra space in help message.

It turns out that -pause calls the undocumented function SSL_set_debug.
That just sets flag inside the SSL structure.  That flag, despite
the command is never used.  So remove the flag, the field, and the
function.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoEDH >= 1024 bits even at security level 0
Viktor Dukhovni [Thu, 14 Jan 2016 06:16:16 +0000 (01:16 -0500)]
EDH >= 1024 bits even at security level 0

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoPrepare for 1.1.0-pre3-dev
Richard Levitte [Thu, 14 Jan 2016 14:27:14 +0000 (15:27 +0100)]
Prepare for 1.1.0-pre3-dev

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