Return an error if no recipient type matches.

If the key type does not match any CMS recipient type return
an error instead of using a random key (MMA mitigation). This
does not leak any useful information to an attacker.

PR#3348
Fixed CRLF in file
safety check to ensure we dont send out beyond the users buffer
Move length check earlier to ensure we don't go beyond the end of the user's buffer. PR#3320
Unit/regression test for TLS heartbeats.

Regression test against CVE-2014-0160 (Heartbleed).

More info: http://mike-bland.com/tags/heartbleed.html