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
9fcdc5ec
Commit
9fcdc5ec
authored
Dec 02, 2016
by
Hans Leidekker
Committed by
Alexandre Julliard
Dec 06, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcrypt/tests: Add AES provider tests.
Signed-off-by:
Bruno Jesus
<
00cpxxx@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8d8936cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
0 deletions
+62
-0
bcrypt.c
dlls/bcrypt/tests/bcrypt.c
+57
-0
bcrypt.h
include/bcrypt.h
+5
-0
No files found.
dlls/bcrypt/tests/bcrypt.c
View file @
9fcdc5ec
...
...
@@ -765,6 +765,62 @@ static void test_rng(void)
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
}
static
void
test_aes
(
void
)
{
BCRYPT_ALG_HANDLE
alg
;
ULONG
size
,
len
;
UCHAR
mode
[
64
];
NTSTATUS
ret
;
todo_wine
{
alg
=
NULL
;
ret
=
pBCryptOpenAlgorithmProvider
(
&
alg
,
BCRYPT_AES_ALGORITHM
,
MS_PRIMITIVE_PROVIDER
,
0
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
ok
(
alg
!=
NULL
,
"alg not set
\n
"
);
len
=
size
=
0
;
ret
=
pBCryptGetProperty
(
alg
,
BCRYPT_OBJECT_LENGTH
,
(
UCHAR
*
)
&
len
,
sizeof
(
len
),
&
size
,
0
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
if
(
sizeof
(
void
*
)
==
4
)
{
ok
(
len
==
618
/* >= Win 8 */
||
broken
(
len
==
610
)
/* Win 7 */
||
broken
(
len
==
582
)
/* < Win 7 */
,
"got %u
\n
"
,
len
);
ok
(
size
==
sizeof
(
len
),
"got %u
\n
"
,
size
);
}
else
{
ok
(
len
==
654
/* >= Win 8 */
||
broken
(
len
==
622
)
/* Win 7 */
||
broken
(
len
==
598
)
/* < Win 7 */
,
"got %u
\n
"
,
len
);
ok
(
size
==
sizeof
(
len
),
"got %u
\n
"
,
size
);
}
len
=
size
=
0
;
ret
=
pBCryptGetProperty
(
alg
,
BCRYPT_BLOCK_LENGTH
,
(
UCHAR
*
)
&
len
,
sizeof
(
len
),
&
size
,
0
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
ok
(
len
==
16
,
"got %u
\n
"
,
len
);
ok
(
size
==
sizeof
(
len
),
"got %u
\n
"
,
size
);
size
=
0
;
ret
=
pBCryptGetProperty
(
alg
,
BCRYPT_CHAINING_MODE
,
mode
,
0
,
&
size
,
0
);
ok
(
ret
==
STATUS_BUFFER_TOO_SMALL
,
"got %08x
\n
"
,
ret
);
ok
(
size
==
64
,
"got %u
\n
"
,
size
);
size
=
0
;
ret
=
pBCryptGetProperty
(
alg
,
BCRYPT_CHAINING_MODE
,
mode
,
sizeof
(
mode
),
&
size
,
0
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
ok
(
!
lstrcmpW
((
const
WCHAR
*
)
mode
,
BCRYPT_CHAIN_MODE_CBC
),
"got %s
\n
"
,
mode
);
ok
(
size
==
64
,
"got %u
\n
"
,
size
);
test_alg_name
(
alg
,
"AES"
);
ret
=
pBCryptCloseAlgorithmProvider
(
alg
,
0
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
}
}
START_TEST
(
bcrypt
)
{
HMODULE
module
;
...
...
@@ -795,6 +851,7 @@ START_TEST(bcrypt)
test_sha512
();
test_md5
();
test_rng
();
test_aes
();
if
(
pBCryptHash
)
/* >= Win 10 */
test_BcryptHash
();
...
...
include/bcrypt.h
View file @
9fcdc5ec
...
...
@@ -63,6 +63,7 @@ typedef LONG NTSTATUS;
#define MS_PLATFORM_CRYPTO_PROVIDER (const WCHAR [])\
{'M','i','c','r','o','s','o','f','t',' ','P','l','a','t','f','o','r','m',' ','C','r','y','p','t','o',' ','P','r','o','v','i','d','e','r',0}
#define BCRYPT_AES_ALGORITHM (const WCHAR []){'A','E','S',0}
#define BCRYPT_MD5_ALGORITHM (const WCHAR []){'M','D','5',0}
#define BCRYPT_RNG_ALGORITHM (const WCHAR []){'R','N','G',0}
#define BCRYPT_SHA1_ALGORITHM (const WCHAR []){'S','H','A','1',0}
...
...
@@ -70,6 +71,10 @@ typedef LONG NTSTATUS;
#define BCRYPT_SHA384_ALGORITHM (const WCHAR []){'S','H','A','3','8','4',0}
#define BCRYPT_SHA512_ALGORITHM (const WCHAR []){'S','H','A','5','1','2',0}
#define BCRYPT_CHAIN_MODE_NA (const WCHAR []){'C','h','a','i','n','i','n','g','M','o','d','e','N','/','A',0}
#define BCRYPT_CHAIN_MODE_CBC (const WCHAR []){'C','h','a','i','n','i','n','g','M','o','d','e','C','B','C',0}
#define BCRYPT_CHAIN_MODE_ECB (const WCHAR []){'C','h','a','i','n','i','n','g','M','o','d','e','E','C','B',0}
typedef
struct
_BCRYPT_ALGORITHM_IDENTIFIER
{
LPWSTR
pszName
;
...
...
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