@@ -199,12 +199,11 @@ _bcrypt_derive_key_pbkdf2 (BCRYPT_ALG_HANDLE algorithm,
199
199
const uint8_t * salt ,
200
200
size_t salt_len ,
201
201
uint32_t iterations ,
202
- size_t output_len ,
202
+ size_t hash_size ,
203
203
unsigned char * output )
204
204
{
205
205
uint8_t intermediate_digest [MONGOC_SCRAM_HASH_MAX_SIZE ];
206
206
uint8_t start_key [MONGOC_SCRAM_HASH_MAX_SIZE ];
207
- const int hash_size = _crypto_hash_size (crypto );
208
207
209
208
memcpy (start_key , salt , salt_len );
210
209
start_key [salt_len ] = 0 ;
@@ -241,8 +240,13 @@ mongoc_crypto_cng_pbkdf2_hmac_sha1 (mongoc_crypto_t *crypto,
241
240
size_t output_len ,
242
241
unsigned char * output )
243
242
{
243
+ #if defined(MONGOC_HAVE_BCRYPT_PBKDF2 )
244
244
return _bcrypt_derive_key_pbkdf2 (
245
245
_sha1_hmac_algo , password , password_len , salt , salt_len , iterations , output_len , output );
246
+ #else
247
+ return _bcrypt_derive_key_pbkdf2 (
248
+ _sha1_hmac_algo , password , password_len , salt , salt_len , iterations , _crypto_hash_size (crypto ), output );
249
+ #endif
246
250
}
247
251
248
252
void
@@ -286,8 +290,13 @@ mongoc_crypto_cng_pbkdf2_hmac_sha256 (mongoc_crypto_t *crypto,
286
290
size_t output_len ,
287
291
unsigned char * output )
288
292
{
293
+ #if defined(MONGOC_HAVE_BCRYPT_PBKDF2 )
289
294
return _bcrypt_derive_key_pbkdf2 (
290
295
_sha256_hmac_algo , password , password_len , salt , salt_len , iterations , output_len , output );
296
+ #else
297
+ return _bcrypt_derive_key_pbkdf2 (
298
+ _sha256_hmac_algo , password , password_len , salt , salt_len , iterations , _crypto_hash_size (crypto ), output );
299
+ #endif
291
300
}
292
301
293
302
void
0 commit comments