[nx] Add getNcaPartititionAesCtr()

This commit is contained in:
jakcron 2018-05-01 13:21:28 +08:00
parent b69dc62062
commit 3291d06082
2 changed files with 9 additions and 0 deletions

View file

@ -9,5 +9,6 @@ namespace nx
static inline size_t sectorToOffset(size_t sector_index) { return sector_index * nx::nca::kSectorSize; }
static void decryptNcaHeader(const byte_t* src, byte_t* dst, const crypto::aes::sAesXts128Key& key);
static byte_t getMasterKeyRevisionFromKeyGeneration(byte_t key_generation);
static void getNcaPartitionAesCtr(const nx::sNcaFsHeader* hdr, byte_t* ctr);
};
}

View file

@ -46,4 +46,12 @@ byte_t nx::NcaUtils::getMasterKeyRevisionFromKeyGeneration(byte_t key_generation
}
return masterkey_rev;
}
void nx::NcaUtils::getNcaPartitionAesCtr(const nx::sNcaFsHeader* hdr, byte_t* ctr)
{
for (size_t i = 0; i < 16; i++)
{
ctr[15-i] = hdr->base_ctr.iv[i];
}
}