From: Piotr Caban piotr@codeweavers.com
LibTomCrypt hash functions return CRYPT_INVALID_ARG when input buffer is NULL. --- dlls/bcrypt/bcrypt_main.c | 2 +- dlls/bcrypt/tests/bcrypt.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c index 8a4d595a7d0..bb27cfa00e3 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -2420,7 +2420,7 @@ static NTSTATUS pbkdf2( struct hash *hash, UCHAR *pwd, ULONG pwd_len, UCHAR *sal if (j == 0) { /* use salt || INT(i) */ - if (hash->desc->process( &hash->inner, salt, salt_len )) + if (salt_len && hash->desc->process( &hash->inner, salt, salt_len )) { free( buf ); return STATUS_INVALID_PARAMETER; diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c index dbb1f0f5bad..af49d76730e 100644 --- a/dlls/bcrypt/tests/bcrypt.c +++ b/dlls/bcrypt/tests/bcrypt.c @@ -486,6 +486,7 @@ static UCHAR dk3[] = "4b007901b765489abead49d926f721d065a429c1"; static UCHAR dk4[] = "364dd6bc200ec7d197f1b85f4a61769010717124"; static UCHAR dk5[] = "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038"; static UCHAR dk6[] = "56fa6aa75548099dcc37d7f03425e0c3"; +static UCHAR dk7[] = "8754c32c64b0f524fc50c00f788135de";
static const struct { @@ -503,7 +504,8 @@ static const struct { 8, 4, 4096, 20, password, salt, dk3 }, { 8, 4, 1000000, 20, password, salt, dk4 }, { 24, 36, 4096, 25, long_password, long_salt, dk5 }, - { 9, 5, 4096, 16, password_NUL, salt_NUL, dk6 } + { 9, 5, 4096, 16, password_NUL, salt_NUL, dk6 }, + { 8, 0, 1, 16, password, NULL, dk7 } };
static void test_BcryptDeriveKeyPBKDF2(void)