mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
mbedTLS: run rename.pl script and fix errors
This commit is contained in:
@ -9,8 +9,8 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <polarssl/aes.h>
|
||||
#include <polarssl/sha1.h>
|
||||
#include <mbedtls/aes.h>
|
||||
#include <mbedtls/sha1.h>
|
||||
|
||||
#include "Common/CommonFuncs.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
@ -30,13 +30,13 @@ namespace DiscIO
|
||||
CVolumeWiiCrypted::CVolumeWiiCrypted(std::unique_ptr<IBlobReader> reader, u64 _VolumeOffset,
|
||||
const unsigned char* _pVolumeKey)
|
||||
: m_pReader(std::move(reader)),
|
||||
m_AES_ctx(new aes_context),
|
||||
m_AES_ctx(new mbedtls_aes_context),
|
||||
m_pBuffer(nullptr),
|
||||
m_VolumeOffset(_VolumeOffset),
|
||||
m_dataOffset(0x20000),
|
||||
m_LastDecryptedBlockOffset(-1)
|
||||
{
|
||||
aes_setkey_dec(m_AES_ctx.get(), _pVolumeKey, 128);
|
||||
mbedtls_aes_setkey_dec(m_AES_ctx.get(), _pVolumeKey, 128);
|
||||
m_pBuffer = new u8[s_block_total_size];
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ bool CVolumeWiiCrypted::ChangePartition(u64 offset)
|
||||
|
||||
u8 volume_key[16];
|
||||
DiscIO::VolumeKeyForPartition(*m_pReader, offset, volume_key);
|
||||
aes_setkey_dec(m_AES_ctx.get(), volume_key, 128);
|
||||
mbedtls_aes_setkey_dec(m_AES_ctx.get(), volume_key, 128);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer, bool de
|
||||
// 0x3D0 - 0x3DF in m_pBuffer will be overwritten,
|
||||
// but that won't affect anything, because we won't
|
||||
// use the content of m_pBuffer anymore after this
|
||||
aes_crypt_cbc(m_AES_ctx.get(), AES_DECRYPT, s_block_data_size, m_pBuffer + 0x3D0,
|
||||
mbedtls_aes_crypt_cbc(m_AES_ctx.get(), MBEDTLS_AES_DECRYPT, s_block_data_size, m_pBuffer + 0x3D0,
|
||||
m_pBuffer + s_block_header_size, m_LastDecryptedBlock);
|
||||
m_LastDecryptedBlockOffset = Block;
|
||||
|
||||
@ -287,7 +287,7 @@ bool CVolumeWiiCrypted::CheckIntegrity() const
|
||||
NOTICE_LOG(DISCIO, "Integrity Check: fail at cluster %d: could not read metadata", clusterID);
|
||||
return false;
|
||||
}
|
||||
aes_crypt_cbc(m_AES_ctx.get(), AES_DECRYPT, 0x400, IV, clusterMDCrypted, clusterMD);
|
||||
mbedtls_aes_crypt_cbc(m_AES_ctx.get(), MBEDTLS_AES_DECRYPT, 0x400, IV, clusterMDCrypted, clusterMD);
|
||||
|
||||
|
||||
// Some clusters have invalid data and metadata because they aren't
|
||||
@ -317,7 +317,7 @@ bool CVolumeWiiCrypted::CheckIntegrity() const
|
||||
{
|
||||
u8 hash[20];
|
||||
|
||||
sha1(clusterData + hashID * 0x400, 0x400, hash);
|
||||
mbedtls_sha1(clusterData + hashID * 0x400, 0x400, hash);
|
||||
|
||||
// Note that we do not use strncmp here
|
||||
if (memcmp(hash, clusterMD + hashID * 20, 20))
|
||||
|
Reference in New Issue
Block a user