hos: Support new sept/exo keyslots

This commit is contained in:
CTCaer
2020-06-14 13:53:21 +03:00
parent f7f99bddab
commit d607a8830b
8 changed files with 105 additions and 47 deletions

View File

@@ -20,6 +20,7 @@
#include "pkg2.h"
#include "hos.h"
#include "../config/config.h"
#include "../libs/fatfs/ff.h"
#include "../utils/aarch64_util.h"
#include "../mem/heap.h"
@@ -28,6 +29,7 @@
#include "../gfx/gfx.h"
extern hekate_config h_cfg;
extern const u8 package2_keyseed[];
u32 pkg2_newkern_ini1_val;
@@ -158,7 +160,7 @@ pkg2_hdr_t *pkg2_decrypt(void *data, u8 kb)
if ((kb >= KB_FIRMWARE_VERSION_810) && (kb < KB_FIRMWARE_VERSION_MAX))
{
u8 tmp_mkey[0x10];
u8 decr_slot = 12; // Sept mkey.
u8 decr_slot = !h_cfg.aes_slots_new ? 12 : 13; // Sept mkey.
u8 mkey_seeds_cnt = sizeof(mkey_vector_8xx) / 0x10;
u8 mkey_seeds_idx = mkey_seeds_cnt; // Real index + 1.
u8 mkey_seeds_min_idx = mkey_seeds_cnt - (KB_FIRMWARE_VERSION_MAX - kb);
@@ -189,7 +191,7 @@ pkg2_hdr_t *pkg2_decrypt(void *data, u8 kb)
{
mkey_seeds_cnt--;
mkey_seeds_idx = mkey_seeds_cnt;
decr_slot = 12; // Sept mkey.
decr_slot = !h_cfg.aes_slots_new ? 12 : 13; // Sept mkey.
}
// Out of keys. pkg2 is latest or process failed.