oweals/openssl.git
8 years agoMake fallback addresses static so that we can initialize it
Kurt Roeckx [Thu, 4 Feb 2016 00:59:20 +0000 (01:59 +0100)]
Make fallback addresses static so that we can initialize it

Reviewed-by: Richard Levitte <levitte@openssl.org>
MR: #1841

8 years agoOnly use TLS1.2 when it's available
Richard Levitte [Wed, 3 Feb 2016 23:25:49 +0000 (00:25 +0100)]
Only use TLS1.2 when it's available

Reviewed-by: Ben Laurie <ben@openssl.org>
8 years agoHave 70-test_clienthello.t be selective on when it can be run
Richard Levitte [Wed, 3 Feb 2016 23:24:16 +0000 (00:24 +0100)]
Have 70-test_clienthello.t be selective on when it can be run

The test program clienthello checks TLS extensions, so there's no
point running it when no TLS protocol is available.

Reviewed-by: Ben Laurie <ben@openssl.org>
8 years agoHave OpenSSL::Test::Utils::available_protocols load configdata as well
Richard Levitte [Wed, 3 Feb 2016 23:22:59 +0000 (00:22 +0100)]
Have OpenSSL::Test::Utils::available_protocols load configdata as well

Otherwise, it could typically always return an empty list, since it's
often called first if at all.

Reviewed-by: Ben Laurie <ben@openssl.org>
8 years agoRT2752: Add some EKU OID's
Rich Salz [Thu, 4 Feb 2016 01:26:03 +0000 (20:26 -0500)]
RT2752: Add some EKU OID's

And some others found in the Internet.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoHandle localhost being either 127.0.0.1 or ::1
Viktor Dukhovni [Wed, 3 Feb 2016 23:32:25 +0000 (18:32 -0500)]
Handle localhost being either 127.0.0.1 or ::1

When connecting to "localhost" the Proxy's choice of client address
family may not match the server's choice address family.  Without
MultiHomed => 1, the proxy may try the wrong address family first,
and give up without trying the other.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUse matching quotes
Richard Levitte [Thu, 4 Feb 2016 00:44:51 +0000 (01:44 +0100)]
Use matching quotes

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMake the mk1mf 'mv' command variable
Richard Levitte [Wed, 3 Feb 2016 23:40:41 +0000 (00:40 +0100)]
Make the mk1mf 'mv' command variable

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoTweak opensslconf.h.in for style
Rich Salz [Mon, 1 Feb 2016 01:31:00 +0000 (20:31 -0500)]
Tweak opensslconf.h.in for style

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUse BIO_snprintf() rather than snprintf()
Richard Levitte [Wed, 3 Feb 2016 21:41:14 +0000 (22:41 +0100)]
Use BIO_snprintf() rather than snprintf()

Some platforms do not have the latter.

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoRefactoring BIO: small test correction
Richard Levitte [Wed, 3 Feb 2016 20:43:43 +0000 (21:43 +0100)]
Refactoring BIO: small test correction

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoGH614: Use memcpy()/strdup() when possible
Dmitry-Me [Wed, 3 Feb 2016 14:34:14 +0000 (17:34 +0300)]
GH614: Use memcpy()/strdup() when possible

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoRefactoring BIO: Add a few lines in CHANGES & NEWS
Richard Levitte [Wed, 3 Feb 2016 00:04:44 +0000 (01:04 +0100)]
Refactoring BIO: Add a few lines in CHANGES & NEWS

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoRefactoring BIO: add a simple networking test of s_client and s_server
Richard Levitte [Tue, 2 Feb 2016 23:57:30 +0000 (00:57 +0100)]
Refactoring BIO: add a simple networking test of s_client and s_server

This makes use of TLSProxy, which was expanded to use IO::Socket::IP
(which is a core perl module) or IO::Socket::INET6 (which is said to
be more popular) instead IO::Socket::INET if one of them is installed.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoRefactoring BIO: Adapt s_client and s_server
Richard Levitte [Tue, 2 Feb 2016 23:47:42 +0000 (00:47 +0100)]
Refactoring BIO: Adapt s_client and s_server

s_socket.c gets brutally cleaned out and now consists of only two
functions, one for client and the other for server.  They both handle
AF_INET, AF_INET6 and additionally AF_UNIX where supported.  The rest
is just easy adaptation.

Both s_client and s_server get the new flags -4 and -6 to force the
use of IPv4 or IPv6 only.

Also, the default host "localhost" in s_client is removed.  It's not
certain that this host is set up for both IPv4 and IPv6.  For example,
Debian has "ip6-localhost" as the default hostname for [::1].  The
better way is to default |host| to NULL and rely on BIO_lookup() to
return a BIO_ADDRINFO with the appropriate loopback address for IPv4
or IPv6 as indicated by the |family| parameter.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoRefactoring BIO: Adapt BIO_s_datagram and all that depends on it
Richard Levitte [Tue, 2 Feb 2016 23:27:44 +0000 (00:27 +0100)]
Refactoring BIO: Adapt BIO_s_datagram and all that depends on it

The control commands that previously took a struct sockaddr * have
been changed to take a BIO_ADDR * instead.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoRefactoring BIO: add a test, using test/ssltest
Richard Levitte [Tue, 2 Feb 2016 22:50:52 +0000 (23:50 +0100)]
Refactoring BIO: add a test, using test/ssltest

This adds a couple of simple tests to see that SSL traffic using the
reimplemented BIO_s_accept() and BIO_s_connect() works as expected,
both on IPv4 and on IPv6.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agomake update
Richard Levitte [Tue, 2 Feb 2016 22:50:41 +0000 (23:50 +0100)]
make update

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoRefactoring BIO: adapt BIO_s_connect and BIO_s_accept
Richard Levitte [Tue, 2 Feb 2016 22:40:34 +0000 (23:40 +0100)]
Refactoring BIO: adapt BIO_s_connect and BIO_s_accept

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agomake update
Richard Levitte [Tue, 2 Feb 2016 21:43:01 +0000 (22:43 +0100)]
make update

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoRefactoring BIO: reimplement old socket handling functions with new ones
Richard Levitte [Tue, 2 Feb 2016 21:33:57 +0000 (22:33 +0100)]
Refactoring BIO: reimplement old socket handling functions with new ones

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agomake update
Richard Levitte [Tue, 2 Feb 2016 20:44:01 +0000 (21:44 +0100)]
make update

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoTemporary pragma to have GCC quiet down about deprecated functions
Richard Levitte [Tue, 2 Feb 2016 20:42:45 +0000 (21:42 +0100)]
Temporary pragma to have GCC quiet down about deprecated functions

Future commits will change our use to newer functions and the pragmas
will go away at that time.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoRefactoring BIO: new socket-handling functions, deprecate older ones
Richard Levitte [Tue, 2 Feb 2016 20:04:54 +0000 (21:04 +0100)]
Refactoring BIO: new socket-handling functions, deprecate older ones

Added functions:

BIO_socket
BIO_connect
BIO_listen
BIO_accept_ex
BIO_closesocket
BIO_sock_info

These get deprecated:

BIO_gethostbyname
BIO_get_port
BIO_get_host_ip
BIO_get_accept_socket
BIO_accept

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoRefactoring BIO: add error macros & text, and make update
Richard Levitte [Tue, 2 Feb 2016 15:25:42 +0000 (16:25 +0100)]
Refactoring BIO: add error macros & text, and make update

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoRefactoring BIO: Small adjustments
Richard Levitte [Tue, 2 Feb 2016 15:23:26 +0000 (16:23 +0100)]
Refactoring BIO: Small adjustments

Because of the way bio_lcl.h is organised, we must not include
internal/cryptlib.h before it.  As a matter of fact, bio_lcl.h
includes internal/cryptlib.h on its own.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoRefactoring BIO: add wrappers around sockaddr et al
Richard Levitte [Tue, 2 Feb 2016 14:54:57 +0000 (15:54 +0100)]
Refactoring BIO: add wrappers around sockaddr et al

Because different platforms have different levels of support for IPv6,
different kinds of sockaddr variants, and some have getaddrinfo et al
while others don't, we could end up with a mess if ifdefs, duplicate
code and other maintainance nightmares.

Instead, we're introducing wrappers around the common form for socket
communication:
BIO_ADDR, closely related to struct sockaddr and some of its variants.
BIO_ADDRINFO, closely related to struct addrinfo.

With that comes support routines, both convenient creators and
accessors, plus a few utility functions:

BIO_parse_hostserv, takes a string of the form host:service and
splits it into host and service.  It checks for * in both parts, and
converts any [ipv6-address] syntax to ust the IPv6 address.

BIO_lookup, looks up information on a host.

All routines handle IPv4 (AF_INET) and IPv6 (AF_INET6) addresses, and
there is support for local sockets (AF_UNIX) as well.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoRT4148
Emilia Kasper [Tue, 2 Feb 2016 17:03:33 +0000 (18:03 +0100)]
RT4148

Accept leading 0-byte in PKCS1 type 1 padding. Internally, the byte is
stripped by BN_bn2bin but external callers may have other expectations.

Reviewed-by: Kurt Roeckx<kurt@openssl.org>
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>