1 //-----------------------------------------------------------------------------
2 // Copyright (C) Gerhard de Koning Gans - May 2008
3 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // See LICENSE.txt for the text of the license.
16 //-----------------------------------------------------------------------------
23 int16_t mifare_cmd_readblocks(MifareWakeupType wakeup
, uint8_t key_auth_cmd
, uint8_t *key
, uint8_t read_cmd
, uint8_t block_no
, uint8_t count
, uint8_t *block_data
);
24 int16_t mifare_cmd_writeblocks(MifareWakeupType wakeup
, uint8_t key_auth_cmd
, uint8_t *key
, uint8_t write_cmd
, uint8_t block_no
, uint8_t count
, uint8_t *block_data
);
25 void MifareReadSector(uint8_t sector_no
, uint8_t key_type
, uint8_t *key
);
26 void MifareValue(uint8_t arg0
, uint8_t arg1
, uint8_t arg2
, uint8_t *datain
);
28 void MifareUReadBlock(uint8_t arg0
, uint8_t arg1
, uint8_t *datain
);
29 void MifareUC_Auth(uint8_t arg0
, uint8_t *keybytes
);
30 void MifareUL_AES_Auth(bool turn_off_field
, uint8_t keyno
, uint8_t *keybytes
);
32 void MifareUReadCard(uint8_t arg0
, uint16_t arg1
, uint8_t arg2
, uint8_t *datain
);
33 void MifareUWriteBlockCompat(uint8_t arg0
, uint8_t arg1
, uint8_t *datain
);
34 void MifareUWriteBlock(uint8_t arg0
, uint8_t arg1
, uint8_t *datain
);
36 void MifareNested(uint8_t blockNo
, uint8_t keyType
, uint8_t targetBlockNo
, uint8_t targetKeyType
, bool calibrate
, uint8_t *key
);
37 void MifareStaticNested(uint8_t blockNo
, uint8_t keyType
, uint8_t targetBlockNo
, uint8_t targetKeyType
, uint8_t *key
);
39 void MifareAcquireEncryptedNonces(uint32_t arg0
, uint32_t arg1
, uint32_t flags
, uint8_t *datain
);
40 int MifareAcquireStaticEncryptedNonces(uint32_t flags
, const uint8_t *key
, bool reply
, uint8_t first_block_no
, uint8_t first_key_type
);
41 void MifareAcquireNonces(uint32_t arg0
, uint32_t flags
);
42 void MifareChkKeys(uint8_t *datain
, uint8_t reserved_mem
);
43 void MifareChkKeys_fast(uint32_t arg0
, uint32_t arg1
, uint32_t arg2
, uint8_t *datain
);
44 void MifareChkKeys_file(uint8_t *fn
);
46 void MifareEMemClr(void);
47 void MifareEMemGet(uint8_t blockno
, uint8_t blockcnt
);
48 int MifareECardLoad(uint8_t sectorcnt
, uint8_t keytype
, uint8_t *key
);
49 int MifareECardLoadExt(uint8_t sectorcnt
, uint8_t keytype
, uint8_t *key
);
52 void MifareCSetBlock(uint32_t arg0
, uint32_t arg1
, uint8_t *datain
); // Work with "magic Chinese" card
53 void MifareCGetBlock(uint32_t arg0
, uint32_t arg1
, uint8_t *datain
);
54 void MifareCIdent(bool is_mfc
, uint8_t keytype
, uint8_t *key
); // is "magic chinese" card?
55 void MifareHasStaticNonce(void); // Has the tag a static nonce?
56 void MifareHasStaticEncryptedNonce(uint8_t block_no
, uint8_t key_type
, uint8_t *key
, uint8_t block_no_nested
, uint8_t key_type_nested
, uint8_t *key_nested
, uint8_t nr_nested
, bool reset
, bool hardreset
, bool addread
, bool addauth
, bool incblk2
, bool corruptnrar
, bool corruptnrarparity
); // Has the tag a static encrypted nonce?
59 int DoGen3Cmd(uint8_t *cmd
, uint8_t cmd_len
);
60 void MifareGen3UID(uint8_t uidlen
, uint8_t *uid
); // Gen 3 magic card set UID without manufacturer block
61 void MifareGen3Blk(uint8_t block_len
, uint8_t *block
); // Gen 3 magic card overwrite manufacturer block
62 void MifareGen3Freez(void); // Gen 3 magic card lock further UID changes
65 void MifareG4ReadBlk(uint8_t blockno
, uint8_t *pwd
, uint8_t workFlags
);
66 void MifareG4WriteBlk(uint8_t blockno
, uint8_t *pwd
, uint8_t *data
, uint8_t workFlags
);
68 void MifareSetMod(uint8_t *datain
);
69 void MifarePersonalizeUID(uint8_t keyType
, uint8_t perso_option
, uint64_t key
);
71 void MifareUSetPwd(uint8_t arg0
, uint8_t *datain
);
72 void OnSuccessMagic(void);
73 void OnErrorMagic(uint8_t reason
);
75 int32_t dist_nt(uint32_t nt1
, uint32_t nt2
);
76 //void RAMFUNC SniffMifare(uint8_t param);
78 void Mifare_DES_Auth1(uint8_t arg0
, uint8_t *datain
);
79 void Mifare_DES_Auth2(uint32_t arg0
, uint8_t *datain
);
81 // Tear-off test for MFU
82 void MifareU_Otp_Tearoff(uint8_t blno
, uint32_t tearoff_time
, uint8_t *data_testwrite
);
83 void MifareU_Counter_Tearoff(uint8_t counter
, uint32_t tearoff_time
, uint8_t *datain
);