[hac|nstool] Renamed NcaUtils to ContentArchiveUtils

This commit is contained in:
jakcron 2018-10-25 20:44:48 +08:00
parent dfe877b959
commit 148fe3da76
7 changed files with 18 additions and 18 deletions

View file

@ -5,7 +5,7 @@ namespace nn
{
namespace hac
{
class NcaUtils
class ContentArchiveUtils
{
public:
static inline size_t sectorToOffset(size_t sector_index) { return sector_index * nn::hac::nca::kSectorSize; }

View file

@ -65,7 +65,7 @@
<ClInclude Include="include\nn\hac\nacp.h" />
<ClInclude Include="include\nn\hac\nca.h" />
<ClInclude Include="include\nn\hac\ContentArchiveHeader.h" />
<ClInclude Include="include\nn\hac\NcaUtils.h" />
<ClInclude Include="include\nn\hac\ContentArchiveUtils.h" />
<ClInclude Include="include\nn\hac\nro.h" />
<ClInclude Include="include\nn\hac\NroHeader.h" />
<ClInclude Include="include\nn\hac\nrr.h" />
@ -118,7 +118,7 @@
<ClCompile Include="source\MiscParamsEntry.cpp" />
<ClCompile Include="source\MiscParamsHandler.cpp" />
<ClCompile Include="source\ContentArchiveHeader.cpp" />
<ClCompile Include="source\NcaUtils.cpp" />
<ClCompile Include="source\ContentArchiveUtils.cpp" />
<ClCompile Include="source\NroHeader.cpp" />
<ClCompile Include="source\NsoHeader.cpp" />
<ClCompile Include="source\PatchMetaExtendedHeader.cpp" />

View file

@ -147,7 +147,7 @@
<ClInclude Include="include\nn\hac\ContentArchiveHeader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\nn\hac\NcaUtils.h">
<ClInclude Include="include\nn\hac\ContentArchiveUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\nn\hac\nro.h">
@ -296,7 +296,7 @@
<ClCompile Include="source\ContentArchiveHeader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\NcaUtils.cpp">
<ClCompile Include="source\ContentArchiveUtils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\Meta.cpp">

View file

@ -1,6 +1,6 @@
#include <nn/hac/NcaUtils.h>
#include <nn/hac/ContentArchiveUtils.h>
void nn::hac::NcaUtils::decryptContentArchiveHeader(const byte_t* src, byte_t* dst, const fnd::aes::sAesXts128Key& key)
void nn::hac::ContentArchiveUtils::decryptContentArchiveHeader(const byte_t* src, byte_t* dst, const fnd::aes::sAesXts128Key& key)
{
byte_t tweak[fnd::aes::kAesBlockSize];
@ -19,7 +19,7 @@ void nn::hac::NcaUtils::decryptContentArchiveHeader(const byte_t* src, byte_t* d
}
}
byte_t nn::hac::NcaUtils::getMasterKeyRevisionFromKeyGeneration(byte_t key_generation)
byte_t nn::hac::ContentArchiveUtils::getMasterKeyRevisionFromKeyGeneration(byte_t key_generation)
{
byte_t masterkey_rev;
@ -48,7 +48,7 @@ byte_t nn::hac::NcaUtils::getMasterKeyRevisionFromKeyGeneration(byte_t key_gener
return masterkey_rev;
}
void nn::hac::NcaUtils::getNcaPartitionAesCtr(const nn::hac::sNcaFsHeader* hdr, byte_t* ctr)
void nn::hac::ContentArchiveUtils::getNcaPartitionAesCtr(const nn::hac::sNcaFsHeader* hdr, byte_t* ctr)
{
for (size_t i = 0; i < 8; i++)
{

View file

@ -2,7 +2,7 @@
#include <fnd/ResourceFileReader.h>
#include <fnd/SimpleTextOutput.h>
#include <nn/hac/AesKeygen.h>
#include <nn/hac/NcaUtils.h>
#include <nn/hac/ContentArchiveUtils.h>
KeyConfiguration::KeyConfiguration()
{

View file

@ -5,7 +5,7 @@
#include <fnd/OffsetAdjustedIFile.h>
#include <fnd/AesCtrWrappedIFile.h>
#include <fnd/LayeredIntegrityWrappedIFile.h>
#include <nn/hac/NcaUtils.h>
#include <nn/hac/ContentArchiveUtils.h>
#include <nn/hac/AesKeygen.h>
#include <nn/hac/HierarchicalSha256Header.h>
#include <nn/hac/HierarchicalIntegrityHeader.h>
@ -112,7 +112,7 @@ void NcaProcess::importHeader()
// decrypt header block
fnd::aes::sAesXts128Key header_key;
mKeyCfg.getContentArchiveHeaderKey(header_key);
nn::hac::NcaUtils::decryptContentArchiveHeader((byte_t*)&mHdrBlock, (byte_t*)&mHdrBlock, header_key);
nn::hac::ContentArchiveUtils::decryptContentArchiveHeader((byte_t*)&mHdrBlock, (byte_t*)&mHdrBlock, header_key);
// generate header hash
fnd::sha::Sha256((byte_t*)&mHdrBlock.header, sizeof(nn::hac::sContentArchiveHeader), mHdrHash.bytes);
@ -128,7 +128,7 @@ void NcaProcess::generateNcaBodyEncryptionKeys()
memset(zero_aesctr_key.key, 0, sizeof(zero_aesctr_key));
// get key data from header
byte_t masterkey_rev = nn::hac::NcaUtils::getMasterKeyRevisionFromKeyGeneration(mHdr.getKeyGeneration());
byte_t masterkey_rev = nn::hac::ContentArchiveUtils::getMasterKeyRevisionFromKeyGeneration(mHdr.getKeyGeneration());
byte_t keak_index = mHdr.getKeyAreaEncryptionKeyIndex();
// process key area
@ -253,7 +253,7 @@ void NcaProcess::generatePartitionConfiguration()
}
// setup AES-CTR
nn::hac::NcaUtils::getNcaPartitionAesCtr(&fs_header, info.aes_ctr.iv);
nn::hac::ContentArchiveUtils::getNcaPartitionAesCtr(&fs_header, info.aes_ctr.iv);
// save partition config
info.reader = nullptr;

View file

@ -13,7 +13,7 @@
#include <fnd/SimpleTextOutput.h>
#include <fnd/Vec.h>
#include <fnd/ResourceFileReader.h>
#include <nn/hac/NcaUtils.h>
#include <nn/hac/ContentArchiveUtils.h>
#include <nn/hac/AesKeygen.h>
#include <nn/hac/define/xci.h>
#include <nn/hac/define/pfs.h>
@ -506,7 +506,7 @@ void UserSettings::populateKeyset(sCmdArgs& args)
fnd::aes::sAes128Key enc_title_key;
memcpy(enc_title_key.key, tik.getBody().getEncTitleKey(), 16);
fnd::aes::sAes128Key common_key, external_content_key;
if (mKeyCfg.getETicketCommonKey(nn::hac::NcaUtils::getMasterKeyRevisionFromKeyGeneration(tik.getBody().getCommonKeyId()), common_key) == true)
if (mKeyCfg.getETicketCommonKey(nn::hac::ContentArchiveUtils::getMasterKeyRevisionFromKeyGeneration(tik.getBody().getCommonKeyId()), common_key) == true)
{
nn::hac::AesKeygen::generateKey(external_content_key.key, tik.getBody().getEncTitleKey(), common_key.key);
mKeyCfg.addNcaExternalContentKey(tik.getBody().getRightsId(), external_content_key);
@ -701,14 +701,14 @@ bool UserSettings::determineValidNcaFromSample(const fnd::Vec<byte_t>& sample) c
{
// prepare decrypted NCA data
byte_t nca_raw[nn::hac::nca::kHeaderSize];
nn::hac::sContentArchiveHeader* nca_header = (nn::hac::sContentArchiveHeader*)(nca_raw + nn::hac::NcaUtils::sectorToOffset(1));
nn::hac::sContentArchiveHeader* nca_header = (nn::hac::sContentArchiveHeader*)(nca_raw + nn::hac::ContentArchiveUtils::sectorToOffset(1));
if (sample.size() < nn::hac::nca::kHeaderSize)
return false;
fnd::aes::sAesXts128Key header_key;
mKeyCfg.getContentArchiveHeaderKey(header_key);
nn::hac::NcaUtils::decryptContentArchiveHeader(sample.data(), nca_raw, header_key);
nn::hac::ContentArchiveUtils::decryptContentArchiveHeader(sample.data(), nca_raw, header_key);
if (nca_header->st_magic.get() != nn::hac::nca::kNca2StructMagic && nca_header->st_magic.get() != nn::hac::nca::kNca3StructMagic)
return false;