OpenCoverage

qsslkey_openssl.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/ssl/qsslkey_openssl.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9void QSslKeyPrivate::clear(bool deep)-
10{-
11 isNull = true;-
12 if (!QSslSocket::supportsSsl()
!QSslSocket::supportsSsl()Description
TRUEnever evaluated
FALSEevaluated 28524 times by 25 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_networkselftest - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qsslcertificate - unknown status
  • tst_qsslellipticcurve - unknown status
  • tst_qsslerror - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_spdy - unknown status
)
0-28524
13 return;
never executed: return;
0
14 if (algorithm == QSsl::Rsa
algorithm == QSsl::RsaDescription
TRUEevaluated 760 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 27764 times by 25 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_networkselftest - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qsslcertificate - unknown status
  • tst_qsslellipticcurve - unknown status
  • tst_qsslerror - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_spdy - unknown status
&& rsa
rsaDescription
TRUEevaluated 374 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 386 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
) {
374-27764
15 if (deep
deepDescription
TRUEevaluated 374 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
FALSEnever evaluated
)
0-374
16 q_RSA_free(rsa);
executed 374 times by 4 tests: q_RSA_free(rsa);
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
374
17 rsa = 0;-
18 }
executed 374 times by 4 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
374
19 if (algorithm == QSsl::Dsa
algorithm == QSsl::DsaDescription
TRUEevaluated 323 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 28201 times by 25 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_networkselftest - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qsslcertificate - unknown status
  • tst_qsslellipticcurve - unknown status
  • tst_qsslerror - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_spdy - unknown status
&& dsa
dsaDescription
TRUEevaluated 162 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 161 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
) {
161-28201
20 if (deep
deepDescription
TRUEevaluated 162 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEnever evaluated
)
0-162
21 q_DSA_free(dsa);
executed 162 times by 2 tests: q_DSA_free(dsa);
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
162
22 dsa = 0;-
23 }
executed 162 times by 2 tests: end of block
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
162
24-
25 if (algorithm == QSsl::Ec
algorithm == QSsl::EcDescription
TRUEevaluated 243 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 28281 times by 25 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_networkselftest - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qsslcertificate - unknown status
  • tst_qsslellipticcurve - unknown status
  • tst_qsslerror - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_spdy - unknown status
&& ec
ecDescription
TRUEevaluated 122 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 121 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
) {
121-28281
26 if (deep
deepDescription
TRUEevaluated 122 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEnever evaluated
)
0-122
27 q_EC_KEY_free(ec);
executed 122 times by 2 tests: q_EC_KEY_free(ec);
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
122
28 ec = 0;-
29 }
executed 122 times by 2 tests: end of block
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
122
30-
31 if (algorithm == QSsl::Opaque
algorithm == QSsl::OpaqueDescription
TRUEevaluated 27198 times by 25 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_networkselftest - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qsslcertificate - unknown status
  • tst_qsslellipticcurve - unknown status
  • tst_qsslerror - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_spdy - unknown status
FALSEevaluated 1326 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
&& opaque
opaqueDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_qsslsocket - unknown status
FALSEevaluated 27193 times by 25 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_networkselftest - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qsslcertificate - unknown status
  • tst_qsslellipticcurve - unknown status
  • tst_qsslerror - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_spdy - unknown status
) {
5-27198
32 if (deep
deepDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_qsslsocket - unknown status
FALSEnever evaluated
)
0-5
33 q_EVP_PKEY_free(opaque);
executed 5 times by 1 test: q_EVP_PKEY_free(opaque);
Executed by:
  • tst_qsslsocket - unknown status
5
34 opaque = 0;-
35 }
executed 5 times by 1 test: end of block
Executed by:
  • tst_qsslsocket - unknown status
5
36}
executed 28524 times by 25 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_networkselftest - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qsslcertificate - unknown status
  • tst_qsslellipticcurve - unknown status
  • tst_qsslerror - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_spdy - unknown status
28524
37-
38bool QSslKeyPrivate::fromEVP_PKEY(EVP_PKEY *pkey)-
39{-
40 if (pkey->type == 6
pkey->type == 6Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEnever evaluated
) {
0-1
41 isNull = false;-
42 algorithm = QSsl::Rsa;-
43 type = QSsl::PrivateKey;-
44-
45 rsa = q_RSA_new();-
46 memcpy(rsa, q_EVP_PKEY_get1_RSA(pkey), sizeof(RSA));-
47-
48 return
executed 1 time by 1 test: return true;
Executed by:
  • tst_qsslcertificate - unknown status
true;
executed 1 time by 1 test: return true;
Executed by:
  • tst_qsslcertificate - unknown status
1
49 }-
50 else if (pkey->type == 116
pkey->type == 116Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
51 isNull = false;-
52 algorithm = QSsl::Dsa;-
53 type = QSsl::PrivateKey;-
54-
55 dsa = q_DSA_new();-
56 memcpy(dsa, q_EVP_PKEY_get1_DSA(pkey), sizeof(DSA));-
57-
58 return
never executed: return true;
true;
never executed: return true;
0
59 }-
60-
61 else if (pkey->type == 408
pkey->type == 408Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
62 isNull = false;-
63 algorithm = QSsl::Ec;-
64 type = QSsl::PrivateKey;-
65 ec = q_EC_KEY_dup(q_EVP_PKEY_get1_EC_KEY(pkey));-
66-
67 return
never executed: return true;
true;
never executed: return true;
0
68 }-
69-
70 else {-
71-
72-
73-
74-
75 }
never executed: end of block
0
76-
77 return
never executed: return false;
false;
never executed: return false;
0
78}-
79-
80void QSslKeyPrivate::decodeDer(const QByteArray &der, bool deepClear)-
81{-
82 QMap<QByteArray, QByteArray> headers;-
83 decodePem(pemFromDer(der, headers), QByteArray(), deepClear);-
84}
executed 226 times by 2 tests: end of block
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
226
85-
86void QSslKeyPrivate::decodePem(const QByteArray &pem, const QByteArray &passPhrase,-
87 bool deepClear)-
88{-
89 if (pem.isEmpty()
pem.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 659 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
)
0-659
90 return;
never executed: return;
0
91-
92 clear(deepClear);-
93-
94 if (!QSslSocket::supportsSsl()
!QSslSocket::supportsSsl()Description
TRUEnever evaluated
FALSEevaluated 659 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
)
0-659
95 return;
never executed: return;
0
96-
97 BIO *bio = q_BIO_new_mem_buf(const_cast<char *>(pem.data()), pem.size());-
98 if (!bio
!bioDescription
TRUEnever evaluated
FALSEevaluated 659 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
)
0-659
99 return;
never executed: return;
0
100-
101 void *phrase = const_cast<char *>(passPhrase.constData());-
102-
103 if (algorithm == QSsl::Rsa
algorithm == QSsl::RsaDescription
TRUEevaluated 377 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 282 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
) {
282-377
104 RSA *result = (
(type == QSsl::PublicKey)Description
TRUEevaluated 116 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 261 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
type == QSsl::PublicKey)
(type == QSsl::PublicKey)Description
TRUEevaluated 116 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 261 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
116-261
105 ? q_PEM_read_bio_RSA_PUBKEY(bio, &rsa, 0, phrase)-
106 : q_PEM_read_bio_RSAPrivateKey(bio, &rsa, 0, phrase);-
107 if (rsa
rsaDescription
TRUEevaluated 368 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
&& rsa == result
rsa == resultDescription
TRUEevaluated 368 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
FALSEnever evaluated
)
0-368
108 isNull = false;
executed 368 times by 4 tests: isNull = false;
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
368
109 }
executed 377 times by 4 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
else if (algorithm == QSsl::Dsa
algorithm == QSsl::DsaDescription
TRUEevaluated 161 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 121 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
) {
121-377
110 DSA *result = (
(type == QSsl::PublicKey)Description
TRUEevaluated 65 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 96 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
type == QSsl::PublicKey)
(type == QSsl::PublicKey)Description
TRUEevaluated 65 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 96 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
65-96
111 ? q_PEM_read_bio_DSA_PUBKEY(bio, &dsa, 0, phrase)-
112 : q_PEM_read_bio_DSAPrivateKey(bio, &dsa, 0, phrase);-
113 if (dsa
dsaDescription
TRUEevaluated 161 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEnever evaluated
&& dsa == result
dsa == resultDescription
TRUEevaluated 161 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEnever evaluated
)
0-161
114 isNull = false;
executed 161 times by 2 tests: isNull = false;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
161
115-
116 }
executed 161 times by 2 tests: end of block
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
else if (algorithm == QSsl::Ec
algorithm == QSsl::EcDescription
TRUEevaluated 121 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEnever evaluated
) {
0-161
117 EC_KEY *result = (
(type == QSsl::PublicKey)Description
TRUEevaluated 49 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
type == QSsl::PublicKey)
(type == QSsl::PublicKey)Description
TRUEevaluated 49 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
49-72
118 ? q_PEM_read_bio_EC_PUBKEY(bio, &ec, 0, phrase)-
119 : q_PEM_read_bio_ECPrivateKey(bio, &ec, 0, phrase);-
120 if (ec
ecDescription
TRUEevaluated 121 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEnever evaluated
&& ec == result
ec == resultDescription
TRUEevaluated 121 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEnever evaluated
)
0-121
121 isNull = false;
executed 121 times by 2 tests: isNull = false;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
121
122-
123 }
executed 121 times by 2 tests: end of block
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
121
124-
125 q_BIO_free(bio);-
126}
executed 659 times by 4 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
659
127-
128int QSslKeyPrivate::length() const-
129{-
130 if (isNull
isNullDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
FALSEevaluated 744 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
|| algorithm == QSsl::Opaque
algorithm == QSsl::OpaqueDescription
TRUEnever evaluated
FALSEevaluated 744 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
)
0-744
131 return
executed 1 time by 1 test: return -1;
Executed by:
  • tst_qsslkey - unknown status
-1;
executed 1 time by 1 test: return -1;
Executed by:
  • tst_qsslkey - unknown status
1
132-
133 switch (algorithm) {-
134 case
executed 376 times by 2 tests: case QSsl::Rsa:
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
QSsl::Rsa:
executed 376 times by 2 tests: case QSsl::Rsa:
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
return
executed 376 times by 2 tests: return q_BN_num_bits(rsa->n);
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
q_BN_num_bits(rsa->n);
executed 376 times by 2 tests: return q_BN_num_bits(rsa->n);
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
376
135 case
executed 210 times by 2 tests: case QSsl::Dsa:
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
QSsl::Dsa:
executed 210 times by 2 tests: case QSsl::Dsa:
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
return
executed 210 times by 2 tests: return q_BN_num_bits(dsa->p);
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
q_BN_num_bits(dsa->p);
executed 210 times by 2 tests: return q_BN_num_bits(dsa->p);
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
210
136-
137 case
executed 158 times by 2 tests: case QSsl::Ec:
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
QSsl::Ec:
executed 158 times by 2 tests: case QSsl::Ec:
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
return
executed 158 times by 2 tests: return q_EC_GROUP_get_degree(q_EC_KEY_get0_group(ec));
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
q_EC_GROUP_get_degree(q_EC_KEY_get0_group(ec));
executed 158 times by 2 tests: return q_EC_GROUP_get_degree(q_EC_KEY_get0_group(ec));
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
158
138-
139 default
never executed: default:
:
never executed: default:
return
never executed: return -1;
-1;
never executed: return -1;
0
140 }-
141}-
142-
143QByteArray QSslKeyPrivate::toPem(const QByteArray &passPhrase) const-
144{-
145 if (!QSslSocket::supportsSsl()
!QSslSocket::supportsSsl()Description
TRUEnever evaluated
FALSEevaluated 1752 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
|| isNull
isNullDescription
TRUEnever evaluated
FALSEevaluated 1752 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
|| algorithm == QSsl::Opaque
algorithm == QSsl::OpaqueDescription
TRUEnever evaluated
FALSEevaluated 1752 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
)
0-1752
146 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
147-
148 BIO *bio = q_BIO_new(q_BIO_s_mem());-
149 if (!bio
!bioDescription
TRUEnever evaluated
FALSEevaluated 1752 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
)
0-1752
150 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
151-
152 bool fail = false;-
153-
154 if (algorithm == QSsl::Rsa
algorithm == QSsl::RsaDescription
TRUEevaluated 880 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 872 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
) {
872-880
155 if (type == QSsl::PublicKey
type == QSsl::PublicKeyDescription
TRUEevaluated 416 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 464 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
) {
416-464
156 if (!q_PEM_write_bio_RSA_PUBKEY(bio, rsa)
!q_PEM_write_b...BKEY(bio, rsa)Description
TRUEnever evaluated
FALSEevaluated 416 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
)
0-416
157 fail = true;
never executed: fail = true;
0
158 }
executed 416 times by 2 tests: end of block
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
else {
416
159 if (!q_PEM_write_bio_RSAPrivateKey(
!q_PEM_write_b....size(), 0, 0)Description
TRUEnever evaluated
FALSEevaluated 464 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
0-464
160 bio, rsa,
!q_PEM_write_b....size(), 0, 0)Description
TRUEnever evaluated
FALSEevaluated 464 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
0-464
1610-464
162 passPhrase.isEmpty() ? (const EVP_CIPHER *)0 : q_EVP_des_ede3_cbc(),
!q_PEM_write_b....size(), 0, 0)Description
TRUEnever evaluated
FALSEevaluated 464 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
0-464
163 const_cast<uchar *>((const uchar *)passPhrase.data()), passPhrase.size(), 0, 0)
!q_PEM_write_b....size(), 0, 0)Description
TRUEnever evaluated
FALSEevaluated 464 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
) {
0-464
164 fail = true;-
165 }
never executed: end of block
0
166 }
executed 464 times by 2 tests: end of block
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
464
167 } else if (algorithm == QSsl::Dsa
algorithm == QSsl::DsaDescription
TRUEevaluated 498 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 374 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
) {
374-498
168 if (type == QSsl::PublicKey
type == QSsl::PublicKeyDescription
TRUEevaluated 234 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 264 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
) {
234-264
169 if (!q_PEM_write_bio_DSA_PUBKEY(bio, dsa)
!q_PEM_write_b...BKEY(bio, dsa)Description
TRUEnever evaluated
FALSEevaluated 234 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
)
0-234
170 fail = true;
never executed: fail = true;
0
171 }
executed 234 times by 2 tests: end of block
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
else {
234
172 if (!q_PEM_write_bio_DSAPrivateKey(
!q_PEM_write_b....size(), 0, 0)Description
TRUEnever evaluated
FALSEevaluated 264 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
0-264
173 bio, dsa,
!q_PEM_write_b....size(), 0, 0)Description
TRUEnever evaluated
FALSEevaluated 264 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
0-264
1740-264
175 passPhrase.isEmpty() ? (const EVP_CIPHER *)0 : q_EVP_des_ede3_cbc(),
!q_PEM_write_b....size(), 0, 0)Description
TRUEnever evaluated
FALSEevaluated 264 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
0-264
176 const_cast<uchar *>((const uchar *)passPhrase.data()), passPhrase.size(), 0, 0)
!q_PEM_write_b....size(), 0, 0)Description
TRUEnever evaluated
FALSEevaluated 264 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
) {
0-264
177 fail = true;-
178 }
never executed: end of block
0
179 }
executed 264 times by 1 test: end of block
Executed by:
  • tst_qsslkey - unknown status
264
180-
181 } else if (algorithm == QSsl::Ec
algorithm == QSsl::EcDescription
TRUEevaluated 374 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEnever evaluated
) {
0-374
182 if (type == QSsl::PublicKey
type == QSsl::PublicKeyDescription
TRUEevaluated 176 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 198 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
) {
176-198
183 if (!q_PEM_write_bio_EC_PUBKEY(bio, ec)
!q_PEM_write_b...UBKEY(bio, ec)Description
TRUEnever evaluated
FALSEevaluated 176 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
)
0-176
184 fail = true;
never executed: fail = true;
0
185 }
executed 176 times by 2 tests: end of block
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
else {
176
186 if (!q_PEM_write_bio_ECPrivateKey(
!q_PEM_write_b....size(), 0, 0)Description
TRUEnever evaluated
FALSEevaluated 198 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
0-198
187 bio, ec,
!q_PEM_write_b....size(), 0, 0)Description
TRUEnever evaluated
FALSEevaluated 198 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
0-198
1880-198
189 passPhrase.isEmpty() ? (const EVP_CIPHER *)0 : q_EVP_des_ede3_cbc(),
!q_PEM_write_b....size(), 0, 0)Description
TRUEnever evaluated
FALSEevaluated 198 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
0-198
190 const_cast<uchar *>((const uchar *)passPhrase.data()), passPhrase.size(), 0, 0)
!q_PEM_write_b....size(), 0, 0)Description
TRUEnever evaluated
FALSEevaluated 198 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
) {
0-198
191 fail = true;-
192 }
never executed: end of block
0
193 }
executed 198 times by 1 test: end of block
Executed by:
  • tst_qsslkey - unknown status
198
194-
195 } else {-
196 fail = true;-
197 }
never executed: end of block
0
198-
199 QByteArray pem;-
200 if (!fail
!failDescription
TRUEevaluated 1752 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEnever evaluated
) {
0-1752
201 char *data;-
202 long size = (int)q_BIO_ctrl(bio,3,0,(char *)&data);-
203 pem = QByteArray(data, size);-
204 }
executed 1752 times by 2 tests: end of block
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
1752
205 q_BIO_free(bio);-
206 return
executed 1752 times by 2 tests: return pem;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
pem;
executed 1752 times by 2 tests: return pem;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
1752
207}-
208-
209Qt::HANDLE QSslKeyPrivate::handle() const-
210{-
211 switch (algorithm) {-
212 case
executed 4 times by 1 test: case QSsl::Opaque:
Executed by:
  • tst_qsslsocket - unknown status
QSsl::Opaque:
executed 4 times by 1 test: case QSsl::Opaque:
Executed by:
  • tst_qsslsocket - unknown status
4
213 return
executed 4 times by 1 test: return Qt::HANDLE(opaque);
Executed by:
  • tst_qsslsocket - unknown status
Qt::HANDLE(opaque);
executed 4 times by 1 test: return Qt::HANDLE(opaque);
Executed by:
  • tst_qsslsocket - unknown status
4
214 case
executed 89 times by 2 tests: case QSsl::Rsa:
Executed by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
QSsl::Rsa:
executed 89 times by 2 tests: case QSsl::Rsa:
Executed by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
89
215 return
executed 89 times by 2 tests: return Qt::HANDLE(rsa);
Executed by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
Qt::HANDLE(rsa);
executed 89 times by 2 tests: return Qt::HANDLE(rsa);
Executed by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
89
216 case
never executed: case QSsl::Dsa:
QSsl::Dsa:
never executed: case QSsl::Dsa:
0
217 return
never executed: return Qt::HANDLE(dsa);
Qt::HANDLE(dsa);
never executed: return Qt::HANDLE(dsa);
0
218-
219 case
never executed: case QSsl::Ec:
QSsl::Ec:
never executed: case QSsl::Ec:
0
220 return
never executed: return Qt::HANDLE(ec);
Qt::HANDLE(ec);
never executed: return Qt::HANDLE(ec);
0
221-
222 default
never executed: default:
:
never executed: default:
0
223 return
never executed: return Qt::HANDLE(__null);
Qt::HANDLE(__null);
never executed: return Qt::HANDLE(__null);
0
224 }-
225}-
226-
227static QByteArray doCrypt(QSslKeyPrivate::Cipher cipher, const QByteArray &data, const QByteArray &key, const QByteArray &iv, int enc)-
228{-
229 EVP_CIPHER_CTX ctx;-
230 const EVP_CIPHER* type = 0;-
231 int i = 0, len = 0;-
232-
233 switch (cipher) {-
234 case
executed 18 times by 1 test: case QSslKeyPrivate::DesCbc:
Executed by:
  • tst_qsslkey - unknown status
QSslKeyPrivate::DesCbc:
executed 18 times by 1 test: case QSslKeyPrivate::DesCbc:
Executed by:
  • tst_qsslkey - unknown status
18
235 type = q_EVP_des_cbc();-
236 break;
executed 18 times by 1 test: break;
Executed by:
  • tst_qsslkey - unknown status
18
237 case
executed 4 times by 1 test: case QSslKeyPrivate::DesEde3Cbc:
Executed by:
  • tst_qsslkey - unknown status
QSslKeyPrivate::DesEde3Cbc:
executed 4 times by 1 test: case QSslKeyPrivate::DesEde3Cbc:
Executed by:
  • tst_qsslkey - unknown status
4
238 type = q_EVP_des_ede3_cbc();-
239 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_qsslkey - unknown status
4
240 case
executed 12 times by 1 test: case QSslKeyPrivate::Rc2Cbc:
Executed by:
  • tst_qsslkey - unknown status
QSslKeyPrivate::Rc2Cbc:
executed 12 times by 1 test: case QSslKeyPrivate::Rc2Cbc:
Executed by:
  • tst_qsslkey - unknown status
12
241 type = q_EVP_rc2_cbc();-
242 break;
executed 12 times by 1 test: break;
Executed by:
  • tst_qsslkey - unknown status
12
243 }-
244-
245 QByteArray output;-
246 output.resize(data.size() + 32);-
247 q_EVP_CIPHER_CTX_init(&ctx);-
248 q_EVP_CipherInit(&ctx, type, __null, __null, enc);-
249 q_EVP_CIPHER_CTX_set_key_length(&ctx, key.size());-
250 if (cipher == QSslKeyPrivate::Rc2Cbc
cipher == QSsl...rivate::Rc2CbcDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
)
12-22
251 q_EVP_CIPHER_CTX_ctrl(&ctx, 0x3, 8 * key.size(), __null);
executed 12 times by 1 test: q_EVP_CIPHER_CTX_ctrl(&ctx, 0x3, 8 * key.size(), __null);
Executed by:
  • tst_qsslkey - unknown status
12
252 q_EVP_CipherInit(&ctx, __null,-
253 reinterpret_cast<const unsigned char *>(key.constData()),-
254 reinterpret_cast<const unsigned char *>(iv.constData()), enc);-
255 q_EVP_CipherUpdate(&ctx,-
256 reinterpret_cast<unsigned char *>(output.data()), &len,-
257 reinterpret_cast<const unsigned char *>(data.constData()), data.size());-
258 q_EVP_CipherFinal(&ctx,-
259 reinterpret_cast<unsigned char *>(output.data()) + len, &i);-
260 len += i;-
261 q_EVP_CIPHER_CTX_cleanup(&ctx);-
262-
263 return
executed 34 times by 1 test: return output.left(len);
Executed by:
  • tst_qsslkey - unknown status
output.left(len);
executed 34 times by 1 test: return output.left(len);
Executed by:
  • tst_qsslkey - unknown status
34
264}-
265-
266QByteArray QSslKeyPrivate::decrypt(Cipher cipher, const QByteArray &data, const QByteArray &key, const QByteArray &iv)-
267{-
268 return
executed 17 times by 1 test: return doCrypt(cipher, data, key, iv, 0);
Executed by:
  • tst_qsslkey - unknown status
doCrypt(cipher, data, key, iv, 0);
executed 17 times by 1 test: return doCrypt(cipher, data, key, iv, 0);
Executed by:
  • tst_qsslkey - unknown status
17
269}-
270-
271QByteArray QSslKeyPrivate::encrypt(Cipher cipher, const QByteArray &data, const QByteArray &key, const QByteArray &iv)-
272{-
273 return
executed 17 times by 1 test: return doCrypt(cipher, data, key, iv, 1);
Executed by:
  • tst_qsslkey - unknown status
doCrypt(cipher, data, key, iv, 1);
executed 17 times by 1 test: return doCrypt(cipher, data, key, iv, 1);
Executed by:
  • tst_qsslkey - unknown status
17
274}-
275-
276-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9