openssl.git
8 years agoFixed a bug preventing pkeyutl from accessing keys directly on the token via engine_p...
Mouse [Sat, 2 Jan 2016 04:27:49 +0000 (23:27 -0500)]
Fixed a bug preventing pkeyutl from accessing keys directly on the token via engine_pkcs11

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoWrong definition of the macro SSL_set1_sigalgs in ssl.h
arijitnayak [Thu, 31 Dec 2015 07:38:54 +0000 (13:08 +0530)]
Wrong definition of the macro SSL_set1_sigalgs in ssl.h

Error in the definition of the macro SSL_set1_sigalgs(ctx, slist,
slistlen): the third parameter 'slistlen' not used in the substitution
code; used 'clistlen' instead. As a result of this, compilation error
occurs when any application uses this macro.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoChange minimum DH size from 768 to 1024
Kurt Roeckx [Sun, 10 Jan 2016 12:55:08 +0000 (13:55 +0100)]
Change minimum DH size from 768 to 1024

Reviewed-by: Viktor Dukhovni <openssl-users@dukhovni.org>
8 years agoFile is about s_time, not s_client
Kurt Roeckx [Sat, 2 Jan 2016 19:42:27 +0000 (20:42 +0100)]
File is about s_time, not s_client

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
(cherry picked from commit 1918e01c9f915e2eba31a5e2f86f0a5daa4fafb6)

8 years agoFix X509_STORE_CTX_cleanup()
Viktor Dukhovni [Fri, 1 Jan 2016 05:51:12 +0000 (00:51 -0500)]
Fix X509_STORE_CTX_cleanup()

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoRT4202: Update rt URL's.
Rich Salz [Mon, 28 Dec 2015 19:58:23 +0000 (14:58 -0500)]
RT4202: Update rt URL's.

Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 41977c53cd04f52b2b5e56d31ace782577620ac3)

8 years agoAdd some documentation for the OCSP callback functions
Matt Caswell [Mon, 30 Nov 2015 16:04:51 +0000 (16:04 +0000)]
Add some documentation for the OCSP callback functions

Describe the usage of the OCSP callback functions on both the client and
the server side.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoEnsure we don't call the OCSP callback if resuming a session
Matt Caswell [Mon, 30 Nov 2015 13:29:41 +0000 (13:29 +0000)]
Ensure we don't call the OCSP callback if resuming a session

It makes no sense to call the OCSP status callback if we are resuming a
session because no certificates will be sent.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoFix error when server does not send CertificateStatus message
Matt Caswell [Thu, 5 Nov 2015 14:52:27 +0000 (14:52 +0000)]
Fix error when server does not send CertificateStatus message

If a server sends the status_request extension then it may choose
to send the CertificateStatus message. However this is optional.
We were treating it as mandatory and the connection was failing.

Thanks to BoringSSL for reporting this issue.

RT#4120

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoThe functions take a SSL *, not a SSL_CTX *
Daniel Kahn Gillmor [Wed, 23 Dec 2015 20:03:32 +0000 (21:03 +0100)]
The functions take a SSL *, not a SSL_CTX *

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@openssl.org>
RT: #4192, MR: #1533
(cherry picked from commit d938e8dfee16e6bb5427eac7bda32337634ce130)

8 years agoFix memory leak in DSA redo case.
David Benjamin [Thu, 17 Dec 2015 19:11:11 +0000 (20:11 +0100)]
Fix memory leak in DSA redo case.

Found by clang scan-build.

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Richard Levitte <levitte@openssl.org>
RT: #4184, MR: #1496
(cherry picked from commit 679d87515d23ca31491effdc264edc81c695a72a)

8 years agoDon't check RSA_FLAG_SIGN_VER.
Dr. Stephen Henson [Sun, 20 Dec 2015 18:18:43 +0000 (18:18 +0000)]
Don't check RSA_FLAG_SIGN_VER.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoBIO_s_datagram() ctrl doesn't support SEEK/TELL, so don't pretend it does
Richard Levitte [Mon, 2 Nov 2015 15:43:28 +0000 (16:43 +0100)]
BIO_s_datagram() ctrl doesn't support SEEK/TELL, so don't pretend it does

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoCorrect or add comments indicating what controls belong to what
Richard Levitte [Sun, 1 Nov 2015 14:56:21 +0000 (15:56 +0100)]
Correct or add comments indicating what controls belong to what

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoDocument how BIO_get_conn_ip and BIO_get_conn_int_port actually work
Richard Levitte [Sun, 1 Nov 2015 14:45:49 +0000 (15:45 +0100)]
Document how BIO_get_conn_ip and BIO_get_conn_int_port actually work

No dummy arguments.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoHave BIO_get_conn_int_port use BIO_ctrl instead BIO_int_ctrl
Richard Levitte [Sun, 1 Nov 2015 14:42:04 +0000 (15:42 +0100)]
Have BIO_get_conn_int_port use BIO_ctrl instead BIO_int_ctrl

BIO_int_ctrl isn't made for the purpose BIO_get_conn_int_port used it
for.

This also changes BIO_C_GET_CONNECT to actually return the port
instead of assigning it to a pointer that was never returned back to
the caller.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix more URLs mangled by reformat
Matt Caswell [Sat, 19 Dec 2015 14:42:06 +0000 (14:42 +0000)]
Fix more URLs mangled by reformat

Fix some more URLs mangled by indent in the reformat. These ones don't exist
in master so we have a separate commit. Based on a patch supplied by Arnaud
Lacombe <al@aerilon.ca>

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix URLs mangled by reformat
Matt Caswell [Sat, 19 Dec 2015 14:38:17 +0000 (14:38 +0000)]
Fix URLs mangled by reformat

Some URLs in the source code ended up getting mangled by indent. This fixes
it. Based on a patch supplied by Arnaud Lacombe <al@aerilon.ca>

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRemove the "eay" c-file-style indicators
Richard Levitte [Fri, 18 Dec 2015 12:12:58 +0000 (13:12 +0100)]
Remove the "eay" c-file-style indicators

Since we don't use the eay style any more, there's no point tryint to
tell emacs to use it.

Reviewed-by: Ben Laurie <ben@openssl.org>
8 years agoProvide better "make depend" warning.
Rich Salz [Thu, 10 Dec 2015 17:31:01 +0000 (12:31 -0500)]
Provide better "make depend" warning.

Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 2e31ef0366d368ac8cf7f5ecc9052bff27337799)

8 years agoFix a ** 0 mod 1 = 0 for real this time.
Emilia Kasper [Mon, 14 Dec 2015 15:38:15 +0000 (16:38 +0100)]
Fix a ** 0 mod 1 = 0 for real this time.

Commit 2b0180c37fa6ffc48ee40caa831ca398b828e680 attempted to do this but
only hit one of many BN_mod_exp codepaths. Fix remaining variants and add
a test for each method.

Thanks to Hanno Boeck for reporting this issue.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
(cherry picked from commit d911097d7c93e4cfeab624b34d73fe51da158b69)

8 years agoFix tarball production to keep test/bctest and util/pod2mantest
Richard Levitte [Mon, 14 Dec 2015 02:53:06 +0000 (03:53 +0100)]
Fix tarball production to keep test/bctest and util/pod2mantest

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agox86_64 assembly pack: tune clang version detection even further.
Andy Polyakov [Mon, 7 Dec 2015 21:59:11 +0000 (22:59 +0100)]
x86_64 assembly pack: tune clang version detection even further.

RT#4171

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
(cherry picked from commit b9749432346f69b29d82070041e71b237d718ce7)

8 years agoec/ecp_nistz256_table.c: fix potential misalignment problem with Sun C.
Andy Polyakov [Wed, 9 Dec 2015 19:49:12 +0000 (20:49 +0100)]
ec/ecp_nistz256_table.c: fix potential misalignment problem with Sun C.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoEnsure |rwstate| is set correctly on BIO_flush
Matt Caswell [Wed, 4 Nov 2015 11:20:50 +0000 (11:20 +0000)]
Ensure |rwstate| is set correctly on BIO_flush

A BIO_flush call in the DTLS code was not correctly setting the |rwstate|
variable to SSL_WRITING. This means that SSL_get_error() will not return
SSL_ERROR_WANT_WRITE in the event of an IO retry.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 67f60be8c9ae5ff3129fcd6238baf124385a41d8)

8 years agoFix DTLS handshake fragment retries
Matt Caswell [Tue, 3 Nov 2015 14:45:07 +0000 (14:45 +0000)]
Fix DTLS handshake fragment retries

If using DTLS and NBIO then if a second or subsequent handshake message
fragment hits a retry, then the retry attempt uses the wrong fragment
offset value. This commit restores the fragment offset from the last
attempt.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 2ad226e88bee97847496e542d63c67997d5beda6)

8 years agoAdd a return value check
Matt Caswell [Wed, 11 Nov 2015 10:44:07 +0000 (10:44 +0000)]
Add a return value check

If the call to OBJ_find_sigid_by_algs fails to find the relevant NID then
we should set the NID to NID_undef.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 330dcb09b2df7e1e6d1d3d14a5df7269aebd9a68)

8 years agoDon't use applink for static builds.
Dr Stephen Henson [Tue, 8 Dec 2015 19:10:48 +0000 (19:10 +0000)]
Don't use applink for static builds.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRefer to website for acknowledgements.
Rich Salz [Tue, 8 Dec 2015 21:07:09 +0000 (16:07 -0500)]
Refer to website for acknowledgements.

Reviewed-by: Steve Marquess <marquess@openssl.com>
(cherry picked from commit ab29c82a55f3583a490733dd521ea6c486e8e2fb)

8 years agoNot all 'find's know -xtype, use -type instead
Richard Levitte [Tue, 8 Dec 2015 14:34:52 +0000 (15:34 +0100)]
Not all 'find's know -xtype, use -type instead

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 3cd7aef34d0d414d27ab00abadb99265a2cffde9)

8 years agoAdapt the OS X build to use the OS X tar
Richard Levitte [Tue, 8 Dec 2015 11:43:05 +0000 (12:43 +0100)]
Adapt the OS X build to use the OS X tar

As part of this, move release creation to a script to be called from
.travis.yml.  That makes it much easier to test outside of travis.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 382af61f6213e975b4c2a50fd8b9fedd23d86ab5)

8 years agoMake it possible to affect the way dists are made
Richard Levitte [Tue, 8 Dec 2015 11:42:27 +0000 (12:42 +0100)]
Make it possible to affect the way dists are made

Introducing DISTTARVARS to propagate changed variables down to the
tar-making target.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 4d3c30a1799bf7b4dc7223b84417c4de992a6b9c)

8 years agoCleanup the EVP_MD_CTX before exit rather than after
Richard Levitte [Tue, 8 Dec 2015 00:01:13 +0000 (01:01 +0100)]
Cleanup the EVP_MD_CTX before exit rather than after

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoChange tar owner and group to just 0
Richard Levitte [Mon, 7 Dec 2015 15:50:15 +0000 (16:50 +0100)]
Change tar owner and group to just 0

It seems like some tar versions don't like the name:id form for
--owner and --group.  The closest known anonymous user being 0 (root),
that seems to be the most appropriate user/group to assign ownership
to.  It matters very little when unpacking either way.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit b91dd150d2b9b5ddca37722e7f52ea59ba7f80da)

8 years agoDo not add symlinks in the source release
Richard Levitte [Mon, 7 Dec 2015 14:56:27 +0000 (15:56 +0100)]
Do not add symlinks in the source release

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 451a5bdf0386d7acf091c3e3b39107e5ed8be25d)

8 years agoIn travis, build from a "source release" rather than from the build tree
Richard Levitte [Mon, 7 Dec 2015 14:47:43 +0000 (15:47 +0100)]
In travis, build from a "source release" rather than from the build tree

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 475fc3d8729190fd12b4ff23d6ec488439fb78f9)

8 years agoSmall changes to creating dists
Richard Levitte [Mon, 7 Dec 2015 14:45:50 +0000 (15:45 +0100)]
Small changes to creating dists

Make TARFILE include ../ instead of having that hard coded all over the place.
When transforming file names in TAR_COMMAND, use $(NAME) instead of openssl-$(VERSION)

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 4a544810f08539f1549eea9be36bd878c67c8e26)

8 years agoPrepare for 1.0.2f-dev
Matt Caswell [Thu, 3 Dec 2015 14:45:41 +0000 (14:45 +0000)]
Prepare for 1.0.2f-dev

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoPrepare for 1.0.2e release OpenSSL_1_0_2e
Matt Caswell [Thu, 3 Dec 2015 14:44:31 +0000 (14:44 +0000)]
Prepare for 1.0.2e release

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agomake update
Matt Caswell [Thu, 3 Dec 2015 14:44:31 +0000 (14:44 +0000)]
make update

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUpdate CHANGES and NEWS
Matt Caswell [Tue, 1 Dec 2015 14:39:47 +0000 (14:39 +0000)]
Update CHANGES and NEWS

Update the CHANGES and NEWS files for the new release.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd test for CVE-2015-3194
Dr. Stephen Henson [Wed, 4 Nov 2015 13:30:03 +0000 (13:30 +0000)]
Add test for CVE-2015-3194

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd PSS parameter check.
Dr. Stephen Henson [Fri, 2 Oct 2015 11:35:19 +0000 (12:35 +0100)]
Add PSS parameter check.

Avoid seg fault by checking mgf1 parameter is not NULL. This can be
triggered during certificate verification so could be a DoS attack
against a client or a server enabling client authentication.

Thanks to Loïc Jonas Etienne (Qnective AG) for discovering this bug.

CVE-2015-3194

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agobn/asm/x86_64-mont5.pl: fix carry propagating bug (CVE-2015-3193).
Andy Polyakov [Tue, 1 Dec 2015 08:00:32 +0000 (09:00 +0100)]
bn/asm/x86_64-mont5.pl: fix carry propagating bug (CVE-2015-3193).

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit e7c078db57908cbf16074c68034977565ffaf107)

8 years agoFix leak with ASN.1 combine.
Dr. Stephen Henson [Tue, 10 Nov 2015 19:03:07 +0000 (19:03 +0000)]
Fix leak with ASN.1 combine.

When parsing a combined structure pass a flag to the decode routine
so on error a pointer to the parent structure is not zeroed as
this will leak any additional components in the parent.

This can leak memory in any application parsing PKCS#7 or CMS structures.

CVE-2015-3195.

Thanks to Adam Langley (Google/BoringSSL) for discovering this bug using
libFuzzer.

PR#4131

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd cleanup of *.s
Richard Levitte [Thu, 3 Dec 2015 14:20:10 +0000 (15:20 +0100)]
Add cleanup of *.s

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoperlasm/ppc-xlate.pl: comply with ABIs that specify vrsave as reserved.
Andy Polyakov [Wed, 2 Dec 2015 13:32:08 +0000 (14:32 +0100)]
perlasm/ppc-xlate.pl: comply with ABIs that specify vrsave as reserved.

RT#4162

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit b5516cfbd65de9331d827012fc5bdace1953613e)

8 years ago_BSD_SOURCE is deprecated, use _DEFAULT_SOURCE instead
Richard Levitte [Wed, 2 Dec 2015 17:18:03 +0000 (18:18 +0100)]
_BSD_SOURCE is deprecated, use _DEFAULT_SOURCE instead

The feature_test_macros(7) manual tells us that _BSD_SOURCE is
deprecated since glibc 2.20 and that the compiler will warn about it
being used, unless _DEFAULT_SOURCE is defined as well.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit f9fd35248c9a3b1125d9ab82ffb19d62e86533ac)

8 years agocrypto/sparcv9cap.c: add SIGILL-free feature detection for Solaris.
Andy Polyakov [Tue, 1 Dec 2015 11:21:08 +0000 (12:21 +0100)]
crypto/sparcv9cap.c: add SIGILL-free feature detection for Solaris.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 2238e0e45d03ec9ba15e9547f7739cc6987a8f57)

8 years agoRemove cookie validation return value trick
Matt Caswell [Mon, 30 Nov 2015 10:38:54 +0000 (10:38 +0000)]
Remove cookie validation return value trick

In the DTLS ClientHello processing the return value is stored in |ret| which
by default is -1. |ret| is only updated to a positive value once we are past
all points where we could hit an error. We wish to return 1 on success or 2
on success *and* we have validated the DTLS cookie. Previously on successful
validation of the cookie we were setting |ret| to -2, and then once we were
past all error points we set |ret = -ret|. This is non-obvious behaviour and
could be error prone. This commit tries to make this a bit more intuitive.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agox86_64 assembly pack: tune clang version detection.
Andy Polyakov [Sat, 21 Nov 2015 10:32:05 +0000 (11:32 +0100)]
x86_64 assembly pack: tune clang version detection.

RT#4142

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 76eba0d94bb418325be6409b272eac5e2bd4a0a9)

Resolved conflicts:
crypto/bn/asm/x86_64-mont.pl
crypto/bn/asm/x86_64-mont5.pl

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoUse both sun and __sun
Kurt Roeckx [Tue, 24 Nov 2015 22:21:06 +0000 (23:21 +0100)]
Use both sun and __sun

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agomark openssl configuration as loaded at end of OPENSSL_config
Marcus Meissner [Tue, 24 Nov 2015 21:03:58 +0000 (22:03 +0100)]
mark openssl configuration as loaded at end of OPENSSL_config

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@akamai.com>
GH: #466
(cherry picked from commit 434b58457c8cca4d09f77a1774d6d2c446604bae)

8 years agossl3_free(): Return if it wasn't created
Pascal Cuoq [Sun, 22 Nov 2015 23:13:15 +0000 (00:13 +0100)]
ssl3_free(): Return if it wasn't created

If somewhere in SSL_new() there is a memory allocation failure, ssl3_free() can
get called with s->s3 still being NULL.

Patch also provided by Willy Tarreau <wtarreau@haproxy.com>

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Viktor Dukhovni <openssl-users@dukhovni.org>
(cherry picked from commit 3e7bd2ce0b16f8611298175d6dc7cb35ee06ea6d)

8 years agoSet reference count earlier
Kurt Roeckx [Sun, 22 Nov 2015 23:07:28 +0000 (00:07 +0100)]
Set reference count earlier

Backport of 0e04674e964b905e67e3d215bcf888932c92765f

Reviewed-by: Steve Henson <steve@openssl.org>
RT #4047, #4110, MR #1356

8 years agoFix uninitialised p error.
Dr. Stephen Henson [Tue, 24 Nov 2015 16:37:52 +0000 (16:37 +0000)]
Fix uninitialised p error.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 63eb10a07ee29a312e50a227f5b3a290b1ad22b4)

8 years agoLimit depth of ASN1 parse printing.
Dr. Stephen Henson [Thu, 3 Sep 2015 13:27:19 +0000 (14:27 +0100)]
Limit depth of ASN1 parse printing.

Thanks to Guido Vranken <guidovranken@gmail.com> for reporting this issue.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 158e5207a794603f5d64ffa95e0247c7808ab445)

Conflicts:
crypto/asn1/asn1_par.c

8 years agoMakefile.org: add LC_ALL=C to unify error [and other] messages.
Andy Polyakov [Sat, 21 Nov 2015 10:28:05 +0000 (11:28 +0100)]
Makefile.org: add LC_ALL=C to unify error [and other] messages.

RT#4138

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 193ed2d74b1a643b5f32bd46bf50a858fcdd2da4)

8 years agoUse defined(__sun) instead of defined(sun)
Kurt Roeckx [Sun, 22 Nov 2015 09:31:35 +0000 (10:31 +0100)]
Use defined(__sun) instead of defined(sun)

Strict ISO confirming C compilers only define __sun

Reviewed-by: Viktor Dukhovni <openssl-users@dukhovni.org>
RT #4144, MR #1353

(cherry picked from commit 3d32218812e87221344f2985512e42e4aaa88745)

8 years agoAdd initial AppVeyor configuration
Alessandro Ghedini [Wed, 28 Oct 2015 20:11:37 +0000 (21:11 +0100)]
Add initial AppVeyor configuration

Original patch by Frank Morgner.

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@akamai.com>
GH: #456
(cherry picked from commit 68db80e2d1accdd4c4a6b4763559c6cfe9663820)

8 years agoGood hygiene with size_t output argument.
Viktor Dukhovni [Sat, 21 Nov 2015 05:59:07 +0000 (00:59 -0500)]
Good hygiene with size_t output argument.

Though the callers check the function return value and ignore the
size_t output argument on failure, it is still often not ideal to
store -1 in a size_t on error.  That might signal an unduly large
buffer.  Instead set the size_t to 0, to indicate no space.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoEnsure all EVP calls have their returns checked where appropriate
Matt Caswell [Fri, 6 Nov 2015 16:31:21 +0000 (16:31 +0000)]
Ensure all EVP calls have their returns checked where appropriate

There are lots of calls to EVP functions from within libssl There were
various places where we should probably check the return value but don't.
This adds these checks.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix README version typo
Rich Salz [Thu, 19 Nov 2015 15:19:55 +0000 (10:19 -0500)]
Fix README version typo

Reviewed-by: Steve Marquess <marquess@openssl.com>
8 years agoFix release in README
Rich Salz [Wed, 18 Nov 2015 22:00:02 +0000 (17:00 -0500)]
Fix release in README

Reviewed-by: Steve Marquess <marquess@openssl.com>
8 years agoaes/asm/vpaes-ppc.pl: eliminate overhung stores in misaligned cases.
Andy Polyakov [Fri, 13 Nov 2015 22:52:13 +0000 (23:52 +0100)]
aes/asm/vpaes-ppc.pl: eliminate overhung stores in misaligned cases.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit ce24d2ed232a095349886aecc8cb959d5dda8342)

8 years agobn/asm/ppc64-mont.pl: adapt for little-endian.
Andy Polyakov [Fri, 13 Nov 2015 22:44:23 +0000 (23:44 +0100)]
bn/asm/ppc64-mont.pl: adapt for little-endian.

The problem remained unnoticed so far, because it's never called by default.
You have to craft OPENSSL_ppccap environment variable to trigger the problem.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit e4693b4e2a0c3f6241d4d3e61460c34c7e0013f6)

8 years agobn/asm/s390x.S: improve performance on z196 and z13 by up to 26%. [even z10 is couple...
Andy Polyakov [Tue, 10 Nov 2015 20:11:24 +0000 (21:11 +0100)]
bn/asm/s390x.S: improve performance on z196 and z13 by up to 26%. [even z10 is couple percent faster]. Triggered by RT#4128, but solves the problem by real modulo-scheduling.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 9d0e4dc6351df7d0c08400c4b4cf17c017022e50)

8 years agoaesni-sha256-x86_64.pl: fix crash on AMD Jaguar.
Andy Polyakov [Wed, 4 Nov 2015 22:57:06 +0000 (23:57 +0100)]
aesni-sha256-x86_64.pl: fix crash on AMD Jaguar.

It was also found that stich performs suboptimally on AMD Jaguar, hence
execution is limited to XOP-capable and Intel processors.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
(cherry picked from commit a5fd24d19bbb586b1c6d235c2021e9bead22c9f5)

8 years agoRT32671: wrong multiple errs TS_check_status_info
Graeme Perrow [Fri, 13 Nov 2015 21:56:18 +0000 (16:56 -0500)]
RT32671: wrong multiple errs TS_check_status_info

Manual cherry-pick of 0704343f138a38d3882d5af2a4ebe8821e9a8f3a.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agomodes/asm/ghash-armv4.pl: make it compile by clang. RT#3989
Andy Polyakov [Tue, 10 Nov 2015 20:57:22 +0000 (21:57 +0100)]
modes/asm/ghash-armv4.pl: make it compile by clang. RT#3989

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoStop DTLS servers asking for unsafe legacy renegotiation
Matt Caswell [Tue, 10 Nov 2015 15:17:42 +0000 (15:17 +0000)]
Stop DTLS servers asking for unsafe legacy renegotiation

If a DTLS client that does not support secure renegotiation connects to an
OpenSSL DTLS server then, by default, renegotiation is disabled. If a
server application attempts to initiate a renegotiation then OpenSSL is
supposed to prevent this. However due to a discrepancy between the TLS and
DTLS code, the server sends a HelloRequest anyway in DTLS.

This is not a security concern because the handshake will still fail later
in the process when the client responds with a ClientHello.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoOnly call ssl3_init_finished_mac once for DTLS
Matt Caswell [Tue, 3 Nov 2015 15:49:08 +0000 (15:49 +0000)]
Only call ssl3_init_finished_mac once for DTLS

In DTLS if an IO retry occurs during writing of a fragmented ClientHello
then we can end up reseting the finish mac variables on the retry, which
causes a handshake failure. We should only reset on the first attempt not
on retries.

Thanks to BoringSSL for reporting this issue.

RT#4119

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoRemove redundant check from tls1_get_curvelist
Matt Caswell [Mon, 9 Nov 2015 16:37:33 +0000 (16:37 +0000)]
Remove redundant check from tls1_get_curvelist

The function tls1_get_curvelist() has an explicit check to see if s->cert
is NULL or not. However the check appears *after* calling the tls1_suiteb
macro which derefs s->cert. In reality s->cert can never be NULL because
it is created in SSL_new(). If the malloc fails then the SSL_new call fails
and no SSL object is created.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 6329b6092b28b656be8a1e4a8363d2e3bcc32053)

Conflicts:
ssl/t1_lib.c

8 years agoFix missing malloc return value checks
Matt Caswell [Wed, 4 Nov 2015 15:51:02 +0000 (15:51 +0000)]
Fix missing malloc return value checks

During work on a larger change in master a number of locations were
identified where return value checks were missing. This backports the
relevant fixes.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoMake the match for previous cflags a bit more strict
Richard Levitte [Mon, 9 Nov 2015 08:50:56 +0000 (09:50 +0100)]
Make the match for previous cflags a bit more strict

./Configure [target] --strict-warnings -Wno-pedantic-ms-format
would not add '-pedantic' because it matches '-Wno-pedantic-ms-format',
which was added first.

Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 6703c4ea87b30554283deaa5df1f8d68725d3ee4)

8 years agoReject TLS 1.2 ciphersuites if not allowed.
Dr. Stephen Henson [Sun, 8 Nov 2015 13:47:53 +0000 (13:47 +0000)]
Reject TLS 1.2 ciphersuites if not allowed.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoEnsure the dtls1_get_*_methods work with DTLS_ANY_VERSION
Matt Caswell [Wed, 4 Nov 2015 14:46:03 +0000 (14:46 +0000)]
Ensure the dtls1_get_*_methods work with DTLS_ANY_VERSION

The various dtls1_get*_methods did not handle the DTLS_ANY_VERSION case,
so this needed to be added.

Reviewed-by: Tim Hudson <tjh@openssl.org>
8 years agoMinor EVP_SignInit_ex doc fix
Matt Caswell [Mon, 2 Nov 2015 15:37:45 +0000 (15:37 +0000)]
Minor EVP_SignInit_ex doc fix

EVP_SignInit_ex was missing from the NAME section of its man page so
typing "man EVP_SignInit_ex" failed to load the page.

Reviewed-by: Stephen Henson <steve@openssl.org>
(cherry picked from commit 3d866ea67e8b19777e88ac2a78ee4188e0983168)

8 years agoClarify the preferred way of creating patch files
Matt Caswell [Sun, 1 Nov 2015 14:41:29 +0000 (14:41 +0000)]
Clarify the preferred way of creating patch files

Clarify that git format-patch output is preferred for creating patch files.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit f89ee71bc81017e04ac50f570d8aed87f495bcf2)

8 years agoVarious README and CONTRIBUTING updates
Rich Salz [Sun, 1 Nov 2015 13:38:42 +0000 (08:38 -0500)]
Various README and CONTRIBUTING updates

Close GH Issue 69
Close GH PR 457/RT4113
Some other updates

By Rich Salz, Alessandro Ghedini, Steve Marquess, Collin Anderson

(manual cherry-pick of a2aaf8be7e3c22a61ef89f273aa85f482b955336 and
b06935f439af7150d3ae566922353c3f210e63ed)

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoBN_GF2m_mod_inv(): check bn_wexpand return value
Pascal Cuoq [Mon, 12 Oct 2015 10:19:19 +0000 (12:19 +0200)]
BN_GF2m_mod_inv(): check bn_wexpand return value

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@akamai.com>
MR #1276, RT #4107

(cherry picked from commit 94b3664a528258df5ebcaae213d19bf6568cc47d)

8 years agoRemove useless code
Alessandro Ghedini [Thu, 8 Oct 2015 20:00:27 +0000 (22:00 +0200)]
Remove useless code

RT#4081

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 070c23325af4526c9a8532a60d63522c58d5554b)

8 years agoCheck memory allocation
Alessandro Ghedini [Thu, 8 Oct 2015 12:50:27 +0000 (14:50 +0200)]
Check memory allocation

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 8cf9d71a3a43d9b98a8a278d47dc08088a954a7b)

8 years agoFix references to various RFCs
Alessandro Ghedini [Thu, 8 Oct 2015 12:41:09 +0000 (14:41 +0200)]
Fix references to various RFCs

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 3240e7cf5f651d9d94814b4d494fbe294e463b72)

8 years agoFix typos
Alessandro Ghedini [Thu, 8 Oct 2015 12:40:42 +0000 (14:40 +0200)]
Fix typos

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit d900a015b5a89ea2018e6122dd2738925e4d68ab)

8 years agoSet salt length after the malloc has succeeded
Alessandro Ghedini [Thu, 8 Oct 2015 12:39:58 +0000 (14:39 +0200)]
Set salt length after the malloc has succeeded

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit c2319cf9fce87a2e82efb6e58ced11a85190dc3d)

8 years agoFix memory leaks and other mistakes on errors
Alessandro Ghedini [Thu, 8 Oct 2015 12:38:57 +0000 (14:38 +0200)]
Fix memory leaks and other mistakes on errors

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 3f6c7691870d1cd2ad0e0c83638cef3f35a0b548)

8 years agoReplace malloc+strlcpy with strdup
Alessandro Ghedini [Thu, 8 Oct 2015 12:37:21 +0000 (14:37 +0200)]
Replace malloc+strlcpy with strdup

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 8acaabec429b39f9436f6a88006384d72d292539)

8 years agoDo not treat 0 return value from BIO_get_fd() as error
Alessandro Ghedini [Fri, 2 Oct 2015 13:16:08 +0000 (15:16 +0200)]
Do not treat 0 return value from BIO_get_fd() as error

0 is a valid file descriptor.

RT#4068

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 4428c7dba8f6f407d915c1226f4e0f673e8be241)

8 years agoClarify return values for EVP_DigestVerifyFinal.
Adam Eijdenberg [Mon, 19 Oct 2015 18:16:25 +0000 (11:16 -0700)]
Clarify return values for EVP_DigestVerifyFinal.

Previous language was unclear.  New language isn't pretty but I believe
it is more accurate.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 8cbb048c3ea416f2bd8a3706d027f3aa26ef08d9)

8 years agoFix self signed handling.
Dr. Stephen Henson [Wed, 5 Aug 2015 02:21:40 +0000 (03:21 +0100)]
Fix self signed handling.

Don't mark a certificate as self signed if keyUsage is present and
certificate signing not asserted.

PR#3979

Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit f51e5ed6b4b91d12228da873db72aa28109d1797)

8 years agomake depend: prefer clang over makedepend
Emilia Kasper [Fri, 9 Oct 2015 18:00:53 +0000 (20:00 +0200)]
make depend: prefer clang over makedepend

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRFC5753 compliance.
Dr. Stephen Henson [Mon, 12 Oct 2015 20:14:04 +0000 (21:14 +0100)]
RFC5753 compliance.

RFC5753 requires that we omit parameters for AES key wrap and set them
to NULL for 3DES wrap. OpenSSL decrypt uses the received algorithm
parameters so can transparently handle either form.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit 4ec36aff2a3c221b640dafa56ac838312e6724f4)

8 years agoRT3346: Fix test_bn regexp for Windows using MSYS.
Peter Mosmans [Tue, 27 May 2014 22:26:11 +0000 (23:26 +0100)]
RT3346: Fix test_bn regexp for Windows using MSYS.

(cherry picked from commit 028bac0670c167f154438742eb4d0fbed73df209)

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoTypo.
Dr. Stephen Henson [Sat, 10 Oct 2015 23:06:56 +0000 (00:06 +0100)]
Typo.

PR#4079

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit c69ce9351336f5b4a8b33890756b3fd185528210)

8 years agoDon't treat a bare OCTETSTRING as DigestInfo in int_rsa_verify
Matt Caswell [Thu, 8 Oct 2015 12:36:10 +0000 (13:36 +0100)]
Don't treat a bare OCTETSTRING as DigestInfo in int_rsa_verify

The function int_rsa_verify is an internal function used for verifying an
RSA signature. It takes an argument |dtype| which indicates the digest type
that was used. Dependant on that digest type the processing of the
signature data will vary. In particular if |dtype == NID_mdc2| and the
signature data is a bare OCTETSTRING then it is treated differently to the
default case where the signature data is treated as a DigestInfo (X509_SIG).

Due to a missing "else" keyword the logic actually correctly processes the
OCTETSTRING format signature first, and then attempts to continue and
process it as DigestInfo. This will invariably fail because we already know
that it is a bare OCTETSTRING.

This failure doesn't actualy make a real difference because it ends up at
the |err| label regardless and still returns a "success" result. This patch
just cleans things up to make it look a bit more sane.

RT#4076

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit dffe51091f412dcbc18f6641132f0b4f0def6bce)

8 years agoWhen ENGINE_add finds that id or name is missing, actually return
Richard Levitte [Thu, 8 Oct 2015 09:53:07 +0000 (11:53 +0200)]
When ENGINE_add finds that id or name is missing, actually return

Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 5850cc75ea0c1581a9034390f1ca77cadc596238)

8 years agoFix travis 1.0.2 builds
Alessandro Ghedini [Wed, 7 Oct 2015 20:40:37 +0000 (16:40 -0400)]
Fix travis 1.0.2 builds

Disable -Wshadow error when building with GCC
Add support for linu-x86_64-clang debug; this is needed for Travis CI.
Disable linux-clang and mingw debug builds on Travis CI; not supported.
Fix Travis email notifications config

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoMove BN_CTX_start() call so the error case can always call BN_CTX_end().
Pascal Cuoq [Tue, 5 May 2015 09:20:39 +0000 (11:20 +0200)]
Move BN_CTX_start() call so the error case can always call BN_CTX_end().

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@openssl.org>
MR #1231

(cherry picked from commit 99c203337574d967c86ffbfa13f40ace51048485)

8 years agoProperly check return type of DH_compute_key()
Pascal Cuoq [Wed, 6 May 2015 07:55:28 +0000 (09:55 +0200)]
Properly check return type of DH_compute_key()

It returns -1 on error, not 0.

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@openssl.org>
MR #1231

(cherry picked from commit d6e92c0bd6c36fc68291e79ef5753fd7f0420695)