diff options
Diffstat (limited to 'src/core/crypto')
| -rw-r--r-- | src/core/crypto/key_manager.cpp | 2 | ||||
| -rw-r--r-- | src/core/crypto/partition_data_manager.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index 222fc95ba..4401f9f81 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp | |||
| @@ -396,7 +396,7 @@ static std::array<u8, target_size> MGF1(const std::array<u8, in_size>& seed) { | |||
| 396 | while (out.size() < target_size) { | 396 | while (out.size() < target_size) { |
| 397 | out.resize(out.size() + 0x20); | 397 | out.resize(out.size() + 0x20); |
| 398 | seed_exp[in_size + 3] = static_cast<u8>(i); | 398 | seed_exp[in_size + 3] = static_cast<u8>(i); |
| 399 | mbedtls_sha256(seed_exp.data(), seed_exp.size(), out.data() + out.size() - 0x20, 0); | 399 | mbedtls_sha256_ret(seed_exp.data(), seed_exp.size(), out.data() + out.size() - 0x20, 0); |
| 400 | ++i; | 400 | ++i; |
| 401 | } | 401 | } |
| 402 | 402 | ||
diff --git a/src/core/crypto/partition_data_manager.cpp b/src/core/crypto/partition_data_manager.cpp index 594cd82c5..a4b09fd12 100644 --- a/src/core/crypto/partition_data_manager.cpp +++ b/src/core/crypto/partition_data_manager.cpp | |||
| @@ -161,7 +161,7 @@ std::array<u8, key_size> FindKeyFromHex(const std::vector<u8>& binary, | |||
| 161 | 161 | ||
| 162 | std::array<u8, 0x20> temp{}; | 162 | std::array<u8, 0x20> temp{}; |
| 163 | for (size_t i = 0; i < binary.size() - key_size; ++i) { | 163 | for (size_t i = 0; i < binary.size() - key_size; ++i) { |
| 164 | mbedtls_sha256(binary.data() + i, key_size, temp.data(), 0); | 164 | mbedtls_sha256_ret(binary.data() + i, key_size, temp.data(), 0); |
| 165 | 165 | ||
| 166 | if (temp != hash) | 166 | if (temp != hash) |
| 167 | continue; | 167 | continue; |
| @@ -189,7 +189,7 @@ static std::array<Key128, 0x20> FindEncryptedMasterKeyFromHex(const std::vector< | |||
| 189 | AESCipher<Key128> cipher(key, Mode::ECB); | 189 | AESCipher<Key128> cipher(key, Mode::ECB); |
| 190 | for (size_t i = 0; i < binary.size() - 0x10; ++i) { | 190 | for (size_t i = 0; i < binary.size() - 0x10; ++i) { |
| 191 | cipher.Transcode(binary.data() + i, dec_temp.size(), dec_temp.data(), Op::Decrypt); | 191 | cipher.Transcode(binary.data() + i, dec_temp.size(), dec_temp.data(), Op::Decrypt); |
| 192 | mbedtls_sha256(dec_temp.data(), dec_temp.size(), temp.data(), 0); | 192 | mbedtls_sha256_ret(dec_temp.data(), dec_temp.size(), temp.data(), 0); |
| 193 | 193 | ||
| 194 | for (size_t k = 0; k < out.size(); ++k) { | 194 | for (size_t k = 0; k < out.size(); ++k) { |
| 195 | if (temp == master_key_hashes[k]) { | 195 | if (temp == master_key_hashes[k]) { |