Modify API for OpenSSL. Various fixes