bcrypt: Correctly check the size in BCryptGetProperty.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
02a5071674
commit
1db5170f49
|
@ -532,7 +532,7 @@ static NTSTATUS get_alg_property( enum alg_id id, const WCHAR *prop, UCHAR *buf,
|
|||
}
|
||||
if (!strcmpW( prop, BCRYPT_CHAINING_MODE ))
|
||||
{
|
||||
if (size >= sizeof(BCRYPT_CHAIN_MODE_CBC))
|
||||
if (size >= sizeof(BCRYPT_CHAIN_MODE_CBC) * sizeof(WCHAR))
|
||||
{
|
||||
memcpy(buf, BCRYPT_CHAIN_MODE_CBC, sizeof(BCRYPT_CHAIN_MODE_CBC));
|
||||
*ret_size = sizeof(BCRYPT_CHAIN_MODE_CBC) * sizeof(WCHAR);
|
||||
|
|
|
@ -452,6 +452,12 @@ static void test_aes(void)
|
|||
ok(size == 64, "got %u\n", size);
|
||||
|
||||
size = 0;
|
||||
ret = pBCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode) - 1, &size, 0);
|
||||
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
|
||||
ok(size == 64, "got %u\n", size);
|
||||
|
||||
size = 0;
|
||||
memset(mode, 0, sizeof(mode));
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue