Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/bn/bn_blind.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | struct bn_blinding_st { | - | ||||||||||||||||||
5 | BIGNUM *A; | - | ||||||||||||||||||
6 | BIGNUM *Ai; | - | ||||||||||||||||||
7 | BIGNUM *e; | - | ||||||||||||||||||
8 | BIGNUM *mod; | - | ||||||||||||||||||
9 | CRYPTO_THREAD_ID tid; | - | ||||||||||||||||||
10 | int counter; | - | ||||||||||||||||||
11 | unsigned long flags; | - | ||||||||||||||||||
12 | BN_MONT_CTX *m_ctx; | - | ||||||||||||||||||
13 | int (*bn_mod_exp) (BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | - | ||||||||||||||||||
14 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | - | ||||||||||||||||||
15 | CRYPTO_RWLOCK *lock; | - | ||||||||||||||||||
16 | }; | - | ||||||||||||||||||
17 | - | |||||||||||||||||||
18 | BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod) | - | ||||||||||||||||||
19 | { | - | ||||||||||||||||||
20 | BN_BLINDING *ret = | - | ||||||||||||||||||
21 | ((void *)0) | - | ||||||||||||||||||
22 | ; | - | ||||||||||||||||||
23 | - | |||||||||||||||||||
24 | ; | - | ||||||||||||||||||
25 | - | |||||||||||||||||||
26 | if ((
| 0-1733 | ||||||||||||||||||
27 | ((void *)0)
| 0-1733 | ||||||||||||||||||
28 | ) { | - | ||||||||||||||||||
29 | ERR_put_error(3,(102),((1|64)),__FILE__,37); | - | ||||||||||||||||||
30 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
31 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
32 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
33 | } | - | ||||||||||||||||||
34 | - | |||||||||||||||||||
35 | ret->lock = CRYPTO_THREAD_lock_new(); | - | ||||||||||||||||||
36 | if (ret->lock ==
| 0-1733 | ||||||||||||||||||
37 | ((void *)0)
| 0-1733 | ||||||||||||||||||
38 | ) { | - | ||||||||||||||||||
39 | ERR_put_error(3,(102),((1|64)),__FILE__,43); | - | ||||||||||||||||||
40 | CRYPTO_free(ret, __FILE__, 44); | - | ||||||||||||||||||
41 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
42 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
43 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
44 | } | - | ||||||||||||||||||
45 | - | |||||||||||||||||||
46 | BN_BLINDING_set_current_thread(ret); | - | ||||||||||||||||||
47 | - | |||||||||||||||||||
48 | if (A !=
| 0-1733 | ||||||||||||||||||
49 | ((void *)0)
| 0-1733 | ||||||||||||||||||
50 | ) { | - | ||||||||||||||||||
51 | if ((
| 0 | ||||||||||||||||||
52 | ((void *)0)
| 0 | ||||||||||||||||||
53 | ) | - | ||||||||||||||||||
54 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
55 | } never executed: end of block | 0 | ||||||||||||||||||
56 | - | |||||||||||||||||||
57 | if (Ai !=
| 0-1733 | ||||||||||||||||||
58 | ((void *)0)
| 0-1733 | ||||||||||||||||||
59 | ) { | - | ||||||||||||||||||
60 | if ((
| 0 | ||||||||||||||||||
61 | ((void *)0)
| 0 | ||||||||||||||||||
62 | ) | - | ||||||||||||||||||
63 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
64 | } never executed: end of block | 0 | ||||||||||||||||||
65 | - | |||||||||||||||||||
66 | - | |||||||||||||||||||
67 | if ((
| 0-1733 | ||||||||||||||||||
68 | ((void *)0)
| 0-1733 | ||||||||||||||||||
69 | ) | - | ||||||||||||||||||
70 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
71 | - | |||||||||||||||||||
72 | if (BN_get_flags(mod, 0x04) != 0
| 0-1733 | ||||||||||||||||||
73 | BN_set_flags(ret->mod, 0x04); executed 1733 times by 1 test: BN_set_flags(ret->mod, 0x04); Executed by:
| 1733 | ||||||||||||||||||
74 | - | |||||||||||||||||||
75 | - | |||||||||||||||||||
76 | - | |||||||||||||||||||
77 | - | |||||||||||||||||||
78 | - | |||||||||||||||||||
79 | - | |||||||||||||||||||
80 | ret->counter = -1; | - | ||||||||||||||||||
81 | - | |||||||||||||||||||
82 | return executed 1733 times by 1 test: ret;return ret; Executed by:
executed 1733 times by 1 test: return ret; Executed by:
| 1733 | ||||||||||||||||||
83 | - | |||||||||||||||||||
84 | err: | - | ||||||||||||||||||
85 | BN_BLINDING_free(ret); | - | ||||||||||||||||||
86 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
87 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
88 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
89 | } | - | ||||||||||||||||||
90 | - | |||||||||||||||||||
91 | void BN_BLINDING_free(BN_BLINDING *r) | - | ||||||||||||||||||
92 | { | - | ||||||||||||||||||
93 | if (r ==
| 1733-50207 | ||||||||||||||||||
94 | ((void *)0)
| 1733-50207 | ||||||||||||||||||
95 | ) | - | ||||||||||||||||||
96 | return; executed 50207 times by 1 test: return; Executed by:
| 50207 | ||||||||||||||||||
97 | BN_free(r->A); | - | ||||||||||||||||||
98 | BN_free(r->Ai); | - | ||||||||||||||||||
99 | BN_free(r->e); | - | ||||||||||||||||||
100 | BN_free(r->mod); | - | ||||||||||||||||||
101 | CRYPTO_THREAD_lock_free(r->lock); | - | ||||||||||||||||||
102 | CRYPTO_free(r, __FILE__, 90); | - | ||||||||||||||||||
103 | } executed 1733 times by 1 test: end of block Executed by:
| 1733 | ||||||||||||||||||
104 | - | |||||||||||||||||||
105 | int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx) | - | ||||||||||||||||||
106 | { | - | ||||||||||||||||||
107 | int ret = 0; | - | ||||||||||||||||||
108 | - | |||||||||||||||||||
109 | if ((
| 0-648 | ||||||||||||||||||
110 | ((void *)0)
| 0-648 | ||||||||||||||||||
111 | )
| 0-648 | ||||||||||||||||||
112 | ((void *)0)
| 0-648 | ||||||||||||||||||
113 | )
| 0-648 | ||||||||||||||||||
114 | ERR_put_error(3,(103),(107),__FILE__,98); | - | ||||||||||||||||||
115 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
116 | } | - | ||||||||||||||||||
117 | - | |||||||||||||||||||
118 | if (b->counter == -1
| 0-648 | ||||||||||||||||||
119 | b->counter = 0; never executed: b->counter = 0; | 0 | ||||||||||||||||||
120 | - | |||||||||||||||||||
121 | if (++
| 0-633 | ||||||||||||||||||
122 | ((void *)0)
| 0-15 | ||||||||||||||||||
123 | && | - | ||||||||||||||||||
124 | !(b->flags & 0x00000002)
| 0-15 | ||||||||||||||||||
125 | - | |||||||||||||||||||
126 | if (!BN_BLINDING_create_param(b,
| 0-15 | ||||||||||||||||||
127 | ((void *)0)
| 0-15 | ||||||||||||||||||
128 | ,
| 0-15 | ||||||||||||||||||
129 | ((void *)0)
| 0-15 | ||||||||||||||||||
130 | , ctx,
| 0-15 | ||||||||||||||||||
131 | ((void *)0)
| 0-15 | ||||||||||||||||||
132 | ,
| 0-15 | ||||||||||||||||||
133 | ((void *)0)
| 0-15 | ||||||||||||||||||
134 | )
| 0-15 | ||||||||||||||||||
135 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
136 | } executed 15 times by 1 test: else if (!(b->flags & 0x00000001)end of block Executed by:
| 0-633 | ||||||||||||||||||
137 | if (b->m_ctx !=
| 161-472 | ||||||||||||||||||
138 | ((void *)0)
| 161-472 | ||||||||||||||||||
139 | ) { | - | ||||||||||||||||||
140 | if (!bn_mul_mont_fixed_top(b->Ai, b->Ai, b->Ai, b->m_ctx, ctx)
| 0-472 | ||||||||||||||||||
141 | || !bn_mul_mont_fixed_top(b->A, b->A, b->A, b->m_ctx, ctx)
| 0-472 | ||||||||||||||||||
142 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
143 | } executed 472 times by 1 test: else {end of block Executed by:
| 472 | ||||||||||||||||||
144 | if (!BN_mod_mul(b->Ai, b->Ai, b->Ai, b->mod, ctx)
| 0-161 | ||||||||||||||||||
145 | || !BN_mod_mul(b->A, b->A, b->A, b->mod, ctx)
| 0-161 | ||||||||||||||||||
146 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
147 | } executed 161 times by 1 test: end of block Executed by:
| 161 | ||||||||||||||||||
148 | } | - | ||||||||||||||||||
149 | - | |||||||||||||||||||
150 | ret = 1; | - | ||||||||||||||||||
151 | err: code before this statement executed 648 times by 1 test: err: Executed by:
| 648 | ||||||||||||||||||
152 | if (b->counter == 32
| 15-633 | ||||||||||||||||||
153 | b->counter = 0; executed 15 times by 1 test: b->counter = 0; Executed by:
| 15 | ||||||||||||||||||
154 | return executed 648 times by 1 test: ret;return ret; Executed by:
executed 648 times by 1 test: return ret; Executed by:
| 648 | ||||||||||||||||||
155 | } | - | ||||||||||||||||||
156 | - | |||||||||||||||||||
157 | int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx) | - | ||||||||||||||||||
158 | { | - | ||||||||||||||||||
159 | return never executed: BN_BLINDING_convert_ex(n, return BN_BLINDING_convert_ex(n, ((void *)0) , b, ctx); never executed: return BN_BLINDING_convert_ex(n, ((void *)0) , b, ctx); | 0 | ||||||||||||||||||
160 | ((void *)0) never executed: return BN_BLINDING_convert_ex(n, ((void *)0) , b, ctx); | 0 | ||||||||||||||||||
161 | , b, ctx); never executed: return BN_BLINDING_convert_ex(n, ((void *)0) , b, ctx); | 0 | ||||||||||||||||||
162 | } | - | ||||||||||||||||||
163 | - | |||||||||||||||||||
164 | int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx) | - | ||||||||||||||||||
165 | { | - | ||||||||||||||||||
166 | int ret = 1; | - | ||||||||||||||||||
167 | - | |||||||||||||||||||
168 | ; | - | ||||||||||||||||||
169 | - | |||||||||||||||||||
170 | if ((
| 0-2381 | ||||||||||||||||||
171 | ((void *)0)
| 0-2381 | ||||||||||||||||||
172 | )
| 0-2381 | ||||||||||||||||||
173 | ((void *)0)
| 0-2381 | ||||||||||||||||||
174 | )
| 0-2381 | ||||||||||||||||||
175 | ERR_put_error(3,(100),(107),__FILE__,141); | - | ||||||||||||||||||
176 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
177 | } | - | ||||||||||||||||||
178 | - | |||||||||||||||||||
179 | if (b->counter == -1
| 648-1733 | ||||||||||||||||||
180 | - | |||||||||||||||||||
181 | b->counter = 0; executed 1733 times by 1 test: b->counter = 0; Executed by:
| 1733 | ||||||||||||||||||
182 | else if (!BN_BLINDING_update(b, ctx)
| 0-648 | ||||||||||||||||||
183 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
184 | - | |||||||||||||||||||
185 | if (r !=
| 0-2381 | ||||||||||||||||||
186 | ((void *)0)
| 0-2381 | ||||||||||||||||||
187 | && (
| 0 | ||||||||||||||||||
188 | ((void *)0)
| 0 | ||||||||||||||||||
189 | )
| 0 | ||||||||||||||||||
190 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
191 | - | |||||||||||||||||||
192 | if (b->m_ctx !=
| 495-1886 | ||||||||||||||||||
193 | ((void *)0)
| 495-1886 | ||||||||||||||||||
194 | ) | - | ||||||||||||||||||
195 | ret = BN_mod_mul_montgomery(n, n, b->A, b->m_ctx, ctx); executed 495 times by 1 test: ret = BN_mod_mul_montgomery(n, n, b->A, b->m_ctx, ctx); Executed by:
| 495 | ||||||||||||||||||
196 | else | - | ||||||||||||||||||
197 | ret = BN_mod_mul(n, n, b->A, b->mod, ctx); executed 1886 times by 1 test: ret = BN_mod_mul(n, n, b->A, b->mod, ctx); Executed by:
| 1886 | ||||||||||||||||||
198 | - | |||||||||||||||||||
199 | return executed 2381 times by 1 test: ret;return ret; Executed by:
executed 2381 times by 1 test: return ret; Executed by:
| 2381 | ||||||||||||||||||
200 | } | - | ||||||||||||||||||
201 | - | |||||||||||||||||||
202 | int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx) | - | ||||||||||||||||||
203 | { | - | ||||||||||||||||||
204 | return never executed: BN_BLINDING_invert_ex(n, return BN_BLINDING_invert_ex(n, ((void *)0) , b, ctx); never executed: return BN_BLINDING_invert_ex(n, ((void *)0) , b, ctx); | 0 | ||||||||||||||||||
205 | ((void *)0) never executed: return BN_BLINDING_invert_ex(n, ((void *)0) , b, ctx); | 0 | ||||||||||||||||||
206 | , b, ctx); never executed: return BN_BLINDING_invert_ex(n, ((void *)0) , b, ctx); | 0 | ||||||||||||||||||
207 | } | - | ||||||||||||||||||
208 | - | |||||||||||||||||||
209 | int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, | - | ||||||||||||||||||
210 | BN_CTX *ctx) | - | ||||||||||||||||||
211 | { | - | ||||||||||||||||||
212 | int ret; | - | ||||||||||||||||||
213 | - | |||||||||||||||||||
214 | ; | - | ||||||||||||||||||
215 | - | |||||||||||||||||||
216 | if (r ==
| 0-2381 | ||||||||||||||||||
217 | ((void *)0)
| 0-2381 | ||||||||||||||||||
218 | && (
| 0-2381 | ||||||||||||||||||
219 | ((void *)0)
| 0-2381 | ||||||||||||||||||
220 | ) { | - | ||||||||||||||||||
221 | ERR_put_error(3,(101),(107),__FILE__,175); | - | ||||||||||||||||||
222 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
223 | } | - | ||||||||||||||||||
224 | - | |||||||||||||||||||
225 | if (b->m_ctx !=
| 495-1886 | ||||||||||||||||||
226 | ((void *)0)
| 495-1886 | ||||||||||||||||||
227 | ) { | - | ||||||||||||||||||
228 | - | |||||||||||||||||||
229 | if (n->dmax >= r->top
| 0-495 | ||||||||||||||||||
230 | size_t i, rtop = r->top, ntop = n->top; | - | ||||||||||||||||||
231 | unsigned long mask; | - | ||||||||||||||||||
232 | - | |||||||||||||||||||
233 | for (i = 0; i < rtop
| 495-5961 | ||||||||||||||||||
234 | mask = (unsigned long)0 - ((i - ntop) >> (8 * sizeof(i) - 1)); | - | ||||||||||||||||||
235 | n->d[i] &= mask; | - | ||||||||||||||||||
236 | } executed 5961 times by 1 test: end of block Executed by:
| 5961 | ||||||||||||||||||
237 | mask = (unsigned long)0 - ((rtop - ntop) >> (8 * sizeof(ntop) - 1)); | - | ||||||||||||||||||
238 | - | |||||||||||||||||||
239 | n->top = (int)(rtop & ~mask) | (ntop & mask); | - | ||||||||||||||||||
240 | n->flags |= (0 & ~mask); | - | ||||||||||||||||||
241 | } executed 495 times by 1 test: end of block Executed by:
| 495 | ||||||||||||||||||
242 | ret = BN_mod_mul_montgomery(n, n, r, b->m_ctx, ctx); | - | ||||||||||||||||||
243 | } executed 495 times by 1 test: else {end of block Executed by:
| 495 | ||||||||||||||||||
244 | ret = BN_mod_mul(n, n, r, b->mod, ctx); | - | ||||||||||||||||||
245 | } executed 1886 times by 1 test: end of block Executed by:
| 1886 | ||||||||||||||||||
246 | - | |||||||||||||||||||
247 | ; | - | ||||||||||||||||||
248 | return executed 2381 times by 1 test: ret;return ret; Executed by:
executed 2381 times by 1 test: return ret; Executed by:
| 2381 | ||||||||||||||||||
249 | } | - | ||||||||||||||||||
250 | - | |||||||||||||||||||
251 | int BN_BLINDING_is_current_thread(BN_BLINDING *b) | - | ||||||||||||||||||
252 | { | - | ||||||||||||||||||
253 | return executed 2381 times by 1 test: CRYPTO_THREAD_compare_id(CRYPTO_THREAD_get_current_id(), b->tid);return CRYPTO_THREAD_compare_id(CRYPTO_THREAD_get_current_id(), b->tid); Executed by:
executed 2381 times by 1 test: return CRYPTO_THREAD_compare_id(CRYPTO_THREAD_get_current_id(), b->tid); Executed by:
| 2381 | ||||||||||||||||||
254 | } | - | ||||||||||||||||||
255 | - | |||||||||||||||||||
256 | void BN_BLINDING_set_current_thread(BN_BLINDING *b) | - | ||||||||||||||||||
257 | { | - | ||||||||||||||||||
258 | b->tid = CRYPTO_THREAD_get_current_id(); | - | ||||||||||||||||||
259 | } executed 3466 times by 1 test: end of block Executed by:
| 3466 | ||||||||||||||||||
260 | - | |||||||||||||||||||
261 | int BN_BLINDING_lock(BN_BLINDING *b) | - | ||||||||||||||||||
262 | { | - | ||||||||||||||||||
263 | return never executed: CRYPTO_THREAD_write_lock(b->lock);return CRYPTO_THREAD_write_lock(b->lock); never executed: return CRYPTO_THREAD_write_lock(b->lock); | 0 | ||||||||||||||||||
264 | } | - | ||||||||||||||||||
265 | - | |||||||||||||||||||
266 | int BN_BLINDING_unlock(BN_BLINDING *b) | - | ||||||||||||||||||
267 | { | - | ||||||||||||||||||
268 | return never executed: CRYPTO_THREAD_unlock(b->lock);return CRYPTO_THREAD_unlock(b->lock); never executed: return CRYPTO_THREAD_unlock(b->lock); | 0 | ||||||||||||||||||
269 | } | - | ||||||||||||||||||
270 | - | |||||||||||||||||||
271 | unsigned long BN_BLINDING_get_flags(const BN_BLINDING *b) | - | ||||||||||||||||||
272 | { | - | ||||||||||||||||||
273 | return never executed: b->flags;return b->flags; never executed: return b->flags; | 0 | ||||||||||||||||||
274 | } | - | ||||||||||||||||||
275 | - | |||||||||||||||||||
276 | void BN_BLINDING_set_flags(BN_BLINDING *b, unsigned long flags) | - | ||||||||||||||||||
277 | { | - | ||||||||||||||||||
278 | b->flags = flags; | - | ||||||||||||||||||
279 | } never executed: end of block | 0 | ||||||||||||||||||
280 | - | |||||||||||||||||||
281 | BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, | - | ||||||||||||||||||
282 | const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, | - | ||||||||||||||||||
283 | int (*bn_mod_exp) (BIGNUM *r, | - | ||||||||||||||||||
284 | const BIGNUM *a, | - | ||||||||||||||||||
285 | const BIGNUM *p, | - | ||||||||||||||||||
286 | const BIGNUM *m, | - | ||||||||||||||||||
287 | BN_CTX *ctx, | - | ||||||||||||||||||
288 | BN_MONT_CTX *m_ctx), | - | ||||||||||||||||||
289 | BN_MONT_CTX *m_ctx) | - | ||||||||||||||||||
290 | { | - | ||||||||||||||||||
291 | int retry_counter = 32; | - | ||||||||||||||||||
292 | BN_BLINDING *ret = | - | ||||||||||||||||||
293 | ((void *)0) | - | ||||||||||||||||||
294 | ; | - | ||||||||||||||||||
295 | - | |||||||||||||||||||
296 | if (b ==
| 15-1733 | ||||||||||||||||||
297 | ((void *)0)
| 15-1733 | ||||||||||||||||||
298 | ) | - | ||||||||||||||||||
299 | ret = BN_BLINDING_new( executed 1733 times by 1 test: ret = BN_BLINDING_new( ((void *)0) , ((void *)0) , m); Executed by:
| 1733 | ||||||||||||||||||
300 | ((void *)0) executed 1733 times by 1 test: ret = BN_BLINDING_new( ((void *)0) , ((void *)0) , m); Executed by:
| 1733 | ||||||||||||||||||
301 | , executed 1733 times by 1 test: ret = BN_BLINDING_new( ((void *)0) , ((void *)0) , m); Executed by:
| 1733 | ||||||||||||||||||
302 | ((void *)0) executed 1733 times by 1 test: ret = BN_BLINDING_new( ((void *)0) , ((void *)0) , m); Executed by:
| 1733 | ||||||||||||||||||
303 | , m); executed 1733 times by 1 test: ret = BN_BLINDING_new( ((void *)0) , ((void *)0) , m); Executed by:
| 1733 | ||||||||||||||||||
304 | else | - | ||||||||||||||||||
305 | ret = b; executed 15 times by 1 test: ret = b; Executed by:
| 15 | ||||||||||||||||||
306 | - | |||||||||||||||||||
307 | if (ret ==
| 0-1748 | ||||||||||||||||||
308 | ((void *)0)
| 0-1748 | ||||||||||||||||||
309 | ) | - | ||||||||||||||||||
310 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
311 | - | |||||||||||||||||||
312 | if (ret->A ==
| 15-1733 | ||||||||||||||||||
313 | ((void *)0)
| 15-1733 | ||||||||||||||||||
314 | && (
| 0-1733 | ||||||||||||||||||
315 | ((void *)0)
| 0-1733 | ||||||||||||||||||
316 | ) | - | ||||||||||||||||||
317 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
318 | if (ret->Ai ==
| 15-1733 | ||||||||||||||||||
319 | ((void *)0)
| 15-1733 | ||||||||||||||||||
320 | && (
| 0-1733 | ||||||||||||||||||
321 | ((void *)0)
| 0-1733 | ||||||||||||||||||
322 | ) | - | ||||||||||||||||||
323 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
324 | - | |||||||||||||||||||
325 | if (e !=
| 15-1733 | ||||||||||||||||||
326 | ((void *)0)
| 15-1733 | ||||||||||||||||||
327 | ) { | - | ||||||||||||||||||
328 | BN_free(ret->e); | - | ||||||||||||||||||
329 | ret->e = BN_dup(e); | - | ||||||||||||||||||
330 | } executed 1733 times by 1 test: end of block Executed by:
| 1733 | ||||||||||||||||||
331 | if (ret->e ==
| 0-1748 | ||||||||||||||||||
332 | ((void *)0)
| 0-1748 | ||||||||||||||||||
333 | ) | - | ||||||||||||||||||
334 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
335 | - | |||||||||||||||||||
336 | if (bn_mod_exp !=
| 15-1733 | ||||||||||||||||||
337 | ((void *)0)
| 15-1733 | ||||||||||||||||||
338 | ) | - | ||||||||||||||||||
339 | ret->bn_mod_exp = bn_mod_exp; executed 1733 times by 1 test: ret->bn_mod_exp = bn_mod_exp; Executed by:
| 1733 | ||||||||||||||||||
340 | if (m_ctx !=
| 8-1740 | ||||||||||||||||||
341 | ((void *)0)
| 8-1740 | ||||||||||||||||||
342 | ) | - | ||||||||||||||||||
343 | ret->m_ctx = m_ctx; executed 8 times by 1 test: ret->m_ctx = m_ctx; Executed by:
| 8 | ||||||||||||||||||
344 | - | |||||||||||||||||||
345 | do { | - | ||||||||||||||||||
346 | int rv; | - | ||||||||||||||||||
347 | if (!BN_priv_rand_range(ret->A, ret->mod)
| 0-1748 | ||||||||||||||||||
348 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
349 | if (int_bn_mod_inverse(ret->Ai, ret->A, ret->mod, ctx, &rv)
| 0-1748 | ||||||||||||||||||
350 | break; executed 1748 times by 1 test: break; Executed by:
| 1748 | ||||||||||||||||||
351 | - | |||||||||||||||||||
352 | - | |||||||||||||||||||
353 | - | |||||||||||||||||||
354 | - | |||||||||||||||||||
355 | if (!rv
| 0 | ||||||||||||||||||
356 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
357 | - | |||||||||||||||||||
358 | if (retry_counter-- == 0
| 0 | ||||||||||||||||||
359 | ERR_put_error(3,(128),(113),__FILE__,285); | - | ||||||||||||||||||
360 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
361 | } | - | ||||||||||||||||||
362 | } never executed: while (1);end of block | 0 | ||||||||||||||||||
363 | - | |||||||||||||||||||
364 | if (ret->bn_mod_exp !=
| 0-1748 | ||||||||||||||||||
365 | ((void *)0)
| 0-1748 | ||||||||||||||||||
366 | && ret->m_ctx !=
| 23-1725 | ||||||||||||||||||
367 | ((void *)0)
| 23-1725 | ||||||||||||||||||
368 | ) { | - | ||||||||||||||||||
369 | if (!ret->bn_mod_exp(ret->A, ret->A, ret->e, ret->mod, ctx, ret->m_ctx)
| 0-23 | ||||||||||||||||||
370 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
371 | } executed 23 times by 1 test: else {end of block Executed by:
| 23 | ||||||||||||||||||
372 | if (!BN_mod_exp(ret->A, ret->A, ret->e, ret->mod, ctx)
| 0-1725 | ||||||||||||||||||
373 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
374 | } executed 1725 times by 1 test: end of block Executed by:
| 1725 | ||||||||||||||||||
375 | - | |||||||||||||||||||
376 | if (ret->m_ctx !=
| 23-1725 | ||||||||||||||||||
377 | ((void *)0)
| 23-1725 | ||||||||||||||||||
378 | ) { | - | ||||||||||||||||||
379 | if (!bn_to_mont_fixed_top(ret->Ai, ret->Ai, ret->m_ctx, ctx)
| 0-23 | ||||||||||||||||||
380 | || !bn_to_mont_fixed_top(ret->A, ret->A, ret->m_ctx, ctx)
| 0-23 | ||||||||||||||||||
381 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
382 | } executed 23 times by 1 test: end of block Executed by:
| 23 | ||||||||||||||||||
383 | - | |||||||||||||||||||
384 | return executed 1748 times by 1 test: ret;return ret; Executed by:
executed 1748 times by 1 test: return ret; Executed by:
| 1748 | ||||||||||||||||||
385 | err: | - | ||||||||||||||||||
386 | if (b ==
| 0 | ||||||||||||||||||
387 | ((void *)0)
| 0 | ||||||||||||||||||
388 | ) { | - | ||||||||||||||||||
389 | BN_BLINDING_free(ret); | - | ||||||||||||||||||
390 | ret = | - | ||||||||||||||||||
391 | ((void *)0) | - | ||||||||||||||||||
392 | ; | - | ||||||||||||||||||
393 | } never executed: end of block | 0 | ||||||||||||||||||
394 | - | |||||||||||||||||||
395 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||
396 | } | - | ||||||||||||||||||
Switch to Source code | Preprocessed file |