oweals/openssl.git
8 years agoDon't replace cflags with thread_cflags, only append the latter
Richard Levitte [Fri, 29 Jan 2016 16:21:18 +0000 (17:21 +0100)]
Don't replace cflags with thread_cflags, only append the latter

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRemove clean-depend
Rich Salz [Thu, 21 Jan 2016 15:29:38 +0000 (10:29 -0500)]
Remove clean-depend

Remove depend hacks from demos/engines.
Remove clean-depend; just call makedepend (or $CC -M) and use that.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoMake it possible to check for explicit auxiliary trust
Viktor Dukhovni [Thu, 28 Jan 2016 03:43:23 +0000 (22:43 -0500)]
Make it possible to check for explicit auxiliary trust

By default X509_check_trust() trusts self-signed certificates from
the trust store that have no explicit local trust/reject oids
encapsulated as a "TRUSTED CERTIFICATE" object.  (See the -addtrust
and -trustout options of x509(1)).

This commit adds a flag that makes it possible to distinguish between
that implicit trust, and explicit auxiliary settings.

With flags |= X509_TRUST_NO_SS_COMPAT, a certificate is only trusted
via explicit trust settings.

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoAlways DPURIFY
Emilia Kasper [Wed, 27 Jan 2016 18:13:33 +0000 (19:13 +0100)]
Always DPURIFY

The use of the uninitialized buffer in the RNG has no real security
benefits and is only a nuisance when using memory sanitizers.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoRemove x86_gcc_des,x86_gcc_opts
Rich Salz [Thu, 28 Jan 2016 00:16:38 +0000 (19:16 -0500)]
Remove x86_gcc_des,x86_gcc_opts

This is a followin from !1738, we no longer need those variables.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd have_precompute_mult tests
Matt Caswell [Wed, 4 Nov 2015 22:54:29 +0000 (22:54 +0000)]
Add have_precompute_mult tests

Add tests for have_precompute_mult for the optimised curves (nistp224,
nistp256 and nistp521) if present

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix bug in nistp224/256/521 where have_precompute_mult always returns 0
Matt Caswell [Wed, 4 Nov 2015 17:30:22 +0000 (17:30 +0000)]
Fix bug in nistp224/256/521 where have_precompute_mult always returns 0

During precomputation if the group given is well known then we memcpy a
well known precomputation. However we go the wrong label in the code and
don't store the data properly. Consequently if we call have_precompute_mult
the data isn't there and we return 0.

RT#3600

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd missing return value checks
Matt Caswell [Fri, 29 Jan 2016 09:40:03 +0000 (09:40 +0000)]
Add missing return value checks

The function DH_check_pub_key() was missing some return value checks in
some calls to BN functions.

RT#4278

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoCorrect value of DH_CHECK_PUBKEY_INVALID
Matt Caswell [Fri, 29 Jan 2016 09:38:06 +0000 (09:38 +0000)]
Correct value of DH_CHECK_PUBKEY_INVALID

A new return value for DH_check_pub_key was recently added:
DH_CHECK_PUBKEY_INVALID. As this is a flag which can be ORed with other
return values it should have been set to the value 4 not 3.

RT#4278

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoImplement Async SSL_shutdown
Matt Caswell [Mon, 25 Jan 2016 15:00:10 +0000 (15:00 +0000)]
Implement Async SSL_shutdown

This extends the existing async functionality to SSL_shutdown(), i.e.
SSL_shutdown() can now casuse an SSL_ERROR_WANT_ASYNC error to be returned
from SSL_get_error() if async mode has been enabled.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoKeep RC5 bit shifts in [0..31]
Viktor Dukhovni [Fri, 29 Jan 2016 00:04:49 +0000 (19:04 -0500)]
Keep RC5 bit shifts in [0..31]

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUse callback for DSAPublicKey
Dr. Stephen Henson [Thu, 28 Jan 2016 19:34:51 +0000 (19:34 +0000)]
Use callback for DSAPublicKey

PR#4277

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoRemove extraneous output from util/mk scripts
Rich Salz [Thu, 28 Jan 2016 19:17:19 +0000 (14:17 -0500)]
Remove extraneous output from util/mk scripts

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRemove outdated tests
Rich Salz [Thu, 28 Jan 2016 03:00:55 +0000 (22:00 -0500)]
Remove outdated tests

These tests are not built, and only usable as hand-tests so not
worth moving into our test framework.
This closes https://github.com/openssl/openssl/pull/561 and RT 4252

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd more components to build.
Rich Salz [Thu, 28 Jan 2016 19:26:50 +0000 (14:26 -0500)]
Add more components to build.

Add enable-crypto-mdebug enable-rc5 enable-md2 to any target that was
--strict-warnings.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoMissed part of b4f35e
Rich Salz [Thu, 28 Jan 2016 18:40:33 +0000 (13:40 -0500)]
Missed part of b4f35e

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoCorrect number of arguments in BIO_get_conn_int_port macro
Richard Levitte [Thu, 28 Jan 2016 16:55:11 +0000 (17:55 +0100)]
Correct number of arguments in BIO_get_conn_int_port macro

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoCHANGES and NEWS updates for release
Matt Caswell [Wed, 27 Jan 2016 13:41:16 +0000 (13:41 +0000)]
CHANGES and NEWS updates for release

Add details about the latest issues fixed in the forthcoming release.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd a test for small subgroup attacks on DH/DHE
Matt Caswell [Wed, 20 Jan 2016 11:56:28 +0000 (11:56 +0000)]
Add a test for small subgroup attacks on DH/DHE

Following on from the previous commit, add a test to ensure that
DH_compute_key correctly fails if passed a bad y such that:

y^q (mod p) != 1

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoPrevent small subgroup attacks on DH/DHE
Matt Caswell [Mon, 18 Jan 2016 11:31:58 +0000 (11:31 +0000)]
Prevent small subgroup attacks on DH/DHE

Historically OpenSSL only ever generated DH parameters based on "safe"
primes. More recently (in version 1.0.2) support was provided for
generating X9.42 style parameter files such as those required for RFC
5114 support. The primes used in such files may not be "safe". Where an
application is using DH configured with parameters based on primes that
are not "safe" then an attacker could use this fact to find a peer's
private DH exponent. This attack requires that the attacker complete
multiple handshakes in which the peer uses the same DH exponent.

A simple mitigation is to ensure that y^q (mod p) == 1

CVE-2016-0701

Issue reported by Antonio Sanso.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoFix typo in md2.h
Rich Salz [Thu, 28 Jan 2016 14:18:21 +0000 (09:18 -0500)]
Fix typo in md2.h

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoRestore NUMPRIMES as a numeric literal
Viktor Dukhovni [Thu, 28 Jan 2016 05:10:11 +0000 (00:10 -0500)]
Restore NUMPRIMES as a numeric literal

This fixes clang compilation problem with size_t NUMPRIMES and int
loop counters.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd CRYPTO_secure_zalloc
Rich Salz [Thu, 28 Jan 2016 04:16:47 +0000 (23:16 -0500)]
Add CRYPTO_secure_zalloc

Also turn B<foo> into foo() in the pod page.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoComment side-effect only calls of X509_check_purpose
Viktor Dukhovni [Thu, 28 Jan 2016 02:54:09 +0000 (21:54 -0500)]
Comment side-effect only calls of X509_check_purpose

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRemove EIGHT_BIT and SIXTEEN_BIT
Rich Salz [Sat, 23 Jan 2016 18:23:25 +0000 (13:23 -0500)]
Remove EIGHT_BIT and SIXTEEN_BIT

Also cleaned up bn_prime.pl to current coding style.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoRemove outdated legacy crypto options
Rich Salz [Wed, 27 Jan 2016 23:43:25 +0000 (18:43 -0500)]
Remove outdated legacy crypto options

Many options for supporting optimizations for legacy crypto on legacy
platforms have been removed.  This simplifies the source code and
does not really penalize anyone.
        DES_PTR (always on)
        DES_RISC1, DES_RISC2 (always off)
        DES_INT (always 'unsigned int')
        DES_UNROLL (always on)
        BF_PTR (always on) BF_PTR2 (removed)
        MD2_CHAR, MD2_LONG (always 'unsigned char')
        IDEA_SHORT, IDEA_LONG (always 'unsigned int')
        RC2_SHORT, RC2_LONG (always 'unsigned int')
        RC4_LONG (only int and char (for assembler) are supported)
        RC4_CHUNK (always long), RC_CHUNK_LL (removed)
        RC4_INDEX (always on)
And also make D_ENCRYPT macro more clear (@appro)

This is done in consultation with Andy.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoFix check of what makedepprog should be
Richard Levitte [Wed, 27 Jan 2016 18:03:13 +0000 (19:03 +0100)]
Fix check of what makedepprog should be

A mistake was made and the setting of this config variable got
reverted to an older behavior.  This restores the latest.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoTest all built-in curves and let the library choose the EC_METHOD
Billy Brumley [Wed, 27 Jan 2016 15:29:32 +0000 (17:29 +0200)]
Test all built-in curves and let the library choose the EC_METHOD

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoComplete the removal of /* foo.c */ comments
Richard Levitte [Wed, 27 Jan 2016 17:37:12 +0000 (18:37 +0100)]
Complete the removal of /* foo.c */ comments

Some files that are automatically generated still had those comments
added by the generating scripts.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoSkip all explicitely if the number of tests is 0
Richard Levitte [Wed, 27 Jan 2016 17:31:08 +0000 (18:31 +0100)]
Skip all explicitely if the number of tests is 0

It seems that Test::More doesn't like 0 tests, a line like this raises
an error and stops the recipe entirely:

    plan tests => 0;

So we need to check for 0 tests beforehand and skip the subtest
explicitely in that case.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix typos
Zhao Junwang [Tue, 26 Jan 2016 21:57:27 +0000 (05:57 +0800)]
Fix typos

cryptograpic => cryptographic

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoBe careful when applying EXE_SHELL
Richard Levitte [Tue, 26 Jan 2016 16:50:13 +0000 (17:50 +0100)]
Be careful when applying EXE_SHELL

$EXE_SHELL should only be used with out own programs, not with
surrounding programs such as the perl interpreter.

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoDoc fixes suggested by Claus Assmann
Viktor Dukhovni [Wed, 27 Jan 2016 05:55:19 +0000 (00:55 -0500)]
Doc fixes suggested by Claus Assmann

RT4264, RT4268

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoFix Custom Extension tests skip count
Viktor Dukhovni [Tue, 26 Jan 2016 21:52:26 +0000 (16:52 -0500)]
Fix Custom Extension tests skip count

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRemove /* foo.c */ comments
Rich Salz [Fri, 18 Dec 2015 17:57:23 +0000 (12:57 -0500)]
Remove /* foo.c */ comments

This was done by the following
        find . -name '*.[ch]' | /tmp/pl
where /tmp/pl is the following three-line script:
        print unless $. == 1 && m@/\* .*\.[ch] \*/@;
        close ARGV if eof; # Close file to reset $.

And then some hand-editing of other files.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoSHARED_LIBS_LINK_EXTS is no longer used, remove it completely
Richard Levitte [Tue, 26 Jan 2016 16:04:26 +0000 (17:04 +0100)]
SHARED_LIBS_LINK_EXTS is no longer used, remove it completely

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRemove unused, undocumented clean-shared target
Benjamin Kaduk [Thu, 21 Jan 2016 18:06:39 +0000 (12:06 -0600)]
Remove unused, undocumented clean-shared target

Also removes the make variable SHARED_LIBS_LINK_EXTS, only used by
the clean-shared target.

When shared library linking was moved to the separate Makefile.shared
in commit 30afcc072acd4f70590fec68bf0590da4e4f1883, this target was
skipped.  Prior to that commit, clean-shared was invoked as a
dependency of build-shared, but afterward it was no longer referenced
anywhere in the tree.

Instead of porting the functionality over to Makefile.shared, just
remove it entirely, as it appears to be unused.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRT4272: Unit tests fail when DTLS disabled
Todd Short [Mon, 25 Jan 2016 17:44:15 +0000 (12:44 -0500)]
RT4272: Unit tests fail when DTLS disabled

Missing SKIP: block in SSL unit tests for DTLS and TLS version tests.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years ago80-test_ca.t is made to use the new perlapp()
Richard Levitte [Tue, 26 Jan 2016 14:01:00 +0000 (15:01 +0100)]
80-test_ca.t is made to use the new perlapp()

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoHave OpenSSL::Test handle perl scripts like any program
Richard Levitte [Tue, 26 Jan 2016 13:57:21 +0000 (14:57 +0100)]
Have OpenSSL::Test handle perl scripts like any program

Since we're building some of our perl scripts and the result might not
end up in apps/ (*), we may need to treat them like the compile
programs we use for testing.

This introduces perlapp() and perltest(), which behave like app() and
test(), but will add the perl executable in the command line.

-----

(*) For example, with a mk1mf build, the result will end up in $(BIN_D)

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoAdd SSL_up_ref() and SSL_CTX_up_ref()
Matt Caswell [Tue, 26 Jan 2016 11:31:41 +0000 (11:31 +0000)]
Add SSL_up_ref() and SSL_CTX_up_ref()

The SSL and SSL_CTX structures are reference counted. However since libssl
was made opaque there is no way for users of the library to manipulate the
reference counts. This adds functions to enable that.

Reviewed-by: Stephen Henson <steve@openssl.org>
8 years agoRemove dirs from mkfiles.pl
Matt Caswell [Tue, 26 Jan 2016 10:29:48 +0000 (10:29 +0000)]
Remove dirs from mkfiles.pl

Recent changes have removed some directories which is causing mkfiles.pl
to fail.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUse the new OpenSSL::Test::Utils routines.
Richard Levitte [Tue, 26 Jan 2016 01:11:55 +0000 (02:11 +0100)]
Use the new OpenSSL::Test::Utils routines.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoUse Configure's @disablables and %disabled through configdata.pm
Richard Levitte [Tue, 26 Jan 2016 01:09:33 +0000 (02:09 +0100)]
Use Configure's @disablables and %disabled through configdata.pm

Enhances the routines in OpenSSL::Test::Utils for checking disabled
stuff to get their information directly from Configure instead of
'openssl list -disabled'.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoConfigure first in travis create release
Richard Levitte [Tue, 26 Jan 2016 00:47:00 +0000 (01:47 +0100)]
Configure first in travis create release

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoBase the tarfile list of files on git ls-files instead of find
Richard Levitte [Tue, 26 Jan 2016 00:40:13 +0000 (01:40 +0100)]
Base the tarfile list of files on git ls-files instead of find

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAsk for tests in CONTRIBUTING
Rich Salz [Mon, 25 Jan 2016 22:12:57 +0000 (17:12 -0500)]
Ask for tests in CONTRIBUTING

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoSmall Makefile.in cleanup
Richard Levitte [Mon, 25 Jan 2016 21:23:42 +0000 (22:23 +0100)]
Small Makefile.in cleanup

engines_obj changed name to padlock_obj in Configure.  We need to do
the corresponding ENGINES_ASM_OBJ -> PADLOCK_ASM_OBJ in appropriate
Makefile.ins.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoSmall cleanups in Configure
Richard Levitte [Mon, 25 Jan 2016 20:51:22 +0000 (21:51 +0100)]
Small cleanups in Configure

- Small rearrangement of the TABLE and HASH printouts, and adding
  printout of the "build_scheme" item
- Renamed "engines_obj" to "padlock_obj"
- Moved the runs of dofile down...  it didn't quite make sense to have
  that in the middle of a printout

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGenerate warning text
Richard Levitte [Mon, 25 Jan 2016 20:19:59 +0000 (21:19 +0100)]
Generate warning text

Now that we're using templates, we should warn people not to edit the
resulting file.  We do it through util/dofile.pl, which is enhanced
with an option to tell what file it was called from.  We also change
the calls so the template files are on the command line instead of
being redirected through standard input.  That way, we can display
something like this (example taken from include/openssl/opensslconf.h):

    /* WARNING: do not edit! */
    /* Generated by Configure from include/openssl/opensslconf.h.in */

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMisc fixups
Richard Levitte [Mon, 25 Jan 2016 19:07:34 +0000 (20:07 +0100)]
Misc fixups

The goal is Makefile, not Makefile.new
Remove the second generation of opensslconf.h

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRevert merge error
Richard Levitte [Mon, 25 Jan 2016 17:20:23 +0000 (18:20 +0100)]
Revert merge error

There are two versions of print_table_entry() in Configure.  Remove
the older.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd some info in CHANGES about what's happening so far with Configure et al
Richard Levitte [Sat, 23 Jan 2016 22:09:12 +0000 (23:09 +0100)]
Add some info in CHANGES about what's happening so far with Configure et al

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoRemove GOST again
Richard Levitte [Sat, 23 Jan 2016 21:58:51 +0000 (22:58 +0100)]
Remove GOST again

The config for the removed GOST engine reappeared by mistake.  Now
removed again.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoRefactor file writing - Remake Makefile.org into a template
Richard Levitte [Wed, 20 May 2015 18:03:20 +0000 (20:03 +0200)]
Refactor file writing - Remake Makefile.org into a template

It is time for Makefile.org to fold into the new regime and have a run
through util/dofile.pl.  This forces some information out of there and
into Configure, which isn't a bad thing, it makes Configure
increasingly the center of build information, which is as it should
be.

A few extra defaults were needed in the BASE template to get rid of
warnings about missing values.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoNow that Configure doesn't produce tools/c_rehash, mk1mf has to do it
Richard Levitte [Sun, 24 Jan 2016 16:07:27 +0000 (17:07 +0100)]
Now that Configure doesn't produce tools/c_rehash, mk1mf has to do it

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFor every test in 80-test_ssl.t, check that the protocol(s) used is enabled
Richard Levitte [Mon, 25 Jan 2016 13:34:22 +0000 (14:34 +0100)]
For every test in 80-test_ssl.t, check that the protocol(s) used is enabled

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMake tests use configdata.pm rather than parsing Makefile
Richard Levitte [Mon, 25 Jan 2016 14:48:35 +0000 (15:48 +0100)]
Make tests use configdata.pm rather than parsing Makefile

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMove & split opensslconf.h.in
Rich Salz [Mon, 25 Jan 2016 14:44:08 +0000 (09:44 -0500)]
Move & split opensslconf.h.in

Move opensslconf.h.in to include/openssl.
Split off DES,BN,RC4 stuff into separate header file
templates in crypto/include/internal/*_conf.h.in

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix OpenSSL::Test::Simple to take more than one algorithm
Richard Levitte [Sun, 24 Jan 2016 15:23:55 +0000 (16:23 +0100)]
Fix OpenSSL::Test::Simple to take more than one algorithm

Some test programs may depend on more than just one TLS version, for
example.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoMove pqueue into ssl
Rich Salz [Fri, 22 Jan 2016 19:54:01 +0000 (14:54 -0500)]
Move pqueue into ssl

This is an internal facility, never documented, not for
public consumption.  Move it into ssl (where it's only used
for DTLS).

I also made the typedef's for pqueue and pitem follow our style: they
name structures, not pointers.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoMake sure apps/Makefile builds apps/CA.pl by default
Richard Levitte [Sun, 24 Jan 2016 23:16:04 +0000 (00:16 +0100)]
Make sure apps/Makefile builds apps/CA.pl by default

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoThe rehash.time target should depend on build_tools as well
Richard Levitte [Sat, 23 Jan 2016 22:19:05 +0000 (23:19 +0100)]
The rehash.time target should depend on build_tools as well

The explanation is that it falls back to using tools/c_rehash if
'apps/openssl rehash' isn't supported on the platform at hand.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix two possible leaks.
FdaSilvaYY [Thu, 21 Jan 2016 22:10:29 +0000 (23:10 +0100)]
Fix two possible leaks.

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

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>