Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
bc20b546
Commit
bc20b546
authored
Mar 10, 2017
by
Sebastian Lackner
Committed by
Alexandre Julliard
Mar 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcrypt/tests: Add basic tests for BCryptDuplicateHash.
Signed-off-by:
Sebastian Lackner
<
sebastian@fds-team.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
da8853f0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
2 deletions
+27
-2
bcrypt.c
dlls/bcrypt/tests/bcrypt.c
+27
-2
No files found.
dlls/bcrypt/tests/bcrypt.c
View file @
bc20b546
...
@@ -33,6 +33,7 @@ static NTSTATUS (WINAPI *pBCryptCreateHash)(BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDL
...
@@ -33,6 +33,7 @@ static NTSTATUS (WINAPI *pBCryptCreateHash)(BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDL
ULONG
,
ULONG
);
ULONG
,
ULONG
);
static
NTSTATUS
(
WINAPI
*
pBCryptHash
)(
BCRYPT_ALG_HANDLE
,
UCHAR
*
,
ULONG
,
UCHAR
*
,
ULONG
,
UCHAR
*
,
ULONG
);
static
NTSTATUS
(
WINAPI
*
pBCryptHash
)(
BCRYPT_ALG_HANDLE
,
UCHAR
*
,
ULONG
,
UCHAR
*
,
ULONG
,
UCHAR
*
,
ULONG
);
static
NTSTATUS
(
WINAPI
*
pBCryptHashData
)(
BCRYPT_HASH_HANDLE
,
PUCHAR
,
ULONG
,
ULONG
);
static
NTSTATUS
(
WINAPI
*
pBCryptHashData
)(
BCRYPT_HASH_HANDLE
,
PUCHAR
,
ULONG
,
ULONG
);
static
NTSTATUS
(
WINAPI
*
pBCryptDuplicateHash
)(
BCRYPT_HASH_HANDLE
,
BCRYPT_HASH_HANDLE
*
,
UCHAR
*
,
ULONG
,
ULONG
);
static
NTSTATUS
(
WINAPI
*
pBCryptFinishHash
)(
BCRYPT_HASH_HANDLE
,
PUCHAR
,
ULONG
,
ULONG
);
static
NTSTATUS
(
WINAPI
*
pBCryptFinishHash
)(
BCRYPT_HASH_HANDLE
,
PUCHAR
,
ULONG
,
ULONG
);
static
NTSTATUS
(
WINAPI
*
pBCryptDestroyHash
)(
BCRYPT_HASH_HANDLE
);
static
NTSTATUS
(
WINAPI
*
pBCryptDestroyHash
)(
BCRYPT_HASH_HANDLE
);
static
NTSTATUS
(
WINAPI
*
pBCryptGenRandom
)(
BCRYPT_ALG_HANDLE
,
PUCHAR
,
ULONG
,
ULONG
);
static
NTSTATUS
(
WINAPI
*
pBCryptGenRandom
)(
BCRYPT_ALG_HANDLE
,
PUCHAR
,
ULONG
,
ULONG
);
...
@@ -208,9 +209,9 @@ static void test_sha1(void)
...
@@ -208,9 +209,9 @@ static void test_sha1(void)
{
{
static
const
char
expected
[]
=
"961fa64958818f767707072755d7018dcd278e94"
;
static
const
char
expected
[]
=
"961fa64958818f767707072755d7018dcd278e94"
;
static
const
char
expected_hmac
[]
=
"2472cf65d0e090618d769d3e46f0d9446cf212da"
;
static
const
char
expected_hmac
[]
=
"2472cf65d0e090618d769d3e46f0d9446cf212da"
;
UCHAR
buf
[
512
],
buf_hmac
[
1024
],
buf_hmac2
[
1024
],
sha1
[
20
],
sha1_hmac
[
20
];
BCRYPT_HASH_HANDLE
hash
,
hash2
;
BCRYPT_ALG_HANDLE
alg
;
BCRYPT_ALG_HANDLE
alg
;
BCRYPT_HASH_HANDLE
hash
;
UCHAR
buf
[
512
],
buf_hmac
[
1024
],
sha1
[
20
],
sha1_hmac
[
20
];
char
str
[
41
];
char
str
[
41
];
NTSTATUS
ret
;
NTSTATUS
ret
;
ULONG
len
;
ULONG
len
;
...
@@ -268,6 +269,29 @@ static void test_sha1(void)
...
@@ -268,6 +269,29 @@ static void test_sha1(void)
test_hash_length
(
hash
,
20
);
test_hash_length
(
hash
,
20
);
test_alg_name
(
hash
,
"SHA1"
);
test_alg_name
(
hash
,
"SHA1"
);
len
=
sizeof
(
buf_hmac2
);
ret
=
pBCryptDuplicateHash
(
NULL
,
&
hash2
,
buf_hmac2
,
len
,
0
);
ok
(
ret
==
STATUS_INVALID_HANDLE
,
"got %08x
\n
"
,
ret
);
len
=
sizeof
(
buf_hmac2
);
ret
=
pBCryptDuplicateHash
(
hash
,
NULL
,
buf_hmac2
,
len
,
0
);
ok
(
ret
==
STATUS_INVALID_PARAMETER
,
"got %08x
\n
"
,
ret
);
hash2
=
NULL
;
len
=
sizeof
(
buf_hmac2
);
ret
=
pBCryptDuplicateHash
(
hash
,
&
hash2
,
buf_hmac2
,
len
,
0
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
ok
(
hash2
!=
NULL
,
"hash not set
\n
"
);
memset
(
sha1_hmac
,
0
,
sizeof
(
sha1_hmac
));
ret
=
pBCryptFinishHash
(
hash2
,
sha1_hmac
,
sizeof
(
sha1_hmac
),
0
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
format_hash
(
sha1_hmac
,
sizeof
(
sha1_hmac
),
str
);
ok
(
!
strcmp
(
str
,
expected_hmac
),
"got %s
\n
"
,
str
);
ret
=
pBCryptDestroyHash
(
hash2
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
memset
(
sha1_hmac
,
0
,
sizeof
(
sha1_hmac
));
memset
(
sha1_hmac
,
0
,
sizeof
(
sha1_hmac
));
ret
=
pBCryptFinishHash
(
hash
,
sha1_hmac
,
sizeof
(
sha1_hmac
),
0
);
ret
=
pBCryptFinishHash
(
hash
,
sha1_hmac
,
sizeof
(
sha1_hmac
),
0
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
...
@@ -990,6 +1014,7 @@ START_TEST(bcrypt)
...
@@ -990,6 +1014,7 @@ START_TEST(bcrypt)
pBCryptCreateHash
=
(
void
*
)
GetProcAddress
(
module
,
"BCryptCreateHash"
);
pBCryptCreateHash
=
(
void
*
)
GetProcAddress
(
module
,
"BCryptCreateHash"
);
pBCryptHash
=
(
void
*
)
GetProcAddress
(
module
,
"BCryptHash"
);
pBCryptHash
=
(
void
*
)
GetProcAddress
(
module
,
"BCryptHash"
);
pBCryptHashData
=
(
void
*
)
GetProcAddress
(
module
,
"BCryptHashData"
);
pBCryptHashData
=
(
void
*
)
GetProcAddress
(
module
,
"BCryptHashData"
);
pBCryptDuplicateHash
=
(
void
*
)
GetProcAddress
(
module
,
"BCryptDuplicateHash"
);
pBCryptFinishHash
=
(
void
*
)
GetProcAddress
(
module
,
"BCryptFinishHash"
);
pBCryptFinishHash
=
(
void
*
)
GetProcAddress
(
module
,
"BCryptFinishHash"
);
pBCryptDestroyHash
=
(
void
*
)
GetProcAddress
(
module
,
"BCryptDestroyHash"
);
pBCryptDestroyHash
=
(
void
*
)
GetProcAddress
(
module
,
"BCryptDestroyHash"
);
pBCryptGenRandom
=
(
void
*
)
GetProcAddress
(
module
,
"BCryptGenRandom"
);
pBCryptGenRandom
=
(
void
*
)
GetProcAddress
(
module
,
"BCryptGenRandom"
);
...
...
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