Fix OpenSSL compat (simplifies the code) + add relevant exit code on error