@@ -184,22 +184,22 @@ _bcrypt_derive_key_pbkdf2 (BCRYPT_ALG_HANDLE prf,
184
184
bson_free (salt_copy );
185
185
186
186
if (!NT_SUCCESS (status )) {
187
- MONGOC_ERROR ("BCryptDeriveKeyPBKDF2 (): %ld" , status );
187
+ MONGOC_ERROR ("_bcrypt_derive_key_pbkdf2 (): %ld" , status );
188
188
return false;
189
189
}
190
190
return true;
191
191
}
192
192
193
193
#else
194
- /* Compute the SCRAM step Hi() as defined in RFC5802 */
194
+ /* Manually salts password if BCryptDeriveKeyPBKDF2 is unavailable */
195
195
static bool
196
196
_bcrypt_derive_key_pbkdf2 (mongoc_crypto_t * crypto ,
197
- const char * password ,
198
- size_t password_len ,
199
- const uint8_t * salt ,
200
- size_t salt_len ,
201
- uint32_t iterations ,
202
- unsigned char * output )
197
+ const char * password ,
198
+ size_t password_len ,
199
+ const uint8_t * salt ,
200
+ size_t salt_len ,
201
+ uint32_t iterations ,
202
+ unsigned char * output )
203
203
{
204
204
uint8_t intermediate_digest [MONGOC_SCRAM_HASH_MAX_SIZE ];
205
205
uint8_t start_key [MONGOC_SCRAM_HASH_MAX_SIZE ];
@@ -239,8 +239,7 @@ mongoc_crypto_cng_pbkdf2_hmac_sha1 (mongoc_crypto_t *crypto,
239
239
return _bcrypt_derive_key_pbkdf2 (
240
240
_sha1_hmac_algo , password , password_len , salt , salt_len , iterations , output_len , output );
241
241
#else
242
- return _bcrypt_derive_key_pbkdf2 (
243
- crypto , password , password_len , salt , salt_len , iterations , output );
242
+ return _bcrypt_derive_key_pbkdf2 (crypto , password , password_len , salt , salt_len , iterations , output );
244
243
#endif
245
244
}
246
245
@@ -289,8 +288,7 @@ mongoc_crypto_cng_pbkdf2_hmac_sha256 (mongoc_crypto_t *crypto,
289
288
return _bcrypt_derive_key_pbkdf2 (
290
289
_sha256_hmac_algo , password , password_len , salt , salt_len , iterations , output_len , output );
291
290
#else
292
- return _bcrypt_derive_key_pbkdf2 (
293
- crypto , password , password_len , salt , salt_len , iterations , output );
291
+ return _bcrypt_derive_key_pbkdf2 (crypto , password , password_len , salt , salt_len , iterations , output );
294
292
#endif
295
293
}
296
294
0 commit comments