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/Volume.cpp | |
| parent | 4b6ad977c6103aba8697896337fb17723d24413a (diff) | |
| parent | f8b9034a2857a5dbe92b958f02c440a1fa0d0669 (diff) | |
Merge pull request #10899 from shuffle2/sha1
add hw-accelerated SHA1
Diffstat (limited to 'Source/Core/DiscIO/Volume.cpp')
| -rw-r--r-- | Source/Core/DiscIO/Volume.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Source/Core/DiscIO/Volume.cpp b/Source/Core/DiscIO/Volume.cpp index bf7ef4e019..b6d84254f0 100644 --- a/Source/Core/DiscIO/Volume.cpp +++ b/Source/Core/DiscIO/Volume.cpp @@ -12,9 +12,8 @@ #include <utility> #include <vector> -#include <mbedtls/sha1.h> - #include "Common/CommonTypes.h" +#include "Common/Crypto/SHA1.h" #include "Common/StringUtil.h" #include "Core/IOS/ES/Formats.h" @@ -33,21 +32,21 @@ const IOS::ES::TMDReader Volume::INVALID_TMD{}; const std::vector<u8> Volume::INVALID_CERT_CHAIN{}; template <typename T> -static void AddToSyncHash(mbedtls_sha1_context* context, const T& data) +static void AddToSyncHash(Common::SHA1::Context* context, const T& data) { static_assert(std::is_trivially_copyable_v<T>); - mbedtls_sha1_update_ret(context, reinterpret_cast<const u8*>(&data), sizeof(data)); + context->Update(reinterpret_cast<const u8*>(&data), sizeof(data)); } -void Volume::ReadAndAddToSyncHash(mbedtls_sha1_context* context, u64 offset, u64 length, +void Volume::ReadAndAddToSyncHash(Common::SHA1::Context* context, u64 offset, u64 length, const Partition& partition) const { std::vector<u8> buffer(length); if (Read(offset, length, buffer.data(), partition)) - mbedtls_sha1_update_ret(context, buffer.data(), buffer.size()); + context->Update(buffer); } -void Volume::AddTMDToSyncHash(mbedtls_sha1_context* context, const Partition& partition) const +void Volume::AddTMDToSyncHash(Common::SHA1::Context* context, const Partition& partition) const { // We want to hash some important parts of the TMD, but nothing that changes when fakesigning. // (Fakesigned WADs are very popular, and we don't want people with properly signed WADs to |
