syntax sugar

This commit is contained in:
iceman1001 2017-08-19 16:14:30 +02:00
commit 33a994aa3f
2 changed files with 14 additions and 20 deletions

View file

@ -426,7 +426,6 @@ int bruteforceItem(dumpdata item, uint16_t keytable[])
return errors;
}
/**
* 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] .
@ -524,8 +523,7 @@ int bruteforceDump(uint8_t dump[], size_t dumpsize, uint16_t keytable[])
// master key calculation
uint8_t first16bytes[16] = {0};
for(i = 0 ; i < 16 ; i++)
{
for (i = 0 ; i < 16 ; i++) {
first16bytes[i] = keytable[i] & 0xFF;
if(!(keytable[i] & CRACKED))
@ -589,7 +587,6 @@ int bruteforceFileNoKeys(const char *filename)
// ----------------------------------------------------------------------------
// TEST CODE BELOW
// ----------------------------------------------------------------------------
int _testBruteforce()
{
int errors = 0;
@ -637,16 +634,14 @@ int _test_iclass_key_permutation()
permutekey(testcase, testcase_output);
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!");
printarr("testcase_output", testcase_output, 8);
printarr("testcase_output_correct", testcase_output_correct, 8);
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");
printarr("testcase", testcase, 8);
printarr("testcase_output_rev", testcase_output_rev, 8);
@ -658,12 +653,12 @@ int _test_iclass_key_permutation()
}
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 k[8] = {0};
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!");
printarr("calculated", k, 8);
printarr("expected", expected, 8);

View file

@ -689,7 +689,6 @@ int readKeyFile(uint8_t key[8]) {
return retval;
}
int doKeyTests(uint8_t debuglevel)
{
debug_print = debuglevel;