CHG: 'hf iclass readblk' - should be able to read block 0,1 on all cards without key.

CHG: 'hf iclass reader' -  two rules according to datasheet
  if app_limit is less than 0x6,  app_limit should be 0x6
  if app_limit is bigger than 31/0x1F on 2kb picopass,  the app_limit should be 26/0x1A
This commit is contained in:
iceman1001 2017-07-05 12:05:53 +02:00
commit dd98b934bc
3 changed files with 48 additions and 5 deletions

View file

@ -1174,9 +1174,16 @@ static int ReadBlock(uint8_t *KEY, uint8_t blockno, uint8_t keyType, bool elite,
uint8_t MAC[4]={0x00,0x00,0x00,0x00};
uint8_t div_key[8]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
if (!select_and_auth(KEY, MAC, div_key, (keyType==0x18), elite, rawkey, verbose))
return 0;
// block 0,1 should always be able to read, and block 5 on some cards.
if (blockno >= 2 ) {
if (!select_and_auth(KEY, MAC, div_key, (keyType==0x18), elite, rawkey, verbose))
return 0;
} else {
uint8_t CSN[8]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
uint8_t CCNR[12]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
if (!select_only(CSN, CCNR, false, verbose))
return false;
}
UsbCommand resp;
UsbCommand w = {CMD_ICLASS_READBLOCK, {blockno}};
clearCommandBuffer();