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 // High frequency iClass support
17 //-----------------------------------------------------------------------------
18 #ifndef CMDHFICLASS_H__
19 #define CMDHFICLASS_H__
22 #include "fileutils.h"
23 #include "iclass_cmd.h"
25 int CmdHFiClass(const char *Cmd
);
27 int info_iclass(bool shallow_mod
);
28 int read_iclass_csn(bool loop
, bool verbose
, bool shallow_mod
);
29 void printIclassDumpContents(uint8_t *iclass_dump
, uint8_t startblock
, uint8_t endblock
, size_t filesize
, bool dense_output
);
30 void HFiClassCalcDivKey(uint8_t *CSN
, uint8_t *KEY
, uint8_t *div_key
, bool elite
);
32 void GenerateMacFrom(uint8_t *CSN
, uint8_t *CCNR
, bool use_raw
, bool use_elite
, uint8_t *keys
, uint32_t keycnt
, iclass_premac_t
*list
);
33 void GenerateMacKeyFrom(uint8_t *CSN
, uint8_t *CCNR
, bool use_raw
, bool use_elite
, uint8_t *keys
, uint32_t keycnt
, iclass_prekey_t
*list
);
34 void PrintPreCalcMac(uint8_t *keys
, uint32_t keycnt
, iclass_premac_t
*pre_list
);
35 void PrintPreCalc(iclass_prekey_t
*list
, uint32_t itemcnt
);
37 uint8_t get_pagemap(const picopass_hdr_t
*hdr
);
38 bool check_known_default(uint8_t *csn
, uint8_t *epurse
, uint8_t *rmac
, uint8_t *tmac
, uint8_t *key
);
40 void picopass_elite_nextKey(uint8_t *key
);
41 void picopass_elite_reset(void);
42 uint32_t picopass_elite_rng(void);
43 uint32_t picopass_elite_lcg(void);
44 uint8_t picopass_elite_nextByte(void);
45 void generate_key_block_inverted(const uint8_t *startingKey
, uint64_t index
, uint8_t *keyBlock
);