- fix coverity issues 966593-966596
Set Enveloped data version to 2 if ktri version not zero.
(cherry picked from commit 546b1b438468e629eea4e836190b1bb056e39286)
Initialize num properly.

PR#3289
PR#3345
(cherry picked from commit 3ba1e406c2309adb427ced9815ebf05f5b58d155)
Unit/regression test for TLS heartbeats.

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

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

(based on commit 35cb55988b75573105eefd00d27d0138eebe40b1)