summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/VolumeWad.cpp
diff options
context:
space:
mode:
authorTilka <tilkax@gmail.com>2022-08-02 18:28:47 +0100
committerGitHub <noreply@github.com>2022-08-02 18:28:47 +0100
commite62ceab349c7120450f2da6c5d5f0a311707046a (patch)
treef772d8e2f07ecfbcca84b2b67cf5f4cb8f8edaf1 /Source/Core/DiscIO/VolumeWad.cpp
parentcc1cb4499302b182e7b0da2103f3e32a4f2bc5e2 (diff)
parent46ad8b9d68b7eff720a6f33e6029ddd36ab8edaa (diff)
Merge pull request #10902 from shuffle2/aes
Implement hw accelerated AES
Diffstat (limited to 'Source/Core/DiscIO/VolumeWad.cpp')
-rw-r--r--Source/Core/DiscIO/VolumeWad.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp
index b485899c6e..edfd4c76ee 100644
--- a/Source/Core/DiscIO/VolumeWad.cpp
+++ b/Source/Core/DiscIO/VolumeWad.cpp
@@ -13,11 +13,10 @@
#include <utility>
#include <vector>
-#include <mbedtls/aes.h>
-
#include "Common/Align.h"
#include "Common/Assert.h"
#include "Common/CommonTypes.h"
+#include "Common/Crypto/AES.h"
#include "Common/Crypto/SHA1.h"
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
@@ -159,17 +158,14 @@ bool VolumeWAD::CheckContentIntegrity(const IOS::ES::Content& content,
if (encrypted_data.size() != Common::AlignUp(content.size, 0x40))
return false;
- mbedtls_aes_context context;
- const std::array<u8, 16> key = ticket.GetTitleKey();
- mbedtls_aes_setkey_dec(&context, key.data(), 128);
+ auto context = Common::AES::CreateContextDecrypt(ticket.GetTitleKey().data());
std::array<u8, 16> iv{};
iv[0] = static_cast<u8>(content.index >> 8);
iv[1] = static_cast<u8>(content.index & 0xFF);
std::vector<u8> decrypted_data(encrypted_data.size());
- mbedtls_aes_crypt_cbc(&context, MBEDTLS_AES_DECRYPT, decrypted_data.size(), iv.data(),
- encrypted_data.data(), decrypted_data.data());
+ context->Crypt(iv.data(), encrypted_data.data(), decrypted_data.data(), decrypted_data.size());
return Common::SHA1::CalculateDigest(decrypted_data.data(), content.size) == content.sha1;
}