OpenCoverage

aes_ige.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/aes/aes_ige.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4typedef struct {-
5 unsigned long data[(16 / sizeof(unsigned long))];-
6} aes_block_t;-
7void AES_ige_encrypt(const unsigned char *in, unsigned char *out,-
8 size_t length, const AES_KEY *key,-
9 unsigned char *ivec, const int enc)-
10{-
11 size_t n;-
12 size_t len = length;-
13-
14 if (length == 0
length == 0Description
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-21
15 return;
never executed: return;
0
16-
17 (void)((in && out && key && ivec) ? 0 : (OPENSSL_die("assertion failed: " "in && out && key && ivec", __FILE__, 47), 1));-
18 (void)(((1 == enc) || (0 == enc)) ? 0 : (OPENSSL_die("assertion failed: " "(AES_ENCRYPT == enc) || (AES_DECRYPT == enc)", __FILE__, 48), 1));-
19 (void)(((length % 16) == 0) ? 0 : (OPENSSL_die("assertion failed: " "(length % AES_BLOCK_SIZE) == 0", __FILE__, 49), 1));-
20-
21 len = length / 16;-
22-
23 if (1 == enc
1 == encDescription
TRUEevaluated 11 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 10 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
10-11
24 if (in != out
in != outDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
&&
1-10
25 (1-
26 || ((
dead code: ((size_t)in | (size_t)out | (size_t)ivec) % sizeof(long) == 0
size_t)in | (size_t)out | (size_t)ivec) % sizeof(long) ==
dead code: ((size_t)in | (size_t)out | (size_t)ivec) % sizeof(long) == 0
-
27 0
dead code: ((size_t)in | (size_t)out | (size_t)ivec) % sizeof(long) == 0
)) {
-
28 aes_block_t *ivp = (aes_block_t *) ivec;-
29 aes_block_t *iv2p = (aes_block_t *) (ivec + 16);-
30-
31 while (len
lenDescription
TRUEevaluated 2586 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 10 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
10-2586
32 aes_block_t *inp = (aes_block_t *) in;-
33 aes_block_t *outp = (aes_block_t *) out;-
34-
35 for (n = 0; n < (16 / sizeof(unsigned long))
n < (16 / size...nsigned long))Description
TRUEevaluated 5172 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2586 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++n)
2586-5172
36 outp->data[n] = inp->data[n] ^ ivp->data[n];
executed 5172 times by 1 test: outp->data[n] = inp->data[n] ^ ivp->data[n];
Executed by:
  • libcrypto.so.1.1
5172
37 AES_encrypt((unsigned char *)outp->data,-
38 (unsigned char *)outp->data, key);-
39 for (n = 0; n < (16 / sizeof(unsigned long))
n < (16 / size...nsigned long))Description
TRUEevaluated 5172 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2586 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++n)
2586-5172
40 outp->data[n] ^= iv2p->data[n];
executed 5172 times by 1 test: outp->data[n] ^= iv2p->data[n];
Executed by:
  • libcrypto.so.1.1
5172
41 ivp = outp;-
42 iv2p = inp;-
43 --len;-
44 in += 16;-
45 out += 16;-
46 }
executed 2586 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
2586
47 memcpy(ivec, ivp->data, 16);-
48 memcpy(ivec + 16, iv2p->data, 16);-
49 }
executed 10 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
10
50 aes_block_t tmp, tmp2;-
51 aes_block_t iv;-
52 aes_block_t iv2;-
53-
54 (iv) = *(const aes_block_t *)(ivec);-
55 (iv2) = *(const aes_block_t *)(ivec + 16);-
56-
57 while (len
lenDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1-2
58 (tmp) = *(const aes_block_t *)(in);-
59 for (n = 0; n < (16 / sizeof(unsigned long))
n < (16 / size...nsigned long))Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++n)
2-4
60 tmp2.data[n] = tmp.data[n] ^ iv.data[n];
executed 4 times by 1 test: tmp2.data[n] = tmp.data[n] ^ iv.data[n];
Executed by:
  • libcrypto.so.1.1
4
61 AES_encrypt((unsigned char *)tmp2.data,-
62 (unsigned char *)tmp2.data, key);-
63 for (n = 0; n < (16 / sizeof(unsigned long))
n < (16 / size...nsigned long))Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++n)
2-4
64 tmp2.data[n] ^= iv2.data[n];
executed 4 times by 1 test: tmp2.data[n] ^= iv2.data[n];
Executed by:
  • libcrypto.so.1.1
4
65 *(aes_block_t *)(out) = (tmp2);-
66 iv = tmp2;-
67 iv2 = tmp;-
68 --len;-
69 in += 16;-
70 out += 16;-
71 }
executed 2 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
2
72 memcpy(ivec, iv.data, 16);-
73 memcpy(ivec + 16, iv2.data, 16);-
74 }
executed 1 time by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1
75 } else {-
76 if (in != out
in != outDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
&&
1-9
77 (1-
78 || ((
dead code: ((size_t)in | (size_t)out | (size_t)ivec) % sizeof(long) == 0
size_t)in | (size_t)out | (size_t)ivec) % sizeof(long) ==
dead code: ((size_t)in | (size_t)out | (size_t)ivec) % sizeof(long) == 0
-
79 0
dead code: ((size_t)in | (size_t)out | (size_t)ivec) % sizeof(long) == 0
)) {
-
80 aes_block_t *ivp = (aes_block_t *) ivec;-
81 aes_block_t *iv2p = (aes_block_t *) (ivec + 16);-
82-
83 while (len
lenDescription
TRUEevaluated 2586 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
9-2586
84 aes_block_t tmp;-
85 aes_block_t *inp = (aes_block_t *) in;-
86 aes_block_t *outp = (aes_block_t *) out;-
87-
88 for (n = 0; n < (16 / sizeof(unsigned long))
n < (16 / size...nsigned long))Description
TRUEevaluated 5172 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2586 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++n)
2586-5172
89 tmp.data[n] = inp->data[n] ^ iv2p->data[n];
executed 5172 times by 1 test: tmp.data[n] = inp->data[n] ^ iv2p->data[n];
Executed by:
  • libcrypto.so.1.1
5172
90 AES_decrypt((unsigned char *)tmp.data,-
91 (unsigned char *)outp->data, key);-
92 for (n = 0; n < (16 / sizeof(unsigned long))
n < (16 / size...nsigned long))Description
TRUEevaluated 5172 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2586 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++n)
2586-5172
93 outp->data[n] ^= ivp->data[n];
executed 5172 times by 1 test: outp->data[n] ^= ivp->data[n];
Executed by:
  • libcrypto.so.1.1
5172
94 ivp = inp;-
95 iv2p = outp;-
96 --len;-
97 in += 16;-
98 out += 16;-
99 }
executed 2586 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
2586
100 memcpy(ivec, ivp->data, 16);-
101 memcpy(ivec + 16, iv2p->data, 16);-
102 }
executed 9 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
9
103 aes_block_t tmp, tmp2;-
104 aes_block_t iv;-
105 aes_block_t iv2;-
106-
107 (iv) = *(const aes_block_t *)(ivec);-
108 (iv2) = *(const aes_block_t *)(ivec + 16);-
109-
110 while (len
lenDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1-2
111 (tmp) = *(const aes_block_t *)(in);-
112 tmp2 = tmp;-
113 for (n = 0; n < (16 / sizeof(unsigned long))
n < (16 / size...nsigned long))Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++n)
2-4
114 tmp.data[n] ^= iv2.data[n];
executed 4 times by 1 test: tmp.data[n] ^= iv2.data[n];
Executed by:
  • libcrypto.so.1.1
4
115 AES_decrypt((unsigned char *)tmp.data,-
116 (unsigned char *)tmp.data, key);-
117 for (n = 0; n < (16 / sizeof(unsigned long))
n < (16 / size...nsigned long))Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++n)
2-4
118 tmp.data[n] ^= iv.data[n];
executed 4 times by 1 test: tmp.data[n] ^= iv.data[n];
Executed by:
  • libcrypto.so.1.1
4
119 *(aes_block_t *)(out) = (tmp);-
120 iv = tmp2;-
121 iv2 = tmp;-
122 --len;-
123 in += 16;-
124 out += 16;-
125 }
executed 2 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
2
126 memcpy(ivec, iv.data, 16);-
127 memcpy(ivec + 16, iv2.data, 16);-
128 }
executed 1 time by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1
129 }-
130}-
131void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,-
132 size_t length, const AES_KEY *key,-
133 const AES_KEY *key2, const unsigned char *ivec,-
134 const int enc)-
135{-
136 size_t n;-
137 size_t len = length;-
138 unsigned char tmp[16];-
139 unsigned char tmp2[16];-
140 unsigned char tmp3[16];-
141 unsigned char prev[16];-
142 const unsigned char *iv;-
143 const unsigned char *iv2;-
144-
145 (void)((in && out && key && ivec) ? 0 : (OPENSSL_die("assertion failed: " "in && out && key && ivec", __FILE__, 183), 1));-
146 (void)(((1 == enc) || (0 == enc)) ? 0 : (OPENSSL_die("assertion failed: " "(AES_ENCRYPT == enc) || (AES_DECRYPT == enc)", __FILE__, 184), 1));-
147 (void)(((length % 16) == 0) ? 0 : (OPENSSL_die("assertion failed: " "(length % AES_BLOCK_SIZE) == 0", __FILE__, 185), 1));-
148-
149 if (1 == enc
1 == encDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1-3
150-
151-
152-
153-
154-
155-
156 iv = ivec;-
157 iv2 = ivec + 16;-
158 while (len >= 16
len >= 16Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
3-14
159 for (n = 0; n < 16
n < 16Description
TRUEevaluated 224 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++n)
14-224
160 out[n] = in[n] ^ iv[n];
executed 224 times by 1 test: out[n] = in[n] ^ iv[n];
Executed by:
  • libcrypto.so.1.1
224
161 AES_encrypt(out, out, key);-
162 for (n = 0; n < 16
n < 16Description
TRUEevaluated 224 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++n)
14-224
163 out[n] ^= iv2[n];
executed 224 times by 1 test: out[n] ^= iv2[n];
Executed by:
  • libcrypto.so.1.1
224
164 iv = out;-
165 memcpy(prev, in, 16);-
166 iv2 = prev;-
167 len -= 16;-
168 in += 16;-
169 out += 16;-
170 }
executed 14 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
14
171-
172-
173 iv = ivec + 16 * 2;-
174 iv2 = ivec + 16 * 3;-
175 len = length;-
176 while (len >= 16
len >= 16Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
3-14
177 out -= 16;-
178-
179-
180-
181 memcpy(tmp, out, 16);-
182 for (n = 0; n < 16
n < 16Description
TRUEevaluated 224 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++n)
14-224
183 out[n] ^= iv[n];
executed 224 times by 1 test: out[n] ^= iv[n];
Executed by:
  • libcrypto.so.1.1
224
184-
185-
186-
187 AES_encrypt(out, out, key);-
188-
189-
190-
191-
192-
193-
194 for (n = 0; n < 16
n < 16Description
TRUEevaluated 224 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++n)
14-224
195 out[n] ^= iv2[n];
executed 224 times by 1 test: out[n] ^= iv2[n];
Executed by:
  • libcrypto.so.1.1
224
196-
197-
198-
199 iv = out;-
200 memcpy(prev, tmp, 16);-
201 iv2 = prev;-
202 len -= 16;-
203 }
executed 14 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
14
204 }
executed 3 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
3
205-
206 iv = ivec + 16 * 2;-
207 iv2 = ivec + 16 * 3;-
208 in += length;-
209 out += length;-
210 while (len >= 16
len >= 16Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1-8
211 in -= 16;-
212 out -= 16;-
213 memcpy(tmp, in, 16);-
214 memcpy(tmp2, in, 16);-
215 for (n = 0; n < 16
n < 16Description
TRUEevaluated 128 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++n)
8-128
216 tmp[n] ^= iv2[n];
executed 128 times by 1 test: tmp[n] ^= iv2[n];
Executed by:
  • libcrypto.so.1.1
128
217 AES_decrypt(tmp, out, key);-
218 for (n = 0; n < 16
n < 16Description
TRUEevaluated 128 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++n)
8-128
219 out[n] ^= iv[n];
executed 128 times by 1 test: out[n] ^= iv[n];
Executed by:
  • libcrypto.so.1.1
128
220 memcpy(tmp3, tmp2, 16);-
221 iv = tmp3;-
222 iv2 = out;-
223 len -= 16;-
224 }
executed 8 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
8
225-
226-
227 iv = ivec;-
228 iv2 = ivec + 16;-
229 len = length;-
230 while (len >= 16
len >= 16Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1-8
231 memcpy(tmp, out, 16);-
232 memcpy(tmp2, out, 16);-
233 for (n = 0; n < 16
n < 16Description
TRUEevaluated 128 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++n)
8-128
234 tmp[n] ^= iv2[n];
executed 128 times by 1 test: tmp[n] ^= iv2[n];
Executed by:
  • libcrypto.so.1.1
128
235 AES_decrypt(tmp, out, key);-
236 for (n = 0; n < 16
n < 16Description
TRUEevaluated 128 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++n)
8-128
237 out[n] ^= iv[n];
executed 128 times by 1 test: out[n] ^= iv[n];
Executed by:
  • libcrypto.so.1.1
128
238 memcpy(tmp3, tmp2, 16);-
239 iv = tmp3;-
240 iv2 = out;-
241 len -= 16;-
242 in += 16;-
243 out += 16;-
244 }
executed 8 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
8
245 }
executed 1 time by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1
246}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2