From 5104caf6a647dac47509a8e0540a2eb04c1b1ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sun, 12 Feb 2017 11:50:35 +0100 Subject: Move AES code to Common/Crypto --- Source/Core/Common/Crypto/AES.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Source/Core/Common/Crypto/AES.cpp (limited to 'Source/Core/Common/Crypto/AES.cpp') diff --git a/Source/Core/Common/Crypto/AES.cpp b/Source/Core/Common/Crypto/AES.cpp new file mode 100644 index 0000000000..e12ba2481c --- /dev/null +++ b/Source/Core/Common/Crypto/AES.cpp @@ -0,0 +1,24 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include + +#include "Common/Crypto/AES.h" + +namespace Common +{ +namespace AES +{ +std::vector Decrypt(const u8* key, u8* iv, const u8* src, size_t size) +{ + mbedtls_aes_context aes_ctx; + std::vector buffer(size); + + mbedtls_aes_setkey_dec(&aes_ctx, key, 128); + mbedtls_aes_crypt_cbc(&aes_ctx, MBEDTLS_AES_DECRYPT, size, iv, src, buffer.data()); + + return buffer; +} +} // namespace AES +} // namespace Common -- cgit v1.2.3