diff --git a/deps/libfmt b/deps/libfmt index ae6df0a..22d3ddc 160000 --- a/deps/libfmt +++ b/deps/libfmt @@ -1 +1 @@ -Subproject commit ae6df0aead2fdaae8a0b117524a6eb036c8fa075 +Subproject commit 22d3ddc718021809d8499913867bb9d93dfce7d0 diff --git a/deps/libpietendo b/deps/libpietendo index 7227006..e090b58 160000 --- a/deps/libpietendo +++ b/deps/libpietendo @@ -1 +1 @@ -Subproject commit 722700675db9ca4ad6378012d05a06f4499fe828 +Subproject commit e090b58aef89e815b53d4f2ac7d180f7ed6572c3 diff --git a/deps/libtoolchain b/deps/libtoolchain index 05a38e1..0bd9836 160000 --- a/deps/libtoolchain +++ b/deps/libtoolchain @@ -1 +1 @@ -Subproject commit 05a38e1f0b7e28d8763937f503d4ac34dc8d823d +Subproject commit 0bd98364bb4a253200ecd684c8e6323804321c7b diff --git a/src/EsTikProcess.cpp b/src/EsTikProcess.cpp index c4e68cf..eea7afc 100644 --- a/src/EsTikProcess.cpp +++ b/src/EsTikProcess.cpp @@ -85,8 +85,8 @@ void nstool::EsTikProcess::verifyTicket() tc::crypto::GenerateSha1Hash(tik_hash.data(), mTik.getBody().getBytes().data(), mTik.getBody().getBytes().size()); break; case (pie::hac::es::sign::HASH_ALGO_SHA256): - tik_hash = tc::ByteData(tc::crypto::Sha256Generator::kHashSize); - tc::crypto::GenerateSha256Hash(tik_hash.data(), mTik.getBody().getBytes().data(), mTik.getBody().getBytes().size()); + tik_hash = tc::ByteData(tc::crypto::Sha2256Generator::kHashSize); + tc::crypto::GenerateSha2256Hash(tik_hash.data(), mTik.getBody().getBytes().data(), mTik.getBody().getBytes().size()); break; } @@ -109,7 +109,7 @@ void nstool::EsTikProcess::displayTicket() fmt::print("[ES Ticket]\n"); fmt::print(" SignType: {:s}", getSignTypeStr(mTik.getSignature().getSignType())); if (mCliOutputMode.show_extended_info) - fmt::print(" (0x{:x})", mTik.getSignature().getSignType()); + fmt::print(" (0x{:x})", (uint32_t)mTik.getSignature().getSignType()); fmt::print("\n"); fmt::print(" Issuer: {:s}\n", body.getIssuer()); diff --git a/src/GameCardProcess.cpp b/src/GameCardProcess.cpp index c415aed..a1c08c4 100644 --- a/src/GameCardProcess.cpp +++ b/src/GameCardProcess.cpp @@ -114,7 +114,7 @@ void nstool::GameCardProcess::importHeader() pie::hac::sGcHeader_Rsa2048Signed* hdr_ptr = (pie::hac::sGcHeader_Rsa2048Signed*)(scratch.data() + mGcHeaderOffset); // generate hash of raw header - tc::crypto::GenerateSha256Hash(mHdrHash.data(), (byte_t*)&hdr_ptr->header, sizeof(pie::hac::sGcHeader)); + tc::crypto::GenerateSha2256Hash(mHdrHash.data(), (byte_t*)&hdr_ptr->header, sizeof(pie::hac::sGcHeader)); // save the signature memcpy(mHdrSignature.data(), hdr_ptr->signature.data(), mHdrSignature.size()); @@ -225,7 +225,7 @@ bool nstool::GameCardProcess::validateRegionOfFile(int64_t offset, int64_t len, mFile->read(scratch.data(), scratch.size()); // update hash - tc::crypto::Sha256Generator sha256_gen; + tc::crypto::Sha2256Generator sha256_gen; sha256_gen.initialize(); sha256_gen.update(scratch.data(), scratch.size()); if (use_salt) @@ -247,7 +247,7 @@ void nstool::GameCardProcess::validateXciSignature() { if (mKeyCfg.xci_header_sign_key.isSet()) { - if (tc::crypto::VerifyRsa2048Pkcs1Sha256(mHdrSignature.data(), mHdrHash.data(), mKeyCfg.xci_header_sign_key.get()) == false) + if (tc::crypto::VerifyRsa2048Pkcs1Sha2256(mHdrSignature.data(), mHdrHash.data(), mKeyCfg.xci_header_sign_key.get()) == false) { fmt::print("[WARNING] GameCard Header Signature: FAIL\n"); } diff --git a/src/NcaProcess.cpp b/src/NcaProcess.cpp index 48d84e3..db0f87b 100644 --- a/src/NcaProcess.cpp +++ b/src/NcaProcess.cpp @@ -116,7 +116,7 @@ void nstool::NcaProcess::importHeader() pie::hac::ContentArchiveUtil::decryptContentArchiveHeader((byte_t*)&mHdrBlock, (byte_t*)&mHdrBlock, mKeyCfg.nca_header_key.get()); // generate header hash - tc::crypto::GenerateSha256Hash(mHdrHash.data(), (byte_t*)&mHdrBlock.header, sizeof(pie::hac::sContentArchiveHeader)); + tc::crypto::GenerateSha2256Hash(mHdrHash.data(), (byte_t*)&mHdrBlock.header, sizeof(pie::hac::sContentArchiveHeader)); // proccess main header mHdr.fromBytes((byte_t*)&mHdrBlock.header, sizeof(pie::hac::sContentArchiveHeader)); @@ -256,7 +256,7 @@ void nstool::NcaProcess::generatePartitionConfiguration() // validate header hash pie::hac::detail::sha256_hash_t fs_header_hash; - tc::crypto::GenerateSha256Hash(fs_header_hash.data(), (const byte_t*)&mHdrBlock.fs_header[partition.header_index], sizeof(pie::hac::sContentArchiveFsHeader)); + tc::crypto::GenerateSha2256Hash(fs_header_hash.data(), (const byte_t*)&mHdrBlock.fs_header[partition.header_index], sizeof(pie::hac::sContentArchiveFsHeader)); if (fs_header_hash != partition.fs_header_hash) { throw tc::Exception(mModuleName, fmt::format("NCA FS Header [{:d}] Hash: FAIL", partition.header_index)); @@ -412,7 +412,7 @@ void nstool::NcaProcess::validateNcaSignatures() // validate signature[0] if (mKeyCfg.nca_header_sign0_key.find(mHdr.getSignatureKeyGeneration()) != mKeyCfg.nca_header_sign0_key.end()) { - if (tc::crypto::VerifyRsa2048PssSha256(mHdrBlock.signature_main.data(), mHdrHash.data(), mKeyCfg.nca_header_sign0_key[mHdr.getSignatureKeyGeneration()]) == false) + if (tc::crypto::VerifyRsa2048PssSha2256(mHdrBlock.signature_main.data(), mHdrHash.data(), mKeyCfg.nca_header_sign0_key[mHdr.getSignatureKeyGeneration()]) == false) { fmt::print("[WARNING] NCA Header Main Signature: FAIL\n"); } @@ -446,7 +446,7 @@ void nstool::NcaProcess::validateNcaSignatures() npdm.setCliOutputMode(CliOutputMode(false, false, false, false)); npdm.process(); - if (tc::crypto::VerifyRsa2048PssSha256(mHdrBlock.signature_acid.data(), mHdrHash.data(), npdm.getMeta().getAccessControlInfoDesc().getContentArchiveHeaderSignature2Key()) == false) + if (tc::crypto::VerifyRsa2048PssSha2256(mHdrBlock.signature_acid.data(), mHdrHash.data(), npdm.getMeta().getAccessControlInfoDesc().getContentArchiveHeaderSignature2Key()) == false) { throw tc::Exception("Bad signature"); } diff --git a/src/NsoProcess.cpp b/src/NsoProcess.cpp index f639399..a65bdb2 100644 --- a/src/NsoProcess.cpp +++ b/src/NsoProcess.cpp @@ -116,7 +116,7 @@ void nstool::NsoProcess::importCodeSegments() } if (mHdr.getTextSegmentInfo().is_hashed) { - tc::crypto::GenerateSha256Hash(calc_hash.data(), mTextBlob.data(), mTextBlob.size()); + tc::crypto::GenerateSha2256Hash(calc_hash.data(), mTextBlob.data(), mTextBlob.size()); if (calc_hash != mHdr.getTextSegmentInfo().hash) { throw tc::Exception(mModuleName, "NSO text segment failed SHA256 verification"); @@ -149,7 +149,7 @@ void nstool::NsoProcess::importCodeSegments() } if (mHdr.getRoSegmentInfo().is_hashed) { - tc::crypto::GenerateSha256Hash(calc_hash.data(), mRoBlob.data(), mRoBlob.size()); + tc::crypto::GenerateSha2256Hash(calc_hash.data(), mRoBlob.data(), mRoBlob.size()); if (calc_hash != mHdr.getRoSegmentInfo().hash) { throw tc::Exception(mModuleName, "NSO ro segment failed SHA256 verification"); @@ -182,7 +182,7 @@ void nstool::NsoProcess::importCodeSegments() } if (mHdr.getDataSegmentInfo().is_hashed) { - tc::crypto::GenerateSha256Hash(calc_hash.data(), mDataBlob.data(), mDataBlob.size()); + tc::crypto::GenerateSha2256Hash(calc_hash.data(), mDataBlob.data(), mDataBlob.size()); if (calc_hash != mHdr.getDataSegmentInfo().hash) { throw tc::Exception(mModuleName, "NSO data segment failed SHA256 verification"); diff --git a/src/PkiValidator.cpp b/src/PkiValidator.cpp index 4b99e2d..a47e68a 100644 --- a/src/PkiValidator.cpp +++ b/src/PkiValidator.cpp @@ -62,8 +62,8 @@ void nstool::PkiValidator::addCertificate(const pie::hac::es::SignedData