OpenCoverage

bn_print.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/bn/bn_print.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3static const char Hex[] = "0123456789ABCDEF";-
4-
5-
6char *BN_bn2hex(const BIGNUM *a)-
7{-
8 int i, j, v, z = 0;-
9 char *buf;-
10 char *p;-
11-
12 if (BN_is_zero(a)
BN_is_zero(a)Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1728 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
5-1728
13 return
executed 5 times by 1 test: return CRYPTO_strdup("0", __FILE__, 27);
Executed by:
  • libcrypto.so.1.1
CRYPTO_strdup("0", __FILE__, 27);
executed 5 times by 1 test: return CRYPTO_strdup("0", __FILE__, 27);
Executed by:
  • libcrypto.so.1.1
5
14 buf = CRYPTO_malloc(a->top * 8 * 2 + 2, __FILE__, 28);-
15 if (buf ==
buf == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1728 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1728
16 ((void *)0)
buf == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1728 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1728
17 ) {-
18 ERR_put_error(3,(105),((1|64)),__FILE__,30);-
19 goto
never executed: goto err;
err;
never executed: goto err;
0
20 }-
21 p = buf;-
22 if (a->neg
a->negDescription
TRUEevaluated 733 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 995 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
733-995
23 *
executed 733 times by 1 test: *p++ = '-';
Executed by:
  • libcrypto.so.1.1
p++ = '-';
executed 733 times by 1 test: *p++ = '-';
Executed by:
  • libcrypto.so.1.1
733
24 for (i = a->top - 1; i >= 0
i >= 0Description
TRUEevaluated 7472 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1728 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i--) {
1728-7472
25 for (j = (8 * 8) - 8; j >= 0
j >= 0Description
TRUEevaluated 59776 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 7472 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; j -= 8) {
7472-59776
26-
27 v = (int)((a->d[i] >> j) & 0xff);-
28 if (z
zDescription
TRUEevaluated 47804 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 11972 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| v != 0
v != 0Description
TRUEevaluated 1728 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 10244 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1728-47804
29 *p++ = Hex[v >> 4];-
30 *p++ = Hex[v & 0x0f];-
31 z = 1;-
32 }
executed 49532 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
49532
33 }
executed 59776 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
59776
34 }
executed 7472 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
7472
35 *p = '\0';-
36 err:
code before this statement executed 1728 times by 1 test: err:
Executed by:
  • libcrypto.so.1.1
1728
37 return
executed 1728 times by 1 test: return buf;
Executed by:
  • libcrypto.so.1.1
buf;
executed 1728 times by 1 test: return buf;
Executed by:
  • libcrypto.so.1.1
1728
38}-
39-
40-
41char *BN_bn2dec(const BIGNUM *a)-
42{-
43 int i = 0, num, ok = 0, n, tbytes;-
44 char *buf = -
45 ((void *)0)-
46 ;-
47 char *p;-
48 BIGNUM *t = -
49 ((void *)0)-
50 ;-
51 unsigned long *bn_data = -
52 ((void *)0)-
53 , *lp;-
54 int bn_data_num;-
55-
56-
57-
58-
59-
60-
61-
62 i = BN_num_bits(a) * 3;-
63 num = (i / 10 + i / 1000 + 1) + 1;-
64 tbytes = num + 3;-
65 bn_data_num = num / 19 + 1;-
66 bn_data = CRYPTO_malloc(bn_data_num * sizeof(unsigned long), __FILE__, 72);-
67 buf = CRYPTO_malloc(tbytes, __FILE__, 73);-
68 if (buf ==
buf == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 18302 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-18302
69 ((void *)0)
buf == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 18302 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-18302
70 || bn_data ==
bn_data == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 18302 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-18302
71 ((void *)0)
bn_data == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 18302 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-18302
72 ) {-
73 ERR_put_error(3,(104),((1|64)),__FILE__,75);-
74 goto
never executed: goto err;
err;
never executed: goto err;
0
75 }-
76 if ((
(t = BN_dup(a)) == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 18302 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
t = BN_dup(a)) ==
(t = BN_dup(a)) == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 18302 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-18302
77 ((void *)0)
(t = BN_dup(a)) == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 18302 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-18302
78 )-
79 goto
never executed: goto err;
err;
never executed: goto err;
0
80-
81 p = buf;-
82 lp = bn_data;-
83 if (BN_is_zero(t)
BN_is_zero(t)Description
TRUEevaluated 1160 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 17142 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1160-17142
84 *p++ = '0';-
85 *p++ = '\0';-
86 }
executed 1160 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
1160
87 if (BN_is_negative(t)
BN_is_negative(t)Description
TRUEevaluated 1906 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 15236 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
1906-15236
88 *
executed 1906 times by 1 test: *p++ = '-';
Executed by:
  • libcrypto.so.1.1
p++ = '-';
executed 1906 times by 1 test: *p++ = '-';
Executed by:
  • libcrypto.so.1.1
1906
89-
90 while (!BN_is_zero(t)
!BN_is_zero(t)Description
TRUEevaluated 35612 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 17142 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
17142-35612
91 if (lp - bn_data >= bn_data_num
lp - bn_data >= bn_data_numDescription
TRUEnever evaluated
FALSEevaluated 35612 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-35612
92 goto
never executed: goto err;
err;
never executed: goto err;
0
93 *lp = BN_div_word(t, (10000000000000000000UL));-
94 if (*
*lp == (unsigned long)-1Description
TRUEnever evaluated
FALSEevaluated 35612 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
lp == (unsigned long)-1
*lp == (unsigned long)-1Description
TRUEnever evaluated
FALSEevaluated 35612 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-35612
95 goto
never executed: goto err;
err;
never executed: goto err;
0
96 lp++;-
97 }
executed 35612 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
35612
98 lp--;-
99-
100-
101-
102-
103-
104 n = BIO_snprintf(p, tbytes - (size_t)(p - buf), "%lu", *lp);-
105 if (n < 0
n < 0Description
TRUEnever evaluated
FALSEevaluated 17142 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-17142
106 goto
never executed: goto err;
err;
never executed: goto err;
0
107 p += n;-
108 while (lp != bn_data
lp != bn_dataDescription
TRUEevaluated 18470 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 17142 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
17142-18470
109 lp--;-
110 n = BIO_snprintf(p, tbytes - (size_t)(p - buf), "%019lu", *lp);-
111 if (n < 0
n < 0Description
TRUEnever evaluated
FALSEevaluated 18470 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-18470
112 goto
never executed: goto err;
err;
never executed: goto err;
0
113 p += n;-
114 }
executed 18470 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
18470
115 }
executed 17142 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
17142
116 ok = 1;-
117 err:
code before this statement executed 18302 times by 1 test: err:
Executed by:
  • libcrypto.so.1.1
18302
118 CRYPTO_free(bn_data, __FILE__, 118);-
119 BN_free(t);-
120 if (ok
okDescription
TRUEevaluated 18302 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-18302
121 return
executed 18302 times by 1 test: return buf;
Executed by:
  • libcrypto.so.1.1
buf;
executed 18302 times by 1 test: return buf;
Executed by:
  • libcrypto.so.1.1
18302
122 CRYPTO_free(buf, __FILE__, 122);-
123 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
124 ((void *)0)
never executed: return ((void *)0) ;
0
125 ;
never executed: return ((void *)0) ;
0
126}-
127-
128int BN_hex2bn(BIGNUM **bn, const char *a)-
129{-
130 BIGNUM *ret = -
131 ((void *)0)-
132 ;-
133 unsigned long l = 0;-
134 int neg = 0, h, m, i, j, k, c;-
135 int num;-
136-
137 if (a ==
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8393 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-8393
138 ((void *)0)
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8393 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-8393
139 || *
*a == '\0'Description
TRUEnever evaluated
FALSEevaluated 8393 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
a == '\0'
*a == '\0'Description
TRUEnever evaluated
FALSEevaluated 8393 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-8393
140 return
never executed: return 0;
0;
never executed: return 0;
0
141-
142 if (*
*a == '-'Description
TRUEevaluated 1796 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6597 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
a == '-'
*a == '-'Description
TRUEevaluated 1796 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6597 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
1796-6597
143 neg = 1;-
144 a++;-
145 }
executed 1796 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1796
146-
147 for (i = 0; i <= 0x7fffffff / 4
i <= 0x7fffffff / 4Description
TRUEevaluated 803016 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
&& (
(ossl_ctype_ch...(a[i]), 0x10))Description
TRUEevaluated 794623 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 8393 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
ossl_ctype_check((a[i]), 0x10))
(ossl_ctype_ch...(a[i]), 0x10))Description
TRUEevaluated 794623 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 8393 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
; i++)
0-803016
148 continue;
executed 794623 times by 2 tests: continue;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
794623
149-
150 if (i == 0
i == 0Description
TRUEnever evaluated
FALSEevaluated 8393 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
|| i > 0x7fffffff / 4
i > 0x7fffffff / 4Description
TRUEnever evaluated
FALSEevaluated 8393 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-8393
151 goto
never executed: goto err;
err;
never executed: goto err;
0
152-
153 num = i + neg;-
154 if (bn ==
bn == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8393 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-8393
155 ((void *)0)
bn == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8393 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-8393
156 )-
157 return
never executed: return num;
num;
never executed: return num;
0
158-
159-
160 if (*
*bn == ((void *)0)Description
TRUEevaluated 8181 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 212 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
bn ==
*bn == ((void *)0)Description
TRUEevaluated 8181 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 212 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
212-8181
161 ((void *)0)
*bn == ((void *)0)Description
TRUEevaluated 8181 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 212 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
212-8181
162 ) {-
163 if ((
(ret = BN_new(...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8181 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
ret = BN_new()) ==
(ret = BN_new(...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8181 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-8181
164 ((void *)0)
(ret = BN_new(...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8181 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-8181
165 )-
166 return
never executed: return 0;
0;
never executed: return 0;
0
167 }
executed 8181 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
else {
8181
168 ret = *bn;-
169 (BN_set_word((ret),0));-
170 }
executed 212 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
212
171-
172-
173 if (bn_expand(ret, i * 4) ==
bn_expand(ret,...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8393 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-8393
174 ((void *)0)
bn_expand(ret,...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8393 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-8393
175 )-
176 goto
never executed: goto err;
err;
never executed: goto err;
0
177-
178 j = i;-
179 m = 0;-
180 h = 0;-
181 while (j > 0
j > 0Description
TRUEevaluated 53559 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 8393 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
8393-53559
182 m = (
(8 * 2 <= j)Description
TRUEevaluated 47141 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 6418 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
8 * 2 <= j)
(8 * 2 <= j)Description
TRUEevaluated 47141 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 6418 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
? 8 * 2 : j;
6418-47141
183 l = 0;-
184 for (;;) {-
185 c = a[j - m];-
186 k = OPENSSL_hexchar2int(c);-
187 if (k < 0
k < 0Description
TRUEnever evaluated
FALSEevaluated 794623 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-794623
188 k = 0;
never executed: k = 0;
0
189 l = (l << 4) | k;-
190-
191 if (--
--m <= 0Description
TRUEevaluated 53559 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 741064 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
m <= 0
--m <= 0Description
TRUEevaluated 53559 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 741064 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
53559-741064
192 ret->d[h++] = l;-
193 break;
executed 53559 times by 2 tests: break;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
53559
194 }-
195 }
executed 741064 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
741064
196 j -= 8 * 2;-
197 }
executed 53559 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
53559
198 ret->top = h;-
199 bn_correct_top(ret);-
200-
201 *bn = ret;-
202 ;-
203-
204 if (ret->top != 0
ret->top != 0Description
TRUEevaluated 8282 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 111 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
111-8282
205 ret->neg = neg;
executed 8282 times by 2 tests: ret->neg = neg;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
8282
206 return
executed 8393 times by 2 tests: return num;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
num;
executed 8393 times by 2 tests: return num;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
8393
207 err:-
208 if (*
*bn == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
bn ==
*bn == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
209 ((void *)0)
*bn == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
210 )-
211 BN_free(ret);
never executed: BN_free(ret);
0
212 return
never executed: return 0;
0;
never executed: return 0;
0
213}-
214-
215int BN_dec2bn(BIGNUM **bn, const char *a)-
216{-
217 BIGNUM *ret = -
218 ((void *)0)-
219 ;-
220 unsigned long l = 0;-
221 int neg = 0, i, j;-
222 int num;-
223-
224 if (a ==
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-44
225 ((void *)0)
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-44
226 || *
*a == '\0'Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
a == '\0'
*a == '\0'Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-44
227 return
never executed: return 0;
0;
never executed: return 0;
0
228 if (*
*a == '-'Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 41 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
a == '-'
*a == '-'Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 41 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
3-41
229 neg = 1;-
230 a++;-
231 }
executed 3 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
3
232-
233 for (i = 0; i <= 0x7fffffff / 4
i <= 0x7fffffff / 4Description
TRUEevaluated 1130 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
&& (
(ossl_ctype_ch...((a[i]), 0x4))Description
TRUEevaluated 1086 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 44 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ossl_ctype_check((a[i]), 0x4))
(ossl_ctype_ch...((a[i]), 0x4))Description
TRUEevaluated 1086 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 44 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i++)
0-1130
234 continue;
executed 1086 times by 1 test: continue;
Executed by:
  • libcrypto.so.1.1
1086
235-
236 if (i == 0
i == 0Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| i > 0x7fffffff / 4
i > 0x7fffffff / 4Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-44
237 goto
never executed: goto err;
err;
never executed: goto err;
0
238-
239 num = i + neg;-
240 if (bn ==
bn == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-44
241 ((void *)0)
bn == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-44
242 )-
243 return
never executed: return num;
num;
never executed: return num;
0
244-
245-
246-
247-
248-
249 if (*
*bn == ((void *)0)Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 35 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
bn ==
*bn == ((void *)0)Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 35 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
9-35
250 ((void *)0)
*bn == ((void *)0)Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 35 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
9-35
251 ) {-
252 if ((
(ret = BN_new(...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ret = BN_new()) ==
(ret = BN_new(...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9
253 ((void *)0)
(ret = BN_new(...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9
254 )-
255 return
never executed: return 0;
0;
never executed: return 0;
0
256 }
executed 9 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
9
257 ret = *bn;-
258 (BN_set_word((ret),0));-
259 }
executed 35 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
35
260-
261-
262 if (bn_expand(ret, i * 4) ==
bn_expand(ret,...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-44
263 ((void *)0)
bn_expand(ret,...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-44
264 )-
265 goto
never executed: goto err;
err;
never executed: goto err;
0
266-
267 j = 19 - i % 19;-
268 if (j == 19
j == 19Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 42 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
2-42
269 j = 0;
executed 2 times by 1 test: j = 0;
Executed by:
  • libcrypto.so.1.1
2
270 l = 0;-
271 while (--
--i >= 0Description
TRUEevaluated 1086 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 44 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
i >= 0
--i >= 0Description
TRUEevaluated 1086 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 44 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
44-1086
272 l *= 10;-
273 l += *a - '0';-
274 a++;-
275 if (++
++j == 19Description
TRUEevaluated 89 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 997 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
j == 19
++j == 19Description
TRUEevaluated 89 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 997 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
89-997
276 if (!BN_mul_word(ret, (10000000000000000000UL))
!BN_mul_word(r...0000000000UL))Description
TRUEnever evaluated
FALSEevaluated 89 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-89
277 || !BN_add_word(ret, l)
!BN_add_word(ret, l)Description
TRUEnever evaluated
FALSEevaluated 89 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-89
278 goto
never executed: goto err;
err;
never executed: goto err;
0
279 l = 0;-
280 j = 0;-
281 }
executed 89 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
89
282 }
executed 1086 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1086
283-
284 bn_correct_top(ret);-
285 *bn = ret;-
286 ;-
287-
288 if (ret->top != 0
ret->top != 0Description
TRUEevaluated 36 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
8-36
289 ret->neg = neg;
executed 36 times by 1 test: ret->neg = neg;
Executed by:
  • libcrypto.so.1.1
36
290 return
executed 44 times by 1 test: return num;
Executed by:
  • libcrypto.so.1.1
num;
executed 44 times by 1 test: return num;
Executed by:
  • libcrypto.so.1.1
44
291 err:-
292 if (*
*bn == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
bn ==
*bn == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
293 ((void *)0)
*bn == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
294 )-
295 BN_free(ret);
never executed: BN_free(ret);
0
296 return
never executed: return 0;
0;
never executed: return 0;
0
297}-
298-
299int BN_asc2bn(BIGNUM **bn, const char *a)-
300{-
301 const char *p = a;-
302-
303 if (*
*p == '-'Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
p == '-'
*p == '-'Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
5-9
304 p++;
executed 5 times by 1 test: p++;
Executed by:
  • libcrypto.so.1.1
5
305-
306 if (p[0] == '0'
p[0] == '0'Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& (p[1] == 'X'
p[1] == 'X'Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| p[1] == 'x'
p[1] == 'x'Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)) {
1-8
307 if (!BN_hex2bn(bn, p + 2)
!BN_hex2bn(bn, p + 2)Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-3
308 return
never executed: return 0;
0;
never executed: return 0;
0
309 }
executed 3 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
3
310 if (!BN_dec2bn(bn, p)
!BN_dec2bn(bn, p)Description
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-11
311 return
never executed: return 0;
0;
never executed: return 0;
0
312 }
executed 11 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
11
313-
314 if (*
*a == '-'Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
a == '-'
*a == '-'Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& (*
(*bn)->top != 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
bn)->top != 0
(*bn)->top != 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
1-9
315 (*
executed 4 times by 1 test: (*bn)->neg = 1;
Executed by:
  • libcrypto.so.1.1
bn)->neg = 1;
executed 4 times by 1 test: (*bn)->neg = 1;
Executed by:
  • libcrypto.so.1.1
4
316 return
executed 14 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 14 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
14
317}-
318-
319-
320int BN_print_fp(FILE *fp, const BIGNUM *a)-
321{-
322 BIO *b;-
323 int ret;-
324-
325 if ((
(b = BIO_new(B...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
b = BIO_new(BIO_s_file())) ==
(b = BIO_new(B...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
326 ((void *)0)
(b = BIO_new(B...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
327 )-
328 return
never executed: return 0;
0;
never executed: return 0;
0
329 BIO_ctrl(b,106,0x00,(char *)(fp));-
330 ret = BN_print(b, a);-
331 BIO_free(b);-
332 return
never executed: return ret;
ret;
never executed: return ret;
0
333}-
334-
335-
336int BN_print(BIO *bp, const BIGNUM *a)-
337{-
338 int i, j, v, z = 0;-
339 int ret = 0;-
340-
341 if ((
(a->neg)Description
TRUEnever evaluated
FALSEevaluated 11205 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
a->neg)
(a->neg)Description
TRUEnever evaluated
FALSEevaluated 11205 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& BIO_write(bp, "-", 1) != 1
BIO_write(bp, "-", 1) != 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0-11205
342 goto
never executed: goto end;
end;
never executed: goto end;
0
343 if (BN_is_zero(a)
BN_is_zero(a)Description
TRUEevaluated 331 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 10874 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& BIO_write(bp, "0", 1) != 1
BIO_write(bp, "0", 1) != 1Description
TRUEnever evaluated
FALSEevaluated 331 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-10874
344 goto
never executed: goto end;
end;
never executed: goto end;
0
345 for (i = a->top - 1; i >= 0
i >= 0Description
TRUEevaluated 30388 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 11205 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i--) {
11205-30388
346 for (j = (8 * 8) - 4; j >= 0
j >= 0Description
TRUEevaluated 486208 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 30388 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; j -= 4) {
30388-486208
347-
348 v = (int)((a->d[i] >> j) & 0x0f);-
349 if (z
zDescription
TRUEevaluated 346049 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 140159 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| v != 0
v != 0Description
TRUEevaluated 10874 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 129285 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
10874-346049
350 if (BIO_write(bp, &Hex[v], 1) != 1
BIO_write(bp, &Hex[v], 1) != 1Description
TRUEnever evaluated
FALSEevaluated 356923 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-356923
351 goto
never executed: goto end;
end;
never executed: goto end;
0
352 z = 1;-
353 }
executed 356923 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
356923
354 }
executed 486208 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
486208
355 }
executed 30388 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
30388
356 ret = 1;-
357 end:
code before this statement executed 11205 times by 1 test: end:
Executed by:
  • libcrypto.so.1.1
11205
358 return
executed 11205 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 11205 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
11205
359}-
360-
361char *BN_options(void)-
362{-
363 static int init = 0;-
364 static char data[16];-
365-
366 if (!init
!initDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
367 init++;-
368-
369-
370-
371-
372 BIO_snprintf(data, sizeof(data), "bn(%zu,%zu)",-
373 sizeof(unsigned long) * 8, sizeof(unsigned long) * 8);-
374-
375 }
never executed: end of block
0
376 return
never executed: return data;
data;
never executed: return data;
0
377}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2