Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2f09686f
Commit
2f09686f
authored
Oct 07, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Oct 08, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Set callbacks needed by OpenSSL for multithreaded use.
parent
55423d8d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
net.c
dlls/winhttp/net.c
+49
-0
No files found.
dlls/winhttp/net.c
View file @
2f09686f
...
...
@@ -111,11 +111,29 @@ MAKE_FUNCPTR( SSL_get_peer_certificate );
MAKE_FUNCPTR
(
SSL_CTX_set_default_verify_paths
);
MAKE_FUNCPTR
(
BIO_new_fp
);
MAKE_FUNCPTR
(
CRYPTO_num_locks
);
MAKE_FUNCPTR
(
CRYPTO_set_id_callback
);
MAKE_FUNCPTR
(
CRYPTO_set_locking_callback
);
MAKE_FUNCPTR
(
ERR_get_error
);
MAKE_FUNCPTR
(
ERR_error_string
);
MAKE_FUNCPTR
(
i2d_X509
);
#undef MAKE_FUNCPTR
static
CRITICAL_SECTION
*
ssl_locks
;
static
unsigned
long
ssl_thread_id
(
void
)
{
return
GetCurrentThreadId
();
}
static
void
ssl_lock_callback
(
int
mode
,
int
type
,
const
char
*
file
,
int
line
)
{
if
(
mode
&
CRYPTO_LOCK
)
EnterCriticalSection
(
&
ssl_locks
[
type
]
);
else
LeaveCriticalSection
(
&
ssl_locks
[
type
]
);
}
#endif
/* translate a unix error code into a winsock error code */
...
...
@@ -187,6 +205,10 @@ static int sock_get_error( int err )
BOOL
netconn_init
(
netconn_t
*
conn
,
BOOL
secure
)
{
#if defined(SONAME_LIBSSL) && defined(SONAME_LIBCRYPTO)
int
i
;
#endif
conn
->
socket
=
-
1
;
if
(
!
secure
)
return
TRUE
;
...
...
@@ -245,6 +267,9 @@ BOOL netconn_init( netconn_t *conn, BOOL secure )
return FALSE; \
}
LOAD_FUNCPTR
(
BIO_new_fp
);
LOAD_FUNCPTR
(
CRYPTO_num_locks
);
LOAD_FUNCPTR
(
CRYPTO_set_id_callback
);
LOAD_FUNCPTR
(
CRYPTO_set_locking_callback
);
LOAD_FUNCPTR
(
ERR_get_error
);
LOAD_FUNCPTR
(
ERR_error_string
);
LOAD_FUNCPTR
(
i2d_X509
);
...
...
@@ -263,6 +288,20 @@ BOOL netconn_init( netconn_t *conn, BOOL secure )
LeaveCriticalSection
(
&
init_ssl_cs
);
return
FALSE
;
}
pCRYPTO_set_id_callback
(
ssl_thread_id
);
ssl_locks
=
HeapAlloc
(
GetProcessHeap
(),
0
,
pCRYPTO_num_locks
()
*
sizeof
(
HANDLE
));
if
(
!
ssl_locks
)
{
set_last_error
(
ERROR_OUTOFMEMORY
);
LeaveCriticalSection
(
&
init_ssl_cs
);
return
FALSE
;
}
for
(
i
=
0
;
i
<
pCRYPTO_num_locks
();
i
++
)
InitializeCriticalSection
(
&
ssl_locks
[
i
]
);
pCRYPTO_set_locking_callback
(
ssl_lock_callback
);
LeaveCriticalSection
(
&
init_ssl_cs
);
#else
WARN
(
"SSL support not compiled in.
\n
"
);
...
...
@@ -276,7 +315,17 @@ void netconn_unload( void )
{
#if defined(SONAME_LIBSSL) && defined(SONAME_LIBCRYPTO)
if
(
libcrypto_handle
)
{
if
(
ssl_locks
)
{
int
i
;
for
(
i
=
0
;
i
<
pCRYPTO_num_locks
();
i
++
)
DeleteCriticalSection
(
&
ssl_locks
[
i
]
);
HeapFree
(
GetProcessHeap
(),
0
,
ssl_locks
);
}
wine_dlclose
(
libcrypto_handle
,
NULL
,
0
);
}
if
(
libssl_handle
)
{
if
(
ctx
)
...
...
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