uplift bdk

Signed-off-by: Damien Zhao <zdm65477730@126.com>
This commit is contained in:
Damien Zhao
2024-04-13 12:27:17 +08:00
parent cf9ec7683b
commit 029b32f722
109 changed files with 58033 additions and 2060 deletions

View File

@@ -581,7 +581,7 @@ void gfx_hexdiff(u32 base, const u8 *buf1, const u8 *buf2, u32 len)
for (u32 j = 0; j < bytes_left; j++)
{
if (buf1[i+j] != buf2[i+j])
gfx_con.fgcol = COLOR_ORANGE;
gfx_con.fgcol = 0xFFFFA500;
gfx_printf("%02x ", buf1[i+j]);
gfx_con.fgcol = 0xFFCCCCCC;
}
@@ -591,7 +591,7 @@ void gfx_hexdiff(u32 base, const u8 *buf1, const u8 *buf2, u32 len)
for (u32 j = 0; j < bytes_left; j++)
{
if (buf1[i+j] != buf2[i+j])
gfx_con.fgcol = COLOR_ORANGE;
gfx_con.fgcol = 0xFFFFA500;
gfx_printf("%02x ", buf2[i+j]);
gfx_con.fgcol = 0xFFCCCCCC;
}

View File

@@ -6,6 +6,12 @@
#define COLOR_DEFAULT 0xFF1B1B1B
#define COLOR_GREY 0xFF888888
#define COLOR_DARKGREY 0xFF333333
#define COLOR_ORANGE 0xFFFFA500
#define COLOR_GREEN 0xFF008000
#define COLOR_VIOLET 0xFFEE82EE
#define COLOR_BLUE 0xFF0000FF
#define COLOR_RED 0xFF0000FF
#define COLOR_YELLOW 0xFFFF0000
#define COLORTORGB(color) (color & 0x00FFFFFF)
#define SETCOLOR(fg, bg) gfx_con_setcol(fg, 1, bg)

View File

@@ -33,6 +33,7 @@
#include <utils/btn.h>
#include <utils/list.h>
#include <utils/types.h>
#include "../gfx/gfxutils.h"
#include <gfx_utils.h>
@@ -41,6 +42,8 @@
#define WB_RST_ADDR 0x40010ED0
#define WB_RST_SIZE 0x30
const u32 colors[6] = {COLOR_RED, COLOR_ORANGE, COLOR_YELLOW, COLOR_GREEN, COLOR_BLUE, COLOR_VIOLET};
u8 warmboot_reboot[] = {
0x14, 0x00, 0x9F, 0xE5, // LDR R0, =0x7000E450
0x01, 0x10, 0xB0, 0xE3, // MOVS R1, #1

View File

@@ -59,7 +59,7 @@ extern hekate_config h_cfg;
static int _key_exists(const void *data) { return memcmp(data, "\x00\x00\x00\x00\x00\x00\x00\x00", 8) != 0; };
static ALWAYS_INLINE u8 *_find_tsec_fw(const u8 *pkg1) {
static inline __attribute__((always_inline)) u8 *_find_tsec_fw(const u8 *pkg1) {
const u32 tsec_fw_align = 0x100;
const u32 tsec_fw_first_instruction = 0xCF42004D;
@@ -70,7 +70,7 @@ static ALWAYS_INLINE u8 *_find_tsec_fw(const u8 *pkg1) {
return NULL;
}
static ALWAYS_INLINE u32 _get_tsec_fw_size(tsec_key_data_t *key_data) {
static inline __attribute__((always_inline)) u32 _get_tsec_fw_size(tsec_key_data_t *key_data) {
return key_data->blob0_size + sizeof(tsec_key_data_t) + key_data->blob1_size + key_data->blob2_size + key_data->blob3_size + key_data->blob4_size;
}
@@ -175,7 +175,7 @@ static int _derive_master_keys_from_keyblobs(key_derivation_ctx_t *keys) {
se_aes_crypt_block_ecb(7, 0, keys->device_key_4x, device_master_key_source_kek_source);
se_aes_key_set(10, keys->keyblob_mac_key, sizeof(keys->keyblob_mac_key));
se_aes_cmac(10, keyblob_mac, sizeof(keyblob_mac), current_keyblob->iv, sizeof(current_keyblob->iv) + sizeof(keyblob_t));
se_aes_cmac_128(10, keyblob_mac, current_keyblob->iv, sizeof(current_keyblob->iv) + sizeof(keyblob_t));
if (memcmp(current_keyblob, keyblob_mac, sizeof(keyblob_mac)) != 0) {
//EPRINTFARGS("Keyblob %x corrupt.", 0);
free(keyblob_block);
@@ -233,7 +233,7 @@ static bool _derive_tsec_keys(tsec_ctxt_t *tsec_ctxt, u32 kb, key_derivation_ctx
return true;
}
static ALWAYS_INLINE u8 *_read_pkg1(const pkg1_id_t **pkg1_id) {
static inline __attribute__((always_inline)) u8 *_read_pkg1(const pkg1_id_t **pkg1_id) {
/*
if (emummc_storage_init_mmc(&emmc_storage, &emmc_sdmmc)) {

View File

@@ -35,7 +35,7 @@ ErrCode_t saveCommit(const char *path){
goto out_free;
}
se_aes_cmac(8, cmac, 0x10, cmac_data, cmac_data_size);
se_aes_cmac_128(8, cmac, cmac_data, cmac_data_size);
f_lseek(&file, 0);

View File

@@ -70,7 +70,6 @@ volatile nyx_storage_t *nyx_str = (nyx_storage_t *)NYX_STORAGE_ADDR;
#define EXT_PAYLOAD_ADDR 0xC0000000
#define RCM_PAYLOAD_ADDR (EXT_PAYLOAD_ADDR + ALIGN(PATCHED_RELOC_SZ, 0x10))
#define COREBOOT_END_ADDR 0xD0000000
#define CBFS_DRAM_EN_ADDR 0x4003e000
#define CBFS_DRAM_MAGIC 0x4452414D // "DRAM"
static void *coreboot_addr;

View File

@@ -16,15 +16,15 @@ extern hekate_config h_cfg;
extern int launch_payload(char *path);
void ALWAYS_INLINE power_off(){
void inline __attribute__((always_inline)) power_off(){
power_set_state(POWER_OFF_RESET);
}
void ALWAYS_INLINE reboot_rcm(){
void inline __attribute__((always_inline)) reboot_rcm(){
power_set_state(REBOOT_RCM);
}
void ALWAYS_INLINE reboot_normal(){
void inline __attribute__((always_inline)) reboot_normal(){
power_set_state((h_cfg.t210b01) ? REBOOT_BYPASS_FUSES : POWER_OFF_REBOOT);
}