ヒープチェック時にSDに書き出すデータを暗号化するように

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
This commit is contained in:
N2614 2011-11-25 02:22:17 +00:00
parent a032646cb4
commit 39ec6377f1
2 changed files with 29 additions and 0 deletions

View File

@ -15,6 +15,7 @@
#include <nn/crypto/crypto_SwAesCtrContext.h>
#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;

View File

@ -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