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
a71062b9
Commit
a71062b9
authored
Aug 17, 2017
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcrypt: Support BCRYPT_KEY_LENGTHS property for AES.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ab575f3d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
bcrypt_main.c
dlls/bcrypt/bcrypt_main.c
+13
-0
bcrypt.c
dlls/bcrypt/tests/bcrypt.c
+20
-0
No files found.
dlls/bcrypt/bcrypt_main.c
View file @
a71062b9
...
...
@@ -474,6 +474,19 @@ static NTSTATUS get_alg_property( enum alg_id id, const WCHAR *prop, UCHAR *buf,
return
STATUS_BUFFER_TOO_SMALL
;
}
}
if
(
!
strcmpW
(
prop
,
BCRYPT_KEY_LENGTHS
))
{
BCRYPT_KEY_LENGTHS_STRUCT
*
key_lengths
=
(
void
*
)
buf
;
*
ret_size
=
sizeof
(
*
key_lengths
);
if
(
key_lengths
&&
size
<
*
ret_size
)
return
STATUS_BUFFER_TOO_SMALL
;
if
(
key_lengths
)
{
key_lengths
->
dwMinLength
=
128
;
key_lengths
->
dwMaxLength
=
256
;
key_lengths
->
dwIncrement
=
64
;
}
return
STATUS_SUCCESS
;
}
break
;
default:
...
...
dlls/bcrypt/tests/bcrypt.c
View file @
a71062b9
...
...
@@ -700,6 +700,7 @@ static void test_rng(void)
static
void
test_aes
(
void
)
{
BCRYPT_KEY_LENGTHS_STRUCT
key_lengths
;
BCRYPT_ALG_HANDLE
alg
;
ULONG
size
,
len
;
UCHAR
mode
[
64
];
...
...
@@ -733,6 +734,15 @@ static void test_aes(void)
ok
(
!
lstrcmpW
((
const
WCHAR
*
)
mode
,
BCRYPT_CHAIN_MODE_CBC
),
"got %s
\n
"
,
mode
);
ok
(
size
==
64
,
"got %u
\n
"
,
size
);
size
=
0
;
memset
(
&
key_lengths
,
0
,
sizeof
(
key_lengths
));
ret
=
BCryptGetProperty
(
alg
,
BCRYPT_KEY_LENGTHS
,
(
UCHAR
*
)
&
key_lengths
,
sizeof
(
key_lengths
),
&
size
,
0
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
ok
(
size
==
sizeof
(
key_lengths
),
"got %u
\n
"
,
size
);
ok
(
key_lengths
.
dwMinLength
==
128
,
"Expected 128, got %d
\n
"
,
key_lengths
.
dwMinLength
);
ok
(
key_lengths
.
dwMaxLength
==
256
,
"Expected 256, got %d
\n
"
,
key_lengths
.
dwMaxLength
);
ok
(
key_lengths
.
dwIncrement
==
64
,
"Expected 64, got %d
\n
"
,
key_lengths
.
dwIncrement
);
test_alg_name
(
alg
,
"AES"
);
ret
=
pBCryptCloseAlgorithmProvider
(
alg
,
0
);
...
...
@@ -962,6 +972,7 @@ static void test_BCryptDecrypt(void)
{
0xc6
,
0xa1
,
0x3b
,
0x37
,
0x87
,
0x8f
,
0x5b
,
0x82
,
0x6f
,
0x4f
,
0x81
,
0x62
,
0xa1
,
0xc8
,
0xd8
,
0x79
,
0xb1
,
0xa2
,
0x92
,
0x73
,
0xbe
,
0x2c
,
0x42
,
0x07
,
0xa5
,
0xac
,
0xe3
,
0x93
,
0x39
,
0x8c
,
0xb6
,
0xfb
,
0x87
,
0x5d
,
0xea
,
0xa3
,
0x7e
,
0x0f
,
0xde
,
0xfa
,
0xd9
,
0xec
,
0x6c
,
0x4e
,
0x3c
,
0x76
,
0x86
,
0xe4
};
BCRYPT_KEY_LENGTHS_STRUCT
key_lengths
;
BCRYPT_ALG_HANDLE
aes
;
BCRYPT_KEY_HANDLE
key
;
UCHAR
*
buf
,
plaintext
[
48
],
ivbuf
[
16
];
...
...
@@ -971,6 +982,15 @@ static void test_BCryptDecrypt(void)
ret
=
pBCryptOpenAlgorithmProvider
(
&
aes
,
BCRYPT_AES_ALGORITHM
,
NULL
,
0
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
size
=
0
;
memset
(
&
key_lengths
,
0
,
sizeof
(
key_lengths
));
ret
=
BCryptGetProperty
(
aes
,
BCRYPT_KEY_LENGTHS
,
(
UCHAR
*
)
&
key_lengths
,
sizeof
(
key_lengths
),
&
size
,
0
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
ok
(
size
==
sizeof
(
key_lengths
),
"got %u
\n
"
,
size
);
ok
(
key_lengths
.
dwMinLength
==
128
,
"Expected 128, got %d
\n
"
,
key_lengths
.
dwMinLength
);
ok
(
key_lengths
.
dwMaxLength
==
256
,
"Expected 256, got %d
\n
"
,
key_lengths
.
dwMaxLength
);
ok
(
key_lengths
.
dwIncrement
==
64
,
"Expected 64, got %d
\n
"
,
key_lengths
.
dwIncrement
);
len
=
0xdeadbeef
;
size
=
sizeof
(
len
);
ret
=
pBCryptGetProperty
(
aes
,
BCRYPT_OBJECT_LENGTH
,
(
UCHAR
*
)
&
len
,
sizeof
(
len
),
&
size
,
0
);
...
...
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