Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/bn/bn_mul.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||||||||||||||
3 | unsigned long | - | ||||||||||||||||||||||||||||||||||||
4 | bn_sub_part_words(unsigned long *r, const unsigned long *a, const unsigned long *b, int cl, | - | ||||||||||||||||||||||||||||||||||||
5 | int dl) | - | ||||||||||||||||||||||||||||||||||||
6 | { | - | ||||||||||||||||||||||||||||||||||||
7 | unsigned long c, t; | - | ||||||||||||||||||||||||||||||||||||
8 | - | |||||||||||||||||||||||||||||||||||||
9 | - | |||||||||||||||||||||||||||||||||||||
10 | ((void) (0)) | - | ||||||||||||||||||||||||||||||||||||
11 | ; | - | ||||||||||||||||||||||||||||||||||||
12 | c = bn_sub_words(r, a, b, cl); | - | ||||||||||||||||||||||||||||||||||||
13 | - | |||||||||||||||||||||||||||||||||||||
14 | if (dl == 0
| 850-4734 | ||||||||||||||||||||||||||||||||||||
15 | return executed 4734 times by 7 tests: c;return c; Executed by:
executed 4734 times by 7 tests: return c; Executed by:
| 4734 | ||||||||||||||||||||||||||||||||||||
16 | - | |||||||||||||||||||||||||||||||||||||
17 | r += cl; | - | ||||||||||||||||||||||||||||||||||||
18 | a += cl; | - | ||||||||||||||||||||||||||||||||||||
19 | b += cl; | - | ||||||||||||||||||||||||||||||||||||
20 | - | |||||||||||||||||||||||||||||||||||||
21 | if (dl < 0
| 0-850 | ||||||||||||||||||||||||||||||||||||
22 | - | |||||||||||||||||||||||||||||||||||||
23 | - | |||||||||||||||||||||||||||||||||||||
24 | - | |||||||||||||||||||||||||||||||||||||
25 | - | |||||||||||||||||||||||||||||||||||||
26 | - | |||||||||||||||||||||||||||||||||||||
27 | for (;;) { | - | ||||||||||||||||||||||||||||||||||||
28 | t = b[0]; | - | ||||||||||||||||||||||||||||||||||||
29 | r[0] = (0 - t - c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
30 | if (t != 0
| 0 | ||||||||||||||||||||||||||||||||||||
31 | c = 1; never executed: c = 1; | 0 | ||||||||||||||||||||||||||||||||||||
32 | if (++
| 0 | ||||||||||||||||||||||||||||||||||||
33 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
34 | - | |||||||||||||||||||||||||||||||||||||
35 | t = b[1]; | - | ||||||||||||||||||||||||||||||||||||
36 | r[1] = (0 - t - c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
37 | if (t != 0
| 0 | ||||||||||||||||||||||||||||||||||||
38 | c = 1; never executed: c = 1; | 0 | ||||||||||||||||||||||||||||||||||||
39 | if (++
| 0 | ||||||||||||||||||||||||||||||||||||
40 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
41 | - | |||||||||||||||||||||||||||||||||||||
42 | t = b[2]; | - | ||||||||||||||||||||||||||||||||||||
43 | r[2] = (0 - t - c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
44 | if (t != 0
| 0 | ||||||||||||||||||||||||||||||||||||
45 | c = 1; never executed: c = 1; | 0 | ||||||||||||||||||||||||||||||||||||
46 | if (++
| 0 | ||||||||||||||||||||||||||||||||||||
47 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
48 | - | |||||||||||||||||||||||||||||||||||||
49 | t = b[3]; | - | ||||||||||||||||||||||||||||||||||||
50 | r[3] = (0 - t - c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
51 | if (t != 0
| 0 | ||||||||||||||||||||||||||||||||||||
52 | c = 1; never executed: c = 1; | 0 | ||||||||||||||||||||||||||||||||||||
53 | if (++
| 0 | ||||||||||||||||||||||||||||||||||||
54 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
55 | - | |||||||||||||||||||||||||||||||||||||
56 | b += 4; | - | ||||||||||||||||||||||||||||||||||||
57 | r += 4; | - | ||||||||||||||||||||||||||||||||||||
58 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
59 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
60 | int save_dl = dl; | - | ||||||||||||||||||||||||||||||||||||
61 | - | |||||||||||||||||||||||||||||||||||||
62 | - | |||||||||||||||||||||||||||||||||||||
63 | - | |||||||||||||||||||||||||||||||||||||
64 | - | |||||||||||||||||||||||||||||||||||||
65 | - | |||||||||||||||||||||||||||||||||||||
66 | while (c
| 370-548 | ||||||||||||||||||||||||||||||||||||
67 | t = a[0]; | - | ||||||||||||||||||||||||||||||||||||
68 | r[0] = (t - c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
69 | if (t != 0
| 0-370 | ||||||||||||||||||||||||||||||||||||
70 | c = 0; executed 370 times by 2 tests: c = 0; Executed by:
| 370 | ||||||||||||||||||||||||||||||||||||
71 | if (--
| 68-302 | ||||||||||||||||||||||||||||||||||||
72 | break; executed 302 times by 1 test: break; Executed by:
| 302 | ||||||||||||||||||||||||||||||||||||
73 | - | |||||||||||||||||||||||||||||||||||||
74 | t = a[1]; | - | ||||||||||||||||||||||||||||||||||||
75 | r[1] = (t - c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
76 | if (t != 0
| 0-68 | ||||||||||||||||||||||||||||||||||||
77 | c = 0; executed 68 times by 1 test: c = 0; Executed by:
| 68 | ||||||||||||||||||||||||||||||||||||
78 | if (--
| 0-68 | ||||||||||||||||||||||||||||||||||||
79 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
80 | - | |||||||||||||||||||||||||||||||||||||
81 | t = a[2]; | - | ||||||||||||||||||||||||||||||||||||
82 | r[2] = (t - c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
83 | if (t != 0
| 0-68 | ||||||||||||||||||||||||||||||||||||
84 | c = 0; executed 68 times by 1 test: c = 0; Executed by:
| 68 | ||||||||||||||||||||||||||||||||||||
85 | if (--
| 0-68 | ||||||||||||||||||||||||||||||||||||
86 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
87 | - | |||||||||||||||||||||||||||||||||||||
88 | t = a[3]; | - | ||||||||||||||||||||||||||||||||||||
89 | r[3] = (t - c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
90 | if (t != 0
| 2-66 | ||||||||||||||||||||||||||||||||||||
91 | c = 0; executed 66 times by 1 test: c = 0; Executed by:
| 66 | ||||||||||||||||||||||||||||||||||||
92 | if (--
| 0-68 | ||||||||||||||||||||||||||||||||||||
93 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
94 | - | |||||||||||||||||||||||||||||||||||||
95 | save_dl = dl; | - | ||||||||||||||||||||||||||||||||||||
96 | a += 4; | - | ||||||||||||||||||||||||||||||||||||
97 | r += 4; | - | ||||||||||||||||||||||||||||||||||||
98 | } executed 68 times by 1 test: end of block Executed by:
| 68 | ||||||||||||||||||||||||||||||||||||
99 | if (dl > 0
| 302-548 | ||||||||||||||||||||||||||||||||||||
100 | - | |||||||||||||||||||||||||||||||||||||
101 | - | |||||||||||||||||||||||||||||||||||||
102 | - | |||||||||||||||||||||||||||||||||||||
103 | - | |||||||||||||||||||||||||||||||||||||
104 | - | |||||||||||||||||||||||||||||||||||||
105 | if (save_dl > dl
| 0-548 | ||||||||||||||||||||||||||||||||||||
106 | switch (save_dl - dl) { | - | ||||||||||||||||||||||||||||||||||||
107 | case never executed: 1:case 1: never executed: case 1: | 0 | ||||||||||||||||||||||||||||||||||||
108 | r[1] = a[1]; | - | ||||||||||||||||||||||||||||||||||||
109 | if (--
| 0 | ||||||||||||||||||||||||||||||||||||
110 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
111 | case never executed: 2:case 2: never executed: case 2: code before this statement never executed: case 2: | 0 | ||||||||||||||||||||||||||||||||||||
112 | r[2] = a[2]; | - | ||||||||||||||||||||||||||||||||||||
113 | if (--
| 0 | ||||||||||||||||||||||||||||||||||||
114 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
115 | case never executed: 3:case 3: never executed: case 3: code before this statement never executed: case 3: | 0 | ||||||||||||||||||||||||||||||||||||
116 | r[3] = a[3]; | - | ||||||||||||||||||||||||||||||||||||
117 | if (--
| 0 | ||||||||||||||||||||||||||||||||||||
118 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
119 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
120 | a += 4; | - | ||||||||||||||||||||||||||||||||||||
121 | r += 4; | - | ||||||||||||||||||||||||||||||||||||
122 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
123 | } executed 548 times by 2 tests: end of block Executed by:
| 548 | ||||||||||||||||||||||||||||||||||||
124 | if (dl > 0
| 302-548 | ||||||||||||||||||||||||||||||||||||
125 | - | |||||||||||||||||||||||||||||||||||||
126 | - | |||||||||||||||||||||||||||||||||||||
127 | - | |||||||||||||||||||||||||||||||||||||
128 | - | |||||||||||||||||||||||||||||||||||||
129 | - | |||||||||||||||||||||||||||||||||||||
130 | for (;;) { | - | ||||||||||||||||||||||||||||||||||||
131 | r[0] = a[0]; | - | ||||||||||||||||||||||||||||||||||||
132 | if (--
| 152-1606 | ||||||||||||||||||||||||||||||||||||
133 | break; executed 152 times by 2 tests: break; Executed by:
| 152 | ||||||||||||||||||||||||||||||||||||
134 | r[1] = a[1]; | - | ||||||||||||||||||||||||||||||||||||
135 | if (--
| 150-1456 | ||||||||||||||||||||||||||||||||||||
136 | break; executed 150 times by 1 test: break; Executed by:
| 150 | ||||||||||||||||||||||||||||||||||||
137 | r[2] = a[2]; | - | ||||||||||||||||||||||||||||||||||||
138 | if (--
| 150-1306 | ||||||||||||||||||||||||||||||||||||
139 | break; executed 150 times by 1 test: break; Executed by:
| 150 | ||||||||||||||||||||||||||||||||||||
140 | r[3] = a[3]; | - | ||||||||||||||||||||||||||||||||||||
141 | if (--
| 96-1210 | ||||||||||||||||||||||||||||||||||||
142 | break; executed 96 times by 1 test: break; Executed by:
| 96 | ||||||||||||||||||||||||||||||||||||
143 | - | |||||||||||||||||||||||||||||||||||||
144 | a += 4; | - | ||||||||||||||||||||||||||||||||||||
145 | r += 4; | - | ||||||||||||||||||||||||||||||||||||
146 | } executed 1210 times by 1 test: end of block Executed by:
| 1210 | ||||||||||||||||||||||||||||||||||||
147 | } executed 548 times by 2 tests: end of block Executed by:
| 548 | ||||||||||||||||||||||||||||||||||||
148 | } executed 850 times by 2 tests: end of block Executed by:
| 850 | ||||||||||||||||||||||||||||||||||||
149 | return executed 850 times by 2 tests: c;return c; Executed by:
executed 850 times by 2 tests: return c; Executed by:
| 850 | ||||||||||||||||||||||||||||||||||||
150 | } | - | ||||||||||||||||||||||||||||||||||||
151 | - | |||||||||||||||||||||||||||||||||||||
152 | - | |||||||||||||||||||||||||||||||||||||
153 | unsigned long | - | ||||||||||||||||||||||||||||||||||||
154 | bn_add_part_words(unsigned long *r, const unsigned long *a, const unsigned long *b, int cl, | - | ||||||||||||||||||||||||||||||||||||
155 | int dl) | - | ||||||||||||||||||||||||||||||||||||
156 | { | - | ||||||||||||||||||||||||||||||||||||
157 | unsigned long c, l, t; | - | ||||||||||||||||||||||||||||||||||||
158 | - | |||||||||||||||||||||||||||||||||||||
159 | - | |||||||||||||||||||||||||||||||||||||
160 | ((void) (0)) | - | ||||||||||||||||||||||||||||||||||||
161 | ; | - | ||||||||||||||||||||||||||||||||||||
162 | c = bn_add_words(r, a, b, cl); | - | ||||||||||||||||||||||||||||||||||||
163 | - | |||||||||||||||||||||||||||||||||||||
164 | if (dl == 0
| 0 | ||||||||||||||||||||||||||||||||||||
165 | return never executed: c;return c; never executed: return c; | 0 | ||||||||||||||||||||||||||||||||||||
166 | - | |||||||||||||||||||||||||||||||||||||
167 | r += cl; | - | ||||||||||||||||||||||||||||||||||||
168 | a += cl; | - | ||||||||||||||||||||||||||||||||||||
169 | b += cl; | - | ||||||||||||||||||||||||||||||||||||
170 | - | |||||||||||||||||||||||||||||||||||||
171 | if (dl < 0
| 0 | ||||||||||||||||||||||||||||||||||||
172 | int save_dl = dl; | - | ||||||||||||||||||||||||||||||||||||
173 | - | |||||||||||||||||||||||||||||||||||||
174 | - | |||||||||||||||||||||||||||||||||||||
175 | - | |||||||||||||||||||||||||||||||||||||
176 | - | |||||||||||||||||||||||||||||||||||||
177 | - | |||||||||||||||||||||||||||||||||||||
178 | while (c
| 0 | ||||||||||||||||||||||||||||||||||||
179 | l = (c + b[0]) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
180 | c = (l < c); | - | ||||||||||||||||||||||||||||||||||||
181 | r[0] = l; | - | ||||||||||||||||||||||||||||||||||||
182 | if (++
| 0 | ||||||||||||||||||||||||||||||||||||
183 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
184 | - | |||||||||||||||||||||||||||||||||||||
185 | l = (c + b[1]) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
186 | c = (l < c); | - | ||||||||||||||||||||||||||||||||||||
187 | r[1] = l; | - | ||||||||||||||||||||||||||||||||||||
188 | if (++
| 0 | ||||||||||||||||||||||||||||||||||||
189 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
190 | - | |||||||||||||||||||||||||||||||||||||
191 | l = (c + b[2]) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
192 | c = (l < c); | - | ||||||||||||||||||||||||||||||||||||
193 | r[2] = l; | - | ||||||||||||||||||||||||||||||||||||
194 | if (++
| 0 | ||||||||||||||||||||||||||||||||||||
195 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
196 | - | |||||||||||||||||||||||||||||||||||||
197 | l = (c + b[3]) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
198 | c = (l < c); | - | ||||||||||||||||||||||||||||||||||||
199 | r[3] = l; | - | ||||||||||||||||||||||||||||||||||||
200 | if (++
| 0 | ||||||||||||||||||||||||||||||||||||
201 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
202 | - | |||||||||||||||||||||||||||||||||||||
203 | save_dl = dl; | - | ||||||||||||||||||||||||||||||||||||
204 | b += 4; | - | ||||||||||||||||||||||||||||||||||||
205 | r += 4; | - | ||||||||||||||||||||||||||||||||||||
206 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
207 | if (dl < 0
| 0 | ||||||||||||||||||||||||||||||||||||
208 | - | |||||||||||||||||||||||||||||||||||||
209 | - | |||||||||||||||||||||||||||||||||||||
210 | - | |||||||||||||||||||||||||||||||||||||
211 | - | |||||||||||||||||||||||||||||||||||||
212 | - | |||||||||||||||||||||||||||||||||||||
213 | if (save_dl < dl
| 0 | ||||||||||||||||||||||||||||||||||||
214 | switch (dl - save_dl) { | - | ||||||||||||||||||||||||||||||||||||
215 | case never executed: 1:case 1: never executed: case 1: | 0 | ||||||||||||||||||||||||||||||||||||
216 | r[1] = b[1]; | - | ||||||||||||||||||||||||||||||||||||
217 | if (++
| 0 | ||||||||||||||||||||||||||||||||||||
218 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
219 | case never executed: 2:case 2: never executed: case 2: code before this statement never executed: case 2: | 0 | ||||||||||||||||||||||||||||||||||||
220 | r[2] = b[2]; | - | ||||||||||||||||||||||||||||||||||||
221 | if (++
| 0 | ||||||||||||||||||||||||||||||||||||
222 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
223 | case never executed: 3:case 3: never executed: case 3: code before this statement never executed: case 3: | 0 | ||||||||||||||||||||||||||||||||||||
224 | r[3] = b[3]; | - | ||||||||||||||||||||||||||||||||||||
225 | if (++
| 0 | ||||||||||||||||||||||||||||||||||||
226 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
227 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
228 | b += 4; | - | ||||||||||||||||||||||||||||||||||||
229 | r += 4; | - | ||||||||||||||||||||||||||||||||||||
230 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
231 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
232 | if (dl < 0
| 0 | ||||||||||||||||||||||||||||||||||||
233 | - | |||||||||||||||||||||||||||||||||||||
234 | - | |||||||||||||||||||||||||||||||||||||
235 | - | |||||||||||||||||||||||||||||||||||||
236 | - | |||||||||||||||||||||||||||||||||||||
237 | - | |||||||||||||||||||||||||||||||||||||
238 | for (;;) { | - | ||||||||||||||||||||||||||||||||||||
239 | r[0] = b[0]; | - | ||||||||||||||||||||||||||||||||||||
240 | if (++
| 0 | ||||||||||||||||||||||||||||||||||||
241 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
242 | r[1] = b[1]; | - | ||||||||||||||||||||||||||||||||||||
243 | if (++
| 0 | ||||||||||||||||||||||||||||||||||||
244 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
245 | r[2] = b[2]; | - | ||||||||||||||||||||||||||||||||||||
246 | if (++
| 0 | ||||||||||||||||||||||||||||||||||||
247 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
248 | r[3] = b[3]; | - | ||||||||||||||||||||||||||||||||||||
249 | if (++
| 0 | ||||||||||||||||||||||||||||||||||||
250 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
251 | - | |||||||||||||||||||||||||||||||||||||
252 | b += 4; | - | ||||||||||||||||||||||||||||||||||||
253 | r += 4; | - | ||||||||||||||||||||||||||||||||||||
254 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
255 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
256 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
257 | int save_dl = dl; | - | ||||||||||||||||||||||||||||||||||||
258 | - | |||||||||||||||||||||||||||||||||||||
259 | - | |||||||||||||||||||||||||||||||||||||
260 | - | |||||||||||||||||||||||||||||||||||||
261 | - | |||||||||||||||||||||||||||||||||||||
262 | while (c
| 0 | ||||||||||||||||||||||||||||||||||||
263 | t = (a[0] + c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
264 | c = (t < c); | - | ||||||||||||||||||||||||||||||||||||
265 | r[0] = t; | - | ||||||||||||||||||||||||||||||||||||
266 | if (--
| 0 | ||||||||||||||||||||||||||||||||||||
267 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
268 | - | |||||||||||||||||||||||||||||||||||||
269 | t = (a[1] + c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
270 | c = (t < c); | - | ||||||||||||||||||||||||||||||||||||
271 | r[1] = t; | - | ||||||||||||||||||||||||||||||||||||
272 | if (--
| 0 | ||||||||||||||||||||||||||||||||||||
273 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
274 | - | |||||||||||||||||||||||||||||||||||||
275 | t = (a[2] + c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
276 | c = (t < c); | - | ||||||||||||||||||||||||||||||||||||
277 | r[2] = t; | - | ||||||||||||||||||||||||||||||||||||
278 | if (--
| 0 | ||||||||||||||||||||||||||||||||||||
279 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
280 | - | |||||||||||||||||||||||||||||||||||||
281 | t = (a[3] + c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
282 | c = (t < c); | - | ||||||||||||||||||||||||||||||||||||
283 | r[3] = t; | - | ||||||||||||||||||||||||||||||||||||
284 | if (--
| 0 | ||||||||||||||||||||||||||||||||||||
285 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
286 | - | |||||||||||||||||||||||||||||||||||||
287 | save_dl = dl; | - | ||||||||||||||||||||||||||||||||||||
288 | a += 4; | - | ||||||||||||||||||||||||||||||||||||
289 | r += 4; | - | ||||||||||||||||||||||||||||||||||||
290 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
291 | - | |||||||||||||||||||||||||||||||||||||
292 | - | |||||||||||||||||||||||||||||||||||||
293 | - | |||||||||||||||||||||||||||||||||||||
294 | - | |||||||||||||||||||||||||||||||||||||
295 | if (dl > 0
| 0 | ||||||||||||||||||||||||||||||||||||
296 | if (save_dl > dl
| 0 | ||||||||||||||||||||||||||||||||||||
297 | switch (save_dl - dl) { | - | ||||||||||||||||||||||||||||||||||||
298 | case never executed: 1:case 1: never executed: case 1: | 0 | ||||||||||||||||||||||||||||||||||||
299 | r[1] = a[1]; | - | ||||||||||||||||||||||||||||||||||||
300 | if (--
| 0 | ||||||||||||||||||||||||||||||||||||
301 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
302 | case never executed: 2:case 2: never executed: case 2: code before this statement never executed: case 2: | 0 | ||||||||||||||||||||||||||||||||||||
303 | r[2] = a[2]; | - | ||||||||||||||||||||||||||||||||||||
304 | if (--
| 0 | ||||||||||||||||||||||||||||||||||||
305 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
306 | case never executed: 3:case 3: never executed: case 3: code before this statement never executed: case 3: | 0 | ||||||||||||||||||||||||||||||||||||
307 | r[3] = a[3]; | - | ||||||||||||||||||||||||||||||||||||
308 | if (--
| 0 | ||||||||||||||||||||||||||||||||||||
309 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
310 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
311 | a += 4; | - | ||||||||||||||||||||||||||||||||||||
312 | r += 4; | - | ||||||||||||||||||||||||||||||||||||
313 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
314 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
315 | if (dl > 0
| 0 | ||||||||||||||||||||||||||||||||||||
316 | - | |||||||||||||||||||||||||||||||||||||
317 | - | |||||||||||||||||||||||||||||||||||||
318 | - | |||||||||||||||||||||||||||||||||||||
319 | - | |||||||||||||||||||||||||||||||||||||
320 | - | |||||||||||||||||||||||||||||||||||||
321 | for (;;) { | - | ||||||||||||||||||||||||||||||||||||
322 | r[0] = a[0]; | - | ||||||||||||||||||||||||||||||||||||
323 | if (--
| 0 | ||||||||||||||||||||||||||||||||||||
324 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
325 | r[1] = a[1]; | - | ||||||||||||||||||||||||||||||||||||
326 | if (--
| 0 | ||||||||||||||||||||||||||||||||||||
327 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
328 | r[2] = a[2]; | - | ||||||||||||||||||||||||||||||||||||
329 | if (--
| 0 | ||||||||||||||||||||||||||||||||||||
330 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
331 | r[3] = a[3]; | - | ||||||||||||||||||||||||||||||||||||
332 | if (--
| 0 | ||||||||||||||||||||||||||||||||||||
333 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
334 | - | |||||||||||||||||||||||||||||||||||||
335 | a += 4; | - | ||||||||||||||||||||||||||||||||||||
336 | r += 4; | - | ||||||||||||||||||||||||||||||||||||
337 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
338 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
339 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
340 | return never executed: c;return c; never executed: return c; | 0 | ||||||||||||||||||||||||||||||||||||
341 | } | - | ||||||||||||||||||||||||||||||||||||
342 | void | - | ||||||||||||||||||||||||||||||||||||
343 | bn_mul_recursive(unsigned long *r, unsigned long *a, unsigned long *b, int n2, int dna, | - | ||||||||||||||||||||||||||||||||||||
344 | int dnb, unsigned long *t) | - | ||||||||||||||||||||||||||||||||||||
345 | { | - | ||||||||||||||||||||||||||||||||||||
346 | int n = n2 / 2, c1, c2; | - | ||||||||||||||||||||||||||||||||||||
347 | int tna = n + dna, tnb = n + dnb; | - | ||||||||||||||||||||||||||||||||||||
348 | unsigned int neg, zero; | - | ||||||||||||||||||||||||||||||||||||
349 | unsigned long ln, lo, *p; | - | ||||||||||||||||||||||||||||||||||||
350 | if (n2 == 8
| 31-2518 | ||||||||||||||||||||||||||||||||||||
351 | bn_mul_comba8(r, a, b); | - | ||||||||||||||||||||||||||||||||||||
352 | return; executed 302 times by 1 test: return; Executed by:
| 302 | ||||||||||||||||||||||||||||||||||||
353 | } | - | ||||||||||||||||||||||||||||||||||||
354 | - | |||||||||||||||||||||||||||||||||||||
355 | - | |||||||||||||||||||||||||||||||||||||
356 | if (n2 < (16)
| 175-2518 | ||||||||||||||||||||||||||||||||||||
357 | bn_mul_normal(r, a, n2 + dna, b, n2 + dnb); | - | ||||||||||||||||||||||||||||||||||||
358 | if ((
| 0-175 | ||||||||||||||||||||||||||||||||||||
359 | memset(&r[2*n2 + dna + dnb], 0, executed 175 times by 2 tests: memset(&r[2*n2 + dna + dnb], 0, sizeof(unsigned long) * -(dna + dnb)); Executed by:
| 175 | ||||||||||||||||||||||||||||||||||||
360 | sizeof(unsigned long) * -(dna + dnb)); executed 175 times by 2 tests: memset(&r[2*n2 + dna + dnb], 0, sizeof(unsigned long) * -(dna + dnb)); Executed by:
| 175 | ||||||||||||||||||||||||||||||||||||
361 | return; executed 175 times by 2 tests: return; Executed by:
| 175 | ||||||||||||||||||||||||||||||||||||
362 | } | - | ||||||||||||||||||||||||||||||||||||
363 | - | |||||||||||||||||||||||||||||||||||||
364 | c1 = bn_cmp_part_words(a, &(a[n]), tna, n - tna); | - | ||||||||||||||||||||||||||||||||||||
365 | c2 = bn_cmp_part_words(&(b[n]), b,tnb, tnb - n); | - | ||||||||||||||||||||||||||||||||||||
366 | zero = neg = 0; | - | ||||||||||||||||||||||||||||||||||||
367 | switch (c1 * 3 + c2) { | - | ||||||||||||||||||||||||||||||||||||
368 | case executed 543 times by 7 tests: -4:case -4: Executed by:
executed 543 times by 7 tests: case -4: Executed by:
| 543 | ||||||||||||||||||||||||||||||||||||
369 | bn_sub_part_words(t, &(a[n]), a, tna, tna - n); | - | ||||||||||||||||||||||||||||||||||||
370 | bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); | - | ||||||||||||||||||||||||||||||||||||
371 | break; executed 543 times by 7 tests: break; Executed by:
| 543 | ||||||||||||||||||||||||||||||||||||
372 | case never executed: -3:case -3: never executed: case -3: | 0 | ||||||||||||||||||||||||||||||||||||
373 | zero = 1; | - | ||||||||||||||||||||||||||||||||||||
374 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
375 | case executed 379 times by 7 tests: -2:case -2: Executed by:
executed 379 times by 7 tests: case -2: Executed by:
| 379 | ||||||||||||||||||||||||||||||||||||
376 | bn_sub_part_words(t, &(a[n]), a, tna, tna - n); | - | ||||||||||||||||||||||||||||||||||||
377 | bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n); | - | ||||||||||||||||||||||||||||||||||||
378 | neg = 1; | - | ||||||||||||||||||||||||||||||||||||
379 | break; executed 379 times by 7 tests: break; Executed by:
| 379 | ||||||||||||||||||||||||||||||||||||
380 | case never executed: -1:case -1: never executed: case -1: | 0 | ||||||||||||||||||||||||||||||||||||
381 | case never executed: 0:case 0: never executed: case 0: | 0 | ||||||||||||||||||||||||||||||||||||
382 | case never executed: 1:case 1: never executed: case 1: | 0 | ||||||||||||||||||||||||||||||||||||
383 | zero = 1; | - | ||||||||||||||||||||||||||||||||||||
384 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
385 | case executed 1065 times by 7 tests: 2:case 2: Executed by:
executed 1065 times by 7 tests: case 2: Executed by:
| 1065 | ||||||||||||||||||||||||||||||||||||
386 | bn_sub_part_words(t, a, &(a[n]), tna, n - tna); | - | ||||||||||||||||||||||||||||||||||||
387 | bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); | - | ||||||||||||||||||||||||||||||||||||
388 | neg = 1; | - | ||||||||||||||||||||||||||||||||||||
389 | break; executed 1065 times by 7 tests: break; Executed by:
| 1065 | ||||||||||||||||||||||||||||||||||||
390 | case never executed: 3:case 3: never executed: case 3: | 0 | ||||||||||||||||||||||||||||||||||||
391 | zero = 1; | - | ||||||||||||||||||||||||||||||||||||
392 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
393 | case executed 531 times by 7 tests: 4:case 4: Executed by:
executed 531 times by 7 tests: case 4: Executed by:
| 531 | ||||||||||||||||||||||||||||||||||||
394 | bn_sub_part_words(t, a, &(a[n]), tna, n - tna); | - | ||||||||||||||||||||||||||||||||||||
395 | bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n); | - | ||||||||||||||||||||||||||||||||||||
396 | break; executed 531 times by 7 tests: break; Executed by:
| 531 | ||||||||||||||||||||||||||||||||||||
397 | } | - | ||||||||||||||||||||||||||||||||||||
398 | - | |||||||||||||||||||||||||||||||||||||
399 | - | |||||||||||||||||||||||||||||||||||||
400 | if (n == 4
| 0-2518 | ||||||||||||||||||||||||||||||||||||
401 | - | |||||||||||||||||||||||||||||||||||||
402 | { | - | ||||||||||||||||||||||||||||||||||||
403 | if (!zero
| 0 | ||||||||||||||||||||||||||||||||||||
404 | bn_mul_comba4(&(t[n2]), t, &(t[n])); never executed: bn_mul_comba4(&(t[n2]), t, &(t[n])); | 0 | ||||||||||||||||||||||||||||||||||||
405 | else | - | ||||||||||||||||||||||||||||||||||||
406 | memset(&(t[n2]), 0, 8 * sizeof(unsigned long)); never executed: memset(&(t[n2]), 0, 8 * sizeof(unsigned long)); | 0 | ||||||||||||||||||||||||||||||||||||
407 | - | |||||||||||||||||||||||||||||||||||||
408 | bn_mul_comba4(r, a, b); | - | ||||||||||||||||||||||||||||||||||||
409 | bn_mul_comba4(&(r[n2]), &(a[n]), &(b[n])); | - | ||||||||||||||||||||||||||||||||||||
410 | } never executed: else if (n == 8end of block
| 0-2235 | ||||||||||||||||||||||||||||||||||||
411 | - | |||||||||||||||||||||||||||||||||||||
412 | - | |||||||||||||||||||||||||||||||||||||
413 | { | - | ||||||||||||||||||||||||||||||||||||
414 | if (!zero
| 0-2084 | ||||||||||||||||||||||||||||||||||||
415 | bn_mul_comba8(&(t[n2]), t, &(t[n])); executed 2084 times by 7 tests: bn_mul_comba8(&(t[n2]), t, &(t[n])); Executed by:
| 2084 | ||||||||||||||||||||||||||||||||||||
416 | else | - | ||||||||||||||||||||||||||||||||||||
417 | memset(&(t[n2]), 0, 16 * sizeof(unsigned long)); never executed: memset(&(t[n2]), 0, 16 * sizeof(unsigned long)); | 0 | ||||||||||||||||||||||||||||||||||||
418 | - | |||||||||||||||||||||||||||||||||||||
419 | bn_mul_comba8(r, a, b); | - | ||||||||||||||||||||||||||||||||||||
420 | bn_mul_comba8(&(r[n2]), &(a[n]), &(b[n])); | - | ||||||||||||||||||||||||||||||||||||
421 | } executed 2084 times by 7 tests: elseend of block Executed by:
| 2084 | ||||||||||||||||||||||||||||||||||||
422 | - | |||||||||||||||||||||||||||||||||||||
423 | { | - | ||||||||||||||||||||||||||||||||||||
424 | p = &(t[n2 * 2]); | - | ||||||||||||||||||||||||||||||||||||
425 | if (!zero
| 0-434 | ||||||||||||||||||||||||||||||||||||
426 | bn_mul_recursive(&(t[n2]), t, &(t[n]), n, 0, 0, p); executed 434 times by 5 tests: bn_mul_recursive(&(t[n2]), t, &(t[n]), n, 0, 0, p); Executed by:
| 434 | ||||||||||||||||||||||||||||||||||||
427 | else | - | ||||||||||||||||||||||||||||||||||||
428 | memset(&(t[n2]), 0, n2 * sizeof(unsigned long)); never executed: memset(&(t[n2]), 0, n2 * sizeof(unsigned long)); | 0 | ||||||||||||||||||||||||||||||||||||
429 | bn_mul_recursive(r, a, b, n, 0, 0, p); | - | ||||||||||||||||||||||||||||||||||||
430 | bn_mul_recursive(&(r[n2]), &(a[n]), &(b[n]), n, dna, dnb, p); | - | ||||||||||||||||||||||||||||||||||||
431 | } executed 434 times by 5 tests: end of block Executed by:
| 434 | ||||||||||||||||||||||||||||||||||||
432 | - | |||||||||||||||||||||||||||||||||||||
433 | - | |||||||||||||||||||||||||||||||||||||
434 | - | |||||||||||||||||||||||||||||||||||||
435 | - | |||||||||||||||||||||||||||||||||||||
436 | - | |||||||||||||||||||||||||||||||||||||
437 | - | |||||||||||||||||||||||||||||||||||||
438 | c1 = (int)(bn_add_words(t, r, &(r[n2]), n2)); | - | ||||||||||||||||||||||||||||||||||||
439 | - | |||||||||||||||||||||||||||||||||||||
440 | if (neg
| 1074-1444 | ||||||||||||||||||||||||||||||||||||
441 | { | - | ||||||||||||||||||||||||||||||||||||
442 | c1 -= (int)(bn_sub_words(&(t[n2]), t, &(t[n2]), n2)); | - | ||||||||||||||||||||||||||||||||||||
443 | } executed 1444 times by 7 tests: else {end of block Executed by:
| 1444 | ||||||||||||||||||||||||||||||||||||
444 | - | |||||||||||||||||||||||||||||||||||||
445 | c1 += (int)(bn_add_words(&(t[n2]), &(t[n2]), t, n2)); | - | ||||||||||||||||||||||||||||||||||||
446 | } executed 1074 times by 7 tests: end of block Executed by:
| 1074 | ||||||||||||||||||||||||||||||||||||
447 | - | |||||||||||||||||||||||||||||||||||||
448 | - | |||||||||||||||||||||||||||||||||||||
449 | - | |||||||||||||||||||||||||||||||||||||
450 | - | |||||||||||||||||||||||||||||||||||||
451 | - | |||||||||||||||||||||||||||||||||||||
452 | - | |||||||||||||||||||||||||||||||||||||
453 | c1 += (int)(bn_add_words(&(r[n]), &(r[n]), &(t[n2]), n2)); | - | ||||||||||||||||||||||||||||||||||||
454 | if (c1
| 1023-1495 | ||||||||||||||||||||||||||||||||||||
455 | p = &(r[n + n2]); | - | ||||||||||||||||||||||||||||||||||||
456 | lo= *p; | - | ||||||||||||||||||||||||||||||||||||
457 | ln = (lo + c1) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
458 | *p = ln; | - | ||||||||||||||||||||||||||||||||||||
459 | - | |||||||||||||||||||||||||||||||||||||
460 | - | |||||||||||||||||||||||||||||||||||||
461 | - | |||||||||||||||||||||||||||||||||||||
462 | if (ln < (unsigned long)c1
| 0-1023 | ||||||||||||||||||||||||||||||||||||
463 | do { | - | ||||||||||||||||||||||||||||||||||||
464 | p++; | - | ||||||||||||||||||||||||||||||||||||
465 | lo= *p; | - | ||||||||||||||||||||||||||||||||||||
466 | ln = (lo + 1) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
467 | *p = ln; | - | ||||||||||||||||||||||||||||||||||||
468 | } never executed: while (ln == 0end of block
| 0 | ||||||||||||||||||||||||||||||||||||
469 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
470 | } executed 1023 times by 7 tests: end of block Executed by:
| 1023 | ||||||||||||||||||||||||||||||||||||
471 | } executed 2518 times by 7 tests: end of block Executed by:
| 2518 | ||||||||||||||||||||||||||||||||||||
472 | - | |||||||||||||||||||||||||||||||||||||
473 | - | |||||||||||||||||||||||||||||||||||||
474 | - | |||||||||||||||||||||||||||||||||||||
475 | - | |||||||||||||||||||||||||||||||||||||
476 | void | - | ||||||||||||||||||||||||||||||||||||
477 | bn_mul_part_recursive(unsigned long *r, unsigned long *a, unsigned long *b, int n, int tna, | - | ||||||||||||||||||||||||||||||||||||
478 | int tnb, unsigned long *t) | - | ||||||||||||||||||||||||||||||||||||
479 | { | - | ||||||||||||||||||||||||||||||||||||
480 | int i, j, n2 = n * 2; | - | ||||||||||||||||||||||||||||||||||||
481 | int c1, c2, neg; | - | ||||||||||||||||||||||||||||||||||||
482 | unsigned long ln, lo, *p; | - | ||||||||||||||||||||||||||||||||||||
483 | - | |||||||||||||||||||||||||||||||||||||
484 | - | |||||||||||||||||||||||||||||||||||||
485 | - | |||||||||||||||||||||||||||||||||||||
486 | - | |||||||||||||||||||||||||||||||||||||
487 | - | |||||||||||||||||||||||||||||||||||||
488 | if (n < 8
| 0-274 | ||||||||||||||||||||||||||||||||||||
489 | bn_mul_normal(r, a, n + tna, b, n + tnb); | - | ||||||||||||||||||||||||||||||||||||
490 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
491 | } | - | ||||||||||||||||||||||||||||||||||||
492 | - | |||||||||||||||||||||||||||||||||||||
493 | - | |||||||||||||||||||||||||||||||||||||
494 | c1 = bn_cmp_part_words(a, &(a[n]), tna, n - tna); | - | ||||||||||||||||||||||||||||||||||||
495 | c2 = bn_cmp_part_words(&(b[n]), b, tnb, tnb - n); | - | ||||||||||||||||||||||||||||||||||||
496 | neg = 0; | - | ||||||||||||||||||||||||||||||||||||
497 | switch (c1 * 3 + c2) { | - | ||||||||||||||||||||||||||||||||||||
498 | case never executed: -4:case -4: never executed: case -4: | 0 | ||||||||||||||||||||||||||||||||||||
499 | bn_sub_part_words(t, &(a[n]), a, tna, tna - n); | - | ||||||||||||||||||||||||||||||||||||
500 | bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); | - | ||||||||||||||||||||||||||||||||||||
501 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
502 | case never executed: -3:case -3: never executed: case -3: | 0 | ||||||||||||||||||||||||||||||||||||
503 | - | |||||||||||||||||||||||||||||||||||||
504 | case never executed: -2:case -2: never executed: case -2: | 0 | ||||||||||||||||||||||||||||||||||||
505 | bn_sub_part_words(t, &(a[n]), a, tna, tna - n); | - | ||||||||||||||||||||||||||||||||||||
506 | bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n); | - | ||||||||||||||||||||||||||||||||||||
507 | neg = 1; | - | ||||||||||||||||||||||||||||||||||||
508 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
509 | case never executed: -1:case -1: never executed: case -1: | 0 | ||||||||||||||||||||||||||||||||||||
510 | case never executed: 0:case 0: never executed: case 0: | 0 | ||||||||||||||||||||||||||||||||||||
511 | case never executed: 1:case 1: never executed: case 1: | 0 | ||||||||||||||||||||||||||||||||||||
512 | - | |||||||||||||||||||||||||||||||||||||
513 | case executed 274 times by 2 tests: 2:case 2: Executed by:
executed 274 times by 2 tests: case 2: Executed by:
| 274 | ||||||||||||||||||||||||||||||||||||
514 | bn_sub_part_words(t, a, &(a[n]), tna, n - tna); | - | ||||||||||||||||||||||||||||||||||||
515 | bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); | - | ||||||||||||||||||||||||||||||||||||
516 | neg = 1; | - | ||||||||||||||||||||||||||||||||||||
517 | break; executed 274 times by 2 tests: break; Executed by:
| 274 | ||||||||||||||||||||||||||||||||||||
518 | case never executed: 3:case 3: never executed: case 3: | 0 | ||||||||||||||||||||||||||||||||||||
519 | - | |||||||||||||||||||||||||||||||||||||
520 | case never executed: 4:case 4: never executed: case 4: | 0 | ||||||||||||||||||||||||||||||||||||
521 | bn_sub_part_words(t, a, &(a[n]), tna, n - tna); | - | ||||||||||||||||||||||||||||||||||||
522 | bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n); | - | ||||||||||||||||||||||||||||||||||||
523 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
524 | } | - | ||||||||||||||||||||||||||||||||||||
525 | if (n == 8
| 2-272 | ||||||||||||||||||||||||||||||||||||
526 | bn_mul_comba8(&(t[n2]), t, &(t[n])); | - | ||||||||||||||||||||||||||||||||||||
527 | bn_mul_comba8(r, a, b); | - | ||||||||||||||||||||||||||||||||||||
528 | bn_mul_normal(&(r[n2]), &(a[n]), tna, &(b[n]), tnb); | - | ||||||||||||||||||||||||||||||||||||
529 | memset(&(r[n2 + tna + tnb]), 0, | - | ||||||||||||||||||||||||||||||||||||
530 | sizeof(unsigned long) * (n2 - tna - tnb)); | - | ||||||||||||||||||||||||||||||||||||
531 | } executed 2 times by 1 test: else {end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||
532 | p = &(t[n2*2]); | - | ||||||||||||||||||||||||||||||||||||
533 | bn_mul_recursive(&(t[n2]), t, &(t[n]), n, 0, 0, p); | - | ||||||||||||||||||||||||||||||||||||
534 | bn_mul_recursive(r, a, b, n, 0, 0, p); | - | ||||||||||||||||||||||||||||||||||||
535 | i = n / 2; | - | ||||||||||||||||||||||||||||||||||||
536 | - | |||||||||||||||||||||||||||||||||||||
537 | - | |||||||||||||||||||||||||||||||||||||
538 | if (tna > tnb
| 0-272 | ||||||||||||||||||||||||||||||||||||
539 | j = tna - i; never executed: j = tna - i; | 0 | ||||||||||||||||||||||||||||||||||||
540 | else | - | ||||||||||||||||||||||||||||||||||||
541 | j = tnb - i; executed 272 times by 2 tests: j = tnb - i; Executed by:
| 272 | ||||||||||||||||||||||||||||||||||||
542 | if (j == 0
| 24-248 | ||||||||||||||||||||||||||||||||||||
543 | bn_mul_recursive(&(r[n2]), &(a[n]), &(b[n]), | - | ||||||||||||||||||||||||||||||||||||
544 | i, tna - i, tnb - i, p); | - | ||||||||||||||||||||||||||||||||||||
545 | memset(&(r[n2 + i * 2]), 0, | - | ||||||||||||||||||||||||||||||||||||
546 | sizeof(unsigned long) * (n2 - i * 2)); | - | ||||||||||||||||||||||||||||||||||||
547 | } executed 24 times by 1 test: end of block Executed by:
| 24 | ||||||||||||||||||||||||||||||||||||
548 | else if (j > 0
| 2-246 | ||||||||||||||||||||||||||||||||||||
549 | { | - | ||||||||||||||||||||||||||||||||||||
550 | bn_mul_part_recursive(&(r[n2]), &(a[n]), &(b[n]), | - | ||||||||||||||||||||||||||||||||||||
551 | i, tna - i, tnb - i, p); | - | ||||||||||||||||||||||||||||||||||||
552 | memset(&(r[n2 + tna + tnb]), 0, | - | ||||||||||||||||||||||||||||||||||||
553 | sizeof(unsigned long) * (n2 - tna - tnb)); | - | ||||||||||||||||||||||||||||||||||||
554 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||
555 | else | - | ||||||||||||||||||||||||||||||||||||
556 | { | - | ||||||||||||||||||||||||||||||||||||
557 | memset(&(r[n2]), 0, sizeof(unsigned long) * n2); | - | ||||||||||||||||||||||||||||||||||||
558 | if (tna < (16)
| 0-246 | ||||||||||||||||||||||||||||||||||||
559 | tnb < (16)
| 0-246 | ||||||||||||||||||||||||||||||||||||
560 | bn_mul_normal(&(r[n2]), &(a[n]), tna, | - | ||||||||||||||||||||||||||||||||||||
561 | &(b[n]), tnb); | - | ||||||||||||||||||||||||||||||||||||
562 | } executed 246 times by 1 test: else {end of block Executed by:
| 246 | ||||||||||||||||||||||||||||||||||||
563 | for (;;) { | - | ||||||||||||||||||||||||||||||||||||
564 | i /= 2; | - | ||||||||||||||||||||||||||||||||||||
565 | - | |||||||||||||||||||||||||||||||||||||
566 | - | |||||||||||||||||||||||||||||||||||||
567 | - | |||||||||||||||||||||||||||||||||||||
568 | if (i < tna
| 0 | ||||||||||||||||||||||||||||||||||||
569 | bn_mul_part_recursive(&(r[n2]), | - | ||||||||||||||||||||||||||||||||||||
570 | &(a[n]), &(b[n]), i, | - | ||||||||||||||||||||||||||||||||||||
571 | tna - i, tnb - i, p); | - | ||||||||||||||||||||||||||||||||||||
572 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
573 | } else if (i == tna
| 0 | ||||||||||||||||||||||||||||||||||||
574 | bn_mul_recursive(&(r[n2]), | - | ||||||||||||||||||||||||||||||||||||
575 | &(a[n]), &(b[n]), i, | - | ||||||||||||||||||||||||||||||||||||
576 | tna - i, tnb - i, p); | - | ||||||||||||||||||||||||||||||||||||
577 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
578 | } | - | ||||||||||||||||||||||||||||||||||||
579 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
580 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
581 | } | - | ||||||||||||||||||||||||||||||||||||
582 | } | - | ||||||||||||||||||||||||||||||||||||
583 | - | |||||||||||||||||||||||||||||||||||||
584 | - | |||||||||||||||||||||||||||||||||||||
585 | - | |||||||||||||||||||||||||||||||||||||
586 | - | |||||||||||||||||||||||||||||||||||||
587 | - | |||||||||||||||||||||||||||||||||||||
588 | - | |||||||||||||||||||||||||||||||||||||
589 | c1 = (int)(bn_add_words(t, r,&(r[n2]), n2)); | - | ||||||||||||||||||||||||||||||||||||
590 | - | |||||||||||||||||||||||||||||||||||||
591 | if (neg
| 0-274 | ||||||||||||||||||||||||||||||||||||
592 | { | - | ||||||||||||||||||||||||||||||||||||
593 | c1 -= (int)(bn_sub_words(&(t[n2]), t,&(t[n2]), n2)); | - | ||||||||||||||||||||||||||||||||||||
594 | } executed 274 times by 2 tests: else {end of block Executed by:
| 274 | ||||||||||||||||||||||||||||||||||||
595 | - | |||||||||||||||||||||||||||||||||||||
596 | c1 += (int)(bn_add_words(&(t[n2]), &(t[n2]), t, n2)); | - | ||||||||||||||||||||||||||||||||||||
597 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
598 | - | |||||||||||||||||||||||||||||||||||||
599 | - | |||||||||||||||||||||||||||||||||||||
600 | - | |||||||||||||||||||||||||||||||||||||
601 | - | |||||||||||||||||||||||||||||||||||||
602 | - | |||||||||||||||||||||||||||||||||||||
603 | - | |||||||||||||||||||||||||||||||||||||
604 | c1 += (int)(bn_add_words(&(r[n]), &(r[n]), &(t[n2]), n2)); | - | ||||||||||||||||||||||||||||||||||||
605 | if (c1
| 0-274 | ||||||||||||||||||||||||||||||||||||
606 | p = &(r[n + n2]); | - | ||||||||||||||||||||||||||||||||||||
607 | lo= *p; | - | ||||||||||||||||||||||||||||||||||||
608 | ln = (lo + c1)&(0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
609 | *p = ln; | - | ||||||||||||||||||||||||||||||||||||
610 | - | |||||||||||||||||||||||||||||||||||||
611 | - | |||||||||||||||||||||||||||||||||||||
612 | - | |||||||||||||||||||||||||||||||||||||
613 | if (ln < (unsigned long)c1
| 0 | ||||||||||||||||||||||||||||||||||||
614 | do { | - | ||||||||||||||||||||||||||||||||||||
615 | p++; | - | ||||||||||||||||||||||||||||||||||||
616 | lo= *p; | - | ||||||||||||||||||||||||||||||||||||
617 | ln = (lo + 1) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
618 | *p = ln; | - | ||||||||||||||||||||||||||||||||||||
619 | } never executed: while (ln == 0end of block
| 0 | ||||||||||||||||||||||||||||||||||||
620 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
621 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
622 | } executed 274 times by 2 tests: end of block Executed by:
| 274 | ||||||||||||||||||||||||||||||||||||
623 | - | |||||||||||||||||||||||||||||||||||||
624 | - | |||||||||||||||||||||||||||||||||||||
625 | - | |||||||||||||||||||||||||||||||||||||
626 | - | |||||||||||||||||||||||||||||||||||||
627 | void | - | ||||||||||||||||||||||||||||||||||||
628 | bn_mul_low_recursive(unsigned long *r, unsigned long *a, unsigned long *b, int n2, unsigned long *t) | - | ||||||||||||||||||||||||||||||||||||
629 | { | - | ||||||||||||||||||||||||||||||||||||
630 | int n = n2 / 2; | - | ||||||||||||||||||||||||||||||||||||
631 | - | |||||||||||||||||||||||||||||||||||||
632 | - | |||||||||||||||||||||||||||||||||||||
633 | - | |||||||||||||||||||||||||||||||||||||
634 | - | |||||||||||||||||||||||||||||||||||||
635 | - | |||||||||||||||||||||||||||||||||||||
636 | bn_mul_recursive(r, a, b, n, 0, 0, &(t[0])); | - | ||||||||||||||||||||||||||||||||||||
637 | if (n >= (32)
| 0 | ||||||||||||||||||||||||||||||||||||
638 | bn_mul_low_recursive(&(t[0]), &(a[0]), &(b[n]), n, &(t[n2])); | - | ||||||||||||||||||||||||||||||||||||
639 | bn_add_words(&(r[n]), &(r[n]), &(t[0]), n); | - | ||||||||||||||||||||||||||||||||||||
640 | bn_mul_low_recursive(&(t[0]), &(a[n]), &(b[0]), n, &(t[n2])); | - | ||||||||||||||||||||||||||||||||||||
641 | bn_add_words(&(r[n]), &(r[n]), &(t[0]), n); | - | ||||||||||||||||||||||||||||||||||||
642 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
643 | bn_mul_low_normal(&(t[0]), &(a[0]), &(b[n]), n); | - | ||||||||||||||||||||||||||||||||||||
644 | bn_mul_low_normal(&(t[n]), &(a[n]), &(b[0]), n); | - | ||||||||||||||||||||||||||||||||||||
645 | bn_add_words(&(r[n]), &(r[n]), &(t[0]), n); | - | ||||||||||||||||||||||||||||||||||||
646 | bn_add_words(&(r[n]), &(r[n]), &(t[n]), n); | - | ||||||||||||||||||||||||||||||||||||
647 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
648 | } | - | ||||||||||||||||||||||||||||||||||||
649 | - | |||||||||||||||||||||||||||||||||||||
650 | - | |||||||||||||||||||||||||||||||||||||
651 | - | |||||||||||||||||||||||||||||||||||||
652 | - | |||||||||||||||||||||||||||||||||||||
653 | - | |||||||||||||||||||||||||||||||||||||
654 | - | |||||||||||||||||||||||||||||||||||||
655 | void | - | ||||||||||||||||||||||||||||||||||||
656 | bn_mul_high(unsigned long *r, unsigned long *a, unsigned long *b, unsigned long *l, int n2, | - | ||||||||||||||||||||||||||||||||||||
657 | unsigned long *t) | - | ||||||||||||||||||||||||||||||||||||
658 | { | - | ||||||||||||||||||||||||||||||||||||
659 | int i, n; | - | ||||||||||||||||||||||||||||||||||||
660 | int c1, c2; | - | ||||||||||||||||||||||||||||||||||||
661 | int neg, oneg, zero; | - | ||||||||||||||||||||||||||||||||||||
662 | unsigned long ll, lc, *lp, *mp; | - | ||||||||||||||||||||||||||||||||||||
663 | - | |||||||||||||||||||||||||||||||||||||
664 | - | |||||||||||||||||||||||||||||||||||||
665 | - | |||||||||||||||||||||||||||||||||||||
666 | - | |||||||||||||||||||||||||||||||||||||
667 | n = n2 / 2; | - | ||||||||||||||||||||||||||||||||||||
668 | - | |||||||||||||||||||||||||||||||||||||
669 | - | |||||||||||||||||||||||||||||||||||||
670 | neg = zero = 0; | - | ||||||||||||||||||||||||||||||||||||
671 | c1 = bn_cmp_words(&(a[0]), &(a[n]), n); | - | ||||||||||||||||||||||||||||||||||||
672 | c2 = bn_cmp_words(&(b[n]), &(b[0]), n); | - | ||||||||||||||||||||||||||||||||||||
673 | switch (c1 * 3 + c2) { | - | ||||||||||||||||||||||||||||||||||||
674 | case never executed: -4:case -4: never executed: case -4: | 0 | ||||||||||||||||||||||||||||||||||||
675 | bn_sub_words(&(r[0]), &(a[n]), &(a[0]), n); | - | ||||||||||||||||||||||||||||||||||||
676 | bn_sub_words(&(r[n]), &(b[0]), &(b[n]), n); | - | ||||||||||||||||||||||||||||||||||||
677 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
678 | case never executed: -3:case -3: never executed: case -3: | 0 | ||||||||||||||||||||||||||||||||||||
679 | zero = 1; | - | ||||||||||||||||||||||||||||||||||||
680 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
681 | case never executed: -2:case -2: never executed: case -2: | 0 | ||||||||||||||||||||||||||||||||||||
682 | bn_sub_words(&(r[0]), &(a[n]), &(a[0]), n); | - | ||||||||||||||||||||||||||||||||||||
683 | bn_sub_words(&(r[n]), &(b[n]), &(b[0]), n); | - | ||||||||||||||||||||||||||||||||||||
684 | neg = 1; | - | ||||||||||||||||||||||||||||||||||||
685 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
686 | case never executed: -1:case -1: never executed: case -1: | 0 | ||||||||||||||||||||||||||||||||||||
687 | case never executed: 0:case 0: never executed: case 0: | 0 | ||||||||||||||||||||||||||||||||||||
688 | case never executed: 1:case 1: never executed: case 1: | 0 | ||||||||||||||||||||||||||||||||||||
689 | zero = 1; | - | ||||||||||||||||||||||||||||||||||||
690 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
691 | case never executed: 2:case 2: never executed: case 2: | 0 | ||||||||||||||||||||||||||||||||||||
692 | bn_sub_words(&(r[0]), &(a[0]), &(a[n]), n); | - | ||||||||||||||||||||||||||||||||||||
693 | bn_sub_words(&(r[n]), &(b[0]), &(b[n]), n); | - | ||||||||||||||||||||||||||||||||||||
694 | neg = 1; | - | ||||||||||||||||||||||||||||||||||||
695 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
696 | case never executed: 3:case 3: never executed: case 3: | 0 | ||||||||||||||||||||||||||||||||||||
697 | zero = 1; | - | ||||||||||||||||||||||||||||||||||||
698 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
699 | case never executed: 4:case 4: never executed: case 4: | 0 | ||||||||||||||||||||||||||||||||||||
700 | bn_sub_words(&(r[0]), &(a[0]), &(a[n]), n); | - | ||||||||||||||||||||||||||||||||||||
701 | bn_sub_words(&(r[n]), &(b[n]), &(b[0]), n); | - | ||||||||||||||||||||||||||||||||||||
702 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
703 | } | - | ||||||||||||||||||||||||||||||||||||
704 | - | |||||||||||||||||||||||||||||||||||||
705 | oneg = neg; | - | ||||||||||||||||||||||||||||||||||||
706 | - | |||||||||||||||||||||||||||||||||||||
707 | - | |||||||||||||||||||||||||||||||||||||
708 | - | |||||||||||||||||||||||||||||||||||||
709 | if (n == 8
| 0 | ||||||||||||||||||||||||||||||||||||
710 | bn_mul_comba8(&(t[0]), &(r[0]), &(r[n])); | - | ||||||||||||||||||||||||||||||||||||
711 | bn_mul_comba8(r, &(a[n]), &(b[n])); | - | ||||||||||||||||||||||||||||||||||||
712 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||||||||||||||
713 | - | |||||||||||||||||||||||||||||||||||||
714 | { | - | ||||||||||||||||||||||||||||||||||||
715 | bn_mul_recursive(&(t[0]), &(r[0]), &(r[n]), n, 0, 0, &(t[n2])); | - | ||||||||||||||||||||||||||||||||||||
716 | bn_mul_recursive(r, &(a[n]), &(b[n]), n, 0, 0, &(t[n2])); | - | ||||||||||||||||||||||||||||||||||||
717 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
718 | - | |||||||||||||||||||||||||||||||||||||
719 | - | |||||||||||||||||||||||||||||||||||||
720 | - | |||||||||||||||||||||||||||||||||||||
721 | - | |||||||||||||||||||||||||||||||||||||
722 | - | |||||||||||||||||||||||||||||||||||||
723 | - | |||||||||||||||||||||||||||||||||||||
724 | - | |||||||||||||||||||||||||||||||||||||
725 | if (l !=
| 0 | ||||||||||||||||||||||||||||||||||||
726 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||
727 | ) { | - | ||||||||||||||||||||||||||||||||||||
728 | lp = &(t[n2 + n]); | - | ||||||||||||||||||||||||||||||||||||
729 | c1 = (int)(bn_add_words(lp, &(r[0]), &(l[0]), n)); | - | ||||||||||||||||||||||||||||||||||||
730 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
731 | c1 = 0; | - | ||||||||||||||||||||||||||||||||||||
732 | lp = &(r[0]); | - | ||||||||||||||||||||||||||||||||||||
733 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
734 | - | |||||||||||||||||||||||||||||||||||||
735 | if (neg
| 0 | ||||||||||||||||||||||||||||||||||||
736 | neg = (int)(bn_sub_words(&(t[n2]), lp, &(t[0]), n)); never executed: neg = (int)(bn_sub_words(&(t[n2]), lp, &(t[0]), n)); | 0 | ||||||||||||||||||||||||||||||||||||
737 | else { | - | ||||||||||||||||||||||||||||||||||||
738 | bn_add_words(&(t[n2]), lp, &(t[0]), n); | - | ||||||||||||||||||||||||||||||||||||
739 | neg = 0; | - | ||||||||||||||||||||||||||||||||||||
740 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
741 | - | |||||||||||||||||||||||||||||||||||||
742 | if (l !=
| 0 | ||||||||||||||||||||||||||||||||||||
743 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||
744 | ) { | - | ||||||||||||||||||||||||||||||||||||
745 | bn_sub_words(&(t[n2 + n]), &(l[n]), &(t[n2]), n); | - | ||||||||||||||||||||||||||||||||||||
746 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
747 | lp = &(t[n2 + n]); | - | ||||||||||||||||||||||||||||||||||||
748 | mp = &(t[n2]); | - | ||||||||||||||||||||||||||||||||||||
749 | for (i = 0; i < n
| 0 | ||||||||||||||||||||||||||||||||||||
750 | lp[i] = ((~mp[i]) + 1) & (0xffffffffffffffffL); never executed: lp[i] = ((~mp[i]) + 1) & (0xffffffffffffffffL); | 0 | ||||||||||||||||||||||||||||||||||||
751 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
752 | if (l !=
| 0 | ||||||||||||||||||||||||||||||||||||
753 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||
754 | ) { | - | ||||||||||||||||||||||||||||||||||||
755 | lp = &(t[n2]); | - | ||||||||||||||||||||||||||||||||||||
756 | c1 = (int)(bn_add_words(lp, &(t[n2 + n]), &(l[0]), n)); | - | ||||||||||||||||||||||||||||||||||||
757 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
758 | lp = &(t[n2 + n]); | - | ||||||||||||||||||||||||||||||||||||
759 | c1 = 0; | - | ||||||||||||||||||||||||||||||||||||
760 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
761 | c1 += (int)(bn_add_words(&(t[n2]), lp, &(r[0]), n)); | - | ||||||||||||||||||||||||||||||||||||
762 | if (oneg
| 0 | ||||||||||||||||||||||||||||||||||||
763 | c1 -= (int)(bn_sub_words(&(t[n2]), &(t[n2]), &(t[0]), n)); never executed: c1 -= (int)(bn_sub_words(&(t[n2]), &(t[n2]), &(t[0]), n)); | 0 | ||||||||||||||||||||||||||||||||||||
764 | else | - | ||||||||||||||||||||||||||||||||||||
765 | c1 += (int)(bn_add_words(&(t[n2]), &(t[n2]), &(t[0]), n)); never executed: c1 += (int)(bn_add_words(&(t[n2]), &(t[n2]), &(t[0]), n)); | 0 | ||||||||||||||||||||||||||||||||||||
766 | - | |||||||||||||||||||||||||||||||||||||
767 | c2 = (int)(bn_add_words(&(r[0]), &(r[0]), &(t[n2 + n]), n)); | - | ||||||||||||||||||||||||||||||||||||
768 | c2 += (int)(bn_add_words(&(r[0]), &(r[0]), &(r[n]), n)); | - | ||||||||||||||||||||||||||||||||||||
769 | if (oneg
| 0 | ||||||||||||||||||||||||||||||||||||
770 | c2 -= (int)(bn_sub_words(&(r[0]), &(r[0]), &(t[n]), n)); never executed: c2 -= (int)(bn_sub_words(&(r[0]), &(r[0]), &(t[n]), n)); | 0 | ||||||||||||||||||||||||||||||||||||
771 | else | - | ||||||||||||||||||||||||||||||||||||
772 | c2 += (int)(bn_add_words(&(r[0]), &(r[0]), &(t[n]), n)); never executed: c2 += (int)(bn_add_words(&(r[0]), &(r[0]), &(t[n]), n)); | 0 | ||||||||||||||||||||||||||||||||||||
773 | - | |||||||||||||||||||||||||||||||||||||
774 | if (c1 != 0
| 0 | ||||||||||||||||||||||||||||||||||||
775 | { | - | ||||||||||||||||||||||||||||||||||||
776 | i = 0; | - | ||||||||||||||||||||||||||||||||||||
777 | if (c1 > 0
| 0 | ||||||||||||||||||||||||||||||||||||
778 | lc = c1; | - | ||||||||||||||||||||||||||||||||||||
779 | do { | - | ||||||||||||||||||||||||||||||||||||
780 | ll = (r[i] + lc) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
781 | r[i++] = ll; | - | ||||||||||||||||||||||||||||||||||||
782 | lc = (lc > ll); | - | ||||||||||||||||||||||||||||||||||||
783 | } never executed: while (lcend of block
| 0 | ||||||||||||||||||||||||||||||||||||
784 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
785 | lc = -c1; | - | ||||||||||||||||||||||||||||||||||||
786 | do { | - | ||||||||||||||||||||||||||||||||||||
787 | ll = r[i]; | - | ||||||||||||||||||||||||||||||||||||
788 | r[i++] = (ll - lc) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
789 | lc = (lc > ll); | - | ||||||||||||||||||||||||||||||||||||
790 | } never executed: while (lcend of block
| 0 | ||||||||||||||||||||||||||||||||||||
791 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
792 | } | - | ||||||||||||||||||||||||||||||||||||
793 | if (c2 != 0
| 0 | ||||||||||||||||||||||||||||||||||||
794 | { | - | ||||||||||||||||||||||||||||||||||||
795 | i = n; | - | ||||||||||||||||||||||||||||||||||||
796 | if (c2 > 0
| 0 | ||||||||||||||||||||||||||||||||||||
797 | lc = c2; | - | ||||||||||||||||||||||||||||||||||||
798 | do { | - | ||||||||||||||||||||||||||||||||||||
799 | ll = (r[i] + lc) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
800 | r[i++] = ll; | - | ||||||||||||||||||||||||||||||||||||
801 | lc = (lc > ll); | - | ||||||||||||||||||||||||||||||||||||
802 | } never executed: while (lcend of block
| 0 | ||||||||||||||||||||||||||||||||||||
803 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
804 | lc = -c2; | - | ||||||||||||||||||||||||||||||||||||
805 | do { | - | ||||||||||||||||||||||||||||||||||||
806 | ll = r[i]; | - | ||||||||||||||||||||||||||||||||||||
807 | r[i++] = (ll - lc) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||||||||||||||
808 | lc = (lc > ll); | - | ||||||||||||||||||||||||||||||||||||
809 | } never executed: while (lcend of block
| 0 | ||||||||||||||||||||||||||||||||||||
810 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
811 | } | - | ||||||||||||||||||||||||||||||||||||
812 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
813 | - | |||||||||||||||||||||||||||||||||||||
814 | - | |||||||||||||||||||||||||||||||||||||
815 | int | - | ||||||||||||||||||||||||||||||||||||
816 | BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) | - | ||||||||||||||||||||||||||||||||||||
817 | { | - | ||||||||||||||||||||||||||||||||||||
818 | int ret = 0; | - | ||||||||||||||||||||||||||||||||||||
819 | int top, al, bl; | - | ||||||||||||||||||||||||||||||||||||
820 | BIGNUM *rr; | - | ||||||||||||||||||||||||||||||||||||
821 | - | |||||||||||||||||||||||||||||||||||||
822 | int i; | - | ||||||||||||||||||||||||||||||||||||
823 | - | |||||||||||||||||||||||||||||||||||||
824 | - | |||||||||||||||||||||||||||||||||||||
825 | BIGNUM *t = | - | ||||||||||||||||||||||||||||||||||||
826 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
827 | ; | - | ||||||||||||||||||||||||||||||||||||
828 | int j = 0, k; | - | ||||||||||||||||||||||||||||||||||||
829 | - | |||||||||||||||||||||||||||||||||||||
830 | - | |||||||||||||||||||||||||||||||||||||
831 | - | |||||||||||||||||||||||||||||||||||||
832 | - | |||||||||||||||||||||||||||||||||||||
833 | - | |||||||||||||||||||||||||||||||||||||
834 | - | |||||||||||||||||||||||||||||||||||||
835 | ; | - | ||||||||||||||||||||||||||||||||||||
836 | ; | - | ||||||||||||||||||||||||||||||||||||
837 | ; | - | ||||||||||||||||||||||||||||||||||||
838 | - | |||||||||||||||||||||||||||||||||||||
839 | al = a->top; | - | ||||||||||||||||||||||||||||||||||||
840 | bl = b->top; | - | ||||||||||||||||||||||||||||||||||||
841 | - | |||||||||||||||||||||||||||||||||||||
842 | if ((
| 585-731685 | ||||||||||||||||||||||||||||||||||||
843 | (BN_set_word((r),0)); | - | ||||||||||||||||||||||||||||||||||||
844 | return executed 11563 times by 4 tests: (1);return (1); Executed by:
executed 11563 times by 4 tests: return (1); Executed by:
| 11563 | ||||||||||||||||||||||||||||||||||||
845 | } | - | ||||||||||||||||||||||||||||||||||||
846 | top = al + bl; | - | ||||||||||||||||||||||||||||||||||||
847 | - | |||||||||||||||||||||||||||||||||||||
848 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||||||||||||||
849 | if ((
| 16-720488 | ||||||||||||||||||||||||||||||||||||
850 | if ((
| 0-235 | ||||||||||||||||||||||||||||||||||||
851 | ((void *)0)
| 0-235 | ||||||||||||||||||||||||||||||||||||
852 | ) | - | ||||||||||||||||||||||||||||||||||||
853 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
854 | } executed 235 times by 2 tests: elseend of block Executed by:
| 235 | ||||||||||||||||||||||||||||||||||||
855 | rr = r; executed 720472 times by 14 tests: rr = r; Executed by:
| 720472 | ||||||||||||||||||||||||||||||||||||
856 | rr->neg = a->neg ^ b->neg; | - | ||||||||||||||||||||||||||||||||||||
857 | - | |||||||||||||||||||||||||||||||||||||
858 | - | |||||||||||||||||||||||||||||||||||||
859 | i = al - bl; | - | ||||||||||||||||||||||||||||||||||||
860 | - | |||||||||||||||||||||||||||||||||||||
861 | - | |||||||||||||||||||||||||||||||||||||
862 | if (i == 0
| 290116-430591 | ||||||||||||||||||||||||||||||||||||
863 | if (al == 8
| 160145-270446 | ||||||||||||||||||||||||||||||||||||
864 | if ((((
| 0-160145 | ||||||||||||||||||||||||||||||||||||
865 | ((void *)0)
| 0-160145 | ||||||||||||||||||||||||||||||||||||
866 | ) | - | ||||||||||||||||||||||||||||||||||||
867 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
868 | rr->top = 16; | - | ||||||||||||||||||||||||||||||||||||
869 | bn_mul_comba8(rr->d, a->d, b->d); | - | ||||||||||||||||||||||||||||||||||||
870 | goto executed 160145 times by 6 tests: end;goto end; Executed by:
executed 160145 times by 6 tests: goto end; Executed by:
| 160145 | ||||||||||||||||||||||||||||||||||||
871 | } | - | ||||||||||||||||||||||||||||||||||||
872 | } executed 270446 times by 14 tests: end of block Executed by:
| 270446 | ||||||||||||||||||||||||||||||||||||
873 | - | |||||||||||||||||||||||||||||||||||||
874 | - | |||||||||||||||||||||||||||||||||||||
875 | if ((
| 35-559129 | ||||||||||||||||||||||||||||||||||||
876 | if (i >= -1
| 0-1397 | ||||||||||||||||||||||||||||||||||||
877 | - | |||||||||||||||||||||||||||||||||||||
878 | - | |||||||||||||||||||||||||||||||||||||
879 | if (i >= 0
| 234-1163 | ||||||||||||||||||||||||||||||||||||
880 | j = BN_num_bits_word((unsigned long)al); | - | ||||||||||||||||||||||||||||||||||||
881 | } executed 1163 times by 7 tests: end of block Executed by:
| 1163 | ||||||||||||||||||||||||||||||||||||
882 | if (i == -1
| 234-1163 | ||||||||||||||||||||||||||||||||||||
883 | j = BN_num_bits_word((unsigned long)bl); | - | ||||||||||||||||||||||||||||||||||||
884 | } executed 234 times by 2 tests: end of block Executed by:
| 234 | ||||||||||||||||||||||||||||||||||||
885 | j = 1 << (j - 1); | - | ||||||||||||||||||||||||||||||||||||
886 | - | |||||||||||||||||||||||||||||||||||||
887 | ((void) (0)) | - | ||||||||||||||||||||||||||||||||||||
888 | ; | - | ||||||||||||||||||||||||||||||||||||
889 | k = j + j; | - | ||||||||||||||||||||||||||||||||||||
890 | if ((
| 0-1397 | ||||||||||||||||||||||||||||||||||||
891 | ((void *)0)
| 0-1397 | ||||||||||||||||||||||||||||||||||||
892 | ) | - | ||||||||||||||||||||||||||||||||||||
893 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
894 | if (al > j
| 0-1125 | ||||||||||||||||||||||||||||||||||||
895 | if ((((
| 0-272 | ||||||||||||||||||||||||||||||||||||
896 | ((void *)0)
| 0-272 | ||||||||||||||||||||||||||||||||||||
897 | ) | - | ||||||||||||||||||||||||||||||||||||
898 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
899 | if ((((
| 0-272 | ||||||||||||||||||||||||||||||||||||
900 | ((void *)0)
| 0-272 | ||||||||||||||||||||||||||||||||||||
901 | ) | - | ||||||||||||||||||||||||||||||||||||
902 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
903 | bn_mul_part_recursive(rr->d, a->d, b->d, | - | ||||||||||||||||||||||||||||||||||||
904 | j, al - j, bl - j, t->d); | - | ||||||||||||||||||||||||||||||||||||
905 | } executed 272 times by 2 tests: end of block Executed by:
| 272 | ||||||||||||||||||||||||||||||||||||
906 | else | - | ||||||||||||||||||||||||||||||||||||
907 | { | - | ||||||||||||||||||||||||||||||||||||
908 | if ((((
| 0-1125 | ||||||||||||||||||||||||||||||||||||
909 | ((void *)0)
| 0-1125 | ||||||||||||||||||||||||||||||||||||
910 | ) | - | ||||||||||||||||||||||||||||||||||||
911 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
912 | if ((((
| 0-1125 | ||||||||||||||||||||||||||||||||||||
913 | ((void *)0)
| 0-1125 | ||||||||||||||||||||||||||||||||||||
914 | ) | - | ||||||||||||||||||||||||||||||||||||
915 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
916 | bn_mul_recursive(rr->d, a->d, b->d, | - | ||||||||||||||||||||||||||||||||||||
917 | j, al - j, bl - j, t->d); | - | ||||||||||||||||||||||||||||||||||||
918 | } executed 1125 times by 7 tests: end of block Executed by:
| 1125 | ||||||||||||||||||||||||||||||||||||
919 | rr->top = top; | - | ||||||||||||||||||||||||||||||||||||
920 | goto executed 1397 times by 7 tests: end;goto end; Executed by:
executed 1397 times by 7 tests: goto end; Executed by:
| 1397 | ||||||||||||||||||||||||||||||||||||
921 | } | - | ||||||||||||||||||||||||||||||||||||
922 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
923 | - | |||||||||||||||||||||||||||||||||||||
924 | if ((((
| 0-559165 | ||||||||||||||||||||||||||||||||||||
925 | ((void *)0)
| 0-559165 | ||||||||||||||||||||||||||||||||||||
926 | ) | - | ||||||||||||||||||||||||||||||||||||
927 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
928 | rr->top = top; | - | ||||||||||||||||||||||||||||||||||||
929 | bn_mul_normal(rr->d, a->d, al, b->d, bl); | - | ||||||||||||||||||||||||||||||||||||
930 | - | |||||||||||||||||||||||||||||||||||||
931 | - | |||||||||||||||||||||||||||||||||||||
932 | end: code before this statement executed 559165 times by 14 tests: end: Executed by:
| 559165 | ||||||||||||||||||||||||||||||||||||
933 | - | |||||||||||||||||||||||||||||||||||||
934 | { unsigned long *ftl; int tmp_top = (rr)->top; if (tmp_top > 0
executed 720707 times by 14 tests: (rr)->top = tmp_top; }break; Executed by:
executed 720707 times by 14 tests: ; };end of block Executed by:
| 0-1268039 | ||||||||||||||||||||||||||||||||||||
935 | if (r != rr
| 235-720472 | ||||||||||||||||||||||||||||||||||||
936 | BN_copy(r, rr); executed 235 times by 2 tests: BN_copy(r, rr); Executed by:
| 235 | ||||||||||||||||||||||||||||||||||||
937 | ret = 1; | - | ||||||||||||||||||||||||||||||||||||
938 | err: code before this statement executed 720707 times by 14 tests: err: Executed by:
| 720707 | ||||||||||||||||||||||||||||||||||||
939 | ; | - | ||||||||||||||||||||||||||||||||||||
940 | BN_CTX_end(ctx); | - | ||||||||||||||||||||||||||||||||||||
941 | return executed 720707 times by 14 tests: (ret);return (ret); Executed by:
executed 720707 times by 14 tests: return (ret); Executed by:
| 720707 | ||||||||||||||||||||||||||||||||||||
942 | } | - | ||||||||||||||||||||||||||||||||||||
943 | - | |||||||||||||||||||||||||||||||||||||
944 | void | - | ||||||||||||||||||||||||||||||||||||
945 | bn_mul_normal(unsigned long *r, unsigned long *a, int na, unsigned long *b, int nb) | - | ||||||||||||||||||||||||||||||||||||
946 | { | - | ||||||||||||||||||||||||||||||||||||
947 | unsigned long *rr; | - | ||||||||||||||||||||||||||||||||||||
948 | - | |||||||||||||||||||||||||||||||||||||
949 | - | |||||||||||||||||||||||||||||||||||||
950 | - | |||||||||||||||||||||||||||||||||||||
951 | - | |||||||||||||||||||||||||||||||||||||
952 | - | |||||||||||||||||||||||||||||||||||||
953 | if (na < nb
| 275675-283913 | ||||||||||||||||||||||||||||||||||||
954 | int itmp; | - | ||||||||||||||||||||||||||||||||||||
955 | unsigned long *ltmp; | - | ||||||||||||||||||||||||||||||||||||
956 | - | |||||||||||||||||||||||||||||||||||||
957 | itmp = na; | - | ||||||||||||||||||||||||||||||||||||
958 | na = nb; | - | ||||||||||||||||||||||||||||||||||||
959 | nb = itmp; | - | ||||||||||||||||||||||||||||||||||||
960 | ltmp = a; | - | ||||||||||||||||||||||||||||||||||||
961 | a = b; | - | ||||||||||||||||||||||||||||||||||||
962 | b = ltmp; | - | ||||||||||||||||||||||||||||||||||||
963 | - | |||||||||||||||||||||||||||||||||||||
964 | } executed 283913 times by 12 tests: end of block Executed by:
| 283913 | ||||||||||||||||||||||||||||||||||||
965 | rr = &(r[na]); | - | ||||||||||||||||||||||||||||||||||||
966 | if (nb <= 0
| 0-559588 | ||||||||||||||||||||||||||||||||||||
967 | (void)bn_mul_words(r, a, na, 0); | - | ||||||||||||||||||||||||||||||||||||
968 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
969 | } else | - | ||||||||||||||||||||||||||||||||||||
970 | rr[0] = bn_mul_words(r, a, na, b[0]); executed 559588 times by 14 tests: rr[0] = bn_mul_words(r, a, na, b[0]); Executed by:
| 559588 | ||||||||||||||||||||||||||||||||||||
971 | - | |||||||||||||||||||||||||||||||||||||
972 | for (;;) { | - | ||||||||||||||||||||||||||||||||||||
973 | if (--
| 226332-483208 | ||||||||||||||||||||||||||||||||||||
974 | return; executed 483208 times by 14 tests: return; Executed by:
| 483208 | ||||||||||||||||||||||||||||||||||||
975 | rr[1] = bn_mul_add_words(&(r[1]), a, na, b[1]); | - | ||||||||||||||||||||||||||||||||||||
976 | if (--
| 1167-225165 | ||||||||||||||||||||||||||||||||||||
977 | return; executed 1167 times by 6 tests: return; Executed by:
| 1167 | ||||||||||||||||||||||||||||||||||||
978 | rr[2] = bn_mul_add_words(&(r[2]), a, na, b[2]); | - | ||||||||||||||||||||||||||||||||||||
979 | if (--
| 6164-219001 | ||||||||||||||||||||||||||||||||||||
980 | return; executed 6164 times by 9 tests: return; Executed by:
| 6164 | ||||||||||||||||||||||||||||||||||||
981 | rr[3] = bn_mul_add_words(&(r[3]), a, na, b[3]); | - | ||||||||||||||||||||||||||||||||||||
982 | if (--
| 69049-149952 | ||||||||||||||||||||||||||||||||||||
983 | return; executed 69049 times by 7 tests: return; Executed by:
| 69049 | ||||||||||||||||||||||||||||||||||||
984 | rr[4] = bn_mul_add_words(&(r[4]), a, na, b[4]); | - | ||||||||||||||||||||||||||||||||||||
985 | rr += 4; | - | ||||||||||||||||||||||||||||||||||||
986 | r += 4; | - | ||||||||||||||||||||||||||||||||||||
987 | b += 4; | - | ||||||||||||||||||||||||||||||||||||
988 | } executed 149952 times by 7 tests: end of block Executed by:
| 149952 | ||||||||||||||||||||||||||||||||||||
989 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
990 | - | |||||||||||||||||||||||||||||||||||||
991 | void | - | ||||||||||||||||||||||||||||||||||||
992 | bn_mul_low_normal(unsigned long *r, unsigned long *a, unsigned long *b, int n) | - | ||||||||||||||||||||||||||||||||||||
993 | { | - | ||||||||||||||||||||||||||||||||||||
994 | - | |||||||||||||||||||||||||||||||||||||
995 | - | |||||||||||||||||||||||||||||||||||||
996 | - | |||||||||||||||||||||||||||||||||||||
997 | bn_mul_words(r, a, n, b[0]); | - | ||||||||||||||||||||||||||||||||||||
998 | - | |||||||||||||||||||||||||||||||||||||
999 | for (;;) { | - | ||||||||||||||||||||||||||||||||||||
1000 | if (--
| 0 | ||||||||||||||||||||||||||||||||||||
1001 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
1002 | bn_mul_add_words(&(r[1]), a, n, b[1]); | - | ||||||||||||||||||||||||||||||||||||
1003 | if (--
| 0 | ||||||||||||||||||||||||||||||||||||
1004 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
1005 | bn_mul_add_words(&(r[2]), a, n, b[2]); | - | ||||||||||||||||||||||||||||||||||||
1006 | if (--
| 0 | ||||||||||||||||||||||||||||||||||||
1007 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
1008 | bn_mul_add_words(&(r[3]), a, n, b[3]); | - | ||||||||||||||||||||||||||||||||||||
1009 | if (--
| 0 | ||||||||||||||||||||||||||||||||||||
1010 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
1011 | bn_mul_add_words(&(r[4]), a, n, b[4]); | - | ||||||||||||||||||||||||||||||||||||
1012 | r += 4; | - | ||||||||||||||||||||||||||||||||||||
1013 | b += 4; | - | ||||||||||||||||||||||||||||||||||||
1014 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1015 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |