From a8807e7452389b0461174868c0d69ab013601145 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 19 Jul 2019 20:05:03 +0200 Subject: [PATCH] Force signature verification during system update from disc Unlike the WADs people put in their game lists, these WADs should always be correctly signed. --- Source/Core/Core/WiiUtils.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/WiiUtils.cpp b/Source/Core/Core/WiiUtils.cpp index 792934ed50..75ed6efed0 100644 --- a/Source/Core/Core/WiiUtils.cpp +++ b/Source/Core/Core/WiiUtils.cpp @@ -46,7 +46,8 @@ namespace WiiUtils { -static bool ImportWAD(IOS::HLE::Kernel& ios, const DiscIO::VolumeWAD& wad) +static bool ImportWAD(IOS::HLE::Kernel& ios, const DiscIO::VolumeWAD& wad, + IOS::HLE::Device::ES::VerifySignature verify_signature) { if (!wad.GetTicket().IsValid() || !wad.GetTMD().IsValid()) { @@ -66,9 +67,9 @@ static bool ImportWAD(IOS::HLE::Kernel& ios, const DiscIO::VolumeWAD& wad) while ((ret = es->ImportTicket(ticket.GetBytes(), wad.GetCertificateChain(), IOS::HLE::Device::ES::TicketImportType::Unpersonalised, - IOS::HLE::Device::ES::VerifySignature::No)) < 0 || + verify_signature)) < 0 || (ret = es->ImportTitleInit(context, tmd.GetBytes(), wad.GetCertificateChain(), - IOS::HLE::Device::ES::VerifySignature::No)) < 0) + verify_signature)) < 0) { if (ret != IOS::HLE::IOSC_FAIL_CHECKVALUE) PanicAlertT("WAD installation failed: Could not initialise title import (error %d).", ret); @@ -141,7 +142,8 @@ bool InstallWAD(IOS::HLE::Kernel& ios, const DiscIO::VolumeWAD& wad, InstallType if (previous_temporary_title_id) ios.GetES()->DeleteTitleContent(previous_temporary_title_id); - if (!ImportWAD(ios, wad)) + // A lot of people use fakesigned WADs, so disable signature checking when installing a WAD. + if (!ImportWAD(ios, wad, IOS::HLE::Device::ES::VerifySignature::No)) return false; // Keep track of the title ID so this title can be removed to make room for any future install. @@ -731,7 +733,8 @@ UpdateResult DiscSystemUpdater::ProcessEntry(u32 type, std::bitset<32> attrs, return UpdateResult::DiscReadFailed; } const DiscIO::VolumeWAD wad{std::move(blob)}; - return ImportWAD(m_ios, wad) ? UpdateResult::Succeeded : UpdateResult::ImportFailed; + const bool success = ImportWAD(m_ios, wad, IOS::HLE::Device::ES::VerifySignature::Yes); + return success ? UpdateResult::Succeeded : UpdateResult::ImportFailed; } UpdateResult DoOnlineUpdate(UpdateCallback update_callback, const std::string& region)