Skip to content

Commit e99d593

Browse files
committed
Return meaningful value from manual cng pbkdf2
1 parent 3e1b9af commit e99d593

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/libmongoc/src/mongoc/mongoc-crypto-cng.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,16 @@ _bcrypt_derive_key_pbkdf2 (BCRYPT_ALG_HANDLE algorithm,
212212
start_key[salt_len + 2] = 0;
213213
start_key[salt_len + 3] = 1;
214214

215-
_mongoc_crypto_cng_hmac_or_hash (algorithm, password, password_len, start_key, hash_size, output);
215+
if (!_mongoc_crypto_cng_hmac_or_hash (algorithm, password, password_len, start_key, hash_size, output)) {
216+
return false;
217+
}
216218
memcpy (intermediate_digest, output, hash_size);
217219

218220
for (uint32_t i = 2u; i <= iterations; i++) {
219-
_mongoc_crypto_cng_hmac_or_hash (algorithm, password, password_len, intermediate_digest, hash_size, output);
221+
if (!_mongoc_crypto_cng_hmac_or_hash (
222+
algorithm, password, password_len, intermediate_digest, hash_size, output)) {
223+
return false;
224+
}
220225

221226
for (int k = 0; k < hash_size; k++) {
222227
output[k] ^= intermediate_digest[k];

0 commit comments

Comments
 (0)