| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/bn/bn_mul.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | unsigned long bn_sub_part_words(unsigned long *r, | - | ||||||||||||||||||||||||
| 2 | const unsigned long *a, const unsigned long *b, | - | ||||||||||||||||||||||||
| 3 | int cl, int dl) | - | ||||||||||||||||||||||||
| 4 | { | - | ||||||||||||||||||||||||
| 5 | unsigned long c, t; | - | ||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | ((void) (0)) | - | ||||||||||||||||||||||||
| 9 | ; | - | ||||||||||||||||||||||||
| 10 | c = bn_sub_words(r, a, b, cl); | - | ||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | if (dl == 0
| 78753-565727 | ||||||||||||||||||||||||
| 13 | return executed 565727 times by 1 test: c;return c;Executed by:
executed 565727 times by 1 test: return c;Executed by:
| 565727 | ||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||
| 15 | r += cl; | - | ||||||||||||||||||||||||
| 16 | a += cl; | - | ||||||||||||||||||||||||
| 17 | b += cl; | - | ||||||||||||||||||||||||
| 18 | - | |||||||||||||||||||||||||
| 19 | if (dl < 0
| 9582-69171 | ||||||||||||||||||||||||
| 20 | for (;;) { | - | ||||||||||||||||||||||||
| 21 | t = b[0]; | - | ||||||||||||||||||||||||
| 22 | r[0] = (0 - t - c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||
| 23 | if (t != 0
| 0-28644 | ||||||||||||||||||||||||
| 24 | c = 1; never executed: c = 1; | 0 | ||||||||||||||||||||||||
| 25 | if (++
| 1516-27128 | ||||||||||||||||||||||||
| 26 | break; executed 1516 times by 1 test: break;Executed by:
| 1516 | ||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||
| 28 | t = b[1]; | - | ||||||||||||||||||||||||
| 29 | r[1] = (0 - t - c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||
| 30 | if (t != 0
| 0-27128 | ||||||||||||||||||||||||
| 31 | c = 1; never executed: c = 1; | 0 | ||||||||||||||||||||||||
| 32 | if (++
| 892-26236 | ||||||||||||||||||||||||
| 33 | break; executed 892 times by 1 test: break;Executed by:
| 892 | ||||||||||||||||||||||||
| 34 | - | |||||||||||||||||||||||||
| 35 | t = b[2]; | - | ||||||||||||||||||||||||
| 36 | r[2] = (0 - t - c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||
| 37 | if (t != 0
| 0-26236 | ||||||||||||||||||||||||
| 38 | c = 1; never executed: c = 1; | 0 | ||||||||||||||||||||||||
| 39 | if (++
| 4109-22127 | ||||||||||||||||||||||||
| 40 | break; executed 4109 times by 1 test: break;Executed by:
| 4109 | ||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||
| 42 | t = b[3]; | - | ||||||||||||||||||||||||
| 43 | r[3] = (0 - t - c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||
| 44 | if (t != 0
| 0-22127 | ||||||||||||||||||||||||
| 45 | c = 1; never executed: c = 1; | 0 | ||||||||||||||||||||||||
| 46 | if (++
| 3065-19062 | ||||||||||||||||||||||||
| 47 | break; executed 3065 times by 1 test: break;Executed by:
| 3065 | ||||||||||||||||||||||||
| 48 | - | |||||||||||||||||||||||||
| 49 | b += 4; | - | ||||||||||||||||||||||||
| 50 | r += 4; | - | ||||||||||||||||||||||||
| 51 | } executed 19062 times by 1 test: end of blockExecuted by:
| 19062 | ||||||||||||||||||||||||
| 52 | } executed 9582 times by 1 test: else {end of blockExecuted by:
| 9582 | ||||||||||||||||||||||||
| 53 | int save_dl = dl; | - | ||||||||||||||||||||||||
| 54 | while (c
| 26392-60860 | ||||||||||||||||||||||||
| 55 | t = a[0]; | - | ||||||||||||||||||||||||
| 56 | r[0] = (t - c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||
| 57 | if (t != 0
| 11118-15274 | ||||||||||||||||||||||||
| 58 | c = 0; executed 11118 times by 1 test: c = 0;Executed by:
| 11118 | ||||||||||||||||||||||||
| 59 | if (--
| 2849-23543 | ||||||||||||||||||||||||
| 60 | break; executed 2849 times by 1 test: break;Executed by:
| 2849 | ||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||
| 62 | t = a[1]; | - | ||||||||||||||||||||||||
| 63 | r[1] = (t - c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||
| 64 | if (t != 0
| 8763-14780 | ||||||||||||||||||||||||
| 65 | c = 0; executed 8763 times by 1 test: c = 0;Executed by:
| 8763 | ||||||||||||||||||||||||
| 66 | if (--
| 2455-21088 | ||||||||||||||||||||||||
| 67 | break; executed 2455 times by 1 test: break;Executed by:
| 2455 | ||||||||||||||||||||||||
| 68 | - | |||||||||||||||||||||||||
| 69 | t = a[2]; | - | ||||||||||||||||||||||||
| 70 | r[2] = (t - c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||
| 71 | if (t != 0
| 7522-13566 | ||||||||||||||||||||||||
| 72 | c = 0; executed 7522 times by 1 test: c = 0;Executed by:
| 7522 | ||||||||||||||||||||||||
| 73 | if (--
| 1242-19846 | ||||||||||||||||||||||||
| 74 | break; executed 1242 times by 1 test: break;Executed by:
| 1242 | ||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||
| 76 | t = a[3]; | - | ||||||||||||||||||||||||
| 77 | r[3] = (t - c) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||
| 78 | if (t != 0
| 6476-13370 | ||||||||||||||||||||||||
| 79 | c = 0; executed 6476 times by 1 test: c = 0;Executed by:
| 6476 | ||||||||||||||||||||||||
| 80 | if (--
| 1765-18081 | ||||||||||||||||||||||||
| 81 | break; executed 1765 times by 1 test: break;Executed by:
| 1765 | ||||||||||||||||||||||||
| 82 | - | |||||||||||||||||||||||||
| 83 | save_dl = dl; | - | ||||||||||||||||||||||||
| 84 | a += 4; | - | ||||||||||||||||||||||||
| 85 | r += 4; | - | ||||||||||||||||||||||||
| 86 | } executed 18081 times by 1 test: end of blockExecuted by:
| 18081 | ||||||||||||||||||||||||
| 87 | if (dl > 0
| 8311-60860 | ||||||||||||||||||||||||
| 88 | if (save_dl > dl
| 0-60860 | ||||||||||||||||||||||||
| 89 | switch (save_dl - dl) { | - | ||||||||||||||||||||||||
| 90 | case never executed: 1:case 1:never executed: case 1: | 0 | ||||||||||||||||||||||||
| 91 | r[1] = a[1]; | - | ||||||||||||||||||||||||
| 92 | if (--
| 0 | ||||||||||||||||||||||||
| 93 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 94 | - | |||||||||||||||||||||||||
| 95 | case never executed: 2:case 2:never executed: case 2:code before this statement never executed: case 2: | 0 | ||||||||||||||||||||||||
| 96 | r[2] = a[2]; | - | ||||||||||||||||||||||||
| 97 | if (--
| 0 | ||||||||||||||||||||||||
| 98 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 99 | - | |||||||||||||||||||||||||
| 100 | case never executed: 3:case 3:never executed: case 3:code before this statement never executed: case 3: | 0 | ||||||||||||||||||||||||
| 101 | r[3] = a[3]; | - | ||||||||||||||||||||||||
| 102 | if (--
| 0 | ||||||||||||||||||||||||
| 103 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 104 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 105 | a += 4; | - | ||||||||||||||||||||||||
| 106 | r += 4; | - | ||||||||||||||||||||||||
| 107 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 108 | } executed 60860 times by 1 test: end of blockExecuted by:
| 60860 | ||||||||||||||||||||||||
| 109 | if (dl > 0
| 8311-60860 | ||||||||||||||||||||||||
| 110 | for (;;) { | - | ||||||||||||||||||||||||
| 111 | r[0] = a[0]; | - | ||||||||||||||||||||||||
| 112 | if (--
| 17509-250859 | ||||||||||||||||||||||||
| 113 | break; executed 17509 times by 1 test: break;Executed by:
| 17509 | ||||||||||||||||||||||||
| 114 | r[1] = a[1]; | - | ||||||||||||||||||||||||
| 115 | if (--
| 9171-241688 | ||||||||||||||||||||||||
| 116 | break; executed 9171 times by 1 test: break;Executed by:
| 9171 | ||||||||||||||||||||||||
| 117 | r[2] = a[2]; | - | ||||||||||||||||||||||||
| 118 | if (--
| 18155-223533 | ||||||||||||||||||||||||
| 119 | break; executed 18155 times by 1 test: break;Executed by:
| 18155 | ||||||||||||||||||||||||
| 120 | r[3] = a[3]; | - | ||||||||||||||||||||||||
| 121 | if (--
| 16025-207508 | ||||||||||||||||||||||||
| 122 | break; executed 16025 times by 1 test: break;Executed by:
| 16025 | ||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||
| 124 | a += 4; | - | ||||||||||||||||||||||||
| 125 | r += 4; | - | ||||||||||||||||||||||||
| 126 | } executed 207508 times by 1 test: end of blockExecuted by:
| 207508 | ||||||||||||||||||||||||
| 127 | } executed 60860 times by 1 test: end of blockExecuted by:
| 60860 | ||||||||||||||||||||||||
| 128 | } executed 69171 times by 1 test: end of blockExecuted by:
| 69171 | ||||||||||||||||||||||||
| 129 | return executed 78753 times by 1 test: c;return c;Executed by:
executed 78753 times by 1 test: return c;Executed by:
| 78753 | ||||||||||||||||||||||||
| 130 | } | - | ||||||||||||||||||||||||
| 131 | void bn_mul_recursive(unsigned long *r, unsigned long *a, unsigned long *b, int n2, | - | ||||||||||||||||||||||||
| 132 | int dna, int dnb, unsigned long *t) | - | ||||||||||||||||||||||||
| 133 | { | - | ||||||||||||||||||||||||
| 134 | int n = n2 / 2, c1, c2; | - | ||||||||||||||||||||||||
| 135 | int tna = n + dna, tnb = n + dnb; | - | ||||||||||||||||||||||||
| 136 | unsigned int neg, zero; | - | ||||||||||||||||||||||||
| 137 | unsigned long ln, lo, *p; | - | ||||||||||||||||||||||||
| 138 | if (n2 == 8
| 3360-323584 | ||||||||||||||||||||||||
| 139 | bn_mul_comba8(r, a, b); | - | ||||||||||||||||||||||||
| 140 | return; executed 13554 times by 1 test: return;Executed by:
| 13554 | ||||||||||||||||||||||||
| 141 | } | - | ||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||
| 143 | - | |||||||||||||||||||||||||
| 144 | if (n2 < (16)
| 6941-323584 | ||||||||||||||||||||||||
| 145 | bn_mul_normal(r, a, n2 + dna, b, n2 + dnb); | - | ||||||||||||||||||||||||
| 146 | if ((
| 0-6941 | ||||||||||||||||||||||||
| 147 | memset(&r[2 * n2 + dna + dnb], 0, executed 6941 times by 1 test: memset(&r[2 * n2 + dna + dnb], 0, sizeof(unsigned long) * -(dna + dnb));Executed by:
| 6941 | ||||||||||||||||||||||||
| 148 | sizeof(unsigned long) * -(dna + dnb)); executed 6941 times by 1 test: memset(&r[2 * n2 + dna + dnb], 0, sizeof(unsigned long) * -(dna + dnb));Executed by:
| 6941 | ||||||||||||||||||||||||
| 149 | return; executed 6941 times by 1 test: return;Executed by:
| 6941 | ||||||||||||||||||||||||
| 150 | } | - | ||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||
| 152 | c1 = bn_cmp_part_words(a, &(a[n]), tna, n - tna); | - | ||||||||||||||||||||||||
| 153 | c2 = bn_cmp_part_words(&(b[n]), b, tnb, tnb - n); | - | ||||||||||||||||||||||||
| 154 | zero = neg = 0; | - | ||||||||||||||||||||||||
| 155 | switch (c1 * 3 + c2) { | - | ||||||||||||||||||||||||
| 156 | case executed 58472 times by 1 test: -4:case -4:Executed by:
executed 58472 times by 1 test: case -4:Executed by:
| 58472 | ||||||||||||||||||||||||
| 157 | bn_sub_part_words(t, &(a[n]), a, tna, tna - n); | - | ||||||||||||||||||||||||
| 158 | bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); | - | ||||||||||||||||||||||||
| 159 | break; executed 58472 times by 1 test: break;Executed by:
| 58472 | ||||||||||||||||||||||||
| 160 | case executed 5972 times by 1 test: -3:case -3:Executed by:
executed 5972 times by 1 test: case -3:Executed by:
| 5972 | ||||||||||||||||||||||||
| 161 | zero = 1; | - | ||||||||||||||||||||||||
| 162 | break; executed 5972 times by 1 test: break;Executed by:
| 5972 | ||||||||||||||||||||||||
| 163 | case executed 57836 times by 1 test: -2:case -2:Executed by:
executed 57836 times by 1 test: case -2:Executed by:
| 57836 | ||||||||||||||||||||||||
| 164 | bn_sub_part_words(t, &(a[n]), a, tna, tna - n); | - | ||||||||||||||||||||||||
| 165 | bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n); | - | ||||||||||||||||||||||||
| 166 | neg = 1; | - | ||||||||||||||||||||||||
| 167 | break; executed 57836 times by 1 test: break;Executed by:
| 57836 | ||||||||||||||||||||||||
| 168 | case executed 8391 times by 1 test: -1:case -1:Executed by:
executed 8391 times by 1 test: case -1:Executed by:
| 8391 | ||||||||||||||||||||||||
| 169 | case executed 6341 times by 1 test: 0:case 0:Executed by:
executed 6341 times by 1 test: case 0:Executed by:
| 6341 | ||||||||||||||||||||||||
| 170 | case executed 9235 times by 1 test: 1:case 1:Executed by:
executed 9235 times by 1 test: case 1:Executed by:
| 9235 | ||||||||||||||||||||||||
| 171 | zero = 1; | - | ||||||||||||||||||||||||
| 172 | break; executed 23967 times by 1 test: break;Executed by:
| 23967 | ||||||||||||||||||||||||
| 173 | case executed 94853 times by 1 test: 2:case 2:Executed by:
executed 94853 times by 1 test: case 2:Executed by:
| 94853 | ||||||||||||||||||||||||
| 174 | bn_sub_part_words(t, a, &(a[n]), tna, n - tna); | - | ||||||||||||||||||||||||
| 175 | bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); | - | ||||||||||||||||||||||||
| 176 | neg = 1; | - | ||||||||||||||||||||||||
| 177 | break; executed 94853 times by 1 test: break;Executed by:
| 94853 | ||||||||||||||||||||||||
| 178 | case executed 6759 times by 1 test: 3:case 3:Executed by:
executed 6759 times by 1 test: case 3:Executed by:
| 6759 | ||||||||||||||||||||||||
| 179 | zero = 1; | - | ||||||||||||||||||||||||
| 180 | break; executed 6759 times by 1 test: break;Executed by:
| 6759 | ||||||||||||||||||||||||
| 181 | case executed 75725 times by 1 test: 4:case 4:Executed by:
executed 75725 times by 1 test: case 4:Executed by:
| 75725 | ||||||||||||||||||||||||
| 182 | bn_sub_part_words(t, a, &(a[n]), tna, n - tna); | - | ||||||||||||||||||||||||
| 183 | bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n); | - | ||||||||||||||||||||||||
| 184 | break; executed 75725 times by 1 test: break;Executed by:
| 75725 | ||||||||||||||||||||||||
| 185 | } | - | ||||||||||||||||||||||||
| 186 | - | |||||||||||||||||||||||||
| 187 | - | |||||||||||||||||||||||||
| 188 | if (n == 4
| 0-323584 | ||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||
| 190 | if (!zero
| 0 | ||||||||||||||||||||||||
| 191 | bn_mul_comba4(&(t[n2]), t, &(t[n])); never executed: bn_mul_comba4(&(t[n2]), t, &(t[n])); | 0 | ||||||||||||||||||||||||
| 192 | else | - | ||||||||||||||||||||||||
| 193 | memset(&t[n2], 0, sizeof(*t) * 8); never executed: memset(&t[n2], 0, sizeof(*t) * 8); | 0 | ||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||
| 195 | bn_mul_comba4(r, a, b); | - | ||||||||||||||||||||||||
| 196 | bn_mul_comba4(&(r[n2]), &(a[n]), &(b[n])); | - | ||||||||||||||||||||||||
| 197 | } never executed: else if (n == 8end of block
| 0-239618 | ||||||||||||||||||||||||
| 198 | - | |||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||
| 200 | if (!zero
| 28984-204044 | ||||||||||||||||||||||||
| 201 | bn_mul_comba8(&(t[n2]), t, &(t[n])); executed 204044 times by 1 test: bn_mul_comba8(&(t[n2]), t, &(t[n]));Executed by:
| 204044 | ||||||||||||||||||||||||
| 202 | else | - | ||||||||||||||||||||||||
| 203 | memset(&t[n2], 0, sizeof(*t) * 16); executed 28984 times by 1 test: memset(&t[n2], 0, sizeof(*t) * 16);Executed by:
| 28984 | ||||||||||||||||||||||||
| 204 | - | |||||||||||||||||||||||||
| 205 | bn_mul_comba8(r, a, b); | - | ||||||||||||||||||||||||
| 206 | bn_mul_comba8(&(r[n2]), &(a[n]), &(b[n])); | - | ||||||||||||||||||||||||
| 207 | } executed 233028 times by 1 test: elseend of blockExecuted by:
| 233028 | ||||||||||||||||||||||||
| 208 | - | |||||||||||||||||||||||||
| 209 | { | - | ||||||||||||||||||||||||
| 210 | p = &(t[n2 * 2]); | - | ||||||||||||||||||||||||
| 211 | if (!zero
| 7714-82842 | ||||||||||||||||||||||||
| 212 | bn_mul_recursive(&(t[n2]), t, &(t[n]), n, 0, 0, p); executed 82842 times by 1 test: bn_mul_recursive(&(t[n2]), t, &(t[n]), n, 0, 0, p);Executed by:
| 82842 | ||||||||||||||||||||||||
| 213 | else | - | ||||||||||||||||||||||||
| 214 | memset(&t[n2], 0, sizeof(*t) * n2); executed 7714 times by 1 test: memset(&t[n2], 0, sizeof(*t) * n2);Executed by:
| 7714 | ||||||||||||||||||||||||
| 215 | bn_mul_recursive(r, a, b, n, 0, 0, p); | - | ||||||||||||||||||||||||
| 216 | bn_mul_recursive(&(r[n2]), &(a[n]), &(b[n]), n, dna, dnb, p); | - | ||||||||||||||||||||||||
| 217 | } executed 90556 times by 1 test: end of blockExecuted by:
| 90556 | ||||||||||||||||||||||||
| 218 | - | |||||||||||||||||||||||||
| 219 | - | |||||||||||||||||||||||||
| 220 | - | |||||||||||||||||||||||||
| 221 | - | |||||||||||||||||||||||||
| 222 | - | |||||||||||||||||||||||||
| 223 | - | |||||||||||||||||||||||||
| 224 | - | |||||||||||||||||||||||||
| 225 | c1 = (int)(bn_add_words(t, r, &(r[n2]), n2)); | - | ||||||||||||||||||||||||
| 226 | - | |||||||||||||||||||||||||
| 227 | if (neg
| 152689-170895 | ||||||||||||||||||||||||
| 228 | c1 -= (int)(bn_sub_words(&(t[n2]), t, &(t[n2]), n2)); | - | ||||||||||||||||||||||||
| 229 | } executed 152689 times by 1 test: else {end of blockExecuted by:
| 152689 | ||||||||||||||||||||||||
| 230 | - | |||||||||||||||||||||||||
| 231 | c1 += (int)(bn_add_words(&(t[n2]), &(t[n2]), t, n2)); | - | ||||||||||||||||||||||||
| 232 | } executed 170895 times by 1 test: end of blockExecuted by:
| 170895 | ||||||||||||||||||||||||
| 233 | - | |||||||||||||||||||||||||
| 234 | - | |||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||
| 237 | - | |||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||
| 239 | - | |||||||||||||||||||||||||
| 240 | c1 += (int)(bn_add_words(&(r[n]), &(r[n]), &(t[n2]), n2)); | - | ||||||||||||||||||||||||
| 241 | if (c1
| 104120-219464 | ||||||||||||||||||||||||
| 242 | p = &(r[n + n2]); | - | ||||||||||||||||||||||||
| 243 | lo = *p; | - | ||||||||||||||||||||||||
| 244 | ln = (lo + c1) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||
| 245 | *p = ln; | - | ||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||
| 247 | - | |||||||||||||||||||||||||
| 248 | - | |||||||||||||||||||||||||
| 249 | - | |||||||||||||||||||||||||
| 250 | - | |||||||||||||||||||||||||
| 251 | if (ln < (unsigned long)c1
| 980-103140 | ||||||||||||||||||||||||
| 252 | do { | - | ||||||||||||||||||||||||
| 253 | p++; | - | ||||||||||||||||||||||||
| 254 | lo = *p; | - | ||||||||||||||||||||||||
| 255 | ln = (lo + 1) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||
| 256 | *p = ln; | - | ||||||||||||||||||||||||
| 257 | } executed 4588 times by 1 test: while (ln == 0end of blockExecuted by:
| 980-4588 | ||||||||||||||||||||||||
| 258 | } executed 980 times by 1 test: end of blockExecuted by:
| 980 | ||||||||||||||||||||||||
| 259 | } executed 104120 times by 1 test: end of blockExecuted by:
| 104120 | ||||||||||||||||||||||||
| 260 | } executed 323584 times by 1 test: end of blockExecuted by:
| 323584 | ||||||||||||||||||||||||
| 261 | - | |||||||||||||||||||||||||
| 262 | - | |||||||||||||||||||||||||
| 263 | - | |||||||||||||||||||||||||
| 264 | - | |||||||||||||||||||||||||
| 265 | - | |||||||||||||||||||||||||
| 266 | void bn_mul_part_recursive(unsigned long *r, unsigned long *a, unsigned long *b, int n, | - | ||||||||||||||||||||||||
| 267 | int tna, int tnb, unsigned long *t) | - | ||||||||||||||||||||||||
| 268 | { | - | ||||||||||||||||||||||||
| 269 | int i, j, n2 = n * 2; | - | ||||||||||||||||||||||||
| 270 | int c1, c2, neg; | - | ||||||||||||||||||||||||
| 271 | unsigned long ln, lo, *p; | - | ||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||
| 273 | if (n < 8
| 0-35354 | ||||||||||||||||||||||||
| 274 | bn_mul_normal(r, a, n + tna, b, n + tnb); | - | ||||||||||||||||||||||||
| 275 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 276 | } | - | ||||||||||||||||||||||||
| 277 | - | |||||||||||||||||||||||||
| 278 | - | |||||||||||||||||||||||||
| 279 | c1 = bn_cmp_part_words(a, &(a[n]), tna, n - tna); | - | ||||||||||||||||||||||||
| 280 | c2 = bn_cmp_part_words(&(b[n]), b, tnb, tnb - n); | - | ||||||||||||||||||||||||
| 281 | neg = 0; | - | ||||||||||||||||||||||||
| 282 | switch (c1 * 3 + c2) { | - | ||||||||||||||||||||||||
| 283 | case executed 5260 times by 1 test: -4:case -4:Executed by:
executed 5260 times by 1 test: case -4:Executed by:
| 5260 | ||||||||||||||||||||||||
| 284 | bn_sub_part_words(t, &(a[n]), a, tna, tna - n); | - | ||||||||||||||||||||||||
| 285 | bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); | - | ||||||||||||||||||||||||
| 286 | break; executed 5260 times by 1 test: break;Executed by:
| 5260 | ||||||||||||||||||||||||
| 287 | case executed 304 times by 1 test: -3:case -3:Executed by:
executed 304 times by 1 test: case -3:Executed by:
| 304 | ||||||||||||||||||||||||
| 288 | case executed 1039 times by 1 test: -2:case -2:Executed by:
executed 1039 times by 1 test: case -2:Executed by:
| 1039 | ||||||||||||||||||||||||
| 289 | bn_sub_part_words(t, &(a[n]), a, tna, tna - n); | - | ||||||||||||||||||||||||
| 290 | bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n); | - | ||||||||||||||||||||||||
| 291 | neg = 1; | - | ||||||||||||||||||||||||
| 292 | break; executed 1343 times by 1 test: break;Executed by:
| 1343 | ||||||||||||||||||||||||
| 293 | case executed 676 times by 1 test: -1:case -1:Executed by:
executed 676 times by 1 test: case -1:Executed by:
| 676 | ||||||||||||||||||||||||
| 294 | case executed 354 times by 1 test: 0:case 0:Executed by:
executed 354 times by 1 test: case 0:Executed by:
| 354 | ||||||||||||||||||||||||
| 295 | case executed 234 times by 1 test: 1:case 1:Executed by:
executed 234 times by 1 test: case 1:Executed by:
| 234 | ||||||||||||||||||||||||
| 296 | case executed 26345 times by 1 test: 2:case 2:Executed by:
executed 26345 times by 1 test: case 2:Executed by:
| 26345 | ||||||||||||||||||||||||
| 297 | bn_sub_part_words(t, a, &(a[n]), tna, n - tna); | - | ||||||||||||||||||||||||
| 298 | bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); | - | ||||||||||||||||||||||||
| 299 | neg = 1; | - | ||||||||||||||||||||||||
| 300 | break; executed 27609 times by 1 test: break;Executed by:
| 27609 | ||||||||||||||||||||||||
| 301 | case executed 407 times by 1 test: 3:case 3:Executed by:
executed 407 times by 1 test: case 3:Executed by:
| 407 | ||||||||||||||||||||||||
| 302 | case executed 735 times by 1 test: 4:case 4:Executed by:
executed 735 times by 1 test: case 4:Executed by:
| 735 | ||||||||||||||||||||||||
| 303 | bn_sub_part_words(t, a, &(a[n]), tna, n - tna); | - | ||||||||||||||||||||||||
| 304 | bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n); | - | ||||||||||||||||||||||||
| 305 | break; executed 1142 times by 1 test: break;Executed by:
| 1142 | ||||||||||||||||||||||||
| 306 | } | - | ||||||||||||||||||||||||
| 307 | if (n == 8
| 6517-28837 | ||||||||||||||||||||||||
| 308 | bn_mul_comba8(&(t[n2]), t, &(t[n])); | - | ||||||||||||||||||||||||
| 309 | bn_mul_comba8(r, a, b); | - | ||||||||||||||||||||||||
| 310 | bn_mul_normal(&(r[n2]), &(a[n]), tna, &(b[n]), tnb); | - | ||||||||||||||||||||||||
| 311 | memset(&r[n2 + tna + tnb], 0, sizeof(*r) * (n2 - tna - tnb)); | - | ||||||||||||||||||||||||
| 312 | } executed 6517 times by 1 test: else {end of blockExecuted by:
| 6517 | ||||||||||||||||||||||||
| 313 | p = &(t[n2 * 2]); | - | ||||||||||||||||||||||||
| 314 | bn_mul_recursive(&(t[n2]), t, &(t[n]), n, 0, 0, p); | - | ||||||||||||||||||||||||
| 315 | bn_mul_recursive(r, a, b, n, 0, 0, p); | - | ||||||||||||||||||||||||
| 316 | i = n / 2; | - | ||||||||||||||||||||||||
| 317 | - | |||||||||||||||||||||||||
| 318 | - | |||||||||||||||||||||||||
| 319 | - | |||||||||||||||||||||||||
| 320 | if (tna > tnb
| 5237-23600 | ||||||||||||||||||||||||
| 321 | j = tna - i; executed 5237 times by 1 test: j = tna - i;Executed by:
| 5237 | ||||||||||||||||||||||||
| 322 | else | - | ||||||||||||||||||||||||
| 323 | j = tnb - i; executed 23600 times by 1 test: j = tnb - i;Executed by:
| 23600 | ||||||||||||||||||||||||
| 324 | if (j == 0
| 5516-23321 | ||||||||||||||||||||||||
| 325 | bn_mul_recursive(&(r[n2]), &(a[n]), &(b[n]), | - | ||||||||||||||||||||||||
| 326 | i, tna - i, tnb - i, p); | - | ||||||||||||||||||||||||
| 327 | memset(&r[n2 + i * 2], 0, sizeof(*r) * (n2 - i * 2)); | - | ||||||||||||||||||||||||
| 328 | } executed 5516 times by 1 test: else if (j > 0end of blockExecuted by:
| 5516-16249 | ||||||||||||||||||||||||
| 329 | bn_mul_part_recursive(&(r[n2]), &(a[n]), &(b[n]), | - | ||||||||||||||||||||||||
| 330 | i, tna - i, tnb - i, p); | - | ||||||||||||||||||||||||
| 331 | memset(&(r[n2 + tna + tnb]), 0, | - | ||||||||||||||||||||||||
| 332 | sizeof(unsigned long) * (n2 - tna - tnb)); | - | ||||||||||||||||||||||||
| 333 | } executed 7072 times by 1 test: else {end of blockExecuted by:
| 7072 | ||||||||||||||||||||||||
| 334 | - | |||||||||||||||||||||||||
| 335 | memset(&r[n2], 0, sizeof(*r) * n2); | - | ||||||||||||||||||||||||
| 336 | if (tna < (16)
| 1520-14729 | ||||||||||||||||||||||||
| 337 | && tnb < (16)
| 316-14413 | ||||||||||||||||||||||||
| 338 | bn_mul_normal(&(r[n2]), &(a[n]), tna, &(b[n]), tnb); | - | ||||||||||||||||||||||||
| 339 | } executed 14413 times by 1 test: else {end of blockExecuted by:
| 14413 | ||||||||||||||||||||||||
| 340 | for (;;) { | - | ||||||||||||||||||||||||
| 341 | i /= 2; | - | ||||||||||||||||||||||||
| 342 | - | |||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||
| 344 | - | |||||||||||||||||||||||||
| 345 | - | |||||||||||||||||||||||||
| 346 | if (i < tna
| 282-1873 | ||||||||||||||||||||||||
| 347 | bn_mul_part_recursive(&(r[n2]), | - | ||||||||||||||||||||||||
| 348 | &(a[n]), &(b[n]), | - | ||||||||||||||||||||||||
| 349 | i, tna - i, tnb - i, p); | - | ||||||||||||||||||||||||
| 350 | break; executed 982 times by 1 test: break;Executed by:
| 982 | ||||||||||||||||||||||||
| 351 | } else if (i == tna
| 316-1053 | ||||||||||||||||||||||||
| 352 | bn_mul_recursive(&(r[n2]), | - | ||||||||||||||||||||||||
| 353 | &(a[n]), &(b[n]), | - | ||||||||||||||||||||||||
| 354 | i, tna - i, tnb - i, p); | - | ||||||||||||||||||||||||
| 355 | break; executed 854 times by 1 test: break;Executed by:
| 854 | ||||||||||||||||||||||||
| 356 | } | - | ||||||||||||||||||||||||
| 357 | } executed 737 times by 1 test: end of blockExecuted by:
| 737 | ||||||||||||||||||||||||
| 358 | } executed 1836 times by 1 test: end of blockExecuted by:
| 1836 | ||||||||||||||||||||||||
| 359 | } | - | ||||||||||||||||||||||||
| 360 | } | - | ||||||||||||||||||||||||
| 361 | - | |||||||||||||||||||||||||
| 362 | - | |||||||||||||||||||||||||
| 363 | - | |||||||||||||||||||||||||
| 364 | - | |||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||
| 366 | - | |||||||||||||||||||||||||
| 367 | - | |||||||||||||||||||||||||
| 368 | c1 = (int)(bn_add_words(t, r, &(r[n2]), n2)); | - | ||||||||||||||||||||||||
| 369 | - | |||||||||||||||||||||||||
| 370 | if (neg
| 6402-28952 | ||||||||||||||||||||||||
| 371 | c1 -= (int)(bn_sub_words(&(t[n2]), t, &(t[n2]), n2)); | - | ||||||||||||||||||||||||
| 372 | } executed 28952 times by 1 test: else {end of blockExecuted by:
| 28952 | ||||||||||||||||||||||||
| 373 | - | |||||||||||||||||||||||||
| 374 | c1 += (int)(bn_add_words(&(t[n2]), &(t[n2]), t, n2)); | - | ||||||||||||||||||||||||
| 375 | } executed 6402 times by 1 test: end of blockExecuted by:
| 6402 | ||||||||||||||||||||||||
| 376 | - | |||||||||||||||||||||||||
| 377 | - | |||||||||||||||||||||||||
| 378 | - | |||||||||||||||||||||||||
| 379 | - | |||||||||||||||||||||||||
| 380 | - | |||||||||||||||||||||||||
| 381 | - | |||||||||||||||||||||||||
| 382 | - | |||||||||||||||||||||||||
| 383 | c1 += (int)(bn_add_words(&(r[n]), &(r[n]), &(t[n2]), n2)); | - | ||||||||||||||||||||||||
| 384 | if (c1
| 651-34703 | ||||||||||||||||||||||||
| 385 | p = &(r[n + n2]); | - | ||||||||||||||||||||||||
| 386 | lo = *p; | - | ||||||||||||||||||||||||
| 387 | ln = (lo + c1) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||
| 388 | *p = ln; | - | ||||||||||||||||||||||||
| 389 | - | |||||||||||||||||||||||||
| 390 | - | |||||||||||||||||||||||||
| 391 | - | |||||||||||||||||||||||||
| 392 | - | |||||||||||||||||||||||||
| 393 | - | |||||||||||||||||||||||||
| 394 | if (ln < (unsigned long)c1
| 292-359 | ||||||||||||||||||||||||
| 395 | do { | - | ||||||||||||||||||||||||
| 396 | p++; | - | ||||||||||||||||||||||||
| 397 | lo = *p; | - | ||||||||||||||||||||||||
| 398 | ln = (lo + 1) & (0xffffffffffffffffL); | - | ||||||||||||||||||||||||
| 399 | *p = ln; | - | ||||||||||||||||||||||||
| 400 | } executed 1491 times by 1 test: while (ln == 0end of blockExecuted by:
| 359-1491 | ||||||||||||||||||||||||
| 401 | } executed 359 times by 1 test: end of blockExecuted by:
| 359 | ||||||||||||||||||||||||
| 402 | } executed 651 times by 1 test: end of blockExecuted by:
| 651 | ||||||||||||||||||||||||
| 403 | } executed 35354 times by 1 test: end of blockExecuted by:
| 35354 | ||||||||||||||||||||||||
| 404 | - | |||||||||||||||||||||||||
| 405 | - | |||||||||||||||||||||||||
| 406 | - | |||||||||||||||||||||||||
| 407 | - | |||||||||||||||||||||||||
| 408 | - | |||||||||||||||||||||||||
| 409 | void bn_mul_low_recursive(unsigned long *r, unsigned long *a, unsigned long *b, int n2, | - | ||||||||||||||||||||||||
| 410 | unsigned long *t) | - | ||||||||||||||||||||||||
| 411 | { | - | ||||||||||||||||||||||||
| 412 | int n = n2 / 2; | - | ||||||||||||||||||||||||
| 413 | - | |||||||||||||||||||||||||
| 414 | bn_mul_recursive(r, a, b, n, 0, 0, &(t[0])); | - | ||||||||||||||||||||||||
| 415 | if (n >= (32)
| 0 | ||||||||||||||||||||||||
| 416 | bn_mul_low_recursive(&(t[0]), &(a[0]), &(b[n]), n, &(t[n2])); | - | ||||||||||||||||||||||||
| 417 | bn_add_words(&(r[n]), &(r[n]), &(t[0]), n); | - | ||||||||||||||||||||||||
| 418 | bn_mul_low_recursive(&(t[0]), &(a[n]), &(b[0]), n, &(t[n2])); | - | ||||||||||||||||||||||||
| 419 | bn_add_words(&(r[n]), &(r[n]), &(t[0]), n); | - | ||||||||||||||||||||||||
| 420 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 421 | bn_mul_low_normal(&(t[0]), &(a[0]), &(b[n]), n); | - | ||||||||||||||||||||||||
| 422 | bn_mul_low_normal(&(t[n]), &(a[n]), &(b[0]), n); | - | ||||||||||||||||||||||||
| 423 | bn_add_words(&(r[n]), &(r[n]), &(t[0]), n); | - | ||||||||||||||||||||||||
| 424 | bn_add_words(&(r[n]), &(r[n]), &(t[n]), n); | - | ||||||||||||||||||||||||
| 425 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 426 | } | - | ||||||||||||||||||||||||
| 427 | - | |||||||||||||||||||||||||
| 428 | - | |||||||||||||||||||||||||
| 429 | int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 430 | { | - | ||||||||||||||||||||||||
| 431 | int ret = bn_mul_fixed_top(r, a, b, ctx); | - | ||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||
| 433 | bn_correct_top(r); | - | ||||||||||||||||||||||||
| 434 | ; | - | ||||||||||||||||||||||||
| 435 | - | |||||||||||||||||||||||||
| 436 | return executed 2968993 times by 2 tests: ret;return ret;Executed by:
executed 2968993 times by 2 tests: return ret;Executed by:
| 2968993 | ||||||||||||||||||||||||
| 437 | } | - | ||||||||||||||||||||||||
| 438 | - | |||||||||||||||||||||||||
| 439 | int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 440 | { | - | ||||||||||||||||||||||||
| 441 | int ret = 0; | - | ||||||||||||||||||||||||
| 442 | int top, al, bl; | - | ||||||||||||||||||||||||
| 443 | BIGNUM *rr; | - | ||||||||||||||||||||||||
| 444 | - | |||||||||||||||||||||||||
| 445 | int i; | - | ||||||||||||||||||||||||
| 446 | - | |||||||||||||||||||||||||
| 447 | - | |||||||||||||||||||||||||
| 448 | BIGNUM *t = | - | ||||||||||||||||||||||||
| 449 | ((void *)0) | - | ||||||||||||||||||||||||
| 450 | ; | - | ||||||||||||||||||||||||
| 451 | int j = 0, k; | - | ||||||||||||||||||||||||
| 452 | - | |||||||||||||||||||||||||
| 453 | - | |||||||||||||||||||||||||
| 454 | ; | - | ||||||||||||||||||||||||
| 455 | ; | - | ||||||||||||||||||||||||
| 456 | ; | - | ||||||||||||||||||||||||
| 457 | - | |||||||||||||||||||||||||
| 458 | al = a->top; | - | ||||||||||||||||||||||||
| 459 | bl = b->top; | - | ||||||||||||||||||||||||
| 460 | - | |||||||||||||||||||||||||
| 461 | if ((
| 45622-3214734 | ||||||||||||||||||||||||
| 462 | (BN_set_word((r),0)); | - | ||||||||||||||||||||||||
| 463 | return executed 103017 times by 1 test: 1;return 1;Executed by:
executed 103017 times by 1 test: return 1;Executed by:
| 103017 | ||||||||||||||||||||||||
| 464 | } | - | ||||||||||||||||||||||||
| 465 | top = al + bl; | - | ||||||||||||||||||||||||
| 466 | - | |||||||||||||||||||||||||
| 467 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||
| 468 | if ((
| 196-3156857 | ||||||||||||||||||||||||
| 469 | if ((
| 0-678 | ||||||||||||||||||||||||
| 470 | ((void *)0)
| 0-678 | ||||||||||||||||||||||||
| 471 | ) | - | ||||||||||||||||||||||||
| 472 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 473 | } executed 678 times by 1 test: elseend of blockExecuted by:
| 678 | ||||||||||||||||||||||||
| 474 | rr = r; executed 3156661 times by 2 tests: rr = r;Executed by:
| 3156661 | ||||||||||||||||||||||||
| 475 | - | |||||||||||||||||||||||||
| 476 | - | |||||||||||||||||||||||||
| 477 | i = al - bl; | - | ||||||||||||||||||||||||
| 478 | - | |||||||||||||||||||||||||
| 479 | - | |||||||||||||||||||||||||
| 480 | if (i == 0
| 842610-2314729 | ||||||||||||||||||||||||
| 481 | if (al == 8
| 161685-680925 | ||||||||||||||||||||||||
| 482 | if (bn_wexpand(rr, 16) ==
| 0-161685 | ||||||||||||||||||||||||
| 483 | ((void *)0)
| 0-161685 | ||||||||||||||||||||||||
| 484 | ) | - | ||||||||||||||||||||||||
| 485 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 486 | rr->top = 16; | - | ||||||||||||||||||||||||
| 487 | bn_mul_comba8(rr->d, a->d, b->d); | - | ||||||||||||||||||||||||
| 488 | goto executed 161685 times by 1 test: end;goto end;Executed by:
executed 161685 times by 1 test: goto end;Executed by:
| 161685 | ||||||||||||||||||||||||
| 489 | } | - | ||||||||||||||||||||||||
| 490 | } executed 680925 times by 2 tests: end of blockExecuted by:
| 680925 | ||||||||||||||||||||||||
| 491 | - | |||||||||||||||||||||||||
| 492 | - | |||||||||||||||||||||||||
| 493 | if ((
| 7275-2940568 | ||||||||||||||||||||||||
| 494 | if (i >= -1
| 685-47126 | ||||||||||||||||||||||||
| 495 | - | |||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||
| 497 | - | |||||||||||||||||||||||||
| 498 | - | |||||||||||||||||||||||||
| 499 | if (i >= 0
| 8800-34581 | ||||||||||||||||||||||||
| 500 | j = BN_num_bits_word((unsigned long)al); | - | ||||||||||||||||||||||||
| 501 | } executed 34581 times by 1 test: end of blockExecuted by:
| 34581 | ||||||||||||||||||||||||
| 502 | if (i == -1
| 8800-34581 | ||||||||||||||||||||||||
| 503 | j = BN_num_bits_word((unsigned long)bl); | - | ||||||||||||||||||||||||
| 504 | } executed 8800 times by 1 test: end of blockExecuted by:
| 8800 | ||||||||||||||||||||||||
| 505 | j = 1 << (j - 1); | - | ||||||||||||||||||||||||
| 506 | - | |||||||||||||||||||||||||
| 507 | ((void) (0)) | - | ||||||||||||||||||||||||
| 508 | ; | - | ||||||||||||||||||||||||
| 509 | k = j + j; | - | ||||||||||||||||||||||||
| 510 | t = BN_CTX_get(ctx); | - | ||||||||||||||||||||||||
| 511 | if (t ==
| 0-43381 | ||||||||||||||||||||||||
| 512 | ((void *)0)
| 0-43381 | ||||||||||||||||||||||||
| 513 | ) | - | ||||||||||||||||||||||||
| 514 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 515 | if (al > j
| 3054-24246 | ||||||||||||||||||||||||
| 516 | if (bn_wexpand(t, k * 4) ==
| 0-27300 | ||||||||||||||||||||||||
| 517 | ((void *)0)
| 0-27300 | ||||||||||||||||||||||||
| 518 | ) | - | ||||||||||||||||||||||||
| 519 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 520 | if (bn_wexpand(rr, k * 4) ==
| 0-27300 | ||||||||||||||||||||||||
| 521 | ((void *)0)
| 0-27300 | ||||||||||||||||||||||||
| 522 | ) | - | ||||||||||||||||||||||||
| 523 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 524 | bn_mul_part_recursive(rr->d, a->d, b->d, | - | ||||||||||||||||||||||||
| 525 | j, al - j, bl - j, t->d); | - | ||||||||||||||||||||||||
| 526 | } executed 27300 times by 1 test: else {end of blockExecuted by:
| 27300 | ||||||||||||||||||||||||
| 527 | - | |||||||||||||||||||||||||
| 528 | if (bn_wexpand(t, k * 2) ==
| 0-16081 | ||||||||||||||||||||||||
| 529 | ((void *)0)
| 0-16081 | ||||||||||||||||||||||||
| 530 | ) | - | ||||||||||||||||||||||||
| 531 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 532 | if (bn_wexpand(rr, k * 2) ==
| 0-16081 | ||||||||||||||||||||||||
| 533 | ((void *)0)
| 0-16081 | ||||||||||||||||||||||||
| 534 | ) | - | ||||||||||||||||||||||||
| 535 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 536 | bn_mul_recursive(rr->d, a->d, b->d, j, al - j, bl - j, t->d); | - | ||||||||||||||||||||||||
| 537 | } executed 16081 times by 1 test: end of blockExecuted by:
| 16081 | ||||||||||||||||||||||||
| 538 | rr->top = top; | - | ||||||||||||||||||||||||
| 539 | goto executed 43381 times by 1 test: end;goto end;Executed by:
executed 43381 times by 1 test: goto end;Executed by:
| 43381 | ||||||||||||||||||||||||
| 540 | } | - | ||||||||||||||||||||||||
| 541 | } executed 4430 times by 1 test: end of blockExecuted by:
| 4430 | ||||||||||||||||||||||||
| 542 | - | |||||||||||||||||||||||||
| 543 | if (bn_wexpand(rr, top) ==
| 0-2952273 | ||||||||||||||||||||||||
| 544 | ((void *)0)
| 0-2952273 | ||||||||||||||||||||||||
| 545 | ) | - | ||||||||||||||||||||||||
| 546 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 547 | rr->top = top; | - | ||||||||||||||||||||||||
| 548 | bn_mul_normal(rr->d, a->d, al, b->d, bl); | - | ||||||||||||||||||||||||
| 549 | - | |||||||||||||||||||||||||
| 550 | - | |||||||||||||||||||||||||
| 551 | end: code before this statement executed 2952273 times by 2 tests: end:Executed by:
| 2952273 | ||||||||||||||||||||||||
| 552 | - | |||||||||||||||||||||||||
| 553 | rr->neg = a->neg ^ b->neg; | - | ||||||||||||||||||||||||
| 554 | rr->flags |= 0; | - | ||||||||||||||||||||||||
| 555 | if (r != rr
| 0-3156661 | ||||||||||||||||||||||||
| 556 | ((void *)0)
| 0-678 | ||||||||||||||||||||||||
| 557 | ) | - | ||||||||||||||||||||||||
| 558 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 559 | - | |||||||||||||||||||||||||
| 560 | ret = 1; | - | ||||||||||||||||||||||||
| 561 | err: code before this statement executed 3157339 times by 2 tests: err:Executed by:
| 3157339 | ||||||||||||||||||||||||
| 562 | ; | - | ||||||||||||||||||||||||
| 563 | BN_CTX_end(ctx); | - | ||||||||||||||||||||||||
| 564 | return executed 3157339 times by 2 tests: ret;return ret;Executed by:
executed 3157339 times by 2 tests: return ret;Executed by:
| 3157339 | ||||||||||||||||||||||||
| 565 | } | - | ||||||||||||||||||||||||
| 566 | - | |||||||||||||||||||||||||
| 567 | void bn_mul_normal(unsigned long *r, unsigned long *a, int na, unsigned long *b, int nb) | - | ||||||||||||||||||||||||
| 568 | { | - | ||||||||||||||||||||||||
| 569 | unsigned long *rr; | - | ||||||||||||||||||||||||
| 570 | - | |||||||||||||||||||||||||
| 571 | if (na < nb
| 745125-2235019 | ||||||||||||||||||||||||
| 572 | int itmp; | - | ||||||||||||||||||||||||
| 573 | unsigned long *ltmp; | - | ||||||||||||||||||||||||
| 574 | - | |||||||||||||||||||||||||
| 575 | itmp = na; | - | ||||||||||||||||||||||||
| 576 | na = nb; | - | ||||||||||||||||||||||||
| 577 | nb = itmp; | - | ||||||||||||||||||||||||
| 578 | ltmp = a; | - | ||||||||||||||||||||||||
| 579 | a = b; | - | ||||||||||||||||||||||||
| 580 | b = ltmp; | - | ||||||||||||||||||||||||
| 581 | - | |||||||||||||||||||||||||
| 582 | } executed 2235019 times by 2 tests: end of blockExecuted by:
| 2235019 | ||||||||||||||||||||||||
| 583 | rr = &(r[na]); | - | ||||||||||||||||||||||||
| 584 | if (nb <= 0
| 5119-2975025 | ||||||||||||||||||||||||
| 585 | (void)bn_mul_words(r, a, na, 0); | - | ||||||||||||||||||||||||
| 586 | return; executed 5119 times by 1 test: return;Executed by:
| 5119 | ||||||||||||||||||||||||
| 587 | } else | - | ||||||||||||||||||||||||
| 588 | rr[0] = bn_mul_words(r, a, na, b[0]); executed 2975025 times by 2 tests: rr[0] = bn_mul_words(r, a, na, b[0]);Executed by:
| 2975025 | ||||||||||||||||||||||||
| 589 | - | |||||||||||||||||||||||||
| 590 | for (;;) { | - | ||||||||||||||||||||||||
| 591 | if (--
| 542715-2657449 | ||||||||||||||||||||||||
| 592 | return; executed 2657449 times by 2 tests: return;Executed by:
| 2657449 | ||||||||||||||||||||||||
| 593 | rr[1] = bn_mul_add_words(&(r[1]), a, na, b[1]); | - | ||||||||||||||||||||||||
| 594 | if (--
| 53479-489236 | ||||||||||||||||||||||||
| 595 | return; executed 53479 times by 1 test: return;Executed by:
| 53479 | ||||||||||||||||||||||||
| 596 | rr[2] = bn_mul_add_words(&(r[2]), a, na, b[2]); | - | ||||||||||||||||||||||||
| 597 | if (--
| 26815-462421 | ||||||||||||||||||||||||
| 598 | return; executed 26815 times by 1 test: return;Executed by:
| 26815 | ||||||||||||||||||||||||
| 599 | rr[3] = bn_mul_add_words(&(r[3]), a, na, b[3]); | - | ||||||||||||||||||||||||
| 600 | if (--
| 225139-237282 | ||||||||||||||||||||||||
| 601 | return; executed 237282 times by 2 tests: return;Executed by:
| 237282 | ||||||||||||||||||||||||
| 602 | rr[4] = bn_mul_add_words(&(r[4]), a, na, b[4]); | - | ||||||||||||||||||||||||
| 603 | rr += 4; | - | ||||||||||||||||||||||||
| 604 | r += 4; | - | ||||||||||||||||||||||||
| 605 | b += 4; | - | ||||||||||||||||||||||||
| 606 | } executed 225139 times by 1 test: end of blockExecuted by:
| 225139 | ||||||||||||||||||||||||
| 607 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 608 | - | |||||||||||||||||||||||||
| 609 | void bn_mul_low_normal(unsigned long *r, unsigned long *a, unsigned long *b, int n) | - | ||||||||||||||||||||||||
| 610 | { | - | ||||||||||||||||||||||||
| 611 | bn_mul_words(r, a, n, b[0]); | - | ||||||||||||||||||||||||
| 612 | - | |||||||||||||||||||||||||
| 613 | for (;;) { | - | ||||||||||||||||||||||||
| 614 | if (--
| 0 | ||||||||||||||||||||||||
| 615 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 616 | bn_mul_add_words(&(r[1]), a, n, b[1]); | - | ||||||||||||||||||||||||
| 617 | if (--
| 0 | ||||||||||||||||||||||||
| 618 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 619 | bn_mul_add_words(&(r[2]), a, n, b[2]); | - | ||||||||||||||||||||||||
| 620 | if (--
| 0 | ||||||||||||||||||||||||
| 621 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 622 | bn_mul_add_words(&(r[3]), a, n, b[3]); | - | ||||||||||||||||||||||||
| 623 | if (--
| 0 | ||||||||||||||||||||||||
| 624 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 625 | bn_mul_add_words(&(r[4]), a, n, b[4]); | - | ||||||||||||||||||||||||
| 626 | r += 4; | - | ||||||||||||||||||||||||
| 627 | b += 4; | - | ||||||||||||||||||||||||
| 628 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 629 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |