From 48e98ab8c94c1a552f6aa85a40c1f3a52f53d91d Mon Sep 17 00:00:00 2001 From: CTCaer Date: Sat, 6 Feb 2021 03:20:43 +0200 Subject: [PATCH] eks: Update old version automatically --- bootloader/hos/hos.c | 6 ++++-- nyx/nyx_gui/hos/hos.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/bootloader/hos/hos.c b/bootloader/hos/hos.c index 732100d..c0e26b1 100644 --- a/bootloader/hos/hos.c +++ b/bootloader/hos/hos.c @@ -265,6 +265,8 @@ void hos_eks_save(u32 kb) // If matching blob doesn't exist, create it. bool update_eks = key_idx ? (h_cfg.eks->enabled[key_idx] < kb) : !h_cfg.eks->enabled[0]; + // If old EKS version was found, update it. + update_eks |= h_cfg.eks->lot0 != FUSE(FUSE_OPT_LOT_CODE_0); if (update_eks) { // Read EKS blob. @@ -281,8 +283,8 @@ void hos_eks_save(u32 kb) } // Get keys. - u8 *keys = (u8 *)calloc(0x1000, 1); - se_get_aes_keys(keys + 0x800, keys, SE_KEY_128_SIZE); + u8 *keys = (u8 *)calloc(0x2000, 1); + se_get_aes_keys(keys + 0x1000, keys, SE_KEY_128_SIZE); // Set magic and personalized info. h_cfg.eks->magic = HOS_EKS_MAGIC; diff --git a/nyx/nyx_gui/hos/hos.c b/nyx/nyx_gui/hos/hos.c index f3f1c13..7cc578f 100644 --- a/nyx/nyx_gui/hos/hos.c +++ b/nyx/nyx_gui/hos/hos.c @@ -234,6 +234,8 @@ void hos_eks_save(u32 kb) // If matching blob doesn't exist, create it. bool update_eks = key_idx ? (h_cfg.eks->enabled[key_idx] < kb) : !h_cfg.eks->enabled[0]; + // If old EKS version was found, update it. + update_eks |= h_cfg.eks->lot0 != FUSE(FUSE_OPT_LOT_CODE_0); if (update_eks) { // Read EKS blob. @@ -250,8 +252,8 @@ void hos_eks_save(u32 kb) } // Get keys. - u8 *keys = (u8 *)calloc(0x1000, 1); - se_get_aes_keys(keys + 0x800, keys, SE_KEY_128_SIZE); + u8 *keys = (u8 *)calloc(0x2000, 1); + se_get_aes_keys(keys + 0x1000, keys, SE_KEY_128_SIZE); // Set magic and personalized info. h_cfg.eks->magic = HOS_EKS_MAGIC;