Skip to content

Commit 5d558c2

Browse files
committed
Comments for _bcrypt_derive_key_pbkdf2
1 parent 1ca9507 commit 5d558c2

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -184,22 +184,22 @@ _bcrypt_derive_key_pbkdf2 (BCRYPT_ALG_HANDLE prf,
184184
bson_free (salt_copy);
185185

186186
if (!NT_SUCCESS (status)) {
187-
MONGOC_ERROR ("BCryptDeriveKeyPBKDF2(): %ld", status);
187+
MONGOC_ERROR ("_bcrypt_derive_key_pbkdf2(): %ld", status);
188188
return false;
189189
}
190190
return true;
191191
}
192192

193193
#else
194-
/* Compute the SCRAM step Hi() as defined in RFC5802 */
194+
/* Manually salts password if BCryptDeriveKeyPBKDF2 is unavailable */
195195
static bool
196196
_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)
203203
{
204204
uint8_t intermediate_digest[MONGOC_SCRAM_HASH_MAX_SIZE];
205205
uint8_t start_key[MONGOC_SCRAM_HASH_MAX_SIZE];
@@ -239,8 +239,7 @@ mongoc_crypto_cng_pbkdf2_hmac_sha1 (mongoc_crypto_t *crypto,
239239
return _bcrypt_derive_key_pbkdf2 (
240240
_sha1_hmac_algo, password, password_len, salt, salt_len, iterations, output_len, output);
241241
#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);
244243
#endif
245244
}
246245

@@ -289,8 +288,7 @@ mongoc_crypto_cng_pbkdf2_hmac_sha256 (mongoc_crypto_t *crypto,
289288
return _bcrypt_derive_key_pbkdf2 (
290289
_sha256_hmac_algo, password, password_len, salt, salt_len, iterations, output_len, output);
291290
#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);
294292
#endif
295293
}
296294

0 commit comments

Comments
 (0)