From 1cec2aa5982b8087195fdd2bbaaa6b6d8514b7c9 Mon Sep 17 00:00:00 2001 From: N2614 Date: Thu, 28 Jul 2011 07:32:11 +0000 Subject: [PATCH] =?UTF-8?q?[Verifier]=E3=83=98=E3=83=83=E3=83=80=E3=82=82?= =?UTF-8?q?=E8=AA=AD=E3=81=BF=E8=BE=BC=E3=81=BF=E6=B8=88=E3=81=BF=E3=81=AE?= =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=B5=E3=82=A4=E3=82=BA?= =?UTF-8?q?=E3=81=A8=E3=81=97=E3=81=A6=E8=A8=88=E7=AE=97=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@409 385bec56-5757-e545-9c3a-d8741f4650f1 --- .../sources/tools/ExportedDataVerifier/main.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/trunk/ConsoleDataMigration/sources/tools/ExportedDataVerifier/main.cpp b/trunk/ConsoleDataMigration/sources/tools/ExportedDataVerifier/main.cpp index 06b7f13..755abad 100644 --- a/trunk/ConsoleDataMigration/sources/tools/ExportedDataVerifier/main.cpp +++ b/trunk/ConsoleDataMigration/sources/tools/ExportedDataVerifier/main.cpp @@ -280,6 +280,8 @@ bool VerifyDirectory(const wchar_t * from_path, void* buf, // NAND上のフルパスをハッシュに含めている context.Update(nandPath, std::wcslen(nandPath) * sizeof(wchar_t)); + size_t totalReadSize = 0; + BackupDataHeader enc; BackupDataHeader dec; std::memset(&enc, 0, sizeof(enc)); @@ -291,10 +293,10 @@ bool VerifyDirectory(const wchar_t * from_path, void* buf, ret_value = false; break; } + totalReadSize += readSize; context.Update(&enc, sizeof(enc)); swAesCtrContext.Decrypt(&dec, &enc, sizeof(enc)); - size_t totalReadSize = 0; while (1) { result = sdFile.TryRead(&readSize, buf, bufSize); @@ -313,7 +315,7 @@ bool VerifyDirectory(const wchar_t * from_path, void* buf, ret_value = CalculateAndCompareCmac(&context, sdCmac); if(!ret_value) { - COMMON_LOGGER("********** Verification Failed **********\n %s\n", common::GetCharStr(target_from.str().c_str())); + COMMON_LOGGER("********** Verification Failed ********** %s\n", common::GetCharStr(target_from.str().c_str())); s_VerifyFail++; } else @@ -327,9 +329,9 @@ bool VerifyDirectory(const wchar_t * from_path, void* buf, { bool readDone = false;; // CMACまで読んだかどうか - if (sdFileSize - (sizeof(BackupDataHeader) + nn::crypto::AES_CMAC_MAC_SIZE) < totalReadSize) + if (sdFileSize - nn::crypto::AES_CMAC_MAC_SIZE < totalReadSize) { - readSize -= totalReadSize - (sdFileSize - (sizeof(BackupDataHeader) + nn::crypto::AES_CMAC_MAC_SIZE)); + readSize -= totalReadSize - (sdFileSize - nn::crypto::AES_CMAC_MAC_SIZE); readDone = true; } context.Update(buf, readSize); @@ -339,7 +341,7 @@ bool VerifyDirectory(const wchar_t * from_path, void* buf, ret_value = CalculateAndCompareCmac(&context, sdCmac); if(!ret_value) { - COMMON_LOGGER("********** Verification Failed **********\n %s\n", common::GetCharStr(target_from.str().c_str())); + COMMON_LOGGER("********** Verification Failed ********** %s\n", common::GetCharStr(target_from.str().c_str())); s_VerifyFail++; } else