--- thread.c.orig	2015-02-25 16:20:53.000000000 +1100
+++ thread.c	2021-02-12 20:24:18.000000000 +1100
@@ -4817,6 +4817,8 @@ exec_recursive_i(VALUE tag, struct exec_
     return result;
 }
 
+ID rb_frame_last_func(void);
+
 /*
  * Calls func(obj, arg, recursive), where recursive is non-zero if the
  * current method is called recursively on obj, or on the pair <obj, pairid>
--- ext/openssl/extconf.rb.orig	2012-12-20 18:42:56.000000000 +1100
+++ ext/openssl/extconf.rb	2021-02-12 21:13:01.000000000 +1100
@@ -63,82 +63,82 @@
 end
 
 Logging::message "=== Checking for OpenSSL features... ===\n"
-have_func("ERR_peek_last_error")
-have_func("ASN1_put_eoc")
-have_func("BN_mod_add")
-have_func("BN_mod_sqr")
-have_func("BN_mod_sub")
-have_func("BN_pseudo_rand_range")
-have_func("BN_rand_range")
-have_func("CONF_get1_default_config_file")
-have_func("EVP_CIPHER_CTX_copy")
-have_func("EVP_CIPHER_CTX_set_padding")
-have_func("EVP_CipherFinal_ex")
-have_func("EVP_CipherInit_ex")
-have_func("EVP_DigestFinal_ex")
-have_func("EVP_DigestInit_ex")
-have_func("EVP_MD_CTX_cleanup")
-have_func("EVP_MD_CTX_create")
-have_func("EVP_MD_CTX_destroy")
-have_func("EVP_MD_CTX_init")
-have_func("HMAC_CTX_cleanup")
-have_func("HMAC_CTX_copy")
-have_func("HMAC_CTX_init")
-have_func("PEM_def_callback")
-have_func("PKCS5_PBKDF2_HMAC")
-have_func("PKCS5_PBKDF2_HMAC_SHA1")
-have_func("X509V3_set_nconf")
-have_func("X509V3_EXT_nconf_nid")
-have_func("X509_CRL_add0_revoked")
-have_func("X509_CRL_set_issuer_name")
-have_func("X509_CRL_set_version")
-have_func("X509_CRL_sort")
-have_func("X509_NAME_hash_old")
-have_func("X509_STORE_get_ex_data")
-have_func("X509_STORE_set_ex_data")
-have_func("OBJ_NAME_do_all_sorted")
-have_func("SSL_SESSION_get_id")
+have_func("ERR_peek_last_error", "openssl/err.h")
+have_func("ASN1_put_eoc", "openssl/asn1.h")
+have_func("BN_mod_add", "openssl/bn.h")
+have_func("BN_mod_sqr", "openssl/bn.h")
+have_func("BN_mod_sub", "openssl/bn.h")
+have_func("BN_pseudo_rand_range", "openssl/bn.h")
+have_func("BN_rand_range", "openssl/bn.h")
+have_func("CONF_get1_default_config_file", "openssl/conf.h")
+have_func("EVP_CIPHER_CTX_copy", "openssl/evp.h")
+have_func("EVP_CIPHER_CTX_set_padding", "openssl/evp.h")
+have_func("EVP_CipherFinal_ex", "openssl/evp.h")
+have_func("EVP_CipherInit_ex", "openssl/evp.h")
+have_func("EVP_DigestFinal_ex", "openssl/evp.h")
+have_func("EVP_DigestInit_ex", "openssl/evp.h")
+have_func("EVP_MD_CTX_cleanup", "openssl/evp.h")
+have_func("EVP_MD_CTX_create", "openssl/evp.h")
+have_func("EVP_MD_CTX_destroy", "openssl/evp.h")
+have_func("EVP_MD_CTX_init", "openssl/evp.h")
+have_func("HMAC_CTX_cleanup", "openssl/hmac.h")
+have_func("HMAC_CTX_copy", "openssl/hmac.h")
+have_func("HMAC_CTX_init", "openssl/hmac.h")
+have_func("PEM_def_callback", "openssl/pem.h")
+have_func("PKCS5_PBKDF2_HMAC", "openssl/evp.h")
+have_func("PKCS5_PBKDF2_HMAC_SHA1", "openssl/evp.h")
+have_func("X509V3_set_nconf", "openssl/x509v3.h")
+have_func("X509V3_EXT_nconf_nid", "openssl/x509v3.h")
+have_func("X509_CRL_add0_revoked", "openssl/x509.h")
+have_func("X509_CRL_set_issuer_name", "openssl/x509.h")
+have_func("X509_CRL_set_version", "openssl/x509.h")
+have_func("X509_CRL_sort", "openssl/x509.h")
+have_func("X509_NAME_hash_old", "openssl/x509.h")
+have_func("X509_STORE_get_ex_data", "openssl/x509.h")
+have_func("X509_STORE_set_ex_data", "openssl/x509.h")
+have_func("OBJ_NAME_do_all_sorted", "openssl/objects.h")
+have_func("SSL_SESSION_get_id", "openssl/ssl.h")
 have_func("SSL_SESSION_cmp")
-have_func("OPENSSL_cleanse")
-have_func("SSLv2_method")
-have_func("SSLv2_server_method")
-have_func("SSLv2_client_method")
-have_func("TLSv1_1_method")
-have_func("TLSv1_1_server_method")
-have_func("TLSv1_1_client_method")
-have_func("TLSv1_2_method")
-have_func("TLSv1_2_server_method")
-have_func("TLSv1_2_client_method")
+have_func("OPENSSL_cleanse", "openssl/crypto.h")
+have_func("SSLv2_method", "openssl/ssl.h")
+have_func("SSLv2_server_method", "openssl/ssl.h")
+have_func("SSLv2_client_method", "openssl/ssl.h")
+have_func("TLSv1_1_method", "openssl/ssl.h")
+have_func("TLSv1_1_server_method", "openssl/ssl.h")
+have_func("TLSv1_1_client_method", "openssl/ssl.h")
+have_func("TLSv1_2_method", "openssl/ssl.h")
+have_func("TLSv1_2_server_method", "openssl/ssl.h")
+have_func("TLSv1_2_client_method", "openssl/ssl.h")
 have_macro("OPENSSL_NPN_NEGOTIATED", ['openssl/ssl.h']) && $defs.push("-DHAVE_OPENSSL_NPN_NEGOTIATED")
 unless have_func("SSL_set_tlsext_host_name", ['openssl/ssl.h'])
   have_macro("SSL_set_tlsext_host_name", ['openssl/ssl.h']) && $defs.push("-DHAVE_SSL_SET_TLSEXT_HOST_NAME")
 end
 if have_header("openssl/engine.h")
-  have_func("ENGINE_add")
-  have_func("ENGINE_load_builtin_engines")
-  have_func("ENGINE_load_openbsd_dev_crypto")
-  have_func("ENGINE_get_digest")
-  have_func("ENGINE_get_cipher")
-  have_func("ENGINE_cleanup")
-  have_func("ENGINE_load_dynamic")
-  have_func("ENGINE_load_4758cca")
-  have_func("ENGINE_load_aep")
-  have_func("ENGINE_load_atalla")
-  have_func("ENGINE_load_chil")
-  have_func("ENGINE_load_cswift")
-  have_func("ENGINE_load_nuron")
-  have_func("ENGINE_load_sureware")
-  have_func("ENGINE_load_ubsec")
-  have_func("ENGINE_load_padlock")
-  have_func("ENGINE_load_capi")
-  have_func("ENGINE_load_gmp")
-  have_func("ENGINE_load_gost")
-  have_func("ENGINE_load_cryptodev")
-  have_func("ENGINE_load_aesni")
+  have_func("ENGINE_add", "openssl/engine.h")
+  have_func("ENGINE_load_builtin_engines", "openssl/engine.h")
+  have_func("ENGINE_load_openbsd_dev_crypto", "openssl/engine.h")
+  have_func("ENGINE_get_digest", "openssl/engine.h")
+  have_func("ENGINE_get_cipher", "openssl/engine.h")
+  have_func("ENGINE_cleanup", "openssl/engine.h")
+  have_func("ENGINE_load_dynamic", "openssl/engine.h")
+  have_func("ENGINE_load_4758cca", "openssl/engine.h")
+  have_func("ENGINE_load_aep", "openssl/engine.h")
+  have_func("ENGINE_load_atalla", "openssl/engine.h")
+  have_func("ENGINE_load_chil", "openssl/engine.h")
+  have_func("ENGINE_load_cswift", "openssl/engine.h")
+  have_func("ENGINE_load_nuron", "openssl/engine.h")
+  have_func("ENGINE_load_sureware", "openssl/engine.h")
+  have_func("ENGINE_load_ubsec", "openssl/engine.h")
+  have_func("ENGINE_load_padlock", "openssl/engine.h")
+  have_func("ENGINE_load_capi", "openssl/engine.h")
+  have_func("ENGINE_load_gmp", "openssl/engine.h")
+  have_func("ENGINE_load_gost", "openssl/engine.h")
+  have_func("ENGINE_load_cryptodev", "openssl/engine.h")
+  have_func("ENGINE_load_aesni", "openssl/engine.h")
 end
-have_func("DH_generate_parameters_ex")
-have_func("DSA_generate_parameters_ex")
-have_func("RSA_generate_key_ex")
+have_func("DH_generate_parameters_ex", "openssl/dh.h")
+have_func("DSA_generate_parameters_ex", "openssl/dsa.h")
+have_func("RSA_generate_key_ex", "openssl/rsa.h")
 if checking_for('OpenSSL version is 0.9.7 or later') {
     try_static_assert('OPENSSL_VERSION_NUMBER >= 0x00907000L', 'openssl/opensslv.h')
   }
