Fix segfault when built with OpenSSL >= 1.0.1

This commit fixes segfaults encountered when using `ext/openssl` built against OpenSSL >= 1.0.1. This newer version of OpenSSL is required for TLSv1.1 and TLSv1.2 support.

Note that this patch has no BC implications and should be safe to merge with 5.4 and 5.5 branches.