OpenCoverage

qcryptographichash.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qcryptographichash.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10typedef unsigned char BitSequence;-
11typedef unsigned long long DataLength;-
12typedef enum { SUCCESS = 0, FAIL = 1, BAD_HASHLEN = 2 } HashReturn;-
13-
14typedef spongeState hashState;-
15-
16-
17-
18-
19-
20typedef spongeState SHA3Context;-
21typedef HashReturn (SHA3Init)(hashState *state, int hashbitlen);-
22typedef HashReturn (SHA3Update)(hashState *state, const BitSequence *data, DataLength databitlen);-
23typedef HashReturn (SHA3Final)(hashState *state, BitSequence *hashval);-
24-
25-
26-
27-
28static SHA3Init * const sha3Init = Init;-
29static SHA3Update * const sha3Update = Update;-
30static SHA3Final * const sha3Final = Final;-
31static int SHA224_256AddLength(SHA256Context *context, unsigned int length);-
32static int SHA384_512AddLength(SHA512Context *context, unsigned int length);-
33-
34-
35-
36-
37-
38-
39-
40-
41-
42-
43-
44-
45static inline int SHA224_256AddLength(SHA256Context *context, unsigned int length)-
46{-
47 ::quint32 addTemp;-
48 return
executed 750 times by 2 tests: return (addTemp = (context)->Length_Low, (context)->Corrupted = (((context)->Length_Low += (length)) < addTemp) && (++(context)->Length_High == 0) ? shaInputTooLong : (context)->Corrupted );
Executed by:
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
(addTemp = (context)->Length_Low, (context)->Corrupted = (((context)->Length_Low += (length)) < addTemp) && (++(context)->Length_High == 0) ? shaInputTooLong : (context)->Corrupted );
executed 750 times by 2 tests: return (addTemp = (context)->Length_Low, (context)->Corrupted = (((context)->Length_Low += (length)) < addTemp) && (++(context)->Length_High == 0) ? shaInputTooLong : (context)->Corrupted );
Executed by:
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
750
49}-
50static inline int SHA384_512AddLength(SHA512Context *context, unsigned int length)-
51{-
52 ::quint64 addTemp;-
53 return
executed 24 times by 1 test: return (addTemp = context->Length_Low, context->Corrupted = ((context->Length_Low += length) < addTemp) && (++context->Length_High == 0) ? shaInputTooLong : (context)->Corrupted);
Executed by:
  • tst_QCryptographicHash
(addTemp = context->Length_Low, context->Corrupted = ((context->Length_Low += length) < addTemp) && (++context->Length_High == 0) ? shaInputTooLong : (context)->Corrupted);
executed 24 times by 1 test: return (addTemp = context->Length_Low, context->Corrupted = ((context->Length_Low += length) < addTemp) && (++context->Length_High == 0) ? shaInputTooLong : (context)->Corrupted);
Executed by:
  • tst_QCryptographicHash
24
54}-
55-
56-
57-
58-
59class QCryptographicHashPrivate-
60{-
61public:-
62 QCryptographicHash::Algorithm method;-
63 union {-
64 Sha1State sha1Context;-
65-
66 MD5Context md5Context;-
67 md4_context md4Context;-
68 SHA224Context sha224Context;-
69 SHA256Context sha256Context;-
70 SHA384Context sha384Context;-
71 SHA512Context sha512Context;-
72 SHA3Context sha3Context;-
73-
74 };-
75 QByteArray result;-
76};-
77QCryptographicHash::QCryptographicHash(Algorithm method)-
78 : d(new QCryptographicHashPrivate)-
79{-
80 d->method = method;-
81 reset();-
82}
executed 10730 times by 24 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMessageAuthenticationCode
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QUuid
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
10730
83-
84-
85-
86-
87QCryptographicHash::~QCryptographicHash()-
88{-
89 delete d;-
90}
executed 10730 times by 24 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMessageAuthenticationCode
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QUuid
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
10730
91-
92-
93-
94-
95void QCryptographicHash::reset()-
96{-
97 switch (d->method) {-
98 case
executed 7726 times by 12 tests: case Sha1:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSslCertificate
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
Sha1:
executed 7726 times by 12 tests: case Sha1:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSslCertificate
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
7726
99 sha1InitState(&d->sha1Context);-
100 break;
executed 7726 times by 12 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSslCertificate
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
7726
101-
102-
103-
104-
105-
106-
107 case
executed 8 times by 2 tests: case Md4:
Executed by:
  • tst_QAuthenticator
  • tst_QCryptographicHash
Md4:
executed 8 times by 2 tests: case Md4:
Executed by:
  • tst_QAuthenticator
  • tst_QCryptographicHash
8
108 md4_init(&d->md4Context);-
109 break;
executed 8 times by 2 tests: break;
Executed by:
  • tst_QAuthenticator
  • tst_QCryptographicHash
8
110 case
executed 3078 times by 19 tests: case Md5:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMessageAuthenticationCode
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QUuid
  • tst_QXmlInputSource
  • tst_Spdy
Md5:
executed 3078 times by 19 tests: case Md5:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMessageAuthenticationCode
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QUuid
  • tst_QXmlInputSource
  • tst_Spdy
3078
111 MD5Init(&d->md5Context);-
112 break;
executed 3078 times by 19 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMessageAuthenticationCode
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QUuid
  • tst_QXmlInputSource
  • tst_Spdy
3078
113 case
executed 4 times by 1 test: case Sha224:
Executed by:
  • tst_QCryptographicHash
Sha224:
executed 4 times by 1 test: case Sha224:
Executed by:
  • tst_QCryptographicHash
4
114 SHA224Reset(&d->sha224Context);-
115 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
4
116 case
executed 16 times by 2 tests: case Sha256:
Executed by:
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
Sha256:
executed 16 times by 2 tests: case Sha256:
Executed by:
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
16
117 SHA256Reset(&d->sha256Context);-
118 break;
executed 16 times by 2 tests: break;
Executed by:
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
16
119 case
executed 4 times by 1 test: case Sha384:
Executed by:
  • tst_QCryptographicHash
Sha384:
executed 4 times by 1 test: case Sha384:
Executed by:
  • tst_QCryptographicHash
4
120 SHA384Reset(&d->sha384Context);-
121 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
4
122 case
executed 4 times by 1 test: case Sha512:
Executed by:
  • tst_QCryptographicHash
Sha512:
executed 4 times by 1 test: case Sha512:
Executed by:
  • tst_QCryptographicHash
4
123 SHA512Reset(&d->sha512Context);-
124 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
4
125 case
executed 6 times by 1 test: case Sha3_224:
Executed by:
  • tst_QCryptographicHash
Sha3_224:
executed 6 times by 1 test: case Sha3_224:
Executed by:
  • tst_QCryptographicHash
6
126 sha3Init(&d->sha3Context, 224);-
127 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
6
128 case
executed 6 times by 1 test: case Sha3_256:
Executed by:
  • tst_QCryptographicHash
Sha3_256:
executed 6 times by 1 test: case Sha3_256:
Executed by:
  • tst_QCryptographicHash
6
129 sha3Init(&d->sha3Context, 256);-
130 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
6
131 case
executed 6 times by 1 test: case Sha3_384:
Executed by:
  • tst_QCryptographicHash
Sha3_384:
executed 6 times by 1 test: case Sha3_384:
Executed by:
  • tst_QCryptographicHash
6
132 sha3Init(&d->sha3Context, 384);-
133 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
6
134 case
executed 6 times by 1 test: case Sha3_512:
Executed by:
  • tst_QCryptographicHash
Sha3_512:
executed 6 times by 1 test: case Sha3_512:
Executed by:
  • tst_QCryptographicHash
6
135 sha3Init(&d->sha3Context, 512);-
136 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
6
137-
138 }-
139 d->result.clear();-
140}
executed 10864 times by 24 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMessageAuthenticationCode
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QUuid
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
10864
141-
142-
143-
144-
145-
146void QCryptographicHash::addData(const char *data, int length)-
147{-
148 switch (d->method) {-
149 case
executed 7734 times by 12 tests: case Sha1:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSslCertificate
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
Sha1:
executed 7734 times by 12 tests: case Sha1:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSslCertificate
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
7734
150 sha1Update(&d->sha1Context, (const unsigned char *)data, length);-
151 break;
executed 7734 times by 12 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSslCertificate
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
7734
152-
153-
154-
155-
156-
157-
158 case
executed 8 times by 2 tests: case Md4:
Executed by:
  • tst_QAuthenticator
  • tst_QCryptographicHash
Md4:
executed 8 times by 2 tests: case Md4:
Executed by:
  • tst_QAuthenticator
  • tst_QCryptographicHash
8
159 md4_update(&d->md4Context, (const unsigned char *)data, length);-
160 break;
executed 8 times by 2 tests: break;
Executed by:
  • tst_QAuthenticator
  • tst_QCryptographicHash
8
161 case
executed 3646 times by 19 tests: case Md5:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMessageAuthenticationCode
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QUuid
  • tst_QXmlInputSource
  • tst_Spdy
Md5:
executed 3646 times by 19 tests: case Md5:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMessageAuthenticationCode
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QUuid
  • tst_QXmlInputSource
  • tst_Spdy
3646
162 MD5Update(&d->md5Context, (const unsigned char *)data, length);-
163 break;
executed 3646 times by 19 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMessageAuthenticationCode
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QUuid
  • tst_QXmlInputSource
  • tst_Spdy
3646
164 case
executed 4 times by 1 test: case Sha224:
Executed by:
  • tst_QCryptographicHash
Sha224:
executed 4 times by 1 test: case Sha224:
Executed by:
  • tst_QCryptographicHash
4
165 SHA224Input(&d->sha224Context, reinterpret_cast<const unsigned char *>(data), length);-
166 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
4
167 case
executed 22 times by 2 tests: case Sha256:
Executed by:
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
Sha256:
executed 22 times by 2 tests: case Sha256:
Executed by:
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
22
168 SHA256Input(&d->sha256Context, reinterpret_cast<const unsigned char *>(data), length);-
169 break;
executed 22 times by 2 tests: break;
Executed by:
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
22
170 case
executed 4 times by 1 test: case Sha384:
Executed by:
  • tst_QCryptographicHash
Sha384:
executed 4 times by 1 test: case Sha384:
Executed by:
  • tst_QCryptographicHash
4
171 SHA384Input(&d->sha384Context, reinterpret_cast<const unsigned char *>(data), length);-
172 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
4
173 case
executed 4 times by 1 test: case Sha512:
Executed by:
  • tst_QCryptographicHash
Sha512:
executed 4 times by 1 test: case Sha512:
Executed by:
  • tst_QCryptographicHash
4
174 SHA512Input(&d->sha512Context, reinterpret_cast<const unsigned char *>(data), length);-
175 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
4
176 case
executed 6 times by 1 test: case Sha3_224:
Executed by:
  • tst_QCryptographicHash
Sha3_224:
executed 6 times by 1 test: case Sha3_224:
Executed by:
  • tst_QCryptographicHash
6
177 sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8);-
178 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
6
179 case
executed 6 times by 1 test: case Sha3_256:
Executed by:
  • tst_QCryptographicHash
Sha3_256:
executed 6 times by 1 test: case Sha3_256:
Executed by:
  • tst_QCryptographicHash
6
180 sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8);-
181 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
6
182 case
executed 6 times by 1 test: case Sha3_384:
Executed by:
  • tst_QCryptographicHash
Sha3_384:
executed 6 times by 1 test: case Sha3_384:
Executed by:
  • tst_QCryptographicHash
6
183 sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8);-
184 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
6
185 case
executed 6 times by 1 test: case Sha3_512:
Executed by:
  • tst_QCryptographicHash
Sha3_512:
executed 6 times by 1 test: case Sha3_512:
Executed by:
  • tst_QCryptographicHash
6
186 sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8);-
187 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
6
188-
189 }-
190 d->result.clear();-
191}
executed 11446 times by 24 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMessageAuthenticationCode
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QUuid
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
11446
192-
193-
194-
195-
196void QCryptographicHash::addData(const QByteArray &data)-
197{-
198 addData(data.constData(), data.length());-
199}
executed 11117 times by 24 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMessageAuthenticationCode
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QUuid
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
11117
200-
201-
202-
203-
204-
205-
206bool QCryptographicHash::addData(QIODevice* device)-
207{-
208 if (!device->isReadable()
!device->isReadable()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QCryptographicHash
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QCryptographicHash
)
2
209 return
executed 2 times by 1 test: return false;
Executed by:
  • tst_QCryptographicHash
false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_QCryptographicHash
2
210-
211 if (!device->isOpen()
!device->isOpen()Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QCryptographicHash
)
0-2
212 return
never executed: return false;
false;
never executed: return false;
0
213-
214 char buffer[1024];-
215 int length;-
216-
217 while ((
(length = devi...(buffer))) > 0Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QCryptographicHash
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QCryptographicHash
length = device->read(buffer,sizeof(buffer))) > 0
(length = devi...(buffer))) > 0Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QCryptographicHash
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QCryptographicHash
)
2-9
218 addData(buffer,length);
executed 9 times by 1 test: addData(buffer,length);
Executed by:
  • tst_QCryptographicHash
9
219-
220 return
executed 2 times by 1 test: return device->atEnd();
Executed by:
  • tst_QCryptographicHash
device->atEnd();
executed 2 times by 1 test: return device->atEnd();
Executed by:
  • tst_QCryptographicHash
2
221}-
222-
223-
224-
225-
226-
227-
228-
229QByteArray QCryptographicHash::result() const-
230{-
231 if (!d->result.isEmpty()
!d->result.isEmpty()Description
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_QCryptographicHash
FALSEevaluated 10830 times by 24 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMessageAuthenticationCode
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QUuid
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
)
22-10830
232 return
executed 22 times by 1 test: return d->result;
Executed by:
  • tst_QCryptographicHash
d->result;
executed 22 times by 1 test: return d->result;
Executed by:
  • tst_QCryptographicHash
22
233-
234 switch (d->method) {-
235 case
executed 7722 times by 12 tests: case Sha1:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSslCertificate
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
Sha1:
executed 7722 times by 12 tests: case Sha1:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSslCertificate
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
{
7722
236 Sha1State copy = d->sha1Context;-
237 d->result.resize(20);-
238 sha1FinalizeState(&copy);-
239 sha1ToHash(&copy, (unsigned char *)d->result.data());-
240 break;
executed 7722 times by 12 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSslCertificate
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QUuid
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
7722
241 }-
242-
243-
244-
245-
246-
247-
248 case
executed 8 times by 2 tests: case Md4:
Executed by:
  • tst_QAuthenticator
  • tst_QCryptographicHash
Md4:
executed 8 times by 2 tests: case Md4:
Executed by:
  • tst_QAuthenticator
  • tst_QCryptographicHash
{
8
249 md4_context copy = d->md4Context;-
250 d->result.resize((128/8));-
251 md4_final(&copy, (unsigned char *)d->result.data());-
252 break;
executed 8 times by 2 tests: break;
Executed by:
  • tst_QAuthenticator
  • tst_QCryptographicHash
8
253 }-
254 case
executed 3052 times by 19 tests: case Md5:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMessageAuthenticationCode
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QUuid
  • tst_QXmlInputSource
  • tst_Spdy
Md5:
executed 3052 times by 19 tests: case Md5:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMessageAuthenticationCode
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QUuid
  • tst_QXmlInputSource
  • tst_Spdy
{
3052
255 MD5Context copy = d->md5Context;-
256 d->result.resize(16);-
257 MD5Final(&copy, (unsigned char *)d->result.data());-
258 break;
executed 3052 times by 19 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMessageAuthenticationCode
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QUuid
  • tst_QXmlInputSource
  • tst_Spdy
3052
259 }-
260 case
executed 4 times by 1 test: case Sha224:
Executed by:
  • tst_QCryptographicHash
Sha224:
executed 4 times by 1 test: case Sha224:
Executed by:
  • tst_QCryptographicHash
{
4
261 SHA224Context copy = d->sha224Context;-
262 d->result.resize(SHA224HashSize);-
263 SHA224Result(&copy, reinterpret_cast<unsigned char *>(d->result.data()));-
264 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
4
265 }-
266 case
executed 12 times by 2 tests: case Sha256:
Executed by:
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
Sha256:
executed 12 times by 2 tests: case Sha256:
Executed by:
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
{
12
267 SHA256Context copy = d->sha256Context;-
268 d->result.resize(SHA256HashSize);-
269 SHA256Result(&copy, reinterpret_cast<unsigned char *>(d->result.data()));-
270 break;
executed 12 times by 2 tests: break;
Executed by:
  • tst_QCryptographicHash
  • tst_QMessageAuthenticationCode
12
271 }-
272 case
executed 4 times by 1 test: case Sha384:
Executed by:
  • tst_QCryptographicHash
Sha384:
executed 4 times by 1 test: case Sha384:
Executed by:
  • tst_QCryptographicHash
{
4
273 SHA384Context copy = d->sha384Context;-
274 d->result.resize(SHA384HashSize);-
275 SHA384Result(&copy, reinterpret_cast<unsigned char *>(d->result.data()));-
276 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
4
277 }-
278 case
executed 4 times by 1 test: case Sha512:
Executed by:
  • tst_QCryptographicHash
Sha512:
executed 4 times by 1 test: case Sha512:
Executed by:
  • tst_QCryptographicHash
{
4
279 SHA512Context copy = d->sha512Context;-
280 d->result.resize(SHA512HashSize);-
281 SHA512Result(&copy, reinterpret_cast<unsigned char *>(d->result.data()));-
282 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
4
283 }-
284 case
executed 6 times by 1 test: case Sha3_224:
Executed by:
  • tst_QCryptographicHash
Sha3_224:
executed 6 times by 1 test: case Sha3_224:
Executed by:
  • tst_QCryptographicHash
{
6
285 SHA3Context copy = d->sha3Context;-
286 d->result.resize(224/8);-
287 sha3Final(&copy, reinterpret_cast<BitSequence *>(d->result.data()));-
288 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
6
289 }-
290 case
executed 6 times by 1 test: case Sha3_256:
Executed by:
  • tst_QCryptographicHash
Sha3_256:
executed 6 times by 1 test: case Sha3_256:
Executed by:
  • tst_QCryptographicHash
{
6
291 SHA3Context copy = d->sha3Context;-
292 d->result.resize(256/8);-
293 sha3Final(&copy, reinterpret_cast<BitSequence *>(d->result.data()));-
294 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
6
295 }-
296 case
executed 6 times by 1 test: case Sha3_384:
Executed by:
  • tst_QCryptographicHash
Sha3_384:
executed 6 times by 1 test: case Sha3_384:
Executed by:
  • tst_QCryptographicHash
{
6
297 SHA3Context copy = d->sha3Context;-
298 d->result.resize(384/8);-
299 sha3Final(&copy, reinterpret_cast<BitSequence *>(d->result.data()));-
300 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
6
301 }-
302 case
executed 6 times by 1 test: case Sha3_512:
Executed by:
  • tst_QCryptographicHash
Sha3_512:
executed 6 times by 1 test: case Sha3_512:
Executed by:
  • tst_QCryptographicHash
{
6
303 SHA3Context copy = d->sha3Context;-
304 d->result.resize(512/8);-
305 sha3Final(&copy, reinterpret_cast<BitSequence *>(d->result.data()));-
306 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QCryptographicHash
6
307 }-
308-
309 }-
310 return
executed 10830 times by 24 tests: return d->result;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMessageAuthenticationCode
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QUuid
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
d->result;
executed 10830 times by 24 tests: return d->result;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMessageAuthenticationCode
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QUuid
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
10830
311}-
312-
313-
314-
315-
316QByteArray QCryptographicHash::hash(const QByteArray &data, Algorithm method)-
317{-
318 QCryptographicHash hash(method);-
319 hash.addData(data);-
320 return
executed 10309 times by 22 tests: return hash.result();
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
hash.result();
executed 10309 times by 22 tests: return hash.result();
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QCryptographicHash
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QTcpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
10309
321}-
322-
323-
Switch to Source codePreprocessed file

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