diff options
| author | shuffle2 <godisgovernment@gmail.com> | 2015-10-03 18:00:58 -0700 |
|---|---|---|
| committer | shuffle2 <godisgovernment@gmail.com> | 2015-10-03 18:00:58 -0700 |
| commit | a6f04b0e15af9ce261cc5bb190eb60a2bbaee804 (patch) | |
| tree | 233f28f1b4df9566667013f47c5e9a09920626e9 /Source/Core/DiscIO | |
| parent | 8bb35c85887eaef35ddcb7dfaae394f7d1165fe1 (diff) | |
| parent | f6795466e767ee11e3f2c7d93c8f51abeabd29af (diff) | |
Merge pull request #3091 from Tilka/mbedtls
Update mbed TLS (PolarSSL)
Diffstat (limited to 'Source/Core/DiscIO')
| -rw-r--r-- | Source/Core/DiscIO/DiscIO.vcxproj | 4 | ||||
| -rw-r--r-- | Source/Core/DiscIO/NANDContentLoader.cpp | 8 | ||||
| -rw-r--r-- | Source/Core/DiscIO/VolumeCreator.cpp | 8 | ||||
| -rw-r--r-- | Source/Core/DiscIO/VolumeWiiCrypted.cpp | 16 | ||||
| -rw-r--r-- | Source/Core/DiscIO/VolumeWiiCrypted.h | 4 |
5 files changed, 20 insertions, 20 deletions
diff --git a/Source/Core/DiscIO/DiscIO.vcxproj b/Source/Core/DiscIO/DiscIO.vcxproj index 3250c37531..2927bc4781 100644 --- a/Source/Core/DiscIO/DiscIO.vcxproj +++ b/Source/Core/DiscIO/DiscIO.vcxproj @@ -78,7 +78,7 @@ <Text Include="CMakeLists.txt" /> </ItemGroup> <ItemGroup> - <ProjectReference Include="$(ExternalsDir)polarssl\visualc\PolarSSL.vcxproj"> + <ProjectReference Include="$(ExternalsDir)mbedtls\mbedTLS.vcxproj"> <Project>{bdb6578b-0691-4e80-a46c-df21639fd3b8}</Project> </ProjectReference> <ProjectReference Include="$(ExternalsDir)zlib\zlib.vcxproj"> @@ -91,4 +91,4 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> -</Project>
\ No newline at end of file +</Project> diff --git a/Source/Core/DiscIO/NANDContentLoader.cpp b/Source/Core/DiscIO/NANDContentLoader.cpp index 733f0735d8..0e26fa051e 100644 --- a/Source/Core/DiscIO/NANDContentLoader.cpp +++ b/Source/Core/DiscIO/NANDContentLoader.cpp @@ -10,7 +10,7 @@ #include <string> #include <utility> #include <vector> -#include <polarssl/aes.h> +#include <mbedtls/aes.h> #include "Common/CommonTypes.h" #include "Common/FileUtil.h" @@ -279,10 +279,10 @@ bool CNANDContentLoader::Initialize(const std::string& _rName) } void CNANDContentLoader::AESDecode(u8* _pKey, u8* _IV, u8* _pSrc, u32 _Size, u8* _pDest) { - aes_context AES_ctx; + mbedtls_aes_context AES_ctx; - aes_setkey_dec(&AES_ctx, _pKey, 128); - aes_crypt_cbc(&AES_ctx, AES_DECRYPT, _Size, _IV, _pSrc, _pDest); + mbedtls_aes_setkey_dec(&AES_ctx, _pKey, 128); + mbedtls_aes_crypt_cbc(&AES_ctx, MBEDTLS_AES_DECRYPT, _Size, _IV, _pSrc, _pDest); } void CNANDContentLoader::GetKeyFromTicket(u8* pTicket, u8* pTicketKey) diff --git a/Source/Core/DiscIO/VolumeCreator.cpp b/Source/Core/DiscIO/VolumeCreator.cpp index 4b3e90e2d0..66ee188d9c 100644 --- a/Source/Core/DiscIO/VolumeCreator.cpp +++ b/Source/Core/DiscIO/VolumeCreator.cpp @@ -9,7 +9,7 @@ #include <utility> #include <vector> -#include <polarssl/aes.h> +#include <mbedtls/aes.h> #include "Common/CommonTypes.h" #include "Common/StringUtil.h" @@ -139,10 +139,10 @@ void VolumeKeyForPartition(IBlobReader& _rReader, u64 offset, u8* VolumeKey) if (Reader.Read8(0x3) == 'K' && Reader.Read8(offset + 0x1f1) == 1) usingKoreanKey = true; - aes_context AES_ctx; - aes_setkey_dec(&AES_ctx, (usingKoreanKey ? s_master_key_korean : s_master_key), 128); + mbedtls_aes_context AES_ctx; + mbedtls_aes_setkey_dec(&AES_ctx, (usingKoreanKey ? s_master_key_korean : s_master_key), 128); - aes_crypt_cbc(&AES_ctx, AES_DECRYPT, 16, IV, SubKey, VolumeKey); + mbedtls_aes_crypt_cbc(&AES_ctx, MBEDTLS_AES_DECRYPT, 16, IV, SubKey, VolumeKey); } static IVolume* CreateVolumeFromCryptedWiiImage(std::unique_ptr<IBlobReader> reader, u32 _PartitionGroup, u32 _VolumeType, u32 _VolumeNum) diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.cpp b/Source/Core/DiscIO/VolumeWiiCrypted.cpp index 2812647c84..6483f971ce 100644 --- a/Source/Core/DiscIO/VolumeWiiCrypted.cpp +++ b/Source/Core/DiscIO/VolumeWiiCrypted.cpp @@ -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; @@ -292,7 +292,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 @@ -322,7 +322,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)) diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.h b/Source/Core/DiscIO/VolumeWiiCrypted.h index bfd5c6df8b..c88138faf6 100644 --- a/Source/Core/DiscIO/VolumeWiiCrypted.h +++ b/Source/Core/DiscIO/VolumeWiiCrypted.h @@ -8,7 +8,7 @@ #include <memory> #include <string> #include <vector> -#include <polarssl/aes.h> +#include <mbedtls/aes.h> #include "Common/CommonTypes.h" #include "DiscIO/Blob.h" @@ -54,7 +54,7 @@ private: static const unsigned int s_block_total_size = s_block_header_size + s_block_data_size; std::unique_ptr<IBlobReader> m_pReader; - std::unique_ptr<aes_context> m_AES_ctx; + std::unique_ptr<mbedtls_aes_context> m_AES_ctx; u8* m_pBuffer; |
