From 33827fe3a304c989beb1542613d9acb4953b1fff Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sat, 7 Dec 2019 13:44:08 -0800 Subject: [PATCH] Implement support for 9.1.0 --- ...D7D642F75B0159771671F73082448ACE30BD6BAE89.ips | Bin 0 -> 27 bytes ...B6405B7FC305B54F961024BF432575296E4D52BC99.ips | Bin 0 -> 27 bytes common/include/atmosphere/target_fw.h | 5 +++-- exosphere/src/masterkey.c | 2 ++ exosphere/src/masterkey.h | 7 ++++--- exosphere/src/package2.c | 14 +++++++++++--- exosphere/src/package2.h | 6 ++++-- exosphere/src/smc_api.c | 1 + exosphere/src/smc_user.c | 1 + exosphere/src/utils.c | 10 +++++----- fusee/fusee-secondary/src/emummc_cfg.h | 3 +++ fusee/fusee-secondary/src/ips.c | 3 +++ fusee/fusee-secondary/src/key_derivation.c | 6 +++++- fusee/fusee-secondary/src/masterkey.c | 2 ++ fusee/fusee-secondary/src/masterkey.h | 7 ++++--- fusee/fusee-secondary/src/nxboot.c | 2 ++ fusee/fusee-secondary/src/package2.c | 2 +- fusee/fusee-secondary/src/package2.h | 6 ++++-- .../key_derivation/src/key_derivation.c | 9 ++++++--- .../include/stratosphere/ams/ams_types.hpp | 2 ++ .../include/stratosphere/hos/hos_types.hpp | 3 ++- .../source/hos/hos_version_api.cpp | 6 ++++++ 22 files changed, 71 insertions(+), 26 deletions(-) create mode 100644 common/defaults/kip_patches/default_nogc/B5E7A64C6F5C4FE319C36FD7D642F75B0159771671F73082448ACE30BD6BAE89.ips create mode 100644 common/defaults/kip_patches/default_nogc/F196D144D04445B6E7497CB6405B7FC305B54F961024BF432575296E4D52BC99.ips diff --git a/common/defaults/kip_patches/default_nogc/B5E7A64C6F5C4FE319C36FD7D642F75B0159771671F73082448ACE30BD6BAE89.ips b/common/defaults/kip_patches/default_nogc/B5E7A64C6F5C4FE319C36FD7D642F75B0159771671F73082448ACE30BD6BAE89.ips new file mode 100644 index 0000000000000000000000000000000000000000..6bdb8ce04235b2a5de5d3b967042a2a34bdb216c GIT binary patch literal 27 icmWG=3~}}lF|K4_Y!I4iz`*fVVOJ_nBg literal 0 HcmV?d00001 diff --git a/common/defaults/kip_patches/default_nogc/F196D144D04445B6E7497CB6405B7FC305B54F961024BF432575296E4D52BC99.ips b/common/defaults/kip_patches/default_nogc/F196D144D04445B6E7497CB6405B7FC305B54F961024BF432575296E4D52BC99.ips new file mode 100644 index 0000000000000000000000000000000000000000..6bdb8ce04235b2a5de5d3b967042a2a34bdb216c GIT binary patch literal 27 icmWG=3~}}lF|K4_Y!I4iz`*fVVOJ_nBg literal 0 HcmV?d00001 diff --git a/common/include/atmosphere/target_fw.h b/common/include/atmosphere/target_fw.h index 30dd286e4..8628272b9 100644 --- a/common/include/atmosphere/target_fw.h +++ b/common/include/atmosphere/target_fw.h @@ -28,11 +28,12 @@ #define ATMOSPHERE_TARGET_FIRMWARE_800 9 #define ATMOSPHERE_TARGET_FIRMWARE_810 10 #define ATMOSPHERE_TARGET_FIRMWARE_900 11 +#define ATMOSPHERE_TARGET_FIRMWARE_910 12 -#define ATMOSPHERE_TARGET_FIRMWARE_CURRENT ATMOSPHERE_TARGET_FIRMWARE_900 +#define ATMOSPHERE_TARGET_FIRMWARE_CURRENT ATMOSPHERE_TARGET_FIRMWARE_910 #define ATMOSPHERE_TARGET_FIRMWARE_MIN ATMOSPHERE_TARGET_FIRMWARE_100 -#define ATMOSPHERE_TARGET_FIRMWARE_MAX ATMOSPHERE_TARGET_FIRMWARE_900 +#define ATMOSPHERE_TARGET_FIRMWARE_MAX ATMOSPHERE_TARGET_FIRMWARE_910 /* TODO: What should this be, for release? */ #define ATMOSPHERE_TARGET_FIRMWARE_DEFAULT_FOR_DEBUG ATMOSPHERE_TARGET_FIRMWARE_CURRENT diff --git a/exosphere/src/masterkey.c b/exosphere/src/masterkey.c index bfd90d163..e24b33b42 100644 --- a/exosphere/src/masterkey.c +++ b/exosphere/src/masterkey.c @@ -44,6 +44,7 @@ static const uint8_t mkey_vectors_dev[MASTERKEY_REVISION_MAX][0x10] = {0x37, 0xAF, 0xAB, 0x35, 0x79, 0x09, 0xD9, 0x48, 0x29, 0xD2, 0xDB, 0xA5, 0xA5, 0xF5, 0x30, 0x19}, /* Master key 06 encrypted with Master key 07. */ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* TODO: Master key 07 encrypted with Master key 08. */ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* TODO: Master key 08 encrypted with Master key 09. */ + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* TODO: Master key 09 encrypted with Master key 0A. */ }; /* Retail unit keys. */ @@ -59,6 +60,7 @@ static const uint8_t mkey_vectors[MASTERKEY_REVISION_MAX][0x10] = {0xA4, 0xD4, 0x52, 0x6F, 0xD1, 0xE4, 0x36, 0xAA, 0x9F, 0xCB, 0x61, 0x27, 0x1C, 0x67, 0x65, 0x1F}, /* Master key 06 encrypted with Master key 07. */ {0xEA, 0x60, 0xB3, 0xEA, 0xCE, 0x8F, 0x24, 0x46, 0x7D, 0x33, 0x9C, 0xD1, 0xBC, 0x24, 0x98, 0x29}, /* Master key 07 encrypted with Master key 08. */ {0x4D, 0xD9, 0x98, 0x42, 0x45, 0x0D, 0xB1, 0x3C, 0x52, 0x0C, 0x9A, 0x44, 0xBB, 0xAD, 0xAF, 0x80}, /* Master key 08 encrypted with Master key 09. */ + {0xB8, 0x96, 0x9E, 0x4A, 0x00, 0x0D, 0xD6, 0x28, 0xB3, 0xD1, 0xDB, 0x68, 0x5F, 0xFB, 0xE1, 0x2A}, /* Master key 09 encrypted with Master key 0A. */ }; bool check_mkey_revision(unsigned int revision, bool is_retail) { diff --git a/exosphere/src/masterkey.h b/exosphere/src/masterkey.h index 6d186d7c1..d8ebda839 100644 --- a/exosphere/src/masterkey.h +++ b/exosphere/src/masterkey.h @@ -19,8 +19,8 @@ /* This is glue code to enable master key support across versions. */ -/* TODO: Update to 0xB on release of new master key. */ -#define MASTERKEY_REVISION_MAX 0xA +/* TODO: Update to 0xC on release of new master key. */ +#define MASTERKEY_REVISION_MAX 0xB #define MASTERKEY_REVISION_100_230 0x00 #define MASTERKEY_REVISION_300 0x01 @@ -31,7 +31,8 @@ #define MASTERKEY_REVISION_620 0x06 #define MASTERKEY_REVISION_700_800 0x07 #define MASTERKEY_REVISION_810 0x08 -#define MASTERKEY_REVISION_900_CURRENT 0x09 +#define MASTERKEY_REVISION_900 0x09 +#define MASTERKEY_REVISION_910_CURRENT 0x0A #define MASTERKEY_NUM_NEW_DEVICE_KEYS (MASTERKEY_REVISION_MAX - MASTERKEY_REVISION_400_410) diff --git a/exosphere/src/package2.c b/exosphere/src/package2.c index e0717a8a8..6935e8bca 100644 --- a/exosphere/src/package2.c +++ b/exosphere/src/package2.c @@ -45,6 +45,7 @@ static const uint8_t new_device_key_sources[MASTERKEY_NUM_NEW_DEVICE_KEYS][0x10] {0x8F, 0x77, 0x5A, 0x96, 0xB0, 0x94, 0xFD, 0x8D, 0x28, 0xE4, 0x19, 0xC8, 0x16, 0x1C, 0xDB, 0x3D}, /* 7.0.0 New Device Key Source. */ {0x67, 0x62, 0xD4, 0x8E, 0x55, 0xCF, 0xFF, 0x41, 0x31, 0x15, 0x3B, 0x24, 0x0C, 0x7C, 0x07, 0xAE}, /* 8.1.0 New Device Key Source. */ {0x4A, 0xC3, 0x4E, 0x14, 0x8B, 0x96, 0x4A, 0xD5, 0xD4, 0x99, 0x73, 0xC4, 0x45, 0xAB, 0x8B, 0x49}, /* 9.0.0 New Device Key Source. */ + {0x14, 0xB8, 0x74, 0x12, 0xCB, 0xBD, 0x0B, 0x8F, 0x20, 0xFB, 0x30, 0xDA, 0x27, 0xE4, 0x58, 0x94}, /* 9.1.0 New Device Key Source. */ }; static const uint8_t new_device_keygen_sources[MASTERKEY_NUM_NEW_DEVICE_KEYS][0x10] = { @@ -54,7 +55,8 @@ static const uint8_t new_device_keygen_sources[MASTERKEY_NUM_NEW_DEVICE_KEYS][0x {0x81, 0x3C, 0x6C, 0xBF, 0x5D, 0x21, 0xDE, 0x77, 0x20, 0xD9, 0x6C, 0xE3, 0x22, 0x06, 0xAE, 0xBB}, /* 6.2.0 New Device Keygen Source. */ {0x86, 0x61, 0xB0, 0x16, 0xFA, 0x7A, 0x9A, 0xEA, 0xF6, 0xF5, 0xBE, 0x1A, 0x13, 0x5B, 0x6D, 0x9E}, /* 7.0.0 New Device Keygen Source. */ {0xA6, 0x81, 0x71, 0xE7, 0xB5, 0x23, 0x74, 0xB0, 0x39, 0x8C, 0xB7, 0xFF, 0xA0, 0x62, 0x9F, 0x8D}, /* 8.1.0 New Device Keygen Source. */ - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* TODO: 9.0.0 New Device Keygen Source to be added on next change-of-keys. */ + {0x03, 0xE7, 0xEB, 0x43, 0x1B, 0xCF, 0x5F, 0xB5, 0xED, 0xDC, 0x97, 0xAE, 0x21, 0x8D, 0x19, 0xED}, /* 9.0.0 New Device Keygen Source. */ + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* TODO: 9.1.0 New Device Keygen Source to be added on next change-of-keys. */ }; static const uint8_t new_device_keygen_sources_dev[MASTERKEY_NUM_NEW_DEVICE_KEYS][0x10] = { @@ -64,7 +66,8 @@ static const uint8_t new_device_keygen_sources_dev[MASTERKEY_NUM_NEW_DEVICE_KEYS {0x20, 0xAB, 0xF2, 0x0F, 0x05, 0xE3, 0xDE, 0x2E, 0xA1, 0xFB, 0x37, 0x5E, 0x8B, 0x22, 0x1A, 0x38}, /* 6.2.0 New Device Keygen Source. */ {0x60, 0xAE, 0x56, 0x68, 0x11, 0xE2, 0x0C, 0x99, 0xDE, 0x05, 0xAE, 0x68, 0x78, 0x85, 0x04, 0xAE}, /* 7.0.0 New Device Keygen Source. */ {0x94, 0xD6, 0xA8, 0xC0, 0x95, 0xAF, 0xD0, 0xA6, 0x27, 0x53, 0x5E, 0xE5, 0x8E, 0x70, 0x1F, 0x87}, /* 8.1.0 New Device Keygen Source. */ - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* TODO: 9.0.0 New Device Keygen Source to be added on next change-of-keys. */ + {0x61, 0x6A, 0x88, 0x21, 0xA3, 0x52, 0xB0, 0x19, 0x16, 0x25, 0xA4, 0xE3, 0x4C, 0x54, 0x02, 0x0F}, /* 9.0.0 New Device Keygen Source. */ + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* TODO: 9.1.0 New Device Keygen Source to be added on next change-of-keys. */ }; static void derive_new_device_keys(unsigned int keygen_keyslot) { @@ -145,6 +148,7 @@ static void setup_se(void) { case ATMOSPHERE_TARGET_FIRMWARE_800: case ATMOSPHERE_TARGET_FIRMWARE_810: case ATMOSPHERE_TARGET_FIRMWARE_900: + case ATMOSPHERE_TARGET_FIRMWARE_910: derive_new_device_keys(KEYSLOT_SWITCH_5XNEWDEVICEKEYGENKEY); break; } @@ -334,7 +338,7 @@ static bool validate_package2_metadata(package2_meta_t *metadata) { /* Perform version checks. */ /* We will be compatible with all package2s released before current, but not newer ones. */ - if (metadata->version_max >= PACKAGE2_MINVER_THEORETICAL && metadata->version_min < PACKAGE2_MAXVER_900_CURRENT) { + if (metadata->version_max >= PACKAGE2_MINVER_THEORETICAL && metadata->version_min < PACKAGE2_MAXVER_910_CURRENT) { return true; } @@ -461,6 +465,7 @@ static void copy_warmboot_bin_to_dram() { case ATMOSPHERE_TARGET_FIRMWARE_800: case ATMOSPHERE_TARGET_FIRMWARE_810: case ATMOSPHERE_TARGET_FIRMWARE_900: + case ATMOSPHERE_TARGET_FIRMWARE_910: warmboot_src = (uint8_t *)0x4003E000; break; } @@ -540,6 +545,9 @@ void load_package2(coldboot_crt0_reloc_list_t *reloc_list) { case ATMOSPHERE_TARGET_FIRMWARE_900: MAKE_REG32(PMC_BASE + 0x360) = 0x16B; break; + case ATMOSPHERE_TARGET_FIRMWARE_910: + MAKE_REG32(PMC_BASE + 0x360) = 0x18C; + break; } } diff --git a/exosphere/src/package2.h b/exosphere/src/package2.h index d17d532d7..9981f0b2e 100644 --- a/exosphere/src/package2.h +++ b/exosphere/src/package2.h @@ -72,7 +72,8 @@ static inline uintptr_t get_nx_bootloader_mailbox_base(unsigned int targetfw) { #define PACKAGE2_MAXVER_620 0x9 #define PACKAGE2_MAXVER_700_800 0xA #define PACKAGE2_MAXVER_810 0xB -#define PACKAGE2_MAXVER_900_CURRENT 0xC +#define PACKAGE2_MAXVER_900 0xC +#define PACKAGE2_MAXVER_910_CURRENT 0xD #define PACKAGE2_MINVER_100 0x3 #define PACKAGE2_MINVER_200 0x4 @@ -84,7 +85,8 @@ static inline uintptr_t get_nx_bootloader_mailbox_base(unsigned int targetfw) { #define PACKAGE2_MINVER_620 0xA #define PACKAGE2_MINVER_700_800 0xB #define PACKAGE2_MINVER_810 0xC -#define PACKAGE2_MINVER_900_CURRENT 0xD +#define PACKAGE2_MINVER_900 0xD +#define PACKAGE2_MINVER_910_CURRENT 0xE typedef struct { union { diff --git a/exosphere/src/smc_api.c b/exosphere/src/smc_api.c index f2380bf7d..bdf8ff1a0 100644 --- a/exosphere/src/smc_api.c +++ b/exosphere/src/smc_api.c @@ -187,6 +187,7 @@ void set_version_specific_smcs(void) { case ATMOSPHERE_TARGET_FIRMWARE_800: case ATMOSPHERE_TARGET_FIRMWARE_810: case ATMOSPHERE_TARGET_FIRMWARE_900: + case ATMOSPHERE_TARGET_FIRMWARE_910: /* No more LoadSecureExpModKey. */ g_smc_user_table[0xE].handler = NULL; g_smc_user_table[0xC].id = 0xC300D60C; diff --git a/exosphere/src/smc_user.c b/exosphere/src/smc_user.c index 7232e86aa..1999570d1 100644 --- a/exosphere/src/smc_user.c +++ b/exosphere/src/smc_user.c @@ -54,6 +54,7 @@ static bool is_user_keyslot_valid(unsigned int keyslot) { case ATMOSPHERE_TARGET_FIRMWARE_800: case ATMOSPHERE_TARGET_FIRMWARE_810: case ATMOSPHERE_TARGET_FIRMWARE_900: + case ATMOSPHERE_TARGET_FIRMWARE_910: default: return keyslot <= 5; } diff --git a/exosphere/src/utils.c b/exosphere/src/utils.c index df7e6affd..098447a85 100644 --- a/exosphere/src/utils.c +++ b/exosphere/src/utils.c @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #include #include #include "utils.h" @@ -29,7 +29,7 @@ __attribute__ ((noreturn)) void panic(uint32_t code) { if (APBDEV_PMC_SCRATCH200_0 == 0) { APBDEV_PMC_SCRATCH200_0 = code; } - + /* // Uncomment for Debugging. uint64_t temp_reg; MAKE_REG32(MMIO_GET_DEVICE_ADDRESS(MMIO_DEVID_DEBUG_IRAM)) = APBDEV_PMC_SCRATCH200_0; @@ -38,8 +38,8 @@ __attribute__ ((noreturn)) void panic(uint32_t code) { SAVE_SYSREG64(FAR_EL3, 0x20); MAKE_REG32(MMIO_GET_DEVICE_ADDRESS(MMIO_DEVID_RTC_PMC) + 0x450ull) = 0x2; MAKE_REG32(MMIO_GET_DEVICE_ADDRESS(MMIO_DEVID_RTC_PMC) + 0x400ull) = 0x10; */ - - + + /* TODO: Custom Panic Driver, which displays to screen without rebooting. */ /* For now, just use NX BOOTLOADER's panic. */ fuse_disable_programming(); @@ -50,7 +50,7 @@ __attribute__ ((noreturn)) void panic(uint32_t code) { __attribute__ ((noreturn)) void generic_panic(void) { /* //Uncomment for Debugging. - uint64_t temp_reg; + uint64_t temp_reg; do { __asm__ __volatile__ ("mov %0, LR" : "=r"(temp_reg) :: "memory"); } while (false); MAKE_REG32(MMIO_GET_DEVICE_ADDRESS(MMIO_DEVID_DEBUG_IRAM) + 0x28) = (uint32_t)((temp_reg >> 0) & 0xFFFFFFFFULL); MAKE_REG32(MMIO_GET_DEVICE_ADDRESS(MMIO_DEVID_DEBUG_IRAM) + 0x28 + 4) = (uint32_t)((temp_reg >> 32) & 0xFFFFFFFFULL); diff --git a/fusee/fusee-secondary/src/emummc_cfg.h b/fusee/fusee-secondary/src/emummc_cfg.h index ec84ef0c1..3e9f21004 100644 --- a/fusee/fusee-secondary/src/emummc_cfg.h +++ b/fusee/fusee-secondary/src/emummc_cfg.h @@ -79,6 +79,9 @@ typedef enum { FS_VER_9_0_0, FS_VER_9_0_0_EXFAT, + FS_VER_9_1_0, + FS_VER_9_1_0_EXFAT, + FS_VER_MAX, } emummc_fs_ver_t; diff --git a/fusee/fusee-secondary/src/ips.c b/fusee/fusee-secondary/src/ips.c index ae2378fd5..129dd1bea 100644 --- a/fusee/fusee-secondary/src/ips.c +++ b/fusee/fusee-secondary/src/ips.c @@ -414,6 +414,9 @@ static const uint8_t g_fs_hashes[FS_VER_MAX][0x8] = { "\x46\x87\x40\x76\x1E\x19\x3E\xB7", /* FS_VER_9_0_0 */ "\x7C\x95\x13\x76\xE5\xC1\x2D\xF8", /* FS_VER_9_0_0_EXFAT */ + + "\xB5\xE7\xA6\x4C\x6F\x5C\x4F\xE3", /* FS_VER_9_1_0 */ + "\xF1\x96\xD1\x44\xD0\x44\x45\xB6", /* FS_VER_9_1_0_EXFAT */ }; kip1_header_t *apply_kip_ips_patches(kip1_header_t *kip, size_t kip_size, emummc_fs_ver_t *out_fs_ver) { diff --git a/fusee/fusee-secondary/src/key_derivation.c b/fusee/fusee-secondary/src/key_derivation.c index a72195014..ab42de1a5 100644 --- a/fusee/fusee-secondary/src/key_derivation.c +++ b/fusee/fusee-secondary/src/key_derivation.c @@ -155,8 +155,12 @@ int derive_nx_keydata(uint32_t target_firmware, const nx_keyblob_t *keyblobs, ui break; case ATMOSPHERE_TARGET_FIRMWARE_810: desired_keyblob = MASTERKEY_REVISION_810; + /* Fallthrough */ case ATMOSPHERE_TARGET_FIRMWARE_900: - desired_keyblob = MASTERKEY_REVISION_900_CURRENT; + desired_keyblob = MASTERKEY_REVISION_900; + /* Fallthrough */ + case ATMOSPHERE_TARGET_FIRMWARE_910: + desired_keyblob = MASTERKEY_REVISION_910_CURRENT; break; default: fatal_error("Unknown target firmware: %02x!", target_firmware); diff --git a/fusee/fusee-secondary/src/masterkey.c b/fusee/fusee-secondary/src/masterkey.c index 37af8b4e4..5cc466763 100644 --- a/fusee/fusee-secondary/src/masterkey.c +++ b/fusee/fusee-secondary/src/masterkey.c @@ -41,6 +41,7 @@ static const uint8_t mkey_vectors_dev[MASTERKEY_REVISION_MAX][0x10] = {0x37, 0xAF, 0xAB, 0x35, 0x79, 0x09, 0xD9, 0x48, 0x29, 0xD2, 0xDB, 0xA5, 0xA5, 0xF5, 0x30, 0x19}, /* Master key 06 encrypted with Master key 07. */ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* TODO: Master key 07 encrypted with Master key 08. */ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* TODO: Master key 08 encrypted with Master key 09. */ + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* TODO: Master key 09 encrypted with Master key 0A. */ }; /* Retail unit keys. */ @@ -56,6 +57,7 @@ static const uint8_t mkey_vectors[MASTERKEY_REVISION_MAX][0x10] = {0xA4, 0xD4, 0x52, 0x6F, 0xD1, 0xE4, 0x36, 0xAA, 0x9F, 0xCB, 0x61, 0x27, 0x1C, 0x67, 0x65, 0x1F}, /* Master key 06 encrypted with Master key 07. */ {0xEA, 0x60, 0xB3, 0xEA, 0xCE, 0x8F, 0x24, 0x46, 0x7D, 0x33, 0x9C, 0xD1, 0xBC, 0x24, 0x98, 0x29}, /* Master key 07 encrypted with Master key 08. */ {0x4D, 0xD9, 0x98, 0x42, 0x45, 0x0D, 0xB1, 0x3C, 0x52, 0x0C, 0x9A, 0x44, 0xBB, 0xAD, 0xAF, 0x80}, /* Master key 08 encrypted with Master key 09. */ + {0xB8, 0x96, 0x9E, 0x4A, 0x00, 0x0D, 0xD6, 0x28, 0xB3, 0xD1, 0xDB, 0x68, 0x5F, 0xFB, 0xE1, 0x2A}, /* Master key 09 encrypted with Master key 0A. */ }; static bool check_mkey_revision(unsigned int revision, bool is_retail) { diff --git a/fusee/fusee-secondary/src/masterkey.h b/fusee/fusee-secondary/src/masterkey.h index d266752ff..cb7856731 100644 --- a/fusee/fusee-secondary/src/masterkey.h +++ b/fusee/fusee-secondary/src/masterkey.h @@ -19,8 +19,8 @@ /* This is glue code to enable master key support across versions. */ -/* TODO: Update to 0xB on release of new master key. */ -#define MASTERKEY_REVISION_MAX 0xA +/* TODO: Update to 0xC on release of new master key. */ +#define MASTERKEY_REVISION_MAX 0xB #define MASTERKEY_REVISION_100_230 0x00 #define MASTERKEY_REVISION_300 0x01 @@ -31,7 +31,8 @@ #define MASTERKEY_REVISION_620 0x06 #define MASTERKEY_REVISION_700_800 0x07 #define MASTERKEY_REVISION_810 0x08 -#define MASTERKEY_REVISION_900_CURRENT 0x09 +#define MASTERKEY_REVISION_900 0x09 +#define MASTERKEY_REVISION_910_CURRENT 0x0A #define MASTERKEY_NUM_NEW_DEVICE_KEYS (MASTERKEY_REVISION_MAX - MASTERKEY_REVISION_400_410) diff --git a/fusee/fusee-secondary/src/nxboot.c b/fusee/fusee-secondary/src/nxboot.c index e283d044c..ddc5c32ce 100644 --- a/fusee/fusee-secondary/src/nxboot.c +++ b/fusee/fusee-secondary/src/nxboot.c @@ -215,6 +215,8 @@ static uint32_t nxboot_get_target_firmware(const void *package1loader) { return ATMOSPHERE_TARGET_FIRMWARE_810; } else if (memcmp(package1loader_header->build_timestamp, "20190809", 8) == 0) { return ATMOSPHERE_TARGET_FIRMWARE_900; + } else if (memcmp(package1loader_header->build_timestamp, "20191021", 8) == 0) { + return ATMOSPHERE_TARGET_FIRMWARE_910; } else { fatal_error("[NXBOOT] Unable to identify package1!\n"); } diff --git a/fusee/fusee-secondary/src/package2.c b/fusee/fusee-secondary/src/package2.c index 32a9b7c4e..3ed9e8cc2 100644 --- a/fusee/fusee-secondary/src/package2.c +++ b/fusee/fusee-secondary/src/package2.c @@ -232,7 +232,7 @@ static bool package2_validate_metadata(package2_meta_t *metadata, uint8_t data[] /* Perform version checks. */ /* We will be compatible with all package2s released before current, but not newer ones. */ - if (metadata->version_max >= PACKAGE2_MINVER_THEORETICAL && metadata->version_min < PACKAGE2_MAXVER_900_CURRENT) { + if (metadata->version_max >= PACKAGE2_MINVER_THEORETICAL && metadata->version_min < PACKAGE2_MAXVER_910_CURRENT) { return true; } diff --git a/fusee/fusee-secondary/src/package2.h b/fusee/fusee-secondary/src/package2.h index 1254fc6b0..ddfb0d111 100644 --- a/fusee/fusee-secondary/src/package2.h +++ b/fusee/fusee-secondary/src/package2.h @@ -38,7 +38,8 @@ #define PACKAGE2_MAXVER_620 0x9 #define PACKAGE2_MAXVER_700_800 0xA #define PACKAGE2_MAXVER_810 0xB -#define PACKAGE2_MAXVER_900_CURRENT 0xC +#define PACKAGE2_MAXVER_900 0xC +#define PACKAGE2_MAXVER_910_CURRENT 0xD #define PACKAGE2_MINVER_100 0x3 #define PACKAGE2_MINVER_200 0x4 @@ -50,7 +51,8 @@ #define PACKAGE2_MINVER_620 0xA #define PACKAGE2_MINVER_700_800 0xB #define PACKAGE2_MINVER_810 0xC -#define PACKAGE2_MINVER_900_CURRENT 0xD +#define PACKAGE2_MINVER_900 0xD +#define PACKAGE2_MINVER_910_CURRENT 0xE #define NX_BOOTLOADER_PACKAGE2_LOAD_ADDRESS ((void *)(0xA9800000ull)) diff --git a/sept/sept-secondary/key_derivation/src/key_derivation.c b/sept/sept-secondary/key_derivation/src/key_derivation.c index dc74f1236..b90fa47c7 100644 --- a/sept/sept-secondary/key_derivation/src/key_derivation.c +++ b/sept/sept-secondary/key_derivation/src/key_derivation.c @@ -54,19 +54,22 @@ static const uint8_t AL16 zeroes[0x10] = { static const uint8_t AL16 master_kek_seeds[DERIVATION_ID_MAX][0x10] = { {0x9A, 0x3E, 0xA9, 0xAB, 0xFD, 0x56, 0x46, 0x1C, 0x9B, 0xF6, 0x48, 0x7F, 0x5C, 0xFA, 0x09, 0x5C}, /* 8.1.0: {0xDE, 0xDC, 0xE3, 0x39, 0x30, 0x88, 0x16, 0xF8, 0xAE, 0x97, 0xAD, 0xEC, 0x64, 0x2D, 0x41, 0x41}, */ - {0x1A, 0xEC, 0x11, 0x82, 0x2B, 0x32, 0x38, 0x7A, 0x2B, 0xED, 0xBA, 0x01, 0x47, 0x7E, 0x3B, 0x67}, + /* 9.0.0: {0x1A, 0xEC, 0x11, 0x82, 0x2B, 0x32, 0x38, 0x7A, 0x2B, 0xED, 0xBA, 0x01, 0x47, 0x7E, 0x3B, 0x67}, */ + {0x30, 0x3F, 0x02, 0x7E, 0xD8, 0x38, 0xEC, 0xD7, 0x93, 0x25, 0x34, 0xB5, 0x30, 0xEB, 0xCA, 0x7A}, }; static const uint8_t AL16 master_devkey_seeds[DERIVATION_ID_MAX][0x10] = { {0x8F, 0x77, 0x5A, 0x96, 0xB0, 0x94, 0xFD, 0x8D, 0x28, 0xE4, 0x19, 0xC8, 0x16, 0x1C, 0xDB, 0x3D}, /* 8.1.0: {0x67, 0x62, 0xD4, 0x8E, 0x55, 0xCF, 0xFF, 0x41, 0x31, 0x15, 0x3B, 0x24, 0x0C, 0x7C, 0x07, 0xAE}, */ - {0x4A, 0xC3, 0x4E, 0x14, 0x8B, 0x96, 0x4A, 0xD5, 0xD4, 0x99, 0x73, 0xC4, 0x45, 0xAB, 0x8B, 0x49}, + /* 9.0.0: {0x4A, 0xC3, 0x4E, 0x14, 0x8B, 0x96, 0x4A, 0xD5, 0xD4, 0x99, 0x73, 0xC4, 0x45, 0xAB, 0x8B, 0x49}, */ + {0x14, 0xB8, 0x74, 0x12, 0xCB, 0xBD, 0x0B, 0x8F, 0x20, 0xFB, 0x30, 0xDA, 0x27, 0xE4, 0x58, 0x94}, }; static const uint8_t AL16 master_devkey_vectors[DERIVATION_ID_MAX][0x10] = { {0xD8, 0xD3, 0x67, 0x4F, 0xF3, 0xA2, 0xA4, 0x4E, 0xE4, 0x04, 0x37, 0xC2, 0xD9, 0xCF, 0x41, 0x6F}, /* 8.1.0: {0x72, 0xD0, 0xAD, 0xEB, 0xE1, 0xF6, 0x35, 0x90, 0xB4, 0x43, 0xCC, 0x4B, 0xC4, 0xDC, 0x88, 0x0A}, */ - {0x8B, 0xD6, 0x13, 0x2F, 0xC3, 0x4D, 0x53, 0x2D, 0x10, 0xA1, 0x63, 0x85, 0x49, 0x2B, 0xCF, 0x3F}, + /* 9.0.0: {0x8B, 0xD6, 0x13, 0x2F, 0xC3, 0x4D, 0x53, 0x2D, 0x10, 0xA1, 0x63, 0x85, 0x49, 0x2B, 0xCF, 0x3F}, */ + {0xA8, 0x58, 0x05, 0x8D, 0xDD, 0x9A, 0xA0, 0x2F, 0x01, 0x62, 0x4A, 0x6B, 0xC6, 0x77, 0xE9, 0x86}, }; void derive_keys(void) { diff --git a/stratosphere/libstratosphere/include/stratosphere/ams/ams_types.hpp b/stratosphere/libstratosphere/include/stratosphere/ams/ams_types.hpp index bd4c4af2a..75e7adfe7 100644 --- a/stratosphere/libstratosphere/include/stratosphere/ams/ams_types.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/ams/ams_types.hpp @@ -33,6 +33,7 @@ namespace ams::exosphere { TargetFirmware_800 = 9, TargetFirmware_810 = 10, TargetFirmware_900 = 11, + TargetFirmware_910 = 12, }; #ifdef ATMOSPHERE_H @@ -50,6 +51,7 @@ namespace ams::exosphere { AMS_VALIDATE_TARGET_FIRMWARE_ENUM(800); AMS_VALIDATE_TARGET_FIRMWARE_ENUM(810); AMS_VALIDATE_TARGET_FIRMWARE_ENUM(900); + AMS_VALIDATE_TARGET_FIRMWARE_ENUM(910); #undef AMS_VALIDATE_TARGET_FIRMWARE_ENUM diff --git a/stratosphere/libstratosphere/include/stratosphere/hos/hos_types.hpp b/stratosphere/libstratosphere/include/stratosphere/hos/hos_types.hpp index 0b8c60b48..158310ba7 100644 --- a/stratosphere/libstratosphere/include/stratosphere/hos/hos_types.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/hos/hos_types.hpp @@ -31,7 +31,8 @@ namespace ams::hos { Version_800 = 7, Version_810 = 8, Version_900 = 9, - Version_Current = Version_900, + Version_910 = 10, + Version_Current = Version_910, Version_Max = 32, }; diff --git a/stratosphere/libstratosphere/source/hos/hos_version_api.cpp b/stratosphere/libstratosphere/source/hos/hos_version_api.cpp index d0118a752..0c1837b9d 100644 --- a/stratosphere/libstratosphere/source/hos/hos_version_api.cpp +++ b/stratosphere/libstratosphere/source/hos/hos_version_api.cpp @@ -66,6 +66,8 @@ namespace ams::hos { break; case exosphere::TargetFirmware_900: g_hos_version = hos::Version_900; + case exosphere::TargetFirmware_910: + g_hos_version = hos::Version_910; break; AMS_UNREACHABLE_DEFAULT_CASE(); } @@ -132,6 +134,10 @@ namespace ams::hos { major = 9; minor = 0; micro = 0; + case hos::Version_910: + major = 9; + minor = 1; + micro = 0; break; AMS_UNREACHABLE_DEFAULT_CASE(); }