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
b605d822
Commit
b605d822
authored
Jun 23, 2023
by
Hans Leidekker
Committed by
Alexandre Julliard
Jul 06, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
secur32: Reduce indentation level in schan_QueryContextAttributesA/W().
parent
472150bf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
42 deletions
+23
-42
schannel.c
dlls/secur32/schannel.c
+23
-42
No files found.
dlls/secur32/schannel.c
View file @
b605d822
...
...
@@ -1150,13 +1150,12 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW(
struct
schan_context
*
ctx
;
SECURITY_STATUS
status
;
TRACE
(
"context_handle %p, attribute %#lx, buffer %p
\n
"
,
context_handle
,
attribute
,
buffer
);
TRACE
(
"context_handle %p, attribute %#lx, buffer %p
\n
"
,
context_handle
,
attribute
,
buffer
);
if
(
!
context_handle
||
!
(
ctx
=
schan_get_object
(
context_handle
->
dwLower
,
SCHAN_HANDLE_CTX
)))
return
SEC_E_INVALID_HANDLE
;
switch
(
attribute
)
switch
(
attribute
)
{
case
SECPKG_ATTR_STREAM_SIZES
:
{
...
...
@@ -1205,10 +1204,7 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW(
{
PCCERT_CONTEXT
*
cert
=
buffer
;
status
=
ensure_remote_cert
(
ctx
);
if
(
status
!=
SEC_E_OK
)
return
status
;
if
((
status
=
ensure_remote_cert
(
ctx
))
!=
SEC_E_OK
)
return
status
;
*
cert
=
CertDuplicateCertificateContext
(
ctx
->
cert
);
return
SEC_E_OK
;
}
...
...
@@ -1220,42 +1216,36 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW(
}
case
SECPKG_ATTR_ENDPOINT_BINDINGS
:
{
static
const
char
prefix
[]
=
"tls-server-end-point:"
;
SecPkgContext_Bindings
*
bindings
=
buffer
;
CCRYPT_OID_INFO
*
info
;
ALG_ID
hash_alg
=
CALG_SHA_256
;
BYTE
hash
[
1024
];
DWORD
hash_size
;
char
*
p
;
BOOL
r
;
static
const
char
prefix
[]
=
"tls-server-end-point:"
;
BOOL
ret
;
status
=
ensure_remote_cert
(
ctx
);
if
(
status
!=
SEC_E_OK
)
return
status
;
if
((
status
=
ensure_remote_cert
(
ctx
))
!=
SEC_E_OK
)
return
status
;
/* RFC 5929 */
info
=
CryptFindOIDInfo
(
CRYPT_OID_INFO_OID_KEY
,
ctx
->
cert
->
pCertInfo
->
SignatureAlgorithm
.
pszObjId
,
0
);
if
(
info
&&
info
->
u
.
Algid
!=
CALG_SHA1
&&
info
->
u
.
Algid
!=
CALG_MD5
)
hash_alg
=
info
->
u
.
Algid
;
if
(
info
&&
info
->
u
.
Algid
!=
CALG_SHA1
&&
info
->
u
.
Algid
!=
CALG_MD5
)
hash_alg
=
info
->
u
.
Algid
;
hash_size
=
sizeof
(
hash
);
r
=
CryptHashCertificate
(
0
,
hash_alg
,
0
,
ctx
->
cert
->
pbCertEncoded
,
ctx
->
cert
->
cbCertEncoded
,
hash
,
&
hash_size
);
if
(
!
r
)
return
GetLastError
();
ret
=
CryptHashCertificate
(
0
,
hash_alg
,
0
,
ctx
->
cert
->
pbCertEncoded
,
ctx
->
cert
->
cbCertEncoded
,
hash
,
&
hash_size
);
if
(
!
ret
)
return
GetLastError
();
bindings
->
BindingsLength
=
sizeof
(
*
bindings
->
Bindings
)
+
sizeof
(
prefix
)
-
1
+
hash_size
;
bindings
->
BindingsLength
=
sizeof
(
*
bindings
->
Bindings
)
+
sizeof
(
prefix
)
-
1
+
hash_size
;
/* freed with FreeContextBuffer */
bindings
->
Bindings
=
RtlAllocateHeap
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
bindings
->
BindingsLength
);
if
(
!
bindings
->
Bindings
)
return
SEC_E_INSUFFICIENT_MEMORY
;
if
(
!
bindings
->
Bindings
)
return
SEC_E_INSUFFICIENT_MEMORY
;
bindings
->
Bindings
->
cbApplicationDataLength
=
sizeof
(
prefix
)
-
1
+
hash_size
;
bindings
->
Bindings
->
cbApplicationDataLength
=
sizeof
(
prefix
)
-
1
+
hash_size
;
bindings
->
Bindings
->
dwApplicationDataOffset
=
sizeof
(
*
bindings
->
Bindings
);
p
=
(
char
*
)(
bindings
->
Bindings
+
1
);
memcpy
(
p
,
prefix
,
sizeof
(
prefix
)
-
1
);
p
+=
sizeof
(
prefix
)
-
1
;
p
=
(
char
*
)(
bindings
->
Bindings
+
1
);
memcpy
(
p
,
prefix
,
sizeof
(
prefix
)
-
1
);
p
+=
sizeof
(
prefix
)
-
1
;
memcpy
(
p
,
hash
,
hash_size
);
return
SEC_E_OK
;
}
...
...
@@ -1270,18 +1260,17 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW(
if
(
GNUTLS_CALL
(
get_unique_channel_binding
,
&
params
)
!=
SEC_E_BUFFER_TOO_SMALL
)
return
SEC_E_INTERNAL_ERROR
;
bindings
->
BindingsLength
=
sizeof
(
*
bindings
->
Bindings
)
+
sizeof
(
prefix
)
-
1
+
size
;
bindings
->
BindingsLength
=
sizeof
(
*
bindings
->
Bindings
)
+
sizeof
(
prefix
)
-
1
+
size
;
/* freed with FreeContextBuffer */
bindings
->
Bindings
=
RtlAllocateHeap
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
bindings
->
BindingsLength
);
if
(
!
bindings
->
Bindings
)
return
SEC_E_INSUFFICIENT_MEMORY
;
if
(
!
bindings
->
Bindings
)
return
SEC_E_INSUFFICIENT_MEMORY
;
bindings
->
Bindings
->
cbApplicationDataLength
=
sizeof
(
prefix
)
-
1
+
size
;
bindings
->
Bindings
->
cbApplicationDataLength
=
sizeof
(
prefix
)
-
1
+
size
;
bindings
->
Bindings
->
dwApplicationDataOffset
=
sizeof
(
*
bindings
->
Bindings
);
p
=
(
char
*
)(
bindings
->
Bindings
+
1
);
memcpy
(
p
,
prefix
,
sizeof
(
prefix
)
-
1
);
p
+=
sizeof
(
prefix
)
-
1
;
p
=
(
char
*
)(
bindings
->
Bindings
+
1
);
memcpy
(
p
,
prefix
,
sizeof
(
prefix
)
-
1
);
p
+=
sizeof
(
prefix
)
-
1
;
params
.
buffer
=
p
;
return
GNUTLS_CALL
(
get_unique_channel_binding
,
&
params
);
}
...
...
@@ -1297,7 +1286,6 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW(
struct
get_cipher_info_params
params
=
{
ctx
->
session
,
info
};
return
GNUTLS_CALL
(
get_cipher_info
,
&
params
);
}
default:
FIXME
(
"Unhandled attribute %#lx
\n
"
,
attribute
);
return
SEC_E_UNSUPPORTED_FUNCTION
;
...
...
@@ -1307,13 +1295,10 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW(
static
SECURITY_STATUS
SEC_ENTRY
schan_QueryContextAttributesA
(
PCtxtHandle
context_handle
,
ULONG
attribute
,
PVOID
buffer
)
{
TRACE
(
"context_handle %p, attribute %#lx, buffer %p
\n
"
,
context_handle
,
attribute
,
buffer
);
TRACE
(
"context_handle %p, attribute %#lx, buffer %p
\n
"
,
context_handle
,
attribute
,
buffer
);
switch
(
attribute
)
{
case
SECPKG_ATTR_STREAM_SIZES
:
return
schan_QueryContextAttributesW
(
context_handle
,
attribute
,
buffer
);
case
SECPKG_ATTR_KEY_INFO
:
{
SECURITY_STATUS
status
=
schan_QueryContextAttributesW
(
context_handle
,
attribute
,
buffer
);
...
...
@@ -1325,16 +1310,12 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesA(
}
return
status
;
}
case
SECPKG_ATTR_STREAM_SIZES
:
case
SECPKG_ATTR_REMOTE_CERT_CONTEXT
:
return
schan_QueryContextAttributesW
(
context_handle
,
attribute
,
buffer
);
case
SECPKG_ATTR_CONNECTION_INFO
:
return
schan_QueryContextAttributesW
(
context_handle
,
attribute
,
buffer
);
case
SECPKG_ATTR_ENDPOINT_BINDINGS
:
return
schan_QueryContextAttributesW
(
context_handle
,
attribute
,
buffer
);
case
SECPKG_ATTR_UNIQUE_BINDINGS
:
return
schan_QueryContextAttributesW
(
context_handle
,
attribute
,
buffer
);
case
SECPKG_ATTR_APPLICATION_PROTOCOL
:
return
schan_QueryContextAttributesW
(
context_handle
,
attribute
,
buffer
);
case
SECPKG_ATTR_CIPHER_INFO
:
return
schan_QueryContextAttributesW
(
context_handle
,
attribute
,
buffer
);
...
...
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