Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/bn/bn_mont.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | static int bn_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont); | - | ||||||||||||||||||
6 | - | |||||||||||||||||||
7 | - | |||||||||||||||||||
8 | int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, | - | ||||||||||||||||||
9 | BN_MONT_CTX *mont, BN_CTX *ctx) | - | ||||||||||||||||||
10 | { | - | ||||||||||||||||||
11 | int ret = bn_mul_mont_fixed_top(r, a, b, mont, ctx); | - | ||||||||||||||||||
12 | - | |||||||||||||||||||
13 | bn_correct_top(r); | - | ||||||||||||||||||
14 | ; | - | ||||||||||||||||||
15 | - | |||||||||||||||||||
16 | return executed 16868843 times by 2 tests: ret;return ret; Executed by:
executed 16868843 times by 2 tests: return ret; Executed by:
| 16868843 | ||||||||||||||||||
17 | } | - | ||||||||||||||||||
18 | - | |||||||||||||||||||
19 | int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, | - | ||||||||||||||||||
20 | BN_MONT_CTX *mont, BN_CTX *ctx) | - | ||||||||||||||||||
21 | { | - | ||||||||||||||||||
22 | BIGNUM *tmp; | - | ||||||||||||||||||
23 | int ret = 0; | - | ||||||||||||||||||
24 | int num = mont->N.top; | - | ||||||||||||||||||
25 | - | |||||||||||||||||||
26 | - | |||||||||||||||||||
27 | if (num > 1
| 56138-19372441 | ||||||||||||||||||
28 | if (bn_wexpand(r, num) ==
| 0-19072833 | ||||||||||||||||||
29 | ((void *)0)
| 0-19072833 | ||||||||||||||||||
30 | ) | - | ||||||||||||||||||
31 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
32 | if (bn_mul_mont(r->d, a->d, b->d, mont->N.d, mont->n0, num)
| 0-19072833 | ||||||||||||||||||
33 | r->neg = a->neg ^ b->neg; | - | ||||||||||||||||||
34 | r->top = num; | - | ||||||||||||||||||
35 | r->flags |= 0; | - | ||||||||||||||||||
36 | return executed 19072833 times by 2 tests: 1;return 1; Executed by:
executed 19072833 times by 2 tests: return 1; Executed by:
| 19072833 | ||||||||||||||||||
37 | } | - | ||||||||||||||||||
38 | } never executed: end of block | 0 | ||||||||||||||||||
39 | - | |||||||||||||||||||
40 | - | |||||||||||||||||||
41 | if ((
| 1-355745 | ||||||||||||||||||
42 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||
43 | - | |||||||||||||||||||
44 | BN_CTX_start(ctx); | - | ||||||||||||||||||
45 | tmp = BN_CTX_get(ctx); | - | ||||||||||||||||||
46 | if (tmp ==
| 0-355745 | ||||||||||||||||||
47 | ((void *)0)
| 0-355745 | ||||||||||||||||||
48 | ) | - | ||||||||||||||||||
49 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
50 | - | |||||||||||||||||||
51 | ; | - | ||||||||||||||||||
52 | if (a == b
| 66756-288989 | ||||||||||||||||||
53 | if (!bn_sqr_fixed_top(tmp, a, ctx)
| 0-66756 | ||||||||||||||||||
54 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
55 | } executed 66756 times by 1 test: else {end of block Executed by:
| 66756 | ||||||||||||||||||
56 | if (!bn_mul_fixed_top(tmp, a, b, ctx)
| 0-288989 | ||||||||||||||||||
57 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
58 | } executed 288989 times by 2 tests: end of block Executed by:
| 288989 | ||||||||||||||||||
59 | - | |||||||||||||||||||
60 | - | |||||||||||||||||||
61 | if (!bn_from_montgomery_word(r, tmp, mont)
| 0-355745 | ||||||||||||||||||
62 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
63 | - | |||||||||||||||||||
64 | - | |||||||||||||||||||
65 | - | |||||||||||||||||||
66 | - | |||||||||||||||||||
67 | ret = 1; | - | ||||||||||||||||||
68 | err: code before this statement executed 355745 times by 2 tests: err: Executed by:
| 355745 | ||||||||||||||||||
69 | BN_CTX_end(ctx); | - | ||||||||||||||||||
70 | return executed 355745 times by 2 tests: ret;return ret; Executed by:
executed 355745 times by 2 tests: return ret; Executed by:
| 355745 | ||||||||||||||||||
71 | } | - | ||||||||||||||||||
72 | - | |||||||||||||||||||
73 | - | |||||||||||||||||||
74 | static int bn_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) | - | ||||||||||||||||||
75 | { | - | ||||||||||||||||||
76 | BIGNUM *n; | - | ||||||||||||||||||
77 | unsigned long *ap, *np, *rp, n0, v, carry; | - | ||||||||||||||||||
78 | int nl, max, i; | - | ||||||||||||||||||
79 | unsigned int rtop; | - | ||||||||||||||||||
80 | - | |||||||||||||||||||
81 | n = &(mont->N); | - | ||||||||||||||||||
82 | nl = n->top; | - | ||||||||||||||||||
83 | if (nl == 0
| 0-407757 | ||||||||||||||||||
84 | ret->top = 0; | - | ||||||||||||||||||
85 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||
86 | } | - | ||||||||||||||||||
87 | - | |||||||||||||||||||
88 | max = (2 * nl); | - | ||||||||||||||||||
89 | if (bn_wexpand(r, max) ==
| 0-407757 | ||||||||||||||||||
90 | ((void *)0)
| 0-407757 | ||||||||||||||||||
91 | ) | - | ||||||||||||||||||
92 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
93 | - | |||||||||||||||||||
94 | r->neg ^= n->neg; | - | ||||||||||||||||||
95 | np = n->d; | - | ||||||||||||||||||
96 | rp = r->d; | - | ||||||||||||||||||
97 | - | |||||||||||||||||||
98 | - | |||||||||||||||||||
99 | for (rtop = r->top, i = 0; i < max
| 407757-4633356 | ||||||||||||||||||
100 | v = (unsigned long)0 - ((i - rtop) >> (8 * sizeof(rtop) - 1)); | - | ||||||||||||||||||
101 | rp[i] &= v; | - | ||||||||||||||||||
102 | } executed 4633356 times by 2 tests: end of block Executed by:
| 4633356 | ||||||||||||||||||
103 | - | |||||||||||||||||||
104 | r->top = max; | - | ||||||||||||||||||
105 | r->flags |= 0; | - | ||||||||||||||||||
106 | n0 = mont->n0[0]; | - | ||||||||||||||||||
107 | - | |||||||||||||||||||
108 | - | |||||||||||||||||||
109 | - | |||||||||||||||||||
110 | - | |||||||||||||||||||
111 | - | |||||||||||||||||||
112 | - | |||||||||||||||||||
113 | for (carry = 0, i = 0; i < nl
| 407757-2316678 | ||||||||||||||||||
114 | v = bn_mul_add_words(rp, np, nl, (rp[0] * n0) & (0xffffffffffffffffL)); | - | ||||||||||||||||||
115 | v = (v + carry + rp[nl]) & (0xffffffffffffffffL); | - | ||||||||||||||||||
116 | carry |= (v != rp[nl]); | - | ||||||||||||||||||
117 | carry &= (v <= rp[nl]); | - | ||||||||||||||||||
118 | rp[nl] = v; | - | ||||||||||||||||||
119 | } executed 2316678 times by 2 tests: end of block Executed by:
| 2316678 | ||||||||||||||||||
120 | - | |||||||||||||||||||
121 | if (bn_wexpand(ret, nl) ==
| 0-407757 | ||||||||||||||||||
122 | ((void *)0)
| 0-407757 | ||||||||||||||||||
123 | ) | - | ||||||||||||||||||
124 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
125 | ret->top = nl; | - | ||||||||||||||||||
126 | ret->flags |= 0; | - | ||||||||||||||||||
127 | ret->neg = r->neg; | - | ||||||||||||||||||
128 | - | |||||||||||||||||||
129 | rp = ret->d; | - | ||||||||||||||||||
130 | - | |||||||||||||||||||
131 | - | |||||||||||||||||||
132 | - | |||||||||||||||||||
133 | - | |||||||||||||||||||
134 | - | |||||||||||||||||||
135 | ap = &(r->d[nl]); | - | ||||||||||||||||||
136 | - | |||||||||||||||||||
137 | carry -= bn_sub_words(rp, ap, np, nl); | - | ||||||||||||||||||
138 | - | |||||||||||||||||||
139 | - | |||||||||||||||||||
140 | - | |||||||||||||||||||
141 | - | |||||||||||||||||||
142 | - | |||||||||||||||||||
143 | for (i = 0; i < nl
| 407757-2316678 | ||||||||||||||||||
144 | rp[i] = (carry & ap[i]) | (~carry & rp[i]); | - | ||||||||||||||||||
145 | ap[i] = 0; | - | ||||||||||||||||||
146 | } executed 2316678 times by 2 tests: end of block Executed by:
| 2316678 | ||||||||||||||||||
147 | - | |||||||||||||||||||
148 | return executed 407757 times by 2 tests: 1;return 1; Executed by:
executed 407757 times by 2 tests: return 1; Executed by:
| 407757 | ||||||||||||||||||
149 | } | - | ||||||||||||||||||
150 | - | |||||||||||||||||||
151 | - | |||||||||||||||||||
152 | int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont, | - | ||||||||||||||||||
153 | BN_CTX *ctx) | - | ||||||||||||||||||
154 | { | - | ||||||||||||||||||
155 | int retn; | - | ||||||||||||||||||
156 | - | |||||||||||||||||||
157 | retn = bn_from_mont_fixed_top(ret, a, mont, ctx); | - | ||||||||||||||||||
158 | bn_correct_top(ret); | - | ||||||||||||||||||
159 | ; | - | ||||||||||||||||||
160 | - | |||||||||||||||||||
161 | return executed 47264 times by 2 tests: retn;return retn; Executed by:
executed 47264 times by 2 tests: return retn; Executed by:
| 47264 | ||||||||||||||||||
162 | } | - | ||||||||||||||||||
163 | - | |||||||||||||||||||
164 | int bn_from_mont_fixed_top(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont, | - | ||||||||||||||||||
165 | BN_CTX *ctx) | - | ||||||||||||||||||
166 | { | - | ||||||||||||||||||
167 | int retn = 0; | - | ||||||||||||||||||
168 | - | |||||||||||||||||||
169 | BIGNUM *t; | - | ||||||||||||||||||
170 | - | |||||||||||||||||||
171 | BN_CTX_start(ctx); | - | ||||||||||||||||||
172 | if ((
| 0-52012 | ||||||||||||||||||
173 | retn = bn_from_montgomery_word(ret, t, mont); | - | ||||||||||||||||||
174 | } executed 52012 times by 2 tests: end of block Executed by:
| 52012 | ||||||||||||||||||
175 | BN_CTX_end(ctx); | - | ||||||||||||||||||
176 | return executed 52012 times by 2 tests: retn;return retn; Executed by:
executed 52012 times by 2 tests: return retn; Executed by:
| 52012 | ||||||||||||||||||
177 | } | - | ||||||||||||||||||
178 | - | |||||||||||||||||||
179 | int bn_to_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, | - | ||||||||||||||||||
180 | BN_CTX *ctx) | - | ||||||||||||||||||
181 | { | - | ||||||||||||||||||
182 | return executed 37581 times by 2 tests: bn_mul_mont_fixed_top(r, a, &(mont->RR), mont, ctx);return bn_mul_mont_fixed_top(r, a, &(mont->RR), mont, ctx); Executed by:
executed 37581 times by 2 tests: return bn_mul_mont_fixed_top(r, a, &(mont->RR), mont, ctx); Executed by:
| 37581 | ||||||||||||||||||
183 | } | - | ||||||||||||||||||
184 | - | |||||||||||||||||||
185 | BN_MONT_CTX *BN_MONT_CTX_new(void) | - | ||||||||||||||||||
186 | { | - | ||||||||||||||||||
187 | BN_MONT_CTX *ret; | - | ||||||||||||||||||
188 | - | |||||||||||||||||||
189 | if ((
| 0-141614 | ||||||||||||||||||
190 | ((void *)0)
| 0-141614 | ||||||||||||||||||
191 | ) { | - | ||||||||||||||||||
192 | ERR_put_error(3,(149),((1|64)),__FILE__,233); | - | ||||||||||||||||||
193 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
194 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
195 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
196 | } | - | ||||||||||||||||||
197 | - | |||||||||||||||||||
198 | BN_MONT_CTX_init(ret); | - | ||||||||||||||||||
199 | ret->flags = 0x01; | - | ||||||||||||||||||
200 | return executed 141614 times by 2 tests: ret;return ret; Executed by:
executed 141614 times by 2 tests: return ret; Executed by:
| 141614 | ||||||||||||||||||
201 | } | - | ||||||||||||||||||
202 | - | |||||||||||||||||||
203 | void BN_MONT_CTX_init(BN_MONT_CTX *ctx) | - | ||||||||||||||||||
204 | { | - | ||||||||||||||||||
205 | ctx->ri = 0; | - | ||||||||||||||||||
206 | bn_init(&ctx->RR); | - | ||||||||||||||||||
207 | bn_init(&ctx->N); | - | ||||||||||||||||||
208 | bn_init(&ctx->Ni); | - | ||||||||||||||||||
209 | ctx->n0[0] = ctx->n0[1] = 0; | - | ||||||||||||||||||
210 | ctx->flags = 0; | - | ||||||||||||||||||
211 | } executed 141614 times by 2 tests: end of block Executed by:
| 141614 | ||||||||||||||||||
212 | - | |||||||||||||||||||
213 | void BN_MONT_CTX_free(BN_MONT_CTX *mont) | - | ||||||||||||||||||
214 | { | - | ||||||||||||||||||
215 | if (mont ==
| 141614-218062 | ||||||||||||||||||
216 | ((void *)0)
| 141614-218062 | ||||||||||||||||||
217 | ) | - | ||||||||||||||||||
218 | return; executed 218062 times by 2 tests: return; Executed by:
| 218062 | ||||||||||||||||||
219 | BN_clear_free(&mont->RR); | - | ||||||||||||||||||
220 | BN_clear_free(&mont->N); | - | ||||||||||||||||||
221 | BN_clear_free(&mont->Ni); | - | ||||||||||||||||||
222 | if (mont->flags & 0x01
| 0-141614 | ||||||||||||||||||
223 | CRYPTO_free(mont, __FILE__, 260); executed 141614 times by 2 tests: CRYPTO_free(mont, __FILE__, 260); Executed by:
| 141614 | ||||||||||||||||||
224 | } executed 141614 times by 2 tests: end of block Executed by:
| 141614 | ||||||||||||||||||
225 | - | |||||||||||||||||||
226 | int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) | - | ||||||||||||||||||
227 | { | - | ||||||||||||||||||
228 | int i, ret = 0; | - | ||||||||||||||||||
229 | BIGNUM *Ri, *R; | - | ||||||||||||||||||
230 | - | |||||||||||||||||||
231 | if (BN_is_zero(mod)
| 1-83602 | ||||||||||||||||||
232 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||
233 | - | |||||||||||||||||||
234 | BN_CTX_start(ctx); | - | ||||||||||||||||||
235 | if ((
| 0-83602 | ||||||||||||||||||
236 | ((void *)0)
| 0-83602 | ||||||||||||||||||
237 | ) | - | ||||||||||||||||||
238 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
239 | R = &(mont->RR); | - | ||||||||||||||||||
240 | if (!BN_copy(&(mont->N), mod)
| 0-83602 | ||||||||||||||||||
241 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
242 | if (BN_get_flags(mod, 0x04) != 0
| 8536-75066 | ||||||||||||||||||
243 | BN_set_flags(&(mont->N), 0x04); executed 8536 times by 1 test: BN_set_flags(&(mont->N), 0x04); Executed by:
| 8536 | ||||||||||||||||||
244 | mont->N.neg = 0; | - | ||||||||||||||||||
245 | - | |||||||||||||||||||
246 | - | |||||||||||||||||||
247 | { | - | ||||||||||||||||||
248 | BIGNUM tmod; | - | ||||||||||||||||||
249 | unsigned long buf[2]; | - | ||||||||||||||||||
250 | - | |||||||||||||||||||
251 | bn_init(&tmod); | - | ||||||||||||||||||
252 | tmod.d = buf; | - | ||||||||||||||||||
253 | tmod.dmax = 2; | - | ||||||||||||||||||
254 | tmod.neg = 0; | - | ||||||||||||||||||
255 | - | |||||||||||||||||||
256 | if (BN_get_flags(mod, 0x04) != 0
| 8536-75066 | ||||||||||||||||||
257 | BN_set_flags(&tmod, 0x04); executed 8536 times by 1 test: BN_set_flags(&tmod, 0x04); Executed by:
| 8536 | ||||||||||||||||||
258 | - | |||||||||||||||||||
259 | mont->ri = (BN_num_bits(mod) + ((8 * 8) - 1)) / (8 * 8) * (8 * 8); | - | ||||||||||||||||||
260 | (BN_set_word((R),0)); | - | ||||||||||||||||||
261 | if (!(BN_set_bit(R, (8 * 8)))
| 0-83602 | ||||||||||||||||||
262 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
263 | - | |||||||||||||||||||
264 | buf[0] = mod->d[0]; | - | ||||||||||||||||||
265 | buf[1] = 0; | - | ||||||||||||||||||
266 | tmod.top = buf[0] != 0
| 39-83563 | ||||||||||||||||||
267 | - | |||||||||||||||||||
268 | if (BN_is_one(&tmod)
| 6654-76948 | ||||||||||||||||||
269 | ( executed 6654 times by 1 test: BN_set_word((Ri),0));(BN_set_word((Ri),0)); Executed by:
executed 6654 times by 1 test: (BN_set_word((Ri),0)); Executed by:
| 6654 | ||||||||||||||||||
270 | else if ((
| 445-76503 | ||||||||||||||||||
271 | ((void *)0)
| 445-76503 | ||||||||||||||||||
272 | ) | - | ||||||||||||||||||
273 | goto executed 445 times by 1 test: err;goto err; Executed by:
executed 445 times by 1 test: goto err; Executed by:
| 445 | ||||||||||||||||||
274 | if (!BN_lshift(Ri, Ri, (8 * 8))
| 0-83157 | ||||||||||||||||||
275 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
276 | if (!BN_is_zero(Ri)
| 6654-76503 | ||||||||||||||||||
277 | if (!BN_sub_word(Ri, 1)
| 0-76503 | ||||||||||||||||||
278 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
279 | } executed 76503 times by 2 tests: else {end of block Executed by:
| 76503 | ||||||||||||||||||
280 | - | |||||||||||||||||||
281 | if (!BN_set_word(Ri, (0xffffffffffffffffL))
| 0-6654 | ||||||||||||||||||
282 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
283 | } executed 6654 times by 1 test: end of block Executed by:
| 6654 | ||||||||||||||||||
284 | if (!BN_div(Ri,
| 0-83157 | ||||||||||||||||||
285 | ((void *)0)
| 0-83157 | ||||||||||||||||||
286 | , Ri, &tmod, ctx)
| 0-83157 | ||||||||||||||||||
287 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
288 | - | |||||||||||||||||||
289 | - | |||||||||||||||||||
290 | - | |||||||||||||||||||
291 | mont->n0[0] = (
| 0-83157 | ||||||||||||||||||
292 | mont->n0[1] = 0; | - | ||||||||||||||||||
293 | - | |||||||||||||||||||
294 | } | - | ||||||||||||||||||
295 | (BN_set_word((&(mont->RR)),0)); | - | ||||||||||||||||||
296 | if (!BN_set_bit(&(mont->RR), mont->ri * 2)
| 0-83157 | ||||||||||||||||||
297 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
298 | if (!BN_div(
| 0-83157 | ||||||||||||||||||
299 | ((void *)0)
| 0-83157 | ||||||||||||||||||
300 | ,(&(mont->RR)),(&(mont->RR)),(&(mont->N)),(ctx))
| 0-83157 | ||||||||||||||||||
301 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
302 | - | |||||||||||||||||||
303 | for (i = mont->RR.top, ret = mont->N.top; i < ret
| 22425-83157 | ||||||||||||||||||
304 | mont->RR.d[i] = 0; executed 22425 times by 1 test: mont->RR.d[i] = 0; Executed by:
| 22425 | ||||||||||||||||||
305 | mont->RR.top = ret; | - | ||||||||||||||||||
306 | mont->RR.flags |= 0; | - | ||||||||||||||||||
307 | - | |||||||||||||||||||
308 | ret = 1; | - | ||||||||||||||||||
309 | err: code before this statement executed 83157 times by 2 tests: err: Executed by:
| 83157 | ||||||||||||||||||
310 | BN_CTX_end(ctx); | - | ||||||||||||||||||
311 | return executed 83602 times by 2 tests: ret;return ret; Executed by:
executed 83602 times by 2 tests: return ret; Executed by:
| 83602 | ||||||||||||||||||
312 | } | - | ||||||||||||||||||
313 | - | |||||||||||||||||||
314 | BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from) | - | ||||||||||||||||||
315 | { | - | ||||||||||||||||||
316 | if (to == from
| 0-58017 | ||||||||||||||||||
317 | return never executed: to;return to; never executed: return to; | 0 | ||||||||||||||||||
318 | - | |||||||||||||||||||
319 | if (!BN_copy(&(to->RR), &(from->RR))
| 0-58017 | ||||||||||||||||||
320 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
321 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
322 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
323 | if (!BN_copy(&(to->N), &(from->N))
| 0-58017 | ||||||||||||||||||
324 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
325 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
326 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
327 | if (!BN_copy(&(to->Ni), &(from->Ni))
| 0-58017 | ||||||||||||||||||
328 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
329 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
330 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
331 | to->ri = from->ri; | - | ||||||||||||||||||
332 | to->n0[0] = from->n0[0]; | - | ||||||||||||||||||
333 | to->n0[1] = from->n0[1]; | - | ||||||||||||||||||
334 | return executed 58017 times by 2 tests: to;return to; Executed by:
executed 58017 times by 2 tests: return to; Executed by:
| 58017 | ||||||||||||||||||
335 | } | - | ||||||||||||||||||
336 | - | |||||||||||||||||||
337 | BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock, | - | ||||||||||||||||||
338 | const BIGNUM *mod, BN_CTX *ctx) | - | ||||||||||||||||||
339 | { | - | ||||||||||||||||||
340 | BN_MONT_CTX *ret; | - | ||||||||||||||||||
341 | - | |||||||||||||||||||
342 | CRYPTO_THREAD_read_lock(lock); | - | ||||||||||||||||||
343 | ret = *pmont; | - | ||||||||||||||||||
344 | CRYPTO_THREAD_unlock(lock); | - | ||||||||||||||||||
345 | if (ret
| 2376-8871 | ||||||||||||||||||
346 | return executed 2376 times by 1 test: ret;return ret; Executed by:
executed 2376 times by 1 test: return ret; Executed by:
| 2376 | ||||||||||||||||||
347 | ret = BN_MONT_CTX_new(); | - | ||||||||||||||||||
348 | if (ret ==
| 0-8871 | ||||||||||||||||||
349 | ((void *)0)
| 0-8871 | ||||||||||||||||||
350 | ) | - | ||||||||||||||||||
351 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
352 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
353 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
354 | if (!BN_MONT_CTX_set(ret, mod, ctx)
| 22-8849 | ||||||||||||||||||
355 | BN_MONT_CTX_free(ret); | - | ||||||||||||||||||
356 | return executed 22 times by 1 test: return ((void *)0) ; Executed by:
executed 22 times by 1 test: return ((void *)0) ; Executed by:
| 22 | ||||||||||||||||||
357 | ((void *)0) executed 22 times by 1 test: return ((void *)0) ; Executed by:
| 22 | ||||||||||||||||||
358 | ; executed 22 times by 1 test: return ((void *)0) ; Executed by:
| 22 | ||||||||||||||||||
359 | } | - | ||||||||||||||||||
360 | - | |||||||||||||||||||
361 | - | |||||||||||||||||||
362 | CRYPTO_THREAD_write_lock(lock); | - | ||||||||||||||||||
363 | if (*
| 0-8849 | ||||||||||||||||||
364 | BN_MONT_CTX_free(ret); | - | ||||||||||||||||||
365 | ret = *pmont; | - | ||||||||||||||||||
366 | } never executed: elseend of block | 0 | ||||||||||||||||||
367 | * executed 8849 times by 1 test: pmont = ret;*pmont = ret; Executed by:
executed 8849 times by 1 test: *pmont = ret; Executed by:
| 8849 | ||||||||||||||||||
368 | CRYPTO_THREAD_unlock(lock); | - | ||||||||||||||||||
369 | return executed 8849 times by 1 test: ret;return ret; Executed by:
executed 8849 times by 1 test: return ret; Executed by:
| 8849 | ||||||||||||||||||
370 | } | - | ||||||||||||||||||
Switch to Source code | Preprocessed file |