diff options
| author | Matthew Parlane <parlane@gmail.com> | 2017-02-27 16:15:05 +1300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-27 16:15:05 +1300 |
| commit | 48aeb5bf4be58eafd9a9fd36de983aaccfc25365 (patch) | |
| tree | f7fb394acdc67efce888648ecf6d66d71e277964 /Source/Core/Common/Crypto | |
| parent | d1b343ab5aebf9398c5b3d78382678df50728d0c (diff) | |
| parent | 44a3db21e4b7fe20ee2ed6253990f5981b3f12f9 (diff) | |
Merge pull request #4896 from leoetlino/esformats
Use ESFormats for tickets, TMDs and views
Diffstat (limited to 'Source/Core/Common/Crypto')
| -rw-r--r-- | Source/Core/Common/Crypto/AES.cpp | 24 | ||||
| -rw-r--r-- | Source/Core/Common/Crypto/AES.h | 18 |
2 files changed, 42 insertions, 0 deletions
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 <mbedtls/aes.h> + +#include "Common/Crypto/AES.h" + +namespace Common +{ +namespace AES +{ +std::vector<u8> Decrypt(const u8* key, u8* iv, const u8* src, size_t size) +{ + mbedtls_aes_context aes_ctx; + std::vector<u8> 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 diff --git a/Source/Core/Common/Crypto/AES.h b/Source/Core/Common/Crypto/AES.h new file mode 100644 index 0000000000..54d88727ac --- /dev/null +++ b/Source/Core/Common/Crypto/AES.h @@ -0,0 +1,18 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include <cstddef> +#include <vector> + +#include "Common/CommonTypes.h" + +namespace Common +{ +namespace AES +{ +std::vector<u8> Decrypt(const u8* key, u8* iv, const u8* src, size_t size); +} // namespace AES +} // namespace Common |
