- uint16_t len;\r
- uint8_t receivedAnswer[MAX_FRAME_SIZE];\r
- uint8_t receivedAnswerPar[MAX_PARITY_SIZE];\r
- \r
- len = mifare_sendcmd_short_mfucauth(NULL, 1, 0xAF, key, receivedAnswer, receivedAnswerPar, NULL);\r
+ Dbprintf("rnd_ab: %02x %02x %02x %02x %02x %02x %02x %02x",\r
+ rnd_ab[0],rnd_ab[1],rnd_ab[2],rnd_ab[3],rnd_ab[4],rnd_ab[5],rnd_ab[6],rnd_ab[7]);\r
+\r
+ Dbprintf("rnd_ab: %02x %02x %02x %02x %02x %02x %02x %02x",\r
+ rnd_ab[8],rnd_ab[9],rnd_ab[10],rnd_ab[11],rnd_ab[12],rnd_ab[13],rnd_ab[14],rnd_ab[15] );\r
+ }\r
+\r
+ // encrypt out, in, length, key, iv\r
+ //tdes_2key_enc(rnd_ab, rnd_ab, sizeof(rnd_ab), key, enc_random_b);\r
+ des3_set2key_enc(&ctx, key);\r
+ des3_crypt_cbc(&ctx // des3_context\r
+ , DES_ENCRYPT // int mode\r
+ , sizeof(rnd_ab) // length\r
+ , enc_random_b // iv[8]\r
+ , rnd_ab // input\r
+ , rnd_ab // output\r
+ );\r
+\r
+ //len = mifare_sendcmd_short_mfucauth(NULL, 1, 0xAF, rnd_ab, resp, respPar, NULL);\r
+ len = mifare_sendcmd(0xAF, rnd_ab, sizeof(rnd_ab), resp, respPar, NULL);\r