1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

bcrypt: Make DH blob size validation more strict in key_import_pair().

This commit is contained in:
Hans Leidekker 2023-12-07 12:30:08 +01:00 committed by Alexandre Julliard
parent 4becbefe5d
commit 3ef933c08f

View file

@ -1929,7 +1929,7 @@ static NTSTATUS key_import_pair( struct algorithm *alg, const WCHAR *type, BCRYP
{
BCRYPT_DH_KEY_BLOB *dh_blob = (BCRYPT_DH_KEY_BLOB *)input;
if (input_len < sizeof(*dh_blob)) return STATUS_INVALID_PARAMETER;
if (input_len != sizeof(*dh_blob) + dh_blob->cbKey * 4) return STATUS_INVALID_PARAMETER;
if (alg->id != ALG_ID_DH || dh_blob->dwMagic != BCRYPT_DH_PRIVATE_MAGIC)
return STATUS_NOT_SUPPORTED;
@ -1948,7 +1948,7 @@ static NTSTATUS key_import_pair( struct algorithm *alg, const WCHAR *type, BCRYP
{
BCRYPT_DH_KEY_BLOB *dh_blob = (BCRYPT_DH_KEY_BLOB *)input;
if (input_len < sizeof(*dh_blob)) return STATUS_INVALID_PARAMETER;
if (input_len != sizeof(*dh_blob) + dh_blob->cbKey * 3) return STATUS_INVALID_PARAMETER;
if (alg->id != ALG_ID_DH || dh_blob->dwMagic != BCRYPT_DH_PUBLIC_MAGIC)
return STATUS_NOT_SUPPORTED;