}\r
\r
int mifare_sendcmd_short(struct Crypto1State *pcs, uint8_t crypted, uint8_t cmd, uint8_t data, uint8_t* answer)\r
+{\r
+ return mifare_sendcmd_shortex(pcs, crypted, cmd, data, answer, NULL);\r
+}\r
+\r
+int mifare_sendcmd_shortex(struct Crypto1State *pcs, uint8_t crypted, uint8_t cmd, uint8_t data, uint8_t* answer, uint32_t * parptr)\r
{\r
uint8_t dcmd[4], ecmd[4];\r
uint32_t pos, par, res;\r
ReaderTransmit(dcmd, sizeof(dcmd));\r
}\r
\r
- int len = ReaderReceive(answer);\r
+ int len = ReaderReceivePar(answer, &par);\r
+ \r
+ if (parptr) *parptr = par;\r
\r
if (crypted == CRYPT_ALL) {\r
if (len == 1) {\r
}\r
\r
int mifare_classic_auth(struct Crypto1State *pcs, uint32_t uid, uint8_t blockNo, uint8_t keyType, uint64_t ui64Key, uint64_t isNested) \r
+{\r
+ return mifare_classic_authex(pcs, uid, blockNo, keyType, ui64Key, isNested, NULL);\r
+}\r
+\r
+int mifare_classic_authex(struct Crypto1State *pcs, uint32_t uid, uint8_t blockNo, uint8_t keyType, uint64_t ui64Key, uint64_t isNested, uint32_t * ntptr) \r
{\r
// variables\r
int len; \r
}\r
\r
// some statistic\r
- Dbprintf("auth uid: %08x nt: %08x", uid, nt); \r
+ if (!ntptr)\r
+ Dbprintf("auth uid: %08x nt: %08x", uid, nt); \r
+ \r
+ // save Nt\r
+ if (ntptr)\r
+ *ntptr = nt;\r
\r
par = 0;\r
// Generate (encrypted) nr+parity by loading it into the cipher (Nr)\r