1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-12-24 17:06:02 +00:00
hekate/nyx/nyx_gui/hos/hos.h

103 lines
2.3 KiB
C
Raw Normal View History

/*
* Copyright (c) 2018 naehrwert
2023-02-22 11:45:46 +00:00
* Copyright (c) 2018-2023 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,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _HOS_H_
#define _HOS_H_
2022-01-15 22:04:34 +00:00
#include <bdk.h>
#include "pkg1.h"
#include "pkg2.h"
2020-04-30 01:43:29 +01:00
#include <assert.h>
//!TODO: Update on mkey changes.
enum {
HOS_KB_VERSION_100 = 0,
HOS_KB_VERSION_300 = 1,
HOS_KB_VERSION_301 = 2,
HOS_KB_VERSION_400 = 3,
HOS_KB_VERSION_500 = 4,
HOS_KB_VERSION_600 = 5,
HOS_KB_VERSION_620 = 6,
HOS_KB_VERSION_700 = 7,
HOS_KB_VERSION_810 = 8,
HOS_KB_VERSION_900 = 9,
HOS_KB_VERSION_910 = 10,
HOS_KB_VERSION_1210 = 11,
HOS_KB_VERSION_1300 = 12,
HOS_KB_VERSION_1400 = 13,
HOS_KB_VERSION_1500 = 14,
HOS_KB_VERSION_1600 = 15,
2023-10-12 05:41:12 +01:00
HOS_KB_VERSION_1700 = 16,
2024-03-27 08:44:07 +00:00
HOS_KB_VERSION_1800 = 17,
HOS_KB_VERSION_MAX = HOS_KB_VERSION_1800
};
#define HOS_TSEC_VERSION 4 //! TODO: Update on TSEC Root Key changes.
#define HOS_PKG11_MAGIC 0x31314B50
#define HOS_EKS_MAGIC 0x31534B45 // EKS1.
#define HOS_EKS_TSEC_VER (HOS_KB_VERSION_700 + HOS_TSEC_VERSION)
2020-04-30 01:43:29 +01:00
typedef struct _hos_eks_mbr_t
{
u32 magic;
u32 enabled;
2020-11-15 11:43:22 +00:00
u32 lot0;
u32 rsvd;
u8 tsec[SE_KEY_128_SIZE];
u8 troot[SE_KEY_128_SIZE];
u8 troot_dev[SE_KEY_128_SIZE];
2020-04-30 01:43:29 +01:00
} hos_eks_mbr_t;
static_assert(sizeof(hos_eks_mbr_t) == 64, "HOS EKS size is wrong!");
typedef struct _launch_ctxt_t
{
void *keyblob;
void *pkg1;
const pkg1_id_t *pkg1_id;
void *warmboot;
u32 warmboot_size;
void *secmon;
u32 secmon_size;
void *pkg2;
u32 pkg2_size;
2020-04-30 01:43:29 +01:00
bool new_pkg2;
void *kernel;
u32 kernel_size;
link_t kip1_list;
char* kip1_patches;
ini_sec_t *cfg;
} launch_ctxt_t;
2023-07-28 01:28:21 +01:00
extern u8 *cal0_buf;
2020-04-30 01:43:29 +01:00
void hos_eks_clear(u32 kb);
int hos_keygen(void *keyblob, u32 kb, tsec_ctxt_t *tsec_ctxt);
int hos_bis_keygen();
2020-06-15 12:59:45 +01:00
void hos_bis_keys_clear();
2023-07-28 01:28:21 +01:00
int hos_dump_cal0();
#endif