mirror of
https://github.com/DarkStore-3DS/Project_CTR.git
synced 2026-07-02 16:59:03 +00:00
Tag error output as [ctrtool::ClassName ERROR], leaving warnings/progress indicators as [ctrtool::ClassName LOG]
This commit is contained in:
@@ -213,7 +213,7 @@ void ctrtool::CciProcess::importHeader()
|
||||
|
||||
if (mValidInitialDataMac != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] InitialData MAC was invalid.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] InitialData MAC was invalid.\n", mModuleLabel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ void ctrtool::CciProcess::importHeader()
|
||||
else
|
||||
{
|
||||
// no initial data key
|
||||
fmt::print(stderr, "[{} LOG] Failed to determine key to decrypt InitialData.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Failed to determine key to decrypt InitialData.\n", mModuleLabel);
|
||||
}
|
||||
|
||||
// open fs reader
|
||||
@@ -252,13 +252,13 @@ void ctrtool::CciProcess::verifyHeader()
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Could not load CCI RSA2048 public key.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Could not load CCI RSA2048 public key.\n", mModuleLabel);
|
||||
mValidSignature = ValidState::Fail;
|
||||
}
|
||||
|
||||
if (mValidSignature != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Signature for NcsdCommonHeader was invalid.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Signature for NcsdCommonHeader was invalid.\n", mModuleLabel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ void ctrtool::CciProcess::processContent()
|
||||
{
|
||||
if (mContentIndex >= ntd::n3ds::NcsdCommonHeader::kPartitionNum)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Content index {:d} isn't valid for CCI, use index 0-7, defaulting to 0 now.\n", mModuleLabel, mContentIndex);
|
||||
fmt::print(stderr, "[{} ERROR] Content index {:d} isn't valid for CCI, use index 0-7, defaulting to 0 now.\n", mModuleLabel, mContentIndex);
|
||||
mContentIndex = 0;
|
||||
}
|
||||
if (mHeader.ncsd_header.partition_offsetsize[mContentIndex].blk_size.unwrap() != 0)
|
||||
|
||||
+13
-13
@@ -323,7 +323,7 @@ void ctrtool::CiaProcess::importHeader()
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Cannot determine titlekey.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Cannot determine titlekey.\n", mModuleLabel);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -418,21 +418,21 @@ void ctrtool::CiaProcess::verifyMetadata()
|
||||
// only show this warning for non-root signed certificates
|
||||
if (mCertChain[i].signature.issuer != "Root")
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Public key \"{}\" (for certificate \"{}\") was not present in the CIA certificate chain. The public key included with CTRTool was used instead.\n", mModuleLabel, mCertChain[i].signature.issuer, mCertChain[i].subject);
|
||||
fmt::print(stderr, "[{} ERROR] Public key \"{}\" (for certificate \"{}\") was not present in the CIA certificate chain. The public key included with CTRTool was used instead.\n", mModuleLabel, mCertChain[i].signature.issuer, mCertChain[i].subject);
|
||||
}
|
||||
mCertSigValid[i] = keybag_issuer_itr->second->verifyHash(mCertChain[i].calculated_hash.data(), mCertChain[i].signature.sig.data()) ? ValidState::Good : ValidState::Fail;
|
||||
}
|
||||
else
|
||||
{
|
||||
// cannot locate rsa key to verify
|
||||
fmt::print(stderr, "[{} LOG] Could not locate public key for \"{}\" (certificate).\n", mModuleLabel, mCertChain[i].signature.issuer);
|
||||
fmt::print(stderr, "[{} ERROR] Could not locate public key for \"{}\" (certificate).\n", mModuleLabel, mCertChain[i].signature.issuer);
|
||||
mCertSigValid[i] = ValidState::Fail;
|
||||
}
|
||||
|
||||
// log certificate signature validation error
|
||||
if (mCertSigValid[i] != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Signature for Certificate \"{}\" was invalid.\n", mModuleLabel, mCertChain[i].signature.issuer);
|
||||
fmt::print(stderr, "[{} ERROR] Signature for Certificate \"{}\" was invalid.\n", mModuleLabel, mCertChain[i].signature.issuer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -450,20 +450,20 @@ void ctrtool::CiaProcess::verifyMetadata()
|
||||
// fallback try with the keybag imported issuer
|
||||
else if (keybag_issuer_itr != mIssuerSigner.end() && keybag_issuer_itr->second->getSigType() == mTicket.signature.sig_type)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Public key \"{}\" (for ticket) was not present in the CIA certificate chain. The public key included with CTRTool was used instead.\n", mModuleLabel, mTicket.signature.issuer);
|
||||
fmt::print(stderr, "[{} ERROR] Public key \"{}\" (for ticket) was not present in the CIA certificate chain. The public key included with CTRTool was used instead.\n", mModuleLabel, mTicket.signature.issuer);
|
||||
mTicketSigValid = keybag_issuer_itr->second->verifyHash(mTicket.calculated_hash.data(), mTicket.signature.sig.data()) ? ValidState::Good : ValidState::Fail;
|
||||
}
|
||||
else
|
||||
{
|
||||
// cannot locate rsa key to verify
|
||||
fmt::print(stderr, "[{} LOG] Could not locate public key \"{}\" (for ticket).\n", mModuleLabel, mTicket.signature.issuer);
|
||||
fmt::print(stderr, "[{} ERROR] Could not locate public key \"{}\" (for ticket).\n", mModuleLabel, mTicket.signature.issuer);
|
||||
mTicketSigValid = ValidState::Fail;
|
||||
}
|
||||
|
||||
// log ticket signature validation error
|
||||
if (mTicketSigValid != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Signature for Ticket was invalid.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Signature for Ticket was invalid.\n", mModuleLabel);
|
||||
}
|
||||
}
|
||||
if (mHeader.format_version.unwrap() == ntd::n3ds::CiaHeader::FormatVersion_Default && mTmdSizeInfo.size > 0)
|
||||
@@ -480,20 +480,20 @@ void ctrtool::CiaProcess::verifyMetadata()
|
||||
// fallback try with the keybag imported issuer
|
||||
else if (keybag_issuer_itr != mIssuerSigner.end() && keybag_issuer_itr->second->getSigType() == mTitleMetaData.signature.sig_type)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Public key \"{}\" (for tmd) was not present in the CIA certificate chain. The public key included with CTRTool was used instead.\n", mModuleLabel, mTitleMetaData.signature.issuer);
|
||||
fmt::print(stderr, "[{} ERROR] Public key \"{}\" (for tmd) was not present in the CIA certificate chain. The public key included with CTRTool was used instead.\n", mModuleLabel, mTitleMetaData.signature.issuer);
|
||||
mTitleMetaDataSigValid = keybag_issuer_itr->second->verifyHash(mTitleMetaData.calculated_hash.data(), mTitleMetaData.signature.sig.data()) ? ValidState::Good : ValidState::Fail;
|
||||
}
|
||||
else
|
||||
{
|
||||
// cannot locate rsa key to verify
|
||||
fmt::print(stderr, "[{} LOG] Could not locate public key \"{}\" (for tmd).\n", mModuleLabel, mTitleMetaData.signature.issuer);
|
||||
fmt::print(stderr, "[{} ERROR] Could not locate public key \"{}\" (for tmd).\n", mModuleLabel, mTitleMetaData.signature.issuer);
|
||||
mTitleMetaDataSigValid = ValidState::Fail;
|
||||
}
|
||||
|
||||
// log tmd signature validation error
|
||||
if (mTitleMetaDataSigValid != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Signature for TitleMetaData was invalid.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Signature for TitleMetaData was invalid.\n", mModuleLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -546,7 +546,7 @@ void ctrtool::CiaProcess::verifyContent()
|
||||
|
||||
if (itr->second.valid_state != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Hash for content (index=0x{:04x}, id=0x{:08x}) was invalid.\n", mModuleLabel, itr->second.cindex, itr->second.cid);
|
||||
fmt::print(stderr, "[{} ERROR] Hash for content (index=0x{:04x}, id=0x{:08x}) was invalid.\n", mModuleLabel, itr->second.cindex, itr->second.cid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -806,7 +806,7 @@ void ctrtool::CiaProcess::processContent()
|
||||
{
|
||||
if (mContentIndex >= ntd::n3ds::CiaHeader::kCiaMaxContentNum)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Content index {:d} isn't valid for CIA, use index 0-{:d}, defaulting to 0 now.\n", mModuleLabel, mContentIndex, ((size_t)ntd::n3ds::CiaHeader::kCiaMaxContentNum)-1);
|
||||
fmt::print(stderr, "[{} ERROR] Content index {:d} isn't valid for CIA, use index 0-{:d}, defaulting to 0 now.\n", mModuleLabel, mContentIndex, ((size_t)ntd::n3ds::CiaHeader::kCiaMaxContentNum)-1);
|
||||
mContentIndex = 0;
|
||||
}
|
||||
if (mContentInfo.find(mContentIndex) != mContentInfo.end() && mContentInfo[mContentIndex].size != 0)
|
||||
@@ -828,7 +828,7 @@ void ctrtool::CiaProcess::processContent()
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] TWL title processing not supported\n", mModuleLabel);
|
||||
throw tc::NotImplementedException(mModuleLabel, "TWL title processing not supported.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ void ctrtool::CrrProcess::verifyData()
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Could not read static CRR public key.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Could not read static CRR public key.\n", mModuleLabel);
|
||||
mValidCertificateSignature = ValidState::Fail;
|
||||
}
|
||||
|
||||
@@ -149,15 +149,15 @@ void ctrtool::CrrProcess::verifyData()
|
||||
// log validation errors
|
||||
if (mValidCertificateSignature != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Signature for CRR Certificate was invalid.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Signature for CRR Certificate was invalid.\n", mModuleLabel);
|
||||
}
|
||||
if (mValidBodySignature != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Signature for CRR Body was invalid.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Signature for CRR Body was invalid.\n", mModuleLabel);
|
||||
}
|
||||
if (mValidUniqueId != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] CRR UniqueId was invalid.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] CRR UniqueId was invalid.\n", mModuleLabel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,13 +96,13 @@ void ctrtool::ExHeaderProcess::verifyExHeader()
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Could not load AccessDescriptor RSA2048 public key.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Could not load AccessDescriptor RSA2048 public key.\n", mModuleLabel);
|
||||
mValidSignature = ValidState::Fail;
|
||||
}
|
||||
|
||||
if (mValidSignature != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Signature for AccessDescriptor was invalid.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Signature for AccessDescriptor was invalid.\n", mModuleLabel);
|
||||
}
|
||||
|
||||
mValidLocalCaps.system_save_id[0] = ValidState::Good;
|
||||
@@ -191,7 +191,7 @@ void ctrtool::ExHeaderProcess::verifyExHeader()
|
||||
mValidLocalCaps.fs_access = ValidState::Fail;
|
||||
if (mVerbose)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] FsAccess Bit {:d} was not permitted\n", mModuleLabel, fs_bit);
|
||||
fmt::print(stderr, "[{} ERROR] FsAccess Bit {:d} was not permitted\n", mModuleLabel, fs_bit);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -218,64 +218,64 @@ void ctrtool::ExHeaderProcess::verifyExHeader()
|
||||
mValidLocalCaps.service_control = Fail;
|
||||
if (mVerbose)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Service \"{}\" was not permitted\n", mModuleLabel, exhdr_service_access_control[i].decode());
|
||||
fmt::print(stderr, "[{} ERROR] Service \"{}\" was not permitted\n", mModuleLabel, exhdr_service_access_control[i].decode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mValidLocalCaps.system_save_id[0] != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "SystemSaveId1");
|
||||
fmt::print(stderr, "[{} ERROR] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "SystemSaveId1");
|
||||
}
|
||||
if (mValidLocalCaps.system_save_id[1] != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "SystemSaveId2");
|
||||
fmt::print(stderr, "[{} ERROR] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "SystemSaveId2");
|
||||
}
|
||||
if (mValidLocalCaps.fs_access != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "FsAccess");
|
||||
fmt::print(stderr, "[{} ERROR] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "FsAccess");
|
||||
}
|
||||
/*
|
||||
if (mValidLocalCaps.core_version != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "CoreVersion");
|
||||
fmt::print(stderr, "[{} ERROR] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "CoreVersion");
|
||||
}
|
||||
*/
|
||||
if (mValidLocalCaps.program_id != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "ProgramId");
|
||||
fmt::print(stderr, "[{} ERROR] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "ProgramId");
|
||||
}
|
||||
if (mValidLocalCaps.priority != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "ThreadPriority");
|
||||
fmt::print(stderr, "[{} ERROR] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "ThreadPriority");
|
||||
}
|
||||
if (mValidLocalCaps.affinity_mask != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "AffinityMask");
|
||||
fmt::print(stderr, "[{} ERROR] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "AffinityMask");
|
||||
}
|
||||
if (mValidLocalCaps.ideal_processor != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "IdealProcessor");
|
||||
fmt::print(stderr, "[{} ERROR] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "IdealProcessor");
|
||||
}
|
||||
if (mValidLocalCaps.old3ds_system_mode != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "SystemMode (Old3DS)");
|
||||
fmt::print(stderr, "[{} ERROR] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "SystemMode (Old3DS)");
|
||||
}
|
||||
if (mValidLocalCaps.new3ds_system_mode != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "SystemMode (New3DS)");
|
||||
fmt::print(stderr, "[{} ERROR] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "SystemMode (New3DS)");
|
||||
}
|
||||
if (mValidLocalCaps.enable_l2_cache != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "EnableL2Cache");
|
||||
fmt::print(stderr, "[{} ERROR] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "EnableL2Cache");
|
||||
}
|
||||
if (mValidLocalCaps.new3ds_cpu_speed != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "CpuSpeed");
|
||||
fmt::print(stderr, "[{} ERROR] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "CpuSpeed");
|
||||
}
|
||||
if (mValidLocalCaps.service_control != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "ServiceAccess");
|
||||
fmt::print(stderr, "[{} ERROR] {} was not permmited by AccessDescriptor.\n", mModuleLabel, "ServiceAccess");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ void ctrtool::ExeFsProcess::verifyFs()
|
||||
|
||||
if (mSectionValidation[i] != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] ExeFs file \"{}\" had an invalid SHA2-256 hash.\n", mModuleLabel, mHeader.file_table[i].name.decode());
|
||||
fmt::print(stderr, "[{} ERROR] ExeFs file \"{}\" had an invalid SHA2-256 hash.\n", mModuleLabel, mHeader.file_table[i].name.decode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ void ctrtool::FirmProcess::verifyHashes()
|
||||
|
||||
if (mValidFirmSectionHash[i] != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] FIRM section {:d} SHA2-256 hash was invalid.\n", mModuleLabel, i);
|
||||
fmt::print(stderr, "[{} ERROR] FIRM section {:d} SHA2-256 hash was invalid.\n", mModuleLabel, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,7 @@ void ctrtool::FirmProcess::verifySignature()
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Could not load {} RSA2048 public key.\n", mModuleLabel, key_id == mKeyBag.RSAKEY_FIRM_NAND ? "FIRM_NAND" : "FIRM_RECOVERY");
|
||||
fmt::print(stderr, "[{} ERROR] Could not load {} RSA2048 public key.\n", mModuleLabel, key_id == mKeyBag.RSAKEY_FIRM_NAND ? "FIRM_NAND" : "FIRM_RECOVERY");
|
||||
valid_signature = ValidState::Fail;
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ void ctrtool::FirmProcess::verifySignature()
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Could not load {} SigHax RSA2048 signature.\n", mModuleLabel, key_id == mKeyBag.RSAKEY_FIRM_NAND ? "FIRM_NAND" : "FIRM_RECOVERY");
|
||||
fmt::print(stderr, "[{} ERROR] Could not load {} SigHax RSA2048 signature.\n", mModuleLabel, key_id == mKeyBag.RSAKEY_FIRM_NAND ? "FIRM_NAND" : "FIRM_RECOVERY");
|
||||
is_sighax = false;
|
||||
}
|
||||
|
||||
@@ -256,12 +256,12 @@ void ctrtool::FirmProcess::verifySignature()
|
||||
// check if sighax
|
||||
else if (valid_signature == ValidState::Fail && is_sighax == true)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Signature for FIRM was invalid (SigHax).\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Signature for FIRM was invalid (SigHax).\n", mModuleLabel);
|
||||
mSignatureState = SignatureState_SigHax;
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Signature for FIRM was invalid.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Signature for FIRM was invalid.\n", mModuleLabel);
|
||||
mSignatureState = SignatureState_Fail;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ void ctrtool::IvfcProcess::verifyLevels()
|
||||
{
|
||||
if (mVerbose)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] IVFC Layer {:d}, Block {:d} failed validation.\n", mModuleLabel, i, j);
|
||||
fmt::print(stderr, "[{} ERROR] IVFC Layer {:d}, Block {:d} failed validation.\n", mModuleLabel, i, j);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -141,7 +141,7 @@ void ctrtool::IvfcProcess::verifyLevels()
|
||||
|
||||
if (mLevelValidation[i] != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] IVFC Layer {:d} failed validation.\n", mModuleLabel, i);
|
||||
fmt::print(stderr, "[{} ERROR] IVFC Layer {:d} failed validation.\n", mModuleLabel, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
-16
@@ -241,7 +241,7 @@ void ctrtool::NcchProcess::determineRegionEncryption()
|
||||
}
|
||||
if (crypto_is_stripped)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] NCCH appears to be decrypted, contrary to header flags.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] NCCH appears to be decrypted, contrary to header flags.\n", mModuleLabel);
|
||||
}
|
||||
|
||||
// determine encryption mode
|
||||
@@ -287,7 +287,7 @@ void ctrtool::NcchProcess::determineRegionEncryption()
|
||||
keyslot[0].valid_key = ValidState::Fail;
|
||||
keyslot[1].valid_key = ValidState::Fail;
|
||||
|
||||
fmt::print(stderr, "[{} LOG] Could not load {} fixed key.\n", mModuleLabel, (isSystemTitle()? "system" : "application"));
|
||||
fmt::print(stderr, "[{} ERROR] Could not load {} fixed key.\n", mModuleLabel, (isSystemTitle()? "system" : "application"));
|
||||
}
|
||||
|
||||
// save keys
|
||||
@@ -307,7 +307,7 @@ void ctrtool::NcchProcess::determineRegionEncryption()
|
||||
{
|
||||
keyslot[0].valid_x = ValidState::Fail;
|
||||
|
||||
fmt::print(stderr, "[{} LOG] Could not load secure key_x[0x{:02x}].\n", mModuleLabel, 0);
|
||||
fmt::print(stderr, "[{} ERROR] Could not load secure key_x[0x{:02x}].\n", mModuleLabel, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -328,7 +328,7 @@ void ctrtool::NcchProcess::determineRegionEncryption()
|
||||
{
|
||||
keyslot[1].valid_x = ValidState::Fail;
|
||||
|
||||
fmt::print(stderr, "[{} LOG] Could not read secure key_x[0x{:02x}].\n", mModuleLabel, security_version);
|
||||
fmt::print(stderr, "[{} ERROR] Could not load secure key_x[0x{:02x}].\n", mModuleLabel, security_version);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -360,7 +360,7 @@ void ctrtool::NcchProcess::determineRegionEncryption()
|
||||
{
|
||||
keyslot[1].valid_y = ValidState::Fail;
|
||||
|
||||
fmt::print(stderr, "[{} LOG] This title uses seed crypto, but no seed is set, unable to decrypt.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] This title uses seed crypto, but no seed is set, unable to decrypt.\n", mModuleLabel);
|
||||
fmt::print(stderr, " Use -p to avoid decryption or use --seeddb=dbfile or --seed=SEEDHERE.\n");
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ void ctrtool::NcchProcess::determineRegionEncryption()
|
||||
{
|
||||
keyslot[1].valid_y = ValidState::Fail;
|
||||
|
||||
fmt::print(stderr, "[{} LOG] Seed check mismatch. (Got {:08x}, expected: {:08x})\n",
|
||||
fmt::print(stderr, "[{} ERROR] Seed check mismatch. (Got {:08x}, expected: {:08x})\n",
|
||||
mModuleLabel,
|
||||
((tc::bn::be32<uint32_t>*)hash.data())->unwrap(),
|
||||
((tc::bn::be32<uint32_t>*)mHeader.header.seed_checksum.data())->unwrap());
|
||||
@@ -532,7 +532,7 @@ void ctrtool::NcchProcess::determineRegionEncryption()
|
||||
// otherwise use the "best-effort" single key stream (only icon and banner will be decrypt properly)
|
||||
else
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Only NCCH key0 was determined, ExeFS may be partially decrypted\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Only NCCH key0 was determined, ExeFS may be partially decrypted\n", mModuleLabel);
|
||||
mRegionInfo[NcchRegion_ExeFs].ready_stream = std::shared_ptr<tc::crypto::Aes128CtrEncryptedStream>(new tc::crypto::Aes128CtrEncryptedStream(mRegionInfo[NcchRegion_ExeFs].raw_stream, keyslot[0].key, exefs_aesctr));
|
||||
}
|
||||
}
|
||||
@@ -597,7 +597,7 @@ void ctrtool::NcchProcess::verifyRegions()
|
||||
else
|
||||
{
|
||||
// cannot locate rsa key to verify
|
||||
fmt::print(stderr, "[{} LOG] Could not load CFA RSA2048 public key.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Could not load CFA RSA2048 public key.\n", mModuleLabel);
|
||||
mRegionInfo[NcchRegion_Header].valid = ValidState::Fail;
|
||||
}
|
||||
|
||||
@@ -622,14 +622,14 @@ void ctrtool::NcchProcess::verifyRegions()
|
||||
else
|
||||
{
|
||||
// cannot locate rsa key to verify
|
||||
fmt::print(stderr, "[{} LOG] Could not load CXI RSA2048 public key from AccessDescriptor.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Could not load CXI RSA2048 public key from AccessDescriptor.\n", mModuleLabel);
|
||||
mRegionInfo[NcchRegion_Header].valid = ValidState::Fail;
|
||||
}
|
||||
}
|
||||
|
||||
if (mRegionInfo[NcchRegion_Header].valid != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Signature for NcchHeader was invalid.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Signature for NcchHeader was invalid.\n", mModuleLabel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -640,7 +640,7 @@ void ctrtool::NcchProcess::verifyRegions()
|
||||
|
||||
if (mRegionInfo[NcchRegion_ExHeader].valid != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] ExtendedHeader SHA2-256 hash was invalid.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] ExtendedHeader SHA2-256 hash was invalid.\n", mModuleLabel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -651,7 +651,7 @@ void ctrtool::NcchProcess::verifyRegions()
|
||||
|
||||
if (mRegionInfo[NcchRegion_Logo].valid != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Logo SHA2-256 hash was invalid.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Logo SHA2-256 hash was invalid.\n", mModuleLabel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -662,7 +662,7 @@ void ctrtool::NcchProcess::verifyRegions()
|
||||
|
||||
if (mRegionInfo[NcchRegion_ExeFs].valid != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] ExeFs SuperBlock SHA2-256 hash was invalid.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] ExeFs SuperBlock SHA2-256 hash was invalid.\n", mModuleLabel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -673,7 +673,7 @@ void ctrtool::NcchProcess::verifyRegions()
|
||||
|
||||
if (mRegionInfo[NcchRegion_RomFs].valid != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] RomFs SuperBlock SHA2-256 hash was invalid.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] RomFs SuperBlock SHA2-256 hash was invalid.\n", mModuleLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -776,8 +776,8 @@ void ctrtool::NcchProcess::extractRegionBinaries()
|
||||
case NcchRegion_ExHeader: fmt::print(stderr, "[{} LOG] Saving Extended Header...\n", mModuleLabel); break;
|
||||
case NcchRegion_PlainRegion: fmt::print(stderr, "[{} LOG] Saving Plain Region...\n", mModuleLabel); break;
|
||||
case NcchRegion_Logo: fmt::print(stderr, "[{} LOG] Saving Logo...\n", mModuleLabel); break;
|
||||
case NcchRegion_ExeFs: fmt::print(stderr, "[{} LOG] Saving ExeFS...\n", mModuleLabel); break;
|
||||
case NcchRegion_RomFs: fmt::print(stderr, "[{} LOG] Saving RomFS...\n", mModuleLabel); break;
|
||||
case NcchRegion_ExeFs: fmt::print(stderr, "[{} LOG] Saving ExeFs...\n", mModuleLabel); break;
|
||||
case NcchRegion_RomFs: fmt::print(stderr, "[{} LOG] Saving RomFs...\n", mModuleLabel); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -202,21 +202,21 @@ void ctrtool::TikProcess::verifyData()
|
||||
// only show this warning when there are certificates appended to the ticket (only tickets downloaded from CDN will have an appended certificate chain)
|
||||
if (mCertChain.size() != 0)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Public key \"{}\" (for ticket) was not present in the appended certificate chain. The public key included with CTRTool was used instead.\n", mModuleLabel, mTicket.signature.issuer);
|
||||
fmt::print(stderr, "[{} ERROR] Public key \"{}\" (for ticket) was not present in the appended certificate chain. The public key included with CTRTool was used instead.\n", mModuleLabel, mTicket.signature.issuer);
|
||||
}
|
||||
mTicketSigValid = keybag_issuer_itr->second->verifyHash(mTicket.calculated_hash.data(), mTicket.signature.sig.data()) ? ValidState::Good : ValidState::Fail;
|
||||
}
|
||||
else
|
||||
{
|
||||
// cannot locate rsa key to verify
|
||||
fmt::print(stderr, "[{} LOG] Could not locate public key \"{}\" (for ticket).\n", mModuleLabel, mTicket.signature.issuer);
|
||||
fmt::print(stderr, "[{} ERROR] Could not locate public key \"{}\" (for ticket).\n", mModuleLabel, mTicket.signature.issuer);
|
||||
mTicketSigValid = ValidState::Fail;
|
||||
}
|
||||
|
||||
// log ticket signature validation error
|
||||
if (mTicketSigValid != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Signature for Ticket was invalid.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Signature for Ticket was invalid.\n", mModuleLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,21 +139,21 @@ void ctrtool::TmdProcess::verifyData()
|
||||
// only show this warning for non-root signed certificates
|
||||
if (mCertChain[i].signature.issuer != "Root")
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Public key \"{}\" (for certificate \"{}\") was not present in the certificate chain. The public key included with CTRTool was used instead.\n", mModuleLabel, mCertChain[i].signature.issuer, mCertChain[i].subject);
|
||||
fmt::print(stderr, "[{} ERROR] Public key \"{}\" (for certificate \"{}\") was not present in the certificate chain. The public key included with CTRTool was used instead.\n", mModuleLabel, mCertChain[i].signature.issuer, mCertChain[i].subject);
|
||||
}
|
||||
mCertSigValid[i] = keybag_issuer_itr->second->verifyHash(mCertChain[i].calculated_hash.data(), mCertChain[i].signature.sig.data()) ? ValidState::Good : ValidState::Fail;
|
||||
}
|
||||
else
|
||||
{
|
||||
// cannot locate rsa key to verify
|
||||
fmt::print(stderr, "[{} LOG] Could not locate public key for \"{}\" (certificate).\n", mModuleLabel, mCertChain[i].signature.issuer);
|
||||
fmt::print(stderr, "[{} ERROR] Could not locate public key for \"{}\" (certificate).\n", mModuleLabel, mCertChain[i].signature.issuer);
|
||||
mCertSigValid[i] = ValidState::Fail;
|
||||
}
|
||||
|
||||
// log certificate signature validation error
|
||||
if (mCertSigValid[i] != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Signature for Certificate \"{}\" was invalid.\n", mModuleLabel, mCertChain[i].signature.issuer);
|
||||
fmt::print(stderr, "[{} ERROR] Signature for Certificate \"{}\" was invalid.\n", mModuleLabel, mCertChain[i].signature.issuer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,21 +174,21 @@ void ctrtool::TmdProcess::verifyData()
|
||||
// only show this warning when there are certificates appended to the tmd (only tmd downloaded from CDN will have an appended certificate chain)
|
||||
if (mCertChain.size() != 0)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Public key \"{}\" (for tmd) was not present in the appended certificate chain. The public key included with CTRTool was used instead.\n", mModuleLabel, mTitleMetaData.signature.issuer);
|
||||
fmt::print(stderr, "[{} ERROR] Public key \"{}\" (for tmd) was not present in the appended certificate chain. The public key included with CTRTool was used instead.\n", mModuleLabel, mTitleMetaData.signature.issuer);
|
||||
}
|
||||
mTitleMetaDataSigValid = keybag_issuer_itr->second->verifyHash(mTitleMetaData.calculated_hash.data(), mTitleMetaData.signature.sig.data()) ? ValidState::Good : ValidState::Fail;
|
||||
}
|
||||
else
|
||||
{
|
||||
// cannot locate rsa key to verify
|
||||
fmt::print(stderr, "[{} LOG] Could not locate public key \"{}\" (for tmd).\n", mModuleLabel, mTitleMetaData.signature.issuer);
|
||||
fmt::print(stderr, "[{} ERROR] Could not locate public key \"{}\" (for tmd).\n", mModuleLabel, mTitleMetaData.signature.issuer);
|
||||
mTitleMetaDataSigValid = ValidState::Fail;
|
||||
}
|
||||
|
||||
// log tmd signature validation error
|
||||
if (mTitleMetaDataSigValid != ValidState::Good)
|
||||
{
|
||||
fmt::print(stderr, "[{} LOG] Signature for TitleMetaData was invalid.\n", mModuleLabel);
|
||||
fmt::print(stderr, "[{} ERROR] Signature for TitleMetaData was invalid.\n", mModuleLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user