diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2022-07-30 14:11:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-30 14:11:37 +0200 |
| commit | a9d9f5c0daca5527b6cb4b1fe9c2faaab274e895 (patch) | |
| tree | d753b6ff68bcc246e1344fa30db92a8cd8eafa67 /Source/Core/DiscIO/VolumeWad.cpp | |
| parent | 4b6ad977c6103aba8697896337fb17723d24413a (diff) | |
| parent | f8b9034a2857a5dbe92b958f02c440a1fa0d0669 (diff) | |
Merge pull request #10899 from shuffle2/sha1
add hw-accelerated SHA1
Diffstat (limited to 'Source/Core/DiscIO/VolumeWad.cpp')
| -rw-r--r-- | Source/Core/DiscIO/VolumeWad.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp index df12eab293..b485899c6e 100644 --- a/Source/Core/DiscIO/VolumeWad.cpp +++ b/Source/Core/DiscIO/VolumeWad.cpp @@ -14,11 +14,11 @@ #include <vector> #include <mbedtls/aes.h> -#include <mbedtls/sha1.h> #include "Common/Align.h" #include "Common/Assert.h" #include "Common/CommonTypes.h" +#include "Common/Crypto/SHA1.h" #include "Common/Logging/Log.h" #include "Common/MsgHandler.h" #include "Common/StringUtil.h" @@ -171,9 +171,7 @@ bool VolumeWAD::CheckContentIntegrity(const IOS::ES::Content& content, mbedtls_aes_crypt_cbc(&context, MBEDTLS_AES_DECRYPT, decrypted_data.size(), iv.data(), encrypted_data.data(), decrypted_data.data()); - std::array<u8, 20> sha1; - mbedtls_sha1_ret(decrypted_data.data(), content.size, sha1.data()); - return sha1 == content.sha1; + return Common::SHA1::CalculateDigest(decrypted_data.data(), content.size) == content.sha1; } bool VolumeWAD::CheckContentIntegrity(const IOS::ES::Content& content, u64 content_offset, @@ -349,17 +347,13 @@ std::array<u8, 20> VolumeWAD::GetSyncHash() const // We can skip hashing the contents since the TMD contains hashes of the contents. // We specifically don't hash the ticket, since its console ID can differ without any problems. - mbedtls_sha1_context context; - mbedtls_sha1_init(&context); - mbedtls_sha1_starts_ret(&context); + auto context = Common::SHA1::CreateContext(); - AddTMDToSyncHash(&context, PARTITION_NONE); + AddTMDToSyncHash(context.get(), PARTITION_NONE); - ReadAndAddToSyncHash(&context, m_opening_bnr_offset, m_opening_bnr_size, PARTITION_NONE); + ReadAndAddToSyncHash(context.get(), m_opening_bnr_offset, m_opening_bnr_size, PARTITION_NONE); - std::array<u8, 20> hash; - mbedtls_sha1_finish_ret(&context, hash.data()); - return hash; + return context->Finish(); } } // namespace DiscIO |
