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
5118eb3a
Commit
5118eb3a
authored
Mar 22, 2018
by
Andrew Wesie
Committed by
Alexandre Julliard
Mar 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcrypt: Fix BCryptEncrypt with AES_GCM and no input and no output.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
aabc55c4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
bcrypt_main.c
dlls/bcrypt/bcrypt_main.c
+1
-1
bcrypt.c
dlls/bcrypt/tests/bcrypt.c
+18
-0
No files found.
dlls/bcrypt/bcrypt_main.c
View file @
5118eb3a
...
...
@@ -1440,7 +1440,7 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
*
ret_len
=
input_len
;
if
(
flags
&
BCRYPT_BLOCK_PADDING
)
return
STATUS_INVALID_PARAMETER
;
if
(
!
output
)
return
STATUS_SUCCESS
;
if
(
input
&&
!
output
)
return
STATUS_SUCCESS
;
if
(
output_len
<
*
ret_len
)
return
STATUS_BUFFER_TOO_SMALL
;
if
(
auth_info
->
pbAuthData
&&
(
status
=
key_set_auth_data
(
key
,
auth_info
->
pbAuthData
,
auth_info
->
cbAuthData
)))
...
...
dlls/bcrypt/tests/bcrypt.c
View file @
5118eb3a
...
...
@@ -647,6 +647,9 @@ static void test_BCryptEncrypt(void)
{
0x9a
,
0x92
,
0x32
,
0x2c
,
0x61
,
0x2a
,
0xae
,
0xef
,
0x66
,
0x2a
,
0xfb
,
0x55
,
0xe9
,
0x48
,
0xdf
,
0xbd
};
static
UCHAR
expected_tag3
[]
=
{
0x17
,
0x9d
,
0xc0
,
0x7a
,
0xf0
,
0xcf
,
0xaa
,
0xd5
,
0x1c
,
0x11
,
0xc4
,
0x4b
,
0xd6
,
0xa3
,
0x3e
,
0x77
};
static
UCHAR
expected_tag4
[]
=
{
0x4c
,
0x42
,
0x83
,
0x9e
,
0x8d
,
0x40
,
0xf1
,
0x19
,
0xd6
,
0x2b
,
0x1c
,
0x66
,
0x03
,
0x2b
,
0x39
,
0x63
};
BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO
auth_info
;
UCHAR
*
buf
,
ciphertext
[
48
],
ivbuf
[
16
],
tag
[
16
];
BCRYPT_AUTH_TAG_LENGTHS_STRUCT
tag_length
;
...
...
@@ -842,6 +845,21 @@ static void test_BCryptEncrypt(void)
for
(
i
=
0
;
i
<
16
;
i
++
)
ok
(
tag
[
i
]
==
expected_tag3
[
i
],
"%u: %02x != %02x
\n
"
,
i
,
tag
[
i
],
expected_tag3
[
i
]);
memset
(
tag
,
0xff
,
sizeof
(
tag
));
ret
=
pBCryptEncrypt
(
key
,
data2
,
0
,
&
auth_info
,
ivbuf
,
16
,
NULL
,
0
,
&
size
,
0
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
ok
(
!
size
,
"got %u
\n
"
,
size
);
for
(
i
=
0
;
i
<
16
;
i
++
)
ok
(
tag
[
i
]
==
0xff
,
"%u: %02x != %02x
\n
"
,
i
,
tag
[
i
],
0xff
);
memset
(
tag
,
0xff
,
sizeof
(
tag
));
ret
=
pBCryptEncrypt
(
key
,
NULL
,
0
,
&
auth_info
,
ivbuf
,
16
,
NULL
,
0
,
&
size
,
0
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
ok
(
!
size
,
"got %u
\n
"
,
size
);
ok
(
!
memcmp
(
tag
,
expected_tag4
,
sizeof
(
expected_tag4
)),
"wrong tag
\n
"
);
for
(
i
=
0
;
i
<
16
;
i
++
)
ok
(
tag
[
i
]
==
expected_tag4
[
i
],
"%u: %02x != %02x
\n
"
,
i
,
tag
[
i
],
expected_tag4
[
i
]);
/* test with padding */
memcpy
(
ivbuf
,
iv
,
sizeof
(
iv
));
memset
(
ciphertext
,
0
,
sizeof
(
ciphertext
));
...
...
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