mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-28 19:58:53 +00:00
Implement hw accelerated AES
This commit is contained in:
parent
fb45ed3981
commit
46ad8b9d68
13 changed files with 488 additions and 93 deletions
|
@ -171,14 +171,13 @@ std::vector<u8> NANDImporter::GetEntryData(const NANDFSTEntry& entry)
|
|||
std::vector<u8> data{};
|
||||
data.reserve(remaining_bytes);
|
||||
|
||||
auto block = std::make_unique<u8[]>(NAND_FAT_BLOCK_SIZE);
|
||||
while (remaining_bytes > 0)
|
||||
{
|
||||
std::array<u8, 16> iv{};
|
||||
std::vector<u8> block = Common::AES::Decrypt(
|
||||
m_aes_key.data(), iv.data(), &m_nand[NAND_FAT_BLOCK_SIZE * sub], NAND_FAT_BLOCK_SIZE);
|
||||
m_aes_ctx->CryptIvZero(&m_nand[NAND_FAT_BLOCK_SIZE * sub], block.get(), NAND_FAT_BLOCK_SIZE);
|
||||
|
||||
size_t size = std::min(remaining_bytes, block.size());
|
||||
data.insert(data.end(), block.begin(), block.begin() + size);
|
||||
size_t size = std::min(remaining_bytes, NAND_FAT_BLOCK_SIZE);
|
||||
data.insert(data.end(), block.get(), block.get() + size);
|
||||
remaining_bytes -= size;
|
||||
|
||||
sub = m_superblock->fat[sub];
|
||||
|
@ -260,7 +259,7 @@ void NANDImporter::ExportKeys()
|
|||
{
|
||||
constexpr size_t NAND_AES_KEY_OFFSET = 0x158;
|
||||
|
||||
std::copy_n(&m_nand_keys[NAND_AES_KEY_OFFSET], m_aes_key.size(), m_aes_key.begin());
|
||||
m_aes_ctx = Common::AES::CreateContextDecrypt(&m_nand_keys[NAND_AES_KEY_OFFSET]);
|
||||
|
||||
const std::string file_path = m_nand_root + "/keys.bin";
|
||||
File::IOFile file(file_path, "wb");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue