diff options
| -rw-r--r-- | src/core/hle/service/nwm/uds_data.cpp | 5 | ||||
| -rw-r--r-- | src/core/hw/aes/key.h | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/core/hle/service/nwm/uds_data.cpp b/src/core/hle/service/nwm/uds_data.cpp index fabdf67a8..280c73e05 100644 --- a/src/core/hle/service/nwm/uds_data.cpp +++ b/src/core/hle/service/nwm/uds_data.cpp | |||
| @@ -17,9 +17,6 @@ namespace NWM { | |||
| 17 | 17 | ||
| 18 | using MacAddress = std::array<u8, 6>; | 18 | using MacAddress = std::array<u8, 6>; |
| 19 | 19 | ||
| 20 | // AES Keyslot used to generate the UDS data frame CCMP key. | ||
| 21 | constexpr size_t UDSDataCryptoAESKeySlot = 0x2D; | ||
| 22 | |||
| 23 | /* | 20 | /* |
| 24 | * Generates a SNAP-enabled 802.2 LLC header for the specified protocol. | 21 | * Generates a SNAP-enabled 802.2 LLC header for the specified protocol. |
| 25 | * @returns a buffer with the bytes of the generated header. | 22 | * @returns a buffer with the bytes of the generated header. |
| @@ -94,7 +91,7 @@ static std::array<u8, CryptoPP::AES::BLOCKSIZE> GenerateDataCCMPKey( | |||
| 94 | // keyslot 0x2D. | 91 | // keyslot 0x2D. |
| 95 | using CryptoPP::AES; | 92 | using CryptoPP::AES; |
| 96 | std::array<u8, CryptoPP::MD5::DIGESTSIZE> counter = GetDataCryptoCTR(network_info); | 93 | std::array<u8, CryptoPP::MD5::DIGESTSIZE> counter = GetDataCryptoCTR(network_info); |
| 97 | std::array<u8, AES::BLOCKSIZE> key = HW::AES::GetNormalKey(UDSDataCryptoAESKeySlot); | 94 | std::array<u8, AES::BLOCKSIZE> key = HW::AES::GetNormalKey(HW::AES::KeySlotID::UDSDataKey); |
| 98 | CryptoPP::CTR_Mode<AES>::Encryption aes; | 95 | CryptoPP::CTR_Mode<AES>::Encryption aes; |
| 99 | aes.SetKeyWithIV(key.data(), AES::BLOCKSIZE, counter.data()); | 96 | aes.SetKeyWithIV(key.data(), AES::BLOCKSIZE, counter.data()); |
| 100 | aes.ProcessData(ccmp_key.data(), passphrase_hash.data(), passphrase_hash.size()); | 97 | aes.ProcessData(ccmp_key.data(), passphrase_hash.data(), passphrase_hash.size()); |
diff --git a/src/core/hw/aes/key.h b/src/core/hw/aes/key.h index b01d04f13..c9f1342f4 100644 --- a/src/core/hw/aes/key.h +++ b/src/core/hw/aes/key.h | |||
| @@ -12,6 +12,8 @@ namespace HW { | |||
| 12 | namespace AES { | 12 | namespace AES { |
| 13 | 13 | ||
| 14 | enum KeySlotID : size_t { | 14 | enum KeySlotID : size_t { |
| 15 | // AES Keyslot used to generate the UDS data frame CCMP key. | ||
| 16 | UDSDataKey = 0x2D, | ||
| 15 | APTWrap = 0x31, | 17 | APTWrap = 0x31, |
| 16 | 18 | ||
| 17 | MaxKeySlotID = 0x40, | 19 | MaxKeySlotID = 0x40, |