mirror of
https://github.com/Scandal-UK/Incognito_RCM.git
synced 2024-11-22 20:06:42 +00:00
add hash size validation
This commit is contained in:
parent
e81b1e62c7
commit
e7a4f341d9
1 changed files with 31 additions and 11 deletions
|
@ -662,38 +662,58 @@ out:
|
|||
return result;
|
||||
}
|
||||
|
||||
u32 certSize()
|
||||
s32 getClientCertSize()
|
||||
{
|
||||
u32 buffer;
|
||||
readData((u8 *)&buffer, 0x0AD0, sizeof(buffer), NULL);
|
||||
s32 buffer;
|
||||
if(!RETRY(readData((u8 *)&buffer, 0x0AD0, sizeof(buffer), NULL))){
|
||||
return -1;
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
u32 calibrationDataSize()
|
||||
s32 getCalibrationDataSize()
|
||||
{
|
||||
u32 buffer;
|
||||
readData((u8 *)&buffer, 0x08, sizeof(buffer), NULL);
|
||||
s32 buffer;
|
||||
if(!RETRY(readData((u8 *)&buffer, 0x08, sizeof(buffer), NULL))){
|
||||
return -1;
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
bool writeCal0Hash()
|
||||
{
|
||||
return writeHash(0x20, 0x40, calibrationDataSize());
|
||||
s32 calibrationSize = getCalibrationDataSize();
|
||||
if(calibrationSize == -1)
|
||||
return false;
|
||||
|
||||
return writeHash(0x20, 0x40, calibrationSize);
|
||||
}
|
||||
|
||||
bool writeClientCertHash()
|
||||
{
|
||||
return writeHash(0x12E0, 0xAE0, certSize());
|
||||
s32 certSize = getClientCertSize();
|
||||
if(certSize == -1)
|
||||
return false;
|
||||
|
||||
return writeHash(0x12E0, 0xAE0, certSize);
|
||||
}
|
||||
|
||||
bool verifyCal0Hash(u8 *blob)
|
||||
{
|
||||
return verifyHash(0x20, 0x40, calibrationDataSize(), blob);
|
||||
s32 calibrationSize = getCalibrationDataSize();
|
||||
if(calibrationSize == -1)
|
||||
return false;
|
||||
|
||||
return verifyHash(0x20, 0x40, calibrationSize, blob);
|
||||
}
|
||||
|
||||
bool verifyClientCertHash(u8 *blob)
|
||||
{
|
||||
return verifyHash(0x12E0, 0xAE0, certSize(), blob);
|
||||
s32 certSize = getClientCertSize();
|
||||
if(certSize == -1)
|
||||
return false;
|
||||
|
||||
return verifyHash(0x12E0, 0xAE0, certSize, blob);
|
||||
}
|
||||
|
||||
bool verifyProdinfo(u8 *blob)
|
||||
|
|
Loading…
Reference in a new issue