1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
3 // Copyright (C) 2011 Gerhard de Koning Gans
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
8 //-----------------------------------------------------------------------------
9 // High frequency iClass support
10 //-----------------------------------------------------------------------------
11 #ifndef CMDHFICLASS_H__
12 #define CMDHFICLASS_H__
15 #include "fileutils.h"
18 typedef struct iclass_block
{
22 typedef struct iclass_prekey
{
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
);