mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-25 06:36:37 +01:00
fix for OpenSSL 1.1.0
This commit is contained in:
@@ -132,13 +132,16 @@ ECDSASignature::ECDSASignature(const ByteVec& rawR, const ByteVec& rawS):
|
|||||||
ECDSA_SIG_set0(_pSig,
|
ECDSA_SIG_set0(_pSig,
|
||||||
BN_bin2bn(&rawR[0], rawR.size(), 0),
|
BN_bin2bn(&rawR[0], rawR.size(), 0),
|
||||||
BN_bin2bn(&rawS[0], rawS.size(), 0));
|
BN_bin2bn(&rawS[0], rawS.size(), 0));
|
||||||
if (ECDSA_SIG_get0_r(_pSig) == 0 || ECDSA_SIG_get0_s(_pSig) == 0)
|
const BIGNUM* pR = 0;
|
||||||
throw CryptoException("failed to decode R and S values");
|
const BIGNUM* pS = 0;
|
||||||
|
ECDSA_SIG_get0(_pSig, &pR, &pS);
|
||||||
|
if (pR == 0 || pS == 0)
|
||||||
|
throw Poco::Crypto::CryptoException("failed to decode R and S values");
|
||||||
#else
|
#else
|
||||||
if (!BN_bin2bn(&rawR[0], rawR.size(), _pSig->r))
|
if (!BN_bin2bn(&rawR[0], rawR.size(), _pSig->r))
|
||||||
throw OpenSSLException();
|
throw Poco::Crypto::OpenSSLException();
|
||||||
if (!BN_bin2bn(&rawS[0], rawS.size(), _pSig->s))
|
if (!BN_bin2bn(&rawS[0], rawS.size(), _pSig->s))
|
||||||
throw OpenSSLException();
|
throw Poco::Crypto::OpenSSLException();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
@@ -172,8 +175,11 @@ ECDSASignature::ByteVec ECDSASignature::toDER() const
|
|||||||
ECDSASignature::ByteVec ECDSASignature::rawR() const
|
ECDSASignature::ByteVec ECDSASignature::rawR() const
|
||||||
{
|
{
|
||||||
ByteVec buffer;
|
ByteVec buffer;
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
|
||||||
const BIGNUM* pR = ECDSA_SIG_get0_r(_pSig);
|
const BIGNUM* pR = ECDSA_SIG_get0_r(_pSig);
|
||||||
|
#elif OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||||
|
const BIGNUM* pR = 0;
|
||||||
|
ECDSA_SIG_get0(_pSig, &pR, 0);
|
||||||
#else
|
#else
|
||||||
const BIGNUM* pR = _pSig->r;
|
const BIGNUM* pR = _pSig->r;
|
||||||
#endif
|
#endif
|
||||||
@@ -189,8 +195,11 @@ ECDSASignature::ByteVec ECDSASignature::rawR() const
|
|||||||
ECDSASignature::ByteVec ECDSASignature::rawS() const
|
ECDSASignature::ByteVec ECDSASignature::rawS() const
|
||||||
{
|
{
|
||||||
ByteVec buffer;
|
ByteVec buffer;
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
|
||||||
const BIGNUM* pS = ECDSA_SIG_get0_s(_pSig);
|
const BIGNUM* pS = ECDSA_SIG_get0_s(_pSig);
|
||||||
|
#elif OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||||
|
const BIGNUM* pS = 0;
|
||||||
|
ECDSA_SIG_get0(_pSig, 0, &pS);
|
||||||
#else
|
#else
|
||||||
const BIGNUM* pS = _pSig->s;
|
const BIGNUM* pS = _pSig->s;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user