1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-29 21:12:06 +00:00

More unfattening (like always)

This commit is contained in:
Kostas Missos 2018-07-10 16:59:03 +03:00
parent 9401897f93
commit bc67798f43
3 changed files with 39 additions and 53 deletions

View file

@ -84,7 +84,7 @@ typedef struct _merge_kip_t
#define KB_FIRMWARE_VERSION_500 4 #define KB_FIRMWARE_VERSION_500 4
#define KB_FIRMWARE_VERSION_MAX KB_FIRMWARE_VERSION_500 #define KB_FIRMWARE_VERSION_MAX KB_FIRMWARE_VERSION_500
// Exosphère magic "XBC0" // Exosphère magic "XBC0".
#define MAGIC_EXOSPHERE 0x30434258 #define MAGIC_EXOSPHERE 0x30434258
static const u8 keyblob_keyseeds[][0x10] = { static const u8 keyblob_keyseeds[][0x10] = {
@ -124,7 +124,7 @@ static void _se_lock()
SE(0x4) = 0; // Make this reg secure only. SE(0x4) = 0; // Make this reg secure only.
SE(SE_KEY_TABLE_ACCESS_LOCK_OFFSET) = 0; // Make all key access regs secure only. SE(SE_KEY_TABLE_ACCESS_LOCK_OFFSET) = 0; // Make all key access regs secure only.
SE(SE_RSA_KEYTABLE_ACCESS_LOCK_OFFSET) = 0; //Make all rsa access regs secure only. SE(SE_RSA_KEYTABLE_ACCESS_LOCK_OFFSET) = 0; // Make all RSA access regs secure only.
SE(SE_SECURITY_0) &= 0xFFFFFFFB; // Make access lock regs secure only. SE(SE_SECURITY_0) &= 0xFFFFFFFB; // Make access lock regs secure only.
// This is useful for documenting the bits in the SE config registers, so we can keep it around. // This is useful for documenting the bits in the SE config registers, so we can keep it around.
@ -244,7 +244,7 @@ static int _read_emmc_pkg1(launch_ctxt_t *ctxt)
ctxt->pkg1_id = pkg1_identify(ctxt->pkg1); ctxt->pkg1_id = pkg1_identify(ctxt->pkg1);
if (!ctxt->pkg1_id) if (!ctxt->pkg1_id)
{ {
gfx_printf(&gfx_con, "%kCould not identify package1,\nVersion (= '%s').%k\n", 0xFFFF0000, (char *)ctxt->pkg1 + 0x10, 0xFFCCCCCC); gfx_printf(&gfx_con, "%kUnknown package1,\nVersion (= '%s').%k\n", 0xFFFF0000, (char *)ctxt->pkg1 + 0x10, 0xFFCCCCCC);
goto out; goto out;
} }
gfx_printf(&gfx_con, "Identified package1 ('%s'),\nKeyblob version %d\n\n", (char *)(ctxt->pkg1 + 0x10), ctxt->pkg1_id->kb); gfx_printf(&gfx_con, "Identified package1 ('%s'),\nKeyblob version %d\n\n", (char *)(ctxt->pkg1 + 0x10), ctxt->pkg1_id->kb);

View file

@ -99,7 +99,7 @@ int sd_mount()
} }
else else
{ {
EPRINTFARGS("Failed to mount SD card (FatFS Error %d).\n(make sure that a FAT type partition exists)", res); EPRINTFARGS("Failed to mount SD card (FatFS Error %d).\nMake sure that a FAT partition exists..", res);
} }
} }
@ -390,12 +390,9 @@ void print_fuseinfo()
{ {
if (sd_mount()) if (sd_mount())
{ {
char fuseFilename[23];
f_mkdir("Backup"); f_mkdir("Backup");
f_mkdir("Backup/Dumps"); f_mkdir("Backup/Dumps");
memcpy(fuseFilename, "Backup/Dumps/fuses.bin", 23); if (!sd_save_to_file((u8 *)0x7000F900, 0x2FC, "Backup/Dumps/fuses.bin"))
if (!sd_save_to_file((u8 *)0x7000F900, 0x2FC, fuseFilename))
gfx_puts(&gfx_con, "\nDone!\n"); gfx_puts(&gfx_con, "\nDone!\n");
sd_unmount(); sd_unmount();
} }
@ -423,12 +420,9 @@ void print_kfuseinfo()
{ {
if (sd_mount()) if (sd_mount())
{ {
char kfuseFilename[24];
f_mkdir("Backup"); f_mkdir("Backup");
f_mkdir("Backup/Dumps"); f_mkdir("Backup/Dumps");
memcpy(kfuseFilename, "Backup/Dumps/kfuses.bin", 24); if (!sd_save_to_file((u8 *)buf, KFUSE_NUM_WORDS * 4, "Backup/Dumps/kfuses.bin"))
if (!sd_save_to_file((u8 *)buf, KFUSE_NUM_WORDS * 4, kfuseFilename))
gfx_puts(&gfx_con, "\nDone!\n"); gfx_puts(&gfx_con, "\nDone!\n");
sd_unmount(); sd_unmount();
} }
@ -457,7 +451,7 @@ void print_mmc_info()
u16 card_type; u16 card_type;
u32 speed; u32 speed;
gfx_printf(&gfx_con, "%kCard IDentification:%k\n", 0xFF00DDFF, 0xFFCCCCCC); gfx_printf(&gfx_con, "%kCID:%k\n", 0xFF00DDFF, 0xFFCCCCCC);
switch (storage.csd.mmca_vsn) switch (storage.csd.mmca_vsn)
{ {
case 0: /* MMC v1.0 - v1.2 */ case 0: /* MMC v1.0 - v1.2 */
@ -500,7 +494,7 @@ void print_mmc_info()
EPRINTF("Unknown CSD structure."); EPRINTF("Unknown CSD structure.");
else else
{ {
gfx_printf(&gfx_con, "%kExtended Card-Specific Data V1.%d:%k\n", gfx_printf(&gfx_con, "%kExtended CSD V1.%d:%k\n",
0xFF00DDFF, storage.ext_csd.ext_struct, 0xFFCCCCCC); 0xFF00DDFF, storage.ext_csd.ext_struct, 0xFFCCCCCC);
card_type = storage.ext_csd.card_type; card_type = storage.ext_csd.card_type;
u8 card_type_support[96]; u8 card_type_support[96];
@ -664,7 +658,7 @@ void print_tsec_key()
const pkg1_id_t *pkg1_id = pkg1_identify(pkg1); const pkg1_id_t *pkg1_id = pkg1_identify(pkg1);
if (!pkg1_id) if (!pkg1_id)
{ {
EPRINTFARGS("Could not identify package1 version\nto read TSEC firmware (= '%s').", EPRINTFARGS("Unknown package1 version for reading\nTSEC firmware (= '%s').",
(char *)pkg1 + 0x10); (char *)pkg1 + 0x10);
goto out_wait; goto out_wait;
} }
@ -693,20 +687,15 @@ void print_tsec_key()
{ {
if (sd_mount()) if (sd_mount())
{ {
char tsec_keyFilename[26];
f_mkdir("Backup"); f_mkdir("Backup");
f_mkdir("Backup/Dumps"); f_mkdir("Backup/Dumps");
memcpy(tsec_keyFilename, "Backup/Dumps/tsec_key.bin", 26); if (!sd_save_to_file(keys, 0x10 * 3, "Backup/Dumps/tsec_key.bin"))
if (!sd_save_to_file(keys, 0x10 * 3, tsec_keyFilename))
gfx_puts(&gfx_con, "\nDone!\n"); gfx_puts(&gfx_con, "\nDone!\n");
sd_unmount(); sd_unmount();
} }
} }
else else
{
goto out; goto out;
}
out_wait:; out_wait:;
btn_wait(); btn_wait();
@ -1556,7 +1545,7 @@ void dump_packages12()
if (!pkg1_id) if (!pkg1_id)
{ {
gfx_con.fntsz = 8; gfx_con.fntsz = 8;
EPRINTFARGS("Could not identify package1 version to read TSEC firmware (= '%s').", (char *)pkg1 + 0x10); EPRINTFARGS("Unknown package1 version for reading\nTSEC firmware (= '%s').", (char *)pkg1 + 0x10);
goto out; goto out;
} }
@ -1610,7 +1599,7 @@ void dump_packages12()
goto out; goto out;
gfx_puts(&gfx_con, "Warmboot dumped to warmboot.bin\n\n\n"); gfx_puts(&gfx_con, "Warmboot dumped to warmboot.bin\n\n\n");
// Dump package2.1 // Dump package2.1.
sdmmc_storage_set_mmc_partition(&storage, 0); sdmmc_storage_set_mmc_partition(&storage, 0);
// Parse eMMC GPT. // Parse eMMC GPT.
LIST_INIT(gpt); LIST_INIT(gpt);
@ -2234,12 +2223,9 @@ void print_battery_info()
{ {
if (sd_mount()) if (sd_mount())
{ {
char fuelFilename[28];
f_mkdir("Backup"); f_mkdir("Backup");
f_mkdir("Backup/Dumps"); f_mkdir("Backup/Dumps");
memcpy(fuelFilename, "Backup/Dumps/fuel_gauge.bin", 28); if (sd_save_to_file((u8 *)buf, 0x200, "Backup/Dumps/fuel_gauge.bin"))
if (sd_save_to_file((u8 *)buf, 0x200, fuelFilename))
EPRINTF("\nError creating fuel.bin file."); EPRINTF("\nError creating fuel.bin file.");
else else
gfx_puts(&gfx_con, "\nDone!\n"); gfx_puts(&gfx_con, "\nDone!\n");