mirror of
https://github.com/Scandal-UK/Incognito_RCM.git
synced 2024-11-29 07:12:07 +00:00
formatting
This commit is contained in:
parent
e7a4f341d9
commit
eb1b27366e
1 changed files with 51 additions and 37 deletions
|
@ -71,7 +71,6 @@ sdmmc_t sdmmc;
|
|||
emmc_part_t *system_part;
|
||||
emmc_part_t *prodinfo_part;
|
||||
|
||||
|
||||
#define SECTORS_IN_CLUSTER 32
|
||||
#define PRODINFO_SIZE 0x3FBC00
|
||||
|
||||
|
@ -291,9 +290,12 @@ bool dump_keys()
|
|||
const char magic[4] = "CAL0";
|
||||
char buffer[4];
|
||||
readData((u8 *)buffer, 0, 4, NULL);
|
||||
if(memcmp(magic, buffer, 4) == 0){
|
||||
if (memcmp(magic, buffer, 4) == 0)
|
||||
{
|
||||
gfx_printf("%kOK!\n", COLOR_GREEN);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
gfx_printf("%kError!\n", COLOR_RED);
|
||||
return false;
|
||||
}
|
||||
|
@ -380,7 +382,6 @@ bool incognito()
|
|||
if (!writeCal0Hash())
|
||||
return false;
|
||||
|
||||
|
||||
gfx_printf("\n%kIncognito done!\n", COLOR_GREEN);
|
||||
return true;
|
||||
}
|
||||
|
@ -630,10 +631,13 @@ bool verifyHash(u32 hashOffset, u32 offset, u32 sz, u8 *blob)
|
|||
{
|
||||
bool result = false;
|
||||
u8 *buffer = (u8 *)malloc(sz);
|
||||
if(blob == NULL){
|
||||
if (blob == NULL)
|
||||
{
|
||||
if (!readData(buffer, offset, sz, NULL))
|
||||
goto out;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(buffer, blob + offset, sz);
|
||||
}
|
||||
u8 hash1[0x20];
|
||||
|
@ -641,10 +645,13 @@ bool verifyHash(u32 hashOffset, u32 offset, u32 sz, u8 *blob)
|
|||
|
||||
u8 hash2[0x20];
|
||||
|
||||
if(blob == NULL){
|
||||
if (blob == NULL)
|
||||
{
|
||||
if (!readData(hash2, hashOffset, 0x20, NULL))
|
||||
goto out;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(hash2, blob + hashOffset, 0x20);
|
||||
}
|
||||
|
||||
|
@ -665,7 +672,8 @@ out:
|
|||
s32 getClientCertSize()
|
||||
{
|
||||
s32 buffer;
|
||||
if(!RETRY(readData((u8 *)&buffer, 0x0AD0, sizeof(buffer), NULL))){
|
||||
if (!RETRY(readData((u8 *)&buffer, 0x0AD0, sizeof(buffer), NULL)))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return buffer;
|
||||
|
@ -674,7 +682,8 @@ s32 getClientCertSize()
|
|||
s32 getCalibrationDataSize()
|
||||
{
|
||||
s32 buffer;
|
||||
if(!RETRY(readData((u8 *)&buffer, 0x08, sizeof(buffer), NULL))){
|
||||
if (!RETRY(readData((u8 *)&buffer, 0x08, sizeof(buffer), NULL)))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return buffer;
|
||||
|
@ -723,9 +732,12 @@ bool verifyProdinfo(u8 *blob)
|
|||
if (verifyClientCertHash(blob) && verifyCal0Hash(blob))
|
||||
{
|
||||
char serial[15] = "";
|
||||
if(blob == NULL){
|
||||
if (blob == NULL)
|
||||
{
|
||||
readData((u8 *)serial, 0x250, 14, NULL);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(serial, blob + 0x250, 14);
|
||||
}
|
||||
|
||||
|
@ -853,7 +865,8 @@ bool backupProdinfo()
|
|||
gfx_printf("\n%kError reading from NAND!\n", COLOR_RED);
|
||||
goto out;
|
||||
}
|
||||
if(!verifyProdinfo(bufferNX)){
|
||||
if (!verifyProdinfo(bufferNX))
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
gfx_printf("%k\nWriting to file...\n", COLOR_YELLOW);
|
||||
|
@ -907,7 +920,8 @@ bool restoreProdinfo()
|
|||
gfx_printf("\n%kError reading from file!\n", COLOR_RED);
|
||||
goto out;
|
||||
}
|
||||
if(!verifyProdinfo(bufferNX)){
|
||||
if (!verifyProdinfo(bufferNX))
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
gfx_printf("%kWriting to NAND...\n", COLOR_YELLOW);
|
||||
|
|
Loading…
Reference in a new issue