Loading openssl-sys/src/lib.rs +2 −0 Original line number Diff line number Diff line Loading @@ -270,6 +270,7 @@ pub fn init() { GUARDS = mem::transmute(guards); CRYPTO_set_locking_callback(locking_function); unsafe{ rust_openssl_set_id_callback(); } }) } } Loading @@ -290,6 +291,7 @@ pub unsafe fn SSL_CTX_clear_options(ssl: *mut SSL_CTX, op: u64) -> u64 { extern "C" { fn rust_openssl_ssl_ctx_options_rust_to_c(rustval: u64) -> c_long; fn rust_openssl_ssl_ctx_options_c_to_rust(cval: c_long) -> u64; fn rust_openssl_set_id_callback(); pub fn ASN1_INTEGER_set(dest: *mut ASN1_INTEGER, value: c_long) -> c_int; pub fn ASN1_STRING_type_new(ty: c_int) -> *mut ASN1_STRING; Loading openssl-sys/src/openssl_shim.c +27 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,33 @@ #include <openssl/dh.h> #include <openssl/bn.h> #if defined(__APPLE__) || defined(__linux) #include<pthread.h> #include<openssl/crypto.h> unsigned long thread_id() { unsigned long ret = (unsigned long)pthread_self(); return ret; } void rust_openssl_set_id_callback() { CRYPTO_set_id_callback((unsigned long (*)())thread_id); } #else // Openssl already handles Windows directly, so we don't // need to explicitly set it void rust_openssl_set_id_callback() { // We don't know how to set the callback for arbitrary OSes // Let openssl use its defaults and hope they work. } #endif #if OPENSSL_VERSION_NUMBER < 0x1000000L // Copied from openssl crypto/hmac/hmac.c int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx) Loading Loading
openssl-sys/src/lib.rs +2 −0 Original line number Diff line number Diff line Loading @@ -270,6 +270,7 @@ pub fn init() { GUARDS = mem::transmute(guards); CRYPTO_set_locking_callback(locking_function); unsafe{ rust_openssl_set_id_callback(); } }) } } Loading @@ -290,6 +291,7 @@ pub unsafe fn SSL_CTX_clear_options(ssl: *mut SSL_CTX, op: u64) -> u64 { extern "C" { fn rust_openssl_ssl_ctx_options_rust_to_c(rustval: u64) -> c_long; fn rust_openssl_ssl_ctx_options_c_to_rust(cval: c_long) -> u64; fn rust_openssl_set_id_callback(); pub fn ASN1_INTEGER_set(dest: *mut ASN1_INTEGER, value: c_long) -> c_int; pub fn ASN1_STRING_type_new(ty: c_int) -> *mut ASN1_STRING; Loading
openssl-sys/src/openssl_shim.c +27 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,33 @@ #include <openssl/dh.h> #include <openssl/bn.h> #if defined(__APPLE__) || defined(__linux) #include<pthread.h> #include<openssl/crypto.h> unsigned long thread_id() { unsigned long ret = (unsigned long)pthread_self(); return ret; } void rust_openssl_set_id_callback() { CRYPTO_set_id_callback((unsigned long (*)())thread_id); } #else // Openssl already handles Windows directly, so we don't // need to explicitly set it void rust_openssl_set_id_callback() { // We don't know how to set the callback for arbitrary OSes // Let openssl use its defaults and hope they work. } #endif #if OPENSSL_VERSION_NUMBER < 0x1000000L // Copied from openssl crypto/hmac/hmac.c int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx) Loading