Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/bn/bn_kron.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||||||||
6 | int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) | - | ||||||||||||||||||||||||||||||
7 | { | - | ||||||||||||||||||||||||||||||
8 | int i; | - | ||||||||||||||||||||||||||||||
9 | int ret = -2; | - | ||||||||||||||||||||||||||||||
10 | int err = 0; | - | ||||||||||||||||||||||||||||||
11 | BIGNUM *A, *B, *tmp; | - | ||||||||||||||||||||||||||||||
12 | - | |||||||||||||||||||||||||||||||
13 | - | |||||||||||||||||||||||||||||||
14 | - | |||||||||||||||||||||||||||||||
15 | - | |||||||||||||||||||||||||||||||
16 | - | |||||||||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||||||||
18 | - | |||||||||||||||||||||||||||||||
19 | static const int tab[8] = { 0, 1, 0, -1, 0, -1, 0, 1 }; | - | ||||||||||||||||||||||||||||||
20 | - | |||||||||||||||||||||||||||||||
21 | ; | - | ||||||||||||||||||||||||||||||
22 | ; | - | ||||||||||||||||||||||||||||||
23 | - | |||||||||||||||||||||||||||||||
24 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||||||||
25 | A = BN_CTX_get(ctx); | - | ||||||||||||||||||||||||||||||
26 | B = BN_CTX_get(ctx); | - | ||||||||||||||||||||||||||||||
27 | if (B ==
| 0-21124 | ||||||||||||||||||||||||||||||
28 | ((void *)0)
| 0-21124 | ||||||||||||||||||||||||||||||
29 | ) | - | ||||||||||||||||||||||||||||||
30 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||
31 | - | |||||||||||||||||||||||||||||||
32 | err = !BN_copy(A, a); | - | ||||||||||||||||||||||||||||||
33 | if (err
| 0-21124 | ||||||||||||||||||||||||||||||
34 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||
35 | err = !BN_copy(B, b); | - | ||||||||||||||||||||||||||||||
36 | if (err
| 0-21124 | ||||||||||||||||||||||||||||||
37 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||
38 | if (BN_is_zero(B)
| 0-21124 | ||||||||||||||||||||||||||||||
39 | ret = BN_abs_is_word(A, 1); | - | ||||||||||||||||||||||||||||||
40 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||
41 | } | - | ||||||||||||||||||||||||||||||
42 | - | |||||||||||||||||||||||||||||||
43 | - | |||||||||||||||||||||||||||||||
44 | - | |||||||||||||||||||||||||||||||
45 | if (!BN_is_odd(A)
| 0-10723 | ||||||||||||||||||||||||||||||
46 | ret = 0; | - | ||||||||||||||||||||||||||||||
47 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||
48 | } | - | ||||||||||||||||||||||||||||||
49 | - | |||||||||||||||||||||||||||||||
50 | - | |||||||||||||||||||||||||||||||
51 | i = 0; | - | ||||||||||||||||||||||||||||||
52 | while (!BN_is_bit_set(B, i)
| 0-21124 | ||||||||||||||||||||||||||||||
53 | i++; never executed: i++; | 0 | ||||||||||||||||||||||||||||||
54 | err = !BN_rshift(B, B, i); | - | ||||||||||||||||||||||||||||||
55 | if (err
| 0-21124 | ||||||||||||||||||||||||||||||
56 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||
57 | if (i & 1
| 0-21124 | ||||||||||||||||||||||||||||||
58 | - | |||||||||||||||||||||||||||||||
59 | - | |||||||||||||||||||||||||||||||
60 | - | |||||||||||||||||||||||||||||||
61 | - | |||||||||||||||||||||||||||||||
62 | ret = tab[(((A)->top == 0) ? (unsigned long) 0 : (A)->d[0]) & 7]; | - | ||||||||||||||||||||||||||||||
63 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
64 | - | |||||||||||||||||||||||||||||||
65 | ret = 1; | - | ||||||||||||||||||||||||||||||
66 | } executed 21124 times by 1 test: end of block Executed by:
| 21124 | ||||||||||||||||||||||||||||||
67 | - | |||||||||||||||||||||||||||||||
68 | if (B->neg
| 100-21024 | ||||||||||||||||||||||||||||||
69 | B->neg = 0; | - | ||||||||||||||||||||||||||||||
70 | if (A->neg
| 50 | ||||||||||||||||||||||||||||||
71 | ret = -ret; executed 50 times by 1 test: ret = -ret; Executed by:
| 50 | ||||||||||||||||||||||||||||||
72 | } executed 100 times by 1 test: end of block Executed by:
| 100 | ||||||||||||||||||||||||||||||
73 | - | |||||||||||||||||||||||||||||||
74 | - | |||||||||||||||||||||||||||||||
75 | - | |||||||||||||||||||||||||||||||
76 | - | |||||||||||||||||||||||||||||||
77 | - | |||||||||||||||||||||||||||||||
78 | - | |||||||||||||||||||||||||||||||
79 | while (1) { | - | ||||||||||||||||||||||||||||||
80 | - | |||||||||||||||||||||||||||||||
81 | - | |||||||||||||||||||||||||||||||
82 | - | |||||||||||||||||||||||||||||||
83 | - | |||||||||||||||||||||||||||||||
84 | if (BN_is_zero(A)
| 21124-101152 | ||||||||||||||||||||||||||||||
85 | ret = BN_is_one(B)
| 5-21119 | ||||||||||||||||||||||||||||||
86 | goto executed 21124 times by 1 test: end;goto end; Executed by:
executed 21124 times by 1 test: goto end; Executed by:
| 21124 | ||||||||||||||||||||||||||||||
87 | } | - | ||||||||||||||||||||||||||||||
88 | - | |||||||||||||||||||||||||||||||
89 | - | |||||||||||||||||||||||||||||||
90 | i = 0; | - | ||||||||||||||||||||||||||||||
91 | while (!BN_is_bit_set(A, i)
| 100720-101152 | ||||||||||||||||||||||||||||||
92 | i++; executed 100720 times by 1 test: i++; Executed by:
| 100720 | ||||||||||||||||||||||||||||||
93 | err = !BN_rshift(A, A, i); | - | ||||||||||||||||||||||||||||||
94 | if (err
| 0-101152 | ||||||||||||||||||||||||||||||
95 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||
96 | if (i & 1
| 33446-67706 | ||||||||||||||||||||||||||||||
97 | - | |||||||||||||||||||||||||||||||
98 | - | |||||||||||||||||||||||||||||||
99 | ret = ret * tab[(((B)->top == 0) ? (unsigned long) 0 : (B)->d[0]) & 7]; | - | ||||||||||||||||||||||||||||||
100 | } executed 33446 times by 1 test: end of block Executed by:
| 33446 | ||||||||||||||||||||||||||||||
101 | - | |||||||||||||||||||||||||||||||
102 | - | |||||||||||||||||||||||||||||||
103 | - | |||||||||||||||||||||||||||||||
104 | if ((
| 0-101102 | ||||||||||||||||||||||||||||||
105 | ret = -ret; executed 16549 times by 1 test: ret = -ret; Executed by:
| 16549 | ||||||||||||||||||||||||||||||
106 | - | |||||||||||||||||||||||||||||||
107 | - | |||||||||||||||||||||||||||||||
108 | err = !BN_nnmod(B, B, A, ctx); | - | ||||||||||||||||||||||||||||||
109 | if (err
| 0-101152 | ||||||||||||||||||||||||||||||
110 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||
111 | tmp = A; | - | ||||||||||||||||||||||||||||||
112 | A = B; | - | ||||||||||||||||||||||||||||||
113 | B = tmp; | - | ||||||||||||||||||||||||||||||
114 | tmp->neg = 0; | - | ||||||||||||||||||||||||||||||
115 | } executed 101152 times by 1 test: end of block Executed by:
| 101152 | ||||||||||||||||||||||||||||||
116 | end: code before this statement never executed: end: | 0 | ||||||||||||||||||||||||||||||
117 | BN_CTX_end(ctx); | - | ||||||||||||||||||||||||||||||
118 | if (err
| 0-21124 | ||||||||||||||||||||||||||||||
119 | return never executed: -2;return -2; never executed: return -2; | 0 | ||||||||||||||||||||||||||||||
120 | else | - | ||||||||||||||||||||||||||||||
121 | return executed 21124 times by 1 test: ret;return ret; Executed by:
executed 21124 times by 1 test: return ret; Executed by:
| 21124 | ||||||||||||||||||||||||||||||
122 | } | - | ||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |