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