mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-04-01 09:59:57 +08:00
syntax sugar
This commit is contained in:
parent
d13bbcd466
commit
33a994aa3f
2 changed files with 14 additions and 20 deletions
client/loclass
|
@ -426,7 +426,6 @@ int bruteforceItem(dumpdata item, uint16_t keytable[])
|
||||||
return errors;
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* From dismantling iclass-paper:
|
* From dismantling iclass-paper:
|
||||||
* Assume that an adversary somehow learns the first 16 bytes of hash2(K_cus ), i.e., y [0] and z [0] .
|
* Assume that an adversary somehow learns the first 16 bytes of hash2(K_cus ), i.e., y [0] and z [0] .
|
||||||
|
@ -524,8 +523,7 @@ int bruteforceDump(uint8_t dump[], size_t dumpsize, uint16_t keytable[])
|
||||||
// master key calculation
|
// master key calculation
|
||||||
uint8_t first16bytes[16] = {0};
|
uint8_t first16bytes[16] = {0};
|
||||||
|
|
||||||
for(i = 0 ; i < 16 ; i++)
|
for (i = 0 ; i < 16 ; i++) {
|
||||||
{
|
|
||||||
first16bytes[i] = keytable[i] & 0xFF;
|
first16bytes[i] = keytable[i] & 0xFF;
|
||||||
|
|
||||||
if(!(keytable[i] & CRACKED))
|
if(!(keytable[i] & CRACKED))
|
||||||
|
@ -589,7 +587,6 @@ int bruteforceFileNoKeys(const char *filename)
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// TEST CODE BELOW
|
// TEST CODE BELOW
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
int _testBruteforce()
|
int _testBruteforce()
|
||||||
{
|
{
|
||||||
int errors = 0;
|
int errors = 0;
|
||||||
|
@ -637,16 +634,14 @@ int _test_iclass_key_permutation()
|
||||||
permutekey(testcase, testcase_output);
|
permutekey(testcase, testcase_output);
|
||||||
permutekey_rev(testcase_output, testcase_output_rev);
|
permutekey_rev(testcase_output, testcase_output_rev);
|
||||||
|
|
||||||
if(memcmp(testcase_output, testcase_output_correct,8) != 0)
|
if (memcmp(testcase_output, testcase_output_correct,8) != 0) {
|
||||||
{
|
|
||||||
prnlog("Error with iclass key permute!");
|
prnlog("Error with iclass key permute!");
|
||||||
printarr("testcase_output", testcase_output, 8);
|
printarr("testcase_output", testcase_output, 8);
|
||||||
printarr("testcase_output_correct", testcase_output_correct, 8);
|
printarr("testcase_output_correct", testcase_output_correct, 8);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
if(memcmp(testcase, testcase_output_rev, 8) != 0)
|
if (memcmp(testcase, testcase_output_rev, 8) != 0) {
|
||||||
{
|
|
||||||
prnlog("Error with reverse iclass key permute");
|
prnlog("Error with reverse iclass key permute");
|
||||||
printarr("testcase", testcase, 8);
|
printarr("testcase", testcase, 8);
|
||||||
printarr("testcase_output_rev", testcase_output_rev, 8);
|
printarr("testcase_output_rev", testcase_output_rev, 8);
|
||||||
|
@ -658,12 +653,12 @@ int _test_iclass_key_permutation()
|
||||||
}
|
}
|
||||||
int _testHash1()
|
int _testHash1()
|
||||||
{
|
{
|
||||||
|
uint8_t expected[8] = {0x7E,0x72,0x2F,0x40,0x2D,0x02,0x51,0x42};
|
||||||
uint8_t csn[8] = {0x01,0x02,0x03,0x04,0xF7,0xFF,0x12,0xE0};
|
uint8_t csn[8] = {0x01,0x02,0x03,0x04,0xF7,0xFF,0x12,0xE0};
|
||||||
uint8_t k[8] = {0};
|
uint8_t k[8] = {0};
|
||||||
hash1(csn, k);
|
hash1(csn, k);
|
||||||
uint8_t expected[8] = {0x7E,0x72,0x2F,0x40,0x2D,0x02,0x51,0x42};
|
|
||||||
if(memcmp(k,expected,8) != 0)
|
if (memcmp(k,expected,8) != 0) {
|
||||||
{
|
|
||||||
prnlog("Error with hash1!");
|
prnlog("Error with hash1!");
|
||||||
printarr("calculated", k, 8);
|
printarr("calculated", k, 8);
|
||||||
printarr("expected", expected, 8);
|
printarr("expected", expected, 8);
|
||||||
|
|
|
@ -689,7 +689,6 @@ int readKeyFile(uint8_t key[8]) {
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int doKeyTests(uint8_t debuglevel)
|
int doKeyTests(uint8_t debuglevel)
|
||||||
{
|
{
|
||||||
debug_print = debuglevel;
|
debug_print = debuglevel;
|
||||||
|
|
Loading…
Add table
Reference in a new issue