Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - | 2 | ** | - | 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - | 4 | ** Contact: http://www.qt-project.org/legal | - | 5 | ** | - | 6 | ** This file is part of the Qt Toolkit. | - | 7 | ** | - | 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | 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 Digia. For licensing terms and | - | 14 | ** conditions see http://qt.digia.com/licensing. For further information | - | 15 | ** use the contact form at http://qt.digia.com/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 as published by the Free Software | - | 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - | 21 | ** packaging of this file. Please review the following information to | - | 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - | 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | 24 | ** | - | 25 | ** In addition, as a special exception, Digia gives you certain additional | - | 26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - | 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | 28 | ** | - | 29 | ** GNU General Public License Usage | - | 30 | ** Alternatively, this file may be used under the terms of the GNU | - | 31 | ** General Public License version 3.0 as published by the Free Software | - | 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - | 33 | ** packaging of this file. Please review the following information to | - | 34 | ** ensure the GNU General Public License version 3.0 requirements will be | - | 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - | 36 | ** | - | 37 | ** | - | 38 | ** $QT_END_LICENSE$ | - | 39 | ** | - | 40 | ****************************************************************************/ | - | 41 | | - | 42 | /* | - | 43 | Based on the public domain implementation of the SHA-1 algorithm | - | 44 | Copyright (C) Dominik Reichl <dominik.reichl@t-online.de> | - | 45 | */ | - | 46 | #include <QtCore/qendian.h> | - | 47 | | - | 48 | #ifdef Q_CC_MSVC | - | 49 | # include <stdlib.h> | - | 50 | #endif | - | 51 | | - | 52 | QT_BEGIN_NAMESPACE | - | 53 | | - | 54 | // Test Vectors (from FIPS PUB 180-1) | - | 55 | // | - | 56 | // SHA1("abc") = | - | 57 | // A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D | - | 58 | // | - | 59 | // SHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq") = | - | 60 | // 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 | - | 61 | // | - | 62 | // SHA1(A million repetitions of "a") = | - | 63 | // 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F | - | 64 | // | - | 65 | | - | 66 | | - | 67 | // #define or #undef this, if you want the to wipe all | - | 68 | // temporary variables after processing | - | 69 | #define SHA1_WIPE_VARIABLES | - | 70 | | - | 71 | | - | 72 | struct Sha1State | - | 73 | { | - | 74 | quint32 h0; | - | 75 | quint32 h1; | - | 76 | quint32 h2; | - | 77 | quint32 h3; | - | 78 | quint32 h4; | - | 79 | | - | 80 | quint64 messageSize; | - | 81 | unsigned char buffer[64]; | - | 82 | }; | - | 83 | | - | 84 | | - | 85 | typedef union | - | 86 | { | - | 87 | quint8 bytes[64]; | - | 88 | quint32 words[16]; | - | 89 | } Sha1Chunk; | - | 90 | | - | 91 | static inline quint32 rol32(quint32 value, unsigned int shift) | - | 92 | { | - | 93 | #ifdef Q_CC_MSVC | - | 94 | return _rotl(value, shift); | - | 95 | #else | - | 96 | return ((value << shift) | (value >> (32 - shift))); executed: return ((value << shift) | (value >> (32 - shift))); Execution Count:3638656 | 3638656 | 97 | #endif | - | 98 | } | - | 99 | | - | 100 | static inline quint32 sha1Word(Sha1Chunk *chunk, const uint position) | - | 101 | { | - | 102 | return (chunk->words[position & 0xf] = rol32( chunk->words[(position+13) & 0xf] executed: return (chunk->words[position & 0xf] = rol32( chunk->words[(position+13) & 0xf] ^ chunk->words[(position+ 8) & 0xf] ^ chunk->words[(position+ 2) & 0xf] ^ chunk->words[(position) & 0xf], 1)); Execution Count:1039616 | 1039616 | 103 | ^ chunk->words[(position+ 8) & 0xf] executed: return (chunk->words[position & 0xf] = rol32( chunk->words[(position+13) & 0xf] ^ chunk->words[(position+ 8) & 0xf] ^ chunk->words[(position+ 2) & 0xf] ^ chunk->words[(position) & 0xf], 1)); Execution Count:1039616 | 1039616 | 104 | ^ chunk->words[(position+ 2) & 0xf] executed: return (chunk->words[position & 0xf] = rol32( chunk->words[(position+13) & 0xf] ^ chunk->words[(position+ 8) & 0xf] ^ chunk->words[(position+ 2) & 0xf] ^ chunk->words[(position) & 0xf], 1)); Execution Count:1039616 | 1039616 | 105 | ^ chunk->words[(position) & 0xf], 1)); executed: return (chunk->words[position & 0xf] = rol32( chunk->words[(position+13) & 0xf] ^ chunk->words[(position+ 8) & 0xf] ^ chunk->words[(position+ 2) & 0xf] ^ chunk->words[(position) & 0xf], 1)); Execution Count:1039616 | 1039616 | 106 | } | - | 107 | | - | 108 | static inline void sha1Round0(Sha1Chunk *chunk, const uint position, | - | 109 | quint32 &v, quint32 &w, quint32 &x, quint32 &y, quint32 &z) | - | 110 | { | - | 111 | z += ((( w & (x ^ y)) ^ y) + chunk->words[position] + 0x5A827999 + rol32(v, 5)); executed (the execution status of this line is deduced): z += ((( w & (x ^ y)) ^ y) + chunk->words[position] + 0x5A827999 + rol32(v, 5)); | - | 112 | w = rol32(w, 30); executed (the execution status of this line is deduced): w = rol32(w, 30); | - | 113 | } executed: } Execution Count:259904 | 259904 | 114 | | - | 115 | static inline void sha1Round1(Sha1Chunk *chunk, const uint position, | - | 116 | quint32 &v, quint32 &w, quint32 &x, quint32 &y, quint32 &z) | - | 117 | { | - | 118 | z += ((( w & (x ^ y)) ^ y) + sha1Word(chunk,position) + 0x5A827999 + rol32(v, 5)); executed (the execution status of this line is deduced): z += ((( w & (x ^ y)) ^ y) + sha1Word(chunk,position) + 0x5A827999 + rol32(v, 5)); | - | 119 | w = rol32(w, 30); executed (the execution status of this line is deduced): w = rol32(w, 30); | - | 120 | } executed: } Execution Count:64976 | 64976 | 121 | | - | 122 | static inline void sha1Round2(Sha1Chunk *chunk, const uint position, | - | 123 | quint32 &v, quint32 &w, quint32 &x, quint32 &y, quint32 &z) | - | 124 | { | - | 125 | z += (( w ^ x ^ y) + sha1Word(chunk, position) + 0x6ED9EBA1 + rol32(v, 5)); executed (the execution status of this line is deduced): z += (( w ^ x ^ y) + sha1Word(chunk, position) + 0x6ED9EBA1 + rol32(v, 5)); | - | 126 | w = rol32(w, 30); executed (the execution status of this line is deduced): w = rol32(w, 30); | - | 127 | } executed: } Execution Count:324880 | 324880 | 128 | | - | 129 | static inline void sha1Round3(Sha1Chunk *chunk, const uint position, | - | 130 | quint32 &v, quint32 &w, quint32 &x, quint32 &y, quint32 &z) | - | 131 | { | - | 132 | z += (((( w | x) & y) | (w & x)) + sha1Word(chunk, position) + 0x8F1BBCDC + rol32(v, 5)); executed (the execution status of this line is deduced): z += (((( w | x) & y) | (w & x)) + sha1Word(chunk, position) + 0x8F1BBCDC + rol32(v, 5)); | - | 133 | w = rol32(w, 30); executed (the execution status of this line is deduced): w = rol32(w, 30); | - | 134 | } executed: } Execution Count:324880 | 324880 | 135 | | - | 136 | static inline void sha1Round4(Sha1Chunk *chunk, const uint position, | - | 137 | quint32 &v, quint32 &w, quint32 &x, quint32 &y, quint32 &z) | - | 138 | { | - | 139 | z += ((w ^ x ^ y) + sha1Word(chunk, position) + 0xCA62C1D6 + rol32(v, 5)); executed (the execution status of this line is deduced): z += ((w ^ x ^ y) + sha1Word(chunk, position) + 0xCA62C1D6 + rol32(v, 5)); | - | 140 | w = rol32(w, 30); executed (the execution status of this line is deduced): w = rol32(w, 30); | - | 141 | } executed: } Execution Count:324880 | 324880 | 142 | | - | 143 | static inline void sha1ProcessChunk(Sha1State *state, const unsigned char *buffer) | - | 144 | { | - | 145 | // Copy state[] to working vars | - | 146 | quint32 a = state->h0; executed (the execution status of this line is deduced): quint32 a = state->h0; | - | 147 | quint32 b = state->h1; executed (the execution status of this line is deduced): quint32 b = state->h1; | - | 148 | quint32 c = state->h2; executed (the execution status of this line is deduced): quint32 c = state->h2; | - | 149 | quint32 d = state->h3; executed (the execution status of this line is deduced): quint32 d = state->h3; | - | 150 | quint32 e = state->h4; executed (the execution status of this line is deduced): quint32 e = state->h4; | - | 151 | | - | 152 | quint8 chunkBuffer[64]; executed (the execution status of this line is deduced): quint8 chunkBuffer[64]; | - | 153 | memcpy(chunkBuffer, buffer, 64); executed (the execution status of this line is deduced): memcpy(chunkBuffer, buffer, 64); | - | 154 | | - | 155 | Sha1Chunk *chunk = reinterpret_cast<Sha1Chunk*>(&chunkBuffer); executed (the execution status of this line is deduced): Sha1Chunk *chunk = reinterpret_cast<Sha1Chunk*>(&chunkBuffer); | - | 156 | | - | 157 | for (int i = 0; i < 16; ++i) evaluated: i < 16 yes Evaluation Count:259904 | yes Evaluation Count:16244 |
| 16244-259904 | 158 | chunk->words[i] = qFromBigEndian(chunk->words[i]); executed: chunk->words[i] = qFromBigEndian(chunk->words[i]); Execution Count:259904 | 259904 | 159 | | - | 160 | sha1Round0(chunk, 0, a,b,c,d,e); sha1Round0(chunk, 1, e,a,b,c,d); sha1Round0(chunk, 2, d,e,a,b,c); sha1Round0(chunk, 3, c,d,e,a,b); executed (the execution status of this line is deduced): sha1Round0(chunk, 0, a,b,c,d,e); sha1Round0(chunk, 1, e,a,b,c,d); sha1Round0(chunk, 2, d,e,a,b,c); sha1Round0(chunk, 3, c,d,e,a,b); | - | 161 | sha1Round0(chunk, 4, b,c,d,e,a); sha1Round0(chunk, 5, a,b,c,d,e); sha1Round0(chunk, 6, e,a,b,c,d); sha1Round0(chunk, 7, d,e,a,b,c); executed (the execution status of this line is deduced): sha1Round0(chunk, 4, b,c,d,e,a); sha1Round0(chunk, 5, a,b,c,d,e); sha1Round0(chunk, 6, e,a,b,c,d); sha1Round0(chunk, 7, d,e,a,b,c); | - | 162 | sha1Round0(chunk, 8, c,d,e,a,b); sha1Round0(chunk, 9, b,c,d,e,a); sha1Round0(chunk, 10, a,b,c,d,e); sha1Round0(chunk, 11, e,a,b,c,d); executed (the execution status of this line is deduced): sha1Round0(chunk, 8, c,d,e,a,b); sha1Round0(chunk, 9, b,c,d,e,a); sha1Round0(chunk, 10, a,b,c,d,e); sha1Round0(chunk, 11, e,a,b,c,d); | - | 163 | sha1Round0(chunk, 12, d,e,a,b,c); sha1Round0(chunk, 13, c,d,e,a,b); sha1Round0(chunk, 14, b,c,d,e,a); sha1Round0(chunk, 15, a,b,c,d,e); executed (the execution status of this line is deduced): sha1Round0(chunk, 12, d,e,a,b,c); sha1Round0(chunk, 13, c,d,e,a,b); sha1Round0(chunk, 14, b,c,d,e,a); sha1Round0(chunk, 15, a,b,c,d,e); | - | 164 | sha1Round1(chunk, 16, e,a,b,c,d); sha1Round1(chunk, 17, d,e,a,b,c); sha1Round1(chunk, 18, c,d,e,a,b); sha1Round1(chunk, 19, b,c,d,e,a); executed (the execution status of this line is deduced): sha1Round1(chunk, 16, e,a,b,c,d); sha1Round1(chunk, 17, d,e,a,b,c); sha1Round1(chunk, 18, c,d,e,a,b); sha1Round1(chunk, 19, b,c,d,e,a); | - | 165 | sha1Round2(chunk, 20, a,b,c,d,e); sha1Round2(chunk, 21, e,a,b,c,d); sha1Round2(chunk, 22, d,e,a,b,c); sha1Round2(chunk, 23, c,d,e,a,b); executed (the execution status of this line is deduced): sha1Round2(chunk, 20, a,b,c,d,e); sha1Round2(chunk, 21, e,a,b,c,d); sha1Round2(chunk, 22, d,e,a,b,c); sha1Round2(chunk, 23, c,d,e,a,b); | - | 166 | sha1Round2(chunk, 24, b,c,d,e,a); sha1Round2(chunk, 25, a,b,c,d,e); sha1Round2(chunk, 26, e,a,b,c,d); sha1Round2(chunk, 27, d,e,a,b,c); executed (the execution status of this line is deduced): sha1Round2(chunk, 24, b,c,d,e,a); sha1Round2(chunk, 25, a,b,c,d,e); sha1Round2(chunk, 26, e,a,b,c,d); sha1Round2(chunk, 27, d,e,a,b,c); | - | 167 | sha1Round2(chunk, 28, c,d,e,a,b); sha1Round2(chunk, 29, b,c,d,e,a); sha1Round2(chunk, 30, a,b,c,d,e); sha1Round2(chunk, 31, e,a,b,c,d); executed (the execution status of this line is deduced): sha1Round2(chunk, 28, c,d,e,a,b); sha1Round2(chunk, 29, b,c,d,e,a); sha1Round2(chunk, 30, a,b,c,d,e); sha1Round2(chunk, 31, e,a,b,c,d); | - | 168 | sha1Round2(chunk, 32, d,e,a,b,c); sha1Round2(chunk, 33, c,d,e,a,b); sha1Round2(chunk, 34, b,c,d,e,a); sha1Round2(chunk, 35, a,b,c,d,e); executed (the execution status of this line is deduced): sha1Round2(chunk, 32, d,e,a,b,c); sha1Round2(chunk, 33, c,d,e,a,b); sha1Round2(chunk, 34, b,c,d,e,a); sha1Round2(chunk, 35, a,b,c,d,e); | - | 169 | sha1Round2(chunk, 36, e,a,b,c,d); sha1Round2(chunk, 37, d,e,a,b,c); sha1Round2(chunk, 38, c,d,e,a,b); sha1Round2(chunk, 39, b,c,d,e,a); executed (the execution status of this line is deduced): sha1Round2(chunk, 36, e,a,b,c,d); sha1Round2(chunk, 37, d,e,a,b,c); sha1Round2(chunk, 38, c,d,e,a,b); sha1Round2(chunk, 39, b,c,d,e,a); | - | 170 | sha1Round3(chunk, 40, a,b,c,d,e); sha1Round3(chunk, 41, e,a,b,c,d); sha1Round3(chunk, 42, d,e,a,b,c); sha1Round3(chunk, 43, c,d,e,a,b); executed (the execution status of this line is deduced): sha1Round3(chunk, 40, a,b,c,d,e); sha1Round3(chunk, 41, e,a,b,c,d); sha1Round3(chunk, 42, d,e,a,b,c); sha1Round3(chunk, 43, c,d,e,a,b); | - | 171 | sha1Round3(chunk, 44, b,c,d,e,a); sha1Round3(chunk, 45, a,b,c,d,e); sha1Round3(chunk, 46, e,a,b,c,d); sha1Round3(chunk, 47, d,e,a,b,c); executed (the execution status of this line is deduced): sha1Round3(chunk, 44, b,c,d,e,a); sha1Round3(chunk, 45, a,b,c,d,e); sha1Round3(chunk, 46, e,a,b,c,d); sha1Round3(chunk, 47, d,e,a,b,c); | - | 172 | sha1Round3(chunk, 48, c,d,e,a,b); sha1Round3(chunk, 49, b,c,d,e,a); sha1Round3(chunk, 50, a,b,c,d,e); sha1Round3(chunk, 51, e,a,b,c,d); executed (the execution status of this line is deduced): sha1Round3(chunk, 48, c,d,e,a,b); sha1Round3(chunk, 49, b,c,d,e,a); sha1Round3(chunk, 50, a,b,c,d,e); sha1Round3(chunk, 51, e,a,b,c,d); | - | 173 | sha1Round3(chunk, 52, d,e,a,b,c); sha1Round3(chunk, 53, c,d,e,a,b); sha1Round3(chunk, 54, b,c,d,e,a); sha1Round3(chunk, 55, a,b,c,d,e); executed (the execution status of this line is deduced): sha1Round3(chunk, 52, d,e,a,b,c); sha1Round3(chunk, 53, c,d,e,a,b); sha1Round3(chunk, 54, b,c,d,e,a); sha1Round3(chunk, 55, a,b,c,d,e); | - | 174 | sha1Round3(chunk, 56, e,a,b,c,d); sha1Round3(chunk, 57, d,e,a,b,c); sha1Round3(chunk, 58, c,d,e,a,b); sha1Round3(chunk, 59, b,c,d,e,a); executed (the execution status of this line is deduced): sha1Round3(chunk, 56, e,a,b,c,d); sha1Round3(chunk, 57, d,e,a,b,c); sha1Round3(chunk, 58, c,d,e,a,b); sha1Round3(chunk, 59, b,c,d,e,a); | - | 175 | sha1Round4(chunk, 60, a,b,c,d,e); sha1Round4(chunk, 61, e,a,b,c,d); sha1Round4(chunk, 62, d,e,a,b,c); sha1Round4(chunk, 63, c,d,e,a,b); executed (the execution status of this line is deduced): sha1Round4(chunk, 60, a,b,c,d,e); sha1Round4(chunk, 61, e,a,b,c,d); sha1Round4(chunk, 62, d,e,a,b,c); sha1Round4(chunk, 63, c,d,e,a,b); | - | 176 | sha1Round4(chunk, 64, b,c,d,e,a); sha1Round4(chunk, 65, a,b,c,d,e); sha1Round4(chunk, 66, e,a,b,c,d); sha1Round4(chunk, 67, d,e,a,b,c); executed (the execution status of this line is deduced): sha1Round4(chunk, 64, b,c,d,e,a); sha1Round4(chunk, 65, a,b,c,d,e); sha1Round4(chunk, 66, e,a,b,c,d); sha1Round4(chunk, 67, d,e,a,b,c); | - | 177 | sha1Round4(chunk, 68, c,d,e,a,b); sha1Round4(chunk, 69, b,c,d,e,a); sha1Round4(chunk, 70, a,b,c,d,e); sha1Round4(chunk, 71, e,a,b,c,d); executed (the execution status of this line is deduced): sha1Round4(chunk, 68, c,d,e,a,b); sha1Round4(chunk, 69, b,c,d,e,a); sha1Round4(chunk, 70, a,b,c,d,e); sha1Round4(chunk, 71, e,a,b,c,d); | - | 178 | sha1Round4(chunk, 72, d,e,a,b,c); sha1Round4(chunk, 73, c,d,e,a,b); sha1Round4(chunk, 74, b,c,d,e,a); sha1Round4(chunk, 75, a,b,c,d,e); executed (the execution status of this line is deduced): sha1Round4(chunk, 72, d,e,a,b,c); sha1Round4(chunk, 73, c,d,e,a,b); sha1Round4(chunk, 74, b,c,d,e,a); sha1Round4(chunk, 75, a,b,c,d,e); | - | 179 | sha1Round4(chunk, 76, e,a,b,c,d); sha1Round4(chunk, 77, d,e,a,b,c); sha1Round4(chunk, 78, c,d,e,a,b); sha1Round4(chunk, 79, b,c,d,e,a); executed (the execution status of this line is deduced): sha1Round4(chunk, 76, e,a,b,c,d); sha1Round4(chunk, 77, d,e,a,b,c); sha1Round4(chunk, 78, c,d,e,a,b); sha1Round4(chunk, 79, b,c,d,e,a); | - | 180 | | - | 181 | // Add the working vars back into state | - | 182 | state->h0 += a; executed (the execution status of this line is deduced): state->h0 += a; | - | 183 | state->h1 += b; executed (the execution status of this line is deduced): state->h1 += b; | - | 184 | state->h2 += c; executed (the execution status of this line is deduced): state->h2 += c; | - | 185 | state->h3 += d; executed (the execution status of this line is deduced): state->h3 += d; | - | 186 | state->h4 += e; executed (the execution status of this line is deduced): state->h4 += e; | - | 187 | | - | 188 | // Wipe variables | - | 189 | #ifdef SHA1_WIPE_VARIABLES | - | 190 | a = b = c = d = e = 0; executed (the execution status of this line is deduced): a = b = c = d = e = 0; | - | 191 | memset(chunkBuffer, 0, 64); executed (the execution status of this line is deduced): memset(chunkBuffer, 0, 64); | - | 192 | #endif | - | 193 | } executed: } Execution Count:16244 | 16244 | 194 | | - | 195 | static inline void sha1InitState(Sha1State *state) | - | 196 | { | - | 197 | state->h0 = 0x67452301; executed (the execution status of this line is deduced): state->h0 = 0x67452301; | - | 198 | state->h1 = 0xEFCDAB89; executed (the execution status of this line is deduced): state->h1 = 0xEFCDAB89; | - | 199 | state->h2 = 0x98BADCFE; executed (the execution status of this line is deduced): state->h2 = 0x98BADCFE; | - | 200 | state->h3 = 0x10325476; executed (the execution status of this line is deduced): state->h3 = 0x10325476; | - | 201 | state->h4 = 0xC3D2E1F0; executed (the execution status of this line is deduced): state->h4 = 0xC3D2E1F0; | - | 202 | | - | 203 | state->messageSize = 0; executed (the execution status of this line is deduced): state->messageSize = 0; | - | 204 | } executed: } Execution Count:361 | 361 | 205 | | - | 206 | static inline void sha1Update(Sha1State *state, const unsigned char *data, qint64 len) | - | 207 | { | - | 208 | quint32 rest = static_cast<quint32>(state->messageSize & Q_UINT64_C(63)); executed (the execution status of this line is deduced): quint32 rest = static_cast<quint32>(state->messageSize & static_cast<unsigned long long>(63ULL)); | - | 209 | | - | 210 | quint64 availableData = static_cast<quint64>(len) + static_cast<quint64>(rest); executed (the execution status of this line is deduced): quint64 availableData = static_cast<quint64>(len) + static_cast<quint64>(rest); | - | 211 | state->messageSize += len; executed (the execution status of this line is deduced): state->messageSize += len; | - | 212 | | - | 213 | if (availableData < Q_UINT64_C(64)) { evaluated: availableData < static_cast<unsigned long long>(64ULL) yes Evaluation Count:855 | yes Evaluation Count:592 |
| 592-855 | 214 | memcpy(&state->buffer[rest], &data[0], len); executed (the execution status of this line is deduced): memcpy(&state->buffer[rest], &data[0], len); | - | 215 | | - | 216 | } else { executed: } Execution Count:855 | 855 | 217 | qint64 i = static_cast<qint64>(64 - rest); executed (the execution status of this line is deduced): qint64 i = static_cast<qint64>(64 - rest); | - | 218 | memcpy(&state->buffer[rest], &data[0], static_cast<qint32>(i)); executed (the execution status of this line is deduced): memcpy(&state->buffer[rest], &data[0], static_cast<qint32>(i)); | - | 219 | sha1ProcessChunk(state, state->buffer); executed (the execution status of this line is deduced): sha1ProcessChunk(state, state->buffer); | - | 220 | | - | 221 | qint64 lastI = len - ((len + rest) & Q_INT64_C(63)); executed (the execution status of this line is deduced): qint64 lastI = len - ((len + rest) & static_cast<long long>(63LL)); | - | 222 | for( ; i < lastI; i += 64) evaluated: i < lastI yes Evaluation Count:15652 | yes Evaluation Count:592 |
| 592-15652 | 223 | sha1ProcessChunk(state, &data[i]); executed: sha1ProcessChunk(state, &data[i]); Execution Count:15652 | 15652 | 224 | | - | 225 | memcpy(&state->buffer[0], &data[i], len - i); executed (the execution status of this line is deduced): memcpy(&state->buffer[0], &data[i], len - i); | - | 226 | } executed: } Execution Count:592 | 592 | 227 | } | - | 228 | | - | 229 | static inline void sha1FinalizeState(Sha1State *state) | - | 230 | { | - | 231 | quint64 messageSize = state->messageSize; executed (the execution status of this line is deduced): quint64 messageSize = state->messageSize; | - | 232 | unsigned char sizeInBits[8]; executed (the execution status of this line is deduced): unsigned char sizeInBits[8]; | - | 233 | qToBigEndian(messageSize << 3, sizeInBits); executed (the execution status of this line is deduced): qToBigEndian(messageSize << 3, sizeInBits); | - | 234 | | - | 235 | sha1Update(state, (const unsigned char *)"\200", 1); executed (the execution status of this line is deduced): sha1Update(state, (const unsigned char *)"\200", 1); | - | 236 | | - | 237 | unsigned char zero[64]; executed (the execution status of this line is deduced): unsigned char zero[64]; | - | 238 | memset(zero, 0, 64); executed (the execution status of this line is deduced): memset(zero, 0, 64); | - | 239 | if (static_cast<int>(messageSize & 63) > 56 - 1) { evaluated: static_cast<int>(messageSize & 63) > 56 - 1 yes Evaluation Count:1 | yes Evaluation Count:360 |
| 1-360 | 240 | sha1Update(state, zero, 64 - 1 - static_cast<int>(messageSize & 63)); executed (the execution status of this line is deduced): sha1Update(state, zero, 64 - 1 - static_cast<int>(messageSize & 63)); | - | 241 | sha1Update(state, zero, 64 - 8); executed (the execution status of this line is deduced): sha1Update(state, zero, 64 - 8); | - | 242 | } else { executed: } Execution Count:1 | 1 | 243 | sha1Update(state, zero, 64 - 1 - 8 - static_cast<int>(messageSize & 63)); executed (the execution status of this line is deduced): sha1Update(state, zero, 64 - 1 - 8 - static_cast<int>(messageSize & 63)); | - | 244 | } executed: } Execution Count:360 | 360 | 245 | | - | 246 | sha1Update(state, sizeInBits, 8); executed (the execution status of this line is deduced): sha1Update(state, sizeInBits, 8); | - | 247 | #ifdef SHA1_WIPE_VARIABLES | - | 248 | memset(state->buffer, 0, 64); executed (the execution status of this line is deduced): memset(state->buffer, 0, 64); | - | 249 | memset(zero, 0, 64); executed (the execution status of this line is deduced): memset(zero, 0, 64); | - | 250 | state->messageSize = 0; executed (the execution status of this line is deduced): state->messageSize = 0; | - | 251 | #endif | - | 252 | } executed: } Execution Count:361 | 361 | 253 | | - | 254 | static inline void sha1ToHash(Sha1State *state, unsigned char* buffer) | - | 255 | { | - | 256 | qToBigEndian(state->h0, buffer); executed (the execution status of this line is deduced): qToBigEndian(state->h0, buffer); | - | 257 | qToBigEndian(state->h1, buffer + 4); executed (the execution status of this line is deduced): qToBigEndian(state->h1, buffer + 4); | - | 258 | qToBigEndian(state->h2, buffer + 8); executed (the execution status of this line is deduced): qToBigEndian(state->h2, buffer + 8); | - | 259 | qToBigEndian(state->h3, buffer + 12); executed (the execution status of this line is deduced): qToBigEndian(state->h3, buffer + 12); | - | 260 | qToBigEndian(state->h4, buffer + 16); executed (the execution status of this line is deduced): qToBigEndian(state->h4, buffer + 16); | - | 261 | } executed: } Execution Count:361 | 361 | 262 | | - | 263 | QT_END_NAMESPACE | - | 264 | | - | | | |
|