summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-04-29 11:17:47 +0200
committermadmaxoft <github@xoft.cz>2014-04-29 11:17:47 +0200
commit79ec770d77beb0ce9176ee9858b830c32380b742 (patch)
tree585f22490df1890f5a3a61eb6306ed68afebcc92 /src
parentMoved cRsaPrivateKey to PolarSSL++, rewritten using existing objects. (diff)
downloadcuberite-79ec770d77beb0ce9176ee9858b830c32380b742.tar
cuberite-79ec770d77beb0ce9176ee9858b830c32380b742.tar.gz
cuberite-79ec770d77beb0ce9176ee9858b830c32380b742.tar.bz2
cuberite-79ec770d77beb0ce9176ee9858b830c32380b742.tar.lz
cuberite-79ec770d77beb0ce9176ee9858b830c32380b742.tar.xz
cuberite-79ec770d77beb0ce9176ee9858b830c32380b742.tar.zst
cuberite-79ec770d77beb0ce9176ee9858b830c32380b742.zip
Diffstat (limited to 'src')
-rw-r--r--src/PolarSSL++/RsaPrivateKey.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/PolarSSL++/RsaPrivateKey.cpp b/src/PolarSSL++/RsaPrivateKey.cpp
index d042139cf..2d5a2a4b1 100644
--- a/src/PolarSSL++/RsaPrivateKey.cpp
+++ b/src/PolarSSL++/RsaPrivateKey.cpp
@@ -14,6 +14,7 @@
cRsaPrivateKey::cRsaPrivateKey(void)
{
rsa_init(&m_Rsa, RSA_PKCS_V15, 0);
+ m_CtrDrbg.Initialize("RSA", 3);
}
@@ -24,6 +25,7 @@ cRsaPrivateKey::cRsaPrivateKey(const cRsaPrivateKey & a_Other)
{
rsa_init(&m_Rsa, RSA_PKCS_V15, 0);
rsa_copy(&m_Rsa, &a_Other.m_Rsa);
+ m_CtrDrbg.Initialize("RSA", 3);
}
@@ -41,9 +43,10 @@ cRsaPrivateKey::~cRsaPrivateKey()
bool cRsaPrivateKey::Generate(unsigned a_KeySizeBits)
{
- if (rsa_gen_key(&m_Rsa, ctr_drbg_random, m_CtrDrbg.GetInternal(), a_KeySizeBits, 65537) != 0)
+ int res = rsa_gen_key(&m_Rsa, ctr_drbg_random, m_CtrDrbg.GetInternal(), a_KeySizeBits, 65537);
+ if (res != 0)
{
- // Key generation failed
+ LOG("RSA key generation failed: -0x%x", -res);
return false;
}