Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zsolt Vadász
wine
Commits
e1bfe4c1
Commit
e1bfe4c1
authored
18 years ago
by
Kai Blin
Committed by
Alexandre Julliard
18 years ago
Browse files
Options
Downloads
Patches
Plain Diff
secur32: Get rid of some HeapAlloc() calls to make code more readable.
parent
0c3f45ed
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/secur32/tests/ntlm.c
+26
-52
26 additions, 52 deletions
dlls/secur32/tests/ntlm.c
with
26 additions
and
52 deletions
dlls/secur32/tests/ntlm.c
+
26
−
52
View file @
e1bfe4c1
...
...
@@ -673,8 +673,8 @@ static void testSignSeal()
SspiData
client
,
server
;
SEC_WINNT_AUTH_IDENTITY
id
;
static
char
sec_pkg_name
[]
=
"NTLM"
;
P
SecBufferDesc
crypt
=
NULL
;
P
SecBuffer
data
=
NULL
,
fake_data
=
NULL
;
SecBufferDesc
crypt
;
SecBuffer
data
[
2
]
,
fake_data
[
2
]
;
ULONG
qop
=
0
;
SecPkgContext_Sizes
ctxt_sizes
;
...
...
@@ -731,22 +731,10 @@ static void testSignSeal()
goto
end
;
}
if
((
crypt
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
SecBufferDesc
)))
==
NULL
)
{
trace
(
"Failed to allocate the crypto buffer, aborting test.
\n
"
);
goto
end
;
}
crypt
.
ulVersion
=
SECBUFFER_VERSION
;
crypt
.
cBuffers
=
2
;
crypt
->
ulVersion
=
SECBUFFER_VERSION
;
crypt
->
cBuffers
=
2
;
if
((
fake_data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
SecBuffer
)
*
2
))
==
NULL
)
{
trace
(
"Failed to allocate the fake crypto buffer, aborting test.
\n
"
);
goto
end
;
}
crypt
->
pBuffers
=
fake_data
;
crypt
.
pBuffers
=
fake_data
;
fake_data
[
0
].
BufferType
=
SECBUFFER_DATA
;
fake_data
[
0
].
cbBuffer
=
ctxt_sizes
.
cbSecurityTrailer
;
...
...
@@ -756,19 +744,12 @@ static void testSignSeal()
fake_data
[
1
].
cbBuffer
=
lstrlen
(
message
);
fake_data
[
1
].
pvBuffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
fake_data
[
1
].
cbBuffer
);
sec_status
=
pMakeSignature
(
client
.
ctxt
,
0
,
crypt
,
0
);
ok
(
sec_status
==
SEC_E_INVALID_TOKEN
,
sec_status
=
pMakeSignature
(
client
.
ctxt
,
0
,
&
crypt
,
0
);
ok
(
sec_status
==
SEC_E_INVALID_TOKEN
,
"MakeSignature returned %s, not SEC_E_INVALID_TOKEN.
\n
"
,
getSecError
(
sec_status
));
if
((
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
SecBuffer
)
*
2
))
==
NULL
)
{
trace
(
"Failed to allocate the crypto buffer, aborting test.
\n
"
);
goto
end
;
}
crypt
->
pBuffers
=
data
;
crypt
.
pBuffers
=
data
;
data
[
0
].
BufferType
=
SECBUFFER_TOKEN
;
data
[
0
].
cbBuffer
=
ctxt_sizes
.
cbSecurityTrailer
;
...
...
@@ -783,47 +764,47 @@ static void testSignSeal()
* we should get the same signature for our data, no matter if
* it is sent by the client or the server
*/
sec_status
=
pMakeSignature
(
client
.
ctxt
,
0
,
crypt
,
0
);
sec_status
=
pMakeSignature
(
client
.
ctxt
,
0
,
&
crypt
,
0
);
ok
(
sec_status
==
SEC_E_OK
,
"MakeSignature returned %s, not SEC_E_OK.
\n
"
,
getSecError
(
sec_status
));
ok
(
!
memcmp
(
crypt
->
pBuffers
[
0
].
pvBuffer
,
message_signature
,
crypt
->
pBuffers
[
0
].
cbBuffer
),
"Signature is not as expected.
\n
"
);
ok
(
!
memcmp
(
crypt
.
pBuffers
[
0
].
pvBuffer
,
message_signature
,
crypt
.
pBuffers
[
0
].
cbBuffer
),
"Signature is not as expected.
\n
"
);
data
[
0
].
cbBuffer
=
sizeof
(
message_signature
);
memcpy
(
data
[
0
].
pvBuffer
,
crypt_trailer_client
,
data
[
0
].
cbBuffer
);
sec_status
=
pVerifySignature
(
client
.
ctxt
,
crypt
,
0
,
&
qop
);
sec_status
=
pVerifySignature
(
client
.
ctxt
,
&
crypt
,
0
,
&
qop
);
ok
(
sec_status
==
SEC_E_MESSAGE_ALTERED
,
"VerifySignature returned %s, not SEC_E_MESSAGE_ALTERED.
\n
"
,
getSecError
(
sec_status
));
memcpy
(
data
[
0
].
pvBuffer
,
message_signature
,
data
[
0
].
cbBuffer
);
sec_status
=
pVerifySignature
(
client
.
ctxt
,
crypt
,
0
,
&
qop
);
sec_status
=
pVerifySignature
(
client
.
ctxt
,
&
crypt
,
0
,
&
qop
);
ok
(
sec_status
==
SEC_E_OK
,
"VerifySignature returned %s, not SEC_E_OK.
\n
"
,
getSecError
(
sec_status
));
sec_status
=
pEncryptMessage
(
client
.
ctxt
,
0
,
crypt
,
0
);
sec_status
=
pEncryptMessage
(
client
.
ctxt
,
0
,
&
crypt
,
0
);
ok
(
sec_status
==
SEC_E_OK
,
"EncryptMessage returned %s, not SEC_E_OK.
\n
"
,
getSecError
(
sec_status
));
ok
(
!
memcmp
(
crypt
->
pBuffers
[
0
].
pvBuffer
,
crypt_trailer_client
,
crypt
->
pBuffers
[
0
].
cbBuffer
),
"Crypt trailer not as expected.
\n
"
);
ok
(
!
memcmp
(
crypt
->
pBuffers
[
1
].
pvBuffer
,
crypt_message_client
,
crypt
->
pBuffers
[
1
].
cbBuffer
),
"Crypt message not as expected.
\n
"
);
ok
(
!
memcmp
(
crypt
.
pBuffers
[
0
].
pvBuffer
,
crypt_trailer_client
,
crypt
.
pBuffers
[
0
].
cbBuffer
),
"Crypt trailer not as expected.
\n
"
);
ok
(
!
memcmp
(
crypt
.
pBuffers
[
1
].
pvBuffer
,
crypt_message_client
,
crypt
.
pBuffers
[
1
].
cbBuffer
),
"Crypt message not as expected.
\n
"
);
data
[
0
].
cbBuffer
=
sizeof
(
crypt_trailer_server
);
data
[
1
].
cbBuffer
=
sizeof
(
crypt_message_server
);
memcpy
(
data
[
0
].
pvBuffer
,
crypt_trailer_server
,
data
[
0
].
cbBuffer
);
memcpy
(
data
[
1
].
pvBuffer
,
crypt_message_server
,
data
[
1
].
cbBuffer
);
sec_status
=
pDecryptMessage
(
client
.
ctxt
,
crypt
,
0
,
&
qop
);
sec_status
=
pDecryptMessage
(
client
.
ctxt
,
&
crypt
,
0
,
&
qop
);
ok
(
sec_status
==
SEC_E_OK
,
"DecryptMessage returned %s, not SEC_E_OK.
\n
"
,
getSecError
(
sec_status
));
ok
(
!
memcmp
(
crypt
->
pBuffers
[
1
].
pvBuffer
,
message_binary
,
crypt
->
pBuffers
[
1
].
cbBuffer
),
ok
(
!
memcmp
(
crypt
.
pBuffers
[
1
].
pvBuffer
,
message_binary
,
crypt
.
pBuffers
[
1
].
cbBuffer
),
"Failed to decrypt message correctly.
\n
"
);
end:
...
...
@@ -832,18 +813,11 @@ end:
pDeleteSecurityContext
(
client
.
ctxt
);
pFreeCredentialsHandle
(
client
.
cred
);
if
(
fake_data
)
{
HeapFree
(
GetProcessHeap
(),
0
,
fake_data
[
0
].
pvBuffer
);
HeapFree
(
GetProcessHeap
(),
0
,
fake_data
[
1
].
pvBuffer
);
}
if
(
data
)
{
HeapFree
(
GetProcessHeap
(),
0
,
data
[
0
].
pvBuffer
);
HeapFree
(
GetProcessHeap
(),
0
,
data
[
1
].
pvBuffer
);
}
HeapFree
(
GetProcessHeap
(),
0
,
data
);
HeapFree
(
GetProcessHeap
(),
0
,
crypt
);
HeapFree
(
GetProcessHeap
(),
0
,
fake_data
[
0
].
pvBuffer
);
HeapFree
(
GetProcessHeap
(),
0
,
fake_data
[
1
].
pvBuffer
);
HeapFree
(
GetProcessHeap
(),
0
,
data
[
0
].
pvBuffer
);
HeapFree
(
GetProcessHeap
(),
0
,
data
[
1
].
pvBuffer
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment