mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 01:29:42 -06:00
General: Migrate from deprecated mbedTLS functions
As indicated by mbedTLS' documentation, all of the relevant functions have been superseded by _ret-suffixed variants in mbedTLS version 2.7.0.
This commit is contained in:
@ -121,7 +121,7 @@ std::array<u8, 20> SignedBlobReader::GetSha1() const
|
||||
{
|
||||
std::array<u8, 20> sha1;
|
||||
const size_t skip = GetIssuerOffset(GetSignatureType());
|
||||
mbedtls_sha1(m_bytes.data() + skip, m_bytes.size() - skip, sha1.data());
|
||||
mbedtls_sha1_ret(m_bytes.data() + skip, m_bytes.size() - skip, sha1.data());
|
||||
return sha1;
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ ReturnCode ES::VerifySign(const std::vector<u8>& hash, const std::vector<u8>& ec
|
||||
}
|
||||
|
||||
std::array<u8, 20> sha1;
|
||||
mbedtls_sha1(hash.data(), hash.size(), sha1.data());
|
||||
mbedtls_sha1_ret(hash.data(), hash.size(), sha1.data());
|
||||
ret = iosc.VerifyPublicKeySign(sha1, ap_cert, ecc_signature, PID_ES);
|
||||
if (ret != IPC_SUCCESS)
|
||||
{
|
||||
|
@ -344,7 +344,7 @@ IPCCommandResult ES::ImportContentData(Context& context, const IOCtlVRequest& re
|
||||
static bool CheckIfContentHashMatches(const std::vector<u8>& content, const IOS::ES::Content& info)
|
||||
{
|
||||
std::array<u8, 20> sha1;
|
||||
mbedtls_sha1(content.data(), info.size, sha1.data());
|
||||
mbedtls_sha1_ret(content.data(), info.size, sha1.data());
|
||||
return sha1 == info.sha1;
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ ReturnCode IOSC::ComputeSharedKey(Handle dest_handle, Handle private_handle, Han
|
||||
Common::ec::ComputeSharedSecret(private_entry->data.data(), public_entry->data.data());
|
||||
|
||||
std::array<u8, 20> sha1;
|
||||
mbedtls_sha1(shared_secret.data(), shared_secret.size() / 2, sha1.data());
|
||||
mbedtls_sha1_ret(shared_secret.data(), shared_secret.size() / 2, sha1.data());
|
||||
|
||||
dest_entry->data.resize(AES128_KEY_SIZE);
|
||||
std::copy_n(sha1.cbegin(), AES128_KEY_SIZE, dest_entry->data.begin());
|
||||
@ -453,12 +453,12 @@ void IOSC::Sign(u8* sig_out, u8* ap_cert_out, u64 title_id, const u8* data, u32
|
||||
CertECC cert = MakeBlankEccCert(signer, name, ap_priv.data(), 0);
|
||||
// Sign the AP cert.
|
||||
const size_t skip = offsetof(CertECC, signature.issuer);
|
||||
mbedtls_sha1(reinterpret_cast<const u8*>(&cert) + skip, sizeof(cert) - skip, hash.data());
|
||||
mbedtls_sha1_ret(reinterpret_cast<const u8*>(&cert) + skip, sizeof(cert) - skip, hash.data());
|
||||
cert.signature.sig = Common::ec::Sign(m_key_entries[HANDLE_CONSOLE_KEY].data.data(), hash.data());
|
||||
std::memcpy(ap_cert_out, &cert, sizeof(cert));
|
||||
|
||||
// Sign the data.
|
||||
mbedtls_sha1(data, data_size, hash.data());
|
||||
mbedtls_sha1_ret(data, data_size, hash.data());
|
||||
const auto signature = Common::ec::Sign(ap_priv.data(), hash.data());
|
||||
std::copy(signature.cbegin(), signature.cend(), sig_out);
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ static std::vector<u8> ReadCertFile(const std::string& path, const std::array<u8
|
||||
}
|
||||
|
||||
std::array<u8, 32> hash;
|
||||
mbedtls_sha256(bytes.data(), bytes.size(), hash.data(), 0);
|
||||
mbedtls_sha256_ret(bytes.data(), bytes.size(), hash.data(), 0);
|
||||
if (hash != correct_hash)
|
||||
{
|
||||
ERROR_LOG(IOS_SSL, "Wrong hash for %s", path.c_str());
|
||||
|
Reference in New Issue
Block a user