OpenCoverage

bn_blind.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/bn/bn_blind.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4struct 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-
18BN_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 ((
(ret = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ret = CRYPTO_zalloc(sizeof(*ret), __FILE__, 36)) ==
(ret = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1733
27 ((void *)0)
(ret = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
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 ==
ret->lock == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1733
37 ((void *)0)
ret->lock == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
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 !=
A != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1733
49 ((void *)0)
A != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1733
50 ) {-
51 if ((
(ret->A = BN_d...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
ret->A = BN_dup(A)) ==
(ret->A = BN_d...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
52 ((void *)0)
(ret->A = BN_d...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
53 )-
54 goto
never executed: goto err;
err;
never executed: goto err;
0
55 }
never executed: end of block
0
56-
57 if (Ai !=
Ai != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1733
58 ((void *)0)
Ai != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1733
59 ) {-
60 if ((
(ret->Ai = BN_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
ret->Ai = BN_dup(Ai)) ==
(ret->Ai = BN_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
61 ((void *)0)
(ret->Ai = BN_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
62 )-
63 goto
never executed: goto err;
err;
never executed: goto err;
0
64 }
never executed: end of block
0
65-
66-
67 if ((
(ret->mod = BN...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ret->mod = BN_dup(mod)) ==
(ret->mod = BN...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1733
68 ((void *)0)
(ret->mod = BN...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1733
69 )-
70 goto
never executed: goto err;
err;
never executed: goto err;
0
71-
72 if (BN_get_flags(mod, 0x04) != 0
BN_get_flags(mod, 0x04) != 0Description
TRUEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-1733
73 BN_set_flags(ret->mod, 0x04);
executed 1733 times by 1 test: BN_set_flags(ret->mod, 0x04);
Executed by:
  • libcrypto.so.1.1
1733
74-
75-
76-
77-
78-
79-
80 ret->counter = -1;-
81-
82 return
executed 1733 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 1733 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
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-
91void BN_BLINDING_free(BN_BLINDING *r)-
92{-
93 if (r ==
r == ((void *)0)Description
TRUEevaluated 50207 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1733-50207
94 ((void *)0)
r == ((void *)0)Description
TRUEevaluated 50207 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1733-50207
95 )-
96 return;
executed 50207 times by 1 test: return;
Executed by:
  • libcrypto.so.1.1
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:
  • libcrypto.so.1.1
1733
104-
105int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx)-
106{-
107 int ret = 0;-
108-
109 if ((
(b->A == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 648 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
b->A ==
(b->A == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 648 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-648
110 ((void *)0)
(b->A == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 648 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-648
111 )
(b->A == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 648 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| (
(b->Ai == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 648 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
b->Ai ==
(b->Ai == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 648 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-648
112 ((void *)0)
(b->Ai == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 648 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-648
113 )
(b->Ai == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 648 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-648
114 ERR_put_error(3,(103),(107),__FILE__,98);-
115 goto
never executed: goto err;
err;
never executed: goto err;
0
116 }-
117-
118 if (b->counter == -1
b->counter == -1Description
TRUEnever evaluated
FALSEevaluated 648 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-648
119 b->counter = 0;
never executed: b->counter = 0;
0
120-
121 if (++
++b->counter == 32Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 633 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
b->counter == 32
++b->counter == 32Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 633 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& b->e !=
b->e != ((void *)0)Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-633
122 ((void *)0)
b->e != ((void *)0)Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-15
123 &&-
124 !(b->flags & 0x00000002)
!(b->flags & 0x00000002)Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-15
125-
126 if (!BN_BLINDING_create_param(b,
!BN_BLINDING_c... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15
127 ((void *)0)
!BN_BLINDING_c... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15
128 ,
!BN_BLINDING_c... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15
129 ((void *)0)
!BN_BLINDING_c... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15
130 , ctx,
!BN_BLINDING_c... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15
131 ((void *)0)
!BN_BLINDING_c... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15
132 ,
!BN_BLINDING_c... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15
133 ((void *)0)
!BN_BLINDING_c... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15
134 )
!BN_BLINDING_c... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-15
135 goto
never executed: goto err;
err;
never executed: goto err;
0
136 }
executed 15 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else if (!(b->flags & 0x00000001)
!(b->flags & 0x00000001)Description
TRUEevaluated 633 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-633
137 if (b->m_ctx !=
b->m_ctx != ((void *)0)Description
TRUEevaluated 472 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 161 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
161-472
138 ((void *)0)
b->m_ctx != ((void *)0)Description
TRUEevaluated 472 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 161 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
161-472
139 ) {-
140 if (!bn_mul_mont_fixed_top(b->Ai, b->Ai, b->Ai, b->m_ctx, ctx)
!bn_mul_mont_f...b->m_ctx, ctx)Description
TRUEnever evaluated
FALSEevaluated 472 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-472
141 || !bn_mul_mont_fixed_top(b->A, b->A, b->A, b->m_ctx, ctx)
!bn_mul_mont_f...b->m_ctx, ctx)Description
TRUEnever evaluated
FALSEevaluated 472 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-472
142 goto
never executed: goto err;
err;
never executed: goto err;
0
143 }
executed 472 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
472
144 if (!BN_mod_mul(b->Ai, b->Ai, b->Ai, b->mod, ctx)
!BN_mod_mul(b-..., b->mod, ctx)Description
TRUEnever evaluated
FALSEevaluated 161 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-161
145 || !BN_mod_mul(b->A, b->A, b->A, b->mod, ctx)
!BN_mod_mul(b-..., b->mod, ctx)Description
TRUEnever evaluated
FALSEevaluated 161 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-161
146 goto
never executed: goto err;
err;
never executed: goto err;
0
147 }
executed 161 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
161
148 }-
149-
150 ret = 1;-
151 err:
code before this statement executed 648 times by 1 test: err:
Executed by:
  • libcrypto.so.1.1
648
152 if (b->counter == 32
b->counter == 32Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 633 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
15-633
153 b->counter = 0;
executed 15 times by 1 test: b->counter = 0;
Executed by:
  • libcrypto.so.1.1
15
154 return
executed 648 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 648 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
648
155}-
156-
157int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx)-
158{-
159 return
never executed: return BN_BLINDING_convert_ex(n, ((void *)0) , b, ctx);
BN_BLINDING_convert_ex(n,
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-
164int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx)-
165{-
166 int ret = 1;-
167-
168 ;-
169-
170 if ((
(b->A == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2381 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
b->A ==
(b->A == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2381 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2381
171 ((void *)0)
(b->A == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2381 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2381
172 )
(b->A == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2381 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| (
(b->Ai == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2381 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
b->Ai ==
(b->Ai == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2381 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2381
173 ((void *)0)
(b->Ai == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2381 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2381
174 )
(b->Ai == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2381 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-2381
175 ERR_put_error(3,(100),(107),__FILE__,141);-
176 return
never executed: return 0;
0;
never executed: return 0;
0
177 }-
178-
179 if (b->counter == -1
b->counter == -1Description
TRUEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 648 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
648-1733
180-
181 b->counter = 0;
executed 1733 times by 1 test: b->counter = 0;
Executed by:
  • libcrypto.so.1.1
1733
182 else if (!BN_BLINDING_update(b, ctx)
!BN_BLINDING_update(b, ctx)Description
TRUEnever evaluated
FALSEevaluated 648 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-648
183 return
never executed: return 0;
0;
never executed: return 0;
0
184-
185 if (r !=
r != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2381 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2381
186 ((void *)0)
r != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2381 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2381
187 && (
(BN_copy(r, b-... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
BN_copy(r, b->Ai) ==
(BN_copy(r, b-... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
188 ((void *)0)
(BN_copy(r, b-... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
189 )
(BN_copy(r, b-... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
)
0
190 return
never executed: return 0;
0;
never executed: return 0;
0
191-
192 if (b->m_ctx !=
b->m_ctx != ((void *)0)Description
TRUEevaluated 495 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1886 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
495-1886
193 ((void *)0)
b->m_ctx != ((void *)0)Description
TRUEevaluated 495 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1886 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
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:
  • libcrypto.so.1.1
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:
  • libcrypto.so.1.1
1886
198-
199 return
executed 2381 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 2381 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
2381
200}-
201-
202int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx)-
203{-
204 return
never executed: return BN_BLINDING_invert_ex(n, ((void *)0) , b, ctx);
BN_BLINDING_invert_ex(n,
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-
209int 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 ==
r == ((void *)0)Description
TRUEevaluated 2381 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-2381
217 ((void *)0)
r == ((void *)0)Description
TRUEevaluated 2381 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-2381
218 && (
(r = b->Ai) == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2381 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
r = b->Ai) ==
(r = b->Ai) == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2381 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2381
219 ((void *)0)
(r = b->Ai) == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2381 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2381
220 ) {-
221 ERR_put_error(3,(101),(107),__FILE__,175);-
222 return
never executed: return 0;
0;
never executed: return 0;
0
223 }-
224-
225 if (b->m_ctx !=
b->m_ctx != ((void *)0)Description
TRUEevaluated 495 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1886 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
495-1886
226 ((void *)0)
b->m_ctx != ((void *)0)Description
TRUEevaluated 495 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1886 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
495-1886
227 ) {-
228-
229 if (n->dmax >= r->top
n->dmax >= r->topDescription
TRUEevaluated 495 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-495
230 size_t i, rtop = r->top, ntop = n->top;-
231 unsigned long mask;-
232-
233 for (i = 0; i < rtop
i < rtopDescription
TRUEevaluated 5961 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 495 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i++) {
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:
  • libcrypto.so.1.1
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:
  • libcrypto.so.1.1
495
242 ret = BN_mod_mul_montgomery(n, n, r, b->m_ctx, ctx);-
243 }
executed 495 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
495
244 ret = BN_mod_mul(n, n, r, b->mod, ctx);-
245 }
executed 1886 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1886
246-
247 ;-
248 return
executed 2381 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 2381 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
2381
249}-
250-
251int BN_BLINDING_is_current_thread(BN_BLINDING *b)-
252{-
253 return
executed 2381 times by 1 test: return CRYPTO_THREAD_compare_id(CRYPTO_THREAD_get_current_id(), b->tid);
Executed by:
  • libcrypto.so.1.1
CRYPTO_THREAD_compare_id(CRYPTO_THREAD_get_current_id(), b->tid);
executed 2381 times by 1 test: return CRYPTO_THREAD_compare_id(CRYPTO_THREAD_get_current_id(), b->tid);
Executed by:
  • libcrypto.so.1.1
2381
254}-
255-
256void 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:
  • libcrypto.so.1.1
3466
260-
261int BN_BLINDING_lock(BN_BLINDING *b)-
262{-
263 return
never executed: return CRYPTO_THREAD_write_lock(b->lock);
CRYPTO_THREAD_write_lock(b->lock);
never executed: return CRYPTO_THREAD_write_lock(b->lock);
0
264}-
265-
266int BN_BLINDING_unlock(BN_BLINDING *b)-
267{-
268 return
never executed: return CRYPTO_THREAD_unlock(b->lock);
CRYPTO_THREAD_unlock(b->lock);
never executed: return CRYPTO_THREAD_unlock(b->lock);
0
269}-
270-
271unsigned long BN_BLINDING_get_flags(const BN_BLINDING *b)-
272{-
273 return
never executed: return b->flags;
b->flags;
never executed: return b->flags;
0
274}-
275-
276void BN_BLINDING_set_flags(BN_BLINDING *b, unsigned long flags)-
277{-
278 b->flags = flags;-
279}
never executed: end of block
0
280-
281BN_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 ==
b == ((void *)0)Description
TRUEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
15-1733
297 ((void *)0)
b == ((void *)0)Description
TRUEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
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:
  • libcrypto.so.1.1
1733
300 ((void *)0)
executed 1733 times by 1 test: ret = BN_BLINDING_new( ((void *)0) , ((void *)0) , m);
Executed by:
  • libcrypto.so.1.1
1733
301 ,
executed 1733 times by 1 test: ret = BN_BLINDING_new( ((void *)0) , ((void *)0) , m);
Executed by:
  • libcrypto.so.1.1
1733
302 ((void *)0)
executed 1733 times by 1 test: ret = BN_BLINDING_new( ((void *)0) , ((void *)0) , m);
Executed by:
  • libcrypto.so.1.1
1733
303 , m);
executed 1733 times by 1 test: ret = BN_BLINDING_new( ((void *)0) , ((void *)0) , m);
Executed by:
  • libcrypto.so.1.1
1733
304 else-
305 ret = b;
executed 15 times by 1 test: ret = b;
Executed by:
  • libcrypto.so.1.1
15
306-
307 if (ret ==
ret == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1748 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1748
308 ((void *)0)
ret == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1748 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1748
309 )-
310 goto
never executed: goto err;
err;
never executed: goto err;
0
311-
312 if (ret->A ==
ret->A == ((void *)0)Description
TRUEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
15-1733
313 ((void *)0)
ret->A == ((void *)0)Description
TRUEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
15-1733
314 && (
(ret->A = BN_n...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ret->A = BN_new()) ==
(ret->A = BN_n...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1733
315 ((void *)0)
(ret->A = BN_n...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1733
316 )-
317 goto
never executed: goto err;
err;
never executed: goto err;
0
318 if (ret->Ai ==
ret->Ai == ((void *)0)Description
TRUEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
15-1733
319 ((void *)0)
ret->Ai == ((void *)0)Description
TRUEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
15-1733
320 && (
(ret->Ai = BN_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ret->Ai = BN_new()) ==
(ret->Ai = BN_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1733
321 ((void *)0)
(ret->Ai = BN_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1733
322 )-
323 goto
never executed: goto err;
err;
never executed: goto err;
0
324-
325 if (e !=
e != ((void *)0)Description
TRUEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
15-1733
326 ((void *)0)
e != ((void *)0)Description
TRUEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
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:
  • libcrypto.so.1.1
1733
331 if (ret->e ==
ret->e == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1748 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1748
332 ((void *)0)
ret->e == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1748 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1748
333 )-
334 goto
never executed: goto err;
err;
never executed: goto err;
0
335-
336 if (bn_mod_exp !=
bn_mod_exp != ((void *)0)Description
TRUEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
15-1733
337 ((void *)0)
bn_mod_exp != ((void *)0)Description
TRUEevaluated 1733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
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:
  • libcrypto.so.1.1
1733
340 if (m_ctx !=
m_ctx != ((void *)0)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1740 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
8-1740
341 ((void *)0)
m_ctx != ((void *)0)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1740 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
8-1740
342 )-
343 ret->m_ctx = m_ctx;
executed 8 times by 1 test: ret->m_ctx = m_ctx;
Executed by:
  • libcrypto.so.1.1
8
344-
345 do {-
346 int rv;-
347 if (!BN_priv_rand_range(ret->A, ret->mod)
!BN_priv_rand_...->A, ret->mod)Description
TRUEnever evaluated
FALSEevaluated 1748 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-1748
348 goto
never executed: goto err;
err;
never executed: goto err;
0
349 if (int_bn_mod_inverse(ret->Ai, ret->A, ret->mod, ctx, &rv)
int_bn_mod_inv...mod, ctx, &rv)Description
TRUEevaluated 1748 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-1748
350 break;
executed 1748 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
1748
351-
352-
353-
354-
355 if (!rv
!rvDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
356 goto
never executed: goto err;
err;
never executed: goto err;
0
357-
358 if (retry_counter-- == 0
retry_counter-- == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
359 ERR_put_error(3,(128),(113),__FILE__,285);-
360 goto
never executed: goto err;
err;
never executed: goto err;
0
361 }-
362 }
never executed: end of block
while (1);
0
363-
364 if (ret->bn_mod_exp !=
ret->bn_mod_exp != ((void *)0)Description
TRUEevaluated 1748 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1748
365 ((void *)0)
ret->bn_mod_exp != ((void *)0)Description
TRUEevaluated 1748 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1748
366 && ret->m_ctx !=
ret->m_ctx != ((void *)0)Description
TRUEevaluated 23 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1725 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
23-1725
367 ((void *)0)
ret->m_ctx != ((void *)0)Description
TRUEevaluated 23 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1725 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
23-1725
368 ) {-
369 if (!ret->bn_mod_exp(ret->A, ret->A, ret->e, ret->mod, ctx, ret->m_ctx)
!ret->bn_mod_e...x, ret->m_ctx)Description
TRUEnever evaluated
FALSEevaluated 23 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-23
370 goto
never executed: goto err;
err;
never executed: goto err;
0
371 }
executed 23 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
23
372 if (!BN_mod_exp(ret->A, ret->A, ret->e, ret->mod, ctx)
!BN_mod_exp(re...ret->mod, ctx)Description
TRUEnever evaluated
FALSEevaluated 1725 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-1725
373 goto
never executed: goto err;
err;
never executed: goto err;
0
374 }
executed 1725 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1725
375-
376 if (ret->m_ctx !=
ret->m_ctx != ((void *)0)Description
TRUEevaluated 23 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1725 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
23-1725
377 ((void *)0)
ret->m_ctx != ((void *)0)Description
TRUEevaluated 23 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1725 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
23-1725
378 ) {-
379 if (!bn_to_mont_fixed_top(ret->Ai, ret->Ai, ret->m_ctx, ctx)
!bn_to_mont_fi...t->m_ctx, ctx)Description
TRUEnever evaluated
FALSEevaluated 23 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-23
380 || !bn_to_mont_fixed_top(ret->A, ret->A, ret->m_ctx, ctx)
!bn_to_mont_fi...t->m_ctx, ctx)Description
TRUEnever evaluated
FALSEevaluated 23 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-23
381 goto
never executed: goto err;
err;
never executed: goto err;
0
382 }
executed 23 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
23
383-
384 return
executed 1748 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 1748 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
1748
385 err:-
386 if (b ==
b == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
387 ((void *)0)
b == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
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: return ret;
ret;
never executed: return ret;
0
396}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2