int MF_DBGLEVEL = MF_DBG_ALL;\r
\r
// crypto1 helpers\r
-void mf_crypto1_decrypt(struct Crypto1State *pcs, uint8_t *data, int len){\r
+void mf_crypto1_decryptEx(struct Crypto1State *pcs, uint8_t *data_in, int len, uint8_t *data_out){\r
uint8_t bt = 0;\r
int i;\r
\r
if (len != 1) {\r
for (i = 0; i < len; i++)\r
- data[i] = crypto1_byte(pcs, 0x00, 0) ^ data[i];\r
+ data_out[i] = crypto1_byte(pcs, 0x00, 0) ^ data_in[i];\r
} else {\r
bt = 0;\r
for (i = 0; i < 4; i++)\r
- bt |= (crypto1_bit(pcs, 0, 0) ^ BIT(data[0], i)) << i;\r
+ bt |= (crypto1_bit(pcs, 0, 0) ^ BIT(data_in[0], i)) << i;\r
\r
- data[0] = bt;\r
+ data_out[0] = bt;\r
}\r
return;\r
}\r
\r
+void mf_crypto1_decrypt(struct Crypto1State *pcs, uint8_t *data, int len){\r
+ mf_crypto1_decryptEx(pcs, data, len, data);\r
+}\r
+\r
void mf_crypto1_encrypt(struct Crypto1State *pcs, uint8_t *data, uint16_t len, uint8_t *par) {\r
uint8_t bt = 0;\r
int i;\r