diff --git a/kdf.c b/kdf.c index ed6c847..3acc340 100644 --- a/kdf.c +++ b/kdf.c @@ -42,8 +42,15 @@ #include #if defined(__APPLE__) && defined(__MACH__) +#include +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #include #include +#define USE_APPLE_COMMONCRYPTO +#endif +#endif + +#ifdef USE_APPLE_COMMONCRYPTO static void pbkdf2_hash(const char *username, size_t username_len, const char *password, size_t password_len, int iterations, unsigned char hash[KDF_HASH_LEN]) { if (CCKeyDerivationPBKDF(kCCPBKDF2, password, password_len, (const uint8_t *)username, username_len, kCCPRFHmacAlgSHA256, iterations, hash, KDF_HASH_LEN) == kCCParamError)