Correctly increase reference count of OpenSSL structs...

when they are being referenced multiple times, and free each used
structure after use. Now this test passes valgrind with no leaks or
double-free(). Lesson to be learned: do not mock OpenSSL. ;-) Also added
some error messages.
indentation
Properly use OpenSSL API, properly free structs.
Remove X509_verify call from TLSVerifyPeer...

since it's not needed for self-signed certificates. All we have to do
(and we already do) is compare the RSA key we got during handshake with
the one we expect. Verifying signature is expensive and not needed,
since TLS handshake includes at least one RSA decrypt or sign operation.
Abstract the creation of in-memory dummy certificate into
tls_generic.c. Handle errors more carefully.
tls_generic_test is currently leaking memory.

All the new struct opaqueness together with SSL mocking, is giving me a
hard time to fix the leaks, so just mark the relevant lines with TODO.
Merge pull request #1105 from jimis/varfix_tls

Varfix tls