summaryrefslogtreecommitdiffstats
path: root/src/kvilib/net
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2017-01-10 01:47:10 +0100
committerSlávek Banko <slavek.banko@axis.cz>2017-01-10 01:47:10 +0100
commit08fa491feaf3a3923b1c9b6b2f52efd42232850e (patch)
treede9a3b56eb1e4844355a3649d5c13f8abf40281e /src/kvilib/net
parentc170347975ecc096314e9cf744d47ece6ffb1325 (diff)
downloadkvirc-08fa491feaf3a3923b1c9b6b2f52efd42232850e.tar.gz
kvirc-08fa491feaf3a3923b1c9b6b2f52efd42232850e.zip
Added support for OpenSSL 1.1
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'src/kvilib/net')
-rw-r--r--src/kvilib/net/kvi_ssl.cpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/kvilib/net/kvi_ssl.cpp b/src/kvilib/net/kvi_ssl.cpp
index f90d8b00..3404b80b 100644
--- a/src/kvilib/net/kvi_ssl.cpp
+++ b/src/kvilib/net/kvi_ssl.cpp
@@ -207,9 +207,15 @@ static DH * my_get_dh(int keylength)
if(dh)return dh;
dh = DH_new();
if(!dh)return 0;
- dh->p=BN_bin2bn(p,sp,0);
- dh->g=BN_bin2bn(g,sg,0);
- if((dh->p == 0) || (dh->g == 0))
+ BIGNUM *bn_p = BN_bin2bn(p,sp,0);
+ BIGNUM *bn_g = BN_bin2bn(g,sg,0);
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
+ dh->p= bn_p;
+ dh->g= bn_g;
+#else
+ DH_set0_pqg(dh, bn_p, NULL, bn_g);
+#endif
+ if((bn_p == 0) || (bn_g == 0))
{
DH_free(dh);
return 0;
@@ -608,7 +614,11 @@ void KviSSLCertificate::extractPubKeyInfo()
if(p)
{
m_iPubKeyBits = EVP_PKEY_bits(p);
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
m_szPubKeyType = (p->type == NID_undef) ? __tr("Unknown") : OBJ_nid2ln(p->type);
+#else
+ m_szPubKeyType = (EVP_PKEY_base_id(p) == NID_undef) ? __tr("Unknown") : OBJ_nid2ln(EVP_PKEY_base_id(p));
+#endif
// getPKeyType(p->type,m_szPubKeyType);
} else {
m_iPubKeyBits = 0;
@@ -630,16 +640,24 @@ void KviSSLCertificate::extractSignature()
//getPKeyType(X509_get_signature_type(m_pX509),m_szSignatureType);
- int i = OBJ_obj2nid(m_pX509->sig_alg->algorithm);
+ const ASN1_BIT_STRING *signature = 0L;
+ const X509_ALGOR *sig_alg = 0L;
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
+ signature = m_pX509->signature;
+ sig_alg = m_pX509->sig_alg;
+#else
+ X509_get0_signature(&signature, &sig_alg, m_pX509);
+#endif
+ int i = OBJ_obj2nid(sig_alg->algorithm);
m_szSignatureType = (i == NID_undef) ? __tr("Unknown") : OBJ_nid2ln(i);
m_szSignatureContents = "";
- for(i = 0;i < m_pX509->signature->length;i++)
+ for(i = 0;i < signature->length;i++)
{
if(m_szSignatureContents.hasData())m_szSignatureContents.append(":");
- m_szSignatureContents.append(hexdigits[(m_pX509->signature->data[i] & 0xf0) >> 4]);
- m_szSignatureContents.append(hexdigits[(m_pX509->signature->data[i] & 0x0f)]);
+ m_szSignatureContents.append(hexdigits[(signature->data[i] & 0xf0) >> 4]);
+ m_szSignatureContents.append(hexdigits[(signature->data[i] & 0x0f)]);
}
}