Don't call SSL_get_server_tmp_key() if not available (#5858)

This commit is contained in:
Andrey Rakhmatullin 2023-03-27 14:44:44 +04:00 committed by GitHub
parent d60b4edd11
commit ada9173078
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -20,6 +20,9 @@ def x509name_to_string(x509name):
def get_temp_key_info(ssl_object):
# adapted from OpenSSL apps/s_cb.c::ssl_print_tmp_key()
if not hasattr(pyOpenSSLutil.lib, "SSL_get_server_tmp_key"):
# removed in cryptography 40.0.0
return None
temp_key_p = pyOpenSSLutil.ffi.new("EVP_PKEY **")
if not pyOpenSSLutil.lib.SSL_get_server_tmp_key(ssl_object, temp_key_p):
return None