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
3c98992f
Commit
3c98992f
authored
Oct 02, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Oct 02, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Set callbacks needed by OpenSSL for multithreaded use.
parent
41592569
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
netconnection.c
dlls/wininet/netconnection.c
+46
-0
No files found.
dlls/wininet/netconnection.c
View file @
3c98992f
...
@@ -138,11 +138,29 @@ MAKE_FUNCPTR(SSL_CTX_set_default_verify_paths);
...
@@ -138,11 +138,29 @@ MAKE_FUNCPTR(SSL_CTX_set_default_verify_paths);
/* OpenSSL's libcrypto functions that we use */
/* OpenSSL's libcrypto functions that we use */
MAKE_FUNCPTR
(
BIO_new_fp
);
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_get_error
);
MAKE_FUNCPTR
(
ERR_error_string
);
MAKE_FUNCPTR
(
ERR_error_string
);
MAKE_FUNCPTR
(
i2d_X509
);
MAKE_FUNCPTR
(
i2d_X509
);
#undef MAKE_FUNCPTR
#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
#endif
BOOL
NETCON_init
(
WININET_NETCONNECTION
*
connection
,
BOOL
useSSL
)
BOOL
NETCON_init
(
WININET_NETCONNECTION
*
connection
,
BOOL
useSSL
)
...
@@ -152,6 +170,8 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
...
@@ -152,6 +170,8 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
if
(
useSSL
)
if
(
useSSL
)
{
{
#if defined(SONAME_LIBSSL) && defined(SONAME_LIBCRYPTO)
#if defined(SONAME_LIBSSL) && defined(SONAME_LIBCRYPTO)
int
i
;
TRACE
(
"using SSL connection
\n
"
);
TRACE
(
"using SSL connection
\n
"
);
EnterCriticalSection
(
&
init_ssl_cs
);
EnterCriticalSection
(
&
init_ssl_cs
);
if
(
OpenSSL_ssl_handle
)
/* already initialized everything */
if
(
OpenSSL_ssl_handle
)
/* already initialized everything */
...
@@ -219,6 +239,9 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
...
@@ -219,6 +239,9 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
return FALSE; \
return FALSE; \
}
}
DYNCRYPTO
(
BIO_new_fp
);
DYNCRYPTO
(
BIO_new_fp
);
DYNCRYPTO
(
CRYPTO_num_locks
);
DYNCRYPTO
(
CRYPTO_set_id_callback
);
DYNCRYPTO
(
CRYPTO_set_locking_callback
);
DYNCRYPTO
(
ERR_get_error
);
DYNCRYPTO
(
ERR_get_error
);
DYNCRYPTO
(
ERR_error_string
);
DYNCRYPTO
(
ERR_error_string
);
DYNCRYPTO
(
i2d_X509
);
DYNCRYPTO
(
i2d_X509
);
...
@@ -238,6 +261,19 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
...
@@ -238,6 +261,19 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
LeaveCriticalSection
(
&
init_ssl_cs
);
LeaveCriticalSection
(
&
init_ssl_cs
);
return
FALSE
;
return
FALSE
;
}
}
pCRYPTO_set_id_callback
(
ssl_thread_id
);
ssl_locks
=
HeapAlloc
(
GetProcessHeap
(),
0
,
pCRYPTO_num_locks
()
*
sizeof
(
CRITICAL_SECTION
));
if
(
!
ssl_locks
)
{
INTERNET_SetLastError
(
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
);
LeaveCriticalSection
(
&
init_ssl_cs
);
#else
#else
FIXME
(
"can't use SSL, not compiled in.
\n
"
);
FIXME
(
"can't use SSL, not compiled in.
\n
"
);
...
@@ -252,7 +288,17 @@ void NETCON_unload(void)
...
@@ -252,7 +288,17 @@ void NETCON_unload(void)
{
{
#if defined(SONAME_LIBSSL) && defined(SONAME_LIBCRYPTO)
#if defined(SONAME_LIBSSL) && defined(SONAME_LIBCRYPTO)
if
(
OpenSSL_crypto_handle
)
if
(
OpenSSL_crypto_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
(
OpenSSL_crypto_handle
,
NULL
,
0
);
wine_dlclose
(
OpenSSL_crypto_handle
,
NULL
,
0
);
}
if
(
OpenSSL_ssl_handle
)
if
(
OpenSSL_ssl_handle
)
{
{
if
(
ctx
)
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