Rely on RAND_bytes() instead of DES_random_key() to generate random vectors.
This commit is contained in:
parent
5b416ee508
commit
f94c3c743f
2 changed files with 4 additions and 2 deletions
|
@ -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"
|
||||
|
|
|
@ -62,6 +62,8 @@
|
|||
# include <libutil.h>
|
||||
#endif
|
||||
|
||||
#include <openssl/rand.h>
|
||||
|
||||
#include <freefare.h>
|
||||
#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);
|
||||
|
|
Loading…
Reference in a new issue