mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge pull request #10984 from shuffle2/verifydev
fix verifying wii dev signatures
This commit is contained in:
commit
86d760b814
@ -1047,14 +1047,15 @@ ReturnCode ESDevice::VerifyContainer(VerifyContainerType type, VerifyMode mode,
|
|||||||
// IOS assumes that the CA cert will always be signed by the root certificate,
|
// IOS assumes that the CA cert will always be signed by the root certificate,
|
||||||
// and that the issuer is signed by the CA.
|
// and that the issuer is signed by the CA.
|
||||||
IOSC& iosc = m_ios.GetIOSC();
|
IOSC& iosc = m_ios.GetIOSC();
|
||||||
IOSC::Handle handle;
|
IOSC::Handle ca_handle;
|
||||||
|
|
||||||
// Create and initialise a handle for the CA cert and the issuer cert.
|
// Create and initialise a handle for the CA cert and the issuer cert.
|
||||||
ReturnCode ret = iosc.CreateObject(&handle, IOSC::TYPE_PUBLIC_KEY, IOSC::SUBTYPE_RSA2048, PID_ES);
|
ReturnCode ret =
|
||||||
|
iosc.CreateObject(&ca_handle, IOSC::TYPE_PUBLIC_KEY, IOSC::SUBTYPE_RSA2048, PID_ES);
|
||||||
if (ret != IPC_SUCCESS)
|
if (ret != IPC_SUCCESS)
|
||||||
return ret;
|
return ret;
|
||||||
Common::ScopeGuard ca_guard{[&] { iosc.DeleteObject(handle, PID_ES); }};
|
Common::ScopeGuard ca_guard{[&] { iosc.DeleteObject(ca_handle, PID_ES); }};
|
||||||
ret = iosc.ImportCertificate(ca_cert, IOSC::HANDLE_ROOT_KEY, handle, PID_ES);
|
ret = iosc.ImportCertificate(ca_cert, IOSC::HANDLE_ROOT_KEY, ca_handle, PID_ES);
|
||||||
if (ret != IPC_SUCCESS)
|
if (ret != IPC_SUCCESS)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_ImportCertificate(ca) failed with error {}", ret);
|
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_ImportCertificate(ca) failed with error {}", ret);
|
||||||
@ -1068,7 +1069,7 @@ ReturnCode ESDevice::VerifyContainer(VerifyContainerType type, VerifyMode mode,
|
|||||||
if (ret != IPC_SUCCESS)
|
if (ret != IPC_SUCCESS)
|
||||||
return ret;
|
return ret;
|
||||||
Common::ScopeGuard issuer_guard{[&] { iosc.DeleteObject(issuer_handle, PID_ES); }};
|
Common::ScopeGuard issuer_guard{[&] { iosc.DeleteObject(issuer_handle, PID_ES); }};
|
||||||
ret = iosc.ImportCertificate(issuer_cert, handle, issuer_handle, PID_ES);
|
ret = iosc.ImportCertificate(issuer_cert, ca_handle, issuer_handle, PID_ES);
|
||||||
if (ret != IPC_SUCCESS)
|
if (ret != IPC_SUCCESS)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_ImportCertificate(issuer) failed with error {}",
|
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_ImportCertificate(issuer) failed with error {}",
|
||||||
|
@ -263,7 +263,7 @@ void WriteReturnValue(s32 value, u32 address)
|
|||||||
Memory::Write_U32(static_cast<u32>(value), address);
|
Memory::Write_U32(static_cast<u32>(value), address);
|
||||||
}
|
}
|
||||||
|
|
||||||
Kernel::Kernel()
|
Kernel::Kernel(IOSC::ConsoleType console_type) : m_iosc(console_type)
|
||||||
{
|
{
|
||||||
// Until the Wii root and NAND path stuff is entirely managed by IOS and made non-static,
|
// Until the Wii root and NAND path stuff is entirely managed by IOS and made non-static,
|
||||||
// using more than one IOS instance at a time is not supported.
|
// using more than one IOS instance at a time is not supported.
|
||||||
|
@ -110,7 +110,7 @@ void WriteReturnValue(s32 value, u32 address);
|
|||||||
class Kernel
|
class Kernel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Kernel();
|
explicit Kernel(IOSC::ConsoleType console_type = IOSC::ConsoleType::Retail);
|
||||||
virtual ~Kernel();
|
virtual ~Kernel();
|
||||||
|
|
||||||
void DoState(PointerWrap& p);
|
void DoState(PointerWrap& p);
|
||||||
|
@ -95,6 +95,80 @@ static_assert(sizeof(BootMiiKeyDump) == 0x400, "Wrong size");
|
|||||||
|
|
||||||
namespace IOS::HLE
|
namespace IOS::HLE
|
||||||
{
|
{
|
||||||
|
constexpr std::array<u8, 512> ROOT_PUBLIC_KEY = {
|
||||||
|
{0xF8, 0x24, 0x6C, 0x58, 0xBA, 0xE7, 0x50, 0x03, 0x01, 0xFB, 0xB7, 0xC2, 0xEB, 0xE0, 0x01,
|
||||||
|
0x05, 0x71, 0xDA, 0x92, 0x23, 0x78, 0xF0, 0x51, 0x4E, 0xC0, 0x03, 0x1D, 0xD0, 0xD2, 0x1E,
|
||||||
|
0xD3, 0xD0, 0x7E, 0xFC, 0x85, 0x20, 0x69, 0xB5, 0xDE, 0x9B, 0xB9, 0x51, 0xA8, 0xBC, 0x90,
|
||||||
|
0xA2, 0x44, 0x92, 0x6D, 0x37, 0x92, 0x95, 0xAE, 0x94, 0x36, 0xAA, 0xA6, 0xA3, 0x02, 0x51,
|
||||||
|
0x0C, 0x7B, 0x1D, 0xED, 0xD5, 0xFB, 0x20, 0x86, 0x9D, 0x7F, 0x30, 0x16, 0xF6, 0xBE, 0x65,
|
||||||
|
0xD3, 0x83, 0xA1, 0x6D, 0xB3, 0x32, 0x1B, 0x95, 0x35, 0x18, 0x90, 0xB1, 0x70, 0x02, 0x93,
|
||||||
|
0x7E, 0xE1, 0x93, 0xF5, 0x7E, 0x99, 0xA2, 0x47, 0x4E, 0x9D, 0x38, 0x24, 0xC7, 0xAE, 0xE3,
|
||||||
|
0x85, 0x41, 0xF5, 0x67, 0xE7, 0x51, 0x8C, 0x7A, 0x0E, 0x38, 0xE7, 0xEB, 0xAF, 0x41, 0x19,
|
||||||
|
0x1B, 0xCF, 0xF1, 0x7B, 0x42, 0xA6, 0xB4, 0xED, 0xE6, 0xCE, 0x8D, 0xE7, 0x31, 0x8F, 0x7F,
|
||||||
|
0x52, 0x04, 0xB3, 0x99, 0x0E, 0x22, 0x67, 0x45, 0xAF, 0xD4, 0x85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A5, 0x0C, 0xEC, 0x3B,
|
||||||
|
0x73, 0x84, 0xDE, 0x88, 0x6E, 0x82, 0xD2, 0xEB, 0x4D, 0x4E, 0x42, 0xB5, 0xF2, 0xB1, 0x49,
|
||||||
|
0xA8, 0x1E, 0xA7, 0xCE, 0x71, 0x44, 0xDC, 0x29, 0x94, 0xCF, 0xC4, 0x4E, 0x1F, 0x91, 0xCB,
|
||||||
|
0xD4, 0x95}};
|
||||||
|
|
||||||
|
constexpr std::array<u8, 512> ROOT_PUBLIC_KEY_DEV = {
|
||||||
|
{0xD0, 0x1F, 0xE1, 0x00, 0xD4, 0x35, 0x56, 0xB2, 0x4B, 0x56, 0xDA, 0xE9, 0x71, 0xB5, 0xA5,
|
||||||
|
0xD3, 0x84, 0xB9, 0x30, 0x03, 0xBE, 0x1B, 0xBF, 0x28, 0xA2, 0x30, 0x5B, 0x06, 0x06, 0x45,
|
||||||
|
0x46, 0x7D, 0x5B, 0x02, 0x51, 0xD2, 0x56, 0x1A, 0x27, 0x4F, 0x9E, 0x9F, 0x9C, 0xEC, 0x64,
|
||||||
|
0x61, 0x50, 0xAB, 0x3D, 0x2A, 0xE3, 0x36, 0x68, 0x66, 0xAC, 0xA4, 0xBA, 0xE8, 0x1A, 0xE3,
|
||||||
|
0xD7, 0x9A, 0xA6, 0xB0, 0x4A, 0x8B, 0xCB, 0xA7, 0xE6, 0xFB, 0x64, 0x89, 0x45, 0xEB, 0xDF,
|
||||||
|
0xDB, 0x85, 0xBA, 0x09, 0x1F, 0xD7, 0xD1, 0x14, 0xB5, 0xA3, 0xA7, 0x80, 0xE3, 0xA2, 0x2E,
|
||||||
|
0x6E, 0xCD, 0x87, 0xB5, 0xA4, 0xC6, 0xF9, 0x10, 0xE4, 0x03, 0x22, 0x08, 0x81, 0x4B, 0x0C,
|
||||||
|
0xEE, 0xA1, 0xA1, 0x7D, 0xF7, 0x39, 0x69, 0x5F, 0x61, 0x7E, 0xF6, 0x35, 0x28, 0xDB, 0x94,
|
||||||
|
0x96, 0x37, 0xA0, 0x56, 0x03, 0x7F, 0x7B, 0x32, 0x41, 0x38, 0x95, 0xC0, 0xA8, 0xF1, 0x98,
|
||||||
|
0x2E, 0x15, 0x65, 0xE3, 0x8E, 0xED, 0xC2, 0x2E, 0x59, 0x0E, 0xE2, 0x67, 0x7B, 0x86, 0x09,
|
||||||
|
0xF4, 0x8C, 0x2E, 0x30, 0x3F, 0xBC, 0x40, 0x5C, 0xAC, 0x18, 0x04, 0x2F, 0x82, 0x20, 0x84,
|
||||||
|
0xE4, 0x93, 0x68, 0x03, 0xDA, 0x7F, 0x41, 0x34, 0x92, 0x48, 0x56, 0x2B, 0x8E, 0xE1, 0x2F,
|
||||||
|
0x78, 0xF8, 0x03, 0x24, 0x63, 0x30, 0xBC, 0x7B, 0xE7, 0xEE, 0x72, 0x4A, 0xF4, 0x58, 0xA4,
|
||||||
|
0x72, 0xE7, 0xAB, 0x46, 0xA1, 0xA7, 0xC1, 0x0C, 0x2F, 0x18, 0xFA, 0x07, 0xC3, 0xDD, 0xD8,
|
||||||
|
0x98, 0x06, 0xA1, 0x1C, 0x9C, 0xC1, 0x30, 0xB2, 0x47, 0xA3, 0x3C, 0x8D, 0x47, 0xDE, 0x67,
|
||||||
|
0xF2, 0x9E, 0x55, 0x77, 0xB1, 0x1C, 0x43, 0x49, 0x3D, 0x5B, 0xBA, 0x76, 0x34, 0xA7, 0xE4,
|
||||||
|
0xE7, 0x15, 0x31, 0xB7, 0xDF, 0x59, 0x81, 0xFE, 0x24, 0xA1, 0x14, 0x55, 0x4C, 0xBD, 0x8F,
|
||||||
|
0x00, 0x5C, 0xE1, 0xDB, 0x35, 0x08, 0x5C, 0xCF, 0xC7, 0x78, 0x06, 0xB6, 0xDE, 0x25, 0x40,
|
||||||
|
0x68, 0xA2, 0x6C, 0xB5, 0x49, 0x2D, 0x45, 0x80, 0x43, 0x8F, 0xE1, 0xE5, 0xA9, 0xED, 0x75,
|
||||||
|
0xC5, 0xED, 0x45, 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xB4, 0xFB, 0x00, 0xCC, 0xB7, 0x51, 0xAF, 0x50, 0x73, 0x29, 0xC4,
|
||||||
|
0xA3, 0x93, 0x9E, 0xA6, 0xDD, 0x9C, 0x50, 0xA0, 0xE7, 0x38, 0x6B, 0x01, 0x45, 0x79, 0x6B,
|
||||||
|
0x41, 0xAF, 0x61, 0xF7, 0x85, 0x55, 0x94, 0x4F, 0x3B, 0xC2, 0x2D, 0xC3, 0xBD, 0x0D, 0x00,
|
||||||
|
0xF8, 0x79, 0x8A, 0x42, 0xB1, 0xAA, 0xA0, 0x83, 0x20, 0x65, 0x9A, 0xC7, 0x39, 0x5A, 0xB4,
|
||||||
|
0xF3, 0x29}};
|
||||||
|
|
||||||
constexpr u32 DEFAULT_DEVICE_ID = 0x0403AC68;
|
constexpr u32 DEFAULT_DEVICE_ID = 0x0403AC68;
|
||||||
constexpr u32 DEFAULT_KEY_ID = 0x6AAB8C59;
|
constexpr u32 DEFAULT_KEY_ID = 0x6AAB8C59;
|
||||||
|
|
||||||
@ -131,9 +205,9 @@ static size_t GetSizeForType(IOSC::ObjectType type, IOSC::ObjectSubType subtype)
|
|||||||
return iterator != s_type_to_size_map.end() ? iterator->second : 0;
|
return iterator != s_type_to_size_map.end() ? iterator->second : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
IOSC::IOSC(ConsoleType console_type)
|
IOSC::IOSC(ConsoleType console_type) : m_console_type(console_type)
|
||||||
{
|
{
|
||||||
LoadDefaultEntries(console_type);
|
LoadDefaultEntries();
|
||||||
LoadEntries();
|
LoadEntries();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,8 +401,20 @@ ReturnCode IOSC::VerifyPublicKeySign(const std::array<u8, 20>& sha1, Handle sign
|
|||||||
mbedtls_mpi_read_binary(&rsa.E, reinterpret_cast<const u8*>(&entry->misc_data), 4);
|
mbedtls_mpi_read_binary(&rsa.E, reinterpret_cast<const u8*>(&entry->misc_data), 4);
|
||||||
rsa.len = entry->data.size();
|
rsa.len = entry->data.size();
|
||||||
|
|
||||||
const int ret = mbedtls_rsa_pkcs1_verify(&rsa, nullptr, nullptr, MBEDTLS_RSA_PUBLIC,
|
int ret = mbedtls_rsa_pkcs1_verify(&rsa, nullptr, nullptr, MBEDTLS_RSA_PUBLIC, MBEDTLS_MD_SHA1,
|
||||||
MBEDTLS_MD_SHA1, 0, sha1.data(), signature.data());
|
0, sha1.data(), signature.data());
|
||||||
|
if (ret != 0 && m_console_type == ConsoleType::RVT)
|
||||||
|
{
|
||||||
|
// Some dev signatures do not have proper PKCS#1 padding. Just powmod and check it ends with
|
||||||
|
// digest.
|
||||||
|
std::vector<u8> result(signature.size());
|
||||||
|
if (mbedtls_rsa_public(&rsa, signature.data(), result.data()) == 0 &&
|
||||||
|
memcmp(&result[result.size() - sha1.size()], sha1.data(), sha1.size()) == 0)
|
||||||
|
{
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
WARN_LOG_FMT(IOS, "VerifyPublicKeySign: RSA verification failed (error {})", ret);
|
WARN_LOG_FMT(IOS, "VerifyPublicKeySign: RSA verification failed (error {})", ret);
|
||||||
@ -467,54 +553,23 @@ void IOSC::Sign(u8* sig_out, u8* ap_cert_out, u64 title_id, const u8* data, u32
|
|||||||
std::copy(signature.cbegin(), signature.cend(), sig_out);
|
std::copy(signature.cbegin(), signature.cend(), sig_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr std::array<u8, 512> ROOT_PUBLIC_KEY = {
|
void IOSC::LoadDefaultEntries()
|
||||||
{0xF8, 0x24, 0x6C, 0x58, 0xBA, 0xE7, 0x50, 0x03, 0x01, 0xFB, 0xB7, 0xC2, 0xEB, 0xE0, 0x01,
|
|
||||||
0x05, 0x71, 0xDA, 0x92, 0x23, 0x78, 0xF0, 0x51, 0x4E, 0xC0, 0x03, 0x1D, 0xD0, 0xD2, 0x1E,
|
|
||||||
0xD3, 0xD0, 0x7E, 0xFC, 0x85, 0x20, 0x69, 0xB5, 0xDE, 0x9B, 0xB9, 0x51, 0xA8, 0xBC, 0x90,
|
|
||||||
0xA2, 0x44, 0x92, 0x6D, 0x37, 0x92, 0x95, 0xAE, 0x94, 0x36, 0xAA, 0xA6, 0xA3, 0x02, 0x51,
|
|
||||||
0x0C, 0x7B, 0x1D, 0xED, 0xD5, 0xFB, 0x20, 0x86, 0x9D, 0x7F, 0x30, 0x16, 0xF6, 0xBE, 0x65,
|
|
||||||
0xD3, 0x83, 0xA1, 0x6D, 0xB3, 0x32, 0x1B, 0x95, 0x35, 0x18, 0x90, 0xB1, 0x70, 0x02, 0x93,
|
|
||||||
0x7E, 0xE1, 0x93, 0xF5, 0x7E, 0x99, 0xA2, 0x47, 0x4E, 0x9D, 0x38, 0x24, 0xC7, 0xAE, 0xE3,
|
|
||||||
0x85, 0x41, 0xF5, 0x67, 0xE7, 0x51, 0x8C, 0x7A, 0x0E, 0x38, 0xE7, 0xEB, 0xAF, 0x41, 0x19,
|
|
||||||
0x1B, 0xCF, 0xF1, 0x7B, 0x42, 0xA6, 0xB4, 0xED, 0xE6, 0xCE, 0x8D, 0xE7, 0x31, 0x8F, 0x7F,
|
|
||||||
0x52, 0x04, 0xB3, 0x99, 0x0E, 0x22, 0x67, 0x45, 0xAF, 0xD4, 0x85, 0xB2, 0x44, 0x93, 0x00,
|
|
||||||
0x8B, 0x08, 0xC7, 0xF6, 0xB7, 0xE5, 0x6B, 0x02, 0xB3, 0xE8, 0xFE, 0x0C, 0x9D, 0x85, 0x9C,
|
|
||||||
0xB8, 0xB6, 0x82, 0x23, 0xB8, 0xAB, 0x27, 0xEE, 0x5F, 0x65, 0x38, 0x07, 0x8B, 0x2D, 0xB9,
|
|
||||||
0x1E, 0x2A, 0x15, 0x3E, 0x85, 0x81, 0x80, 0x72, 0xA2, 0x3B, 0x6D, 0xD9, 0x32, 0x81, 0x05,
|
|
||||||
0x4F, 0x6F, 0xB0, 0xF6, 0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x3C, 0x69, 0x35, 0x6E, 0xB2, 0xB2, 0xAD, 0x5C, 0xC4, 0xC8, 0x58,
|
|
||||||
0x45, 0x5E, 0xF5, 0xF7, 0xB3, 0x06, 0x44, 0xB4, 0x7C, 0x64, 0x06, 0x8C, 0xDF, 0x80, 0x9F,
|
|
||||||
0x76, 0x02, 0x5A, 0x2D, 0xB4, 0x46, 0xE0, 0x3D, 0x7C, 0xF6, 0x2F, 0x34, 0xE7, 0x02, 0x45,
|
|
||||||
0x7B, 0x02, 0xA4, 0xCF, 0x5D, 0x9D, 0xD5, 0x3C, 0xA5, 0x3A, 0x7C, 0xA6, 0x29, 0x78, 0x8C,
|
|
||||||
0x67, 0xCA, 0x08, 0xBF, 0xEC, 0xCA, 0x43, 0xA9, 0x57, 0xAD, 0x16, 0xC9, 0x4E, 0x1C, 0xD8,
|
|
||||||
0x75, 0xCA, 0x10, 0x7D, 0xCE, 0x7E, 0x01, 0x18, 0xF0, 0xDF, 0x6B, 0xFE, 0xE5, 0x1D, 0xDB,
|
|
||||||
0xD9, 0x91, 0xC2, 0x6E, 0x60, 0xCD, 0x48, 0x58, 0xAA, 0x59, 0x2C, 0x82, 0x00, 0x75, 0xF2,
|
|
||||||
0x9F, 0x52, 0x6C, 0x91, 0x7C, 0x6F, 0xE5, 0x40, 0x3E, 0xA7, 0xD4, 0xA5, 0x0C, 0xEC, 0x3B,
|
|
||||||
0x73, 0x84, 0xDE, 0x88, 0x6E, 0x82, 0xD2, 0xEB, 0x4D, 0x4E, 0x42, 0xB5, 0xF2, 0xB1, 0x49,
|
|
||||||
0xA8, 0x1E, 0xA7, 0xCE, 0x71, 0x44, 0xDC, 0x29, 0x94, 0xCF, 0xC4, 0x4E, 0x1F, 0x91, 0xCB,
|
|
||||||
0xD4, 0x95}};
|
|
||||||
|
|
||||||
void IOSC::LoadDefaultEntries(ConsoleType console_type)
|
|
||||||
{
|
{
|
||||||
|
// NOTE: IOS on real hardware supplies defaulted values if common key is not blown in OTP.
|
||||||
|
// In some cases, the default values used differ between retail and dev builds of IOS.
|
||||||
|
// Dolphin does not use the same "default" values as IOS does, as we do not emulate unblown
|
||||||
|
// scenario.
|
||||||
|
|
||||||
m_key_entries[HANDLE_CONSOLE_KEY] = {
|
m_key_entries[HANDLE_CONSOLE_KEY] = {
|
||||||
TYPE_SECRET_KEY, SUBTYPE_ECC233, {DEFAULT_PRIVATE_KEY.begin(), DEFAULT_PRIVATE_KEY.end()}, 3};
|
TYPE_SECRET_KEY, SUBTYPE_ECC233, {DEFAULT_PRIVATE_KEY.begin(), DEFAULT_PRIVATE_KEY.end()}, 3};
|
||||||
m_console_signature = DEFAULT_SIGNATURE;
|
m_console_signature = DEFAULT_SIGNATURE;
|
||||||
m_console_key_id = DEFAULT_KEY_ID;
|
m_console_key_id = DEFAULT_KEY_ID;
|
||||||
m_key_entries[HANDLE_CONSOLE_ID] = {TYPE_DATA, SUBTYPE_DATA, {}, DEFAULT_DEVICE_ID, 0xFFFFFFF};
|
m_key_entries[HANDLE_CONSOLE_ID] = {TYPE_DATA, SUBTYPE_DATA, {}, DEFAULT_DEVICE_ID, 0xFFFFFFF};
|
||||||
m_key_entries[HANDLE_FS_KEY] = {TYPE_SECRET_KEY, SUBTYPE_AES128, std::vector<u8>(16), 5};
|
m_key_entries[HANDLE_FS_KEY] = {TYPE_SECRET_KEY, SUBTYPE_AES128, std::vector<u8>(AES128_KEY_SIZE),
|
||||||
|
5};
|
||||||
m_key_entries[HANDLE_FS_MAC] = {TYPE_SECRET_KEY, SUBTYPE_MAC, std::vector<u8>(20), 5};
|
m_key_entries[HANDLE_FS_MAC] = {TYPE_SECRET_KEY, SUBTYPE_MAC, std::vector<u8>(20), 5};
|
||||||
|
|
||||||
switch (console_type)
|
switch (m_console_type)
|
||||||
{
|
{
|
||||||
case ConsoleType::Retail:
|
case ConsoleType::Retail:
|
||||||
m_key_entries[HANDLE_COMMON_KEY] = {TYPE_SECRET_KEY,
|
m_key_entries[HANDLE_COMMON_KEY] = {TYPE_SECRET_KEY,
|
||||||
@ -522,6 +577,13 @@ void IOSC::LoadDefaultEntries(ConsoleType console_type)
|
|||||||
{{0xeb, 0xe4, 0x2a, 0x22, 0x5e, 0x85, 0x93, 0xe4, 0x48,
|
{{0xeb, 0xe4, 0x2a, 0x22, 0x5e, 0x85, 0x93, 0xe4, 0x48,
|
||||||
0xd9, 0xc5, 0x45, 0x73, 0x81, 0xaa, 0xf7}},
|
0xd9, 0xc5, 0x45, 0x73, 0x81, 0xaa, 0xf7}},
|
||||||
3};
|
3};
|
||||||
|
m_root_key_entry = {TYPE_PUBLIC_KEY, SUBTYPE_RSA4096,
|
||||||
|
std::vector<u8>(ROOT_PUBLIC_KEY.begin(), ROOT_PUBLIC_KEY.end()),
|
||||||
|
Common::swap32(0x00010001), 0};
|
||||||
|
// Retail keyblob are issued by CA00000001. Default to 1 even though IOSC actually defaults
|
||||||
|
// to 2.
|
||||||
|
m_ms_id = 2;
|
||||||
|
m_ca_id = 1;
|
||||||
break;
|
break;
|
||||||
case ConsoleType::RVT:
|
case ConsoleType::RVT:
|
||||||
m_key_entries[HANDLE_COMMON_KEY] = {TYPE_SECRET_KEY,
|
m_key_entries[HANDLE_COMMON_KEY] = {TYPE_SECRET_KEY,
|
||||||
@ -529,9 +591,11 @@ void IOSC::LoadDefaultEntries(ConsoleType console_type)
|
|||||||
{{0xa1, 0x60, 0x4a, 0x6a, 0x71, 0x23, 0xb5, 0x29, 0xae,
|
{{0xa1, 0x60, 0x4a, 0x6a, 0x71, 0x23, 0xb5, 0x29, 0xae,
|
||||||
0x8b, 0xec, 0x32, 0xc8, 0x16, 0xfc, 0xaa}},
|
0x8b, 0xec, 0x32, 0xc8, 0x16, 0xfc, 0xaa}},
|
||||||
3};
|
3};
|
||||||
break;
|
m_root_key_entry = {TYPE_PUBLIC_KEY, SUBTYPE_RSA4096,
|
||||||
default:
|
std::vector<u8>(ROOT_PUBLIC_KEY_DEV.begin(), ROOT_PUBLIC_KEY_DEV.end()),
|
||||||
ASSERT_MSG(IOS, false, "Unknown console type");
|
Common::swap32(0x00010001), 0};
|
||||||
|
m_ms_id = 3;
|
||||||
|
m_ca_id = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -554,10 +618,6 @@ void IOSC::LoadDefaultEntries(ConsoleType console_type)
|
|||||||
{{0x63, 0xb8, 0x2b, 0xb4, 0xf4, 0x61, 0x4e, 0x2e, 0x13,
|
{{0x63, 0xb8, 0x2b, 0xb4, 0xf4, 0x61, 0x4e, 0x2e, 0x13,
|
||||||
0xf2, 0xfe, 0xfb, 0xba, 0x4c, 0x9b, 0x7e}},
|
0xf2, 0xfe, 0xfb, 0xba, 0x4c, 0x9b, 0x7e}},
|
||||||
3};
|
3};
|
||||||
|
|
||||||
m_root_key_entry = {TYPE_PUBLIC_KEY, SUBTYPE_RSA4096,
|
|
||||||
std::vector<u8>(ROOT_PUBLIC_KEY.begin(), ROOT_PUBLIC_KEY.end()),
|
|
||||||
Common::swap32(0x00010001), 0};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IOSC::LoadEntries()
|
void IOSC::LoadEntries()
|
||||||
|
@ -136,7 +136,7 @@ public:
|
|||||||
// More information on default handles: https://wiibrew.org/wiki/IOS/Syscalls
|
// More information on default handles: https://wiibrew.org/wiki/IOS/Syscalls
|
||||||
enum DefaultHandle : u32
|
enum DefaultHandle : u32
|
||||||
{
|
{
|
||||||
// ECC-233 private signing key (per-console)
|
// NG private key. ECC-233 private signing key (per-console)
|
||||||
HANDLE_CONSOLE_KEY = 0,
|
HANDLE_CONSOLE_KEY = 0,
|
||||||
// Console ID
|
// Console ID
|
||||||
HANDLE_CONSOLE_ID = 1,
|
HANDLE_CONSOLE_ID = 1,
|
||||||
@ -252,7 +252,7 @@ private:
|
|||||||
ExcludeRootKey,
|
ExcludeRootKey,
|
||||||
};
|
};
|
||||||
|
|
||||||
void LoadDefaultEntries(ConsoleType console_type);
|
void LoadDefaultEntries();
|
||||||
void LoadEntries();
|
void LoadEntries();
|
||||||
|
|
||||||
KeyEntries::iterator FindFreeEntry();
|
KeyEntries::iterator FindFreeEntry();
|
||||||
@ -265,12 +265,12 @@ private:
|
|||||||
ReturnCode DecryptEncrypt(Common::AES::Mode mode, Handle key_handle, u8* iv, const u8* input,
|
ReturnCode DecryptEncrypt(Common::AES::Mode mode, Handle key_handle, u8* iv, const u8* input,
|
||||||
size_t size, u8* output, u32 pid) const;
|
size_t size, u8* output, u32 pid) const;
|
||||||
|
|
||||||
|
ConsoleType m_console_type{ConsoleType::Retail};
|
||||||
KeyEntries m_key_entries;
|
KeyEntries m_key_entries;
|
||||||
KeyEntry m_root_key_entry;
|
KeyEntry m_root_key_entry;
|
||||||
Common::ec::Signature m_console_signature{};
|
Common::ec::Signature m_console_signature{};
|
||||||
// Retail keyblob are issued by CA00000001. Default to 1 even though IOSC actually defaults to 2.
|
u32 m_ms_id = 0;
|
||||||
u32 m_ms_id = 2;
|
u32 m_ca_id = 0;
|
||||||
u32 m_ca_id = 1;
|
|
||||||
u32 m_console_key_id = 0;
|
u32 m_console_key_id = 0;
|
||||||
};
|
};
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
|
@ -574,7 +574,9 @@ bool VolumeVerifier::CheckPartition(const Partition& partition)
|
|||||||
|
|
||||||
if (!m_is_datel)
|
if (!m_is_datel)
|
||||||
{
|
{
|
||||||
IOS::HLE::Kernel ios;
|
const auto console_type =
|
||||||
|
IsDebugSigned() ? IOS::HLE::IOSC::ConsoleType::RVT : IOS::HLE::IOSC::ConsoleType::Retail;
|
||||||
|
IOS::HLE::Kernel ios(console_type);
|
||||||
const auto es = ios.GetES();
|
const auto es = ios.GetES();
|
||||||
const std::vector<u8>& cert_chain = m_volume.GetCertificateChain(partition);
|
const std::vector<u8>& cert_chain = m_volume.GetCertificateChain(partition);
|
||||||
|
|
||||||
@ -978,7 +980,7 @@ void VolumeVerifier::CheckMisc()
|
|||||||
|
|
||||||
if (m_volume.GetVolumeType() == Platform::WiiWAD)
|
if (m_volume.GetVolumeType() == Platform::WiiWAD)
|
||||||
{
|
{
|
||||||
IOS::HLE::Kernel ios;
|
IOS::HLE::Kernel ios(m_ticket.GetConsoleType());
|
||||||
const auto es = ios.GetES();
|
const auto es = ios.GetES();
|
||||||
const std::vector<u8>& cert_chain = m_volume.GetCertificateChain(PARTITION_NONE);
|
const std::vector<u8>& cert_chain = m_volume.GetCertificateChain(PARTITION_NONE);
|
||||||
|
|
||||||
@ -1456,7 +1458,8 @@ void VolumeVerifier::Finish()
|
|||||||
{
|
{
|
||||||
m_result.summary_text +=
|
m_result.summary_text +=
|
||||||
Common::GetStringT("\n\nBecause this title is not for retail Wii consoles, "
|
Common::GetStringT("\n\nBecause this title is not for retail Wii consoles, "
|
||||||
"Dolphin cannot verify that it hasn't been tampered with.");
|
"Dolphin cannot ensure that it hasn't been tampered with, even if "
|
||||||
|
"signatures appear valid.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user