diff options
| author | Steven Fackler <[email protected]> | 2015-10-05 20:39:03 +0100 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2015-10-05 20:39:03 +0100 |
| commit | 201624a32dfa0bc5d47d22280ad0fc11cbe8ea8b (patch) | |
| tree | 752164b5a4f61dde2ae70a8fcc8815ac05e3bfa0 /openssl-sys/src/openssl_shim.c | |
| parent | Merge pull request #279 from jtdowney/sslv23_docs (diff) | |
| parent | Set threadid_func on linux/osx (fixes #281) (diff) | |
| download | rust-openssl-201624a32dfa0bc5d47d22280ad0fc11cbe8ea8b.tar.xz rust-openssl-201624a32dfa0bc5d47d22280ad0fc11cbe8ea8b.zip | |
Merge pull request #282 from Manishearth/threadid
Set threadid_func on linux/osx (fixes #281)
Diffstat (limited to 'openssl-sys/src/openssl_shim.c')
| -rw-r--r-- | openssl-sys/src/openssl_shim.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/openssl-sys/src/openssl_shim.c b/openssl-sys/src/openssl_shim.c index 7fabe06e..abfa3918 100644 --- a/openssl-sys/src/openssl_shim.c +++ b/openssl-sys/src/openssl_shim.c @@ -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) |