mirror of
https://github.com/cuberite/cuberite.git
synced 2025-01-05 10:27:10 +08:00
fixes for api changes in embedtls (#5540)
* fixes for api changes in embedtls * Use mbedtls 2.28.9 * Update mbedtls to point to merged master commit. * Fix indentation style. --------- Co-authored-by: Alexander Harkness <me@bearbin.net>
This commit is contained in:
parent
33b9c5dc6d
commit
e17f6906ef
@ -1 +1 @@
|
||||
Subproject commit f3a2ed06abd98c99db6dc46c9eb400951186d9d4
|
||||
Subproject commit 5962c69b26dbfa1e5582a248c0774a8df7ef18f8
|
@ -124,15 +124,18 @@ int cCryptoKey::ParsePrivate(const void * a_Data, size_t a_NumBytes, const AStri
|
||||
|
||||
if (a_Password.empty())
|
||||
{
|
||||
return mbedtls_pk_parse_key(&m_Pk, reinterpret_cast<const unsigned char *>(keyData.data()), a_NumBytes + 1, nullptr, 0, mbedtls_ctr_drbg_random, m_CtrDrbg.GetInternal());
|
||||
return mbedtls_pk_parse_key(
|
||||
&m_Pk,
|
||||
reinterpret_cast<const unsigned char *>(keyData.data()), a_NumBytes + 1,
|
||||
nullptr, 0
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return mbedtls_pk_parse_key(
|
||||
&m_Pk,
|
||||
reinterpret_cast<const unsigned char *>(keyData.data()), a_NumBytes + 1,
|
||||
reinterpret_cast<const unsigned char *>(a_Password.c_str()), a_Password.size(),
|
||||
mbedtls_ctr_drbg_random, m_CtrDrbg.GetInternal()
|
||||
reinterpret_cast<const unsigned char *>(a_Password.c_str()), a_Password.size()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
cRsaPrivateKey::cRsaPrivateKey(void)
|
||||
{
|
||||
mbedtls_rsa_init(&m_Rsa);
|
||||
mbedtls_rsa_init(&m_Rsa, MBEDTLS_RSA_PKCS_V15, 0);
|
||||
m_CtrDrbg.Initialize("RSA", 3);
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ cRsaPrivateKey::cRsaPrivateKey(void)
|
||||
|
||||
cRsaPrivateKey::cRsaPrivateKey(const cRsaPrivateKey & a_Other)
|
||||
{
|
||||
mbedtls_rsa_init(&m_Rsa);
|
||||
mbedtls_rsa_init(&m_Rsa, MBEDTLS_RSA_PKCS_V15, 0);
|
||||
mbedtls_rsa_copy(&m_Rsa, &a_Other.m_Rsa);
|
||||
m_CtrDrbg.Initialize("RSA", 3);
|
||||
}
|
||||
@ -122,7 +122,7 @@ int cRsaPrivateKey::Decrypt(const ContiguousByteBufferView a_EncryptedData, Byte
|
||||
}
|
||||
size_t DecryptedLength;
|
||||
int res = mbedtls_rsa_pkcs1_decrypt(
|
||||
&m_Rsa, mbedtls_ctr_drbg_random, m_CtrDrbg.GetInternal(), &DecryptedLength,
|
||||
&m_Rsa, mbedtls_ctr_drbg_random, m_CtrDrbg.GetInternal(), MBEDTLS_RSA_PRIVATE, &DecryptedLength,
|
||||
reinterpret_cast<const unsigned char *>(a_EncryptedData.data()), a_DecryptedData, a_DecryptedMaxLength
|
||||
);
|
||||
if (res != 0)
|
||||
|
Loading…
Reference in New Issue
Block a user