Merge pull request #1331 from Guilhem7/master
[RRG-proxmark3.git] / armsrc / mifarecmd.h
blobbaf3d9e310f4b7c2ffbe38fd9907bd1800261ad8
1 //-----------------------------------------------------------------------------
2 // Jonathan Westhues, Aug 2005
3 // Gerhard de Koning Gans, April 2008, May 2011
4 //
5 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
6 // at your option, any later version. See the LICENSE.txt file for the text of
7 // the license.
8 //-----------------------------------------------------------------------------
9 // Definitions internal to the app source.
10 //-----------------------------------------------------------------------------
11 #ifndef __MIFARECMD_H
12 #define __MIFARECMD_H
14 #include "common.h"
16 void MifareReadBlock(uint8_t blockNo, uint8_t keyType, uint8_t *datain);
18 void MifareUReadBlock(uint8_t arg0, uint8_t arg1, uint8_t *datain);
19 void MifareUC_Auth(uint8_t arg0, uint8_t *keybytes);
20 void MifareUReadCard(uint8_t arg0, uint16_t arg1, uint8_t arg2, uint8_t *datain);
21 void MifareReadSector(uint8_t arg0, uint8_t arg1, uint8_t *datain);
22 void MifareWriteBlock(uint8_t arg0, uint8_t arg1, uint8_t *datain);
23 void MifareUWriteBlockCompat(uint8_t arg0, uint8_t arg1, uint8_t *datain);
25 void MifareUWriteBlock(uint8_t arg0, uint8_t arg1, uint8_t *datain);
26 void MifareNested(uint8_t blockNo, uint8_t keyType, uint8_t targetBlockNo, uint8_t targetKeyType, bool calibrate, uint8_t *key);
28 void MifareStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t targetBlockNo, uint8_t targetKeyType, uint8_t *key);
30 void MifareAcquireEncryptedNonces(uint32_t arg0, uint32_t arg1, uint32_t flags, uint8_t *datain);
31 void MifareAcquireNonces(uint32_t arg0, uint32_t flags);
32 void MifareChkKeys(uint8_t *datain, uint8_t reserved_mem);
33 void MifareChkKeys_fast(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
34 void MifareChkKeys_file(uint8_t *fn);
36 void MifareEMemClr(void);
37 void MifareEMemSet(uint8_t blockno, uint8_t blockcnt, uint8_t blockwidth, uint8_t *datain);
38 void MifareEMemGet(uint8_t blockno, uint8_t blockcnt);
39 int MifareECardLoad(uint8_t sectorcnt, uint8_t keytype);
40 int MifareECardLoadExt(uint8_t sectorcnt, uint8_t keytype);
42 void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain); // Work with "magic Chinese" card
43 void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain);
44 void MifareCIdent(bool is_mfc); // is "magic chinese" card?
45 void MifareHasStaticNonce(void); // Has the tag a static nonce?
47 int DoGen3Cmd(uint8_t *cmd, uint8_t cmd_len);
48 void MifareGen3UID(uint8_t uidlen, uint8_t *uid); // Gen 3 magic card set UID without manufacturer block
49 void MifareGen3Blk(uint8_t block_len, uint8_t *block); // Gen 3 magic card overwrite manufacturer block
50 void MifareGen3Freez(void); // Gen 3 magic card lock further UID changes
52 void MifareSetMod(uint8_t *datain);
53 void MifarePersonalizeUID(uint8_t keyType, uint8_t perso_option, uint64_t key);
55 void MifareUSetPwd(uint8_t arg0, uint8_t *datain);
56 void OnSuccessMagic(void);
57 void OnErrorMagic(uint8_t reason);
59 int32_t dist_nt(uint32_t nt1, uint32_t nt2);
60 //void RAMFUNC SniffMifare(uint8_t param);
62 void Mifare_DES_Auth1(uint8_t arg0, uint8_t *datain);
63 void Mifare_DES_Auth2(uint32_t arg0, uint8_t *datain);
65 // Tear-off test for MFU
66 void MifareU_Otp_Tearoff(uint8_t blno, uint32_t tearoff_time, uint8_t *data_testwrite);
67 void MifareU_Counter_Tearoff(uint8_t counter, uint32_t tearoff_time, uint8_t *datain);
68 #endif