summaryrefslogtreecommitdiffstats
path: root/src/mbedTLS++
diff options
context:
space:
mode:
authorx12xx12x <44411062+12xx12@users.noreply.github.com>2024-11-08 01:19:47 +0100
committerGitHub <noreply@github.com>2024-11-08 01:19:47 +0100
commite17f6906efe33245c320913a767f28ff764d1399 (patch)
treeac8f5377ad06b53a65fd3825b526e4fba22637c6 /src/mbedTLS++
parentFix cChunkMap issues below with coords below y=0 (#5397) (diff)
downloadcuberite-master.tar
cuberite-master.tar.gz
cuberite-master.tar.bz2
cuberite-master.tar.lz
cuberite-master.tar.xz
cuberite-master.tar.zst
cuberite-master.zip
Diffstat (limited to '')
-rw-r--r--src/mbedTLS++/CryptoKey.cpp9
-rw-r--r--src/mbedTLS++/RsaPrivateKey.cpp6
2 files changed, 9 insertions, 6 deletions
diff --git a/src/mbedTLS++/CryptoKey.cpp b/src/mbedTLS++/CryptoKey.cpp
index 742d9c73c..ea01bfc80 100644
--- a/src/mbedTLS++/CryptoKey.cpp
+++ b/src/mbedTLS++/CryptoKey.cpp
@@ -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()
);
}
}
diff --git a/src/mbedTLS++/RsaPrivateKey.cpp b/src/mbedTLS++/RsaPrivateKey.cpp
index d0c5b7c8b..81cd2db44 100644
--- a/src/mbedTLS++/RsaPrivateKey.cpp
+++ b/src/mbedTLS++/RsaPrivateKey.cpp
@@ -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)