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
64a7d235
Commit
64a7d235
authored
Sep 07, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Sep 08, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Implement WINHTTP_OPTION_SERVER_CERT_CONTEXT.
parent
3d8a9564
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
0 deletions
+65
-0
Makefile.in
dlls/winhttp/Makefile.in
+1
-0
net.c
dlls/winhttp/net.c
+46
-0
session.c
dlls/winhttp/session.c
+17
-0
winhttp_private.h
dlls/winhttp/winhttp_private.h
+1
-0
No files found.
dlls/winhttp/Makefile.in
View file @
64a7d235
...
...
@@ -5,6 +5,7 @@ VPATH = @srcdir@
MODULE
=
winhttp.dll
IMPORTLIB
=
winhttp
IMPORTS
=
wininet kernel32
DELAYIMPORTS
=
crypt32
C_SRCS
=
\
handle.c
\
...
...
dlls/winhttp/net.c
View file @
64a7d235
...
...
@@ -48,6 +48,7 @@
#include "windef.h"
#include "winbase.h"
#include "winhttp.h"
#include "wincrypt.h"
/* to avoid conflicts with the Unix socket headers */
#define USE_WS_PREFIX
...
...
@@ -102,6 +103,7 @@ MAKE_FUNCPTR( SSL_get_peer_certificate );
MAKE_FUNCPTR
(
SSL_CTX_get_timeout
);
MAKE_FUNCPTR
(
SSL_CTX_set_timeout
);
MAKE_FUNCPTR
(
SSL_CTX_set_default_verify_paths
);
MAKE_FUNCPTR
(
i2d_X509
);
MAKE_FUNCPTR
(
BIO_new_fp
);
MAKE_FUNCPTR
(
ERR_get_error
);
...
...
@@ -218,6 +220,7 @@ BOOL netconn_init( netconn_t *conn, BOOL secure )
LOAD_FUNCPTR
(
SSL_CTX_get_timeout
);
LOAD_FUNCPTR
(
SSL_CTX_set_timeout
);
LOAD_FUNCPTR
(
SSL_CTX_set_default_verify_paths
);
LOAD_FUNCPTR
(
i2d_X509
);
#undef LOAD_FUNCPTR
#define LOAD_FUNCPTR(x) \
...
...
@@ -616,3 +619,46 @@ BOOL netconn_resolve( WCHAR *hostnameW, INTERNET_PORT port, struct sockaddr_in *
#endif
return
TRUE
;
}
const
void
*
netconn_get_certificate
(
netconn_t
*
conn
)
{
#ifdef SONAME_LIBSSL
X509
*
cert
;
unsigned
char
*
buffer
,
*
p
;
int
len
;
BOOL
malloc
=
FALSE
;
const
CERT_CONTEXT
*
ret
;
if
(
!
conn
->
secure
)
return
NULL
;
if
(
!
(
cert
=
pSSL_get_peer_certificate
(
conn
->
ssl_conn
)))
return
NULL
;
p
=
NULL
;
if
((
len
=
pi2d_X509
(
cert
,
&
p
))
<
0
)
return
NULL
;
/*
* SSL 0.9.7 and above malloc the buffer if it is null.
* however earlier version do not and so we would need to alloc the buffer.
*
* see the i2d_X509 man page for more details.
*/
if
(
!
p
)
{
if
(
!
(
buffer
=
heap_alloc
(
len
)))
return
NULL
;
p
=
buffer
;
len
=
pi2d_X509
(
cert
,
&
p
);
}
else
{
buffer
=
p
;
malloc
=
TRUE
;
}
ret
=
CertCreateCertificateContext
(
X509_ASN_ENCODING
,
buffer
,
len
);
if
(
malloc
)
free
(
buffer
);
else
heap_free
(
buffer
);
return
ret
;
#else
return
NULL
;
#endif
}
dlls/winhttp/session.c
View file @
64a7d235
...
...
@@ -25,6 +25,7 @@
#include "windef.h"
#include "winbase.h"
#include "winhttp.h"
#include "wincrypt.h"
#include "winhttp_private.h"
...
...
@@ -264,6 +265,22 @@ static BOOL request_query_option( object_header_t *hdr, DWORD option, LPVOID buf
*
buflen
=
sizeof
(
DWORD
);
return
TRUE
;
}
case
WINHTTP_OPTION_SERVER_CERT_CONTEXT
:
{
const
CERT_CONTEXT
*
cert
;
request_t
*
request
=
(
request_t
*
)
hdr
;
if
(
!
(
cert
=
netconn_get_certificate
(
&
request
->
netconn
)))
return
FALSE
;
memcpy
(
buffer
,
cert
,
sizeof
(
CERT_CONTEXT
)
);
*
buflen
=
sizeof
(
cert
);
return
TRUE
;
}
case
WINHTTP_OPTION_SECURITY_KEY_BITNESS
:
{
*
(
DWORD
*
)
buffer
=
128
;
/* FIXME */
*
buflen
=
sizeof
(
DWORD
);
return
TRUE
;
}
default:
FIXME
(
"unimplemented option %u
\n
"
,
option
);
return
FALSE
;
...
...
dlls/winhttp/winhttp_private.h
View file @
64a7d235
...
...
@@ -143,6 +143,7 @@ BOOL netconn_recv( netconn_t *, void *, size_t, int, int * );
BOOL
netconn_resolve
(
WCHAR
*
,
INTERNET_PORT
,
struct
sockaddr_in
*
);
BOOL
netconn_secure_connect
(
netconn_t
*
);
BOOL
netconn_send
(
netconn_t
*
,
const
void
*
,
size_t
,
int
,
int
*
);
const
void
*
netconn_get_certificate
(
netconn_t
*
);
static
inline
void
*
heap_alloc
(
SIZE_T
size
)
{
...
...
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