textual
[RRG-proxmark3.git] / client / src / cmdhficlass.h
blob73d34df0ba4613e623137d91881ac760cb23fddd
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
3 // Copyright (C) 2011 Gerhard de Koning Gans
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 // High frequency iClass support
10 //-----------------------------------------------------------------------------
11 #ifndef CMDHFICLASS_H__
12 #define CMDHFICLASS_H__
14 #include "common.h"
15 #include "fileutils.h"
16 #include "pm3_cmd.h"
18 typedef struct iclass_block {
19 uint8_t d[8];
20 } iclass_block_t;
22 typedef struct iclass_prekey {
23 uint8_t mac[4];
24 uint8_t key[8];
25 } iclass_prekey_t;
27 typedef struct {
28 char desc[70];
29 uint8_t data[16];
30 } iclass_config_card_item_t;
32 int CmdHFiClass(const char *Cmd);
34 int info_iclass(void);
35 int read_iclass_csn(bool loop, bool verbose);
36 void printIclassDumpContents(uint8_t *iclass_dump, uint8_t startblock, uint8_t endblock, size_t filesize);
37 void HFiClassCalcDivKey(uint8_t *CSN, uint8_t *KEY, uint8_t *div_key, bool elite);
39 void GenerateMacFrom(uint8_t *CSN, uint8_t *CCNR, bool use_raw, bool use_elite, uint8_t *keys, uint32_t keycnt, iclass_premac_t *list);
40 void GenerateMacKeyFrom(uint8_t *CSN, uint8_t *CCNR, bool use_raw, bool use_elite, uint8_t *keys, uint32_t keycnt, iclass_prekey_t *list);
41 void PrintPreCalcMac(uint8_t *keys, uint32_t keycnt, iclass_premac_t *pre_list);
42 void PrintPreCalc(iclass_prekey_t *list, uint32_t itemcnt);
44 uint8_t get_pagemap(const picopass_hdr_t *hdr);
45 bool check_known_default(uint8_t *csn, uint8_t *epurse, uint8_t *rmac, uint8_t *tmac, uint8_t *key);
46 #endif