Fix CVE-2014-3470

Check session_cert is not NULL before dereferencing it.
(cherry picked from commit 8011cd56e39a433b1837465259a9bd24a38727fb)
Fix CVE-2014-0221

Unnecessary recursion when receiving a DTLS hello request can be used to
crash a DTLS client. Fixed by handling DTLS hello request without recursion.

Thanks to Imre Rad (Search-Lab Ltd.) for discovering this issue.
(cherry picked from commit d3152655d5319ce883c8e3ac4b99f8de4c59d846)
Additional CVE-2014-0224 protection.

Return a fatal error if an attempt is made to use a zero length
master secret.
(cherry picked from commit 006cd7083f76ed5cb0d9a914857e9231ef1bc317)
Fix for CVE-2014-0224

Only accept change cipher spec when it is expected instead of at any
time. This prevents premature setting of session keys before the master
secret is determined which an attacker could use as a MITM attack.

Thanks to KIKUCHI Masashi (Lepidum Co. Ltd.) for reporting this issue
and providing the initial fix this patch is based on.
(cherry picked from commit bc8923b1ec9c467755cd86f7848c50ee8812e441)
Fix for CVE-2014-0195

A buffer overrun attack can be triggered by sending invalid DTLS fragments
to an OpenSSL DTLS client or server. This is potentially exploitable to
run arbitrary code on a vulnerable client or server.

Fixed by adding consistency check for DTLS fragments.

Thanks to Jüri Aedla for reporting this issue.
(cherry picked from commit 1632ef744872edc2aa2a53d487d3e79c965a4ad3)
Update value to use a free bit.
aesv8-armx.pl update:

- fix 32-bit build (submitted by Ard Biesheuvel);
- fix performance issue in CTR;
Update NEWS.
Add GHASH for ARMv8 Crypto Extension.

Result of joint effort with Ard Biesheuvel.
Engage GHASH for ARMv8.
sha[1|512]-armv8.pl: get instruction endianness right.

Submitted by: Ard Biesheuvel.
ARM assembly pack: get ARMv7 instruction endianness right.

Pointer out and suggested by: Ard Biesheuvel.
Fixed minor duplication in docs
Add official extension value.

Encrypt then MAC now has an official extension value, see:

http://www.ietf.org/id/draft-ietf-tls-encrypt-then-mac-02.txt
Make tls_session_secret_cb work with CVE-2014-0224 fix.

If application uses tls_session_secret_cb for session resumption
set the CCS_OK flag.
Create ~/.rnd with mode 0600 instead of 0666

Because of a missing include <fcntl.h> we don't have O_CREATE and don't create
the file with open() using mode 0600 but fall back to using fopen() with the
default umask followed by a chmod().

Problem found by Jakub Wilk <jwilk@debian.org>.
Link heartbeat_test with the static version of the libraries

It's using an internal API that that might not be available in the shared
library.
Update strength_bits for 3DES.

Fix strength_bits to 112 for 3DES.
SRP ciphersuite correction.

SRP ciphersuites do not have no authentication. They have authentication
based on SRP. Add new SRP authentication flag and cipher string.
Fix null pointer errors.

PR#3394