qsslcertificate_openssl.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/ssl/qsslcertificate_openssl.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtNetwork module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 2.1 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33-
34#include "qssl_p.h"-
35#include "qsslsocket_openssl_symbols_p.h"-
36#include "qsslcertificate_p.h"-
37#include "qsslkey_p.h"-
38#include "qsslcertificateextension_p.h"-
39-
40#include <QtCore/private/qmutexpool_p.h>-
41-
42QT_BEGIN_NAMESPACE-
43-
44// forward declaration-
45static QMap<QByteArray, QString> _q_mapFromX509Name(X509_NAME *name);-
46-
47bool QSslCertificate::operator==(const QSslCertificate &other) const-
48{-
49 if (d == other.d)
d == other.dDescription
TRUEevaluated 51 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 7118 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
51-7118
50 return true;
executed 51 times by 4 tests: return true;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
51
51 if (d->null && other.d->null)
d->nullDescription
TRUEevaluated 74 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 7044 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
other.d->nullDescription
TRUEevaluated 47 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
27-7044
52 return true;
executed 47 times by 3 tests: return true;
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
47
53 if (d->x509 && other.d->x509)
d->x509Description
TRUEevaluated 7044 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
other.d->x509Description
TRUEevaluated 7040 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
4-7044
54 return q_X509_cmp(d->x509, other.d->x509) == 0;
executed 7040 times by 3 tests: return q_X509_cmp(d->x509, other.d->x509) == 0;
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
7040
55 return false;
executed 31 times by 2 tests: return false;
Executed by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
31
56}-
57-
58uint qHash(const QSslCertificate &key, uint seed) Q_DECL_NOTHROW-
59{-
60 if (X509 * const x509 = key.d->x509) {
X509 * const x... = key.d->x509Description
TRUEnever evaluated
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslerror - unknown status
0-4
61 (void)q_X509_cmp(x509, x509); // populate x509->sha1_hash-
62 // (if someone knows a better way...)-
63 return qHashBits(x509->sha1_hash, SHA_DIGEST_LENGTH, seed);
never executed: return qHashBits(x509->sha1_hash, 20, seed);
0
64 } else {-
65 return seed;
executed 4 times by 2 tests: return seed;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslerror - unknown status
4
66 }-
67}-
68-
69bool QSslCertificate::isNull() const-
70{-
71 return d->null;
executed 3672 times by 9 tests: return d->null;
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
3672
72}-
73-
74bool QSslCertificate::isSelfSigned() const-
75{-
76 if (!d->x509)
!d->x509Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
1-2
77 return false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_qsslcertificate - unknown status
1
78-
79 return (q_X509_check_issued(d->x509, d->x509) == X509_V_OK);
executed 2 times by 1 test: return (q_X509_check_issued(d->x509, d->x509) == 0);
Executed by:
  • tst_qsslcertificate - unknown status
2
80}-
81-
82QByteArray QSslCertificate::version() const-
83{-
84 QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));-
85 if (d->versionString.isEmpty() && d->x509)
d->versionString.isEmpty()Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 64 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
d->x509Description
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
2-64
86 d->versionString =
executed 13 times by 1 test: d->versionString = QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->version)) + 1);
Executed by:
  • tst_qsslcertificate - unknown status
13
87 QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->version)) + 1);
executed 13 times by 1 test: d->versionString = QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->version)) + 1);
Executed by:
  • tst_qsslcertificate - unknown status
13
88-
89 return d->versionString;
executed 79 times by 1 test: return d->versionString;
Executed by:
  • tst_qsslcertificate - unknown status
79
90}-
91-
92QByteArray QSslCertificate::serialNumber() const-
93{-
94 QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));-
95 if (d->serialNumberString.isEmpty() && d->x509) {
d->serialNumbe...ring.isEmpty()Description
TRUEevaluated 487 times by 8 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
FALSEevaluated 16459 times by 8 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
d->x509Description
TRUEevaluated 450 times by 8 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
FALSEevaluated 37 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
37-16459
96 ASN1_INTEGER *serialNumber = d->x509->cert_info->serialNumber;-
97 QByteArray hexString;-
98 hexString.reserve(serialNumber->length * 3);-
99 for (int a = 0; a < serialNumber->length; ++a) {
a < serialNumber->lengthDescription
TRUEevaluated 3554 times by 8 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
FALSEevaluated 450 times by 8 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
450-3554
100 hexString += QByteArray::number(serialNumber->data[a], 16).rightJustified(2, '0');-
101 hexString += ':';-
102 }
executed 3554 times by 8 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
3554
103 hexString.chop(1);-
104 d->serialNumberString = hexString;-
105 }
executed 450 times by 8 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
450
106 return d->serialNumberString;
executed 16946 times by 8 tests: return d->serialNumberString;
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
16946
107}-
108-
109QStringList QSslCertificate::issuerInfo(SubjectInfo info) const-
110{-
111 QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));-
112 // lazy init-
113 if (d->issuerInfo.isEmpty() && d->x509)
d->issuerInfo.isEmpty()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 213 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
d->x509Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
1-213
114 d->issuerInfo =
executed 11 times by 1 test: d->issuerInfo = _q_mapFromX509Name(q_X509_get_issuer_name(d->x509));
Executed by:
  • tst_qsslcertificate - unknown status
11
115 _q_mapFromX509Name(q_X509_get_issuer_name(d->x509));
executed 11 times by 1 test: d->issuerInfo = _q_mapFromX509Name(q_X509_get_issuer_name(d->x509));
Executed by:
  • tst_qsslcertificate - unknown status
11
116-
117 return d->issuerInfo.values(d->subjectInfoToString(info));
executed 225 times by 1 test: return d->issuerInfo.values(d->subjectInfoToString(info));
Executed by:
  • tst_qsslcertificate - unknown status
225
118}-
119-
120QStringList QSslCertificate::issuerInfo(const QByteArray &attribute) const-
121{-
122 QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));-
123 // lazy init-
124 if (d->issuerInfo.isEmpty() && d->x509)
d->issuerInfo.isEmpty()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
d->x509Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEnever evaluated
0-6
125 d->issuerInfo =
executed 1 time by 1 test: d->issuerInfo = _q_mapFromX509Name(q_X509_get_issuer_name(d->x509));
Executed by:
  • tst_qsslcertificate - unknown status
1
126 _q_mapFromX509Name(q_X509_get_issuer_name(d->x509));
executed 1 time by 1 test: d->issuerInfo = _q_mapFromX509Name(q_X509_get_issuer_name(d->x509));
Executed by:
  • tst_qsslcertificate - unknown status
1
127-
128 return d->issuerInfo.values(attribute);
executed 7 times by 1 test: return d->issuerInfo.values(attribute);
Executed by:
  • tst_qsslcertificate - unknown status
7
129}-
130-
131QStringList QSslCertificate::subjectInfo(SubjectInfo info) const-
132{-
133 QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));-
134 // lazy init-
135 if (d->subjectInfo.isEmpty() && d->x509)
d->subjectInfo.isEmpty()Description
TRUEevaluated 414 times by 8 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
FALSEevaluated 214 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
d->x509Description
TRUEevaluated 413 times by 8 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
1-414
136 d->subjectInfo =
executed 413 times by 8 tests: d->subjectInfo = _q_mapFromX509Name(q_X509_get_subject_name(d->x509));
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
413
137 _q_mapFromX509Name(q_X509_get_subject_name(d->x509));
executed 413 times by 8 tests: d->subjectInfo = _q_mapFromX509Name(q_X509_get_subject_name(d->x509));
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
413
138-
139 return d->subjectInfo.values(d->subjectInfoToString(info));
executed 628 times by 8 tests: return d->subjectInfo.values(d->subjectInfoToString(info));
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
628
140}-
141-
142QStringList QSslCertificate::subjectInfo(const QByteArray &attribute) const-
143{-
144 QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));-
145 // lazy init-
146 if (d->subjectInfo.isEmpty() && d->x509)
d->subjectInfo.isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
d->x509Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEnever evaluated
0-9
147 d->subjectInfo =
executed 2 times by 1 test: d->subjectInfo = _q_mapFromX509Name(q_X509_get_subject_name(d->x509));
Executed by:
  • tst_qsslcertificate - unknown status
2
148 _q_mapFromX509Name(q_X509_get_subject_name(d->x509));
executed 2 times by 1 test: d->subjectInfo = _q_mapFromX509Name(q_X509_get_subject_name(d->x509));
Executed by:
  • tst_qsslcertificate - unknown status
2
149-
150 return d->subjectInfo.values(attribute);
executed 11 times by 1 test: return d->subjectInfo.values(attribute);
Executed by:
  • tst_qsslcertificate - unknown status
11
151}-
152-
153QList<QByteArray> QSslCertificate::subjectInfoAttributes() const-
154{-
155 QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));-
156 // lazy init-
157 if (d->subjectInfo.isEmpty() && d->x509)
d->subjectInfo.isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
d->x509Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEnever evaluated
0-2
158 d->subjectInfo =
executed 2 times by 1 test: d->subjectInfo = _q_mapFromX509Name(q_X509_get_subject_name(d->x509));
Executed by:
  • tst_qsslcertificate - unknown status
2
159 _q_mapFromX509Name(q_X509_get_subject_name(d->x509));
executed 2 times by 1 test: d->subjectInfo = _q_mapFromX509Name(q_X509_get_subject_name(d->x509));
Executed by:
  • tst_qsslcertificate - unknown status
2
160-
161 return d->subjectInfo.uniqueKeys();
executed 4 times by 1 test: return d->subjectInfo.uniqueKeys();
Executed by:
  • tst_qsslcertificate - unknown status
4
162}-
163-
164QList<QByteArray> QSslCertificate::issuerInfoAttributes() const-
165{-
166 QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));-
167 // lazy init-
168 if (d->issuerInfo.isEmpty() && d->x509)
d->issuerInfo.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
d->x509Description
TRUEnever evaluated
FALSEnever evaluated
0-2
169 d->issuerInfo =
never executed: d->issuerInfo = _q_mapFromX509Name(q_X509_get_issuer_name(d->x509));
0
170 _q_mapFromX509Name(q_X509_get_issuer_name(d->x509));
never executed: d->issuerInfo = _q_mapFromX509Name(q_X509_get_issuer_name(d->x509));
0
171-
172 return d->issuerInfo.uniqueKeys();
executed 2 times by 1 test: return d->issuerInfo.uniqueKeys();
Executed by:
  • tst_qsslcertificate - unknown status
2
173}-
174-
175QMultiMap<QSsl::AlternativeNameEntryType, QString> QSslCertificate::subjectAlternativeNames() const-
176{-
177 QMultiMap<QSsl::AlternativeNameEntryType, QString> result;-
178-
179 if (!d->x509)
!d->x509Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 100 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
1-100
180 return result;
executed 1 time by 1 test: return result;
Executed by:
  • tst_qsslcertificate - unknown status
1
181-
182 STACK_OF(GENERAL_NAME) *altNames = (STACK_OF(GENERAL_NAME)*)q_X509_get_ext_d2i(d->x509, NID_subject_alt_name, 0, 0);-
183-
184 if (altNames) {
altNamesDescription
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 89 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
11-89
185 for (int i = 0; i < q_sk_GENERAL_NAME_num(altNames); ++i) {
i < ((int (*)(...m)((altNames))Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 11 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
11-31
186 const GENERAL_NAME *genName = q_sk_GENERAL_NAME_value(altNames, i);-
187 if (genName->type != GEN_DNS && genName->type != GEN_EMAIL)
genName->type != 2Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 11 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
genName->type != 1Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
0-20
188 continue;
never executed: continue;
0
189-
190 int len = q_ASN1_STRING_length(genName->d.ia5);-
191 if (len < 0 || len >= 8192) {
len < 0Description
TRUEnever evaluated
FALSEevaluated 31 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
len >= 8192Description
TRUEnever evaluated
FALSEevaluated 31 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
0-31
192 // broken name-
193 continue;
never executed: continue;
0
194 }-
195-
196 const char *altNameStr = reinterpret_cast<const char *>(q_ASN1_STRING_data(genName->d.ia5));-
197 const QString altName = QString::fromLatin1(altNameStr, len);-
198 if (genName->type == GEN_DNS)
genName->type == 2Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
11-20
199 result.insert(QSsl::DnsEntry, altName);
executed 11 times by 1 test: result.insert(QSsl::DnsEntry, altName);
Executed by:
  • tst_qsslcertificate - unknown status
11
200 else if (genName->type == GEN_EMAIL)
genName->type == 1Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEnever evaluated
0-20
201 result.insert(QSsl::EmailEntry, altName);
executed 20 times by 1 test: result.insert(QSsl::EmailEntry, altName);
Executed by:
  • tst_qsslcertificate - unknown status
20
202 }
executed 31 times by 1 test: end of block
Executed by:
  • tst_qsslcertificate - unknown status
31
203 q_sk_pop_free((STACK*)altNames, reinterpret_cast<void(*)(void*)>(q_sk_free));-
204 }
executed 11 times by 1 test: end of block
Executed by:
  • tst_qsslcertificate - unknown status
11
205-
206 return result;
executed 100 times by 3 tests: return result;
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
100
207}-
208-
209QDateTime QSslCertificate::effectiveDate() const-
210{-
211 return d->notValidBefore;
executed 41 times by 1 test: return d->notValidBefore;
Executed by:
  • tst_qsslcertificate - unknown status
41
212}-
213-
214QDateTime QSslCertificate::expiryDate() const-
215{-
216 return d->notValidAfter;
executed 56034 times by 4 tests: return d->notValidAfter;
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
56034
217}-
218-
219Qt::HANDLE QSslCertificate::handle() const-
220{-
221 return Qt::HANDLE(d->x509);
executed 52574 times by 4 tests: return Qt::HANDLE(d->x509);
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
52574
222}-
223-
224QSslKey QSslCertificate::publicKey() const-
225{-
226 if (!d->x509)
!d->x509Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
0-8
227 return QSslKey();
never executed: return QSslKey();
0
228-
229 QSslKey key;-
230-
231 key.d->type = QSsl::PublicKey;-
232 X509_PUBKEY *xkey = d->x509->cert_info->key;-
233 EVP_PKEY *pkey = q_X509_PUBKEY_get(xkey);-
234 Q_ASSERT(pkey);-
235-
236 if (q_EVP_PKEY_type(pkey->type) == EVP_PKEY_RSA) {
q_EVP_PKEY_typ...ey->type) == 6Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
2-6
237 key.d->rsa = q_EVP_PKEY_get1_RSA(pkey);-
238 key.d->algorithm = QSsl::Rsa;-
239 key.d->isNull = false;-
240 } else if (q_EVP_PKEY_type(pkey->type) == EVP_PKEY_DSA) {
executed 6 times by 1 test: end of block
Executed by:
  • tst_qsslcertificate - unknown status
q_EVP_PKEY_typ...->type) == 116Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
1-6
241 key.d->dsa = q_EVP_PKEY_get1_DSA(pkey);-
242 key.d->algorithm = QSsl::Dsa;-
243 key.d->isNull = false;-
244#ifndef OPENSSL_NO_EC-
245 } else if (q_EVP_PKEY_type(pkey->type) == EVP_PKEY_EC) {
executed 1 time by 1 test: end of block
Executed by:
  • tst_qsslcertificate - unknown status
q_EVP_PKEY_typ...->type) == 408Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEnever evaluated
0-1
246 key.d->ec = q_EVP_PKEY_get1_EC_KEY(pkey);-
247 key.d->algorithm = QSsl::Ec;-
248 key.d->isNull = false;-
249#endif-
250 } else if (q_EVP_PKEY_type(pkey->type) == EVP_PKEY_DH) {
executed 1 time by 1 test: end of block
Executed by:
  • tst_qsslcertificate - unknown status
q_EVP_PKEY_typ...y->type) == 28Description
TRUEnever evaluated
FALSEnever evaluated
0-1
251 // DH unsupported-
252 } else {
never executed: end of block
0
253 // error?-
254 }
never executed: end of block
0
255-
256 q_EVP_PKEY_free(pkey);-
257 return key;
executed 8 times by 1 test: return key;
Executed by:
  • tst_qsslcertificate - unknown status
8
258}-
259-
260/*-
261 * Convert unknown extensions to a QVariant.-
262 */-
263static QVariant x509UnknownExtensionToValue(X509_EXTENSION *ext)-
264{-
265 // Get the extension specific method object if available-
266 // we cast away the const-ness here because some versions of openssl-
267 // don't use const for the parameters in the functions pointers stored-
268 // in the object.-
269 X509V3_EXT_METHOD *meth = const_cast<X509V3_EXT_METHOD *>(q_X509V3_EXT_get(ext));-
270 if (!meth) {
!methDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
1-9
271 ASN1_OCTET_STRING *value = q_X509_EXTENSION_get_data(ext);-
272 QByteArray result( reinterpret_cast<const char *>(q_ASN1_STRING_data(value)),-
273 q_ASN1_STRING_length(value));-
274 return result;
executed 1 time by 1 test: return result;
Executed by:
  • tst_qsslcertificate - unknown status
1
275 }-
276-
277 //const unsigned char *data = ext->value->data;-
278 void *ext_internal = q_X509V3_EXT_d2i(ext);-
279-
280 // If this extension can be converted-
281 if (meth->i2v && ext_internal) {
meth->i2vDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
ext_internalDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEnever evaluated
0-5
282 STACK_OF(CONF_VALUE) *val = meth->i2v(meth, ext_internal, 0);-
283-
284 QVariantMap map;-
285 QVariantList list;-
286 bool isMap = false;-
287-
288 for (int j = 0; j < q_SKM_sk_num(CONF_VALUE, val); j++) {
j < ((int (*)(...q_sk_num)(val)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
5-12
289 CONF_VALUE *nval = q_SKM_sk_value(CONF_VALUE, val, j);-
290 if (nval->name && nval->value) {
nval->nameDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
nval->valueDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
2-6
291 isMap = true;-
292 map[QString::fromUtf8(nval->name)] = QString::fromUtf8(nval->value);-
293 } else if (nval->name) {
executed 2 times by 1 test: end of block
Executed by:
  • tst_qsslcertificate - unknown status
nval->nameDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
2-6
294 list << QString::fromUtf8(nval->name);-
295 } else if (nval->value) {
executed 4 times by 1 test: end of block
Executed by:
  • tst_qsslcertificate - unknown status
nval->valueDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEnever evaluated
0-6
296 list << QString::fromUtf8(nval->value);-
297 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qsslcertificate - unknown status
6
298 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qsslcertificate - unknown status
12
299-
300 if (isMap)
isMapDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
1-4
301 return map;
executed 1 time by 1 test: return map;
Executed by:
  • tst_qsslcertificate - unknown status
1
302 else-
303 return list;
executed 4 times by 1 test: return list;
Executed by:
  • tst_qsslcertificate - unknown status
4
304 } else if (meth->i2s && ext_internal) {
meth->i2sDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
ext_internalDescription
TRUEnever evaluated
FALSEnever evaluated
0-4
305 //qCDebug(lcSsl) << meth->i2s(meth, ext_internal);-
306 QVariant result(QString::fromUtf8(meth->i2s(meth, ext_internal)));-
307 return result;
never executed: return result;
0
308 } else if (meth->i2r && ext_internal) {
meth->i2rDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEnever evaluated
ext_internalDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEnever evaluated
0-4
309 QByteArray result;-
310-
311 BIO *bio = q_BIO_new(q_BIO_s_mem());-
312 if (!bio)
!bioDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
0-4
313 return result;
never executed: return result;
0
314-
315 meth->i2r(meth, ext_internal, bio, 0);-
316-
317 char *bio_buffer;-
318 long bio_size = q_BIO_get_mem_data(bio, &bio_buffer);-
319 result = QByteArray(bio_buffer, bio_size);-
320-
321 q_BIO_free(bio);-
322 return result;
executed 4 times by 1 test: return result;
Executed by:
  • tst_qsslcertificate - unknown status
4
323 }-
324-
325 return QVariant();
never executed: return QVariant();
0
326}-
327-
328/*-
329 * Convert extensions to a variant. The naming of the keys of the map are-
330 * taken from RFC 5280, however we decided the capitalisation in the RFC-
331 * was too silly for the real world.-
332 */-
333static QVariant x509ExtensionToValue(X509_EXTENSION *ext)-
334{-
335 ASN1_OBJECT *obj = q_X509_EXTENSION_get_object(ext);-
336 int nid = q_OBJ_obj2nid(obj);-
337-
338 switch (nid) {-
339 case NID_basic_constraints:
executed 2 times by 1 test: case 87:
Executed by:
  • tst_qsslcertificate - unknown status
2
340 {-
341 BASIC_CONSTRAINTS *basic = reinterpret_cast<BASIC_CONSTRAINTS *>(q_X509V3_EXT_d2i(ext));-
342-
343 QVariantMap result;-
344 result[QLatin1String("ca")] = basic->ca ? true : false;
basic->caDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
0-2
345 if (basic->pathlen)
basic->pathlenDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
0-2
346 result[QLatin1String("pathLenConstraint")] = (qlonglong)q_ASN1_INTEGER_get(basic->pathlen);
never executed: result[QLatin1String("pathLenConstraint")] = (qlonglong)q_ASN1_INTEGER_get(basic->pathlen);
0
347-
348 q_BASIC_CONSTRAINTS_free(basic);-
349 return result;
executed 2 times by 1 test: return result;
Executed by:
  • tst_qsslcertificate - unknown status
2
350 }-
351 break;
dead code: break;
-
352 case NID_info_access:
executed 2 times by 1 test: case 177:
Executed by:
  • tst_qsslcertificate - unknown status
2
353 {-
354 AUTHORITY_INFO_ACCESS *info = reinterpret_cast<AUTHORITY_INFO_ACCESS *>(q_X509V3_EXT_d2i(ext));-
355-
356 QVariantMap result;-
357 for (int i=0; i < q_SKM_sk_num(ACCESS_DESCRIPTION, info); i++) {
i < ((int (*)(..._sk_num)(info)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
2-4
358 ACCESS_DESCRIPTION *ad = q_SKM_sk_value(ACCESS_DESCRIPTION, info, i);-
359-
360 GENERAL_NAME *name = ad->location;-
361 if (name->type == GEN_URI) {
name->type == 6Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEnever evaluated
0-4
362 int len = q_ASN1_STRING_length(name->d.uniformResourceIdentifier);-
363 if (len < 0 || len >= 8192) {
len < 0Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
len >= 8192Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
0-4
364 // broken name-
365 continue;
never executed: continue;
0
366 }-
367-
368 const char *uriStr = reinterpret_cast<const char *>(q_ASN1_STRING_data(name->d.uniformResourceIdentifier));-
369 const QString uri = QString::fromUtf8(uriStr, len);-
370-
371 result[QString::fromUtf8(QSslCertificatePrivate::asn1ObjectName(ad->method))] = uri;-
372 } else {
executed 4 times by 1 test: end of block
Executed by:
  • tst_qsslcertificate - unknown status
4
373 qCWarning(lcSsl) << "Strange location type" << name->type;
never executed: QMessageLogger(__FILE__, 373, __PRETTY_FUNCTION__, lcSsl().categoryName()).warning() << "Strange location type" << name->type;
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
374 }
never executed: end of block
0
375 }-
376-
377#if OPENSSL_VERSION_NUMBER >= 0x10000000L-
378 q_sk_pop_free((_STACK*)info, reinterpret_cast<void(*)(void*)>(q_sk_free));-
379#else-
380 q_sk_pop_free((STACK*)info, reinterpret_cast<void(*)(void*)>(q_sk_free));-
381#endif-
382 return result;
executed 2 times by 1 test: return result;
Executed by:
  • tst_qsslcertificate - unknown status
2
383 }-
384 break;
dead code: break;
-
385 case NID_subject_key_identifier:
executed 2 times by 1 test: case 82:
Executed by:
  • tst_qsslcertificate - unknown status
2
386 {-
387 void *ext_internal = q_X509V3_EXT_d2i(ext);-
388-
389 // we cast away the const-ness here because some versions of openssl-
390 // don't use const for the parameters in the functions pointers stored-
391 // in the object.-
392 X509V3_EXT_METHOD *meth = const_cast<X509V3_EXT_METHOD *>(q_X509V3_EXT_get(ext));-
393-
394 return QVariant(QString::fromUtf8(meth->i2s(meth, ext_internal)));
executed 2 times by 1 test: return QVariant(QString::fromUtf8(meth->i2s(meth, ext_internal)));
Executed by:
  • tst_qsslcertificate - unknown status
2
395 }-
396 break;
dead code: break;
-
397 case NID_authority_key_identifier:
executed 2 times by 1 test: case 90:
Executed by:
  • tst_qsslcertificate - unknown status
2
398 {-
399 AUTHORITY_KEYID *auth_key = reinterpret_cast<AUTHORITY_KEYID *>(q_X509V3_EXT_d2i(ext));-
400-
401 QVariantMap result;-
402-
403 // keyid-
404 if (auth_key->keyid) {
auth_key->keyidDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEnever evaluated
0-2
405 QByteArray keyid(reinterpret_cast<const char *>(auth_key->keyid->data),-
406 auth_key->keyid->length);-
407 result[QLatin1String("keyid")] = keyid.toHex();-
408 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qsslcertificate - unknown status
2
409-
410 // issuer-
411 // TODO: GENERAL_NAMES-
412-
413 // serial-
414 if (auth_key->serial)
auth_key->serialDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
0-2
415 result[QLatin1String("serial")] = (qlonglong)q_ASN1_INTEGER_get(auth_key->serial);
never executed: result[QLatin1String("serial")] = (qlonglong)q_ASN1_INTEGER_get(auth_key->serial);
0
416-
417 q_AUTHORITY_KEYID_free(auth_key);-
418 return result;
executed 2 times by 1 test: return result;
Executed by:
  • tst_qsslcertificate - unknown status
2
419 }-
420 break;
dead code: break;
-
421 }-
422-
423 return QVariant();
executed 10 times by 1 test: return QVariant();
Executed by:
  • tst_qsslcertificate - unknown status
10
424}-
425-
426QSslCertificateExtension QSslCertificatePrivate::convertExtension(X509_EXTENSION *ext)-
427{-
428 QSslCertificateExtension result;-
429-
430 ASN1_OBJECT *obj = q_X509_EXTENSION_get_object(ext);-
431 QByteArray oid = QSslCertificatePrivate::asn1ObjectId(obj);-
432 QByteArray name = QSslCertificatePrivate::asn1ObjectName(obj);-
433-
434 result.d->oid = QString::fromUtf8(oid);-
435 result.d->name = QString::fromUtf8(name);-
436-
437 bool critical = q_X509_EXTENSION_get_critical(ext);-
438 result.d->critical = critical;-
439-
440 // Lets see if we have custom support for this one-
441 QVariant extensionValue = x509ExtensionToValue(ext);-
442 if (extensionValue.isValid()) {
extensionValue.isValid()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
8-10
443 result.d->value = extensionValue;-
444 result.d->supported = true;-
445-
446 return result;
executed 8 times by 1 test: return result;
Executed by:
  • tst_qsslcertificate - unknown status
8
447 }-
448-
449 extensionValue = x509UnknownExtensionToValue(ext);-
450 if (extensionValue.isValid()) {
extensionValue.isValid()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEnever evaluated
0-10
451 result.d->value = extensionValue;-
452 result.d->supported = false;-
453 return result;
executed 10 times by 1 test: return result;
Executed by:
  • tst_qsslcertificate - unknown status
10
454 }-
455-
456 return result;
never executed: return result;
0
457}-
458-
459QList<QSslCertificateExtension> QSslCertificate::extensions() const-
460{-
461 QList<QSslCertificateExtension> result;-
462-
463 if (!d->x509)
!d->x509Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
0-4
464 return result;
never executed: return result;
0
465-
466 int count = q_X509_get_ext_count(d->x509);-
467 result.reserve(count);-
468-
469 for (int i = 0; i < count; i++) {
i < countDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
4-18
470 X509_EXTENSION *ext = q_X509_get_ext(d->x509, i);-
471 result << QSslCertificatePrivate::convertExtension(ext);-
472 }
executed 18 times by 1 test: end of block
Executed by:
  • tst_qsslcertificate - unknown status
18
473-
474 return result;
executed 4 times by 1 test: return result;
Executed by:
  • tst_qsslcertificate - unknown status
4
475}-
476-
477QByteArray QSslCertificate::toPem() const-
478{-
479 if (!d->x509)
!d->x509Description
TRUEnever evaluated
FALSEevaluated 47 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
0-47
480 return QByteArray();
never executed: return QByteArray();
0
481 return d->QByteArray_from_X509(d->x509, QSsl::Pem);
executed 47 times by 1 test: return d->QByteArray_from_X509(d->x509, QSsl::Pem);
Executed by:
  • tst_qsslcertificate - unknown status
47
482}-
483-
484QByteArray QSslCertificate::toDer() const-
485{-
486 if (!d->x509)
!d->x509Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 89 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
1-89
487 return QByteArray();
executed 1 time by 1 test: return QByteArray();
Executed by:
  • tst_qsslcertificate - unknown status
1
488 return d->QByteArray_from_X509(d->x509, QSsl::Der);
executed 89 times by 1 test: return d->QByteArray_from_X509(d->x509, QSsl::Der);
Executed by:
  • tst_qsslcertificate - unknown status
89
489}-
490-
491QString QSslCertificate::toText() const-
492{-
493 if (!d->x509)
!d->x509Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
0-3
494 return QString();
never executed: return QString();
0
495 return d->text_from_X509(d->x509);
executed 3 times by 1 test: return d->text_from_X509(d->x509);
Executed by:
  • tst_qsslcertificate - unknown status
3
496}-
497-
498#define BEGINCERTSTRING "-----BEGIN CERTIFICATE-----"-
499#define ENDCERTSTRING "-----END CERTIFICATE-----"-
500-
501void QSslCertificatePrivate::init(const QByteArray &data, QSsl::EncodingFormat format)-
502{-
503 if (!data.isEmpty()) {
!data.isEmpty()Description
TRUEevaluated 73 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 30224 times by 16 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslellipticcurve - unknown status
  • tst_qsslerror - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
73-30224
504 QList<QSslCertificate> certs = (format == QSsl::Pem)
(format == QSsl::Pem)Description
TRUEevaluated 60 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 13 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
13-60
505 ? certificatesFromPem(data, 1)-
506 : certificatesFromDer(data, 1);-
507 if (!certs.isEmpty()) {
!certs.isEmpty()Description
TRUEevaluated 70 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
3-70
508 *this = *certs.first().d;-
509 if (x509)
x509Description
TRUEevaluated 70 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
FALSEnever evaluated
0-70
510 x509 = q_X509_dup(x509);
executed 70 times by 3 tests: x509 = q_X509_dup(x509);
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
70
511 }
executed 70 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
70
512 }
executed 73 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
73
513}
executed 30297 times by 16 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_qsslcertificate - unknown status
  • tst_qsslellipticcurve - unknown status
  • tst_qsslerror - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
30297
514-
515// ### refactor against QSsl::pemFromDer() etc. (to avoid redundant implementations)-
516QByteArray QSslCertificatePrivate::QByteArray_from_X509(X509 *x509, QSsl::EncodingFormat format)-
517{-
518 if (!x509) {
!x509Description
TRUEnever evaluated
FALSEevaluated 136 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
0-136
519 qCWarning(lcSsl, "QSslSocketBackendPrivate::X509_to_QByteArray: null X509");
never executed: QMessageLogger(__FILE__, 519, __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocketBackendPrivate::X509_to_QByteArray: null X509");
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
520 return QByteArray();
never executed: return QByteArray();
0
521 }-
522-
523 // Use i2d_X509 to convert the X509 to an array.-
524 int length = q_i2d_X509(x509, 0);-
525 QByteArray array;-
526 array.resize(length);-
527 char *data = array.data();-
528 char **dataP = &data;-
529 unsigned char **dataPu = (unsigned char **)dataP;-
530 if (q_i2d_X509(x509, dataPu) < 0)
q_i2d_X509(x509, dataPu) < 0Description
TRUEnever evaluated
FALSEevaluated 136 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
0-136
531 return QByteArray();
never executed: return QByteArray();
0
532-
533 if (format == QSsl::Der)
format == QSsl::DerDescription
TRUEevaluated 89 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 47 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
47-89
534 return array;
executed 89 times by 1 test: return array;
Executed by:
  • tst_qsslcertificate - unknown status
89
535-
536 // Convert to Base64 - wrap at 64 characters.-
537 array = array.toBase64();-
538 QByteArray tmp;-
539 for (int i = 0; i <= array.size() - 64; i += 64) {
i <= array.size() - 64Description
TRUEevaluated 518 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 47 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
47-518
540 tmp += QByteArray::fromRawData(array.data() + i, 64);-
541 tmp += '\n';-
542 }
executed 518 times by 1 test: end of block
Executed by:
  • tst_qsslcertificate - unknown status
518
543 if (int remainder = array.size() % 64) {
int remainder ...ay.size() % 64Description
TRUEevaluated 46 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
1-46
544 tmp += QByteArray::fromRawData(array.data() + array.size() - remainder, remainder);-
545 tmp += '\n';-
546 }
executed 46 times by 1 test: end of block
Executed by:
  • tst_qsslcertificate - unknown status
46
547-
548 return BEGINCERTSTRING "\n" + tmp + ENDCERTSTRING "\n";
executed 47 times by 1 test: return "-----BEGIN CERTIFICATE-----" "\n" + tmp + "-----END CERTIFICATE-----" "\n";
Executed by:
  • tst_qsslcertificate - unknown status
47
549}-
550-
551QString QSslCertificatePrivate::text_from_X509(X509 *x509)-
552{-
553 if (!x509) {
!x509Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
0-3
554 qCWarning(lcSsl, "QSslSocketBackendPrivate::text_from_X509: null X509");
never executed: QMessageLogger(__FILE__, 554, __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocketBackendPrivate::text_from_X509: null X509");
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
555 return QString();
never executed: return QString();
0
556 }-
557-
558 QByteArray result;-
559 BIO *bio = q_BIO_new(q_BIO_s_mem());-
560 if (!bio)
!bioDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
0-3
561 return QString();
never executed: return QString();
0
562-
563 q_X509_print(bio, x509);-
564-
565 QVarLengthArray<char, 16384> data;-
566 int count = q_BIO_read(bio, data.data(), 16384);-
567 if ( count > 0 ) {
count > 0Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEnever evaluated
0-3
568 result = QByteArray( data.data(), count );-
569 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_qsslcertificate - unknown status
3
570-
571 q_BIO_free(bio);-
572-
573 return QString::fromLatin1(result);
executed 3 times by 1 test: return QString::fromLatin1(result);
Executed by:
  • tst_qsslcertificate - unknown status
3
574}-
575-
576QByteArray QSslCertificatePrivate::asn1ObjectId(ASN1_OBJECT *object)-
577{-
578 char buf[80]; // The openssl docs a buffer length of 80 should be more than enough-
579 q_OBJ_obj2txt(buf, sizeof(buf), object, 1); // the 1 says always use the oid not the long name-
580-
581 return QByteArray(buf);
executed 20 times by 1 test: return QByteArray(buf);
Executed by:
  • tst_qsslcertificate - unknown status
20
582}-
583-
584-
585QByteArray QSslCertificatePrivate::asn1ObjectName(ASN1_OBJECT *object)-
586{-
587 int nid = q_OBJ_obj2nid(object);-
588 if (nid != NID_undef)
nid != 0Description
TRUEevaluated 2722 times by 8 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
2-2722
589 return QByteArray(q_OBJ_nid2sn(nid));
executed 2722 times by 8 tests: return QByteArray(q_OBJ_nid2sn(nid));
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
2722
590-
591 return asn1ObjectId(object);
executed 2 times by 1 test: return asn1ObjectId(object);
Executed by:
  • tst_qsslcertificate - unknown status
2
592}-
593-
594static QMap<QByteArray, QString> _q_mapFromX509Name(X509_NAME *name)-
595{-
596 QMap<QByteArray, QString> info;-
597 for (int i = 0; i < q_X509_NAME_entry_count(name); ++i) {
i < q_X509_NAM...ry_count(name)Description
TRUEevaluated 2702 times by 8 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
FALSEevaluated 429 times by 8 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
429-2702
598 X509_NAME_ENTRY *e = q_X509_NAME_get_entry(name, i);-
599-
600 QByteArray name = QSslCertificatePrivate::asn1ObjectName(q_X509_NAME_ENTRY_get_object(e));-
601 unsigned char *data = 0;-
602 int size = q_ASN1_STRING_to_UTF8(&data, q_X509_NAME_ENTRY_get_data(e));-
603 info.insertMulti(name, QString::fromUtf8((char*)data, size));-
604 q_CRYPTO_free(data);-
605 }
executed 2702 times by 8 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
2702
606-
607 return info;
executed 429 times by 8 tests: return info;
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
429
608}-
609-
610QSslCertificate QSslCertificatePrivate::QSslCertificate_from_X509(X509 *x509)-
611{-
612 QSslCertificate certificate;-
613 if (!x509 || !QSslSocket::supportsSsl())
!x509Description
TRUEevaluated 42 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
FALSEevaluated 20216 times by 8 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
!QSslSocket::supportsSsl()Description
TRUEnever evaluated
FALSEevaluated 20216 times by 8 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
0-20216
614 return certificate;
executed 42 times by 2 tests: return certificate;
Executed by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
42
615-
616 ASN1_TIME *nbef = q_X509_get_notBefore(x509);-
617 ASN1_TIME *naft = q_X509_get_notAfter(x509);-
618 certificate.d->notValidBefore = q_getTimeFromASN1(nbef);-
619 certificate.d->notValidAfter = q_getTimeFromASN1(naft);-
620 certificate.d->null = false;-
621 certificate.d->x509 = q_X509_dup(x509);-
622-
623 return certificate;
executed 20216 times by 8 tests: return certificate;
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
20216
624}-
625-
626static bool matchLineFeed(const QByteArray &pem, int *offset)-
627{-
628 char ch = 0;-
629-
630 // ignore extra whitespace at the end of the line-
631 while (*offset < pem.size() && (ch = pem.at(*offset)) == ' ')
*offset < pem.size()Description
TRUEevaluated 38308 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
(ch = pem.at(*offset)) == ' 'Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 38304 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
1-38308
632 ++*offset;
executed 4 times by 1 test: ++*offset;
Executed by:
  • tst_qsslcertificate - unknown status
4
633-
634 if (ch == '\n') {
ch == '\n'Description
TRUEevaluated 38304 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
1-38304
635 *offset += 1;-
636 return true;
executed 38304 times by 4 tests: return true;
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
38304
637 }-
638 if (ch == '\r' && pem.size() > (*offset + 1) && pem.at(*offset + 1) == '\n') {
ch == '\r'Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
pem.size() > (*offset + 1)Description
TRUEnever evaluated
FALSEnever evaluated
pem.at(*offset + 1) == '\n'Description
TRUEnever evaluated
FALSEnever evaluated
0-1
639 *offset += 2;-
640 return true;
never executed: return true;
0
641 }-
642 return false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_qsslcertificate - unknown status
1
643}-
644-
645QList<QSslCertificate> QSslCertificatePrivate::certificatesFromPem(const QByteArray &pem, int count)-
646{-
647 QList<QSslCertificate> certificates;-
648 QSslSocketPrivate::ensureInitialized();-
649-
650 int offset = 0;-
651 while (count == -1 || certificates.size() < count) {
count == -1Description
TRUEevaluated 28893 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
FALSEevaluated 118 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
certificates.size() < countDescription
TRUEevaluated 60 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 58 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
58-28893
652 int startPos = pem.indexOf(BEGINCERTSTRING, offset);-
653 if (startPos == -1)
startPos == -1Description
TRUEevaluated 9799 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
FALSEevaluated 19154 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
9799-19154
654 break;
executed 9799 times by 4 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
9799
655 startPos += sizeof(BEGINCERTSTRING) - 1;-
656 if (!matchLineFeed(pem, &startPos))
!matchLineFeed(pem, &startPos)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 19153 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
1-19153
657 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_qsslcertificate - unknown status
1
658-
659 int endPos = pem.indexOf(ENDCERTSTRING, startPos);-
660 if (endPos == -1)
endPos == -1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 19152 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
1-19152
661 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_qsslcertificate - unknown status
1
662-
663 offset = endPos + sizeof(ENDCERTSTRING) - 1;-
664 if (offset < pem.size() && !matchLineFeed(pem, &offset))
offset < pem.size()Description
TRUEevaluated 19151 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
!matchLineFeed(pem, &offset)Description
TRUEnever evaluated
FALSEevaluated 19151 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
0-19151
665 break;
never executed: break;
0
666-
667 QByteArray decoded = QByteArray::fromBase64(-
668 QByteArray::fromRawData(pem.data() + startPos, endPos - startPos));-
669 const unsigned char *data = (const unsigned char *)decoded.data();-
670-
671 if (X509 *x509 = q_d2i_X509(0, &data, decoded.size())) {
X509 *x509 = q...ecoded.size())Description
TRUEevaluated 19152 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
FALSEnever evaluated
0-19152
672 certificates << QSslCertificate_from_X509(x509);-
673 q_X509_free(x509);-
674 }
executed 19152 times by 4 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
19152
675 }
executed 19152 times by 4 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
19152
676-
677 return certificates;
executed 9859 times by 4 tests: return certificates;
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
9859
678}-
679-
680QList<QSslCertificate> QSslCertificatePrivate::certificatesFromDer(const QByteArray &der, int count)-
681{-
682 QList<QSslCertificate> certificates;-
683 QSslSocketPrivate::ensureInitialized();-
684-
685 const unsigned char *data = (const unsigned char *)der.data();-
686 int size = der.size();-
687-
688 while (size > 0 && (count == -1 || certificates.size() < count)) {
size > 0Description
TRUEevaluated 57 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
count == -1Description
TRUEevaluated 44 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 13 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
certificates.size() < countDescription
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEnever evaluated
0-57
689 if (X509 *x509 = q_d2i_X509(0, &data, size)) {
X509 *x509 = q..., &data, size)Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
FALSEevaluated 43 times by 1 test
Evaluated by:
  • tst_qsslcertificate - unknown status
14-43
690 certificates << QSslCertificate_from_X509(x509);-
691 q_X509_free(x509);-
692 } else {
executed 14 times by 1 test: end of block
Executed by:
  • tst_qsslcertificate - unknown status
14
693 break;
executed 43 times by 1 test: break;
Executed by:
  • tst_qsslcertificate - unknown status
43
694 }-
695 size -= ((const char *)data - der.data());-
696 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_qsslcertificate - unknown status
14
697-
698 return certificates;
executed 57 times by 1 test: return certificates;
Executed by:
  • tst_qsslcertificate - unknown status
57
699}-
700-
701QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

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