1
0
Fork 0
mirror of https://github.com/s1204IT/Lockpick_RCM.git synced 2024-11-08 11:31:43 +00:00

Lower RAM speed while not doing keygen

This commit is contained in:
shchmue 2021-09-05 14:08:35 -06:00
parent 8fa8941cd2
commit c1436648df
3 changed files with 24 additions and 1 deletions

View file

@ -18,6 +18,8 @@
#ifndef _TYPES_H_
#define _TYPES_H_
#include <assert.h>
#define NULL ((void *)0)
#define ALWAYS_INLINE inline __attribute__((always_inline))
@ -105,6 +107,8 @@ typedef struct __attribute__((__packed__)) _boot_cfg_t
};
} boot_cfg_t;
static_assert(sizeof(boot_cfg_t) == 0x84, "Boot CFG size is wrong!");
typedef struct __attribute__((__packed__)) _reloc_meta_t
{
u32 start;

View file

@ -769,10 +769,14 @@ static void _derive_keys() {
f_unlink("sd:/switch/partialaes.keys");
}
minerva_periodic_training();
if (h_cfg.t210b01) {
_save_mariko_partial_keys(0, 12, false);
}
minerva_periodic_training();
if (!_check_keyslot_access()) {
EPRINTF("Unable to set crypto keyslots!\nTry launching payload differently\n or flash Spacecraft-NX if using a modchip.");
return;
@ -786,6 +790,8 @@ static void _derive_keys() {
TPRINTFARGS("%kMMC init... ", colors[(color_idx++) % 6]);
}
minerva_periodic_training();
if (emmc_storage.initialized && !emummc_storage_set_mmc_partition(EMMC_BOOT0)) {
EPRINTF("Unable to set partition.");
emummc_storage_end();
@ -799,6 +805,7 @@ static void _derive_keys() {
// Master key derivation
if (h_cfg.t210b01) {
_derive_master_key_mariko(keys, is_dev);
minerva_periodic_training();
_derive_master_keys_from_latest_key(keys, is_dev);
} else {
int res = _run_ams_keygen(keys);
@ -814,7 +821,9 @@ static void _derive_keys() {
free(aes_keys);
_derive_master_keys_from_latest_key(&prod_keys, false);
minerva_periodic_training();
_derive_master_keys_from_latest_key(&dev_keys, true);
minerva_periodic_training();
_derive_keyblob_keys(keys);
}
@ -824,11 +833,16 @@ static void _derive_keys() {
TPRINTFARGS("%kBIS keys... ", colors[(color_idx++) % 6]);
minerva_periodic_training();
_derive_misc_keys(keys, is_dev);
minerva_periodic_training();
_derive_non_unique_keys(&prod_keys, is_dev);
minerva_periodic_training();
_derive_non_unique_keys(&dev_keys, is_dev);
minerva_periodic_training();
_derive_per_generation_keys(&prod_keys);
minerva_periodic_training();
_derive_per_generation_keys(&dev_keys);
titlekey_buffer_t *titlekey_buffer = (titlekey_buffer_t *)TITLEKEY_BUF_ADR;
@ -857,6 +871,8 @@ static void _derive_keys() {
}
void dump_keys() {
minerva_change_freq(FREQ_1600);
display_backlight_brightness(h_cfg.backlight, 1000);
gfx_clear_grey(0x1B);
gfx_con_setpos(0, 0);
@ -879,6 +895,8 @@ void dump_keys() {
if (emmc_storage.initialized) {
emummc_storage_end();
}
minerva_change_freq(FREQ_800);
gfx_printf("\n%kPress a button to return to the menu.", colors[(color_idx) % 6], colors[(color_idx + 1) % 6], colors[(color_idx + 2) % 6]);
btn_wait();
gfx_clear_grey(0x1B);

View file

@ -339,7 +339,6 @@ void ipl_main()
// Train DRAM and switch to max frequency.
if (minerva_init()) //!TODO: Add Tegra210B01 support to minerva.
h_cfg.errors |= ERR_LIBSYS_MTC;
minerva_change_freq(FREQ_1600);
display_init();
@ -380,6 +379,8 @@ void ipl_main()
ment_top[6].data = &STATE_REBOOT_FULL;
}
minerva_change_freq(FREQ_800);
while (true)
tui_do_menu(&menu_top);