diff options
Diffstat (limited to 'src/core/crypto/key_manager.cpp')
| -rw-r--r-- | src/core/crypto/key_manager.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index 85776cdcb..0f1a86d1e 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp | |||
| @@ -21,6 +21,8 @@ | |||
| 21 | 21 | ||
| 22 | namespace Core::Crypto { | 22 | namespace Core::Crypto { |
| 23 | 23 | ||
| 24 | constexpr u64 CURRENT_CRYPTO_REVISION = 0x5; | ||
| 25 | |||
| 24 | Key128 GenerateKeyEncryptionKey(Key128 source, Key128 master, Key128 kek_seed, Key128 key_seed) { | 26 | Key128 GenerateKeyEncryptionKey(Key128 source, Key128 master, Key128 kek_seed, Key128 key_seed) { |
| 25 | Key128 out{}; | 27 | Key128 out{}; |
| 26 | 28 | ||
| @@ -37,6 +39,14 @@ Key128 GenerateKeyEncryptionKey(Key128 source, Key128 master, Key128 kek_seed, K | |||
| 37 | return out; | 39 | return out; |
| 38 | } | 40 | } |
| 39 | 41 | ||
| 42 | Key128 DeriveKeyblobKey(Key128 sbk, Key128 tsec, Key128 source) { | ||
| 43 | AESCipher<Key128> sbk_cipher(sbk, Mode::ECB); | ||
| 44 | AESCipher<Key128> tsec_cipher(tsec, Mode::ECB); | ||
| 45 | tsec_cipher.Transcode(source.data(), source.size(), source.data(), Op::Decrypt); | ||
| 46 | sbk_cipher.Transcode(source.data(), source.size(), source.data(), Op::Decrypt); | ||
| 47 | return source; | ||
| 48 | } | ||
| 49 | |||
| 40 | boost::optional<Key128> DeriveSDSeed() { | 50 | boost::optional<Key128> DeriveSDSeed() { |
| 41 | const FileUtil::IOFile save_43(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) + | 51 | const FileUtil::IOFile save_43(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) + |
| 42 | "/system/save/8000000000000043", | 52 | "/system/save/8000000000000043", |