Commit 6ac1e9e6 authored by Ajay Nalawade's avatar Ajay Nalawade Committed by Jeff Wendling

Set thread id callback as required by openssl.

parent 85c7f475
...@@ -60,5 +60,13 @@ void go_thread_locking_callback(int mode, int n, const char *file, ...@@ -60,5 +60,13 @@ void go_thread_locking_callback(int mode, int n, const char *file,
pthread_mutex_unlock(&goopenssl_locks[n]); pthread_mutex_unlock(&goopenssl_locks[n]);
} }
} }
unsigned long go_thread_id_callback(void)
{
unsigned long ret;
ret = (unsigned long)pthread_self();
return (ret);
}
*/ */
import "C" import "C"
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
*/ */
extern int go_init_locks(); extern int go_init_locks();
extern void go_thread_locking_callback(int, int, const char*, int); extern void go_thread_locking_callback(int, int, const char*, int);
extern unsigned long go_thread_id_callback();
static int go_write_bio_puts(BIO *b, const char *str) { static int go_write_bio_puts(BIO *b, const char *str) {
return go_write_bio_write(b, (char*)str, (int)strlen(str)); return go_write_bio_write(b, (char*)str, (int)strlen(str));
} }
...@@ -325,14 +326,13 @@ int X_shim_init() { ...@@ -325,14 +326,13 @@ int X_shim_init() {
SSL_library_init(); SSL_library_init();
OpenSSL_add_all_algorithms(); OpenSSL_add_all_algorithms();
// //
// Set up OPENSSL thread safety callbacks. We only set the locking // Set up OPENSSL thread safety callbacks.
// callback because the default id callback implementation is good
// enough for us.
rc = go_init_locks(); rc = go_init_locks();
if (rc != 0) { if (rc != 0) {
return rc; return rc;
} }
CRYPTO_set_locking_callback(go_thread_locking_callback); CRYPTO_set_locking_callback(go_thread_locking_callback);
CRYPTO_set_id_callback(go_thread_id_callback)
rc = x_bio_init_methods(); rc = x_bio_init_methods();
if (rc != 0) { if (rc != 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment