hekate/nyx: utilize existing block size defines

This commit is contained in:
CTCaer
2024-03-12 15:53:05 +02:00
parent f126486266
commit 82925845e3
8 changed files with 29 additions and 29 deletions

View File

@@ -218,7 +218,7 @@ static void _hos_eks_get()
if (!h_cfg.eks)
{
// Read EKS blob.
u8 *mbr = calloc(512 , 1);
u8 *mbr = calloc(SD_BLOCKSIZE, 1);
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(512 , 1);
h_cfg.eks = calloc(SD_BLOCKSIZE, 1);
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(512 , 1);
u8 *mbr = calloc(SD_BLOCKSIZE, 1);
if (!hos_eks_rw_try(mbr, false))
{
if (new_eks)
@@ -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(512 , 1);
u8 *eks = calloc(SD_BLOCKSIZE, 1);
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(512 , 1);
u8 *mbr = calloc(SD_BLOCKSIZE, 1);
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(512 , 1);
u8 *eks = calloc(SD_BLOCKSIZE, 1);
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));