OpenCoverage

gcm128.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/modes/gcm128.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2static void gcm_init_4bit(u128 Htable[16], u64 H[2])-
3{-
4 u128 V;-
5-
6-
7-
8-
9 Htable[0].hi = 0;-
10 Htable[0].lo = 0;-
11 V.hi = H[0];-
12 V.lo = H[1];-
13 Htable[8] = V;-
14 do { if (sizeof(size_t)==8
sizeof(size_t)==8Description
TRUEevaluated 7990 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
) { u64 T = 0xe100000000000000ULL & (0-(V.lo&1)); V.lo = (V.hi<<63)|(V.lo>>1); V.hi = (V.hi>>1 )^T; }
executed 7990 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
else { u32 T = 0xe1000000U & (0-(u32)(V.lo&1)); V.lo = (V.hi<<63)|(V.lo>>1); V.hi = (V.hi>>1 )^((u64)T<<32); }
never executed: end of block
} while(0);
0-7990
15 Htable[4] = V;-
16 do { if (sizeof(size_t)==8
sizeof(size_t)==8Description
TRUEevaluated 7990 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
) { u64 T = 0xe100000000000000ULL & (0-(V.lo&1)); V.lo = (V.hi<<63)|(V.lo>>1); V.hi = (V.hi>>1 )^T; }
executed 7990 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
else { u32 T = 0xe1000000U & (0-(u32)(V.lo&1)); V.lo = (V.hi<<63)|(V.lo>>1); V.hi = (V.hi>>1 )^((u64)T<<32); }
never executed: end of block
} while(0);
0-7990
17 Htable[2] = V;-
18 do { if (sizeof(size_t)==8
sizeof(size_t)==8Description
TRUEevaluated 7990 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
) { u64 T = 0xe100000000000000ULL & (0-(V.lo&1)); V.lo = (V.hi<<63)|(V.lo>>1); V.hi = (V.hi>>1 )^T; }
executed 7990 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
else { u32 T = 0xe1000000U & (0-(u32)(V.lo&1)); V.lo = (V.hi<<63)|(V.lo>>1); V.hi = (V.hi>>1 )^((u64)T<<32); }
never executed: end of block
} while(0);
0-7990
19 Htable[1] = V;-
20 Htable[3].hi = V.hi ^ Htable[2].hi, Htable[3].lo = V.lo ^ Htable[2].lo;-
21 V = Htable[4];-
22 Htable[5].hi = V.hi ^ Htable[1].hi, Htable[5].lo = V.lo ^ Htable[1].lo;-
23 Htable[6].hi = V.hi ^ Htable[2].hi, Htable[6].lo = V.lo ^ Htable[2].lo;-
24 Htable[7].hi = V.hi ^ Htable[3].hi, Htable[7].lo = V.lo ^ Htable[3].lo;-
25 V = Htable[8];-
26 Htable[9].hi = V.hi ^ Htable[1].hi, Htable[9].lo = V.lo ^ Htable[1].lo;-
27 Htable[10].hi = V.hi ^ Htable[2].hi, Htable[10].lo = V.lo ^ Htable[2].lo;-
28 Htable[11].hi = V.hi ^ Htable[3].hi, Htable[11].lo = V.lo ^ Htable[3].lo;-
29 Htable[12].hi = V.hi ^ Htable[4].hi, Htable[12].lo = V.lo ^ Htable[4].lo;-
30 Htable[13].hi = V.hi ^ Htable[5].hi, Htable[13].lo = V.lo ^ Htable[5].lo;-
31 Htable[14].hi = V.hi ^ Htable[6].hi, Htable[14].lo = V.lo ^ Htable[6].lo;-
32 Htable[15].hi = V.hi ^ Htable[7].hi, Htable[15].lo = V.lo ^ Htable[7].lo;-
33}
executed 7990 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
7990
34void gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16]);-
35void gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16], const u8 *inp,-
36 size_t len);-
37extern unsigned int OPENSSL_ia32cap_P[];-
38-
39void gcm_init_clmul(u128 Htable[16], const u64 Xi[2]);-
40void gcm_gmult_clmul(u64 Xi[2], const u128 Htable[16]);-
41void gcm_ghash_clmul(u64 Xi[2], const u128 Htable[16], const u8 *inp,-
42 size_t len);-
43-
44-
45-
46-
47-
48-
49void gcm_init_avx(u128 Htable[16], const u64 Xi[2]);-
50void gcm_gmult_avx(u64 Xi[2], const u128 Htable[16]);-
51void gcm_ghash_avx(u64 Xi[2], const u128 Htable[16], const u8 *inp,-
52 size_t len);-
53void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block)-
54{-
55 const union {-
56 long one;-
57 char little;-
58 } is_endian = { 1 };-
59-
60 memset(ctx, 0, sizeof(*ctx));-
61 ctx->block = block;-
62 ctx->key = key;-
63-
64 (*block) (ctx->H.c, ctx->H.c, key);-
65-
66 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 7990 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
) {
0-7990
67-
68-
69 ctx->H.u[0] = ({ u64 ret_=(ctx->H.u[0]); asm ("bswapq %0" : "+r"(ret_)); ret_; });-
70 ctx->H.u[1] = ({ u64 ret_=(ctx->H.u[1]); asm ("bswapq %0" : "+r"(ret_)); ret_; });-
71 }
executed 7990 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
7990
72 if (OPENSSL_ia32cap_P[1] & (1 << 1)
OPENSSL_ia32ca...[1] & (1 << 1)Description
TRUEnever evaluated
FALSEevaluated 7990 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
0-7990
73 if (((
((OPENSSL_ia32... 0x41) == 0x41Description
TRUEnever evaluated
FALSEnever evaluated
OPENSSL_ia32cap_P[1] >> 22) & 0x41) == 0x41
((OPENSSL_ia32... 0x41) == 0x41Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
74 gcm_init_avx(ctx->Htable, ctx->H.u);-
75 ctx->gmult = gcm_gmult_avx;-
76 (ctx->ghash = (gcm_ghash_avx));-
77 }
never executed: end of block
else {
0
78 gcm_init_clmul(ctx->Htable, ctx->H.u);-
79 ctx->gmult = gcm_gmult_clmul;-
80 (ctx->ghash = (gcm_ghash_clmul));-
81 }
never executed: end of block
0
82 return;
never executed: return;
0
83 }-
84-
85 gcm_init_4bit(ctx->Htable, ctx->H.u);-
86 ctx->gmult = gcm_gmult_4bit;-
87 (ctx->ghash = (gcm_ghash_4bit));-
88}
executed 7990 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
7990
89-
90void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv,-
91 size_t len)-
92{-
93 const union {-
94 long one;-
95 char little;-
96 } is_endian = { 1 };-
97 unsigned int ctr;-
98-
99 void (*gcm_gmult_p) (u64 Xi[2], const u128 Htable[16]) = ctx->gmult;-
100-
101-
102 ctx->len.u[0] = 0;-
103 ctx->len.u[1] = 0;-
104 ctx->ares = 0;-
105 ctx->mres = 0;-
106-
107 if (len == 12
len == 12Description
TRUEevaluated 31380 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 233 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
233-31380
108 memcpy(ctx->Yi.c, iv, 12);-
109 ctx->Yi.c[12] = 0;-
110 ctx->Yi.c[13] = 0;-
111 ctx->Yi.c[14] = 0;-
112 ctx->Yi.c[15] = 1;-
113 ctr = 1;-
114 }
executed 31380 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
else {
31380
115 size_t i;-
116 u64 len0 = len;-
117-
118-
119 ctx->Xi.u[0] = 0;-
120 ctx->Xi.u[1] = 0;-
121-
122 while (len >= 16
len >= 16Description
TRUEevaluated 539 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 233 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
233-539
123 for (i = 0; i < 16
i < 16Description
TRUEevaluated 8624 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 539 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
; ++i)
539-8624
124 ctx->Xi.c[i] ^= iv[i];
executed 8624 times by 2 tests: ctx->Xi.c[i] ^= iv[i];
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
8624
125 (*gcm_gmult_p)(ctx->Xi.u,ctx->Htable);-
126 iv += 16;-
127 len -= 16;-
128 }
executed 539 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
539
129 if (len
lenDescription
TRUEevaluated 159 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 74 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
74-159
130 for (i = 0; i < len
i < lenDescription
TRUEevaluated 1596 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 159 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
; ++i)
159-1596
131 ctx->Xi.c[i] ^= iv[i];
executed 1596 times by 2 tests: ctx->Xi.c[i] ^= iv[i];
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
1596
132 (*gcm_gmult_p)(ctx->Xi.u,ctx->Htable);-
133 }
executed 159 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
159
134 len0 <<= 3;-
135 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 233 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
) {
0-233
136-
137 ctx->Xi.u[1] ^= ({ u64 ret_=(len0); asm ("bswapq %0" : "+r"(ret_)); ret_; });-
138 }
executed 233 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
else {
233
139 ctx->Xi.u[1] ^= len0;-
140 }
never executed: end of block
0
141-
142 (*gcm_gmult_p)(ctx->Xi.u,ctx->Htable);-
143-
144 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 233 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
)
0-233
145-
146 ctr = ({ u32 ret_=(ctx->Xi.d[3]); asm ("bswapl %0" : "+r"(ret_)); ret_; });
executed 233 times by 2 tests: ctr = ({ u32 ret_=(ctx->Xi.d[3]); asm ("bswapl %0" : "+r"(ret_)); ret_; });
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
233
147-
148-
149-
150 else-
151 ctr = ctx->Xi.d[3];
never executed: ctr = ctx->Xi.d[3];
0
152-
153-
154 ctx->Yi.u[0] = ctx->Xi.u[0];-
155 ctx->Yi.u[1] = ctx->Xi.u[1];-
156 }
executed 233 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
233
157-
158 ctx->Xi.u[0] = 0;-
159 ctx->Xi.u[1] = 0;-
160-
161 (*ctx->block) (ctx->Yi.c, ctx->EK0.c, ctx->key);-
162 ++ctr;-
163 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 31613 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
)
0-31613
164-
165 ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
executed 31613 times by 2 tests: ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
31613
166-
167-
168-
169 else-
170 ctx->Yi.d[3] = ctr;
never executed: ctx->Yi.d[3] = ctr;
0
171}-
172-
173int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad,-
174 size_t len)-
175{-
176 size_t i;-
177 unsigned int n;-
178 u64 alen = ctx->len.u[0];-
179-
180 void (*gcm_gmult_p) (u64 Xi[2], const u128 Htable[16]) = ctx->gmult;-
181-
182 void (*gcm_ghash_p) (u64 Xi[2], const u128 Htable[16],-
183 const u8 *inp, size_t len) = ctx->ghash;-
184-
185-
186-
187 if (ctx->len.u[1]
ctx->len.u[1]Description
TRUEnever evaluated
FALSEevaluated 31713 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
)
0-31713
188 return
never executed: return -2;
-2;
never executed: return -2;
0
189-
190 alen += len;-
191 if (alen > (1ULL << 61)
alen > (1ULL << 61)Description
TRUEnever evaluated
FALSEevaluated 31713 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
|| (sizeof(len) == 8
sizeof(len) == 8Description
TRUEevaluated 31713 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
&& alen < len
alen < lenDescription
TRUEnever evaluated
FALSEevaluated 31713 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
))
0-31713
192 return
never executed: return -1;
-1;
never executed: return -1;
0
193 ctx->len.u[0] = alen;-
194-
195 n = ctx->ares;-
196 if (n
nDescription
TRUEevaluated 312 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 31401 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
312-31401
197 while (n
nDescription
TRUEevaluated 2532 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 156 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& len
lenDescription
TRUEevaluated 2376 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 156 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
156-2532
198 ctx->Xi.c[n] ^= *(aad++);-
199 --len;-
200 n = (n + 1) % 16;-
201 }
executed 2376 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
2376
202 if (n == 0
n == 0Description
TRUEevaluated 156 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 156 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
156
203 (*
executed 156 times by 1 test: (*gcm_gmult_p)(ctx->Xi.u,ctx->Htable);
Executed by:
  • libcrypto.so.1.1
gcm_gmult_p)(ctx->Xi.u,ctx->Htable);
executed 156 times by 1 test: (*gcm_gmult_p)(ctx->Xi.u,ctx->Htable);
Executed by:
  • libcrypto.so.1.1
156
204 else {-
205 ctx->ares = n;-
206 return
executed 156 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 156 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
156
207 }-
208 }-
209-
210 if ((
(i = (len & (size_t)-16))Description
TRUEevaluated 167 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 31390 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
i = (len & (size_t)-16))
(i = (len & (size_t)-16))Description
TRUEevaluated 167 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 31390 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
167-31390
211 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,aad,i);-
212 aad += i;-
213 len -= i;-
214 }
executed 167 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
167
215 if (len
lenDescription
TRUEevaluated 31315 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 242 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
242-31315
216 n = (unsigned int)len;-
217 for (i = 0; i < len
i < lenDescription
TRUEevaluated 201110 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 31315 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
; ++i)
31315-201110
218 ctx->Xi.c[i] ^= aad[i];
executed 201110 times by 2 tests: ctx->Xi.c[i] ^= aad[i];
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
201110
219 }
executed 31315 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
31315
220-
221 ctx->ares = n;-
222 return
executed 31557 times by 2 tests: return 0;
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
0;
executed 31557 times by 2 tests: return 0;
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
31557
223}-
224-
225int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx,-
226 const unsigned char *in, unsigned char *out,-
227 size_t len)-
228{-
229 const union {-
230 long one;-
231 char little;-
232 } is_endian = { 1 };-
233 unsigned int n, ctr, mres;-
234 size_t i;-
235 u64 mlen = ctx->len.u[1];-
236 block128_f block = ctx->block;-
237 void *key = ctx->key;-
238-
239 void (*gcm_gmult_p) (u64 Xi[2], const u128 Htable[16]) = ctx->gmult;-
240-
241 void (*gcm_ghash_p) (u64 Xi[2], const u128 Htable[16],-
242 const u8 *inp, size_t len) = ctx->ghash;-
243-
244-
245-
246 mlen += len;-
247 if (mlen > ((1ULL << 36) - 32)
mlen > ((1ULL << 36) - 32)Description
TRUEnever evaluated
FALSEevaluated 270 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
|| (sizeof(len) == 8
sizeof(len) == 8Description
TRUEevaluated 270 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
&& mlen < len
mlen < lenDescription
TRUEnever evaluated
FALSEevaluated 270 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
))
0-270
248 return
never executed: return -1;
-1;
never executed: return -1;
0
249 ctx->len.u[1] = mlen;-
250-
251 mres = ctx->mres;-
252-
253 if (ctx->ares
ctx->aresDescription
TRUEevaluated 239 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 31 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
31-239
254-
255-
256 if (len == 0
len == 0Description
TRUEnever evaluated
FALSEevaluated 239 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
0-239
257 (*gcm_gmult_p)(ctx->Xi.u,ctx->Htable);-
258 ctx->ares = 0;-
259 return
never executed: return 0;
0;
never executed: return 0;
0
260 }-
261 memcpy(ctx->Xn, ctx->Xi.c, sizeof(ctx->Xi));-
262 ctx->Xi.u[0] = 0;-
263 ctx->Xi.u[1] = 0;-
264 mres = sizeof(ctx->Xi);-
265-
266-
267-
268 ctx->ares = 0;-
269 }
executed 239 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
239
270-
271 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 270 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
)
0-270
272-
273 ctr = ({ u32 ret_=(ctx->Yi.d[3]); asm ("bswapl %0" : "+r"(ret_)); ret_; });
executed 270 times by 2 tests: ctr = ({ u32 ret_=(ctx->Yi.d[3]); asm ("bswapl %0" : "+r"(ret_)); ret_; });
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
270
274-
275-
276-
277 else-
278 ctr = ctx->Yi.d[3];
never executed: ctr = ctx->Yi.d[3];
0
279-
280 n = mres % 16;-
281-
282 if (16 % sizeof(size_t) == 0
16 % sizeof(size_t) == 0Description
TRUEevaluated 270 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
) {
0-270
283 do {-
284 if (n
nDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 246 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
24-246
285-
286 while (n
nDescription
TRUEevaluated 192 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 24 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& len
lenDescription
TRUEevaluated 192 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-192
287 ctx->Xn[mres++] = *(out++) = *(in++) ^ ctx->EKi.c[n];-
288 --len;-
289 n = (n + 1) % 16;-
290 }
executed 192 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
192
291 if (n == 0
n == 0Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-24
292 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,ctx->Xn,mres);-
293 mres = 0;-
294 }
executed 24 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
24
295 ctx->mres = mres;-
296 return
never executed: return 0;
0;
never executed: return 0;
0
297 }-
298 }-
299-
300-
301-
302-
303-
304 if (len >= 16
len >= 16Description
TRUEevaluated 185 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 85 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& mres
mresDescription
TRUEevaluated 166 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 19 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
19-185
305 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,ctx->Xn,mres);-
306 mres = 0;-
307 }
executed 166 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
166
308-
309 while (len >= (3*1024)
len >= (3*1024)Description
TRUEnever evaluated
FALSEevaluated 270 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
0-270
310 size_t j = (3*1024);-
311-
312 while (j
jDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
313 size_t *out_t = (size_t *)out;-
314 const size_t *in_t = (const size_t *)in;-
315-
316 (*block) (ctx->Yi.c, ctx->EKi.c, key);-
317 ++ctr;-
318 if (is_endian.little
is_endian.littleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
319-
320 ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
never executed: ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
0
321-
322-
323-
324 else-
325 ctx->Yi.d[3] = ctr;
never executed: ctx->Yi.d[3] = ctr;
0
326 for (i = 0; i < 16 / sizeof(size_t)
i < 16 / sizeof(size_t)Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
327 out_t[i] = in_t[i] ^ ctx->EKi.t[i];
never executed: out_t[i] = in_t[i] ^ ctx->EKi.t[i];
0
328 out += 16;-
329 in += 16;-
330 j -= 16;-
331 }
never executed: end of block
0
332 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,out - (3*1024),(3*1024));-
333 len -= (3*1024);-
334 }
never executed: end of block
0
335-
336 if ((
(i = (len & (size_t)-16))Description
TRUEevaluated 185 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 85 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
i = (len & (size_t)-16))
(i = (len & (size_t)-16))Description
TRUEevaluated 185 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 85 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
85-185
337 size_t j = i;-
338-
339 while (len >= 16
len >= 16Description
TRUEevaluated 2425 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 185 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
185-2425
340 size_t *out_t = (size_t *)out;-
341 const size_t *in_t = (const size_t *)in;-
342-
343 (*block) (ctx->Yi.c, ctx->EKi.c, key);-
344 ++ctr;-
345 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 2425 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
)
0-2425
346-
347 ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
executed 2425 times by 2 tests: ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
2425
348-
349-
350-
351 else-
352 ctx->Yi.d[3] = ctr;
never executed: ctx->Yi.d[3] = ctr;
0
353 for (i = 0; i < 16 / sizeof(size_t)
i < 16 / sizeof(size_t)Description
TRUEevaluated 4850 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 2425 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
; ++i)
2425-4850
354 out_t[i] = in_t[i] ^ ctx->EKi.t[i];
executed 4850 times by 2 tests: out_t[i] = in_t[i] ^ ctx->EKi.t[i];
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
4850
355 out += 16;-
356 in += 16;-
357 len -= 16;-
358 }
executed 2425 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
2425
359 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,out - j,j);-
360 }
executed 185 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
185
361 if (len
lenDescription
TRUEevaluated 154 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 116 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
116-154
362 (*block) (ctx->Yi.c, ctx->EKi.c, key);-
363 ++ctr;-
364 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 154 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
)
0-154
365-
366 ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
executed 154 times by 2 tests: ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
154
367-
368-
369-
370 else-
371 ctx->Yi.d[3] = ctr;
never executed: ctx->Yi.d[3] = ctr;
0
372-
373 while (len--
len--Description
TRUEevaluated 900 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 154 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
154-900
374 ctx->Xn[mres++] = out[n] = in[n] ^ ctx->EKi.c[n];-
375 ++n;-
376 }
executed 900 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
900
377-
378-
379-
380-
381-
382-
383-
384 }
executed 154 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
154
385-
386 ctx->mres = mres;-
387 return
executed 270 times by 2 tests: return 0;
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
0;
executed 270 times by 2 tests: return 0;
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
270
388 } while (0);-
389 }
never executed: end of block
0
390-
391 for (i = 0; i < len
i < lenDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
392 if (n == 0
n == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
393 (*block) (ctx->Yi.c, ctx->EKi.c, key);-
394 ++ctr;-
395 if (is_endian.little
is_endian.littleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
396-
397 ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
never executed: ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
0
398-
399-
400-
401 else-
402 ctx->Yi.d[3] = ctr;
never executed: ctx->Yi.d[3] = ctr;
0
403 }-
404-
405 ctx->Xn[mres++] = out[i] = in[i] ^ ctx->EKi.c[n];-
406 n = (n + 1) % 16;-
407 if (mres == sizeof(ctx->Xn)
mres == sizeof(ctx->Xn)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
408 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,ctx->Xn,sizeof(ctx->Xn));-
409 mres = 0;-
410 }
never executed: end of block
0
411-
412-
413-
414-
415-
416-
417 }
never executed: end of block
0
418-
419 ctx->mres = mres;-
420 return
never executed: return 0;
0;
never executed: return 0;
0
421}-
422-
423int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,-
424 const unsigned char *in, unsigned char *out,-
425 size_t len)-
426{-
427 const union {-
428 long one;-
429 char little;-
430 } is_endian = { 1 };-
431 unsigned int n, ctr, mres;-
432 size_t i;-
433 u64 mlen = ctx->len.u[1];-
434 block128_f block = ctx->block;-
435 void *key = ctx->key;-
436-
437 void (*gcm_gmult_p) (u64 Xi[2], const u128 Htable[16]) = ctx->gmult;-
438-
439 void (*gcm_ghash_p) (u64 Xi[2], const u128 Htable[16],-
440 const u8 *inp, size_t len) = ctx->ghash;-
441-
442-
443-
444 mlen += len;-
445 if (mlen > ((1ULL << 36) - 32)
mlen > ((1ULL << 36) - 32)Description
TRUEnever evaluated
FALSEevaluated 175 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
|| (sizeof(len) == 8
sizeof(len) == 8Description
TRUEevaluated 175 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
&& mlen < len
mlen < lenDescription
TRUEnever evaluated
FALSEevaluated 175 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
))
0-175
446 return
never executed: return -1;
-1;
never executed: return -1;
0
447 ctx->len.u[1] = mlen;-
448-
449 mres = ctx->mres;-
450-
451 if (ctx->ares
ctx->aresDescription
TRUEevaluated 144 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 31 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
31-144
452-
453-
454 if (len == 0
len == 0Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 141 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
3-141
455 (*gcm_gmult_p)(ctx->Xi.u,ctx->Htable);-
456 ctx->ares = 0;-
457 return
executed 3 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 3 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
3
458 }-
459 memcpy(ctx->Xn, ctx->Xi.c, sizeof(ctx->Xi));-
460 ctx->Xi.u[0] = 0;-
461 ctx->Xi.u[1] = 0;-
462 mres = sizeof(ctx->Xi);-
463-
464-
465-
466 ctx->ares = 0;-
467 }
executed 141 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
141
468-
469 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 172 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
)
0-172
470-
471 ctr = ({ u32 ret_=(ctx->Yi.d[3]); asm ("bswapl %0" : "+r"(ret_)); ret_; });
executed 172 times by 2 tests: ctr = ({ u32 ret_=(ctx->Yi.d[3]); asm ("bswapl %0" : "+r"(ret_)); ret_; });
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
172
472-
473-
474-
475 else-
476 ctr = ctx->Yi.d[3];
never executed: ctr = ctx->Yi.d[3];
0
477-
478 n = mres % 16;-
479-
480 if (16 % sizeof(size_t) == 0
16 % sizeof(size_t) == 0Description
TRUEevaluated 172 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
) {
0-172
481 do {-
482 if (n
nDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 148 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
24-148
483-
484 while (n
nDescription
TRUEevaluated 192 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 24 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& len
lenDescription
TRUEevaluated 192 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-192
485 *(out++) = (ctx->Xn[mres++] = *(in++)) ^ ctx->EKi.c[n];-
486 --len;-
487 n = (n + 1) % 16;-
488 }
executed 192 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
192
489 if (n == 0
n == 0Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-24
490 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,ctx->Xn,mres);-
491 mres = 0;-
492 }
executed 24 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
24
493 ctx->mres = mres;-
494 return
never executed: return 0;
0;
never executed: return 0;
0
495 }-
496 }-
497-
498-
499-
500-
501-
502 if (len >= 16
len >= 16Description
TRUEevaluated 140 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 32 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& mres
mresDescription
TRUEevaluated 121 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 19 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
19-140
503 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,ctx->Xn,mres);-
504 mres = 0;-
505 }
executed 121 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
121
506-
507 while (len >= (3*1024)
len >= (3*1024)Description
TRUEevaluated 60 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 172 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
60-172
508 size_t j = (3*1024);-
509-
510 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,in,(3*1024));-
511 while (j
jDescription
TRUEevaluated 11520 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 60 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
60-11520
512 size_t *out_t = (size_t *)out;-
513 const size_t *in_t = (const size_t *)in;-
514-
515 (*block) (ctx->Yi.c, ctx->EKi.c, key);-
516 ++ctr;-
517 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 11520 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-11520
518-
519 ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
executed 11520 times by 1 test: ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
Executed by:
  • libcrypto.so.1.1
11520
520-
521-
522-
523 else-
524 ctx->Yi.d[3] = ctr;
never executed: ctx->Yi.d[3] = ctr;
0
525 for (i = 0; i < 16 / sizeof(size_t)
i < 16 / sizeof(size_t)Description
TRUEevaluated 23040 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 11520 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++i)
11520-23040
526 out_t[i] = in_t[i] ^ ctx->EKi.t[i];
executed 23040 times by 1 test: out_t[i] = in_t[i] ^ ctx->EKi.t[i];
Executed by:
  • libcrypto.so.1.1
23040
527 out += 16;-
528 in += 16;-
529 j -= 16;-
530 }
executed 11520 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
11520
531 len -= (3*1024);-
532 }
executed 60 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
60
533-
534 if ((
(i = (len & (size_t)-16))Description
TRUEevaluated 138 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 34 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
i = (len & (size_t)-16))
(i = (len & (size_t)-16))Description
TRUEevaluated 138 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 34 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
34-138
535 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,in,i);-
536 while (len >= 16
len >= 16Description
TRUEevaluated 3149 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 138 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
138-3149
537 size_t *out_t = (size_t *)out;-
538 const size_t *in_t = (const size_t *)in;-
539-
540 (*block) (ctx->Yi.c, ctx->EKi.c, key);-
541 ++ctr;-
542 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 3149 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
)
0-3149
543-
544 ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
executed 3149 times by 2 tests: ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
3149
545-
546-
547-
548 else-
549 ctx->Yi.d[3] = ctr;
never executed: ctx->Yi.d[3] = ctr;
0
550 for (i = 0; i < 16 / sizeof(size_t)
i < 16 / sizeof(size_t)Description
TRUEevaluated 6298 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 3149 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
; ++i)
3149-6298
551 out_t[i] = in_t[i] ^ ctx->EKi.t[i];
executed 6298 times by 2 tests: out_t[i] = in_t[i] ^ ctx->EKi.t[i];
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
6298
552 out += 16;-
553 in += 16;-
554 len -= 16;-
555 }
executed 3149 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
3149
556 }
executed 138 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
138
557 if (len
lenDescription
TRUEevaluated 92 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 80 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
80-92
558 (*block) (ctx->Yi.c, ctx->EKi.c, key);-
559 ++ctr;-
560 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 92 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
)
0-92
561-
562 ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
executed 92 times by 2 tests: ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
92
563-
564-
565-
566 else-
567 ctx->Yi.d[3] = ctr;
never executed: ctx->Yi.d[3] = ctr;
0
568-
569 while (len--
len--Description
TRUEevaluated 773 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 92 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
92-773
570 out[n] = (ctx->Xn[mres++] = in[n]) ^ ctx->EKi.c[n];-
571 ++n;-
572 }
executed 773 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
773
573 }
executed 92 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
92
574-
575 ctx->mres = mres;-
576 return
executed 172 times by 2 tests: return 0;
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
0;
executed 172 times by 2 tests: return 0;
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
172
577 } while (0);-
578 }
never executed: end of block
0
579-
580 for (i = 0; i < len
i < lenDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
581 u8 c;-
582 if (n == 0
n == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
583 (*block) (ctx->Yi.c, ctx->EKi.c, key);-
584 ++ctr;-
585 if (is_endian.little
is_endian.littleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
586-
587 ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
never executed: ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
0
588-
589-
590-
591 else-
592 ctx->Yi.d[3] = ctr;
never executed: ctx->Yi.d[3] = ctr;
0
593 }-
594-
595 out[i] = (ctx->Xn[mres++] = c = in[i]) ^ ctx->EKi.c[n];-
596 n = (n + 1) % 16;-
597 if (mres == sizeof(ctx->Xn)
mres == sizeof(ctx->Xn)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
598 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,ctx->Xn,sizeof(ctx->Xn));-
599 mres = 0;-
600 }
never executed: end of block
0
601 }
never executed: end of block
0
602-
603 ctx->mres = mres;-
604 return
never executed: return 0;
0;
never executed: return 0;
0
605}-
606-
607int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx,-
608 const unsigned char *in, unsigned char *out,-
609 size_t len, ctr128_f stream)-
610{-
611-
612-
613-
614 const union {-
615 long one;-
616 char little;-
617 } is_endian = { 1 };-
618 unsigned int n, ctr, mres;-
619 size_t i;-
620 u64 mlen = ctx->len.u[1];-
621 void *key = ctx->key;-
622-
623 void (*gcm_gmult_p) (u64 Xi[2], const u128 Htable[16]) = ctx->gmult;-
624-
625 void (*gcm_ghash_p) (u64 Xi[2], const u128 Htable[16],-
626 const u8 *inp, size_t len) = ctx->ghash;-
627-
628-
629-
630 mlen += len;-
631 if (mlen > ((1ULL << 36) - 32)
mlen > ((1ULL << 36) - 32)Description
TRUEnever evaluated
FALSEevaluated 15231 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| (sizeof(len) == 8
sizeof(len) == 8Description
TRUEevaluated 15231 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
&& mlen < len
mlen < lenDescription
TRUEnever evaluated
FALSEevaluated 15231 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
))
0-15231
632 return
never executed: return -1;
-1;
never executed: return -1;
0
633 ctx->len.u[1] = mlen;-
634-
635 mres = ctx->mres;-
636-
637 if (ctx->ares
ctx->aresDescription
TRUEevaluated 14763 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 468 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
468-14763
638-
639-
640 if (len == 0
len == 0Description
TRUEnever evaluated
FALSEevaluated 14763 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-14763
641 (*gcm_gmult_p)(ctx->Xi.u,ctx->Htable);-
642 ctx->ares = 0;-
643 return
never executed: return 0;
0;
never executed: return 0;
0
644 }-
645 memcpy(ctx->Xn, ctx->Xi.c, sizeof(ctx->Xi));-
646 ctx->Xi.u[0] = 0;-
647 ctx->Xi.u[1] = 0;-
648 mres = sizeof(ctx->Xi);-
649-
650-
651-
652 ctx->ares = 0;-
653 }
executed 14763 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
14763
654-
655 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 15231 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-15231
656-
657 ctr = ({ u32 ret_=(ctx->Yi.d[3]); asm ("bswapl %0" : "+r"(ret_)); ret_; });
executed 15231 times by 1 test: ctr = ({ u32 ret_=(ctx->Yi.d[3]); asm ("bswapl %0" : "+r"(ret_)); ret_; });
Executed by:
  • libcrypto.so.1.1
15231
658-
659-
660-
661 else-
662 ctr = ctx->Yi.d[3];
never executed: ctr = ctx->Yi.d[3];
0
663-
664 n = mres % 16;-
665 if (n
nDescription
TRUEevaluated 276 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14955 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
276-14955
666-
667 while (n
nDescription
TRUEevaluated 2262 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 198 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& len
lenDescription
TRUEevaluated 2184 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 78 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
78-2262
668 ctx->Xn[mres++] = *(out++) = *(in++) ^ ctx->EKi.c[n];-
669 --len;-
670 n = (n + 1) % 16;-
671 }
executed 2184 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
2184
672 if (n == 0
n == 0Description
TRUEevaluated 198 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 78 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
78-198
673 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,ctx->Xn,mres);-
674 mres = 0;-
675 }
executed 198 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
198
676 ctx->mres = mres;-
677 return
executed 78 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 78 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
78
678 }-
679 }-
680-
681 if (len >= 16
len >= 16Description
TRUEevaluated 12286 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2867 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& mres
mresDescription
TRUEevaluated 12088 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 198 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
198-12286
682 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,ctx->Xn,mres);-
683 mres = 0;-
684 }
executed 12088 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
12088
685-
686 while (len >= (3*1024)
len >= (3*1024)Description
TRUEevaluated 1116 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 15153 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1116-15153
687 (*stream) (in, out, (3*1024) / 16, key, ctx->Yi.c);-
688 ctr += (3*1024) / 16;-
689 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 1116 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-1116
690-
691 ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
executed 1116 times by 1 test: ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
Executed by:
  • libcrypto.so.1.1
1116
692-
693-
694-
695 else-
696 ctx->Yi.d[3] = ctr;
never executed: ctx->Yi.d[3] = ctr;
0
697 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,out,(3*1024));-
698 out += (3*1024);-
699 in += (3*1024);-
700 len -= (3*1024);-
701 }
executed 1116 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1116
702-
703-
704 if ((
(i = (len & (size_t)-16))Description
TRUEevaluated 12286 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2867 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
i = (len & (size_t)-16))
(i = (len & (size_t)-16))Description
TRUEevaluated 12286 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2867 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
2867-12286
705 size_t j = i / 16;-
706-
707 (*stream) (in, out, j, key, ctx->Yi.c);-
708 ctr += (unsigned int)j;-
709 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 12286 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-12286
710-
711 ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
executed 12286 times by 1 test: ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
Executed by:
  • libcrypto.so.1.1
12286
712-
713-
714-
715 else-
716 ctx->Yi.d[3] = ctr;
never executed: ctx->Yi.d[3] = ctr;
0
717 in += i;-
718 len -= i;-
719-
720 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,out,i);-
721 out += i;-
722 }
executed 12286 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
12286
723 if (len
lenDescription
TRUEevaluated 13402 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1751 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1751-13402
724 (*ctx->block) (ctx->Yi.c, ctx->EKi.c, key);-
725 ++ctr;-
726 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 13402 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-13402
727-
728 ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
executed 13402 times by 1 test: ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
Executed by:
  • libcrypto.so.1.1
13402
729-
730-
731-
732 else-
733 ctx->Yi.d[3] = ctr;
never executed: ctx->Yi.d[3] = ctr;
0
734 while (len--
len--Description
TRUEevaluated 53338 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 13402 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
13402-53338
735-
736 ctx->Xn[mres++] = out[n] = in[n] ^ ctx->EKi.c[n];-
737-
738-
739-
740 ++n;-
741 }
executed 53338 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
53338
742 }
executed 13402 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
13402
743-
744 ctx->mres = mres;-
745 return
executed 15153 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 15153 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
15153
746-
747}-
748-
749int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx,-
750 const unsigned char *in, unsigned char *out,-
751 size_t len, ctr128_f stream)-
752{-
753-
754-
755-
756 const union {-
757 long one;-
758 char little;-
759 } is_endian = { 1 };-
760 unsigned int n, ctr, mres;-
761 size_t i;-
762 u64 mlen = ctx->len.u[1];-
763 void *key = ctx->key;-
764-
765 void (*gcm_gmult_p) (u64 Xi[2], const u128 Htable[16]) = ctx->gmult;-
766-
767 void (*gcm_ghash_p) (u64 Xi[2], const u128 Htable[16],-
768 const u8 *inp, size_t len) = ctx->ghash;-
769-
770-
771-
772 mlen += len;-
773 if (mlen > ((1ULL << 36) - 32)
mlen > ((1ULL << 36) - 32)Description
TRUEnever evaluated
FALSEevaluated 16481 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| (sizeof(len) == 8
sizeof(len) == 8Description
TRUEevaluated 16481 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
&& mlen < len
mlen < lenDescription
TRUEnever evaluated
FALSEevaluated 16481 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
))
0-16481
774 return
never executed: return -1;
-1;
never executed: return -1;
0
775 ctx->len.u[1] = mlen;-
776-
777 mres = ctx->mres;-
778-
779 if (ctx->ares
ctx->aresDescription
TRUEevaluated 16013 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 468 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
468-16013
780-
781-
782 if (len == 0
len == 0Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 16008 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
5-16008
783 (*gcm_gmult_p)(ctx->Xi.u,ctx->Htable);-
784 ctx->ares = 0;-
785 return
executed 5 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 5 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
5
786 }-
787 memcpy(ctx->Xn, ctx->Xi.c, sizeof(ctx->Xi));-
788 ctx->Xi.u[0] = 0;-
789 ctx->Xi.u[1] = 0;-
790 mres = sizeof(ctx->Xi);-
791-
792-
793-
794 ctx->ares = 0;-
795 }
executed 16008 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
16008
796-
797 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 16476 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-16476
798-
799 ctr = ({ u32 ret_=(ctx->Yi.d[3]); asm ("bswapl %0" : "+r"(ret_)); ret_; });
executed 16476 times by 1 test: ctr = ({ u32 ret_=(ctx->Yi.d[3]); asm ("bswapl %0" : "+r"(ret_)); ret_; });
Executed by:
  • libcrypto.so.1.1
16476
800-
801-
802-
803 else-
804 ctr = ctx->Yi.d[3];
never executed: ctr = ctx->Yi.d[3];
0
805-
806 n = mres % 16;-
807 if (n
nDescription
TRUEevaluated 276 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 16200 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
276-16200
808-
809 while (n
nDescription
TRUEevaluated 2262 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 198 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& len
lenDescription
TRUEevaluated 2184 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 78 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
78-2262
810 *(out++) = (ctx->Xn[mres++] = *(in++)) ^ ctx->EKi.c[n];-
811 --len;-
812 n = (n + 1) % 16;-
813 }
executed 2184 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
2184
814 if (n == 0
n == 0Description
TRUEevaluated 198 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 78 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
78-198
815 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,ctx->Xn,mres);-
816 mres = 0;-
817 }
executed 198 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
198
818 ctx->mres = mres;-
819 return
executed 78 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 78 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
78
820 }-
821 }-
822-
823 if (len >= 16
len >= 16Description
TRUEevaluated 11605 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4793 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& mres
mresDescription
TRUEevaluated 11407 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 198 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
198-11605
824 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,ctx->Xn,mres);-
825 mres = 0;-
826 }
executed 11407 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
11407
827-
828 while (len >= (3*1024)
len >= (3*1024)Description
TRUEevaluated 1156 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 16398 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1156-16398
829 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,in,(3*1024));-
830 (*stream) (in, out, (3*1024) / 16, key, ctx->Yi.c);-
831 ctr += (3*1024) / 16;-
832 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 1156 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-1156
833-
834 ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
executed 1156 times by 1 test: ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
Executed by:
  • libcrypto.so.1.1
1156
835-
836-
837-
838 else-
839 ctx->Yi.d[3] = ctr;
never executed: ctx->Yi.d[3] = ctr;
0
840 out += (3*1024);-
841 in += (3*1024);-
842 len -= (3*1024);-
843 }
executed 1156 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1156
844-
845-
846 if ((
(i = (len & (size_t)-16))Description
TRUEevaluated 11603 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4795 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
i = (len & (size_t)-16))
(i = (len & (size_t)-16))Description
TRUEevaluated 11603 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4795 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
4795-11603
847 size_t j = i / 16;-
848-
849-
850 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,in,i);-
851 (*stream) (in, out, j, key, ctx->Yi.c);-
852 ctr += (unsigned int)j;-
853 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 11603 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-11603
854-
855 ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
executed 11603 times by 1 test: ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
Executed by:
  • libcrypto.so.1.1
11603
856-
857-
858-
859 else-
860 ctx->Yi.d[3] = ctr;
never executed: ctx->Yi.d[3] = ctr;
0
861 out += i;-
862 in += i;-
863 len -= i;-
864 }
executed 11603 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
11603
865 if (len
lenDescription
TRUEevaluated 14618 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1780 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1780-14618
866 (*ctx->block) (ctx->Yi.c, ctx->EKi.c, key);-
867 ++ctr;-
868 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 14618 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-14618
869-
870 ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
executed 14618 times by 1 test: ctx->Yi.d[3] = ({ u32 ret_=(ctr); asm ("bswapl %0" : "+r"(ret_)); ret_; });
Executed by:
  • libcrypto.so.1.1
14618
871-
872-
873-
874 else-
875 ctx->Yi.d[3] = ctr;
never executed: ctx->Yi.d[3] = ctr;
0
876 while (len--
len--Description
TRUEevaluated 83937 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14618 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
14618-83937
877-
878 out[n] = (ctx->Xn[mres++] = in[n]) ^ ctx->EKi.c[n];-
879-
880-
881-
882-
883-
884 ++n;-
885 }
executed 83937 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
83937
886 }
executed 14618 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
14618
887-
888 ctx->mres = mres;-
889 return
executed 16398 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 16398 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
16398
890-
891}-
892-
893int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag,-
894 size_t len)-
895{-
896 const union {-
897 long one;-
898 char little;-
899 } is_endian = { 1 };-
900 u64 alen = ctx->len.u[0] << 3;-
901 u64 clen = ctx->len.u[1] << 3;-
902-
903 void (*gcm_gmult_p) (u64 Xi[2], const u128 Htable[16]) = ctx->gmult;-
904-
905 void (*gcm_ghash_p) (u64 Xi[2], const u128 Htable[16],-
906 const u8 *inp, size_t len) = ctx->ghash;-
907-
908-
909-
910-
911 u128 bitlen;-
912 unsigned int mres = ctx->mres;-
913-
914 if (mres
mresDescription
TRUEevaluated 27822 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 3791 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
3791-27822
915 unsigned blocks = (mres + 15) & -16;-
916-
917 memset(ctx->Xn + mres, 0, blocks - mres);-
918 mres = blocks;-
919 if (mres == sizeof(ctx->Xn)
mres == sizeof(ctx->Xn)Description
TRUEnever evaluated
FALSEevaluated 27822 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
0-27822
920 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,ctx->Xn,mres);-
921 mres = 0;-
922 }
never executed: end of block
0
923 }
executed 27822 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
else if (ctx->ares
ctx->aresDescription
TRUEnever evaluated
FALSEevaluated 3791 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
) {
0-27822
924 (*gcm_gmult_p)(ctx->Xi.u,ctx->Htable);-
925 }
never executed: end of block
0
926-
927-
928-
929-
930-
931 if (is_endian.little
is_endian.littleDescription
TRUEevaluated 31613 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
) {
0-31613
932-
933 alen = ({ u64 ret_=(alen); asm ("bswapq %0" : "+r"(ret_)); ret_; });-
934 clen = ({ u64 ret_=(clen); asm ("bswapq %0" : "+r"(ret_)); ret_; });-
935 }
executed 31613 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
31613
936-
937-
938 bitlen.hi = alen;-
939 bitlen.lo = clen;-
940 memcpy(ctx->Xn + mres, &bitlen, sizeof(bitlen));-
941 mres += sizeof(bitlen);-
942 (*gcm_ghash_p)(ctx->Xi.u,ctx->Htable,ctx->Xn,mres);-
943-
944-
945-
946-
947-
948-
949 ctx->Xi.u[0] ^= ctx->EK0.u[0];-
950 ctx->Xi.u[1] ^= ctx->EK0.u[1];-
951-
952 if (tag
tagDescription
TRUEevaluated 13716 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEevaluated 17897 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& len <= sizeof(ctx->Xi)
len <= sizeof(ctx->Xi)Description
TRUEevaluated 13716 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • modes_internal_test
FALSEnever evaluated
)
0-17897
953 return
executed 13716 times by 2 tests: return CRYPTO_memcmp(ctx->Xi.c, tag, len);
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
CRYPTO_memcmp(ctx->Xi.c, tag, len);
executed 13716 times by 2 tests: return CRYPTO_memcmp(ctx->Xi.c, tag, len);
Executed by:
  • libcrypto.so.1.1
  • modes_internal_test
13716
954 else-
955 return
executed 17897 times by 1 test: return -1;
Executed by:
  • libcrypto.so.1.1
-1;
executed 17897 times by 1 test: return -1;
Executed by:
  • libcrypto.so.1.1
17897
956}-
957-
958void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len)-
959{-
960 CRYPTO_gcm128_finish(ctx, -
961 ((void *)0)-
962 , 0);-
963 memcpy(tag, ctx->Xi.c,-
964 len <= sizeof(ctx->Xi.c) ? len : sizeof(ctx->Xi.c));-
965}
executed 17897 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
17897
966-
967GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block)-
968{-
969 GCM128_CONTEXT *ret;-
970-
971 if ((
(ret = CRYPTO_...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
ret = CRYPTO_malloc(sizeof(*ret), __FILE__, 1879)) !=
(ret = CRYPTO_...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
972 ((void *)0)
(ret = CRYPTO_...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
973 )-
974 CRYPTO_gcm128_init(ret, key, block);
never executed: CRYPTO_gcm128_init(ret, key, block);
0
975-
976 return
never executed: return ret;
ret;
never executed: return ret;
0
977}-
978-
979void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx)-
980{-
981 CRYPTO_clear_free(ctx, sizeof(*ctx), __FILE__, 1887);-
982}
never executed: end of block
0
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2