diff --git a/branches/work/VerificationFailed/sources/ConsoleBackup/HeapChecker.cpp b/branches/work/VerificationFailed/sources/ConsoleBackup/HeapChecker.cpp index d08d137..70b9aed 100644 --- a/branches/work/VerificationFailed/sources/ConsoleBackup/HeapChecker.cpp +++ b/branches/work/VerificationFailed/sources/ConsoleBackup/HeapChecker.cpp @@ -15,6 +15,7 @@ #include +#include "Aes_define.h" #include "HeapChecker.h" #include "SdReaderWriter.h" #include "CommonLogger.h" @@ -93,6 +94,8 @@ nn::Result HeapChecker::Check(std::wstring saveRoot, void* buf, size_t& bufSize) s32 readSize = 0; nn::crypto::Sha256Context writeContext; writeContext.Initialize(); + nn::crypto::SwAesCtrContext aes; + aes.Initialize(common::checkiv, common::checkkey, sizeof(common::checkkey)); for(;;) { result = nandFile.TryRead(&readSize, buf, bufSize); @@ -103,6 +106,7 @@ nn::Result HeapChecker::Check(std::wstring saveRoot, void* buf, size_t& bufSize) break; } + aes.Encrypt(buf, buf, readSize); writeContext.Update(buf, readSize); s32 writeSize; diff --git a/branches/work/VerificationFailed/sources/common/Aes_define.h b/branches/work/VerificationFailed/sources/common/Aes_define.h index 68a4cc6..61f88e6 100644 --- a/branches/work/VerificationFailed/sources/common/Aes_define.h +++ b/branches/work/VerificationFailed/sources/common/Aes_define.h @@ -50,6 +50,18 @@ namespace common 0x7d, 0x06, 0x85, 0xe6, 0xe7, 0xb6, 0x4e, 0xe9 }; + const bit8 checkkey[AES_KEY_SIZE] NN_ATTRIBUTE_ALIGN(4) = + { + 0x5c, 0x5d, 0x56, 0x79, 0x20, 0x75, 0xfc, 0x56, + 0x82, 0x6e, 0xd7, 0x55, 0xf5, 0xec, 0x0c, 0xc4 + }; + + const bit8 checkiv[AES_BLOCK_SIZE] NN_ATTRIBUTE_ALIGN(4) = + { + 0xb8, 0x84, 0x87, 0xce, 0xd5, 0xfd, 0x0a, 0xd4, + 0x5b, 0x3f, 0x3b, 0xc8, 0xc9, 0x85, 0xdf, 0x8a + }; + #else const bit8 key[AES_KEY_SIZE] NN_ATTRIBUTE_ALIGN(4) = { @@ -68,6 +80,19 @@ namespace common 0xe4, 0xcf, 0x58, 0xe5, 0xc9, 0xd6, 0xac, 0x7d, 0xf1, 0xb9, 0x82, 0xf9, 0xa2, 0xd8, 0xda, 0x7b }; + + const bit8 checkkey[AES_KEY_SIZE] NN_ATTRIBUTE_ALIGN(4) = + { + 0xaf, 0xce, 0x0a, 0x87, 0xae, 0x24, 0x64, 0xad, + 0x1d, 0xfd, 0x11, 0x7a, 0xd5, 0xf3, 0xe8, 0x5b + }; + + const bit8 checkiv[AES_BLOCK_SIZE] NN_ATTRIBUTE_ALIGN(4) = + { + 0x17, 0x32, 0x7c, 0xf3, 0x00, 0xae, 0x58, 0x67, + 0x78, 0x5e, 0x56, 0xcd, 0x85, 0x70, 0xd7, 0x59 + }; + #endif