//Diversify
diversifyKey(item.csn, key_sel_p, div_key);
//Calc mac
- doMAC(item.cc_nr,12, div_key,calculated_MAC);
+ doMAC(item.cc_nr, div_key,calculated_MAC);
if(memcmp(calculated_MAC, item.mac, 4) == 0)
{
long fsize = ftell(f);
fseek(f, 0, SEEK_SET);
+ if (fsize < 0) {
+ prnlog("Error, when getting filesize");
+ fclose(f);
+ return 1;
+ }
+
uint8_t *dump = malloc(fsize);
size_t bytes_read = fread(dump, 1, fsize, f);
{
prnlog("Error, could only read %d bytes (should be %d)",bytes_read, fsize );
}
- return bruteforceDump(dump,fsize,keytable);
+
+ uint8_t res = bruteforceDump(dump,fsize,keytable);
+ free(dump);
+ return res;
}
/**
*