diff --git a/trunk/ConsoleDataMigration/common/SdReaderWriter.cpp b/trunk/ConsoleDataMigration/common/SdReaderWriter.cpp index 583a46f..d5870cc 100644 --- a/trunk/ConsoleDataMigration/common/SdReaderWriter.cpp +++ b/trunk/ConsoleDataMigration/common/SdReaderWriter.cpp @@ -26,21 +26,6 @@ namespace common { -bool Compare(const bit8* p0, const bit8* p1, size_t size) -{ - s32 i; - bool result = true; - for (i = 0; i < size; ++i) - { - if (*(p0 + i) != *(p1 + i)) - { - result = false; - } - } - return result; -} // Compare - - nn::Result SdReaderWriter::Initialize() { nn::Result result; @@ -228,7 +213,7 @@ nn::Result SdReaderWriter::ReadBufWithCmac(const wchar_t* path, void* buf, size_ result = nn::crypto::CalculateAesCmacSw(cmac, sha256Hash, nn::crypto::Sha256Context::HASH_SIZE, common::cmacKey); COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result); - if(!Compare(reinterpret_cast(buf) + *totalSize, cmac, sizeof(cmac))) + if(std::memcmp(reinterpret_cast(buf) + *totalSize, cmac, sizeof(cmac)) != 0) { // 無効なファイル COMMON_LOGGER("Verification Failed\n");