引越し用コンテキストを出力するように

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@476 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
N2614 2011-11-02 09:08:25 +00:00
parent dda865745d
commit a0c0b6532b
2 changed files with 19 additions and 18 deletions

View File

@ -784,24 +784,6 @@ void ExportThreadFunc()
NN_LOG("Export Thread Finalize\n");
}
nn::Result WriteExportContext()
{
nn::Result result;
nn::fs::DeviceMoveContext context;
result = nn::fs::StartDeviceMoveAsSource(&context);
NN_UTIL_RETURN_IF_FAILED(result);
common::SdMountManager::Mount();
common::SdReaderWriter sdWriter;
result = sdWriter.WriteBufWithCmac(common::MOVE_CONTEXT_PATHNAME, &context, sizeof(context));
NN_UTIL_RETURN_IF_FAILED(result);
common::SdMountManager::Unmount();
return nn::ResultSuccess();
}
nn::Result WriteSaveData()
{
// 不要なデータを削除する

View File

@ -19,14 +19,17 @@
#include <nn/fs/fs_ApiSharedExtSaveData.h>
#include <nn/fs/fs_ApiDeviceMove.h>
#include <nn/fs/fs_ResultPrivate.h>
#include <nn/crypto/crypto_SwAesCtrContext.h>
#include <nn/ndm.h>
#include "Aes_define.h"
#include "SaveDataMover.h"
#include "CommonLogger.h"
#include "FileName.h"
#include "SdReaderWriter.h"
#include "FileTransfer.h"
#include "HeapManager.h"
namespace common
@ -87,6 +90,22 @@ void SaveDataMover::SetupExport()
m_Result = nn::fs::StartDeviceMoveAsSource(&moveContext);
COMMON_LOGGER_RETURN_VOID_IF_FAILED(m_Result);
// コンテキストのSDへの出力
common::HeapManager contextHeap(sizeof(moveContext));
void* enc;
enc = contextHeap.GetAddr();
if(enc != NULL)
{
// AES暗号化する
nn::crypto::SwAesCtrContext swAesCtrContest;
swAesCtrContest.Initialize(common::iv, common::key, sizeof(common::key));
swAesCtrContest.Encrypt(enc, &moveContext, sizeof(moveContext));
common::SdReaderWriter sdWriter;
sdWriter.WriteBufWithCmac(common::MOVE_CONTEXT_PATHNAME, enc, sizeof(moveContext));
}
// 3. 出力用ディレクトリの作成
// 3.1 システムセーブデータ用ディレクトリ
common::SdReaderWriter sdWriter;