From 39ec6377f15d4b95c638dc25a6d0f3df80033178 Mon Sep 17 00:00:00 2001 From: N2614 Date: Fri, 25 Nov 2011 02:22:17 +0000 Subject: [PATCH] =?UTF-8?q?=E3=83=92=E3=83=BC=E3=83=97=E3=83=81=E3=82=A7?= =?UTF-8?q?=E3=83=83=E3=82=AF=E6=99=82=E3=81=ABSD=E3=81=AB=E6=9B=B8?= =?UTF-8?q?=E3=81=8D=E5=87=BA=E3=81=99=E3=83=87=E3=83=BC=E3=82=BF=E3=82=92?= =?UTF-8?q?=E6=9A=97=E5=8F=B7=E5=8C=96=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=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@526 385bec56-5757-e545-9c3a-d8741f4650f1 --- .../sources/ConsoleBackup/HeapChecker.cpp | 4 +++ .../sources/common/Aes_define.h | 25 +++++++++++++++++++ 2 files changed, 29 insertions(+) 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