openssl.git
8 years agoFix the build tree include directory for afalg engine
Richard Levitte [Mon, 7 Mar 2016 17:58:25 +0000 (18:58 +0100)]
Fix the build tree include directory for afalg engine

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMake OpenSSL::Test::setup() a bit more forgiving
Richard Levitte [Sat, 5 Mar 2016 18:05:25 +0000 (19:05 +0100)]
Make OpenSSL::Test::setup() a bit more forgiving

It was unexpected that OpenSSL::Test::setup() should be called twice
by the same recipe.  However, that may happen if a recipe combines
OpenSSL::Test and OpenSSL::Test::Simple, which can be a sensible thing
to do.  Therefore, we now allow it.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoElide EVP_read_pw_string() and friends for no-ui
David Woodhouse [Sun, 21 Feb 2016 11:36:52 +0000 (11:36 +0000)]
Elide EVP_read_pw_string() and friends for no-ui

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoGH768: Minor grammar nits in CRYPTO_get_ex_new_index.pod
Benjamin Kaduk [Tue, 15 Dec 2015 22:23:51 +0000 (16:23 -0600)]
GH768: Minor grammar nits in CRYPTO_get_ex_new_index.pod

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoUnified - adapt the generation of padlock assembler to use GENERATE
Richard Levitte [Mon, 7 Mar 2016 14:50:52 +0000 (15:50 +0100)]
Unified - adapt the generation of padlock assembler to use GENERATE

This gets rid of the BEGINRAW..ENDRAW sections in engines/build.info.

This also moves the assembler generating perl scripts to take the
output file name as last command line argument, where necessary.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUnified - adapt the generation of bignum assembler to use GENERATE
Richard Levitte [Mon, 7 Mar 2016 14:41:33 +0000 (15:41 +0100)]
Unified - adapt the generation of bignum assembler to use GENERATE

This gets rid of the BEGINRAW..ENDRAW sections in crypto/bn/build.info.

This also moves the assembler generating perl scripts to take the
output file name as last command line argument, where necessary.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUnified - Add the build.info command OVERRIDE, to avoid build file clashes
Richard Levitte [Mon, 7 Mar 2016 13:50:37 +0000 (14:50 +0100)]
Unified - Add the build.info command OVERRIDE, to avoid build file clashes

Should it be needed because the recipes within a RAW section might
clash with those generated by Configure, it's possible to tell it
not to generate them with the use of OVERRIDES, for example:

    SOURCE[libfoo]=foo.c bar.c

    OVERRIDES=bar.o
    BEGINRAW[Makefile(unix)]
    bar.o: bar.c
        $(CC) $(CFLAGS) -DSPECIAL -c -o $@ $<
    ENDRAW[Makefile(unix)]

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUnified - Adapt the Unix and VMS templates to support GENERATE
Richard Levitte [Mon, 7 Mar 2016 13:38:54 +0000 (14:38 +0100)]
Unified - Adapt the Unix and VMS templates to support GENERATE

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUnified - Add the build.info command GENERATE, to generate source files
Richard Levitte [Mon, 7 Mar 2016 13:37:00 +0000 (14:37 +0100)]
Unified - Add the build.info command GENERATE, to generate source files

In some cases, one might want to generate some source files from
others, that's done as follows:

    GENERATE[foo.s]=asm/something.pl $(CFLAGS)
    GENERATE[bar.s]=asm/bar.S

The value of each GENERATE line is a command line or part of it.
Configure places no rules on the command line, except the the first
item muct be the generator file.  It is, however, entirely up to the
build file template to define exactly how those command lines should
be handled, how the output is captured and so on.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd a function to detect if we have async or not
Matt Caswell [Mon, 7 Mar 2016 16:55:39 +0000 (16:55 +0000)]
Add a function to detect if we have async or not

Add the ASYNC_is_capable() function and use it in speed.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGH804: Fix unused-result warnings in dasync
Alessandro Ghedini [Mon, 7 Mar 2016 12:27:52 +0000 (12:27 +0000)]
GH804: Fix unused-result warnings in dasync

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agodocumentation and duplicate goto statements
Billy Brumley [Mon, 29 Feb 2016 20:35:35 +0000 (22:35 +0200)]
documentation and duplicate goto statements

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agomove ifdef statements
Billy Brumley [Mon, 29 Feb 2016 19:01:47 +0000 (21:01 +0200)]
move ifdef statements

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoNIST SP800-56A co-factor ECDH KATs
Billy Brumley [Mon, 29 Feb 2016 14:23:00 +0000 (16:23 +0200)]
NIST SP800-56A co-factor ECDH KATs

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRemove use of CRYPTO_LOCK_INIT in init code
Matt Caswell [Mon, 7 Mar 2016 14:39:22 +0000 (14:39 +0000)]
Remove use of CRYPTO_LOCK_INIT in init code

Swap the use of CRYPTO_LOCK_INIT in the init code to use the new threading
API mechanism for locking.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoSwap the init code to use the new Thread API thread locals
Matt Caswell [Wed, 2 Mar 2016 15:23:57 +0000 (15:23 +0000)]
Swap the init code to use the new Thread API thread locals

The init code was using its own thread local code. Now we have a central
API for it we should use that instead.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoSwap the init code to use CRYPTO_ONCE
Matt Caswell [Wed, 2 Mar 2016 14:51:00 +0000 (14:51 +0000)]
Swap the init code to use CRYPTO_ONCE

The init code was using its own "once" implementation. Now that we have
the new thread API we should use that instead.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agomake update
Dr. Stephen Henson [Mon, 7 Mar 2016 15:25:56 +0000 (15:25 +0000)]
make update

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUpdate documentation
Dr. Stephen Henson [Fri, 4 Mar 2016 03:51:35 +0000 (03:51 +0000)]
Update documentation

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMake PKCS8_PRIV_KEY_INFO opaque.
Dr. Stephen Henson [Fri, 4 Mar 2016 03:48:39 +0000 (03:48 +0000)]
Make PKCS8_PRIV_KEY_INFO opaque.

Make PKCS8_PRIV_KEY_INFO opaque. Several accessor functions already exist
for this structure. Two new ones were added to handle attributes.

The old handling of broken formats has been removed and the corresponding
structures simplified.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd support to ASYNC_WAIT_CTX to speed
Andrea Grandi [Mon, 29 Feb 2016 11:28:55 +0000 (11:28 +0000)]
Add support to ASYNC_WAIT_CTX to speed

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoRemove unnecessary memset() to 0 and check for NULL before OPENSSL_free()
Andrea Grandi [Sat, 27 Feb 2016 06:14:49 +0000 (06:14 +0000)]
Remove unnecessary memset() to 0 and check for NULL before OPENSSL_free()

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoFix the error with RSA and the daysnc engine in async mode.
Andrea Grandi [Thu, 18 Feb 2016 10:56:53 +0000 (10:56 +0000)]
Fix the error with RSA and the daysnc engine in async mode.

Move RSA struct in the job local struct.
The change is applied also to other crypto operations (e.g. DSA) to
make things consistent.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoAdd support for async jobs in OpenSSL speed
Andrea Grandi [Wed, 9 Dec 2015 07:26:38 +0000 (07:26 +0000)]
Add support for async jobs in OpenSSL speed

Summary of the changes:

* Move the calls to the crypto operations inside wrapper functions.
  This is required because ASYNC_start_job takes a function as an argument.

* Add new function run_benchmark() that manages the jobs for all the operations.
  In the POSIX case it uses a select() to receive the events from the engine
  and resume the jobs that are paused, while in the WIN case it uses PeekNamedPipe()

* Add new option argument async_jobs to enable and specify the number of async jobs

Example:
  openssl speed -engine dasync -elapsed -async_jobs 32 rsa2048

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoRework the default cipherlist.
Emilia Kasper [Thu, 3 Mar 2016 18:50:03 +0000 (19:50 +0100)]
Rework the default cipherlist.

 - Always prefer forward-secure handshakes.
 - Consistently order ECDSA above RSA.
 - Next, always prefer AEADs to non-AEADs, irrespective of strength.
 - Within AEADs, prefer GCM > CHACHA > CCM for a given strength.
 - Prefer TLS v1.2 ciphers to legacy ciphers.
 - Remove rarely used DSS, IDEA, SEED, CAMELLIA, CCM from the default
   list to reduce ClientHello bloat.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMakefile.in: populate [PLIB_]LDFLAG even with $target{} settings.
Andy Polyakov [Sun, 6 Mar 2016 13:36:11 +0000 (14:36 +0100)]
Makefile.in: populate [PLIB_]LDFLAG even with $target{} settings.

RT#4373

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agobn/asm/x86[_64]-mont*.pl: complement alloca with page-walking.
Andy Polyakov [Fri, 4 Mar 2016 10:39:11 +0000 (11:39 +0100)]
bn/asm/x86[_64]-mont*.pl: complement alloca with page-walking.

Some OSes, *cough*-dows, insist on stack being "wired" to
physical memory in strictly sequential manner, i.e. if stack
allocation spans two pages, then reference to farmost one can
be punishable by SEGV. But page walking can do good even on
other OSes, because it guarantees that villain thread hits
the guard page before it can make damage to innocent one...

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRestore some mingw builds
Emilia Kasper [Mon, 7 Mar 2016 11:59:40 +0000 (12:59 +0100)]
Restore some mingw builds

"no-pic" builds have in fact been green (and reasonably fast), so
restore them while we figure out why tests without "no-pic" hang.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoperlasm/x86_64-xlate.pl: handle binary constants early.
Andy Polyakov [Fri, 4 Mar 2016 10:32:26 +0000 (11:32 +0100)]
perlasm/x86_64-xlate.pl: handle binary constants early.

Not all assemblers of "gas" flavour handle binary constants, e.g.
seasoned MacOS Xcode doesn't, so give them a hand.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoFix some clang warnings
Matt Caswell [Mon, 7 Mar 2016 12:36:20 +0000 (12:36 +0000)]
Fix some clang warnings

The af_alg engine and associated test were creating warnings when compiled
with clang. This fixes it.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix minor errors in the afalg test
Matt Caswell [Thu, 3 Mar 2016 14:56:10 +0000 (14:56 +0000)]
Fix minor errors in the afalg test

The new afalg test should have a copyright date of 2016. Also an
incorrect buffer was being sent to EVP_CipherFinal_ex when
decrypting.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdding afalg test
clucey [Thu, 3 Mar 2016 05:56:10 +0000 (05:56 +0000)]
Adding afalg test

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoFix OPENSSL_INIT flags to avoid a clash.
Matt Caswell [Mon, 29 Feb 2016 16:14:00 +0000 (16:14 +0000)]
Fix OPENSSL_INIT flags to avoid a clash.

The 0x00010000L OPENSSL_INIT flag appeared twice.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoMisc afalg build fixes
Matt Caswell [Mon, 29 Feb 2016 13:36:47 +0000 (13:36 +0000)]
Misc afalg build fixes

Misc afalg build fixes as suggested by Richard Levitte for the latest
Configure changes.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRework based on feedback:
clucey [Tue, 23 Feb 2016 08:01:01 +0000 (08:01 +0000)]
Rework based on feedback:
1. Cleaned up eventfd handling
2. Reworked socket setup code to allow other algorithms to be added in
   future
3. Fixed compile errors for static build
4. Added error to error stack in all cases of ALG_PERR/ALG_ERR
5. Called afalg_aes_128_cbc() from bind() to avoid race conditions
6. Used MAX_INFLIGHT define in io_getevents system call
7. Coding style fixes

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoALG: Add AFALG engine
clucey [Wed, 17 Feb 2016 13:38:36 +0000 (13:38 +0000)]
ALG: Add AFALG engine

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoTrim Travis config part 2
Emilia Kasper [Sun, 6 Mar 2016 21:31:18 +0000 (22:31 +0100)]
Trim Travis config part 2

- Remove Win builds (temporarily). They're slow, allowed to fail,
  and therefore not useful as they are.
- Make the --unified part of the matrix build-only. (This can be
  swapped if --unified becomes the default)
- Only build 'no-engine' once, don't run any tests, but don't allow it
  to fail.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoTrim the Travis config
Emilia Kasper [Sun, 6 Mar 2016 20:59:53 +0000 (21:59 +0100)]
Trim the Travis config

- Remove no-asm. We've got to cut something, and this is at least
  partially covered by the sanitizer builds.
- Remove enable-crypto-mdebug from sanitizer
  builds. enable-crypto-mdebug has been shown to catch some static
  initialization bugs that the standard leak sanitizer can't so
  perhaps it has _some_ value; but we shouldn't let the two compete.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoGH616: Remove dead code
Rich Salz [Sat, 5 Mar 2016 06:00:50 +0000 (01:00 -0500)]
GH616: Remove dead code

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoNo -fno-common for Darwin
Richard Levitte [Fri, 4 Mar 2016 12:48:59 +0000 (13:48 +0100)]
No -fno-common for Darwin

When object files with common block symbols are added to static
libraries on Darwin, those symbols are invisible to the linker that
tries to use them.  Our solution was to use -fno-common when compiling
C source.

Unfortunately, there is assembler code that defines OPENSSL_ia32cap_P
as a common block symbol, unconditionally, and in some cases, there is
no other definition.  -fno-common doesn't help in this case.

However, 'ranlib -c' adds common block symbols to the index of the
static library, which makes them visible to the linker using it, and
that solves the problem we've seen.

The common conclusion is, either use -fno-common or ranlib -c on
Darwin.  Since we have common block symbols unconditionally, choosing
the method for our source is easy.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoNew ordinal files, recreated from scratch
Richard Levitte [Thu, 3 Mar 2016 11:42:37 +0000 (12:42 +0100)]
New ordinal files, recreated from scratch

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoChange names of ordinals and libs, libeay => libcrypto and ssleay => libssl
Richard Levitte [Thu, 3 Mar 2016 11:42:01 +0000 (12:42 +0100)]
Change names of ordinals and libs, libeay => libcrypto and ssleay => libssl

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRemove the old ordinals
Richard Levitte [Thu, 3 Mar 2016 11:24:09 +0000 (12:24 +0100)]
Remove the old ordinals

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agouse saner default parameters for scrypt
Dr. Stephen Henson [Fri, 4 Mar 2016 23:28:45 +0000 (23:28 +0000)]
use saner default parameters for scrypt

Thanks to Colin Percival for reporting this issue.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoDisable SSLv3 by default
Kurt Roeckx [Thu, 3 Mar 2016 21:45:57 +0000 (22:45 +0100)]
Disable SSLv3 by default

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Kasper <emilia@openssl.org>
MR: #2203

8 years agoDon't mark the eNULL ciphers as non-default.
Kurt Roeckx [Thu, 3 Mar 2016 21:02:58 +0000 (22:02 +0100)]
Don't mark the eNULL ciphers as non-default.

They're not part of ALL, so they're not part of COMPLEMENTOFDEFAULT

Reviewed-by: Rich Salz <rsalz@openssl.org>
MR: #2202

8 years agoCurve25519: fix const-initialization
Emilia Kasper [Fri, 4 Mar 2016 17:05:35 +0000 (18:05 +0100)]
Curve25519: fix const-initialization

Clang is permissive of this, but gcc fails.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd ASN.1 ADB callback.
Dr. Stephen Henson [Fri, 4 Mar 2016 14:55:24 +0000 (14:55 +0000)]
Add ASN.1 ADB callback.

Add support for application supplied any defined by callback. An
application can change the selector value if it wishes. This is
mainly intended for values which are only known at runtime, for
example dynamically created OIDs.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGH784: Better variable name
Dmitry-Me [Fri, 4 Mar 2016 07:34:47 +0000 (10:34 +0300)]
GH784: Better variable name

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoMake formatting consistent in apps/Makefile.in
Rob Percival [Fri, 4 Mar 2016 15:30:33 +0000 (15:30 +0000)]
Make formatting consistent in apps/Makefile.in

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRemove redundant semi-colons from apps/Makefile.in
Rob Percival [Fri, 4 Mar 2016 13:18:24 +0000 (13:18 +0000)]
Remove redundant semi-colons from apps/Makefile.in

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoDocumentation for new CT s_client flags
Rob Percival [Thu, 3 Mar 2016 14:07:28 +0000 (14:07 +0000)]
Documentation for new CT s_client flags

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoDocumentation for new SSL functions
Rob Percival [Thu, 3 Mar 2016 18:39:30 +0000 (18:39 +0000)]
Documentation for new SSL functions

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoHandle empty log name in "enable_logs" line of the CT log file
Rob Percival [Thu, 3 Mar 2016 16:08:55 +0000 (16:08 +0000)]
Handle empty log name in "enable_logs" line of the CT log file

e.g. "enabled_logs = foo,,bar"

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoHandle missing "enabled_logs" line in CT log file
Rob Percival [Thu, 3 Mar 2016 16:08:01 +0000 (16:08 +0000)]
Handle missing "enabled_logs" line in CT log file

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoIf a CT log entry in CTLOG_FILE is invalid, skip it and continue loading
Rob Percival [Thu, 3 Mar 2016 16:06:59 +0000 (16:06 +0000)]
If a CT log entry in CTLOG_FILE is invalid, skip it and continue loading

Previously, the remaining CT log entries would not be loaded.
Also, CTLOG_STORE_load_file would return 1 even if a log entry was
invalid, resulting in no errors being shown.

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoExtends s_client to allow a basic CT policy to be enabled
Rob Percival [Wed, 2 Mar 2016 13:34:05 +0000 (13:34 +0000)]
Extends s_client to allow a basic CT policy to be enabled

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoChange default CT log list filename to "ct_log_list.cnf"
Rob Percival [Fri, 4 Mar 2016 13:18:54 +0000 (13:18 +0000)]
Change default CT log list filename to "ct_log_list.cnf"

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdds CT validation to SSL connections
Rob Percival [Thu, 3 Mar 2016 16:19:23 +0000 (16:19 +0000)]
Adds CT validation to SSL connections

Disabled by default, but can be enabled by setting the
ct_validation_callback on a SSL or SSL_CTX.

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoChanges to DEFAULT curves
Rich Salz [Sun, 3 Jan 2016 18:24:32 +0000 (13:24 -0500)]
Changes to DEFAULT curves

Change the ECC default curve list to be this, in order: x25519, secp256r1,
secp521r1, secp384r1, brainpoolP256r1, brainpoolP384r1, and brainpool512r1.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoCurve25519: avoid undefined behaviour
Emilia Kasper [Wed, 2 Mar 2016 22:50:58 +0000 (23:50 +0100)]
Curve25519: avoid undefined behaviour

Appease the sanitizer: avoid left shifts of negative values.

This could've been done entirely with casts to uint and back,
but using masks seemed slightly more readable.

There are also implementation-defined signed right shifts in this
code. Those remain.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agochacha/asm/chacha-ppc.pl: fix typo.
Andy Polyakov [Wed, 2 Mar 2016 11:43:09 +0000 (12:43 +0100)]
chacha/asm/chacha-ppc.pl: fix typo.

RT#4365

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoDon't build RC4 ciphersuites into libssl by default
Matt Caswell [Thu, 3 Mar 2016 15:40:51 +0000 (15:40 +0000)]
Don't build RC4 ciphersuites into libssl by default

RC4 based ciphersuites in libssl have been disabled by default. They can
be added back by building OpenSSL with the "enable-weak-ssl-ciphers"
Configure option at compile time.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoImproved HKDF and TLS1-PRF documentation
Viktor Dukhovni [Fri, 4 Mar 2016 04:30:42 +0000 (23:30 -0500)]
Improved HKDF and TLS1-PRF documentation

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoCorrection, $disabled{shared} rather than $config{no_shared}
Richard Levitte [Fri, 4 Mar 2016 04:43:15 +0000 (05:43 +0100)]
Correction, $disabled{shared} rather than $config{no_shared}

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRestore the zlib / zlib-dynamic logic
Richard Levitte [Thu, 3 Mar 2016 09:07:29 +0000 (10:07 +0100)]
Restore the zlib / zlib-dynamic logic

The proper logic is that both zlib and zlib-dynamic are disabled by
default and that enabling zlib-dynamic would enable zlib.  Somewhere
along the way, the logic got changed, zlib-dynamic was enabled by
default and zlib didn't get automatically enabled.

This change restores the original logic.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoSanity check PVK file fields.
Dr. Stephen Henson [Thu, 3 Mar 2016 23:37:36 +0000 (23:37 +0000)]
Sanity check PVK file fields.

PVK files with abnormally large length or salt fields can cause an
integer overflow which can result in an OOB read and heap corruption.
However this is an rarely used format and private key files do not
normally come from untrusted sources the security implications not
significant.

Fix by limiting PVK length field to 100K and salt to 10K: these should be
more than enough to cover any files encountered in practice.

Issue reported by Guido Vranken.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGH773: Possible leak on CRYPTO_THREAD_lock_new failure
FdaSilvaYY [Tue, 1 Mar 2016 20:59:48 +0000 (21:59 +0100)]
GH773: Possible leak on CRYPTO_THREAD_lock_new failure

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoGH781: openssl.spec: use secure urls
Viktor Szakats [Thu, 3 Mar 2016 09:56:30 +0000 (10:56 +0100)]
GH781: openssl.spec: use secure urls

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoGH769: Reuse strndup()
Dmitry-Me [Tue, 1 Mar 2016 08:48:15 +0000 (11:48 +0300)]
GH769: Reuse strndup()

Reviewed-by: Matt Caswell <matt@openssl.org>
Signed-off-by: Rich Salz <rsalz@akamai.com>
8 years agoGH355: Implement HKDF
Alessandro Ghedini [Wed, 2 Mar 2016 23:58:27 +0000 (23:58 +0000)]
GH355: Implement HKDF

This patch implements the HMAC-based Extract-and-Expand Key Derivation
Function (HKDF) as defined in RFC 5869.

It is required to implement the QUIC and TLS 1.3 protocols (among others).

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoRemove overzealous echoing
Richard Levitte [Thu, 3 Mar 2016 16:45:14 +0000 (17:45 +0100)]
Remove overzealous echoing

This construct in a Makefile is a bit overzealous:

@echo FOO
@FOO

Cleaned up.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd KDF support to pkeyutl. Update documentation.
Dr. Stephen Henson [Tue, 1 Mar 2016 16:29:47 +0000 (16:29 +0000)]
Add KDF support to pkeyutl. Update documentation.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoClean up curve25519 build
Emilia Kasper [Thu, 3 Mar 2016 15:36:06 +0000 (16:36 +0100)]
Clean up curve25519 build

- Remove OPENSSL_X25519_X86_64 which never worked, because we don't have
  the assembly.
- Also remove OPENSSL_SMALL (which should have been
  OPENSSL_SMALL_FOOTPRINT) which isn't a priority at the moment.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoupdate NEWS
Dr. Stephen Henson [Thu, 3 Mar 2016 13:35:02 +0000 (13:35 +0000)]
update NEWS

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agofix no-ec build
Dr. Stephen Henson [Thu, 3 Mar 2016 13:27:34 +0000 (13:27 +0000)]
fix no-ec build

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRefactor ClientHello extension parsing
Emilia Kasper [Tue, 22 Sep 2015 13:20:26 +0000 (15:20 +0200)]
Refactor ClientHello extension parsing

1) Simplify code with better PACKET methods.

2) Make broken SNI parsing explicit. SNI was intended to be extensible
to new name types but RFC 4366 defined the syntax inextensibly, and
OpenSSL has never parsed SNI in a way that would allow adding a new name
type. RFC 6066 fixed the definition but due to broken implementations
being widespread, it appears impossible to ever extend SNI.

3) Annotate resumption behaviour. OpenSSL doesn't currently handle all
extensions correctly upon resumption. Annotate for further clean-up.

4) Send an alert on ALPN protocol mismatch.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agomake update
Dr. Stephen Henson [Wed, 2 Mar 2016 21:32:40 +0000 (21:32 +0000)]
make update

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoadd kdf.h to mkdef.pl
Dr. Stephen Henson [Wed, 2 Mar 2016 21:32:30 +0000 (21:32 +0000)]
add kdf.h to mkdef.pl

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd KDF error codes
Dr. Stephen Henson [Wed, 2 Mar 2016 04:11:02 +0000 (04:11 +0000)]
Add KDF error codes

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agomake update
Dr. Stephen Henson [Tue, 1 Mar 2016 22:15:02 +0000 (22:15 +0000)]
make update

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGeneralise KDF test in evp_test.c
Dr. Stephen Henson [Tue, 1 Mar 2016 18:04:42 +0000 (18:04 +0000)]
Generalise KDF test in evp_test.c

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConvert PRF tests to use Ctrl
Dr. Stephen Henson [Tue, 1 Mar 2016 16:22:25 +0000 (16:22 +0000)]
Convert PRF tests to use Ctrl

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd Ctrl keyword to KDF test in evp_test
Dr. Stephen Henson [Tue, 1 Mar 2016 15:08:18 +0000 (15:08 +0000)]
Add Ctrl keyword to KDF test in evp_test

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd string ctrl operations to TLS1 PRF, update documentation.
Dr. Stephen Henson [Tue, 1 Mar 2016 14:58:33 +0000 (14:58 +0000)]
Add string ctrl operations to TLS1 PRF, update documentation.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUse utility functions for HMAC and CMAC.
Dr. Stephen Henson [Tue, 1 Mar 2016 14:56:02 +0000 (14:56 +0000)]
Use utility functions for HMAC and CMAC.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoEVP_PKEY_CTX utility functions.
Dr. Stephen Henson [Tue, 1 Mar 2016 14:47:15 +0000 (14:47 +0000)]
EVP_PKEY_CTX utility functions.

Utility functions to pass a string or hex string to EVP_PKEY_CTX_ctrl().

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agomake errors
Dr. Stephen Henson [Tue, 1 Mar 2016 19:16:21 +0000 (19:16 +0000)]
make errors

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoHandle KDF internally.
Dr. Stephen Henson [Mon, 29 Feb 2016 14:12:11 +0000 (14:12 +0000)]
Handle KDF internally.

Handle KDF in ECDH_compute_key instead of requiring each implementation
support it. This modifies the compute_key method: now it allocates and
populates a buffer containing the shared secret.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoDocument the changes in config settings
Richard Levitte [Sat, 27 Feb 2016 16:14:44 +0000 (17:14 +0100)]
Document the changes in config settings

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoDon't copy from %target to %config so much, see %config as a complement
Richard Levitte [Wed, 2 Mar 2016 09:57:05 +0000 (10:57 +0100)]
Don't copy from %target to %config so much, see %config as a complement

We copied $target{cflags}, $target{defines} and a few more to %config,
just to add to the entries.  Avoid doing so, and let the build templates
deal with combining the two.

There are a few cases where we still fiddle with %target, but that's
acceptable.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoConfigure - Get rid of the special thread_cflag, replace with thread_scheme
Richard Levitte [Sat, 27 Feb 2016 15:51:34 +0000 (16:51 +0100)]
Configure - Get rid of the special thread_cflag, replace with thread_scheme

The thread_cflag setting filled a double role, as kinda sorta an
indicator of thread scheme, and as cflags.  Some configs also added
lflags and ex_libs for multithreading regardless of if threading would
be enabled or not.

Instead of this, add threading cflags among in the cflag setting,
threading lflags in the lflag setting and so on if and only if threads
are enabled (which they are by default).

Also, for configs where there are no special cflags for threading (the
VMS configs are of that kind), this makes it possible to still clearly
mention what thread scheme is used.

The exact value of thread scheme is currently ignored except when it's
"(unknown)", and thereby only serves as a flag to tell if we know how
to build for multi-threading in a particular config.  Yet, the
currently used values are "(unknown)", "pthreads", "uithreads" (a.k.a
solaris threads) and "winthreads".

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoConfigure - get rid of the special debug_ and release_ settings
Richard Levitte [Wed, 2 Mar 2016 18:13:26 +0000 (19:13 +0100)]
Configure - get rid of the special debug_ and release_ settings

Instead, make the build type ("debug" or "release") available through
$config{build_type} and let the configs themselves figure out what the
usual settings (such as "cflags", "lflags" and so on) should be
accordingly.

The benefit with this is that we can now have debug and release
variants of any setting, not just those Configure supports, and may
also involve other factors (the MSVC flags /MD[d] and /MT[d] involve
both build type and whether threading is enabled or not)

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoMinimize copied config settings
Richard Levitte [Sat, 27 Feb 2016 10:42:13 +0000 (11:42 +0100)]
Minimize copied config settings

$target{lflags} and $target{plib_flag} were copied to %config for no
good reason.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoConfigure - move the addition of the zlib / libz lib to configs
Richard Levitte [Sat, 27 Feb 2016 10:37:33 +0000 (11:37 +0100)]
Configure - move the addition of the zlib / libz lib to configs

Configure had the Unix centric addition of -lz when linking with zlib
is enabled, which doesn't work on other platforms.  Therefore, we move
it to the BASE_unix config template and add corresponding ones in the
other BASE_* config templates.  The Windows one is probably incomplete,
but that doesn't matter for the moment, as mk1mf does it's own thing
anyway.

This required making the %withargs table global, so perl snippets in
the configs can use it.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoConfigure - Rename BASE to DEFAULTS and add a few inheritable BASEs
Richard Levitte [Sat, 27 Feb 2016 10:25:33 +0000 (11:25 +0100)]
Configure - Rename BASE to DEFAULTS and add a few inheritable BASEs

These BASE templates are intended to hold values that are common for
all configuration variants for whole families of configurations.

So far, three "families" are identified: Unix, Windows and VMS, mostly
characterised by the build system they currently use.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoConfigure - Allow CODErefs and ARRAYrefs in configuration setting arrays
Richard Levitte [Sat, 27 Feb 2016 10:08:21 +0000 (11:08 +0100)]
Configure - Allow CODErefs and ARRAYrefs in configuration setting arrays

This provides for more powerful lazy evaluation and buildup of the
setting contents.  For example, something like this becomes possible:

    defines => [ sub { $config{thisorthat} ? "FOO" : () } ]

Any undefined result of such functions (such as 'undef' or the empty
list) will be ignored.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoEnsure Async is deinited properly
Matt Caswell [Wed, 2 Mar 2016 16:52:43 +0000 (16:52 +0000)]
Ensure Async is deinited properly

The global thread local keys were not being deinited properly in async.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConvert ASYNC code to use new Thread API
Matt Caswell [Wed, 2 Mar 2016 16:15:52 +0000 (16:15 +0000)]
Convert ASYNC code to use new Thread API

The async code uses thread local variables. We should convert to using
the new Thread API for doing this.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoProvide getters for default_passwd_cb and userdata
Christian Heimes [Wed, 2 Mar 2016 11:53:40 +0000 (12:53 +0100)]
Provide getters for default_passwd_cb and userdata

This patch provides getters for default_passwd_cb and userdata for SSL
and SSL_CTX. The getter functions are required to port Python's ssl module
to OpenSSL 1.1.0.

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