]>
cvs.zerfleddert.de Git - proxmark3-svn/blob - common/protocols.c
3 // ATA55xx shared presets & routines
4 uint32_t GetT55xxClockBit(uint32_t clock
) {
6 case 128: return T55x7_BITRATE_RF_128
;
7 case 100: return T55x7_BITRATE_RF_100
;
8 case 64: return T55x7_BITRATE_RF_64
;
9 case 50: return T55x7_BITRATE_RF_50
;
10 case 40: return T55x7_BITRATE_RF_40
;
11 case 32: return T55x7_BITRATE_RF_32
;
12 case 16: return T55x7_BITRATE_RF_16
;
13 case 8: return T55x7_BITRATE_RF_8
;
20 #define prnt PrintAndLog
22 uint8_t isset(uint8_t val
, uint8_t mask
) {
26 uint8_t notset(uint8_t val
, uint8_t mask
){
30 void fuse_config(const picopass_hdr
*hdr
) {
31 uint8_t fuses
= hdr
->conf
.fuses
;
33 if (isset(fuses
,FUSE_FPERS
))
34 prnt(" Mode: Personalization [Programmable]");
36 prnt(" Mode: Application [Locked]");
38 if (isset(fuses
, FUSE_CODING1
)) {
41 if( isset( fuses
, FUSE_CODING0
))
42 prnt(" Coding: ISO 14443-2 B/ISO 15693");
44 prnt(" Coding: ISO 14443B only");
46 if( isset (fuses
,FUSE_CRYPT1
| FUSE_CRYPT0
)) prnt(" Crypt: Secured page, keys not locked");
47 if( isset (fuses
,FUSE_CRYPT1
) && notset( fuses
, FUSE_CRYPT0
)) prnt(" Crypt: Secured page, keys not locked");
48 if( notset (fuses
,FUSE_CRYPT1
) && isset( fuses
, FUSE_CRYPT0
)) prnt(" Crypt: Non secured page");
49 if( notset (fuses
,FUSE_CRYPT1
) && notset( fuses
, FUSE_CRYPT0
)) prnt(" Crypt: No auth possible. Read only if RA is enabled");
51 if( isset( fuses
, FUSE_RA
))
52 prnt(" RA: Read access enabled");
54 prnt(" RA: Read access not enabled");
57 void getMemConfig(uint8_t mem_cfg
, uint8_t chip_cfg
, uint8_t *max_blk
, uint8_t *app_areas
, uint8_t *kb
) {
58 // mem-bit 5, mem-bit 7, chip-bit 4: defines chip type
59 uint8_t k16
= isset(mem_cfg
, 0x80);
60 //uint8_t k2 = isset(mem_cfg, 0x08);
61 uint8_t book
= isset(mem_cfg
, 0x20);
63 if(isset(chip_cfg
, 0x10) && !k16
&& !book
) {
67 } else if(isset(chip_cfg
, 0x10) && k16
&& !book
) {
70 *max_blk
= 255; //16kb
71 } else if(notset(chip_cfg
, 0x10) && !k16
&& !book
) {
74 *max_blk
= 255; //16kb
75 } else if(isset(chip_cfg
, 0x10) && k16
&& book
) {
78 *max_blk
= 255; //16kb
79 } else if(notset(chip_cfg
, 0x10) && !k16
&& book
) {
82 *max_blk
= 255; //16kb
90 void mem_app_config(const picopass_hdr
*hdr
) {
91 uint8_t mem
= hdr
->conf
.mem_config
;
92 uint8_t chip
= hdr
->conf
.chip_config
;
93 uint8_t applimit
= hdr
->conf
.app_limit
;
94 if (applimit
< 6) applimit
= 26;
96 uint8_t app_areas
= 2;
98 getMemConfig(mem
, chip
, &max_blk
, &app_areas
, &kb
);
99 prnt(" Mem: %u KBits/%u App Areas (%u * 8 bytes) [%02X]", kb
, app_areas
, max_blk
, mem
);
100 prnt(" AA1: blocks 06-%02X", applimit
);
101 prnt(" AA2: blocks %02X-%02X", applimit
+1, max_blk
);
104 uint8_t book
= isset(mem
, 0x20);
107 prnt("\tRead A - Kd");
108 prnt("\tRead B - Kc");
109 prnt("\tWrite A - Kd");
110 prnt("\tWrite B - Kc");
111 prnt("\tDebit - Kd or Kc");
112 prnt("\tCredit - Kc");
115 prnt("\tRead A - Kd or Kc");
116 prnt("\tRead B - Kd or Kc");
117 prnt("\tWrite A - Kc");
118 prnt("\tWrite B - Kc");
119 prnt("\tDebit - Kd or Kc");
120 prnt("\tCredit - Kc");
123 void print_picopass_info(const picopass_hdr
*hdr
) {
127 void printIclassDumpInfo(uint8_t* iclass_dump
) {
128 print_picopass_info((picopass_hdr
*) iclass_dump
);
133 picopass_hdr hdr = {0x27,0xaf,0x48,0x01,0xf9,0xff,0x12,0xe0,0x12,0xff,0xff,0xff,0x7f,0x1f,0xff,0x3c};
134 prnt("Picopass configuration:");
135 print_picopass_info(&hdr);
137 int main(int argc, char *argv[]) {