@@ -155,8 +155,8 @@ _crypto_hash_size (mongoc_crypto_t *crypto)
155
155
}
156
156
}
157
157
158
- /* Wrapper for BCryptDeriveKeyPBKDF2 */
159
158
#if defined(MONGOC_HAVE_BCRYPT_PBKDF2 )
159
+ /* Wrapper for BCryptDeriveKeyPBKDF2 */
160
160
static bool
161
161
_bcrypt_derive_key_pbkdf2 (BCRYPT_ALG_HANDLE prf ,
162
162
const char * password ,
@@ -189,16 +189,17 @@ _bcrypt_derive_key_pbkdf2 (BCRYPT_ALG_HANDLE prf,
189
189
}
190
190
return true;
191
191
}
192
- #endif
193
192
193
+ #else
194
194
/* Compute the SCRAM step Hi() as defined in RFC5802 */
195
195
static bool
196
- mongoc_crypto_cng_derive_key_pbkdf2 (mongoc_crypto_t * crypto ,
196
+ _bcrypt_derive_key_pbkdf2 (mongoc_crypto_t * crypto ,
197
197
const char * password ,
198
198
size_t password_len ,
199
199
const uint8_t * salt ,
200
200
size_t salt_len ,
201
201
uint32_t iterations ,
202
+ size_t output_len ,
202
203
unsigned char * output )
203
204
{
204
205
uint8_t intermediate_digest [MONGOC_SCRAM_HASH_MAX_SIZE ];
@@ -223,6 +224,7 @@ mongoc_crypto_cng_derive_key_pbkdf2 (mongoc_crypto_t *crypto,
223
224
}
224
225
return true;
225
226
}
227
+ #endif
226
228
227
229
bool
228
230
mongoc_crypto_cng_pbkdf2_hmac_sha1 (mongoc_crypto_t * crypto ,
@@ -234,12 +236,8 @@ mongoc_crypto_cng_pbkdf2_hmac_sha1 (mongoc_crypto_t *crypto,
234
236
size_t output_len ,
235
237
unsigned char * output )
236
238
{
237
- #if defined(MONGOC_HAVE_BCRYPT_PBKDF2 )
238
239
return _bcrypt_derive_key_pbkdf2 (
239
- _sha1_hmac_algo , password , password_len , salt , salt_len , iterations , output_len , output )
240
- #else
241
- return mongoc_crypto_cng_derive_key_pbkdf2 (crypto , password , password_len , salt , salt_len , iterations , output );
242
- #endif
240
+ _sha1_hmac_algo , password , password_len , salt , salt_len , iterations , output_len , output );
243
241
}
244
242
245
243
void
@@ -283,12 +281,8 @@ mongoc_crypto_cng_pbkdf2_hmac_sha256 (mongoc_crypto_t *crypto,
283
281
size_t output_len ,
284
282
unsigned char * output )
285
283
{
286
- #if defined(MONGOC_HAVE_BCRYPT_PBKDF2 )
287
284
return _bcrypt_derive_key_pbkdf2 (
288
- _sha256_hmac_algo , password , password_len , salt , salt_len , iterations , output_len , output )
289
- #else
290
- return mongoc_crypto_cng_derive_key_pbkdf2 (crypto , password , password_len , salt , salt_len , iterations , output );
291
- #endif
285
+ _sha256_hmac_algo , password , password_len , salt , salt_len , iterations , output_len , output );
292
286
}
293
287
294
288
void
0 commit comments