Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-openssl
Commits
6ac1e9e6
Commit
6ac1e9e6
authored
Jul 23, 2018
by
Ajay Nalawade
Committed by
Jeff Wendling
Jul 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set thread id callback as required by openssl.
parent
85c7f475
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
init_posix.go
init_posix.go
+8
-0
shim.c
shim.c
+3
-3
No files found.
init_posix.go
View file @
6ac1e9e6
...
@@ -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"
shim.c
View file @
6ac1e9e6
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment