Modernized to work with OpenSSL 1.0.1 and gcc 4.7