From bb1087006aca92999094ee3b9fcf7e8b939c0779 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Tue, 6 Jan 2026 22:59:53 +0200 Subject: [PATCH] hekate/nyx: update sha calls based on new bdk --- bootloader/hos/hos.c | 8 ++++---- bootloader/hos/pkg2.c | 4 ++-- nyx/nyx_gui/frontend/fe_emmc_tools.c | 7 ++++--- nyx/nyx_gui/frontend/gui_info.c | 2 +- nyx/nyx_gui/hos/hos.c | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/bootloader/hos/hos.c b/bootloader/hos/hos.c index c70c833e..fd841a54 100644 --- a/bootloader/hos/hos.c +++ b/bootloader/hos/hos.c @@ -666,7 +666,7 @@ static bool _get_fs_exfat_compatible(link_t *info, u32 *hos_revision) if (strcmp((char *)ki->kip1->name, "FS")) continue; - if (!se_calc_sha256_oneshot(sha_buf, ki->kip1, ki->size)) + if (!se_sha_hash_256_oneshot(sha_buf, ki->kip1, ki->size)) break; pkg2_get_ids(&kip_ids, &fs_ids_cnt); @@ -947,9 +947,9 @@ void hos_launch(ini_sec_t *cfg) // Hash only Kernel when it embeds INI1. u8 kernel_hash[0x20]; if (!ctxt.new_pkg2) - se_calc_sha256_oneshot(kernel_hash, ctxt.kernel, ctxt.kernel_size); + se_sha_hash_256_oneshot(kernel_hash, ctxt.kernel, ctxt.kernel_size); else - se_calc_sha256_oneshot(kernel_hash, ctxt.kernel + PKG2_NEWKERN_START, + se_sha_hash_256_oneshot(kernel_hash, ctxt.kernel + PKG2_NEWKERN_START, pkg2_newkern_ini1_start - PKG2_NEWKERN_START); ctxt.pkg2_kernel_id = pkg2_identify(kernel_hash); @@ -989,7 +989,7 @@ void hos_launch(ini_sec_t *cfg) LIST_FOREACH_ENTRY(merge_kip_t, mki, &ctxt.kip1_list, link) pkg2_merge_kip(&kip1_info, (pkg2_kip1_t *)mki->kip1); - // Check if FS is compatible with exFAT and if 5.1.0. + // Check if FS is compatible with exFAT and if 5.1.0 or 10.2.0. if (!ctxt.stock && (sd_fs.fs_type == FS_EXFAT || mkey == HOS_MKEY_VER_500 || ctxt.pkg1_id->fuses == 13)) { bool exfat_compat = _get_fs_exfat_compatible(&kip1_info, &ctxt.exo_ctx.hos_revision); diff --git a/bootloader/hos/pkg2.c b/bootloader/hos/pkg2.c index 8b77a93e..ee73cc17 100644 --- a/bootloader/hos/pkg2.c +++ b/bootloader/hos/pkg2.c @@ -544,7 +544,7 @@ const char *pkg2_patch_kips(link_t *info, char *patch_names) // Check if current KIP not hashed and hash it. if (kip_hash[0] == 0) - if (!se_calc_sha256_oneshot(kip_hash, ki->kip1, ki->size)) + if (!se_sha_hash_256_oneshot(kip_hash, ki->kip1, ki->size)) memset(kip_hash, 0, sizeof(kip_hash)); // Check if kip is the expected version. @@ -870,7 +870,7 @@ DPRINTF("INI1 encrypted\n"); u8 *pk2_hash_data = (u8 *)dst + 0x100 + sizeof(pkg2_hdr_t); for (u32 i = PKG2_SEC_KERNEL; i <= PKG2_SEC_UNUSED; i++) { - se_calc_sha256_oneshot(&hdr->sec_sha256[SE_SHA_256_SIZE * i], (void *)pk2_hash_data, hdr->sec_size[i]); + se_sha_hash_256_oneshot(&hdr->sec_sha256[SE_SHA_256_SIZE * i], (void *)pk2_hash_data, hdr->sec_size[i]); pk2_hash_data += hdr->sec_size[i]; } } diff --git a/nyx/nyx_gui/frontend/fe_emmc_tools.c b/nyx/nyx_gui/frontend/fe_emmc_tools.c index fa323776..98ed370a 100644 --- a/nyx/nyx_gui/frontend/fe_emmc_tools.c +++ b/nyx/nyx_gui/frontend/fe_emmc_tools.c @@ -228,7 +228,8 @@ static int _emmc_sd_copy_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage, return VERIF_STATUS_ERROR; } manual_system_maintenance(false); - se_calc_sha256(hashEm, NULL, bufEm, num << 9, 0, SHA_INIT_HASH, false); + + se_sha_hash_256_async(hashEm, bufEm, num << 9); f_lseek(&fp, (u64)sdFileSector << (u64)9); if (f_read_fast(&fp, bufSd, num << 9)) @@ -248,8 +249,8 @@ static int _emmc_sd_copy_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage, return VERIF_STATUS_ERROR; } manual_system_maintenance(false); - se_calc_sha256_finalize(hashEm, NULL); - se_calc_sha256_oneshot(hashSd, bufSd, num << 9); + se_sha_hash_256_finalize(hashEm); + se_sha_hash_256_oneshot(hashSd, bufSd, num << 9); res = memcmp(hashEm, hashSd, SE_SHA_256_SIZE / 2); if (res) diff --git a/nyx/nyx_gui/frontend/gui_info.c b/nyx/nyx_gui/frontend/gui_info.c index 5c665667..0132e8ba 100644 --- a/nyx/nyx_gui/frontend/gui_info.c +++ b/nyx/nyx_gui/frontend/gui_info.c @@ -290,7 +290,7 @@ static lv_res_t _create_mbox_cal0(lv_obj_t *btn) nx_emmc_cal0_t *cal0 = (nx_emmc_cal0_t *)cal0_buf; u32 hash[8]; - se_calc_sha256_oneshot(hash, (u8 *)&cal0->cfg_id1, cal0->body_size); + se_sha_hash_256_oneshot(hash, (u8 *)&cal0->cfg_id1, cal0->body_size); s_printf(txt_buf, "#FF8000 CAL0 Version:# %d\n" diff --git a/nyx/nyx_gui/hos/hos.c b/nyx/nyx_gui/hos/hos.c index 18741643..01e40df3 100644 --- a/nyx/nyx_gui/hos/hos.c +++ b/nyx/nyx_gui/hos/hos.c @@ -707,7 +707,7 @@ int hos_dump_cal0() } u32 hash[8]; - se_calc_sha256_oneshot(hash, (u8 *)&cal0->cfg_id1, cal0->body_size); + se_sha_hash_256_oneshot(hash, (u8 *)&cal0->cfg_id1, cal0->body_size); if (memcmp(hash, cal0->body_sha256, 0x20)) return 3;