2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

UDS: Move the UDS keyslot used to generate the CCMP key to the AES::KeySlotID enum.

This commit is contained in:
Subv 2017-06-14 14:21:35 -05:00
parent 87168bfe8b
commit 1f1739d366
2 changed files with 3 additions and 4 deletions

View file

@ -17,9 +17,6 @@ namespace NWM {
using MacAddress = std::array<u8, 6>; using MacAddress = std::array<u8, 6>;
// AES Keyslot used to generate the UDS data frame CCMP key.
constexpr size_t UDSDataCryptoAESKeySlot = 0x2D;
/* /*
* Generates a SNAP-enabled 802.2 LLC header for the specified protocol. * Generates a SNAP-enabled 802.2 LLC header for the specified protocol.
* @returns a buffer with the bytes of the generated header. * @returns a buffer with the bytes of the generated header.
@ -94,7 +91,7 @@ static std::array<u8, CryptoPP::AES::BLOCKSIZE> GenerateDataCCMPKey(
// keyslot 0x2D. // keyslot 0x2D.
using CryptoPP::AES; using CryptoPP::AES;
std::array<u8, CryptoPP::MD5::DIGESTSIZE> counter = GetDataCryptoCTR(network_info); std::array<u8, CryptoPP::MD5::DIGESTSIZE> counter = GetDataCryptoCTR(network_info);
std::array<u8, AES::BLOCKSIZE> key = HW::AES::GetNormalKey(UDSDataCryptoAESKeySlot); std::array<u8, AES::BLOCKSIZE> key = HW::AES::GetNormalKey(HW::AES::KeySlotID::UDSDataKey);
CryptoPP::CTR_Mode<AES>::Encryption aes; CryptoPP::CTR_Mode<AES>::Encryption aes;
aes.SetKeyWithIV(key.data(), AES::BLOCKSIZE, counter.data()); aes.SetKeyWithIV(key.data(), AES::BLOCKSIZE, counter.data());
aes.ProcessData(ccmp_key.data(), passphrase_hash.data(), passphrase_hash.size()); aes.ProcessData(ccmp_key.data(), passphrase_hash.data(), passphrase_hash.size());

View file

@ -12,6 +12,8 @@ namespace HW {
namespace AES { namespace AES {
enum KeySlotID : size_t { enum KeySlotID : size_t {
// AES Keyslot used to generate the UDS data frame CCMP key.
UDSDataKey = 0x2D,
APTWrap = 0x31, APTWrap = 0x31,
MaxKeySlotID = 0x40, MaxKeySlotID = 0x40,