| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/bn/bn_print.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | static const char Hex[] = "0123456789ABCDEF"; | - | ||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | char *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)
| 5-1728 | ||||||||||||||||||||||||
| 13 | return executed 5 times by 1 test: CRYPTO_strdup("0", __FILE__, 27);return CRYPTO_strdup("0", __FILE__, 27);Executed by:
executed 5 times by 1 test: return CRYPTO_strdup("0", __FILE__, 27);Executed by:
| 5 | ||||||||||||||||||||||||
| 14 | buf = CRYPTO_malloc(a->top * 8 * 2 + 2, __FILE__, 28); | - | ||||||||||||||||||||||||
| 15 | if (buf ==
| 0-1728 | ||||||||||||||||||||||||
| 16 | ((void *)0)
| 0-1728 | ||||||||||||||||||||||||
| 17 | ) { | - | ||||||||||||||||||||||||
| 18 | ERR_put_error(3,(105),((1|64)),__FILE__,30); | - | ||||||||||||||||||||||||
| 19 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 20 | } | - | ||||||||||||||||||||||||
| 21 | p = buf; | - | ||||||||||||||||||||||||
| 22 | if (a->neg
| 733-995 | ||||||||||||||||||||||||
| 23 | * executed 733 times by 1 test: p++ = '-';*p++ = '-';Executed by:
executed 733 times by 1 test: *p++ = '-';Executed by:
| 733 | ||||||||||||||||||||||||
| 24 | for (i = a->top - 1; i >= 0
| 1728-7472 | ||||||||||||||||||||||||
| 25 | for (j = (8 * 8) - 8; j >= 0
| 7472-59776 | ||||||||||||||||||||||||
| 26 | - | |||||||||||||||||||||||||
| 27 | v = (int)((a->d[i] >> j) & 0xff); | - | ||||||||||||||||||||||||
| 28 | if (z
| 1728-47804 | ||||||||||||||||||||||||
| 29 | *p++ = Hex[v >> 4]; | - | ||||||||||||||||||||||||
| 30 | *p++ = Hex[v & 0x0f]; | - | ||||||||||||||||||||||||
| 31 | z = 1; | - | ||||||||||||||||||||||||
| 32 | } executed 49532 times by 1 test: end of blockExecuted by:
| 49532 | ||||||||||||||||||||||||
| 33 | } executed 59776 times by 1 test: end of blockExecuted by:
| 59776 | ||||||||||||||||||||||||
| 34 | } executed 7472 times by 1 test: end of blockExecuted by:
| 7472 | ||||||||||||||||||||||||
| 35 | *p = '\0'; | - | ||||||||||||||||||||||||
| 36 | err: code before this statement executed 1728 times by 1 test: err:Executed by:
| 1728 | ||||||||||||||||||||||||
| 37 | return executed 1728 times by 1 test: buf;return buf;Executed by:
executed 1728 times by 1 test: return buf;Executed by:
| 1728 | ||||||||||||||||||||||||
| 38 | } | - | ||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||
| 40 | - | |||||||||||||||||||||||||
| 41 | char *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 ==
| 0-18302 | ||||||||||||||||||||||||
| 69 | ((void *)0)
| 0-18302 | ||||||||||||||||||||||||
| 70 | || bn_data ==
| 0-18302 | ||||||||||||||||||||||||
| 71 | ((void *)0)
| 0-18302 | ||||||||||||||||||||||||
| 72 | ) { | - | ||||||||||||||||||||||||
| 73 | ERR_put_error(3,(104),((1|64)),__FILE__,75); | - | ||||||||||||||||||||||||
| 74 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 75 | } | - | ||||||||||||||||||||||||
| 76 | if ((
| 0-18302 | ||||||||||||||||||||||||
| 77 | ((void *)0)
| 0-18302 | ||||||||||||||||||||||||
| 78 | ) | - | ||||||||||||||||||||||||
| 79 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 80 | - | |||||||||||||||||||||||||
| 81 | p = buf; | - | ||||||||||||||||||||||||
| 82 | lp = bn_data; | - | ||||||||||||||||||||||||
| 83 | if (BN_is_zero(t)
| 1160-17142 | ||||||||||||||||||||||||
| 84 | *p++ = '0'; | - | ||||||||||||||||||||||||
| 85 | *p++ = '\0'; | - | ||||||||||||||||||||||||
| 86 | } executed 1160 times by 1 test: else {end of blockExecuted by:
| 1160 | ||||||||||||||||||||||||
| 87 | if (BN_is_negative(t)
| 1906-15236 | ||||||||||||||||||||||||
| 88 | * executed 1906 times by 1 test: p++ = '-';*p++ = '-';Executed by:
executed 1906 times by 1 test: *p++ = '-';Executed by:
| 1906 | ||||||||||||||||||||||||
| 89 | - | |||||||||||||||||||||||||
| 90 | while (!BN_is_zero(t)
| 17142-35612 | ||||||||||||||||||||||||
| 91 | if (lp - bn_data >= bn_data_num
| 0-35612 | ||||||||||||||||||||||||
| 92 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 93 | *lp = BN_div_word(t, (10000000000000000000UL)); | - | ||||||||||||||||||||||||
| 94 | if (*
| 0-35612 | ||||||||||||||||||||||||
| 95 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 96 | lp++; | - | ||||||||||||||||||||||||
| 97 | } executed 35612 times by 1 test: end of blockExecuted by:
| 35612 | ||||||||||||||||||||||||
| 98 | lp--; | - | ||||||||||||||||||||||||
| 99 | - | |||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||
| 101 | - | |||||||||||||||||||||||||
| 102 | - | |||||||||||||||||||||||||
| 103 | - | |||||||||||||||||||||||||
| 104 | n = BIO_snprintf(p, tbytes - (size_t)(p - buf), "%lu", *lp); | - | ||||||||||||||||||||||||
| 105 | if (n < 0
| 0-17142 | ||||||||||||||||||||||||
| 106 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 107 | p += n; | - | ||||||||||||||||||||||||
| 108 | while (lp != bn_data
| 17142-18470 | ||||||||||||||||||||||||
| 109 | lp--; | - | ||||||||||||||||||||||||
| 110 | n = BIO_snprintf(p, tbytes - (size_t)(p - buf), "%019lu", *lp); | - | ||||||||||||||||||||||||
| 111 | if (n < 0
| 0-18470 | ||||||||||||||||||||||||
| 112 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 113 | p += n; | - | ||||||||||||||||||||||||
| 114 | } executed 18470 times by 1 test: end of blockExecuted by:
| 18470 | ||||||||||||||||||||||||
| 115 | } executed 17142 times by 1 test: end of blockExecuted by:
| 17142 | ||||||||||||||||||||||||
| 116 | ok = 1; | - | ||||||||||||||||||||||||
| 117 | err: code before this statement executed 18302 times by 1 test: err:Executed by:
| 18302 | ||||||||||||||||||||||||
| 118 | CRYPTO_free(bn_data, __FILE__, 118); | - | ||||||||||||||||||||||||
| 119 | BN_free(t); | - | ||||||||||||||||||||||||
| 120 | if (ok
| 0-18302 | ||||||||||||||||||||||||
| 121 | return executed 18302 times by 1 test: buf;return buf;Executed by:
executed 18302 times by 1 test: return buf;Executed by:
| 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 | - | |||||||||||||||||||||||||
| 128 | int 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 ==
| 0-8393 | ||||||||||||||||||||||||
| 138 | ((void *)0)
| 0-8393 | ||||||||||||||||||||||||
| 139 | || *
| 0-8393 | ||||||||||||||||||||||||
| 140 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 141 | - | |||||||||||||||||||||||||
| 142 | if (*
| 1796-6597 | ||||||||||||||||||||||||
| 143 | neg = 1; | - | ||||||||||||||||||||||||
| 144 | a++; | - | ||||||||||||||||||||||||
| 145 | } executed 1796 times by 1 test: end of blockExecuted by:
| 1796 | ||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||
| 147 | for (i = 0; i <= 0x7fffffff / 4
| 0-803016 | ||||||||||||||||||||||||
| 148 | continue; executed 794623 times by 2 tests: continue;Executed by:
| 794623 | ||||||||||||||||||||||||
| 149 | - | |||||||||||||||||||||||||
| 150 | if (i == 0
| 0-8393 | ||||||||||||||||||||||||
| 151 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 152 | - | |||||||||||||||||||||||||
| 153 | num = i + neg; | - | ||||||||||||||||||||||||
| 154 | if (bn ==
| 0-8393 | ||||||||||||||||||||||||
| 155 | ((void *)0)
| 0-8393 | ||||||||||||||||||||||||
| 156 | ) | - | ||||||||||||||||||||||||
| 157 | return never executed: num;return num;never executed: return num; | 0 | ||||||||||||||||||||||||
| 158 | - | |||||||||||||||||||||||||
| 159 | - | |||||||||||||||||||||||||
| 160 | if (*
| 212-8181 | ||||||||||||||||||||||||
| 161 | ((void *)0)
| 212-8181 | ||||||||||||||||||||||||
| 162 | ) { | - | ||||||||||||||||||||||||
| 163 | if ((
| 0-8181 | ||||||||||||||||||||||||
| 164 | ((void *)0)
| 0-8181 | ||||||||||||||||||||||||
| 165 | ) | - | ||||||||||||||||||||||||
| 166 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 167 | } executed 8181 times by 2 tests: else {end of blockExecuted by:
| 8181 | ||||||||||||||||||||||||
| 168 | ret = *bn; | - | ||||||||||||||||||||||||
| 169 | (BN_set_word((ret),0)); | - | ||||||||||||||||||||||||
| 170 | } executed 212 times by 1 test: end of blockExecuted by:
| 212 | ||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||
| 172 | - | |||||||||||||||||||||||||
| 173 | if (bn_expand(ret, i * 4) ==
| 0-8393 | ||||||||||||||||||||||||
| 174 | ((void *)0)
| 0-8393 | ||||||||||||||||||||||||
| 175 | ) | - | ||||||||||||||||||||||||
| 176 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 177 | - | |||||||||||||||||||||||||
| 178 | j = i; | - | ||||||||||||||||||||||||
| 179 | m = 0; | - | ||||||||||||||||||||||||
| 180 | h = 0; | - | ||||||||||||||||||||||||
| 181 | while (j > 0
| 8393-53559 | ||||||||||||||||||||||||
| 182 | m = (
| 6418-47141 | ||||||||||||||||||||||||
| 183 | l = 0; | - | ||||||||||||||||||||||||
| 184 | for (;;) { | - | ||||||||||||||||||||||||
| 185 | c = a[j - m]; | - | ||||||||||||||||||||||||
| 186 | k = OPENSSL_hexchar2int(c); | - | ||||||||||||||||||||||||
| 187 | if (k < 0
| 0-794623 | ||||||||||||||||||||||||
| 188 | k = 0; never executed: k = 0; | 0 | ||||||||||||||||||||||||
| 189 | l = (l << 4) | k; | - | ||||||||||||||||||||||||
| 190 | - | |||||||||||||||||||||||||
| 191 | if (--
| 53559-741064 | ||||||||||||||||||||||||
| 192 | ret->d[h++] = l; | - | ||||||||||||||||||||||||
| 193 | break; executed 53559 times by 2 tests: break;Executed by:
| 53559 | ||||||||||||||||||||||||
| 194 | } | - | ||||||||||||||||||||||||
| 195 | } executed 741064 times by 2 tests: end of blockExecuted by:
| 741064 | ||||||||||||||||||||||||
| 196 | j -= 8 * 2; | - | ||||||||||||||||||||||||
| 197 | } executed 53559 times by 2 tests: end of blockExecuted by:
| 53559 | ||||||||||||||||||||||||
| 198 | ret->top = h; | - | ||||||||||||||||||||||||
| 199 | bn_correct_top(ret); | - | ||||||||||||||||||||||||
| 200 | - | |||||||||||||||||||||||||
| 201 | *bn = ret; | - | ||||||||||||||||||||||||
| 202 | ; | - | ||||||||||||||||||||||||
| 203 | - | |||||||||||||||||||||||||
| 204 | if (ret->top != 0
| 111-8282 | ||||||||||||||||||||||||
| 205 | ret->neg = neg; executed 8282 times by 2 tests: ret->neg = neg;Executed by:
| 8282 | ||||||||||||||||||||||||
| 206 | return executed 8393 times by 2 tests: num;return num;Executed by:
executed 8393 times by 2 tests: return num;Executed by:
| 8393 | ||||||||||||||||||||||||
| 207 | err: | - | ||||||||||||||||||||||||
| 208 | if (*
| 0 | ||||||||||||||||||||||||
| 209 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 210 | ) | - | ||||||||||||||||||||||||
| 211 | BN_free(ret); never executed: BN_free(ret); | 0 | ||||||||||||||||||||||||
| 212 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 213 | } | - | ||||||||||||||||||||||||
| 214 | - | |||||||||||||||||||||||||
| 215 | int 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 ==
| 0-44 | ||||||||||||||||||||||||
| 225 | ((void *)0)
| 0-44 | ||||||||||||||||||||||||
| 226 | || *
| 0-44 | ||||||||||||||||||||||||
| 227 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 228 | if (*
| 3-41 | ||||||||||||||||||||||||
| 229 | neg = 1; | - | ||||||||||||||||||||||||
| 230 | a++; | - | ||||||||||||||||||||||||
| 231 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||
| 232 | - | |||||||||||||||||||||||||
| 233 | for (i = 0; i <= 0x7fffffff / 4
| 0-1130 | ||||||||||||||||||||||||
| 234 | continue; executed 1086 times by 1 test: continue;Executed by:
| 1086 | ||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||
| 236 | if (i == 0
| 0-44 | ||||||||||||||||||||||||
| 237 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||
| 239 | num = i + neg; | - | ||||||||||||||||||||||||
| 240 | if (bn ==
| 0-44 | ||||||||||||||||||||||||
| 241 | ((void *)0)
| 0-44 | ||||||||||||||||||||||||
| 242 | ) | - | ||||||||||||||||||||||||
| 243 | return never executed: num;return num;never executed: return num; | 0 | ||||||||||||||||||||||||
| 244 | - | |||||||||||||||||||||||||
| 245 | - | |||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||
| 247 | - | |||||||||||||||||||||||||
| 248 | - | |||||||||||||||||||||||||
| 249 | if (*
| 9-35 | ||||||||||||||||||||||||
| 250 | ((void *)0)
| 9-35 | ||||||||||||||||||||||||
| 251 | ) { | - | ||||||||||||||||||||||||
| 252 | if ((
| 0-9 | ||||||||||||||||||||||||
| 253 | ((void *)0)
| 0-9 | ||||||||||||||||||||||||
| 254 | ) | - | ||||||||||||||||||||||||
| 255 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 256 | } executed 9 times by 1 test: else {end of blockExecuted by:
| 9 | ||||||||||||||||||||||||
| 257 | ret = *bn; | - | ||||||||||||||||||||||||
| 258 | (BN_set_word((ret),0)); | - | ||||||||||||||||||||||||
| 259 | } executed 35 times by 1 test: end of blockExecuted by:
| 35 | ||||||||||||||||||||||||
| 260 | - | |||||||||||||||||||||||||
| 261 | - | |||||||||||||||||||||||||
| 262 | if (bn_expand(ret, i * 4) ==
| 0-44 | ||||||||||||||||||||||||
| 263 | ((void *)0)
| 0-44 | ||||||||||||||||||||||||
| 264 | ) | - | ||||||||||||||||||||||||
| 265 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 266 | - | |||||||||||||||||||||||||
| 267 | j = 19 - i % 19; | - | ||||||||||||||||||||||||
| 268 | if (j == 19
| 2-42 | ||||||||||||||||||||||||
| 269 | j = 0; executed 2 times by 1 test: j = 0;Executed by:
| 2 | ||||||||||||||||||||||||
| 270 | l = 0; | - | ||||||||||||||||||||||||
| 271 | while (--
| 44-1086 | ||||||||||||||||||||||||
| 272 | l *= 10; | - | ||||||||||||||||||||||||
| 273 | l += *a - '0'; | - | ||||||||||||||||||||||||
| 274 | a++; | - | ||||||||||||||||||||||||
| 275 | if (++
| 89-997 | ||||||||||||||||||||||||
| 276 | if (!BN_mul_word(ret, (10000000000000000000UL))
| 0-89 | ||||||||||||||||||||||||
| 277 | || !BN_add_word(ret, l)
| 0-89 | ||||||||||||||||||||||||
| 278 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 279 | l = 0; | - | ||||||||||||||||||||||||
| 280 | j = 0; | - | ||||||||||||||||||||||||
| 281 | } executed 89 times by 1 test: end of blockExecuted by:
| 89 | ||||||||||||||||||||||||
| 282 | } executed 1086 times by 1 test: end of blockExecuted by:
| 1086 | ||||||||||||||||||||||||
| 283 | - | |||||||||||||||||||||||||
| 284 | bn_correct_top(ret); | - | ||||||||||||||||||||||||
| 285 | *bn = ret; | - | ||||||||||||||||||||||||
| 286 | ; | - | ||||||||||||||||||||||||
| 287 | - | |||||||||||||||||||||||||
| 288 | if (ret->top != 0
| 8-36 | ||||||||||||||||||||||||
| 289 | ret->neg = neg; executed 36 times by 1 test: ret->neg = neg;Executed by:
| 36 | ||||||||||||||||||||||||
| 290 | return executed 44 times by 1 test: num;return num;Executed by:
executed 44 times by 1 test: return num;Executed by:
| 44 | ||||||||||||||||||||||||
| 291 | err: | - | ||||||||||||||||||||||||
| 292 | if (*
| 0 | ||||||||||||||||||||||||
| 293 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 294 | ) | - | ||||||||||||||||||||||||
| 295 | BN_free(ret); never executed: BN_free(ret); | 0 | ||||||||||||||||||||||||
| 296 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 297 | } | - | ||||||||||||||||||||||||
| 298 | - | |||||||||||||||||||||||||
| 299 | int BN_asc2bn(BIGNUM **bn, const char *a) | - | ||||||||||||||||||||||||
| 300 | { | - | ||||||||||||||||||||||||
| 301 | const char *p = a; | - | ||||||||||||||||||||||||
| 302 | - | |||||||||||||||||||||||||
| 303 | if (*
| 5-9 | ||||||||||||||||||||||||
| 304 | p++; executed 5 times by 1 test: p++;Executed by:
| 5 | ||||||||||||||||||||||||
| 305 | - | |||||||||||||||||||||||||
| 306 | if (p[0] == '0'
| 1-8 | ||||||||||||||||||||||||
| 307 | if (!BN_hex2bn(bn, p + 2)
| 0-3 | ||||||||||||||||||||||||
| 308 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 309 | } executed 3 times by 1 test: else {end of blockExecuted by:
| 3 | ||||||||||||||||||||||||
| 310 | if (!BN_dec2bn(bn, p)
| 0-11 | ||||||||||||||||||||||||
| 311 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 312 | } executed 11 times by 1 test: end of blockExecuted by:
| 11 | ||||||||||||||||||||||||
| 313 | - | |||||||||||||||||||||||||
| 314 | if (*
| 1-9 | ||||||||||||||||||||||||
| 315 | (* executed 4 times by 1 test: bn)->neg = 1;(*bn)->neg = 1;Executed by:
executed 4 times by 1 test: (*bn)->neg = 1;Executed by:
| 4 | ||||||||||||||||||||||||
| 316 | return executed 14 times by 1 test: 1;return 1;Executed by:
executed 14 times by 1 test: return 1;Executed by:
| 14 | ||||||||||||||||||||||||
| 317 | } | - | ||||||||||||||||||||||||
| 318 | - | |||||||||||||||||||||||||
| 319 | - | |||||||||||||||||||||||||
| 320 | int BN_print_fp(FILE *fp, const BIGNUM *a) | - | ||||||||||||||||||||||||
| 321 | { | - | ||||||||||||||||||||||||
| 322 | BIO *b; | - | ||||||||||||||||||||||||
| 323 | int ret; | - | ||||||||||||||||||||||||
| 324 | - | |||||||||||||||||||||||||
| 325 | if ((
| 0 | ||||||||||||||||||||||||
| 326 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 327 | ) | - | ||||||||||||||||||||||||
| 328 | return never executed: 0;return 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: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||||||||
| 333 | } | - | ||||||||||||||||||||||||
| 334 | - | |||||||||||||||||||||||||
| 335 | - | |||||||||||||||||||||||||
| 336 | int BN_print(BIO *bp, const BIGNUM *a) | - | ||||||||||||||||||||||||
| 337 | { | - | ||||||||||||||||||||||||
| 338 | int i, j, v, z = 0; | - | ||||||||||||||||||||||||
| 339 | int ret = 0; | - | ||||||||||||||||||||||||
| 340 | - | |||||||||||||||||||||||||
| 341 | if ((
| 0-11205 | ||||||||||||||||||||||||
| 342 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 343 | if (BN_is_zero(a)
| 0-10874 | ||||||||||||||||||||||||
| 344 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 345 | for (i = a->top - 1; i >= 0
| 11205-30388 | ||||||||||||||||||||||||
| 346 | for (j = (8 * 8) - 4; j >= 0
| 30388-486208 | ||||||||||||||||||||||||
| 347 | - | |||||||||||||||||||||||||
| 348 | v = (int)((a->d[i] >> j) & 0x0f); | - | ||||||||||||||||||||||||
| 349 | if (z
| 10874-346049 | ||||||||||||||||||||||||
| 350 | if (BIO_write(bp, &Hex[v], 1) != 1
| 0-356923 | ||||||||||||||||||||||||
| 351 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 352 | z = 1; | - | ||||||||||||||||||||||||
| 353 | } executed 356923 times by 1 test: end of blockExecuted by:
| 356923 | ||||||||||||||||||||||||
| 354 | } executed 486208 times by 1 test: end of blockExecuted by:
| 486208 | ||||||||||||||||||||||||
| 355 | } executed 30388 times by 1 test: end of blockExecuted by:
| 30388 | ||||||||||||||||||||||||
| 356 | ret = 1; | - | ||||||||||||||||||||||||
| 357 | end: code before this statement executed 11205 times by 1 test: end:Executed by:
| 11205 | ||||||||||||||||||||||||
| 358 | return executed 11205 times by 1 test: ret;return ret;Executed by:
executed 11205 times by 1 test: return ret;Executed by:
| 11205 | ||||||||||||||||||||||||
| 359 | } | - | ||||||||||||||||||||||||
| 360 | - | |||||||||||||||||||||||||
| 361 | char *BN_options(void) | - | ||||||||||||||||||||||||
| 362 | { | - | ||||||||||||||||||||||||
| 363 | static int init = 0; | - | ||||||||||||||||||||||||
| 364 | static char data[16]; | - | ||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||
| 366 | if (!init
| 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: data;return data;never executed: return data; | 0 | ||||||||||||||||||||||||
| 377 | } | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |