oweals/openssl.git
7 years agoAdd UI functionality to duplicate the user data
Richard Levitte [Sun, 28 May 2017 07:35:11 +0000 (09:35 +0200)]
Add UI functionality to duplicate the user data

This can be used by engines that need to retain the data for a longer time
than just the call where this user data is passed.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3575)

7 years agoFix coding style in apps/passwd file
Paul Yang [Wed, 31 May 2017 14:46:30 +0000 (22:46 +0800)]
Fix coding style in apps/passwd file

Reformat some indents and braces based on OpenSSL coding style spec.

Signed-off-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3586)

7 years agoCLA: trivial
HorimotoYasuhiro [Mon, 29 May 2017 11:08:26 +0000 (20:08 +0900)]
CLA: trivial

Fix coding style

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3581)

7 years agoWait longer for the server in TLSProxy to start
Matt Caswell [Wed, 31 May 2017 09:27:32 +0000 (10:27 +0100)]
Wait longer for the server in TLSProxy to start

In a recent PR (#3566) it seems that TLSProxy gave up trying to connect to
the server process too quickly. This meant the test failed even though the
server *did* eventually start. Currently we try 3 times to connect with a
0.1 second pause between each attempt. That is probably too aggressive.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3587)

7 years agoClear sensitive data in ED25519_sign
Dr. Stephen Henson [Thu, 25 May 2017 13:53:32 +0000 (14:53 +0100)]
Clear sensitive data in ED25519_sign

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agoAdd Ed25519 documentation
Dr. Stephen Henson [Sun, 30 Apr 2017 12:42:35 +0000 (13:42 +0100)]
Add Ed25519 documentation

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agono-ec fix
Dr. Stephen Henson [Wed, 26 Apr 2017 17:46:31 +0000 (18:46 +0100)]
no-ec fix

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agoAdd Ed25519 verify test.
Dr. Stephen Henson [Fri, 21 Apr 2017 12:36:15 +0000 (13:36 +0100)]
Add Ed25519 verify test.

Add Ed25519 certificate verify test using certificate from
draft-ietf-curdle-pkix-04 and custom generated root certificate.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agoAdd custom sig_info_set for ED25519
Dr. Stephen Henson [Tue, 25 Apr 2017 19:34:58 +0000 (20:34 +0100)]
Add custom sig_info_set for ED25519

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agomake errors
Dr. Stephen Henson [Sat, 20 May 2017 02:06:26 +0000 (03:06 +0100)]
make errors

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agoAdd custom ASN.1 sign and verify
Dr. Stephen Henson [Fri, 7 Apr 2017 00:17:40 +0000 (01:17 +0100)]
Add custom ASN.1 sign and verify

Since ED25519 doesn't have an associated digest it needs custom sign/verify
routines to handle ASN.1 signatures.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agoAdd ED25519 as signature OID
Dr. Stephen Henson [Fri, 7 Apr 2017 02:34:09 +0000 (03:34 +0100)]
Add ED25519 as signature OID

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agoAdd RFC8032 tests and additional cases
Dr. Stephen Henson [Sat, 20 May 2017 02:05:13 +0000 (03:05 +0100)]
Add RFC8032 tests and additional cases

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agomake errors
Dr. Stephen Henson [Sat, 20 May 2017 02:08:20 +0000 (03:08 +0100)]
make errors

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agoED25519 public key method.
Dr. Stephen Henson [Wed, 5 Apr 2017 20:47:57 +0000 (21:47 +0100)]
ED25519 public key method.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agoadd method
Dr. Stephen Henson [Wed, 5 Apr 2017 15:48:32 +0000 (16:48 +0100)]
add method

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agoAdd ED25519 ASN.1 method
Dr. Stephen Henson [Wed, 5 Apr 2017 18:05:21 +0000 (19:05 +0100)]
Add ED25519 ASN.1 method

Make X25519 key method more flexible by removing hard coding of NID_X25519
OID. Since the parameters and key syntax between ED25519 and X25519 are
almost identical they can share a lot of common code.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agoAdd EdDSA algorithm OIDs from draft-ietf-curdle-pkix-04
Dr. Stephen Henson [Wed, 5 Apr 2017 13:13:48 +0000 (14:13 +0100)]
Add EdDSA algorithm OIDs from draft-ietf-curdle-pkix-04

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agoMake Ed25519 consistent with X25519
Dr. Stephen Henson [Wed, 5 Apr 2017 15:09:57 +0000 (16:09 +0100)]
Make Ed25519 consistent with X25519

Rename and change ED25519_keypair_from_seed to ED25519_public_from_private
to be consistent with X25519 API.

Modidy ED25519_sign to take separate public key argument instead of
requiring it to follow the private key.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agoAdd Ed25519 algorithm.
Dr. Stephen Henson [Tue, 4 Apr 2017 21:56:41 +0000 (22:56 +0100)]
Add Ed25519 algorithm.

Reinstate Ed25519 algorithm to curv25519.c this is largely just a copy of
the code from BoringSSL with some adjustments so it compiles under OpenSSL.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agomake errors
Dr. Stephen Henson [Fri, 19 May 2017 23:00:13 +0000 (00:00 +0100)]
make errors

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agoAllow NULL md for custom signing methods
Dr. Stephen Henson [Sat, 20 May 2017 02:18:32 +0000 (03:18 +0100)]
Allow NULL md for custom signing methods

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agoAdd support for custom digestsign/digestverify methods.
Dr. Stephen Henson [Fri, 19 May 2017 20:31:46 +0000 (21:31 +0100)]
Add support for custom digestsign/digestverify methods.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

7 years agosha/keccak1600.c: implement lane complementing transform
Andy Polyakov [Tue, 30 May 2017 13:57:37 +0000 (15:57 +0200)]
sha/keccak1600.c: implement lane complementing transform

...as discussed in section 2.2 of "Keccak implementation overview".

[skip ci]

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agosha/keccak1600.c: implement bit interleaving optimization.
Andy Polyakov [Mon, 29 May 2017 15:12:54 +0000 (17:12 +0200)]
sha/keccak1600.c: implement bit interleaving optimization.

This targets 32-bit processors and is discussed in section 2.1 of
"Keccak implementation overview".

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd stricter checking in NAME section
Rich Salz [Thu, 25 May 2017 18:16:26 +0000 (14:16 -0400)]
Add stricter checking in NAME section

Require a comma between every name and a single space before the dash

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3559)

7 years agofixing incorrect OID of signingCertificateV2
Marek Klein [Wed, 24 May 2017 12:49:44 +0000 (14:49 +0200)]
fixing incorrect OID of signingCertificateV2
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3538)

7 years agoFix certificate version number in test
Thijs Wenker [Mon, 29 May 2017 00:55:43 +0000 (02:55 +0200)]
Fix certificate version number in test

The version number 3 means version 4, while 2 means version 3. Since this is the v3nametest, version 3 should be used.

CLA: Trivial

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3577)

7 years agoRevert "Add internal functions to fetch a refcount"
Richard Levitte [Sun, 28 May 2017 13:01:36 +0000 (15:01 +0200)]
Revert "Add internal functions to fetch a refcount"

It turned out to be a bad idea.

This reverts commits 6891a79da67ccd621b67e49b60ddc188d7864291
and c27bc74698ed043b7549d5637ec0a8cf65b39e59.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3576)

7 years agoCorrect small typo in CRYPTO_GET_REF
Richard Levitte [Sun, 28 May 2017 05:35:58 +0000 (07:35 +0200)]
Correct small typo in CRYPTO_GET_REF

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3574)

7 years agoAdd internal functions to fetch a refcount
Richard Levitte [Sat, 27 May 2017 20:04:59 +0000 (22:04 +0200)]
Add internal functions to fetch a refcount

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3573)

7 years agoFix spelling errors in CMS.
Josh Soref [Fri, 19 May 2017 00:16:30 +0000 (00:16 +0000)]
Fix spelling errors in CMS.

Unfortunately it affects error code macros in public cms.h header, for
which reason misspelled names are preserved for backward compatibility.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3463)

7 years agoFix a Proxy race condition
Matt Caswell [Fri, 26 May 2017 12:06:08 +0000 (13:06 +0100)]
Fix a Proxy race condition

Issue #3562 describes a problem where a race condition can occur in the
Proxy such that a test "ok" line can appear in the middle of other text
causing the test harness to miss it. The issue is that we do not wait for
the client process to finish after the test is complete, so that process may
continue to write data to stdout/stderr at the same time that the test
harness does.

This commit fixes TLSProxy so that we always wait for the client process to
finish before continuing.

Fixes #3562

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3567)

7 years agoUpdate the pyca-cryptography version
Matt Caswell [Fri, 26 May 2017 13:02:38 +0000 (14:02 +0100)]
Update the pyca-cryptography version

Commit 9bfeeef made some function parameters const. This actually broke
the pyca-cryptography tests. The discussion in #3360 considers this to
actually be a problem with pyca-cryptography not an OpenSSL issue (they
replicate some of our header file contents which then causes function
prototype mismatches). This commit updates the pyca-cryptography version
to pull in their fix for this issue and make our external tests pass again.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3569)

7 years agoFix inconsistent check of UNSAFE_LEGACY_RENEGOTIATION
Todd Short [Mon, 22 May 2017 15:24:59 +0000 (11:24 -0400)]
Fix inconsistent check of UNSAFE_LEGACY_RENEGOTIATION

The check for SSL3_FLAGS_ALLOW_UNSAFE_LEGACY_RENEGOTIATION is
inconsistent. Most places check SSL->options, one place is checking
SSL_CTX->options; fix that.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
GH: #3523

7 years agoFix use of "can_load()" in run_tests.pl.
Rainer Jung [Thu, 25 May 2017 21:58:14 +0000 (23:58 +0200)]
Fix use of "can_load()" in run_tests.pl.

CLA: Trivial

Fixes #3563.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3564)

7 years agotest/evp_test.c: improve output in case of errors.
Andy Polyakov [Thu, 25 May 2017 11:48:32 +0000 (13:48 +0200)]
test/evp_test.c: improve output in case of errors.

Recently introduced TEST_* macros print variables' symbolic names.
In order to make error output more readable rename some variables.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agomodes/ocb128.c: address undefined behaviour warning.
Andy Polyakov [Thu, 25 May 2017 16:08:09 +0000 (18:08 +0200)]
modes/ocb128.c: address undefined behaviour warning.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3526)

7 years agoaria/aria.c: address undefined behaviour warning in small-footprint path.
Andy Polyakov [Tue, 23 May 2017 12:33:20 +0000 (14:33 +0200)]
aria/aria.c: address undefined behaviour warning in small-footprint path.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3526)

7 years agoAdd missing commas in pod files
Kurt Roeckx [Thu, 25 May 2017 17:24:11 +0000 (19:24 +0200)]
Add missing commas in pod files

Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #3557

7 years agoFix BoringSSL alert related test failures
Matt Caswell [Thu, 25 May 2017 10:26:18 +0000 (11:26 +0100)]
Fix BoringSSL alert related test failures

Commit bd990e2535 changed our handling of alerts. Some of the BoringSSl
tests were expecting specific errors to be created if bad alerts were sent.
Those errors have now changed as a result of that commit, so the BoringSSL
test config needs to be updated to match.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3549)

7 years agoDocument that HMAC() with a NULL md is not thread safe
Matt Caswell [Thu, 25 May 2017 14:18:22 +0000 (15:18 +0100)]
Document that HMAC() with a NULL md is not thread safe

Fixes #3541

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3553)

7 years agoUpdates CHANGES and NEWS for new release
Matt Caswell [Thu, 25 May 2017 10:00:29 +0000 (11:00 +0100)]
Updates CHANGES and NEWS for new release

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3546)

7 years agoDocument that PKCS#12 functions assume UTF-8 for passwords
David Woodhouse [Wed, 24 May 2017 11:18:14 +0000 (12:18 +0100)]
Document that PKCS#12 functions assume UTF-8 for passwords

Part of issue #3531

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3535)

7 years agoClarify what character encoding is used in the returned UI strings
Richard Levitte [Tue, 23 May 2017 17:52:54 +0000 (19:52 +0200)]
Clarify what character encoding is used in the returned UI strings

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3532)

7 years agoFix va_arg all in test_error_c90
Rich Salz [Tue, 23 May 2017 13:24:12 +0000 (09:24 -0400)]
Fix va_arg all in test_error_c90

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3506)

7 years agoRevise evp_test parser; make like bn_test
Rich Salz [Fri, 12 May 2017 18:19:51 +0000 (14:19 -0400)]
Revise evp_test parser; make like bn_test

Re-order and comment on the functions

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3506)

7 years agoAdd titles to groups of EVP tests
Rich Salz [Tue, 23 May 2017 14:01:37 +0000 (10:01 -0400)]
Add titles to groups of EVP tests

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3529)

7 years agoFix line numbering for errors.
Rich Salz [Tue, 23 May 2017 12:59:49 +0000 (08:59 -0400)]
Fix line numbering for errors.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3528)

7 years agoDon't use one shot API for SSLv3.
Dr. Stephen Henson [Tue, 23 May 2017 11:56:51 +0000 (12:56 +0100)]
Don't use one shot API for SSLv3.

SSLv3 (specifically with client auth) cannot use one shot APIs: the digested
data and the master secret are handled in separate update operations. So
in the special case of SSLv3 use the streaming API.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3527)

7 years agoFix typo in doc/man3/EVP_EncrypInit.pod
Paul Yang [Mon, 22 May 2017 15:18:45 +0000 (23:18 +0800)]
Fix typo in doc/man3/EVP_EncrypInit.pod

In the example section.

CLA: trivial

Signed-off-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3520)

7 years agoRevert "Integration build a small memory image"
Rich Salz [Mon, 22 May 2017 17:09:58 +0000 (13:09 -0400)]
Revert "Integration build a small memory image"

This reverts commit e2580e70d5c644c5dadd33ffa8bb23223959b87a.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Updates https://github.com/openssl/openssl/pull/3268)

7 years agoAdd an error to the stack on failure in dtls1_write_bytes()
Matt Caswell [Mon, 22 May 2017 11:36:11 +0000 (12:36 +0100)]
Add an error to the stack on failure in dtls1_write_bytes()

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3496)

7 years agoConvert existing usage of assert() to ossl_assert() in libssl
Matt Caswell [Mon, 22 May 2017 11:33:42 +0000 (12:33 +0100)]
Convert existing usage of assert() to ossl_assert() in libssl

Provides consistent output and approach.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3496)

7 years agoFix some style issues in returns
Matt Caswell [Mon, 22 May 2017 11:33:29 +0000 (12:33 +0100)]
Fix some style issues in returns

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3496)

7 years agoReplace instances of OPENSSL_assert() with soft asserts in libssl
Matt Caswell [Fri, 19 May 2017 08:35:19 +0000 (09:35 +0100)]
Replace instances of OPENSSL_assert() with soft asserts in libssl

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3496)

7 years agoAdd a macro for testing assertion in both debug and production builds
Matt Caswell [Fri, 19 May 2017 08:30:37 +0000 (09:30 +0100)]
Add a macro for testing assertion in both debug and production builds

If we have an assert then in a debug build we want an abort() to occur.
In a production build we want the function to return an error.

This introduces a new macro to assist with that. The idea is to replace
existing use of OPENSSL_assert() with this new macro. The problem with
OPENSSL_assert() is that it aborts() on an assertion failure in both debug
and production builds. It should never be a library's decision to abort a
process (we don't get to decide when to kill the life support machine or
the nuclear reactor control system). Additionally if an attacker can
cause a reachable assert to be hit then this can be a source of DoS attacks
e.g. see CVE-2017-3733, CVE-2015-0293, CVE-2011-4577 and CVE-2002-1568.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3496)

7 years agoReformat the string output to be more in line with the decisions made in #3465
Pauli [Sun, 21 May 2017 22:22:19 +0000 (08:22 +1000)]
Reformat the string output to be more in line with the decisions made in #3465

Don't highlight excess when comparing unequal length strings.

Clean up the NULL / empty string display.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3514)

7 years agoBring the memory output inline with the suggestions in #3465.
Pauli [Sun, 21 May 2017 22:39:44 +0000 (08:39 +1000)]
Bring the memory output inline with the suggestions in #3465.

Excess bytes, when one block is longer than the other, are not explicitly
highlighted.

The NULL / zero length block output has been cleaned up.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3515)

7 years agoFixed merge nonsense
Alex Gaynor [Thu, 20 Apr 2017 22:47:53 +0000 (18:47 -0400)]
Fixed merge nonsense

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3149)

7 years agoNewlines!
Alex Gaynor [Mon, 10 Apr 2017 21:11:01 +0000 (17:11 -0400)]
Newlines!

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3149)

7 years agoUpdate the test to assert that the SCT is from an X.509 extension
Alex Gaynor [Sat, 8 Apr 2017 13:33:17 +0000 (09:33 -0400)]
Update the test to assert that the SCT is from an X.509 extension

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3149)

7 years agoStyle fixes and use the source parameter so the OCSP path works
Alex Gaynor [Sat, 8 Apr 2017 13:21:19 +0000 (09:21 -0400)]
Style fixes and use the source parameter so the OCSP path works

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3149)

7 years agoThis is an int
Alex Gaynor [Sat, 8 Apr 2017 00:58:50 +0000 (20:58 -0400)]
This is an int

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3149)

7 years agoDon't use a for-loop decleration
Alex Gaynor [Sat, 8 Apr 2017 00:56:12 +0000 (20:56 -0400)]
Don't use a for-loop decleration

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3149)

7 years agoFixed #3020 -- set entry type on SCTs from X.509 and OCSP extensions
Alex Gaynor [Sat, 8 Apr 2017 00:49:27 +0000 (20:49 -0400)]
Fixed #3020 -- set entry type on SCTs from X.509 and OCSP extensions

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3149)

7 years agoIntegration build a small memory image
Pauli [Mon, 22 May 2017 11:56:42 +0000 (07:56 -0400)]
Integration build a small memory image

Modify one of the integration builds so that that the
OPENSSL_SMALL_MEMORY option is compiled. There doesn't appear to be an
automatic build with this option set.

I think the options in the modified build are covered elsewhere (without
the small memory) but a new job might still be preferable.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3268)

7 years agoFix the mem_sec "small arena"
Todd Short [Sun, 21 May 2017 14:21:06 +0000 (10:21 -0400)]
Fix the mem_sec "small arena"

Fix the small arena test to just check for the symptom of the infinite
loop (i.e. initialized set on failure), rather than the actual infinite
loop. This avoids some valgrind errors.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3512)

7 years agotest/secmemtest.c: clarify limitations for huge secure memory arena test.
Andy Polyakov [Sun, 21 May 2017 09:16:34 +0000 (11:16 +0200)]
test/secmemtest.c: clarify limitations for huge secure memory arena test.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoFix srp app missing NULL termination with password callback
Diego Santa Cruz [Tue, 16 May 2017 14:05:19 +0000 (16:05 +0200)]
Fix srp app missing NULL termination with password callback

The password_callback() function does not necessarily NULL terminate
the password buffer, the caller must use the returned length but the
srp app uses this function as if it was doing NULL termination.

This made the -passin and -passout options of "openssl srp"
fail inexpicably and randomly or even crash.

Fixed by enlarging the buffer by one, so that the maximum password length
remains unchanged, and adding NULL termination upon return.

[Rearrange code for coding style compliance in process.]

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3475)

7 years ago-inkey can be an identifier, not just a file
Rich Salz [Sun, 21 May 2017 01:44:31 +0000 (21:44 -0400)]
-inkey can be an identifier, not just a file

update pkcs12, smime, ts apps.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3507)

7 years agotest/run_tests.pl: don't mask test failures.
Andy Polyakov [Sat, 20 May 2017 10:35:58 +0000 (12:35 +0200)]
test/run_tests.pl: don't mask test failures.

Switch to TAP::Harness inadvertently masked test failures.
Test::Harness::runtests was terminating with non-zero exit code in case
of failure[s], while TAP::Harness apparently holds caller responsible
for doing so.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agotest/test_test.c: fix wrong BN test [and rearrange tests a little bit].
Andy Polyakov [Fri, 19 May 2017 17:37:35 +0000 (19:37 +0200)]
test/test_test.c: fix wrong BN test [and rearrange tests a little bit].

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3502)

7 years agoTweak sec_mem tests
Todd Short [Fri, 12 May 2017 20:46:39 +0000 (16:46 -0400)]
Tweak sec_mem tests

Remove assertion when mmap() fails.
Only run the 1<<31 limit test on Linux

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3455)

7 years agomove comments to same line as fields
Dr. Stephen Henson [Fri, 19 May 2017 20:43:05 +0000 (21:43 +0100)]
move comments to same line as fields

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3500)

7 years agoAdd test data for EVP_DigestSign/EVP_DigestVerify tests.
Dr. Stephen Henson [Sat, 13 May 2017 16:38:08 +0000 (17:38 +0100)]
Add test data for EVP_DigestSign/EVP_DigestVerify tests.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3500)

7 years agoAdd test support for "oneshot" versions EVP_DigestSign, EVP_DigestVerify.
Dr. Stephen Henson [Mon, 15 May 2017 20:27:43 +0000 (21:27 +0100)]
Add test support for "oneshot" versions EVP_DigestSign, EVP_DigestVerify.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3500)

7 years agoAdd tests in evp_test for EVP_Digest{Sign,Verify}{Init,Update,Final}
Dr. Stephen Henson [Fri, 12 May 2017 23:44:02 +0000 (00:44 +0100)]
Add tests in evp_test for EVP_Digest{Sign,Verify}{Init,Update,Final}

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3500)

7 years agoMove engines/afalg to engines
Rich Salz [Sat, 20 May 2017 01:27:58 +0000 (21:27 -0400)]
Move engines/afalg to engines

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3491)

7 years agoremove duplicate tests
Dr. Stephen Henson [Thu, 11 May 2017 23:31:18 +0000 (00:31 +0100)]
remove duplicate tests

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3451)

7 years agoAdd tests
Dr. Stephen Henson [Fri, 12 May 2017 00:11:00 +0000 (01:11 +0100)]
Add tests

Import test data from sha1test.c, sha256t.c and sha512t.c which is
from RFC6234 section 8.5

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3451)

7 years agoAdd support for multiple update calls in evp_test
Dr. Stephen Henson [Thu, 11 May 2017 18:28:09 +0000 (19:28 +0100)]
Add support for multiple update calls in evp_test

Allow multiple "Input" lines to call the update function multiple times.
Add "Ncopy" keyword to copy the input buffer. So for example:

Input = "a"
Ncopy = 1024

Will create a buffer consisting of 1024 "a" characters.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3451)

7 years agoFix return code in tls1_mac
Matt Caswell [Fri, 19 May 2017 09:28:43 +0000 (10:28 +0100)]
Fix return code in tls1_mac

The return code from tls1_mac is supposed to be a boolean 0 for fail, 1 for
success. In one place we returned -1 on error. This would cause code calling
the mac function to erroneously see this as a success (because a non-zero
value is being treated as success in all call sites).

Fortunately, AFAICT, the place that returns -1 can only happen on an
internal error so is not under attacker control. Additionally this code only
appears in master. In 1.1.0 the return codes are treated differently.
Therefore there are no security implications.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3495)

7 years agoReformat the output of BIGNUMS where test cases fail.
Pauli [Sun, 14 May 2017 22:49:36 +0000 (08:49 +1000)]
Reformat the output of BIGNUMS where test cases fail.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3465)

7 years agoFix endless loop on srp app when listing users
Diego Santa Cruz [Wed, 17 May 2017 08:17:59 +0000 (10:17 +0200)]
Fix endless loop on srp app when listing users

With the -list option the srp app loops on the main while() endlessly,
whether users were given on the command line or not. The loop should
be stopped when in list mode and there are no more users.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3489)

7 years agoFix ASN1_TIME_to_generalizedtime to take a const ASN1_TIME
Matt Caswell [Tue, 2 May 2017 10:08:33 +0000 (11:08 +0100)]
Fix ASN1_TIME_to_generalizedtime to take a const ASN1_TIME

Fixes #1526

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3360)

7 years agoMake SSL_is_server() accept a const SSL
Matt Caswell [Tue, 2 May 2017 10:00:50 +0000 (11:00 +0100)]
Make SSL_is_server() accept a const SSL

Fixes #1526

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3360)

7 years agoTry to be more consistent about the alerts we send
Matt Caswell [Tue, 16 May 2017 16:28:23 +0000 (17:28 +0100)]
Try to be more consistent about the alerts we send

We are quite inconsistent about which alerts get sent. Specifically, these
alerts should be used (normally) in the following circumstances:

SSL_AD_DECODE_ERROR = The peer sent a syntactically incorrect message
SSL_AD_ILLEGAL_PARAMETER = The peer sent a message which was syntactically
correct, but a parameter given is invalid for the context
SSL_AD_HANDSHAKE_FAILURE = The peer's messages were syntactically and
semantically correct, but the parameters provided were unacceptable to us
(e.g. because we do not support the requested parameters)
SSL_AD_INTERNAL_ERROR = We messed up (e.g. malloc failure)

The standards themselves aren't always consistent but I think the above
represents the best interpretation.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3480)

7 years agoFix EXT_RETURN usage for add_key_share()
Matt Caswell [Thu, 18 May 2017 09:05:02 +0000 (10:05 +0100)]
Fix EXT_RETURN usage for add_key_share()

add_key_share() is a helper function used during key_share extension
construction. It is expected to be a simple boolean success/fail return.
It shouldn't be using the new EXT_RETURN type but it was partially converted
anyway. This changes it back.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3488)

7 years agoFix typo in INSTALL file
Paul Yang [Mon, 15 May 2017 13:01:53 +0000 (21:01 +0800)]
Fix typo in INSTALL file

recocognised -> recognised

CLA: trivial

Signed-off-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3470)

7 years agoFix compile error/warning in packettest.c
Todd Short [Tue, 9 May 2017 14:19:10 +0000 (10:19 -0400)]
Fix compile error/warning in packettest.c

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3416)

7 years agoAdd a test for a missing sig algs extension
Matt Caswell [Tue, 16 May 2017 11:05:57 +0000 (12:05 +0100)]
Add a test for a missing sig algs extension

Check that a missing sig algs extension succeeds if we are resuming.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3478)

7 years agoAllow a missing sig algs extension if resuming
Matt Caswell [Tue, 16 May 2017 11:04:00 +0000 (12:04 +0100)]
Allow a missing sig algs extension if resuming

The current TLSv1.3 spec says:

'If a server is authenticating via a certificate and the client has not
sent a "signature_algorithms" extension, then the server MUST abort the
handshake with a "missing_extension" alert (see Section 8.2).'

If we are resuming then we are not "authenticating via a certificate" but
we were still aborting with the missing_extension alert if sig algs was
missing.

This commit ensures that we only send the alert if we are not resuming.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3478)

7 years agoAdd a new unsolicited extension error code and add enum tag
Matt Caswell [Wed, 17 May 2017 09:31:46 +0000 (10:31 +0100)]
Add a new unsolicited extension error code and add enum tag

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3418)

7 years agoAdd tests for unsolicited extensions
Matt Caswell [Tue, 9 May 2017 15:42:01 +0000 (16:42 +0100)]
Add tests for unsolicited extensions

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3418)

7 years agoFail if we receive a response to an extension that we didn't request
Matt Caswell [Tue, 9 May 2017 12:44:25 +0000 (13:44 +0100)]
Fail if we receive a response to an extension that we didn't request

We already did this on an ad-hoc per extension basis (for some extensions).
This centralises it and makes sure we do it for all extensions.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3418)

7 years agoRemove notification settings from appveyor.yml
Richard Levitte [Wed, 17 May 2017 06:28:55 +0000 (08:28 +0200)]
Remove notification settings from appveyor.yml

Notifications can be (and should be) configured on account basis on
the CI web site.  This avoids getting emails to openssl-commits for
personal accounts that also build OpenSSL stuff.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3484)

7 years agoDon't allow fragmented alerts
Matt Caswell [Mon, 15 May 2017 10:24:24 +0000 (11:24 +0100)]
Don't allow fragmented alerts

An alert message is 2 bytes long. In theory it is permissible in SSLv3 -
TLSv1.2 to fragment such alerts across multiple records (some of which
could be empty). In practice it make no sense to send an empty alert
record, or to fragment one. TLSv1.3 prohibts this altogether and other
libraries (BoringSSL, NSS) do not support this at all. Supporting it adds
significant complexity to the record layer, and its removal is unlikely
to cause inter-operability issues.

The DTLS code for this never worked anyway and it is not supported at a
protocol level for DTLS. Similarly fragmented DTLS handshake records only
work at a protocol level where at least the handshake message header
exists within the record. DTLS code existed for trying to handle fragmented
handshake records smaller than this size. This code didn't work either so
has also been removed.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3476)

7 years agoUse BIO not FILE for test file
Rich Salz [Mon, 15 May 2017 18:49:37 +0000 (14:49 -0400)]
Use BIO not FILE for test file

Allow multiple file arguments.
Split bntests.txt into separate files.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3471)

7 years agoDocument the history of BIO_gets() on BIO_fd().
Tomas Mraz [Fri, 12 May 2017 08:26:13 +0000 (10:26 +0200)]
Document the history of BIO_gets() on BIO_fd().

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3442)