Skip to content

Commit

Permalink
fixed bug with variable sized certs
Browse files Browse the repository at this point in the history
  • Loading branch information
blawar committed Feb 24, 2019
1 parent cd3cbb9 commit f8af211
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions source/main.cpp
Expand Up @@ -176,7 +176,7 @@ class Incognito
erase(0x3D70, 0x240); // device cert
erase(0x3FC0, 0x240); // device key

writeHash(0x12E0, 0x0AE0, 0x5EA); // client cert hash
writeHash(0x12E0, 0x0AE0, certSize()); // client cert hash
writeCal0Hash();
return verify();
}
Expand All @@ -192,6 +192,7 @@ class Incognito
}

copy(f, 0x0250, 0x18); // serial
copy(f, 0x0AD0, 0x04); // client size
copy(f, 0x0AE0, 0x800); // client cert
copy(f, 0x12E0, 0x20); // client cert hash
copy(f, 0x3AE0, 0x130); // private key
Expand All @@ -207,7 +208,7 @@ class Incognito

bool verify()
{
bool r = verifyHash(0x12E0, 0x0AE0, 0x5EA); // client cert hash
bool r = verifyHash(0x12E0, 0x0AE0, certSize()); // client cert hash
r &= verifyHash(0x20, 0x0040, calibrationDataSize()); // calibration hash

return r;
Expand All @@ -232,6 +233,11 @@ class Incognito
return read<u32>(0x08);
}

u32 certSize()
{
return read<u32>(0x0AD0);
}

bool writeCal0Hash()
{
return writeHash(0x20, 0x0040, calibrationDataSize());
Expand Down

0 comments on commit f8af211

Please sign in to comment.