| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/bn/bn_blind.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | struct bn_blinding_st { | - | ||||||||||||||||||
| 8 | BIGNUM *A; | - | ||||||||||||||||||
| 9 | BIGNUM *Ai; | - | ||||||||||||||||||
| 10 | BIGNUM *e; | - | ||||||||||||||||||
| 11 | BIGNUM *mod; | - | ||||||||||||||||||
| 12 | - | |||||||||||||||||||
| 13 | unsigned long thread_id; | - | ||||||||||||||||||
| 14 | - | |||||||||||||||||||
| 15 | - | |||||||||||||||||||
| 16 | CRYPTO_THREADID tid; | - | ||||||||||||||||||
| 17 | int counter; | - | ||||||||||||||||||
| 18 | unsigned long flags; | - | ||||||||||||||||||
| 19 | BN_MONT_CTX *m_ctx; | - | ||||||||||||||||||
| 20 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | - | ||||||||||||||||||
| 21 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | - | ||||||||||||||||||
| 22 | }; | - | ||||||||||||||||||
| 23 | - | |||||||||||||||||||
| 24 | BN_BLINDING * | - | ||||||||||||||||||
| 25 | BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod) | - | ||||||||||||||||||
| 26 | { | - | ||||||||||||||||||
| 27 | BN_BLINDING *ret = | - | ||||||||||||||||||
| 28 | ((void *)0) | - | ||||||||||||||||||
| 29 | ; | - | ||||||||||||||||||
| 30 | - | |||||||||||||||||||
| 31 | ; | - | ||||||||||||||||||
| 32 | - | |||||||||||||||||||
| 33 | if ((
| 0-67 | ||||||||||||||||||
| 34 | ((void *)0)
| 0-67 | ||||||||||||||||||
| 35 | ) { | - | ||||||||||||||||||
| 36 | ERR_put_error(3,(0xfff),((1|64)),__FILE__,147); | - | ||||||||||||||||||
| 37 | return never executed: (return ( ((void *)0) );never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||
| 38 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||
| 39 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||
| 40 | } | - | ||||||||||||||||||
| 41 | if (A !=
| 0-67 | ||||||||||||||||||
| 42 | ((void *)0)
| 0-67 | ||||||||||||||||||
| 43 | ) { | - | ||||||||||||||||||
| 44 | if ((
| 0 | ||||||||||||||||||
| 45 | ((void *)0)
| 0 | ||||||||||||||||||
| 46 | ) | - | ||||||||||||||||||
| 47 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 48 | } never executed: end of block | 0 | ||||||||||||||||||
| 49 | if (Ai !=
| 0-67 | ||||||||||||||||||
| 50 | ((void *)0)
| 0-67 | ||||||||||||||||||
| 51 | ) { | - | ||||||||||||||||||
| 52 | if ((
| 0 | ||||||||||||||||||
| 53 | ((void *)0)
| 0 | ||||||||||||||||||
| 54 | ) | - | ||||||||||||||||||
| 55 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 56 | } never executed: end of block | 0 | ||||||||||||||||||
| 57 | - | |||||||||||||||||||
| 58 | - | |||||||||||||||||||
| 59 | if ((
| 0-67 | ||||||||||||||||||
| 60 | ((void *)0)
| 0-67 | ||||||||||||||||||
| 61 | ) | - | ||||||||||||||||||
| 62 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 63 | if (((
| 0-67 | ||||||||||||||||||
| 64 | (( executed 67 times by 6 tests: ret->mod)->flags|=(0x04));((ret->mod)->flags|=(0x04));Executed by:
executed 67 times by 6 tests: ((ret->mod)->flags|=(0x04));Executed by:
| 67 | ||||||||||||||||||
| 65 | - | |||||||||||||||||||
| 66 | - | |||||||||||||||||||
| 67 | - | |||||||||||||||||||
| 68 | - | |||||||||||||||||||
| 69 | ret->counter = -1; | - | ||||||||||||||||||
| 70 | CRYPTO_THREADID_current(&ret->tid); | - | ||||||||||||||||||
| 71 | return executed 67 times by 6 tests: (ret);return (ret);Executed by:
executed 67 times by 6 tests: return (ret);Executed by:
| 67 | ||||||||||||||||||
| 72 | - | |||||||||||||||||||
| 73 | err: | - | ||||||||||||||||||
| 74 | if (ret !=
| 0 | ||||||||||||||||||
| 75 | ((void *)0)
| 0 | ||||||||||||||||||
| 76 | ) | - | ||||||||||||||||||
| 77 | BN_BLINDING_free(ret); never executed: BN_BLINDING_free(ret); | 0 | ||||||||||||||||||
| 78 | return never executed: (return ( ((void *)0) );never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||
| 79 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||
| 80 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||
| 81 | } | - | ||||||||||||||||||
| 82 | - | |||||||||||||||||||
| 83 | void | - | ||||||||||||||||||
| 84 | BN_BLINDING_free(BN_BLINDING *r) | - | ||||||||||||||||||
| 85 | { | - | ||||||||||||||||||
| 86 | if (r ==
| 66-443 | ||||||||||||||||||
| 87 | ((void *)0)
| 66-443 | ||||||||||||||||||
| 88 | ) | - | ||||||||||||||||||
| 89 | return; executed 443 times by 6 tests: return;Executed by:
| 443 | ||||||||||||||||||
| 90 | - | |||||||||||||||||||
| 91 | BN_clear_free(r->A); | - | ||||||||||||||||||
| 92 | BN_clear_free(r->Ai); | - | ||||||||||||||||||
| 93 | BN_clear_free(r->e); | - | ||||||||||||||||||
| 94 | BN_clear_free(r->mod); | - | ||||||||||||||||||
| 95 | free(r); | - | ||||||||||||||||||
| 96 | } executed 66 times by 5 tests: end of blockExecuted by:
| 66 | ||||||||||||||||||
| 97 | - | |||||||||||||||||||
| 98 | int | - | ||||||||||||||||||
| 99 | BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx) | - | ||||||||||||||||||
| 100 | { | - | ||||||||||||||||||
| 101 | int ret = 0; | - | ||||||||||||||||||
| 102 | - | |||||||||||||||||||
| 103 | if ((
| 0-492 | ||||||||||||||||||
| 104 | ((void *)0)
| 0-492 | ||||||||||||||||||
| 105 | )
| 0-492 | ||||||||||||||||||
| 106 | ((void *)0)
| 0-492 | ||||||||||||||||||
| 107 | )
| 0-492 | ||||||||||||||||||
| 108 | ERR_put_error(3,(0xfff),(107),__FILE__,197); | - | ||||||||||||||||||
| 109 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 110 | } | - | ||||||||||||||||||
| 111 | - | |||||||||||||||||||
| 112 | if (b->counter == -1
| 0-492 | ||||||||||||||||||
| 113 | b->counter = 0; never executed: b->counter = 0; | 0 | ||||||||||||||||||
| 114 | - | |||||||||||||||||||
| 115 | if (++
| 0-477 | ||||||||||||||||||
| 116 | ((void *)0)
| 0-15 | ||||||||||||||||||
| 117 | && | - | ||||||||||||||||||
| 118 | !(b->flags & 0x00000002)
| 0-15 | ||||||||||||||||||
| 119 | - | |||||||||||||||||||
| 120 | if (!BN_BLINDING_create_param(b,
| 0-15 | ||||||||||||||||||
| 121 | ((void *)0)
| 0-15 | ||||||||||||||||||
| 122 | ,
| 0-15 | ||||||||||||||||||
| 123 | ((void *)0)
| 0-15 | ||||||||||||||||||
| 124 | , ctx,
| 0-15 | ||||||||||||||||||
| 125 | ((void *)0)
| 0-15 | ||||||||||||||||||
| 126 | ,
| 0-15 | ||||||||||||||||||
| 127 | ((void *)0)
| 0-15 | ||||||||||||||||||
| 128 | )
| 0-15 | ||||||||||||||||||
| 129 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 130 | } executed 15 times by 1 test: else if (!(b->flags & 0x00000001)end of blockExecuted by:
| 0-477 | ||||||||||||||||||
| 131 | if (!BN_mod_mul(b->A, b->A, b->A, b->mod, ctx)
| 0-477 | ||||||||||||||||||
| 132 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 133 | if (!BN_mod_mul(b->Ai, b->Ai, b->Ai, b->mod, ctx)
| 0-477 | ||||||||||||||||||
| 134 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 135 | } executed 477 times by 2 tests: end of blockExecuted by:
| 477 | ||||||||||||||||||
| 136 | - | |||||||||||||||||||
| 137 | ret = 1; | - | ||||||||||||||||||
| 138 | - | |||||||||||||||||||
| 139 | err: code before this statement executed 492 times by 2 tests: err:Executed by:
| 492 | ||||||||||||||||||
| 140 | if (b->counter == 32
| 15-477 | ||||||||||||||||||
| 141 | b->counter = 0; executed 15 times by 1 test: b->counter = 0;Executed by:
| 15 | ||||||||||||||||||
| 142 | return executed 492 times by 2 tests: (ret);return (ret);Executed by:
executed 492 times by 2 tests: return (ret);Executed by:
| 492 | ||||||||||||||||||
| 143 | } | - | ||||||||||||||||||
| 144 | - | |||||||||||||||||||
| 145 | int | - | ||||||||||||||||||
| 146 | BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx) | - | ||||||||||||||||||
| 147 | { | - | ||||||||||||||||||
| 148 | return never executed: BN_BLINDING_convert_ex(n, return BN_BLINDING_convert_ex(n, ((void *)0) , b, ctx);never executed: return BN_BLINDING_convert_ex(n, ((void *)0) , b, ctx); | 0 | ||||||||||||||||||
| 149 | ((void *)0) never executed: return BN_BLINDING_convert_ex(n, ((void *)0) , b, ctx); | 0 | ||||||||||||||||||
| 150 | , b, ctx); never executed: return BN_BLINDING_convert_ex(n, ((void *)0) , b, ctx); | 0 | ||||||||||||||||||
| 151 | } | - | ||||||||||||||||||
| 152 | - | |||||||||||||||||||
| 153 | int | - | ||||||||||||||||||
| 154 | BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx) | - | ||||||||||||||||||
| 155 | { | - | ||||||||||||||||||
| 156 | int ret = 1; | - | ||||||||||||||||||
| 157 | - | |||||||||||||||||||
| 158 | ; | - | ||||||||||||||||||
| 159 | - | |||||||||||||||||||
| 160 | if ((
| 0-559 | ||||||||||||||||||
| 161 | ((void *)0)
| 0-559 | ||||||||||||||||||
| 162 | )
| 0-559 | ||||||||||||||||||
| 163 | ((void *)0)
| 0-559 | ||||||||||||||||||
| 164 | )
| 0-559 | ||||||||||||||||||
| 165 | ERR_put_error(3,(0xfff),(107),__FILE__,238); | - | ||||||||||||||||||
| 166 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||||||||
| 167 | } | - | ||||||||||||||||||
| 168 | - | |||||||||||||||||||
| 169 | if (b->counter == -1
| 67-492 | ||||||||||||||||||
| 170 | - | |||||||||||||||||||
| 171 | b->counter = 0; executed 67 times by 6 tests: b->counter = 0;Executed by:
| 67 | ||||||||||||||||||
| 172 | else if (!BN_BLINDING_update(b, ctx)
| 0-492 | ||||||||||||||||||
| 173 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||||||||
| 174 | - | |||||||||||||||||||
| 175 | if (r !=
| 0-559 | ||||||||||||||||||
| 176 | ((void *)0)
| 0-559 | ||||||||||||||||||
| 177 | ) { | - | ||||||||||||||||||
| 178 | if (!BN_copy(r, b->Ai)
| 0 | ||||||||||||||||||
| 179 | ret = 0; never executed: ret = 0; | 0 | ||||||||||||||||||
| 180 | } never executed: end of block | 0 | ||||||||||||||||||
| 181 | - | |||||||||||||||||||
| 182 | if (!BN_mod_mul(n, n,b->A, b->mod, ctx)
| 0-559 | ||||||||||||||||||
| 183 | ret = 0; never executed: ret = 0; | 0 | ||||||||||||||||||
| 184 | - | |||||||||||||||||||
| 185 | return executed 559 times by 6 tests: ret;return ret;Executed by:
executed 559 times by 6 tests: return ret;Executed by:
| 559 | ||||||||||||||||||
| 186 | } | - | ||||||||||||||||||
| 187 | - | |||||||||||||||||||
| 188 | int | - | ||||||||||||||||||
| 189 | BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx) | - | ||||||||||||||||||
| 190 | { | - | ||||||||||||||||||
| 191 | return never executed: BN_BLINDING_invert_ex(n, return BN_BLINDING_invert_ex(n, ((void *)0) , b, ctx);never executed: return BN_BLINDING_invert_ex(n, ((void *)0) , b, ctx); | 0 | ||||||||||||||||||
| 192 | ((void *)0) never executed: return BN_BLINDING_invert_ex(n, ((void *)0) , b, ctx); | 0 | ||||||||||||||||||
| 193 | , b, ctx); never executed: return BN_BLINDING_invert_ex(n, ((void *)0) , b, ctx); | 0 | ||||||||||||||||||
| 194 | } | - | ||||||||||||||||||
| 195 | - | |||||||||||||||||||
| 196 | int | - | ||||||||||||||||||
| 197 | BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx) | - | ||||||||||||||||||
| 198 | { | - | ||||||||||||||||||
| 199 | int ret; | - | ||||||||||||||||||
| 200 | - | |||||||||||||||||||
| 201 | ; | - | ||||||||||||||||||
| 202 | - | |||||||||||||||||||
| 203 | if (r !=
| 0-559 | ||||||||||||||||||
| 204 | ((void *)0)
| 0-559 | ||||||||||||||||||
| 205 | ) | - | ||||||||||||||||||
| 206 | ret = BN_mod_mul(n, n, r, b->mod, ctx); never executed: ret = BN_mod_mul(n, n, r, b->mod, ctx); | 0 | ||||||||||||||||||
| 207 | else { | - | ||||||||||||||||||
| 208 | if (b->Ai ==
| 0-559 | ||||||||||||||||||
| 209 | ((void *)0)
| 0-559 | ||||||||||||||||||
| 210 | ) { | - | ||||||||||||||||||
| 211 | ERR_put_error(3,(0xfff),(107),__FILE__,276); | - | ||||||||||||||||||
| 212 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||||||||
| 213 | } | - | ||||||||||||||||||
| 214 | ret = BN_mod_mul(n, n, b->Ai, b->mod, ctx); | - | ||||||||||||||||||
| 215 | } executed 559 times by 6 tests: end of blockExecuted by:
| 559 | ||||||||||||||||||
| 216 | - | |||||||||||||||||||
| 217 | ; | - | ||||||||||||||||||
| 218 | return executed 559 times by 6 tests: (ret);return (ret);Executed by:
executed 559 times by 6 tests: return (ret);Executed by:
| 559 | ||||||||||||||||||
| 219 | } | - | ||||||||||||||||||
| 220 | - | |||||||||||||||||||
| 221 | - | |||||||||||||||||||
| 222 | unsigned long | - | ||||||||||||||||||
| 223 | BN_BLINDING_get_thread_id(const BN_BLINDING *b) | - | ||||||||||||||||||
| 224 | { | - | ||||||||||||||||||
| 225 | return never executed: b->thread_id;return b->thread_id;never executed: return b->thread_id; | 0 | ||||||||||||||||||
| 226 | } | - | ||||||||||||||||||
| 227 | - | |||||||||||||||||||
| 228 | void | - | ||||||||||||||||||
| 229 | BN_BLINDING_set_thread_id(BN_BLINDING *b, unsigned long n) | - | ||||||||||||||||||
| 230 | { | - | ||||||||||||||||||
| 231 | b->thread_id = n; | - | ||||||||||||||||||
| 232 | } never executed: end of block | 0 | ||||||||||||||||||
| 233 | - | |||||||||||||||||||
| 234 | - | |||||||||||||||||||
| 235 | CRYPTO_THREADID * | - | ||||||||||||||||||
| 236 | BN_BLINDING_thread_id(BN_BLINDING *b) | - | ||||||||||||||||||
| 237 | { | - | ||||||||||||||||||
| 238 | return executed 626 times by 6 tests: &b->tid;return &b->tid;Executed by:
executed 626 times by 6 tests: return &b->tid;Executed by:
| 626 | ||||||||||||||||||
| 239 | } | - | ||||||||||||||||||
| 240 | - | |||||||||||||||||||
| 241 | unsigned long | - | ||||||||||||||||||
| 242 | BN_BLINDING_get_flags(const BN_BLINDING *b) | - | ||||||||||||||||||
| 243 | { | - | ||||||||||||||||||
| 244 | return never executed: b->flags;return b->flags;never executed: return b->flags; | 0 | ||||||||||||||||||
| 245 | } | - | ||||||||||||||||||
| 246 | - | |||||||||||||||||||
| 247 | void | - | ||||||||||||||||||
| 248 | BN_BLINDING_set_flags(BN_BLINDING *b, unsigned long flags) | - | ||||||||||||||||||
| 249 | { | - | ||||||||||||||||||
| 250 | b->flags = flags; | - | ||||||||||||||||||
| 251 | } never executed: end of block | 0 | ||||||||||||||||||
| 252 | - | |||||||||||||||||||
| 253 | BN_BLINDING * | - | ||||||||||||||||||
| 254 | BN_BLINDING_create_param(BN_BLINDING *b, const BIGNUM *e, BIGNUM *m, | - | ||||||||||||||||||
| 255 | BN_CTX *ctx, int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | - | ||||||||||||||||||
| 256 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), BN_MONT_CTX *m_ctx) | - | ||||||||||||||||||
| 257 | { | - | ||||||||||||||||||
| 258 | int retry_counter = 32; | - | ||||||||||||||||||
| 259 | BN_BLINDING *ret = | - | ||||||||||||||||||
| 260 | ((void *)0) | - | ||||||||||||||||||
| 261 | ; | - | ||||||||||||||||||
| 262 | - | |||||||||||||||||||
| 263 | if (b ==
| 15-67 | ||||||||||||||||||
| 264 | ((void *)0)
| 15-67 | ||||||||||||||||||
| 265 | ) | - | ||||||||||||||||||
| 266 | ret = BN_BLINDING_new( executed 67 times by 6 tests: ret = BN_BLINDING_new( ((void *)0) , ((void *)0) , m);Executed by:
| 67 | ||||||||||||||||||
| 267 | ((void *)0) executed 67 times by 6 tests: ret = BN_BLINDING_new( ((void *)0) , ((void *)0) , m);Executed by:
| 67 | ||||||||||||||||||
| 268 | , executed 67 times by 6 tests: ret = BN_BLINDING_new( ((void *)0) , ((void *)0) , m);Executed by:
| 67 | ||||||||||||||||||
| 269 | ((void *)0) executed 67 times by 6 tests: ret = BN_BLINDING_new( ((void *)0) , ((void *)0) , m);Executed by:
| 67 | ||||||||||||||||||
| 270 | , m); executed 67 times by 6 tests: ret = BN_BLINDING_new( ((void *)0) , ((void *)0) , m);Executed by:
| 67 | ||||||||||||||||||
| 271 | else | - | ||||||||||||||||||
| 272 | ret = b; executed 15 times by 1 test: ret = b;Executed by:
| 15 | ||||||||||||||||||
| 273 | - | |||||||||||||||||||
| 274 | if (ret ==
| 0-82 | ||||||||||||||||||
| 275 | ((void *)0)
| 0-82 | ||||||||||||||||||
| 276 | ) | - | ||||||||||||||||||
| 277 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 278 | - | |||||||||||||||||||
| 279 | if (ret->A ==
| 15-67 | ||||||||||||||||||
| 280 | ((void *)0)
| 15-67 | ||||||||||||||||||
| 281 | && (
| 0-67 | ||||||||||||||||||
| 282 | ((void *)0)
| 0-67 | ||||||||||||||||||
| 283 | ) | - | ||||||||||||||||||
| 284 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 285 | if (ret->Ai ==
| 15-67 | ||||||||||||||||||
| 286 | ((void *)0)
| 15-67 | ||||||||||||||||||
| 287 | && (
| 0-67 | ||||||||||||||||||
| 288 | ((void *)0)
| 0-67 | ||||||||||||||||||
| 289 | ) | - | ||||||||||||||||||
| 290 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 291 | - | |||||||||||||||||||
| 292 | if (e !=
| 15-67 | ||||||||||||||||||
| 293 | ((void *)0)
| 15-67 | ||||||||||||||||||
| 294 | ) { | - | ||||||||||||||||||
| 295 | BN_free(ret->e); | - | ||||||||||||||||||
| 296 | ret->e = BN_dup(e); | - | ||||||||||||||||||
| 297 | } executed 67 times by 6 tests: end of blockExecuted by:
| 67 | ||||||||||||||||||
| 298 | if (ret->e ==
| 0-82 | ||||||||||||||||||
| 299 | ((void *)0)
| 0-82 | ||||||||||||||||||
| 300 | ) | - | ||||||||||||||||||
| 301 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 302 | - | |||||||||||||||||||
| 303 | if (bn_mod_exp !=
| 15-67 | ||||||||||||||||||
| 304 | ((void *)0)
| 15-67 | ||||||||||||||||||
| 305 | ) | - | ||||||||||||||||||
| 306 | ret->bn_mod_exp = bn_mod_exp; executed 67 times by 6 tests: ret->bn_mod_exp = bn_mod_exp;Executed by:
| 67 | ||||||||||||||||||
| 307 | if (m_ctx !=
| 3-79 | ||||||||||||||||||
| 308 | ((void *)0)
| 3-79 | ||||||||||||||||||
| 309 | ) | - | ||||||||||||||||||
| 310 | ret->m_ctx = m_ctx; executed 3 times by 1 test: ret->m_ctx = m_ctx;Executed by:
| 3 | ||||||||||||||||||
| 311 | - | |||||||||||||||||||
| 312 | do { | - | ||||||||||||||||||
| 313 | if (!BN_rand_range(ret->A, ret->mod)
| 0-82 | ||||||||||||||||||
| 314 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 315 | if (BN_mod_inverse_ct(ret->Ai, ret->A, ret->mod, ctx) ==
| 0-82 | ||||||||||||||||||
| 316 | ((void *)0)
| 0-82 | ||||||||||||||||||
| 317 | ) { | - | ||||||||||||||||||
| 318 | - | |||||||||||||||||||
| 319 | unsigned long error = ERR_peek_last_error(); | - | ||||||||||||||||||
| 320 | if ((
| 0 | ||||||||||||||||||
| 321 | if (retry_counter-- == 0
| 0 | ||||||||||||||||||
| 322 | ERR_put_error(3,(0xfff),(113),__FILE__,359); | - | ||||||||||||||||||
| 323 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 324 | } | - | ||||||||||||||||||
| 325 | ERR_clear_error(); | - | ||||||||||||||||||
| 326 | } never executed: elseend of block | 0 | ||||||||||||||||||
| 327 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 328 | } else | - | ||||||||||||||||||
| 329 | break; executed 82 times by 6 tests: break;Executed by:
| 82 | ||||||||||||||||||
| 330 | } while (1); | - | ||||||||||||||||||
| 331 | - | |||||||||||||||||||
| 332 | if (ret->bn_mod_exp !=
| 0-82 | ||||||||||||||||||
| 333 | ((void *)0)
| 0-82 | ||||||||||||||||||
| 334 | && ret->m_ctx !=
| 18-64 | ||||||||||||||||||
| 335 | ((void *)0)
| 18-64 | ||||||||||||||||||
| 336 | ) { | - | ||||||||||||||||||
| 337 | if (!ret->bn_mod_exp(ret->A, ret->A, ret->e, ret->mod,
| 0-18 | ||||||||||||||||||
| 338 | ctx, ret->m_ctx)
| 0-18 | ||||||||||||||||||
| 339 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 340 | } executed 18 times by 1 test: else {end of blockExecuted by:
| 18 | ||||||||||||||||||
| 341 | if (!BN_mod_exp_ct(ret->A, ret->A, ret->e, ret->mod, ctx)
| 0-64 | ||||||||||||||||||
| 342 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 343 | } executed 64 times by 5 tests: end of blockExecuted by:
| 64 | ||||||||||||||||||
| 344 | - | |||||||||||||||||||
| 345 | return executed 82 times by 6 tests: ret;return ret;Executed by:
executed 82 times by 6 tests: return ret;Executed by:
| 82 | ||||||||||||||||||
| 346 | - | |||||||||||||||||||
| 347 | err: | - | ||||||||||||||||||
| 348 | if (b ==
| 0 | ||||||||||||||||||
| 349 | ((void *)0)
| 0 | ||||||||||||||||||
| 350 | && ret !=
| 0 | ||||||||||||||||||
| 351 | ((void *)0)
| 0 | ||||||||||||||||||
| 352 | ) { | - | ||||||||||||||||||
| 353 | BN_BLINDING_free(ret); | - | ||||||||||||||||||
| 354 | ret = | - | ||||||||||||||||||
| 355 | ((void *)0) | - | ||||||||||||||||||
| 356 | ; | - | ||||||||||||||||||
| 357 | } never executed: end of block | 0 | ||||||||||||||||||
| 358 | - | |||||||||||||||||||
| 359 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||
| 360 | } | - | ||||||||||||||||||
| Switch to Source code | Preprocessed file |