Fix default init of BIGNUM to nullptr

This commit is contained in:
Konrad Kuśnierz 2019-03-05 09:29:13 +01:00 committed by GitHub
parent 9186ac5321
commit fd3db800fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -335,7 +335,7 @@ void Crypt::rsaSetPublicKey(const std::string& n, const std::string& e)
m_rsa->_method_mod_n = nullptr; m_rsa->_method_mod_n = nullptr;
} }
#else #else
BIGNUM *bn, *be; BIGNUM *bn = nullptr, *be = nullptr;
BN_dec2bn(&bn, n.c_str()); BN_dec2bn(&bn, n.c_str());
BN_dec2bn(&be, e.c_str()); BN_dec2bn(&be, e.c_str());
RSA_set0_key(m_rsa, bn, be, nullptr); RSA_set0_key(m_rsa, bn, be, nullptr);
@ -360,7 +360,7 @@ void Crypt::rsaSetPrivateKey(const std::string& p, const std::string& q, const s
m_rsa->_method_mod_q = nullptr; m_rsa->_method_mod_q = nullptr;
} }
#else #else
BIGNUM *bp, *bq, *bd; BIGNUM *bp = nullptr, *bq = nullptr, *bd = nullptr;
BN_dec2bn(&bp, p.c_str()); BN_dec2bn(&bp, p.c_str());
BN_dec2bn(&bq, q.c_str()); BN_dec2bn(&bq, q.c_str());
BN_dec2bn(&bd, d.c_str()); BN_dec2bn(&bd, d.c_str());
@ -382,7 +382,7 @@ bool Crypt::rsaCheckKey()
BN_mod(m_rsa->dmq1, m_rsa->d, r2, ctx); BN_mod(m_rsa->dmq1, m_rsa->d, r2, ctx);
BN_mod_inverse(m_rsa->iqmp, m_rsa->q, m_rsa->p, ctx); BN_mod_inverse(m_rsa->iqmp, m_rsa->q, m_rsa->p, ctx);
#else #else
const BIGNUM *dmp1_c, *d, *dmq1_c, *iqmp_c, *q, *p; const BIGNUM *dmp1_c = nullptr, *d = nullptr, *dmq1_c = nullptr, *iqmp_c = nullptr, *q = nullptr, *p = nullptr;
RSA_get0_key(m_rsa, nullptr, nullptr, &d); RSA_get0_key(m_rsa, nullptr, nullptr, &d);
RSA_get0_factors(m_rsa, &p, &q); RSA_get0_factors(m_rsa, &p, &q);