Commit graph

11983 commits

Author SHA1 Message Date
Viktor Dukhovni
03bf712780 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>
2015-11-21 05:23:20 -05:00
Matt Caswell
56d9134675 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>
2015-11-20 15:47:44 +00:00
Rich Salz
cb70eede8b Fix README version typo
Reviewed-by: Steve Marquess <marquess@openssl.com>
2015-11-19 10:20:21 -05:00
Rich Salz
01d625e2c3 Fix release in README
Reviewed-by: Steve Marquess <marquess@openssl.com>
2015-11-18 17:00:02 -05:00
Andy Polyakov
bc2ab6ed2f aes/asm/vpaes-ppc.pl: eliminate overhung stores in misaligned cases.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit ce24d2ed23)
2015-11-18 11:57:45 +01:00
Andy Polyakov
bef7693860 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 e4693b4e2a)
2015-11-16 13:41:58 +01:00
Andy Polyakov
c6a5fddf6c 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 9d0e4dc635)
2015-11-16 13:11:27 +01:00
Andy Polyakov
817ddb9fb0 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 a5fd24d19b)
2015-11-16 13:07:33 +01:00
Graeme Perrow
f236ef27bd RT32671: wrong multiple errs TS_check_status_info
Manual cherry-pick of 0704343f13.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-11-13 16:57:08 -05:00
Andy Polyakov
48008008af modes/asm/ghash-armv4.pl: make it compile by clang. RT#3989
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-11-11 22:12:28 +01:00
Matt Caswell
d40ec4ab8e 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>
2015-11-10 19:24:20 +00:00
Matt Caswell
15a7164eb7 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>
2015-11-10 18:44:56 +00:00
Matt Caswell
822d265ced 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 6329b6092b)

Conflicts:
	ssl/t1_lib.c
2015-11-09 23:10:31 +00:00
Matt Caswell
903738ac63 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>
2015-11-09 22:54:19 +00:00
Richard Levitte
a89dda8cd0 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 6703c4ea87)
2015-11-09 12:15:42 +01:00
Dr. Stephen Henson
fdbe4a3fa6 Reject TLS 1.2 ciphersuites if not allowed.
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2015-11-08 13:47:53 +00:00
Matt Caswell
0c0f1361b2 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>
2015-11-04 14:46:03 +00:00
Matt Caswell
ca3658e000 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 3d866ea67e)
2015-11-04 14:39:16 +00:00
Matt Caswell
8f486d793b 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 f89ee71bc8)
2015-11-02 14:33:51 +00:00
Rich Salz
706c85da79 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 a2aaf8be7e and
b06935f439)

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-11-01 08:38:42 -05:00
Pascal Cuoq
dfb23a5ac8 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 94b3664a52)
2015-10-29 20:36:34 +01:00
Alessandro Ghedini
b62a2f8a37 Remove useless code
RT#4081

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 070c23325a)
2015-10-23 20:32:59 +02:00
Alessandro Ghedini
a8bd9f90ed Check memory allocation
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 8cf9d71a3a)
2015-10-23 20:32:59 +02:00
Alessandro Ghedini
43679fc35e Fix references to various RFCs
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 3240e7cf5f)
2015-10-23 20:32:58 +02:00
Alessandro Ghedini
ec3a7c9b37 Fix typos
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit d900a015b5)
2015-10-23 20:32:58 +02:00
Alessandro Ghedini
72895f5112 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 c2319cf9fc)
2015-10-23 19:59:34 +02:00
Alessandro Ghedini
e90f1d9b74 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 3f6c769187)
2015-10-23 19:58:54 +02:00
Alessandro Ghedini
5a1e6b1342 Replace malloc+strlcpy with strdup
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 8acaabec42)
2015-10-23 19:58:48 +02:00
Alessandro Ghedini
51a1cc4ffc 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 4428c7dba8)
2015-10-23 19:57:53 +02:00
Adam Eijdenberg
8d43c0053b 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 8cbb048c3e)
2015-10-22 18:28:38 -04:00
Dr. Stephen Henson
e272f8ef8f 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 f51e5ed6b4)
2015-10-15 15:37:55 +01:00
Emilia Kasper
c97c7f8d53 make depend: prefer clang over makedepend
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-10-14 19:08:54 +02:00
Dr. Stephen Henson
a20d9422cf 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 4ec36aff2a)
2015-10-13 23:02:44 +01:00
Peter Mosmans
bf9d61d1ab RT3346: Fix test_bn regexp for Windows using MSYS.
(cherry picked from commit 028bac0670)

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
2015-10-13 16:09:42 -04:00
Dr. Stephen Henson
6868346585 Typo.
PR#4079

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit c69ce93513)
2015-10-11 00:28:20 +01:00
Matt Caswell
985abd1fd8 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 dffe51091f)
2015-10-08 14:11:59 +01:00
Richard Levitte
b00424792f When ENGINE_add finds that id or name is missing, actually return
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 5850cc75ea)
2015-10-08 12:41:12 +02:00
Alessandro Ghedini
bb7b893d7c 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>
2015-10-07 16:42:42 -04:00
Pascal Cuoq
cc1cdc5df5 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 99c2033375)
2015-10-07 20:36:54 +02:00
Pascal Cuoq
738b8e6bc2 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 d6e92c0bd6)
2015-10-07 20:36:46 +02:00
Pascal Cuoq
6481be7346 Set flags to 0 before calling BN_with_flags()
BN_with_flags() will read the dest->flags to keep the BN_FLG_MALLOCED but
overwrites everything else.

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

(cherry picked from commit f92768e6f5)
2015-10-07 20:36:34 +02:00
Dr. Stephen Henson
cba8745395 Don't try and parse boolean type.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit e58c4d3cdd)
2015-10-06 15:16:05 +01:00
Matt Caswell
61dfe3a720 Change functions to pass in a limit rather than calculate it
Some extension handling functions were passing in a pointer to the start
of the data, plus the length in order to calculate the end, rather than
just passing in the end to start with. This change makes things a little
more readable.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
2015-10-05 14:14:02 +01:00
Alessandro Ghedini
184718baab Validate ClientHello extension field length
RT#4069

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-10-05 12:09:20 +01:00
Kurt Roeckx
6b247c1817 Fix more d2i cases to properly update the input pointer
Thanks to David Benjamin <davidben@google.com> for pointing them out.

Reviewed-by: Steve Henson <steve@openssl.org>
MR #1198

(cherry picked from commit 605236f6a8)
2015-10-03 13:29:15 +02:00
Dr. Stephen Henson
d62c64b947 Link in applink with fips_premain_dso
PR#4042

Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-09-29 18:43:02 +01:00
Ismo Puustinen
6f997dc365 GH367: use random data if seed too short.
Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2015-09-29 12:48:43 -04:00
Emilia Kasper
21b538d616 RT2772: accept empty SessionTicket
RFC 5077 section 3.3 says: If the server determines that it does not
want to include a ticket after it has included the SessionTicket
extension in the ServerHello, then it sends a zero-length ticket in the
NewSessionTicket handshake message.

Previously the client would fail upon attempting to allocate a
zero-length buffer. Now, we have the client ignore the empty ticket and
keep the existing session.

Reviewed-by: Matt Caswell <matt@openssl.org>
2015-09-28 16:07:00 +02:00
Dr. Stephen Henson
92ea6fe597 SRP memory leak fix
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-09-28 14:31:53 +01:00
Rich Salz
920f7cf897 Fix typo in previous merge.
Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-09-25 11:44:28 -04:00