Add option to configure to download system files from Nintendo Update Service (#6269)

Co-authored-by: B3n30 <benediktthomas@gmail.com>
This commit is contained in:
Steveice10
2023-02-09 11:58:08 -08:00
committed by GitHub
parent 691cb43871
commit 6bef34852c
16 changed files with 1076 additions and 10 deletions

View File

@@ -88,7 +88,7 @@ struct KeySlot {
};
std::array<KeySlot, KeySlotID::MaxKeySlotID> key_slots;
std::array<std::optional<AESKey>, 6> common_key_y_slots;
std::array<std::optional<AESKey>, MaxCommonKeySlot> common_key_y_slots;
enum class FirmwareType : u32 {
ARM9 = 0, // uses NDMA
@@ -494,9 +494,9 @@ void LoadPresetKeys() {
} // namespace
void InitKeys() {
void InitKeys(bool force) {
static bool initialized = false;
if (initialized)
if (initialized && !force)
return;
initialized = true;
HW::RSA::InitSlots();

View File

@@ -48,11 +48,13 @@ enum KeySlotID : std::size_t {
MaxKeySlotID = 0x40,
};
constexpr std::size_t MaxCommonKeySlot = 6;
constexpr std::size_t AES_BLOCK_SIZE = 16;
using AESKey = std::array<u8, AES_BLOCK_SIZE>;
void InitKeys();
void InitKeys(bool force = false);
void SetGeneratorConstant(const AESKey& key);
void SetKeyX(std::size_t slot_id, const AESKey& key);