openssl.git
8 years ago[Configure] Make --with-zlib-* work with configdata.pm
Michael Lee [Wed, 3 Feb 2016 16:31:40 +0000 (11:31 -0500)]
[Configure] Make --with-zlib-* work with configdata.pm

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRT3234: disable compression
Emilia Kasper [Tue, 2 Feb 2016 15:26:38 +0000 (16:26 +0100)]
RT3234: disable compression

CRIME protection: disable compression by default, even if OpenSSL is
compiled with zlib enabled. Applications can still enable compression by
calling SSL_CTX_clear_options(ctx, SSL_OP_NO_COMPRESSION), or by using
the SSL_CONF library to configure compression. SSL_CONF continues to
work as before:

SSL_CONF_cmd(ctx, "Options", "Compression") enables compression.

SSL_CONF_cmd(ctx, "Options", "-Compression") disables compression (now
no-op by default).

The command-line switch has changed from -no_comp to -comp.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix pkeyutl/rsautl empty encrypt-input/decrypt-output handling
Viktor Dukhovni [Tue, 2 Feb 2016 05:37:41 +0000 (00:37 -0500)]
Fix pkeyutl/rsautl empty encrypt-input/decrypt-output handling

Also fix option processing in pkeyutl to allow use of (formerly)
"out-of-order" switches that were needless implementation limitations.

Handle documented "ENGINE" form with -keyform and -peerform.

Better handling of OPENSSL_NO_ENGINE and OPENSSL_NO_RSA.

RT2018

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agofix code indentation issue
FdaSilvaYY [Sun, 31 Jan 2016 18:49:39 +0000 (19:49 +0100)]
fix code indentation issue

... related to engine_ref_debug macro.

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoRT2353: Add ipsec IKE OID
Rich Salz [Tue, 2 Feb 2016 19:14:33 +0000 (14:14 -0500)]
RT2353: Add ipsec IKE OID

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoUse a simpler method to build a glob than splitpath and catpath
Richard Levitte [Tue, 2 Feb 2016 18:47:05 +0000 (19:47 +0100)]
Use a simpler method to build a glob than splitpath and catpath

It turns out that the combination splitpath() could return an empty
string for the directory part.  This doesn't play well with catdir().

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agomake update
Dr. Stephen Henson [Tue, 2 Feb 2016 16:59:58 +0000 (16:59 +0000)]
make update

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoNew BN functions.
Dr. Stephen Henson [Mon, 1 Feb 2016 00:02:05 +0000 (00:02 +0000)]
New BN functions.

Add new function BN_bn2binpad() which checks the length of the output
buffer and pads the result with zeroes if necessary.

New functions BN_bn2lebinpad() and BN_lebin2bn() which use little endian
format.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGH608: Ensure 64-bit shift no matter sizeof(long)
Dmitry-Me [Tue, 2 Feb 2016 06:55:06 +0000 (09:55 +0300)]
GH608: Ensure 64-bit shift no matter sizeof(long)

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoRT3854 Update docs.
Emilia Kasper [Tue, 2 Feb 2016 10:36:44 +0000 (11:36 +0100)]
RT3854 Update docs.

Remove ancient unused configuration file in crypto/conf.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoStyle; add "!= NULL"
Rich Salz [Mon, 1 Feb 2016 13:44:33 +0000 (08:44 -0500)]
Style; add "!= NULL"

Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoGH554: Improve pkeyutl doc
Hubert Kario [Mon, 1 Feb 2016 16:14:34 +0000 (11:14 -0500)]
GH554: Improve pkeyutl doc

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoconstify PACKET
Emilia Kasper [Mon, 1 Feb 2016 14:26:18 +0000 (15:26 +0100)]
constify PACKET

PACKET contents should be read-only. To achieve this, also
- constify two user callbacks
- constify BUF_reverse.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoupdate DSA docs
Dr. Stephen Henson [Thu, 28 Jan 2016 23:57:46 +0000 (23:57 +0000)]
update DSA docs

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoadd option to exclude public key from EC keys
Dr. Stephen Henson [Wed, 27 Jan 2016 23:45:15 +0000 (23:45 +0000)]
add option to exclude public key from EC keys

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix memory leak and print out keygen errors.
Dr. Stephen Henson [Mon, 25 Jan 2016 16:59:19 +0000 (16:59 +0000)]
Fix memory leak and print out keygen errors.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoBetter check for gcc/clang
Rich Salz [Sat, 30 Jan 2016 00:50:28 +0000 (19:50 -0500)]
Better check for gcc/clang

Iteratively improved with Richard and Andy.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoComment "secure memcmp" implementation
Dmitry-Me [Mon, 1 Feb 2016 08:48:28 +0000 (11:48 +0300)]
Comment "secure memcmp" implementation

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoUse PKCS#8 format EC key so test is skipped with no-ec
Dr. Stephen Henson [Mon, 1 Feb 2016 03:59:48 +0000 (03:59 +0000)]
Use PKCS#8 format EC key so test is skipped with no-ec

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agounified build scheme: add a personal configuration to test it
Richard Levitte [Fri, 29 Jan 2016 22:36:12 +0000 (23:36 +0100)]
unified build scheme: add a personal configuration to test it

Nothing else will run the unified scheme for now.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agounified build scheme: add build.info files
Richard Levitte [Fri, 29 Jan 2016 22:33:10 +0000 (23:33 +0100)]
unified build scheme: add build.info files

Now that we have the foundation for the "unified" build scheme in
place, we add build.info files.  They have been generated from the
Makefiles in the same directories.  Things that are platform specific
will appear in later commits.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agounified build scheme: a first introduction
Richard Levitte [Fri, 29 Jan 2016 18:45:51 +0000 (19:45 +0100)]
unified build scheme: a first introduction

The "unified" build scheme revolves around small information files,
build.info, which each describe their own bit of everything that needs
to be built, using a mini-language described in Configurations/README.

The information in build.info file contain references to source files
and final result.  Object files are not mentioned at all, they are
simply from source files.  Because of this, all the *_obj items in
Configurations/*.conf are renamed to *_asm_src and the files listed
in the values are change from object files to their corresponding
source files.  For the sake of the other build schemes, Configure
generates corresponding *_obj entries in %target.

Furthermore, the "unified" build scheme supports having a build
directory tree separate from the source directry tree.

All paths in a build.info file is assumed to be relative to its
location, either within the source tree or within the build tree.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoAdd tests for non-ca trusted roots and intermediates
Viktor Dukhovni [Fri, 29 Jan 2016 17:22:21 +0000 (12:22 -0500)]
Add tests for non-ca trusted roots and intermediates

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoCompat self-signed trust with reject-only aux data
Viktor Dukhovni [Fri, 29 Jan 2016 07:28:43 +0000 (02:28 -0500)]
Compat self-signed trust with reject-only aux data

When auxiliary data contains only reject entries, continue to trust
self-signed objects just as when no auxiliary data is present.

This makes it possible to reject specific uses without changing
what's accepted (and thus overring the underlying EKU).

Added new supported certs and doubled test count from 38 to 76.

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoCheck chain extensions also for trusted certificates
Viktor Dukhovni [Thu, 28 Jan 2016 08:01:45 +0000 (03:01 -0500)]
Check chain extensions also for trusted certificates

This includes basic constraints, key usages, issuer EKUs and auxiliary
trust OIDs (given a trust suitably related to the intended purpose).

Added tests and updated documentation.

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoZero newly allocated points
Dr. Stephen Henson [Sun, 31 Jan 2016 18:13:43 +0000 (18:13 +0000)]
Zero newly allocated points

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRemove redundant code.
Dr. Stephen Henson [Sun, 31 Jan 2016 16:35:37 +0000 (16:35 +0000)]
Remove redundant code.

d2i_ECPrivateKey always caculates the public key so there is
no need to caculate it again in eckey_priv_decode().

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd EC_GROUP_order_bits, EC_GROUP_get0_order and EC_GROUP_get0_cofactor
Dr. Stephen Henson [Sun, 31 Jan 2016 16:34:07 +0000 (16:34 +0000)]
Add EC_GROUP_order_bits, EC_GROUP_get0_order and EC_GROUP_get0_cofactor

New functions to return internal pointer for order and cofactor. This
avoids the need to allocate a new BIGNUM which to copy the value to.
Simplify code to use new functions.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoEngage poly1305-sparcv9 module.
Andy Polyakov [Fri, 29 Jan 2016 11:40:56 +0000 (12:40 +0100)]
Engage poly1305-sparcv9 module.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd poly1305/asm/poly1305-sparcv9.pl.
Andy Polyakov [Fri, 29 Jan 2016 11:40:25 +0000 (12:40 +0100)]
Add poly1305/asm/poly1305-sparcv9.pl.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoConfigure: restore original logic for -DWHIRLPOOL_ASM.
Andy Polyakov [Fri, 29 Jan 2016 13:23:24 +0000 (14:23 +0100)]
Configure: restore original logic for -DWHIRLPOOL_ASM.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRT4129: BUF_new_mem_buf should take const void *
Daniel Kahn Gillmor [Sun, 31 Jan 2016 01:38:08 +0000 (20:38 -0500)]
RT4129: BUF_new_mem_buf should take const void *

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoRemove the extra checks for Intel's C compiler
Richard Levitte [Sun, 31 Jan 2016 17:33:42 +0000 (18:33 +0100)]
Remove the extra checks for Intel's C compiler

When the target is {something}-icc, we're doing some extra checks of
the icc compiler.  However, all such targets were cleaned away in
March 2015, so this Configure section is dead code.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRT3755: Remove duplicate #include
Rich Salz [Sun, 31 Jan 2016 01:57:24 +0000 (20:57 -0500)]
RT3755: Remove duplicate #include

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoDon't go into dotted directories when copying Makefile.in to Makefile
Richard Levitte [Sun, 31 Jan 2016 10:51:07 +0000 (11:51 +0100)]
Don't go into dotted directories when copying Makefile.in to Makefile

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGH102: Extra volatile avoids GCC bug
Rich Salz [Sun, 31 Jan 2016 00:48:09 +0000 (19:48 -0500)]
GH102: Extra volatile avoids GCC bug

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoRemove extra level of indirection.
Rich Salz [Sat, 30 Jan 2016 21:43:37 +0000 (16:43 -0500)]
Remove extra level of indirection.

Remove OPENSSL_IMPORT as its only purpose is to define OPENSSL_EXTERN.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoMove more BN internals to bn_lcl.h
Rich Salz [Thu, 28 Jan 2016 15:13:21 +0000 (10:13 -0500)]
Move more BN internals to bn_lcl.h

There was an unused macro in ssl_locl.h that used an internal
type, so I removed it.
Move bio_st from bio.h to ossl_type.h

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoGH102: Add volatile to CRYPTO_memcmp
Rich Salz [Fri, 29 Jan 2016 17:09:05 +0000 (12:09 -0500)]
GH102: Add volatile to CRYPTO_memcmp

Can't hurt and seems to prevent problems from some over-aggressive
(LTO?) compilers.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoWhen checking if there's a VMS directory spec, don't forget the possible device
Richard Levitte [Sat, 30 Jan 2016 16:11:48 +0000 (17:11 +0100)]
When checking if there's a VMS directory spec, don't forget the possible device

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix test/recipes/25-test_verify.t
Richard Levitte [Sat, 30 Jan 2016 15:42:18 +0000 (16:42 +0100)]
Fix test/recipes/25-test_verify.t

top_dir() are used to create directory names, top_file() should be
used for files.  In a Unixly environment, that doesn't matter, but...

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agohandle "Ctrl" in separate function
Dr. Stephen Henson [Sat, 30 Jan 2016 13:17:09 +0000 (13:17 +0000)]
handle "Ctrl" in separate function

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
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>