forked from CTCaer/hekate
hekate/nyx: use zalloc where appropriate
This commit is contained in:
parent
d687b53249
commit
4effaab241
@ -218,7 +218,7 @@ static void _hos_eks_get()
|
||||
if (!h_cfg.eks)
|
||||
{
|
||||
// Read EKS blob.
|
||||
u8 *mbr = calloc(SD_BLOCKSIZE, 1);
|
||||
u8 *mbr = zalloc(SD_BLOCKSIZE);
|
||||
if (!hos_eks_rw_try(mbr, false))
|
||||
goto out;
|
||||
|
||||
@ -248,7 +248,7 @@ static void _hos_eks_save()
|
||||
bool new_eks = false;
|
||||
if (!h_cfg.eks)
|
||||
{
|
||||
h_cfg.eks = calloc(SD_BLOCKSIZE, 1);
|
||||
h_cfg.eks = zalloc(SD_BLOCKSIZE);
|
||||
new_eks = true;
|
||||
}
|
||||
|
||||
@ -256,7 +256,7 @@ static void _hos_eks_save()
|
||||
if (h_cfg.eks->enabled != HOS_EKS_TSEC_VER)
|
||||
{
|
||||
// Read EKS blob.
|
||||
u8 *mbr = calloc(SD_BLOCKSIZE, 1);
|
||||
u8 *mbr = zalloc(SD_BLOCKSIZE);
|
||||
if (!hos_eks_rw_try(mbr, false))
|
||||
{
|
||||
if (new_eks)
|
||||
@ -269,7 +269,7 @@ static void _hos_eks_save()
|
||||
}
|
||||
|
||||
// Get keys.
|
||||
u8 *keys = (u8 *)calloc(SZ_4K, 2);
|
||||
u8 *keys = (u8 *)zalloc(SZ_8K);
|
||||
se_get_aes_keys(keys + SZ_4K, keys, SE_KEY_128_SIZE);
|
||||
|
||||
// Set magic and personalized info.
|
||||
@ -283,7 +283,7 @@ static void _hos_eks_save()
|
||||
memcpy(h_cfg.eks->troot_dev, keys + 11 * SE_KEY_128_SIZE, SE_KEY_128_SIZE);
|
||||
|
||||
// Encrypt EKS blob.
|
||||
u8 *eks = calloc(SD_BLOCKSIZE, 1);
|
||||
u8 *eks = zalloc(SD_BLOCKSIZE);
|
||||
memcpy(eks, h_cfg.eks, sizeof(hos_eks_mbr_t));
|
||||
se_aes_crypt_ecb(14, ENCRYPT, eks, sizeof(hos_eks_mbr_t), eks, sizeof(hos_eks_mbr_t));
|
||||
|
||||
@ -310,7 +310,7 @@ void hos_eks_clear(u32 kb)
|
||||
if (h_cfg.eks->enabled)
|
||||
{
|
||||
// Read EKS blob.
|
||||
u8 *mbr = calloc(SD_BLOCKSIZE, 1);
|
||||
u8 *mbr = zalloc(SD_BLOCKSIZE);
|
||||
if (!hos_eks_rw_try(mbr, false))
|
||||
goto out;
|
||||
|
||||
@ -318,7 +318,7 @@ void hos_eks_clear(u32 kb)
|
||||
h_cfg.eks->enabled = 0;
|
||||
|
||||
// Encrypt EKS blob.
|
||||
u8 *eks = calloc(SD_BLOCKSIZE, 1);
|
||||
u8 *eks = zalloc(SD_BLOCKSIZE);
|
||||
memcpy(eks, h_cfg.eks, sizeof(hos_eks_mbr_t));
|
||||
se_aes_crypt_ecb(14, ENCRYPT, eks, sizeof(hos_eks_mbr_t), eks, sizeof(hos_eks_mbr_t));
|
||||
|
||||
@ -646,7 +646,7 @@ try_load:
|
||||
// Read the correct keyblob for older HOS versions.
|
||||
if (ctxt->pkg1_id->kb <= HOS_KB_VERSION_600)
|
||||
{
|
||||
ctxt->keyblob = (u8 *)calloc(EMMC_BLOCKSIZE, 1);
|
||||
ctxt->keyblob = (u8 *)zalloc(EMMC_BLOCKSIZE);
|
||||
emummc_storage_read(PKG1_HOS_KEYBLOBS_OFFSET / EMMC_BLOCKSIZE + ctxt->pkg1_id->kb, 1, ctxt->keyblob);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018 naehrwert
|
||||
* Copyright (c) 2018-2021 CTCaer
|
||||
* Copyright (c) 2018-2024 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@ -122,27 +122,28 @@ int config_kip1patch(launch_ctxt_t *ctxt, const char *value)
|
||||
if (value == NULL)
|
||||
return 0;
|
||||
|
||||
int valueLen = strlen(value);
|
||||
if (!valueLen)
|
||||
int len = strlen(value);
|
||||
if (!len)
|
||||
return 0;
|
||||
|
||||
if (ctxt->kip1_patches == NULL)
|
||||
{
|
||||
ctxt->kip1_patches = malloc(valueLen + 1);
|
||||
memcpy(ctxt->kip1_patches, value, valueLen);
|
||||
ctxt->kip1_patches[valueLen] = 0;
|
||||
ctxt->kip1_patches = malloc(len + 1);
|
||||
memcpy(ctxt->kip1_patches, value, len);
|
||||
ctxt->kip1_patches[len] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *oldAlloc = ctxt->kip1_patches;
|
||||
int oldSize = strlen(oldAlloc);
|
||||
ctxt->kip1_patches = malloc(oldSize + 1 + valueLen + 1);
|
||||
memcpy(ctxt->kip1_patches, oldAlloc, oldSize);
|
||||
free(oldAlloc);
|
||||
oldAlloc = NULL;
|
||||
ctxt->kip1_patches[oldSize++] = ',';
|
||||
memcpy(&ctxt->kip1_patches[oldSize], value, valueLen);
|
||||
ctxt->kip1_patches[oldSize + valueLen] = 0;
|
||||
char *old_addr = ctxt->kip1_patches;
|
||||
int old_len = strlen(old_addr);
|
||||
|
||||
ctxt->kip1_patches = malloc(old_len + 1 + len + 1);
|
||||
memcpy(ctxt->kip1_patches, old_addr, old_len);
|
||||
free(old_addr);
|
||||
|
||||
ctxt->kip1_patches[old_len++] = ',';
|
||||
memcpy(&ctxt->kip1_patches[old_len], value, len);
|
||||
ctxt->kip1_patches[old_len + len] = 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -220,7 +221,7 @@ static int _config_exo_user_pmu_access(launch_ctxt_t *ctxt, const char *value)
|
||||
static int _config_exo_usb3_force(launch_ctxt_t *ctxt, const char *value)
|
||||
{
|
||||
// Override key found.
|
||||
ctxt->exo_ctx.usb3_force = calloc(sizeof(bool), 1);
|
||||
ctxt->exo_ctx.usb3_force = zalloc(sizeof(bool));
|
||||
|
||||
if (*value == '1')
|
||||
{
|
||||
@ -233,7 +234,7 @@ static int _config_exo_usb3_force(launch_ctxt_t *ctxt, const char *value)
|
||||
static int _config_exo_cal0_blanking(launch_ctxt_t *ctxt, const char *value)
|
||||
{
|
||||
// Override key found.
|
||||
ctxt->exo_ctx.cal0_blank = calloc(sizeof(bool), 1);
|
||||
ctxt->exo_ctx.cal0_blank = zalloc(sizeof(bool));
|
||||
|
||||
if (*value == '1')
|
||||
{
|
||||
@ -246,7 +247,7 @@ static int _config_exo_cal0_blanking(launch_ctxt_t *ctxt, const char *value)
|
||||
static int _config_exo_cal0_writes_enable(launch_ctxt_t *ctxt, const char *value)
|
||||
{
|
||||
// Override key found.
|
||||
ctxt->exo_ctx.cal0_allow_writes_sys = calloc(sizeof(bool), 1);
|
||||
ctxt->exo_ctx.cal0_allow_writes_sys = zalloc(sizeof(bool));
|
||||
|
||||
if (*value == '1')
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018 naehrwert
|
||||
* Copyright (c) 2018-2023 CTCaer
|
||||
* Copyright (c) 2018-2024 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@ -77,7 +77,7 @@ static void parse_external_kip_patches()
|
||||
if (ini_patch_parse(&ini_kip_sections, "bootloader/patches.ini"))
|
||||
{
|
||||
// Copy ids into a new patchset.
|
||||
_kip_id_sets = calloc(sizeof(kip1_id_t), 256); // Max 256 kip ids.
|
||||
_kip_id_sets = zalloc(sizeof(kip1_id_t) * 256); // Max 256 kip ids.
|
||||
memcpy(_kip_id_sets, _kip_ids, sizeof(_kip_ids));
|
||||
|
||||
// Parse patchsets and glue them together.
|
||||
@ -109,12 +109,12 @@ static void parse_external_kip_patches()
|
||||
{
|
||||
curr_kip->name = ini_psec->name;
|
||||
memcpy(curr_kip->hash, ini_psec->hash, 8);
|
||||
curr_kip->patchset = calloc(sizeof(kip1_patchset_t), 1);
|
||||
curr_kip->patchset = zalloc(sizeof(kip1_patchset_t));
|
||||
|
||||
_kip_id_sets_cnt++;
|
||||
}
|
||||
|
||||
kip1_patchset_t *patchsets = (kip1_patchset_t *)calloc(sizeof(kip1_patchset_t), 16); // Max 16 patchsets per kip.
|
||||
kip1_patchset_t *patchsets = (kip1_patchset_t *)zalloc(sizeof(kip1_patchset_t) * 16); // Max 16 patchsets per kip.
|
||||
|
||||
u32 curr_patchset_idx;
|
||||
for (curr_patchset_idx = 0; curr_kip->patchset[curr_patchset_idx].name != NULL; curr_patchset_idx++)
|
||||
@ -128,7 +128,7 @@ static void parse_external_kip_patches()
|
||||
u32 curr_patch_idx = 0;
|
||||
|
||||
// Parse patches and glue them together to a patchset.
|
||||
kip1_patch_t *patches = calloc(sizeof(kip1_patch_t), 32); // Max 32 patches per set.
|
||||
kip1_patch_t *patches = zalloc(sizeof(kip1_patch_t) * 32); // Max 32 patches per set.
|
||||
LIST_FOREACH_ENTRY(ini_patchset_t, pt, &ini_psec->pts, link)
|
||||
{
|
||||
if (first_ext_patch)
|
||||
@ -142,7 +142,7 @@ static void parse_external_kip_patches()
|
||||
// New patchset name found, create a new set.
|
||||
curr_patchset_idx++;
|
||||
curr_patch_idx = 0;
|
||||
patches = calloc(sizeof(kip1_patch_t), 32); // Max 32 patches per set.
|
||||
patches = zalloc(sizeof(kip1_patch_t) * 32); // Max 32 patches per set.
|
||||
|
||||
patchsets[curr_patchset_idx].name = pt->name;
|
||||
patchsets[curr_patchset_idx].patches = patches;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 CTCaer
|
||||
* Copyright (c) 2019-2024 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@ -80,7 +80,7 @@ static ini_kip_sec_t *_ini_create_kip_section(link_t *dst, ini_kip_sec_t *ksec,
|
||||
|
||||
// Calculate total allocation size.
|
||||
u32 len = strlen(name);
|
||||
char *buf = calloc(sizeof(ini_kip_sec_t) + len + 1, 1);
|
||||
char *buf = zalloc(sizeof(ini_kip_sec_t) + len + 1);
|
||||
|
||||
ksec = (ini_kip_sec_t *)buf;
|
||||
u32 i = _find_patch_section_name(name, len, ':') + 1;
|
||||
@ -132,7 +132,7 @@ int ini_patch_parse(link_t *dst, char *ini_path)
|
||||
u32 pos = _find_patch_section_name(lbuf, lblen, '=');
|
||||
|
||||
// Calculate total allocation size.
|
||||
char *buf = calloc(sizeof(ini_patchset_t) + strlen(&lbuf[1]) + 1, 1);
|
||||
char *buf = zalloc(sizeof(ini_patchset_t) + strlen(&lbuf[1]) + 1);
|
||||
ini_patchset_t *pt = (ini_patchset_t *)buf;
|
||||
|
||||
// Set patch name.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2018 naehrwert
|
||||
*
|
||||
* Copyright (c) 2018-2023 CTCaer
|
||||
* Copyright (c) 2018-2024 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@ -767,7 +767,7 @@ static void _check_for_updated_bootloader()
|
||||
_launch_payload("bootloader/update.bin", true, false);
|
||||
else
|
||||
{
|
||||
u8 *buf = calloc(0x200, 1);
|
||||
u8 *buf = zalloc(0x200);
|
||||
is_ipl_updated(buf, "bootloader/update.bin", true);
|
||||
free(buf);
|
||||
}
|
||||
@ -1236,7 +1236,7 @@ static void _check_low_battery()
|
||||
|
||||
u8 *battery_icon = malloc(0x95A); // 21x38x3
|
||||
u8 *charging_icon = malloc(0x2F4); // 21x12x3
|
||||
u8 *no_charging_icon = calloc(0x2F4, 1);
|
||||
u8 *no_charging_icon = zalloc(0x2F4);
|
||||
|
||||
memcpy(charging_icon, battery_res, 0x2F4);
|
||||
memcpy(battery_icon, battery_res + 0x2F4, 0x95A);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2018 naehrwert
|
||||
* Copyright (c) 2018 Rajko Stojadinovic
|
||||
* Copyright (c) 2018-2022 CTCaer
|
||||
* Copyright (c) 2018-2024 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@ -40,7 +40,7 @@ extern char *emmcsn_path_impl(char *path, char *sub_dir, char *filename, sdmmc_s
|
||||
static void _get_valid_partition(u32 *sector_start, u32 *sector_size, u32 *part_idx, bool backup)
|
||||
{
|
||||
sd_mount();
|
||||
mbr_t *mbr = (mbr_t *)calloc(sizeof(mbr_t), 1);
|
||||
mbr_t *mbr = (mbr_t *)zalloc(sizeof(mbr_t));
|
||||
sdmmc_storage_read(&sd_storage, 0, 1, mbr);
|
||||
|
||||
*part_idx = 0;
|
||||
@ -90,7 +90,7 @@ static void _get_valid_partition(u32 *sector_start, u32 *sector_size, u32 *part_
|
||||
// Get emuMMC GPP size.
|
||||
if (backup && *part_idx && *sector_size)
|
||||
{
|
||||
gpt_t *gpt = (gpt_t *)calloc(sizeof(gpt_t), 1);
|
||||
gpt_t *gpt = (gpt_t *)zalloc(sizeof(gpt_t));
|
||||
sdmmc_storage_read(&sd_storage, *sector_start + 0x4001, 1, gpt);
|
||||
|
||||
u32 new_size = gpt->header.alt_lba + 1;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2018 naehrwert
|
||||
* Copyright (c) 2018 Rajko Stojadinovic
|
||||
* Copyright (c) 2018-2023 CTCaer
|
||||
* Copyright (c) 2018-2024 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@ -705,7 +705,7 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part
|
||||
|
||||
// Read MBR, GPT and backup GPT.
|
||||
mbr_t mbr;
|
||||
gpt_t *gpt = calloc(1, sizeof(gpt_t));
|
||||
gpt_t *gpt = zalloc(sizeof(gpt_t));
|
||||
gpt_header_t gpt_hdr_backup;
|
||||
sdmmc_storage_read(&emmc_storage, 0, 1, &mbr);
|
||||
sdmmc_storage_read(&emmc_storage, 1, sizeof(gpt_t) >> 9, gpt);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018 naehrwert
|
||||
* Copyright (c) 2018-2023 CTCaer
|
||||
* Copyright (c) 2018-2024 CTCaer
|
||||
* Copyright (c) 2018 balika011
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@ -1107,7 +1107,7 @@ static lv_res_t _create_mbox_emmc_sandisk_report(lv_obj_t * btn)
|
||||
|
||||
lv_mbox_set_text(mbox, "#C7EA46 Sandisk Device Report#");
|
||||
|
||||
u8 *buf = calloc(EMMC_BLOCKSIZE, 1);
|
||||
u8 *buf = zalloc(EMMC_BLOCKSIZE);
|
||||
char *txt_buf = (char *)malloc(SZ_32K);
|
||||
char *txt_buf2 = (char *)malloc(SZ_32K);
|
||||
txt_buf[0] = 0;
|
||||
|
@ -1145,10 +1145,10 @@ static lv_res_t _create_window_dump_pk12_tool(lv_obj_t *btn)
|
||||
char path[128];
|
||||
|
||||
u8 kb = 0;
|
||||
u8 *pkg1 = (u8 *)calloc(1, SZ_256K);
|
||||
u8 *warmboot = (u8 *)calloc(1, SZ_256K);
|
||||
u8 *secmon = (u8 *)calloc(1, SZ_256K);
|
||||
u8 *loader = (u8 *)calloc(1, SZ_256K);
|
||||
u8 *pkg1 = (u8 *)zalloc(SZ_256K);
|
||||
u8 *warmboot = (u8 *)zalloc(SZ_256K);
|
||||
u8 *secmon = (u8 *)zalloc(SZ_256K);
|
||||
u8 *loader = (u8 *)zalloc(SZ_256K);
|
||||
u8 *pkg2 = NULL;
|
||||
|
||||
char *txt_buf = (char *)malloc(SZ_16K);
|
||||
@ -1207,7 +1207,7 @@ static lv_res_t _create_window_dump_pk12_tool(lv_obj_t *btn)
|
||||
tsec_ctxt.pkg11_off = pkg1_id->pkg11_off;
|
||||
|
||||
// Read keyblob.
|
||||
u8 *keyblob = (u8 *)calloc(EMMC_BLOCKSIZE, 1);
|
||||
u8 *keyblob = (u8 *)zalloc(EMMC_BLOCKSIZE);
|
||||
sdmmc_storage_read(&emmc_storage, HOS_KEYBLOBS_OFFSET / EMMC_BLOCKSIZE + kb, 1, keyblob);
|
||||
|
||||
// Decrypt.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 CTCaer
|
||||
* Copyright (c) 2019-2024 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@ -345,7 +345,7 @@ static void _prepare_and_flash_mbr_gpt()
|
||||
|
||||
if (part_info.and_size)
|
||||
{
|
||||
gpt_t *gpt = calloc(1, sizeof(gpt_t));
|
||||
gpt_t *gpt = zalloc(sizeof(gpt_t));
|
||||
gpt_header_t gpt_hdr_backup = { 0 };
|
||||
|
||||
// Set GPT protective partition in MBR.
|
||||
@ -768,7 +768,7 @@ exit:
|
||||
static u32 _get_available_l4t_partition()
|
||||
{
|
||||
mbr_t mbr = { 0 };
|
||||
gpt_t *gpt = calloc(1, sizeof(gpt_t));
|
||||
gpt_t *gpt = zalloc(sizeof(gpt_t));
|
||||
|
||||
memset(&l4t_flash_ctxt, 0, sizeof(l4t_flasher_ctxt_t));
|
||||
|
||||
@ -815,7 +815,7 @@ static u32 _get_available_l4t_partition()
|
||||
|
||||
static bool _get_available_android_partition()
|
||||
{
|
||||
gpt_t *gpt = calloc(1, sizeof(gpt_t));
|
||||
gpt_t *gpt = zalloc(sizeof(gpt_t));
|
||||
|
||||
// Read main GPT.
|
||||
sdmmc_storage_read(&sd_storage, 1, sizeof(gpt_t) >> 9, gpt);
|
||||
@ -1007,7 +1007,7 @@ static lv_res_t _action_flash_android_data(lv_obj_t * btns, const char * txt)
|
||||
|
||||
// Flash Android components.
|
||||
char path[128];
|
||||
gpt_t *gpt = calloc(1, sizeof(gpt_t));
|
||||
gpt_t *gpt = zalloc(sizeof(gpt_t));
|
||||
char *txt_buf = malloc(SZ_4K);
|
||||
|
||||
lv_obj_t *dark_bg = lv_obj_create(lv_scr_act(), NULL);
|
||||
@ -1077,7 +1077,7 @@ static lv_res_t _action_flash_android_data(lv_obj_t * btns, const char * txt)
|
||||
if (file_size % 0x200)
|
||||
{
|
||||
file_size = ALIGN(file_size, 0x200);
|
||||
u8 *buf_tmp = calloc(file_size, 1);
|
||||
u8 *buf_tmp = zalloc(file_size);
|
||||
memcpy(buf_tmp, buf, file_size);
|
||||
free(buf);
|
||||
buf = buf_tmp;
|
||||
@ -1141,7 +1141,7 @@ boot_img_not_found:
|
||||
if (file_size % 0x200)
|
||||
{
|
||||
file_size = ALIGN(file_size, 0x200);
|
||||
u8 *buf_tmp = calloc(file_size, 1);
|
||||
u8 *buf_tmp = zalloc(file_size);
|
||||
memcpy(buf_tmp, buf, file_size);
|
||||
free(buf);
|
||||
buf = buf_tmp;
|
||||
@ -1203,7 +1203,7 @@ recovery_not_found:
|
||||
if (file_size % 0x200)
|
||||
{
|
||||
file_size = ALIGN(file_size, 0x200);
|
||||
u8 *buf_tmp = calloc(file_size, 1);
|
||||
u8 *buf_tmp = zalloc(file_size);
|
||||
memcpy(buf_tmp, buf, file_size);
|
||||
free(buf);
|
||||
buf = buf_tmp;
|
||||
@ -2228,7 +2228,7 @@ static lv_res_t _action_fix_mbr(lv_obj_t *btn)
|
||||
lv_label_set_recolor(lbl_status, true);
|
||||
|
||||
mbr_t mbr[2] = { 0 };
|
||||
gpt_t *gpt = calloc(1, sizeof(gpt_t));
|
||||
gpt_t *gpt = zalloc(sizeof(gpt_t));
|
||||
gpt_header_t gpt_hdr_backup = { 0 };
|
||||
|
||||
bool has_mbr_attributes = false;
|
||||
@ -2279,7 +2279,7 @@ static lv_res_t _action_fix_mbr(lv_obj_t *btn)
|
||||
LIST_INIT(gpt_parsed);
|
||||
for (u32 i = 0; i < gpt->header.num_part_ents; i++)
|
||||
{
|
||||
emmc_part_t *part = (emmc_part_t *)calloc(sizeof(emmc_part_t), 1);
|
||||
emmc_part_t *part = (emmc_part_t *)zalloc(sizeof(emmc_part_t));
|
||||
|
||||
if (gpt->entries[i].lba_start < gpt->header.first_use_lba)
|
||||
continue;
|
||||
|
@ -210,7 +210,7 @@ static void _hos_eks_get()
|
||||
if (!h_cfg.eks)
|
||||
{
|
||||
// Read EKS blob.
|
||||
u8 *mbr = calloc(SD_BLOCKSIZE, 1);
|
||||
u8 *mbr = zalloc(SD_BLOCKSIZE);
|
||||
if (!hos_eks_rw_try(mbr, false))
|
||||
goto out;
|
||||
|
||||
@ -240,7 +240,7 @@ static void _hos_eks_save()
|
||||
bool new_eks = false;
|
||||
if (!h_cfg.eks)
|
||||
{
|
||||
h_cfg.eks = calloc(SD_BLOCKSIZE, 1);
|
||||
h_cfg.eks = zalloc(SD_BLOCKSIZE);
|
||||
new_eks = true;
|
||||
}
|
||||
|
||||
@ -248,7 +248,7 @@ static void _hos_eks_save()
|
||||
if (h_cfg.eks->enabled != HOS_EKS_TSEC_VER)
|
||||
{
|
||||
// Read EKS blob.
|
||||
u8 *mbr = calloc(SD_BLOCKSIZE, 1);
|
||||
u8 *mbr = zalloc(SD_BLOCKSIZE);
|
||||
if (!hos_eks_rw_try(mbr, false))
|
||||
{
|
||||
if (new_eks)
|
||||
@ -261,7 +261,7 @@ static void _hos_eks_save()
|
||||
}
|
||||
|
||||
// Get keys.
|
||||
u8 *keys = (u8 *)calloc(SZ_4K, 2);
|
||||
u8 *keys = (u8 *)calloc(2, SZ_4K);
|
||||
se_get_aes_keys(keys + SZ_4K, keys, SE_KEY_128_SIZE);
|
||||
|
||||
// Set magic and personalized info.
|
||||
@ -275,7 +275,7 @@ static void _hos_eks_save()
|
||||
memcpy(h_cfg.eks->troot_dev, keys + 11 * SE_KEY_128_SIZE, SE_KEY_128_SIZE);
|
||||
|
||||
// Encrypt EKS blob.
|
||||
u8 *eks = calloc(SD_BLOCKSIZE, 1);
|
||||
u8 *eks = zalloc(SD_BLOCKSIZE);
|
||||
memcpy(eks, h_cfg.eks, sizeof(hos_eks_mbr_t));
|
||||
se_aes_crypt_ecb(14, ENCRYPT, eks, sizeof(hos_eks_mbr_t), eks, sizeof(hos_eks_mbr_t));
|
||||
|
||||
@ -302,7 +302,7 @@ void hos_eks_clear(u32 kb)
|
||||
if (h_cfg.eks->enabled)
|
||||
{
|
||||
// Read EKS blob.
|
||||
u8 *mbr = calloc(SD_BLOCKSIZE, 1);
|
||||
u8 *mbr = zalloc(SD_BLOCKSIZE);
|
||||
if (!hos_eks_rw_try(mbr, false))
|
||||
goto out;
|
||||
|
||||
@ -310,7 +310,7 @@ void hos_eks_clear(u32 kb)
|
||||
h_cfg.eks->enabled = 0;
|
||||
|
||||
// Encrypt EKS blob.
|
||||
u8 *eks = calloc(SD_BLOCKSIZE, 1);
|
||||
u8 *eks = zalloc(SD_BLOCKSIZE);
|
||||
memcpy(eks, h_cfg.eks, sizeof(hos_eks_mbr_t));
|
||||
se_aes_crypt_ecb(14, ENCRYPT, eks, sizeof(hos_eks_mbr_t), eks, sizeof(hos_eks_mbr_t));
|
||||
|
||||
|
@ -21,132 +21,3 @@
|
||||
.nosigchk=0:0x194A0:0x4:BA090094,E0031F2A
|
||||
.nosigchk=0:0x3A79C:0x4:E0060036,1F2003D5
|
||||
|
||||
#FS Patches for 2.0.0
|
||||
[FS:cd7bbe18d6130b28]
|
||||
.nosigchk=0:0x15DF4:0x4:BC0A0094,E0031F2A
|
||||
.nosigchk=0:0x3F720:0x4:00060036,1F2003D5
|
||||
|
||||
#FS Patches for 2.0.0 exfat
|
||||
[FS:e76692dfaa0420e9]
|
||||
.nosigchk=0:0x15DF4:0x4:BC0A0094,E0031F2A
|
||||
.nosigchk=0:0x3F720:0x4:00060036,1F2003D5
|
||||
|
||||
#FS Patches for 2.1.0
|
||||
[FS:0d7005627b07767c]
|
||||
.nosigchk=0:0x15F64:0x4:DF0A0094,E0031F2A
|
||||
.nosigchk=0:0x3FAF8:0x4:00060036,1F2003D5
|
||||
|
||||
#FS Patches for 2.1.0 exfat
|
||||
[FS:dbd85fcacc193da8]
|
||||
.nosigchk=0:0x15F64:0x4:DF0A0094,E0031F2A
|
||||
.nosigchk=0:0x3FAF8:0x4:00060036,1F2003D5
|
||||
|
||||
#FS Patches for 3.0.0
|
||||
[FS:a86da5e87ef1097b]
|
||||
.nosigchk=0:0x18E24:0x4:520C0094,E0031F2A
|
||||
.nosigchk=0:0x49EC8:0x4:40040036,1F2003D5
|
||||
|
||||
#FS Patches for 3.0.0 exfat
|
||||
[FS:981c57e7f02f70f7]
|
||||
.nosigchk=0:0x18E24:0x4:520C0094,E0031F2A
|
||||
.nosigchk=0:0x49EC8:0x4:40040036,1F2003D5
|
||||
|
||||
#FS Patches for 3.0.1
|
||||
[FS:57397c063f10b631]
|
||||
.nosigchk=0:0x18E90:0x4:520C0094,E0031F2A
|
||||
.nosigchk=0:0x49F34:0x4:E0030036,1F2003D5
|
||||
|
||||
#FS Patches for 3.0.1 exfat
|
||||
[FS:073099d7c6ad7d89]
|
||||
.nosigchk=0:0x18E90:0x4:520C0094,E0031F2A
|
||||
.nosigchk=0:0x49F34:0x4:E0030036,1F2003D5
|
||||
|
||||
#FS Patches for 4.0.0
|
||||
[FS:06e90719595a010c]
|
||||
.nosigchk=0:0x1C4FC:0x4:3C2F0094,E0031F2A
|
||||
.nosigchk=0:0x57934:0x4:E0020036,1F2003D5
|
||||
|
||||
#FS Patches for 4.0.0 exfat
|
||||
[FS:549b0f8d6f72c4e9]
|
||||
.nosigchk=0:0x1C4FC:0x4:3C2F0094,E0031F2A
|
||||
.nosigchk=0:0x57934:0x4:E0020036,1F2003D5
|
||||
|
||||
#FS Patches for 4.1.0
|
||||
[FS:8096af7c6a35aa82]
|
||||
.nosigchk=0:0x1C4FC:0x4:3C2F0094,E0031F2A
|
||||
.nosigchk=0:0x57934:0x4:E0020036,1F2003D5
|
||||
|
||||
#FS Patches for 4.1.0 exfat
|
||||
[FS:02d5abaafd20c8b0]
|
||||
.nosigchk=0:0x1C4FC:0x4:3C2F0094,E0031F2A
|
||||
.nosigchk=0:0x57934:0x4:E0020036,1F2003D5
|
||||
|
||||
#FS Patches for 5.0.0
|
||||
[FS:a6f27ad9ac7c73ad]
|
||||
.nosigchk=0:0x22DDC:0x4:7D3E0094,E0031F2A
|
||||
.nosigchk=0:0x7D490:0x4:40030036,1F2003D5
|
||||
|
||||
#FS Patches for 5.0.0 exfat
|
||||
[FS:ce3ecba2f2f062f5]
|
||||
.nosigchk=0:0x22DDC:0x4:7D3E0094,E0031F2A
|
||||
.nosigchk=0:0x7D490:0x4:40030036,1F2003D5
|
||||
|
||||
#FS Patches for 5.1.0
|
||||
[FS:76f87402c9387c0f]
|
||||
.nosigchk=0:0x22E0C:0x4:853E0094,E0031F2A
|
||||
.nosigchk=0:0x7D860:0x4:40030036,1F2003D5
|
||||
|
||||
#FS Patches for 5.1.0 exfat
|
||||
[FS:10b2d81605488599]
|
||||
.nosigchk=0:0x22E0C:0x4:853E0094,E0031F2A
|
||||
.nosigchk=0:0x7D860:0x4:40030036,1F2003D5
|
||||
|
||||
#FS Patches for 6.0.0 - 4
|
||||
[FS:1b82cb221867cb52]
|
||||
.nosigchk=0:0x712A8:0x4:8E3E0094,E0031F2A
|
||||
.nosigchk=0:0xEB08C:0x4:C0030036,1F2003D5
|
||||
|
||||
#FS Patches for 6.0.0 - 4 exfat
|
||||
[FS:966add3d20b62713]
|
||||
.nosigchk=0:0x7C9A8:0x4:8E3E0094,E0031F2A
|
||||
.nosigchk=0:0xF678C:0x4:C0030036,1F2003D5
|
||||
|
||||
#FS Patches for 6.0.0 - 5
|
||||
[FS:3a574d436186191d]
|
||||
.nosigchk=0:0x712A8:0x4:8E3E0094,E0031F2A
|
||||
.nosigchk=0:0xEB08C:0x4:C0030036,1F2003D5
|
||||
|
||||
#FS Patches for 6.0.0 - 5 exfat
|
||||
[FS:330553f6b5fb55c4]
|
||||
.nosigchk=0:0x7C9A8:0x4:8E3E0094,E0031F2A
|
||||
.nosigchk=0:0xF678C:0x4:C0030036,1F2003D5
|
||||
|
||||
#FS Patches for 7.0.0
|
||||
[FS:2ADBE97E9B5F4177]
|
||||
.nosigchk=0:0x74A2C:0x4:31430094,E0031F2A
|
||||
.nosigchk=0:0xF25E4:0x4:C0030036,1F2003D5
|
||||
|
||||
#FS Patches for 7.0.0 exfat
|
||||
[FS:2CCE659CEC536A8E]
|
||||
.nosigchk=0:0x7FFDC:0x4:31430094,E0031F2A
|
||||
.nosigchk=0:0xFDB94:0x4:C0030036,1F2003D5
|
||||
|
||||
#FS Patches for 8.0.0
|
||||
[FS:B2F5176B3548364D]
|
||||
.nosigchk=0:0x7630C:0x4:51440094,E0031F2A
|
||||
.nosigchk=0:0xF49A4:0x4:C0030036,1F2003D5
|
||||
|
||||
#FS Patches for 8.0.0 exfat
|
||||
[FS:DBD941C0C53C52CC]
|
||||
.nosigchk=0:0x818BC:0x4:51440094,E0031F2A
|
||||
.nosigchk=0:0xFFF54:0x4:C0030036,1F2003D5
|
||||
|
||||
#FS Patches for 8.1.0
|
||||
[FS:6B09B67B29C02024]
|
||||
.nosigchk=0:0x7630C:0x4:51440094,E0031F2A
|
||||
.nosigchk=0:0xF49A4:0x4:C0030036,1F2003D5
|
||||
|
||||
#FS Patches for 8.1.0 exfat
|
||||
[FS:B4CAE1F24965D92E]
|
||||
.nosigchk=0:0x818BC:0x4:51440094,E0031F2A
|
||||
.nosigchk=0:0xFFF54:0x4:C0030036,1F2003D5
|
||||
|
Loading…
Reference in New Issue
Block a user