mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
IOS: Use a std::array for the title key instead of vector
The title key is always 16 bytes, so it doesn't make sense to make it a std::vector.
This commit is contained in:
parent
aa020040f6
commit
6d821de2b9
@ -80,7 +80,7 @@ public:
|
||||
|
||||
bool valid = false;
|
||||
IOS::ES::TMDReader tmd;
|
||||
std::vector<u8> title_key;
|
||||
std::array<u8, 16> title_key;
|
||||
std::map<u32, ExportContent> contents;
|
||||
};
|
||||
|
||||
|
@ -380,7 +380,7 @@ u64 TicketReader::GetTitleId() const
|
||||
return Common::swap64(m_bytes.data() + offsetof(Ticket, title_id));
|
||||
}
|
||||
|
||||
std::vector<u8> TicketReader::GetTitleKey() const
|
||||
std::array<u8, 16> TicketReader::GetTitleKey() const
|
||||
{
|
||||
u8 iv[16] = {};
|
||||
std::copy_n(&m_bytes[offsetof(Ticket, title_id)], sizeof(Ticket::title_id), iv);
|
||||
@ -398,7 +398,7 @@ std::vector<u8> TicketReader::GetTitleKey() const
|
||||
const HLE::IOSC::ConsoleType console_type =
|
||||
is_rvt ? HLE::IOSC::ConsoleType::RVT : HLE::IOSC::ConsoleType::Retail;
|
||||
|
||||
std::vector<u8> key(16);
|
||||
std::array<u8, 16> key;
|
||||
HLE::IOSC iosc(console_type);
|
||||
iosc.Decrypt(common_key_handle, iv, &m_bytes[offsetof(Ticket, title_key)], 16, key.data(),
|
||||
HLE::PID_ES);
|
||||
|
@ -222,7 +222,7 @@ public:
|
||||
|
||||
u32 GetDeviceId() const;
|
||||
u64 GetTitleId() const;
|
||||
std::vector<u8> GetTitleKey() const;
|
||||
std::array<u8, 16> GetTitleKey() const;
|
||||
|
||||
// Deletes a ticket with the given ticket ID from the internal buffer.
|
||||
void DeleteTicket(u64 ticket_id);
|
||||
|
@ -186,7 +186,7 @@ void NANDContentLoader::InitializeContentEntries(const std::vector<u8>& data_app
|
||||
m_Content.resize(contents.size());
|
||||
|
||||
u32 data_app_offset = 0;
|
||||
const std::vector<u8> title_key = m_ticket.GetTitleKey();
|
||||
const std::array<u8, 16> title_key = m_ticket.GetTitleKey();
|
||||
IOS::ES::SharedContentMap shared_content{m_root};
|
||||
|
||||
for (size_t i = 0; i < contents.size(); ++i)
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "DiscIO/VolumeWii.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <map>
|
||||
@ -97,9 +98,7 @@ VolumeWii::VolumeWii(std::unique_ptr<BlobReader> reader)
|
||||
IOS::ES::TMDReader tmd{std::move(tmd_buffer)};
|
||||
|
||||
// Get the decryption key
|
||||
const std::vector<u8> key = ticket.GetTitleKey();
|
||||
if (key.size() != 16)
|
||||
continue;
|
||||
const std::array<u8, 16> key = ticket.GetTitleKey();
|
||||
std::unique_ptr<mbedtls_aes_context> aes_context = std::make_unique<mbedtls_aes_context>();
|
||||
mbedtls_aes_setkey_dec(aes_context.get(), key.data(), 128);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user