1 //-----------------------------------------------------------------------------
2 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // See LICENSE.txt for the text of the license.
15 //-----------------------------------------------------------------------------
16 // iso14443-4 mifare commands
17 //-----------------------------------------------------------------------------
49 const char *description
;
50 const char *application
;
56 const char *Description
;
59 void mfpSetVerboseMode(bool verbose
);
60 const char *mfpGetErrorDescription(uint8_t errorCode
);
62 int CalculateMAC(mf4Session_t
*mf4session
, MACType_t mtype
, uint8_t blockNum
, uint8_t blockCount
, uint8_t *data
, int datalen
, uint8_t *mac
, bool verbose
);
63 int MifareAuth4(mf4Session_t
*mf4session
, const uint8_t *keyn
, uint8_t *key
, bool activateField
, bool leaveSignalON
, bool dropFieldIfError
, bool verbose
, bool silentMode
);
65 int MFPWritePerso(const uint8_t *keyNum
, const uint8_t *key
, bool activateField
, bool leaveSignalON
, uint8_t *dataout
, int maxdataoutlen
, int *dataoutlen
);
66 int MFPCommitPerso(bool activateField
, bool leaveSignalON
, uint8_t *dataout
, int maxdataoutlen
, int *dataoutlen
);
67 int MFPReadBlock(mf4Session_t
*mf4session
, bool plain
, bool nomaccmd
, bool nomacres
, uint8_t blockNum
, uint8_t blockCount
, bool activateField
, bool leaveSignalON
, uint8_t *dataout
, int maxdataoutlen
, int *dataoutlen
, uint8_t *mac
);
68 int MFPWriteBlock(mf4Session_t
*mf4session
, bool plain
, bool nomacres
, uint8_t blockNum
, uint8_t blockHdr
, const uint8_t *data
, bool activateField
, bool leaveSignalON
, uint8_t *dataout
, int maxdataoutlen
, int *dataoutlen
, uint8_t *mac
);
69 int mfpReadSector(uint8_t sectorNo
, uint8_t keyType
, uint8_t *key
, uint8_t *dataout
, bool verbose
);
71 int MFPGetSignature(bool activateField
, bool leaveSignalON
, uint8_t *dataout
, int maxdataoutlen
, int *dataoutlen
);
72 int MFPGetVersion(bool activateField
, bool leaveSignalON
, uint8_t *dataout
, int maxdataoutlen
, int *dataoutlen
);
74 bool mfValidateAccessConditions(const uint8_t *data
);
75 bool mfReadOnlyAccessConditions(uint8_t blockn
, const uint8_t *data
);
76 const char *mfGetAccessConditionsDesc(uint8_t blockn
, const uint8_t *data
);
77 uint8_t mf_get_accesscondition(uint8_t blockn
, const uint8_t *data
);
79 uint8_t mfNumBlocksPerSector(uint8_t sectorNo
);
80 uint8_t mfFirstBlockOfSector(uint8_t sectorNo
);
81 uint8_t mfSectorTrailerOfSector(uint8_t sectorNo
);
82 uint8_t mfSectorTrailer(uint16_t blockNo
);
83 bool mfIsSectorTrailer(uint16_t blockNo
);
84 bool mfIsSectorTrailerBasedOnBlocks(uint8_t sectorno
, uint16_t blockno
);
85 uint8_t mfSectorNum(uint16_t blockNo
);