mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
DiscIO: Move some raw pointers over to unique_ptr
This commit is contained in:
@ -21,25 +21,21 @@ namespace DiscIO
|
||||
CVolumeWiiCrypted::CVolumeWiiCrypted(IBlobReader* _pReader, u64 _VolumeOffset,
|
||||
const unsigned char* _pVolumeKey)
|
||||
: m_pReader(_pReader),
|
||||
m_AES_ctx(new aes_context),
|
||||
m_pBuffer(nullptr),
|
||||
m_VolumeOffset(_VolumeOffset),
|
||||
dataOffset(0x20000),
|
||||
m_LastDecryptedBlockOffset(-1)
|
||||
{
|
||||
m_AES_ctx = new aes_context;
|
||||
aes_setkey_dec(m_AES_ctx, _pVolumeKey, 128);
|
||||
aes_setkey_dec(m_AES_ctx.get(), _pVolumeKey, 128);
|
||||
m_pBuffer = new u8[0x8000];
|
||||
}
|
||||
|
||||
|
||||
CVolumeWiiCrypted::~CVolumeWiiCrypted()
|
||||
{
|
||||
delete m_pReader; // is this really our responsibility?
|
||||
m_pReader = nullptr;
|
||||
delete[] m_pBuffer;
|
||||
m_pBuffer = nullptr;
|
||||
delete m_AES_ctx;
|
||||
m_AES_ctx = nullptr;
|
||||
}
|
||||
|
||||
bool CVolumeWiiCrypted::RAWRead( u64 _Offset, u64 _Length, u8* _pBuffer ) const
|
||||
@ -78,7 +74,7 @@ bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer) const
|
||||
if (m_LastDecryptedBlockOffset != Block)
|
||||
{
|
||||
memcpy(IV, m_pBuffer + 0x3d0, 16);
|
||||
aes_crypt_cbc(m_AES_ctx, AES_DECRYPT, 0x7C00, IV, m_pBuffer + 0x400, m_LastDecryptedBlock);
|
||||
aes_crypt_cbc(m_AES_ctx.get(), AES_DECRYPT, 0x7C00, IV, m_pBuffer + 0x400, m_LastDecryptedBlock);
|
||||
|
||||
m_LastDecryptedBlockOffset = Block;
|
||||
}
|
||||
@ -261,7 +257,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, AES_DECRYPT, 0x400, IV, clusterMDCrypted, clusterMD);
|
||||
aes_crypt_cbc(m_AES_ctx.get(), AES_DECRYPT, 0x400, IV, clusterMDCrypted, clusterMD);
|
||||
|
||||
|
||||
// Some clusters have invalid data and metadata because they aren't
|
||||
|
Reference in New Issue
Block a user