OpenCoverage

bf_enc.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/bf/bf_enc.c
Switch to Source codePreprocessed file
LineSourceCount
1void BF_encrypt(unsigned int *data, const BF_KEY *key)-
2{-
3 register unsigned int l, r;-
4 register const unsigned int *p, *s;-
5-
6 p = key->P;-
7 s = &(key->S[0]);-
8 l = data[0];-
9 r = data[1];-
10-
11 l ^= p[0];-
12 ( r^=p[1], r^=((( s[ ((l>>24)&0xff)] + s[0x0100+((l>>16)&0xff)])^ s[0x0200+((l>> 8)&0xff)])+ s[0x0300+((l )&0xff)])&0xffffffffU );-
13 ( l^=p[2], l^=((( s[ ((r>>24)&0xff)] + s[0x0100+((r>>16)&0xff)])^ s[0x0200+((r>> 8)&0xff)])+ s[0x0300+((r )&0xff)])&0xffffffffU );-
14 ( r^=p[3], r^=((( s[ ((l>>24)&0xff)] + s[0x0100+((l>>16)&0xff)])^ s[0x0200+((l>> 8)&0xff)])+ s[0x0300+((l )&0xff)])&0xffffffffU );-
15 ( l^=p[4], l^=((( s[ ((r>>24)&0xff)] + s[0x0100+((r>>16)&0xff)])^ s[0x0200+((r>> 8)&0xff)])+ s[0x0300+((r )&0xff)])&0xffffffffU );-
16 ( r^=p[5], r^=((( s[ ((l>>24)&0xff)] + s[0x0100+((l>>16)&0xff)])^ s[0x0200+((l>> 8)&0xff)])+ s[0x0300+((l )&0xff)])&0xffffffffU );-
17 ( l^=p[6], l^=((( s[ ((r>>24)&0xff)] + s[0x0100+((r>>16)&0xff)])^ s[0x0200+((r>> 8)&0xff)])+ s[0x0300+((r )&0xff)])&0xffffffffU );-
18 ( r^=p[7], r^=((( s[ ((l>>24)&0xff)] + s[0x0100+((l>>16)&0xff)])^ s[0x0200+((l>> 8)&0xff)])+ s[0x0300+((l )&0xff)])&0xffffffffU );-
19 ( l^=p[8], l^=((( s[ ((r>>24)&0xff)] + s[0x0100+((r>>16)&0xff)])^ s[0x0200+((r>> 8)&0xff)])+ s[0x0300+((r )&0xff)])&0xffffffffU );-
20 ( r^=p[9], r^=((( s[ ((l>>24)&0xff)] + s[0x0100+((l>>16)&0xff)])^ s[0x0200+((l>> 8)&0xff)])+ s[0x0300+((l )&0xff)])&0xffffffffU );-
21 ( l^=p[10], l^=((( s[ ((r>>24)&0xff)] + s[0x0100+((r>>16)&0xff)])^ s[0x0200+((r>> 8)&0xff)])+ s[0x0300+((r )&0xff)])&0xffffffffU );-
22 ( r^=p[11], r^=((( s[ ((l>>24)&0xff)] + s[0x0100+((l>>16)&0xff)])^ s[0x0200+((l>> 8)&0xff)])+ s[0x0300+((l )&0xff)])&0xffffffffU );-
23 ( l^=p[12], l^=((( s[ ((r>>24)&0xff)] + s[0x0100+((r>>16)&0xff)])^ s[0x0200+((r>> 8)&0xff)])+ s[0x0300+((r )&0xff)])&0xffffffffU );-
24 ( r^=p[13], r^=((( s[ ((l>>24)&0xff)] + s[0x0100+((l>>16)&0xff)])^ s[0x0200+((l>> 8)&0xff)])+ s[0x0300+((l )&0xff)])&0xffffffffU );-
25 ( l^=p[14], l^=((( s[ ((r>>24)&0xff)] + s[0x0100+((r>>16)&0xff)])^ s[0x0200+((r>> 8)&0xff)])+ s[0x0300+((r )&0xff)])&0xffffffffU );-
26 ( r^=p[15], r^=((( s[ ((l>>24)&0xff)] + s[0x0100+((l>>16)&0xff)])^ s[0x0200+((l>> 8)&0xff)])+ s[0x0300+((l )&0xff)])&0xffffffffU );-
27 ( l^=p[16], l^=((( s[ ((r>>24)&0xff)] + s[0x0100+((r>>16)&0xff)])^ s[0x0200+((r>> 8)&0xff)])+ s[0x0300+((r )&0xff)])&0xffffffffU );-
28-
29-
30-
31-
32-
33-
34 r ^= p[16 + 1];-
35-
36 data[1] = l & 0xffffffffU;-
37 data[0] = r & 0xffffffffU;-
38}
executed 55319 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
55319
39-
40void BF_decrypt(unsigned int *data, const BF_KEY *key)-
41{-
42 register unsigned int l, r;-
43 register const unsigned int *p, *s;-
44-
45 p = key->P;-
46 s = &(key->S[0]);-
47 l = data[0];-
48 r = data[1];-
49-
50 l ^= p[16 + 1];-
51-
52-
53-
54-
55-
56-
57 ( r^=p[16], r^=((( s[ ((l>>24)&0xff)] + s[0x0100+((l>>16)&0xff)])^ s[0x0200+((l>> 8)&0xff)])+ s[0x0300+((l )&0xff)])&0xffffffffU );-
58 ( l^=p[15], l^=((( s[ ((r>>24)&0xff)] + s[0x0100+((r>>16)&0xff)])^ s[0x0200+((r>> 8)&0xff)])+ s[0x0300+((r )&0xff)])&0xffffffffU );-
59 ( r^=p[14], r^=((( s[ ((l>>24)&0xff)] + s[0x0100+((l>>16)&0xff)])^ s[0x0200+((l>> 8)&0xff)])+ s[0x0300+((l )&0xff)])&0xffffffffU );-
60 ( l^=p[13], l^=((( s[ ((r>>24)&0xff)] + s[0x0100+((r>>16)&0xff)])^ s[0x0200+((r>> 8)&0xff)])+ s[0x0300+((r )&0xff)])&0xffffffffU );-
61 ( r^=p[12], r^=((( s[ ((l>>24)&0xff)] + s[0x0100+((l>>16)&0xff)])^ s[0x0200+((l>> 8)&0xff)])+ s[0x0300+((l )&0xff)])&0xffffffffU );-
62 ( l^=p[11], l^=((( s[ ((r>>24)&0xff)] + s[0x0100+((r>>16)&0xff)])^ s[0x0200+((r>> 8)&0xff)])+ s[0x0300+((r )&0xff)])&0xffffffffU );-
63 ( r^=p[10], r^=((( s[ ((l>>24)&0xff)] + s[0x0100+((l>>16)&0xff)])^ s[0x0200+((l>> 8)&0xff)])+ s[0x0300+((l )&0xff)])&0xffffffffU );-
64 ( l^=p[9], l^=((( s[ ((r>>24)&0xff)] + s[0x0100+((r>>16)&0xff)])^ s[0x0200+((r>> 8)&0xff)])+ s[0x0300+((r )&0xff)])&0xffffffffU );-
65 ( r^=p[8], r^=((( s[ ((l>>24)&0xff)] + s[0x0100+((l>>16)&0xff)])^ s[0x0200+((l>> 8)&0xff)])+ s[0x0300+((l )&0xff)])&0xffffffffU );-
66 ( l^=p[7], l^=((( s[ ((r>>24)&0xff)] + s[0x0100+((r>>16)&0xff)])^ s[0x0200+((r>> 8)&0xff)])+ s[0x0300+((r )&0xff)])&0xffffffffU );-
67 ( r^=p[6], r^=((( s[ ((l>>24)&0xff)] + s[0x0100+((l>>16)&0xff)])^ s[0x0200+((l>> 8)&0xff)])+ s[0x0300+((l )&0xff)])&0xffffffffU );-
68 ( l^=p[5], l^=((( s[ ((r>>24)&0xff)] + s[0x0100+((r>>16)&0xff)])^ s[0x0200+((r>> 8)&0xff)])+ s[0x0300+((r )&0xff)])&0xffffffffU );-
69 ( r^=p[4], r^=((( s[ ((l>>24)&0xff)] + s[0x0100+((l>>16)&0xff)])^ s[0x0200+((l>> 8)&0xff)])+ s[0x0300+((l )&0xff)])&0xffffffffU );-
70 ( l^=p[3], l^=((( s[ ((r>>24)&0xff)] + s[0x0100+((r>>16)&0xff)])^ s[0x0200+((r>> 8)&0xff)])+ s[0x0300+((r )&0xff)])&0xffffffffU );-
71 ( r^=p[2], r^=((( s[ ((l>>24)&0xff)] + s[0x0100+((l>>16)&0xff)])^ s[0x0200+((l>> 8)&0xff)])+ s[0x0300+((l )&0xff)])&0xffffffffU );-
72 ( l^=p[1], l^=((( s[ ((r>>24)&0xff)] + s[0x0100+((r>>16)&0xff)])^ s[0x0200+((r>> 8)&0xff)])+ s[0x0300+((r )&0xff)])&0xffffffffU );-
73 r ^= p[0];-
74-
75 data[1] = l & 0xffffffffU;-
76 data[0] = r & 0xffffffffU;-
77}
executed 2644 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
2644
78-
79void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,-
80 const BF_KEY *schedule, unsigned char *ivec, int encrypt)-
81{-
82 register unsigned int tin0, tin1;-
83 register unsigned int tout0, tout1, xor0, xor1;-
84 register long l = length;-
85 unsigned int tin[2];-
86-
87 if (encrypt
encryptDescription
TRUEevaluated 155 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 108 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
108-155
88 (tout0 =((unsigned long)(*((ivec)++)))<<24L, tout0|=((unsigned long)(*((ivec)++)))<<16L, tout0|=((unsigned long)(*((ivec)++)))<< 8L, tout0|=((unsigned long)(*((ivec)++))));-
89 (tout1 =((unsigned long)(*((ivec)++)))<<24L, tout1|=((unsigned long)(*((ivec)++)))<<16L, tout1|=((unsigned long)(*((ivec)++)))<< 8L, tout1|=((unsigned long)(*((ivec)++))));-
90 ivec -= 8;-
91 for (l -= 8; l >= 0
l >= 0Description
TRUEevaluated 1821 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 155 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; l -= 8) {
155-1821
92 (tin0 =((unsigned long)(*((in)++)))<<24L, tin0|=((unsigned long)(*((in)++)))<<16L, tin0|=((unsigned long)(*((in)++)))<< 8L, tin0|=((unsigned long)(*((in)++))));-
93 (tin1 =((unsigned long)(*((in)++)))<<24L, tin1|=((unsigned long)(*((in)++)))<<16L, tin1|=((unsigned long)(*((in)++)))<< 8L, tin1|=((unsigned long)(*((in)++))));-
94 tin0 ^= tout0;-
95 tin1 ^= tout1;-
96 tin[0] = tin0;-
97 tin[1] = tin1;-
98 BF_encrypt(tin, schedule);-
99 tout0 = tin[0];-
100 tout1 = tin[1];-
101 (*((out)++)=(unsigned char)(((tout0)>>24L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0) )&0xff));-
102 (*((out)++)=(unsigned char)(((tout1)>>24L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1) )&0xff));-
103 }
executed 1821 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1821
104 if (l != -8
l != -8Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 154 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1-154
105 { in+=l + 8; tin0=tin1=0; switch (l + 8) { case
never executed: case 8:
8:
never executed: case 8:
tin1 =((unsigned long)(*(--(in)))) ; case
never executed: case 7:
7:
never executed: case 7:
code before this statement never executed: case 7:
tin1|=((unsigned long)(*(--(in))))<< 8; case
never executed: case 6:
6:
never executed: case 6:
code before this statement never executed: case 6:
tin1|=((unsigned long)(*(--(in))))<<16; case
executed 1 time by 1 test: case 5:
Executed by:
  • libcrypto.so.1.1
code before this statement never executed: case 5:
executed 1 time by 1 test: case 5:
Executed by:
  • libcrypto.so.1.1
5:
code before this statement never executed: case 5:
executed 1 time by 1 test: case 5:
Executed by:
  • libcrypto.so.1.1
tin1|=((unsigned long)(*(--(in))))<<24; case
never executed: case 4:
code before this statement executed 1 time by 1 test: case 4:
Executed by:
  • libcrypto.so.1.1
never executed: case 4:
4:
code before this statement executed 1 time by 1 test: case 4:
Executed by:
  • libcrypto.so.1.1
never executed: case 4:
tin0 =((unsigned long)(*(--(in)))) ; case
never executed: case 3:
code before this statement executed 1 time by 1 test: case 3:
Executed by:
  • libcrypto.so.1.1
never executed: case 3:
3:
code before this statement executed 1 time by 1 test: case 3:
Executed by:
  • libcrypto.so.1.1
never executed: case 3:
tin0|=((unsigned long)(*(--(in))))<< 8; case
never executed: case 2:
code before this statement executed 1 time by 1 test: case 2:
Executed by:
  • libcrypto.so.1.1
never executed: case 2:
2:
code before this statement executed 1 time by 1 test: case 2:
Executed by:
  • libcrypto.so.1.1
never executed: case 2:
tin0|=((unsigned long)(*(--(in))))<<16; case
executed 1 time by 1 test: case 1:
Executed by:
  • libcrypto.so.1.1
1:
executed 1 time by 1 test: case 1:
Executed by:
  • libcrypto.so.1.1
code before this statement executed 1 time by 1 test: case 1:
Executed by:
  • libcrypto.so.1.1
tin0|=((unsigned long)(*(--(in))))<<24; }
executed 1 time by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
};
0-1
106 tin0 ^= tout0;-
107 tin1 ^= tout1;-
108 tin[0] = tin0;-
109 tin[1] = tin1;-
110 BF_encrypt(tin, schedule);-
111 tout0 = tin[0];-
112 tout1 = tin[1];-
113 (*((out)++)=(unsigned char)(((tout0)>>24L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0) )&0xff));-
114 (*((out)++)=(unsigned char)(((tout1)>>24L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1) )&0xff));-
115 }
executed 1 time by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1
116 (*((ivec)++)=(unsigned char)(((tout0)>>24L)&0xff), *((ivec)++)=(unsigned char)(((tout0)>>16L)&0xff), *((ivec)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((ivec)++)=(unsigned char)(((tout0) )&0xff));-
117 (*((ivec)++)=(unsigned char)(((tout1)>>24L)&0xff), *((ivec)++)=(unsigned char)(((tout1)>>16L)&0xff), *((ivec)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((ivec)++)=(unsigned char)(((tout1) )&0xff));-
118 }
executed 155 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
155
119 (xor0 =((unsigned long)(*((ivec)++)))<<24L, xor0|=((unsigned long)(*((ivec)++)))<<16L, xor0|=((unsigned long)(*((ivec)++)))<< 8L, xor0|=((unsigned long)(*((ivec)++))));-
120 (xor1 =((unsigned long)(*((ivec)++)))<<24L, xor1|=((unsigned long)(*((ivec)++)))<<16L, xor1|=((unsigned long)(*((ivec)++)))<< 8L, xor1|=((unsigned long)(*((ivec)++))));-
121 ivec -= 8;-
122 for (l -= 8; l >= 0
l >= 0Description
TRUEevaluated 1821 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 108 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; l -= 8) {
108-1821
123 (tin0 =((unsigned long)(*((in)++)))<<24L, tin0|=((unsigned long)(*((in)++)))<<16L, tin0|=((unsigned long)(*((in)++)))<< 8L, tin0|=((unsigned long)(*((in)++))));-
124 (tin1 =((unsigned long)(*((in)++)))<<24L, tin1|=((unsigned long)(*((in)++)))<<16L, tin1|=((unsigned long)(*((in)++)))<< 8L, tin1|=((unsigned long)(*((in)++))));-
125 tin[0] = tin0;-
126 tin[1] = tin1;-
127 BF_decrypt(tin, schedule);-
128 tout0 = tin[0] ^ xor0;-
129 tout1 = tin[1] ^ xor1;-
130 (*((out)++)=(unsigned char)(((tout0)>>24L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0) )&0xff));-
131 (*((out)++)=(unsigned char)(((tout1)>>24L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1) )&0xff));-
132 xor0 = tin0;-
133 xor1 = tin1;-
134 }
executed 1821 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1821
135 if (l != -8
l != -8Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 107 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1-107
136 (tin0 =((unsigned long)(*((in)++)))<<24L, tin0|=((unsigned long)(*((in)++)))<<16L, tin0|=((unsigned long)(*((in)++)))<< 8L, tin0|=((unsigned long)(*((in)++))));-
137 (tin1 =((unsigned long)(*((in)++)))<<24L, tin1|=((unsigned long)(*((in)++)))<<16L, tin1|=((unsigned long)(*((in)++)))<< 8L, tin1|=((unsigned long)(*((in)++))));-
138 tin[0] = tin0;-
139 tin[1] = tin1;-
140 BF_decrypt(tin, schedule);-
141 tout0 = tin[0] ^ xor0;-
142 tout1 = tin[1] ^ xor1;-
143 { out+=l + 8; switch (l + 8) { case
never executed: case 8:
8:
never executed: case 8:
*(--(out))=(unsigned char)(((tout1) )&0xff); case
never executed: case 7:
7:
never executed: case 7:
code before this statement never executed: case 7:
*(--(out))=(unsigned char)(((tout1)>> 8)&0xff); case
never executed: case 6:
6:
never executed: case 6:
code before this statement never executed: case 6:
*(--(out))=(unsigned char)(((tout1)>>16)&0xff); case
executed 1 time by 1 test: case 5:
Executed by:
  • libcrypto.so.1.1
code before this statement never executed: case 5:
executed 1 time by 1 test: case 5:
Executed by:
  • libcrypto.so.1.1
5:
code before this statement never executed: case 5:
executed 1 time by 1 test: case 5:
Executed by:
  • libcrypto.so.1.1
*(--(out))=(unsigned char)(((tout1)>>24)&0xff); case
never executed: case 4:
code before this statement executed 1 time by 1 test: case 4:
Executed by:
  • libcrypto.so.1.1
never executed: case 4:
4:
code before this statement executed 1 time by 1 test: case 4:
Executed by:
  • libcrypto.so.1.1
never executed: case 4:
*(--(out))=(unsigned char)(((tout0) )&0xff); case
never executed: case 3:
code before this statement executed 1 time by 1 test: case 3:
Executed by:
  • libcrypto.so.1.1
never executed: case 3:
3:
code before this statement executed 1 time by 1 test: case 3:
Executed by:
  • libcrypto.so.1.1
never executed: case 3:
*(--(out))=(unsigned char)(((tout0)>> 8)&0xff); case
never executed: case 2:
code before this statement executed 1 time by 1 test: case 2:
Executed by:
  • libcrypto.so.1.1
never executed: case 2:
2:
code before this statement executed 1 time by 1 test: case 2:
Executed by:
  • libcrypto.so.1.1
never executed: case 2:
*(--(out))=(unsigned char)(((tout0)>>16)&0xff); case
executed 1 time by 1 test: case 1:
Executed by:
  • libcrypto.so.1.1
1:
executed 1 time by 1 test: case 1:
Executed by:
  • libcrypto.so.1.1
code before this statement executed 1 time by 1 test: case 1:
Executed by:
  • libcrypto.so.1.1
*(--(out))=(unsigned char)(((tout0)>>24)&0xff); }
executed 1 time by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
};
0-1
144 xor0 = tin0;-
145 xor1 = tin1;-
146 }
executed 1 time by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1
147 (*((ivec)++)=(unsigned char)(((xor0)>>24L)&0xff), *((ivec)++)=(unsigned char)(((xor0)>>16L)&0xff), *((ivec)++)=(unsigned char)(((xor0)>> 8L)&0xff), *((ivec)++)=(unsigned char)(((xor0) )&0xff));-
148 (*((ivec)++)=(unsigned char)(((xor1)>>24L)&0xff), *((ivec)++)=(unsigned char)(((xor1)>>16L)&0xff), *((ivec)++)=(unsigned char)(((xor1)>> 8L)&0xff), *((ivec)++)=(unsigned char)(((xor1) )&0xff));-
149 }
executed 108 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
108
150 tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0;-
151 tin[0] = tin[1] = 0;-
152}
executed 263 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
263
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2