return len;
}
-//make sure field is off before calling this function
+
+// Fudan check checks for which error is given for a command with incorrect crc
+// NXP UL chip responds with 01, fudan 00.
+// other possible checks:
+// send a0 + crc
+// UL responds with 00, fudan doesn't respond
+// or
+// send a200 + crc
+// UL doesn't respond, fudan responds with 00
+// or
+// send 300000 + crc (read with extra byte(s))
+// UL responds with read of page 0, fudan doesn't respond.
+//
+// make sure field is off before calling this function
static int ul_fudan_check( void ){
iso14a_card_select_t card;
if ( !ul_select(&card) )
uint8_t authenticationkey[16] = {0x00};
uint8_t *authKeyPtr = authenticationkey;
- // starting with getting tagtype
- TagTypeUL_t tagtype = GetHF14AMfU_Type();
- if (tagtype == UL_ERROR) return -1;
-
while(param_getchar(Cmd, cmdp) != 0x00)
{
switch(param_getchar(Cmd, cmdp))
case 'b':
case 'B':
blockNo = param_get8(Cmd, cmdp+1);
-
- uint8_t maxblockno = 0;
- for (uint8_t idx = 0; idx < MAX_UL_TYPES; idx++){
- if (tagtype & UL_TYPES_ARRAY[idx])
- maxblockno = UL_MEMORY_ARRAY[idx];
- }
-
if (blockNo < 0) {
PrintAndLog("Wrong block number");
errors = true;
}
- if (blockNo > maxblockno){
- PrintAndLog("block number too large. Max block is %u/0x%02X \n", maxblockno,maxblockno);
- errors = true;
- }
cmdp += 2;
break;
case 'l':
}
if ( blockNo == -1 ) return usage_hf_mfu_wrbl();
+ // starting with getting tagtype
+ TagTypeUL_t tagtype = GetHF14AMfU_Type();
+ if (tagtype == UL_ERROR) return -1;
+
+ uint8_t maxblockno = 0;
+ for (uint8_t idx = 0; idx < MAX_UL_TYPES; idx++){
+ if (tagtype & UL_TYPES_ARRAY[idx])
+ maxblockno = UL_MEMORY_ARRAY[idx];
+ }
+ if (blockNo > maxblockno){
+ PrintAndLog("block number too large. Max block is %u/0x%02X \n", maxblockno,maxblockno);
+ return usage_hf_mfu_wrbl();
+ }
// Swap endianness
if (swapEndian && hasAuthKey) authKeyPtr = SwapEndian64(authenticationkey, 16, 8);
uint8_t authenticationkey[16] = {0x00};
uint8_t *authKeyPtr = authenticationkey;
- // starting with getting tagtype
- TagTypeUL_t tagtype = GetHF14AMfU_Type();
- if (tagtype == UL_ERROR) return -1;
-
while(param_getchar(Cmd, cmdp) != 0x00)
{
switch(param_getchar(Cmd, cmdp))
case 'b':
case 'B':
blockNo = param_get8(Cmd, cmdp+1);
-
- uint8_t maxblockno = 0;
- for (uint8_t idx = 0; idx < MAX_UL_TYPES; idx++){
- if (tagtype & UL_TYPES_ARRAY[idx])
- maxblockno = UL_MEMORY_ARRAY[idx];
- }
-
if (blockNo < 0) {
PrintAndLog("Wrong block number");
errors = true;
}
- if (blockNo > maxblockno){
- PrintAndLog("block number to large. Max block is %u/0x%02X \n", maxblockno,maxblockno);
- errors = true;
- }
cmdp += 2;
break;
case 'l':
}
if ( blockNo == -1 ) return usage_hf_mfu_rdbl();
+ // start with getting tagtype
+ TagTypeUL_t tagtype = GetHF14AMfU_Type();
+ if (tagtype == UL_ERROR) return -1;
+
+ uint8_t maxblockno = 0;
+ for (uint8_t idx = 0; idx < MAX_UL_TYPES; idx++){
+ if (tagtype & UL_TYPES_ARRAY[idx])
+ maxblockno = UL_MEMORY_ARRAY[idx];
+ }
+ if (blockNo > maxblockno){
+ PrintAndLog("block number to large. Max block is %u/0x%02X \n", maxblockno,maxblockno);
+ return usage_hf_mfu_rdbl();
+ }
// Swap endianness
if (swapEndian && hasAuthKey) authKeyPtr = SwapEndian64(authenticationkey, 16, 8);