textual
[RRG-proxmark3.git] / client / src / cmdhflist.h
blobfe4a99208739d9eb413ddc3c893b6c7f4ec4f1e5
1 //-----------------------------------------------------------------------------
2 // Copyright (C) Merlok - 2017
3 //
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
6 // the license.
7 //-----------------------------------------------------------------------------
8 // Command: hf mf list. It shows data from arm buffer.
9 //-----------------------------------------------------------------------------
10 #ifndef CMDHFLIST_H
11 #define CMDHFLIST_H
13 #include "common.h"
15 typedef struct {
16 uint32_t uid; // UID
17 uint32_t nt; // tag challenge
18 uint32_t nt_enc; // encrypted tag challenge
19 uint8_t nt_enc_par; // encrypted tag challenge parity
20 uint32_t nr_enc; // encrypted reader challenge
21 uint8_t nr_enc_par; // encrypted reader challenge parity
22 uint32_t ar_enc; // encrypted reader response
23 uint8_t ar_enc_par; // encrypted reader response parity
24 uint32_t at_enc; // encrypted tag response
25 uint8_t at_enc_par; // encrypted tag response parity
26 bool first_auth; // is first authentication
27 uint32_t ks2; // ar ^ ar_enc
28 uint32_t ks3; // at ^ at_enc
29 } TAuthData;
31 void ClearAuthData(void);
33 uint8_t iso14443A_CRC_check(bool isResponse, uint8_t *d, uint8_t n);
34 uint8_t iso14443B_CRC_check(uint8_t *d, uint8_t n);
35 uint8_t felica_CRC_check(uint8_t *d, uint8_t n);
36 uint8_t mifare_CRC_check(bool isResponse, uint8_t *data, uint8_t len);
37 uint8_t iso15693_CRC_check(uint8_t *d, uint8_t n);
38 uint8_t iclass_CRC_check(bool isResponse, uint8_t *d, uint8_t n);
40 int applyIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
42 void annotateIclass(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool isResponse);
43 void annotateIso15693(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
44 void annotateTopaz(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
45 void annotateLegic(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
46 void annotateFelica(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
47 void annotateIso7816(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
48 void annotateIso14443b(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
49 void annotateIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
50 void annotateMfDesfire(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
51 void annotateMifare(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, uint8_t *parity, uint8_t paritysize, bool isResponse);
52 void annotateLTO(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
53 void annotateCryptoRF(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
55 bool DecodeMifareData(uint8_t *cmd, uint8_t cmdsize, uint8_t *parity, bool isResponse, uint8_t *mfData, size_t *mfDataLen, const uint64_t *dicKeys, uint32_t dicKeysCount);
56 bool NTParityChk(TAuthData *ad, uint32_t ntx);
57 bool NestedCheckKey(uint64_t key, TAuthData *ad, uint8_t *cmd, uint8_t cmdsize, uint8_t *parity);
58 bool CheckCrypto1Parity(uint8_t *cmd_enc, uint8_t cmdsize, uint8_t *cmd, uint8_t *parity_enc);
59 uint64_t GetCrypto1ProbableKey(TAuthData *ad);
61 #endif // CMDHFLIST