diff --git a/configure.ac b/configure.ac index a366eff..3d68928 100644 --- a/configure.ac +++ b/configure.ac @@ -54,7 +54,7 @@ CFLAGS="$CFLAGS -std=c99" # Crypto functions for MIFARE DesFire support are provided by OpenSSL. AC_CHECK_LIB([crypto], [DES_ecb_encrypt], [], [AC_MSG_ERROR([Cannot find libcrypto.])]) -AC_CHECK_HEADER([openssl/des.h], [], [AC_MSG_ERROR([Cannot find openssl headers.])]) +AC_CHECK_HEADERS([openssl/des.h openssl/rand.h], [], [AC_MSG_ERROR([Cannot find openssl headers.])]) # Checks for pkg-config modules. LIBNFC_REQUIRED_VERSION="1.4.0" diff --git a/libfreefare/mifare_desfire.c b/libfreefare/mifare_desfire.c index 707daae..d683b46 100644 --- a/libfreefare/mifare_desfire.c +++ b/libfreefare/mifare_desfire.c @@ -62,6 +62,8 @@ # include #endif +#include + #include #include "freefare_internal.h" @@ -351,7 +353,7 @@ mifare_desfire_authenticate (MifareTag tag, uint8_t key_no, MifareDESFireKey key mifare_cbc_des (key, MIFARE_DESFIRE (tag)->ivect, PICC_RndB, 8, MD_RECEIVE, 0); uint8_t PCD_RndA[8]; - DES_random_key ((DES_cblock*)&PCD_RndA); + RAND_bytes (PCD_RndA, 8); uint8_t PCD_r_RndB[8]; memcpy (PCD_r_RndB, PICC_RndB, 8);