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:
Léo Lam
2017-06-26 23:38:58 +02:00
parent aa020040f6
commit 6d821de2b9
5 changed files with 7 additions and 8 deletions

View File

@ -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;
};

View File

@ -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);

View File

@ -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);