Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | int | - |
7 | BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) | - |
8 | { | - |
9 | int i; | - |
10 | int ret = -2; | - |
11 | int err = 0; | - |
12 | BIGNUM *A, *B, *tmp; | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | static const int tab[8] = {0, 1, 0, -1, 0, -1, 0, 1}; | - |
21 | | - |
22 | ; | - |
23 | ; | - |
24 | | - |
25 | BN_CTX_start(ctx); | - |
26 | if ((TRUE | never evaluated | FALSE | evaluated 140 times by 2 tests |
A = BN_CTX_get(ctx)) == TRUE | never evaluated | FALSE | evaluated 140 times by 2 tests |
| 0-140 |
27 | ((void *)0)TRUE | never evaluated | FALSE | evaluated 140 times by 2 tests |
| 0-140 |
28 | ) | - |
29 | goto never executed: goto end; end;never executed: goto end; | 0 |
30 | if ((TRUE | never evaluated | FALSE | evaluated 140 times by 2 tests |
B = BN_CTX_get(ctx)) == TRUE | never evaluated | FALSE | evaluated 140 times by 2 tests |
| 0-140 |
31 | ((void *)0)TRUE | never evaluated | FALSE | evaluated 140 times by 2 tests |
| 0-140 |
32 | ) | - |
33 | goto never executed: goto end; end;never executed: goto end; | 0 |
34 | | - |
35 | err = !BN_copy(A, a); | - |
36 | if (errTRUE | never evaluated | FALSE | evaluated 140 times by 2 tests |
) | 0-140 |
37 | goto never executed: goto end; end;never executed: goto end; | 0 |
38 | err = !BN_copy(B, b); | - |
39 | if (errTRUE | never evaluated | FALSE | evaluated 140 times by 2 tests |
) | 0-140 |
40 | goto never executed: goto end; end;never executed: goto end; | 0 |
41 | if (((TRUE | never evaluated | FALSE | evaluated 140 times by 2 tests |
B)->top == 0)TRUE | never evaluated | FALSE | evaluated 140 times by 2 tests |
) { | 0-140 |
42 | ret = ((((TRUE | never evaluated | FALSE | never evaluated |
A)->top == 1)TRUE | never evaluated | FALSE | never evaluated |
&& ((TRUE | never evaluated | FALSE | never evaluated |
A)->d[0] == (unsigned long)(1))TRUE | never evaluated | FALSE | never evaluated |
) || (((TRUE | never evaluated | FALSE | never evaluated |
1) == 0)TRUE | never evaluated | FALSE | never evaluated |
&& ((TRUE | never evaluated | FALSE | never evaluated |
A)->top == 0)TRUE | never evaluated | FALSE | never evaluated |
)); | 0 |
43 | goto never executed: goto end; end;never executed: goto end; | 0 |
44 | } | - |
45 | | - |
46 | | - |
47 | | - |
48 | if (!(((TRUE | evaluated 140 times by 2 tests | FALSE | never evaluated |
A)->top > 0)TRUE | evaluated 140 times by 2 tests | FALSE | never evaluated |
&& ((TRUE | evaluated 69 times by 2 tests | FALSE | evaluated 71 times by 2 tests |
A)->d[0] & 1)TRUE | evaluated 69 times by 2 tests | FALSE | evaluated 71 times by 2 tests |
) && !(((TRUE | evaluated 71 times by 2 tests | FALSE | never evaluated |
B)->top > 0)TRUE | evaluated 71 times by 2 tests | FALSE | never evaluated |
&& ((TRUE | evaluated 71 times by 2 tests | FALSE | never evaluated |
B)->d[0] & 1)TRUE | evaluated 71 times by 2 tests | FALSE | never evaluated |
)) { | 0-140 |
49 | ret = 0; | - |
50 | goto never executed: goto end; end;never executed: goto end; | 0 |
51 | } | - |
52 | | - |
53 | | - |
54 | i = 0; | - |
55 | while (!BN_is_bit_set(B, i)TRUE | never evaluated | FALSE | evaluated 140 times by 2 tests |
) | 0-140 |
56 | i++; never executed: i++; | 0 |
57 | err = !BN_rshift(B, B, i); | - |
58 | if (errTRUE | never evaluated | FALSE | evaluated 140 times by 2 tests |
) | 0-140 |
59 | goto never executed: goto end; end;never executed: goto end; | 0 |
60 | if (i & 1TRUE | never evaluated | FALSE | evaluated 140 times by 2 tests |
) { | 0-140 |
61 | | - |
62 | | - |
63 | | - |
64 | | - |
65 | ret = tab[(((A)->top == 0) ? (unsigned long) 0 : (A)->d[0]) & 7]; | - |
66 | } never executed: end of block else { | 0 |
67 | | - |
68 | ret = 1; | - |
69 | }executed 140 times by 2 tests: end of block | 140 |
70 | | - |
71 | if (B->negTRUE | evaluated 100 times by 1 test | FALSE | evaluated 40 times by 2 tests |
) { | 40-100 |
72 | B->neg = 0; | - |
73 | if (A->negTRUE | evaluated 50 times by 1 test | FALSE | evaluated 50 times by 1 test |
) | 50 |
74 | ret = -ret;executed 50 times by 1 test: ret = -ret; | 50 |
75 | }executed 100 times by 1 test: end of block | 100 |
76 | | - |
77 | | - |
78 | | - |
79 | | - |
80 | while (1) { | - |
81 | | - |
82 | | - |
83 | | - |
84 | | - |
85 | if (((TRUE | evaluated 140 times by 2 tests | FALSE | evaluated 18638 times by 2 tests |
A)->top == 0)TRUE | evaluated 140 times by 2 tests | FALSE | evaluated 18638 times by 2 tests |
) { | 140-18638 |
86 | ret = ((((((TRUE | evaluated 140 times by 2 tests | FALSE | never evaluated |
B))->top == 1)TRUE | evaluated 140 times by 2 tests | FALSE | never evaluated |
&& (((TRUE | evaluated 140 times by 2 tests | FALSE | never evaluated |
B))->d[0] == (unsigned long)(1))TRUE | evaluated 140 times by 2 tests | FALSE | never evaluated |
) || (((TRUE | never evaluated | FALSE | never evaluated |
1) == 0)TRUE | never evaluated | FALSE | never evaluated |
&& (((TRUE | never evaluated | FALSE | never evaluated |
B))->top == 0)TRUE | never evaluated | FALSE | never evaluated |
)) && !(B)->negTRUE | evaluated 140 times by 2 tests | FALSE | never evaluated |
) ? ret : 0; | 0-140 |
87 | gotoexecuted 140 times by 2 tests: goto end; end;executed 140 times by 2 tests: goto end; | 140 |
88 | } | - |
89 | | - |
90 | | - |
91 | i = 0; | - |
92 | while (!BN_is_bit_set(A, i)TRUE | evaluated 21111 times by 2 tests | FALSE | evaluated 18638 times by 2 tests |
) | 18638-21111 |
93 | i++;executed 21111 times by 2 tests: i++; | 21111 |
94 | err = !BN_rshift(A, A, i); | - |
95 | if (errTRUE | never evaluated | FALSE | evaluated 18638 times by 2 tests |
) | 0-18638 |
96 | goto never executed: goto end; end;never executed: goto end; | 0 |
97 | if (i & 1TRUE | evaluated 6769 times by 2 tests | FALSE | evaluated 11869 times by 2 tests |
) { | 6769-11869 |
98 | | - |
99 | | - |
100 | ret = ret * tab[(((B)->top == 0) ? (unsigned long) 0 : (B)->d[0]) & 7]; | - |
101 | }executed 6769 times by 2 tests: end of block | 6769 |
102 | | - |
103 | | - |
104 | | - |
105 | if ((TRUE | evaluated 4646 times by 1 test | FALSE | evaluated 13992 times by 2 tests |
A->negTRUE | evaluated 50 times by 1 test | FALSE | evaluated 18588 times by 2 tests |
? ~(((A)->top == 0) ? (unsigned long) 0 : (A)->d[0]) : (((TRUE | never evaluated | FALSE | evaluated 18588 times by 2 tests |
A)->top == 0)TRUE | never evaluated | FALSE | evaluated 18588 times by 2 tests |
? (unsigned long) 0 : (A)->d[0])) & (((B)->top == 0) ? (unsigned long) 0 : (B)->d[0]) & 2TRUE | evaluated 4646 times by 1 test | FALSE | evaluated 13992 times by 2 tests |
) | 0-18588 |
106 | ret = -ret;executed 4646 times by 1 test: ret = -ret; | 4646 |
107 | | - |
108 | | - |
109 | err = !BN_nnmod(B, B, A, ctx); | - |
110 | if (errTRUE | never evaluated | FALSE | evaluated 18638 times by 2 tests |
) | 0-18638 |
111 | goto never executed: goto end; end;never executed: goto end; | 0 |
112 | tmp = A; | - |
113 | A = B; | - |
114 | B = tmp; | - |
115 | tmp->neg = 0; | - |
116 | }executed 18638 times by 2 tests: end of block | 18638 |
117 | | - |
118 | end: code before this statement never executed: end: | 0 |
119 | BN_CTX_end(ctx); | - |
120 | if (errTRUE | never evaluated | FALSE | evaluated 140 times by 2 tests |
) | 0-140 |
121 | return never executed: return -2; -2;never executed: return -2; | 0 |
122 | else | - |
123 | returnexecuted 140 times by 2 tests: return ret; ret;executed 140 times by 2 tests: return ret; | 140 |
124 | } | - |
| | |