Skip to content

Commit 1ca9507

Browse files
committed
Proper calls to diff versions of _bcrypt_derive_key_pbkdf2
1 parent eca2835 commit 1ca9507

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ _bcrypt_derive_key_pbkdf2 (mongoc_crypto_t *crypto,
199199
const uint8_t *salt,
200200
size_t salt_len,
201201
uint32_t iterations,
202-
size_t output_len,
203202
unsigned char *output)
204203
{
205204
uint8_t intermediate_digest[MONGOC_SCRAM_HASH_MAX_SIZE];
@@ -236,8 +235,13 @@ mongoc_crypto_cng_pbkdf2_hmac_sha1 (mongoc_crypto_t *crypto,
236235
size_t output_len,
237236
unsigned char *output)
238237
{
238+
#if defined(MONGOC_HAVE_BCRYPT_PBKDF2)
239239
return _bcrypt_derive_key_pbkdf2 (
240240
_sha1_hmac_algo, password, password_len, salt, salt_len, iterations, output_len, output);
241+
#else
242+
return _bcrypt_derive_key_pbkdf2 (
243+
crypto, password, password_len, salt, salt_len, iterations, output);
244+
#endif
241245
}
242246

243247
void
@@ -281,8 +285,13 @@ mongoc_crypto_cng_pbkdf2_hmac_sha256 (mongoc_crypto_t *crypto,
281285
size_t output_len,
282286
unsigned char *output)
283287
{
288+
#if defined(MONGOC_HAVE_BCRYPT_PBKDF2)
284289
return _bcrypt_derive_key_pbkdf2 (
285290
_sha256_hmac_algo, password, password_len, salt, salt_len, iterations, output_len, output);
291+
#else
292+
return _bcrypt_derive_key_pbkdf2 (
293+
crypto, password, password_len, salt, salt_len, iterations, output);
294+
#endif
286295
}
287296

288297
void

0 commit comments

Comments
 (0)