make style

This commit is contained in:
Philippe Teuwen 2020-12-30 01:31:40 +01:00
commit a0e110941a
5 changed files with 35 additions and 35 deletions

View file

@ -314,9 +314,9 @@ static void SendVersion(void) {
struct p payload; struct p payload;
payload.id = *(AT91C_DBGU_CIDR); payload.id = *(AT91C_DBGU_CIDR);
#ifdef WITH_NO_COMPRESSION #ifdef WITH_NO_COMPRESSION
payload.section_size = (uint32_t)&_bootrom_end - (uint32_t)&_bootrom_start + (uint32_t)&__os_size__; payload.section_size = (uint32_t)&_bootrom_end - (uint32_t)&_bootrom_start + (uint32_t)&__os_size__;
#else #else
payload.section_size = text_and_rodata_section_size + compressed_data_section_size; payload.section_size = text_and_rodata_section_size + compressed_data_section_size;
#endif #endif
payload.versionstr_len = strlen(VersionString) + 1; payload.versionstr_len = strlen(VersionString) + 1;
memcpy(payload.versionstr, VersionString, payload.versionstr_len); memcpy(payload.versionstr, VersionString, payload.versionstr_len);

View file

@ -50,23 +50,23 @@ void Vector(void) {
common_area.version = 1; common_area.version = 1;
} }
common_area.flags.osimage_present = 1; common_area.flags.osimage_present = 1;
#ifdef WITH_NO_COMPRESSION #ifdef WITH_NO_COMPRESSION
/* Set up data segment: Copy from flash to ram */ /* Set up data segment: Copy from flash to ram */
char *src = &__data_src_start__; char *src = &__data_src_start__;
char *dst = &__data_start__; char *dst = &__data_start__;
char *end = &__data_end__; char *end = &__data_end__;
while(dst < end) *dst++ = *src++; while (dst < end) *dst++ = *src++;
dst = &__bss_start__; dst = &__bss_start__;
end = &__bss_end__; end = &__bss_end__;
#else #else
uncompress_data_section(); uncompress_data_section();
/* Set up (that is: clear) BSS. */ /* Set up (that is: clear) BSS. */
char *dst = &__bss_start__; char *dst = &__bss_start__;
char *end = &__bss_end__; char *end = &__bss_end__;
#endif #endif
while (dst < end) *dst++ = 0; while (dst < end) *dst++ = 0;
AppMain(); AppMain();

View file

@ -73,7 +73,7 @@ end
--- Set UID on magic command enabled --- Set UID on magic command enabled
function magicUID(b0, b1, b2, isgen1a) function magicUID(b0, b1, b2, isgen1a)
if isgen1a then if isgen1a then
print('Using backdoor Magic tag (gen1a) function') print('Using backdoor Magic tag (gen1a) function')
else else
print('Using backdoor Magic tag (gen1b) function') print('Using backdoor Magic tag (gen1b) function')
@ -81,21 +81,21 @@ function magicUID(b0, b1, b2, isgen1a)
-- write block 0 -- write block 0
core.console('hf 14a raw -k -a -b 7 40') core.console('hf 14a raw -k -a -b 7 40')
if isgen1a then if isgen1a then
core.console('hf 14a raw -k -a 43') core.console('hf 14a raw -k -a 43')
end end
core.console('hf 14a raw -c -a A200'..b0) core.console('hf 14a raw -c -a A200'..b0)
-- write block 1 -- write block 1
core.console('hf 14a raw -k -a -b 7 40') core.console('hf 14a raw -k -a -b 7 40')
if isgen1a then if isgen1a then
core.console('hf 14a raw -k -a 43') core.console('hf 14a raw -k -a 43')
end end
core.console('hf 14a raw -c -a A201'..b1) core.console('hf 14a raw -c -a A201'..b1)
-- write block 2 -- write block 2
core.console('hf 14a raw -k -a -b 7 40') core.console('hf 14a raw -k -a -b 7 40')
if isgen1a then if isgen1a then
core.console('hf 14a raw -k -a 43') core.console('hf 14a raw -k -a 43')
end end
core.console('hf 14a raw -c -a A202'..b2) core.console('hf 14a raw -c -a A202'..b2)
@ -154,7 +154,7 @@ function main(args)
core.clearCommandBuffer() core.clearCommandBuffer()
if tagtype == 3 then if tagtype == 3 then
brickableUID(block0, block1, block2) brickableUID(block0, block1, block2)
else else
local is_gen1a = (tagtype == 1) local is_gen1a = (tagtype == 1)

View file

@ -675,10 +675,10 @@ int ul_print_type(uint32_t tagtype, uint8_t spaces) {
if (ismagic) if (ismagic)
snprintf(typestr + strlen(typestr), 4, " ("); snprintf(typestr + strlen(typestr), 4, " (");
snprintf(typestr + strlen(typestr) , sizeof(typestr) - strlen(typestr), " %s ", (tagtype & MAGIC) ? _GREEN_("magic") : ""); snprintf(typestr + strlen(typestr), sizeof(typestr) - strlen(typestr), " %s ", (tagtype & MAGIC) ? _GREEN_("magic") : "");
tagtype ^= MAGIC; tagtype ^= MAGIC;
snprintf(typestr + strlen(typestr) , sizeof(typestr) - strlen(typestr), "%s", (tagtype & MAGIC_1A) ? _GREEN_("Gen 1a") : ""); snprintf(typestr + strlen(typestr), sizeof(typestr) - strlen(typestr), "%s", (tagtype & MAGIC_1A) ? _GREEN_("Gen 1a") : "");
snprintf(typestr + strlen(typestr) , sizeof(typestr) - strlen(typestr), "%s", (tagtype & MAGIC_1B) ? _GREEN_("Gen 1b") : ""); snprintf(typestr + strlen(typestr), sizeof(typestr) - strlen(typestr), "%s", (tagtype & MAGIC_1B) ? _GREEN_("Gen 1b") : "");
if (ismagic) if (ismagic)
snprintf(typestr + strlen(typestr), 4, " )"); snprintf(typestr + strlen(typestr), 4, " )");
@ -840,9 +840,9 @@ static int ulev1_print_counters(void) {
if (len == 3) { if (len == 3) {
PrintAndLogEx(INFO, " [%0d]: %s", i, sprint_hex(counter, 3)); PrintAndLogEx(INFO, " [%0d]: %s", i, sprint_hex(counter, 3));
PrintAndLogEx(SUCCESS, " - %02X tearing (%s)" PrintAndLogEx(SUCCESS, " - %02X tearing (%s)"
, tear[0] , tear[0]
, (tear[0] == 0xBD) ? _GREEN_("ok") : _RED_("fail") , (tear[0] == 0xBD) ? _GREEN_("ok") : _RED_("fail")
); );
} }
} }
return len; return len;
@ -938,7 +938,7 @@ static int ulev1_print_signature(TagTypeUL_t tagtype, uint8_t *uid, uint8_t *sig
PrintAndLogEx(INFO, "IC signature public key value: %s", nxp_mfu_public_keys[i].value); PrintAndLogEx(INFO, "IC signature public key value: %s", nxp_mfu_public_keys[i].value);
PrintAndLogEx(INFO, " Elliptic curve parameters: NID_secp128r1"); PrintAndLogEx(INFO, " Elliptic curve parameters: NID_secp128r1");
PrintAndLogEx(INFO, " TAG IC Signature: %s", sprint_hex_inrow(signature, signature_len)); PrintAndLogEx(INFO, " TAG IC Signature: %s", sprint_hex_inrow(signature, signature_len));
PrintAndLogEx(SUCCESS, " Signature verification (" _GREEN_("successful") ")" ); PrintAndLogEx(SUCCESS, " Signature verification (" _GREEN_("successful") ")");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -969,9 +969,9 @@ static int ntag_print_counter(void) {
(void)len; (void)len;
PrintAndLogEx(INFO, " [02]: %s", sprint_hex(counter, 3)); PrintAndLogEx(INFO, " [02]: %s", sprint_hex(counter, 3));
PrintAndLogEx(SUCCESS, " - %02X tearing (%s)" PrintAndLogEx(SUCCESS, " - %02X tearing (%s)"
, tear[0] , tear[0]
, (tear[0] == 0xBD) ? _GREEN_("ok") : _RED_("fail") , (tear[0] == 0xBD) ? _GREEN_("ok") : _RED_("fail")
); );
return len; return len;
} }
@ -1513,7 +1513,7 @@ static int CmdHF14AMfUWrBl(const char *Cmd) {
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
arg_str0("k", "key", "<hex>", "key for authentication (UL-C 16 bytes, EV1/NTAG 4 bytes)"), arg_str0("k", "key", "<hex>", "key for authentication (UL-C 16 bytes, EV1/NTAG 4 bytes)"),
arg_lit0("l", NULL, "swap entered key's endianness"), arg_lit0("l", NULL, "swap entered key's endianness"),
arg_int1("b", "block", "<dec>", "block number to write"), arg_int1("b", "block", "<dec>", "block number to write"),
@ -1540,7 +1540,7 @@ static int CmdHF14AMfUWrBl(const char *Cmd) {
has_auth_key = true; has_auth_key = true;
} else if (ak_len == 4) { } else if (ak_len == 4) {
has_pwd = true; has_pwd = true;
} else if (ak_len != 0){ } else if (ak_len != 0) {
PrintAndLogEx(WARNING, "ERROR: Key is incorrect length\n"); PrintAndLogEx(WARNING, "ERROR: Key is incorrect length\n");
return PM3_EINVARG; return PM3_EINVARG;
} }
@ -1559,7 +1559,7 @@ static int CmdHF14AMfUWrBl(const char *Cmd) {
// starting with getting tagtype // starting with getting tagtype
TagTypeUL_t tagtype = GetHF14AMfU_Type(); TagTypeUL_t tagtype = GetHF14AMfU_Type();
if (tagtype == UL_ERROR) if (tagtype == UL_ERROR)
return PM3_ESOFT; return PM3_ESOFT;
uint8_t maxblockno = 0; uint8_t maxblockno = 0;
@ -1576,7 +1576,7 @@ static int CmdHF14AMfUWrBl(const char *Cmd) {
// Swap endianness // Swap endianness
if (swap_endian) { if (swap_endian) {
if (has_auth_key) if (has_auth_key)
authKeyPtr = SwapEndian64(authenticationkey, 16, 8); authKeyPtr = SwapEndian64(authenticationkey, 16, 8);
if (has_pwd) if (has_pwd)
@ -1591,7 +1591,7 @@ static int CmdHF14AMfUWrBl(const char *Cmd) {
if (ak_len) { if (ak_len) {
PrintAndLogEx(INFO, "Using %s " _GREEN_("%s"), (ak_len == 16) ? "3des" : "pwd", sprint_hex(authenticationkey, ak_len)); PrintAndLogEx(INFO, "Using %s " _GREEN_("%s"), (ak_len == 16) ? "3des" : "pwd", sprint_hex(authenticationkey, ak_len));
} }
//Send write Block //Send write Block
// 4 or 16. // 4 or 16.
@ -1643,7 +1643,7 @@ static int CmdHF14AMfURdBl(const char *Cmd) {
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
arg_str0("k", "key", "<hex>", "key for authentication (UL-C 16 bytes, EV1/NTAG 4 bytes)"), arg_str0("k", "key", "<hex>", "key for authentication (UL-C 16 bytes, EV1/NTAG 4 bytes)"),
arg_lit0("l", NULL, "swap entered key's endianness"), arg_lit0("l", NULL, "swap entered key's endianness"),
arg_int1("b", "block", "<dec>", "block number to write"), arg_int1("b", "block", "<dec>", "block number to write"),
@ -1664,7 +1664,7 @@ static int CmdHF14AMfURdBl(const char *Cmd) {
has_auth_key = true; has_auth_key = true;
} else if (ak_len == 4) { } else if (ak_len == 4) {
has_pwd = true; has_pwd = true;
} else if (ak_len != 0){ } else if (ak_len != 0) {
PrintAndLogEx(WARNING, "ERROR: Key is incorrect length\n"); PrintAndLogEx(WARNING, "ERROR: Key is incorrect length\n");
return PM3_EINVARG; return PM3_EINVARG;
} }
@ -1704,7 +1704,7 @@ static int CmdHF14AMfURdBl(const char *Cmd) {
if (ak_len) { if (ak_len) {
PrintAndLogEx(INFO, "Using %s " _GREEN_("%s"), (ak_len == 16) ? "3des" : "pwd", sprint_hex(authenticationkey, ak_len)); PrintAndLogEx(INFO, "Using %s " _GREEN_("%s"), (ak_len == 16) ? "3des" : "pwd", sprint_hex(authenticationkey, ak_len));
} }
//Read Block //Read Block
uint8_t keytype = 0; uint8_t keytype = 0;
@ -1932,13 +1932,13 @@ static int CmdHF14AMfUDump(const char *Cmd) {
has_auth_key = true; has_auth_key = true;
} else if (ak_len == 4) { } else if (ak_len == 4) {
has_pwd = true; has_pwd = true;
} else if (ak_len != 0){ } else if (ak_len != 0) {
PrintAndLogEx(WARNING, "ERROR: Key is incorrect length\n"); PrintAndLogEx(WARNING, "ERROR: Key is incorrect length\n");
return PM3_EINVARG; return PM3_EINVARG;
} }
bool manual_pages = false; bool manual_pages = false;
if ( start_page > 0) if (start_page > 0)
manual_pages = true; manual_pages = true;
if (pages != 16) if (pages != 16)

View file

@ -198,8 +198,8 @@ Check column "offline" for their availability.
|command |offline |description |command |offline |description
|------- |------- |----------- |------- |------- |-----------
|`hf epa help `|Y |`This help` |`hf epa help `|Y |`This help`
|`hf epa cnonces `|N |`<m> <n> <d> Acquire n>0 encrypted PACE nonces of size m>0 with d sec pauses` |`hf epa cnonces `|N |`Acquire encrypted PACE nonces of specific size`
|`hf epa preplay `|N |`<mse> <get> <map> <pka> <ma> Perform PACE protocol by replaying given APDUs` |`hf epa preplay `|N |`Perform PACE protocol by replaying given APDUs`
### hf emrtd ### hf emrtd