Skip to content

Commit ee7e095

Browse files
committed
Update bcrypt check in cmake
1 parent b8a7ea5 commit ee7e095

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/libmongoc/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -534,13 +534,17 @@ endif ()
534534

535535
# Check if BCryptDeriveKeyPBKDF2 is defined in bcrypt.h
536536
if (WIN32 AND MONGOC_ENABLE_CRYPTO_CNG)
537-
check_symbol_exists (BCryptDeriveKeyPBKDF2 bcrypt.h HAVE_BCRYPT_PBKDF2)
537+
cmake_push_check_state()
538+
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_WIN32_WINNT=0x0601)
539+
list(APPEND CMAKE_REQUIRED_LIBRARIES Bcrypt.lib)
540+
check_symbol_exists (BCryptDeriveKeyPBKDF2 "windows.h;bcrypt.h" HAVE_BCRYPT_PBKDF2)
541+
cmake_pop_check_state()
538542
endif ()
539543

540544
if (HAVE_BCRYPT_PBKDF2)
541-
set (MONGOC_HAVE_BCRYPT_PBKDF2 1)
545+
set (MONGOC_HAVE_BCRYPT_PBKDF2 1)
542546
else ()
543-
set (MONGOC_HAVE_BCRYPT_PBKDF2 0)
547+
set (MONGOC_HAVE_BCRYPT_PBKDF2 0)
544548
endif ()
545549

546550

src/libmongoc/src/mongoc/mongoc-crypto-private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct _mongoc_crypto_t {
5454
void
5555
mongoc_crypto_init (mongoc_crypto_t *crypto, mongoc_crypto_hash_algorithm_t algo);
5656

57-
int
57+
bool
5858
mongoc_crypto_pbkdf (mongoc_crypto_t *crypto,
5959
const char *password,
6060
size_t password_len,

0 commit comments

Comments
 (0)