oweals/openssl.git
8 years agoAdd test data for ECDH
Dr. Stephen Henson [Sat, 30 Jan 2016 03:34:39 +0000 (03:34 +0000)]
Add test data for ECDH

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoAdd support for EVP_PKEY_derive in evp_test
Dr. Stephen Henson [Fri, 29 Jan 2016 14:58:36 +0000 (14:58 +0000)]
Add support for EVP_PKEY_derive in evp_test

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agofix warning
Dr. Stephen Henson [Fri, 29 Jan 2016 15:12:16 +0000 (15:12 +0000)]
fix warning

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoAdd function to return internal enoding of X509_NAME.
Dr. Stephen Henson [Sat, 30 Jan 2016 02:51:01 +0000 (02:51 +0000)]
Add function to return internal enoding of X509_NAME.

PR#4280

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoFix opt_imax() call
Richard Levitte [Sat, 30 Jan 2016 14:39:34 +0000 (15:39 +0100)]
Fix opt_imax() call

Not all architectures have a time_t defined the same way.  To make
sure we get the same result, we need to cast &checkoffset to (intmax_t *)
and make sure that intmax_t is defined somehow.

To make really sure we don't pass a variable with the wrong size down
to opt_imax(), we use a temporary intmax_t.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConfigure: Clarify the handling of $thread_cflags
Richard Levitte [Fri, 29 Jan 2016 21:30:00 +0000 (22:30 +0100)]
Configure: Clarify the handling of $thread_cflags

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoMake opt_imax visible in all apps
Viktor Dukhovni [Fri, 29 Jan 2016 22:23:03 +0000 (17:23 -0500)]
Make opt_imax visible in all apps

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMissed rc2_int from before.
Rich Salz [Fri, 29 Jan 2016 22:04:57 +0000 (17:04 -0500)]
Missed rc2_int from before.

Also remove $Makefile variable :)

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoFix invalid policy detection
Viktor Dukhovni [Fri, 29 Jan 2016 21:38:21 +0000 (16:38 -0500)]
Fix invalid policy detection

As a side-effect of opaque x509, ex_flags were looked up too early,
before additional policy cache updates.

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoTemplatize util/domd
Rich Salz [Fri, 29 Jan 2016 18:29:45 +0000 (13:29 -0500)]
Templatize util/domd

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoBetter type for x509 -checkend argument
Viktor Dukhovni [Fri, 29 Jan 2016 20:27:00 +0000 (15:27 -0500)]
Better type for x509 -checkend argument

This is a time_t and can be zero or negative.  So use 'M' (maximal
signed int) not 'p' (positive int).

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoComplete the lflags -> lflags/ex_libs transition
Richard Levitte [Fri, 29 Jan 2016 18:28:05 +0000 (19:28 +0100)]
Complete the lflags -> lflags/ex_libs transition

Some last lflags to convert to ex_libs or a combo of lflags and ex_libs

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConfigure et al: split up the lflags configuration item into two
Richard Levitte [Fri, 29 Jan 2016 17:07:37 +0000 (18:07 +0100)]
Configure et al: split up the lflags configuration item into two

The lflags configuration had a weird syntax with a % as separator.  If
it was present, whatever came before ended up as PEX_LIBS in Makefile
(usually, this is LDFLAGS), while whatever came after ended up as
EX_LIBS.

This change splits that item into lflags and ex_libs, making their use
more explicit.

Also, PEX_LIBS in all the Makefiles are renamed to LDFLAGS.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMake use of add() and add_before() in Configurations/
Richard Levitte [Fri, 29 Jan 2016 16:35:17 +0000 (17:35 +0100)]
Make use of add() and add_before() in Configurations/

A few more sub-joins could be replaced with calls to add() and add_before()

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRevert "Don't replace cflags with thread_cflags, only append the latter"
Richard Levitte [Fri, 29 Jan 2016 17:00:10 +0000 (18:00 +0100)]
Revert "Don't replace cflags with thread_cflags, only append the latter"

This reverts commit a450326ee040c6cbb262debdb1ed731e6700e1e0.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMerge error, wrong domd submitted.
Rich Salz [Fri, 29 Jan 2016 16:36:21 +0000 (11:36 -0500)]
Merge error, wrong domd submitted.

Reviewed-by: Richard Levitte <levitte@openssl.org>
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>