| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/ec/ec_mult.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | typedef struct ec_pre_comp_st { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | const EC_GROUP *group; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | size_t blocksize; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | size_t numblocks; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | size_t w; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | EC_POINT **points; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | size_t num; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | int references; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | } EC_PRE_COMP; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | static void *ec_pre_comp_dup(void *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | static void ec_pre_comp_free(void *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | static void ec_pre_comp_clear_free(void *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | static EC_PRE_COMP * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | ec_pre_comp_new(const EC_GROUP * group) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | EC_PRE_COMP *ret = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | if (!group
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | ret = malloc(sizeof(EC_PRE_COMP)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | if (!ret
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | ERR_put_error(16,(0xfff),((1|64)),__FILE__,110); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | ret->group = group; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | ret->blocksize = 8; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | ret->numblocks = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | ret->w = 4; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | ret->points = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | ret->num = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | ret->references = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | return executed 10 times by 1 test: ret;return ret;Executed by:
executed 10 times by 1 test: return ret;Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | static void * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | ec_pre_comp_dup(void *src_) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | EC_PRE_COMP *src = src_; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | CRYPTO_add_lock(&src->references,1,36,__FILE__,130); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | return executed 10 times by 1 test: src_;return src_;Executed by:
executed 10 times by 1 test: return src_;Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | static void | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | ec_pre_comp_free(void *pre_) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | int i; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | EC_PRE_COMP *pre = pre_; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | if (!pre
| 10-20 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | return; executed 10 times by 1 test: return;Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | i = CRYPTO_add_lock(&pre->references,-1,36,__FILE__,144); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | if (i > 0
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | return; executed 10 times by 1 test: return;Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | if (pre->points
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | EC_POINT **p; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | for (p = pre->points; *
| 10-3360 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | ((void *)0)
| 10-3360 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | ; p++) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | EC_POINT_free(*p); executed 3360 times by 1 test: EC_POINT_free(*p);Executed by:
| 3360 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | free(pre->points); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | free(pre); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | static void | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | ec_pre_comp_clear_free(void *pre_) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | int i; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | EC_PRE_COMP *pre = pre_; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | if (!pre
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | i = CRYPTO_add_lock(&pre->references,-1,36,__FILE__,167); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | if (i > 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | if (pre->points
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | EC_POINT **p; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | for (p = pre->points; *
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | ; p++) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | EC_POINT_clear_free(*p); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | explicit_bzero(p, sizeof *p); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | free(pre->points); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | freezero(pre, sizeof *pre); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | static signed char * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | compute_wNAF(const BIGNUM * scalar, int w, size_t * ret_len) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | int window_val; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | int ok = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | signed char *r = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | int sign = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | int bit, next_bit, mask; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | size_t len = 0, j; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | if (((
| 0-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | r = malloc(1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | if (!r
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | ERR_put_error(16,(0xfff),((1|64)),__FILE__,207); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | r[0] = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | *ret_len = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | return never executed: r;return r;never executed: return r; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | if (w <= 0
| 0-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | ERR_put_error(16,(0xfff),((4|64)),__FILE__,217); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | bit = 1 << w; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | next_bit = bit << 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | mask = next_bit - 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | if (((
| 0-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | sign = -1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | if (scalar->d ==
| 0-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | ((void *)0)
| 0-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | || scalar->top == 0
| 0-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | ERR_put_error(16,(0xfff),((4|64)),__FILE__,228); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | len = BN_num_bits(scalar); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | r = malloc(len + 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | if (r ==
| 0-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | ((void *)0)
| 0-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | ERR_put_error(16,(0xfff),((1|64)),__FILE__,237); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | window_val = scalar->d[0] & mask; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | j = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | while ((
| 758-179936 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | int digit = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | if (window_val & 1
| 37782-160270 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | if (window_val & bit
| 18642-19140 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | digit = window_val - next_bit; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | if (j + w + 1 >= len
| 166-18476 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | digit = window_val & (mask >> 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } executed 166 times by 1 test: end of blockExecuted by:
| 166 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } executed 18642 times by 1 test: else {end of blockExecuted by:
| 18642 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | digit = window_val; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } executed 19140 times by 1 test: end of blockExecuted by:
| 19140 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | if (digit <= -bit
| 0-37782 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | ERR_put_error(16,(0xfff),((4|64)),__FILE__,271); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | window_val -= digit; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | if (window_val != 0
| 0-19140 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | ERR_put_error(16,(0xfff),((4|64)),__FILE__,282); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | } executed 37782 times by 1 test: end of blockExecuted by:
| 37782 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | r[j++] = sign * digit; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | window_val >>= 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | window_val += bit * BN_is_bit_set(scalar, j + w); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | if (window_val > next_bit
| 0-198052 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | ERR_put_error(16,(0xfff),((4|64)),__FILE__,292); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } executed 198052 times by 1 test: end of blockExecuted by:
| 198052 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | if (j > len + 1
| 0-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | ERR_put_error(16,(0xfff),((4|64)),__FILE__,298); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | len = j; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | ok = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | err: code before this statement executed 758 times by 1 test: err:Executed by:
| 758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | if (!ok
| 0-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | free(r); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | r = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | if (ok
| 0-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | * executed 758 times by 1 test: ret_len = len;*ret_len = len;Executed by:
executed 758 times by 1 test: *ret_len = len;Executed by:
| 758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | return executed 758 times by 1 test: r;return r;Executed by:
executed 758 times by 1 test: return r;Executed by:
| 758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | ec_wNAF_mul(const EC_GROUP * group, EC_POINT * r, const BIGNUM * scalar, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | size_t num, const EC_POINT * points[], const BIGNUM * scalars[], BN_CTX * ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | const EC_POINT *generator = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | EC_POINT *tmp = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | size_t totalnum; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | size_t blocksize = 0, numblocks = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | size_t pre_points_per_block = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | size_t i, j; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | int k; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | int r_is_inverted = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | int r_is_at_infinity = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | size_t *wsize = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | signed char **wNAF = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | signed char *tmp_wNAF = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | size_t *wNAF_len = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | size_t max_len = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | size_t num_val; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | EC_POINT **val = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | EC_POINT **v; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | EC_POINT ***val_sub = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | const EC_PRE_COMP *pre_comp = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | int num_scalar = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | int ret = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | if (group->meth != r->meth
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | ERR_put_error(16,(0xfff),(101),__FILE__,365); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | if ((
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | ((void *)0)
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | )
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | return never executed: EC_POINT_set_to_infinity(group, r);return EC_POINT_set_to_infinity(group, r);never executed: return EC_POINT_set_to_infinity(group, r); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | for (i = 0; i < num
| 379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | if (group->meth != points[i]->meth
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | ERR_put_error(16,(0xfff),(101),__FILE__,373); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | } executed 379 times by 1 test: end of blockExecuted by:
| 379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | if (ctx ==
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | ((void *)0)
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | ctx = new_ctx = BN_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | if (ctx ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | if (scalar !=
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | ((void *)0)
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | generator = EC_GROUP_get0_generator(group); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | if (generator ==
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | ((void *)0)
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | ERR_put_error(16,(0xfff),(113),__FILE__,386); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | pre_comp = EC_EX_DATA_get_data(group->extra_data, ec_pre_comp_dup, ec_pre_comp_free, ec_pre_comp_clear_free); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | if (pre_comp
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | (
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | blocksize = pre_comp->blocksize; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | numblocks = (BN_num_bits(scalar) / blocksize) + 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | if (numblocks > pre_comp->numblocks
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | numblocks = pre_comp->numblocks; never executed: numblocks = pre_comp->numblocks; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | pre_points_per_block = (size_t) 1 << (pre_comp->w - 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | if (pre_comp->num != (pre_comp->numblocks * pre_points_per_block)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | ERR_put_error(16,(0xfff),((4|64)),__FILE__,415); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | pre_comp = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | numblocks = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | num_scalar = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } executed 379 times by 1 test: end of blockExecuted by:
| 379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | totalnum = num + numblocks; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | wNAF = reallocarray( | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | , (totalnum + 1), sizeof wNAF[0]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | if (wNAF ==
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | ((void *)0)
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | ERR_put_error(16,(0xfff),((1|64)),__FILE__,431); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | wNAF[0] = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | wsize = reallocarray( | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | , totalnum, sizeof wsize[0]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | wNAF_len = reallocarray( | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | , totalnum, sizeof wNAF_len[0]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | val_sub = reallocarray( | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | , totalnum, sizeof val_sub[0]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | if (wsize ==
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | ((void *)0)
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | || wNAF_len ==
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | ((void *)0)
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | || val_sub ==
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | ((void *)0)
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | ERR_put_error(16,(0xfff),((1|64)),__FILE__,442); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | num_val = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | for (i = 0; i < num + num_scalar
| 379-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | size_t bits; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | bits = i < num
| 379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | wsize[i] = ((size_t) ((
| 0-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | num_val += (size_t) 1 << (wsize[i] - 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | wNAF[i + 1] = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | wNAF[i] = compute_wNAF((i < num ? scalars[i] : scalar), wsize[i], &wNAF_len[i]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | if (wNAF[i] ==
| 0-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | ((void *)0)
| 0-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | if (wNAF_len[i] > max_len
| 247-511 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | max_len = wNAF_len[i]; executed 511 times by 1 test: max_len = wNAF_len[i];Executed by:
| 511 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } executed 758 times by 1 test: end of blockExecuted by:
| 758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | if (numblocks
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | if (pre_comp ==
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | ((void *)0)
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | if (num_scalar != 1
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | ERR_put_error(16,(0xfff),((4|64)),__FILE__,468); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | } executed 379 times by 1 test: else {end of blockExecuted by:
| 379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | size_t tmp_len = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | if (num_scalar != 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | ERR_put_error(16,(0xfff),((4|64)),__FILE__,476); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | wsize[num] = pre_comp->w; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | tmp_wNAF = compute_wNAF(scalar, wsize[num], &tmp_len); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | if (tmp_wNAF ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | if (tmp_len <= max_len
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | numblocks = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | totalnum = num + 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | wNAF[num] = tmp_wNAF; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | tmp_wNAF = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | wNAF[num + 1] = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | wNAF_len[num] = tmp_len; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | if (tmp_len > max_len
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | max_len = tmp_len; never executed: max_len = tmp_len; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | val_sub[num] = pre_comp->points; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | signed char *pp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | EC_POINT **tmp_points; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | if (tmp_len < numblocks * blocksize
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | numblocks = (tmp_len + blocksize - 1) / blocksize; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | if (numblocks > pre_comp->numblocks
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | ERR_put_error(16,(0xfff),((4|64)),__FILE__,526); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | totalnum = num + numblocks; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | pp = tmp_wNAF; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | tmp_points = pre_comp->points; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | for (i = num; i < totalnum
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | if (i < totalnum - 1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | wNAF_len[i] = blocksize; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | if (tmp_len < blocksize
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | ERR_put_error(16,(0xfff),((4|64)),__FILE__,539); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | tmp_len -= blocksize; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | wNAF_len[i] = tmp_len; never executed: wNAF_len[i] = tmp_len; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | wNAF[i + 1] = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | wNAF[i] = malloc(wNAF_len[i]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | if (wNAF[i] ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | ERR_put_error(16,(0xfff),((1|64)),__FILE__,555); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | memcpy(wNAF[i], pp, wNAF_len[i]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | if (wNAF_len[i] > max_len
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | max_len = wNAF_len[i]; never executed: max_len = wNAF_len[i]; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | if (*
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | ERR_put_error(16,(0xfff),((4|64)),__FILE__,563); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | val_sub[i] = tmp_points; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | tmp_points += pre_points_per_block; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | pp += blocksize; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | val = reallocarray( | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | , (num_val + 1), sizeof val[0]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | if (val ==
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | ((void *)0)
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | ERR_put_error(16,(0xfff),((1|64)),__FILE__,581); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | val[num_val] = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | v = val; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | for (i = 0; i < num + num_scalar
| 379-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | val_sub[i] = v; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | for (j = 0; j < ((size_t) 1 << (wsize[i] - 1))
| 758-3712 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | *v = EC_POINT_new(group); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | if (*
| 0-3712 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | ((void *)0)
| 0-3712 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | v++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | } executed 3712 times by 1 test: end of blockExecuted by:
| 3712 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | } executed 758 times by 1 test: end of blockExecuted by:
| 758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | if (!(v == val + num_val)
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | ERR_put_error(16,(0xfff),((4|64)),__FILE__,598); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | if (!(tmp = EC_POINT_new(group))
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | for (i = 0; i < num + num_scalar
| 379-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | if (i < num
| 379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | if (!EC_POINT_copy(val_sub[i][0], points[i])
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | } executed 379 times by 1 test: else {end of blockExecuted by:
| 379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | if (!EC_POINT_copy(val_sub[i][0], generator)
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } executed 379 times by 1 test: end of blockExecuted by:
| 379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | if (wsize[i] > 1
| 0-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | if (!EC_POINT_dbl(group, tmp, val_sub[i][0], ctx)
| 0-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | for (j = 1; j < ((size_t) 1 << (wsize[i] - 1))
| 758-2954 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | if (!EC_POINT_add(group, val_sub[i][j], val_sub[i][j - 1], tmp, ctx)
| 0-2954 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | } executed 2954 times by 1 test: end of blockExecuted by:
| 2954 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | } executed 758 times by 1 test: end of blockExecuted by:
| 758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | } executed 758 times by 1 test: end of blockExecuted by:
| 758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | if (!EC_POINTs_make_affine(group, num_val, val, ctx)
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | r_is_at_infinity = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | for (k = max_len - 1; k >= 0
| 379-99325 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | if (!r_is_at_infinity
| 379-98946 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | if (!EC_POINT_dbl(group, r, r, ctx)
| 0-98946 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | } executed 98946 times by 1 test: end of blockExecuted by:
| 98946 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | for (i = 0; i < totalnum
| 99325-198650 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | if (wNAF_len[i] > (size_t) k
| 598-198052 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | int digit = wNAF[i][k]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | int is_neg; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | if (digit
| 37782-160270 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | is_neg = digit < 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | if (is_neg
| 18476-19306 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | digit = -digit; executed 18476 times by 1 test: digit = -digit;Executed by:
| 18476 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | if (is_neg != r_is_inverted
| 18360-19422 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | if (!r_is_at_infinity
| 0-18360 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | if (!EC_POINT_invert(group, r, ctx)
| 0-18360 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | } executed 18360 times by 1 test: end of blockExecuted by:
| 18360 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | r_is_inverted = !r_is_inverted; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | } executed 18360 times by 1 test: end of blockExecuted by:
| 18360 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | if (r_is_at_infinity
| 379-37403 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | if (!EC_POINT_copy(r, val_sub[i][digit >> 1])
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | r_is_at_infinity = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | } executed 379 times by 1 test: else {end of blockExecuted by:
| 379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | if (!EC_POINT_add(group, r, r, val_sub[i][digit >> 1], ctx)
| 0-37403 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | } executed 37403 times by 1 test: end of blockExecuted by:
| 37403 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } executed 198052 times by 1 test: end of blockExecuted by:
| 198052 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | } executed 198650 times by 1 test: end of blockExecuted by:
| 198650 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | } executed 99325 times by 1 test: end of blockExecuted by:
| 99325 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | if (r_is_at_infinity
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | if (!EC_POINT_set_to_infinity(group, r)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | if (r_is_inverted
| 175-204 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | if (!EC_POINT_invert(group, r, ctx)
| 0-204 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | } executed 379 times by 1 test: end of blockExecuted by:
| 379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | ret = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | err: code before this statement executed 379 times by 1 test: err:Executed by:
| 379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | EC_POINT_free(tmp); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | free(wsize); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | free(wNAF_len); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | free(tmp_wNAF); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | if (wNAF !=
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | ((void *)0)
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | signed char **w; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | for (w = wNAF; *
| 379-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | ((void *)0)
| 379-758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | ; w++) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | free(*w); executed 758 times by 1 test: free(*w);Executed by:
| 758 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | free(wNAF); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | } executed 379 times by 1 test: end of blockExecuted by:
| 379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | if (val !=
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | ((void *)0)
| 0-379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | for (v = val; *
| 379-3712 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | ((void *)0)
| 379-3712 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | ; v++) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | EC_POINT_clear_free(*v); executed 3712 times by 1 test: EC_POINT_clear_free(*v);Executed by:
| 3712 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | free(val); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | } executed 379 times by 1 test: end of blockExecuted by:
| 379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | free(val_sub); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | return executed 379 times by 1 test: ret;return ret;Executed by:
executed 379 times by 1 test: return ret;Executed by:
| 379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | ec_wNAF_precompute_mult(EC_GROUP * group, BN_CTX * ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | const EC_POINT *generator; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | EC_POINT *tmp_point = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | , *base = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | , **var; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | BIGNUM *order; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | size_t i, bits, w, pre_points_per_block, blocksize, numblocks, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | num; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | EC_POINT **points = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | EC_PRE_COMP *pre_comp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | int ret = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | EC_EX_DATA_free_data(&group->extra_data, ec_pre_comp_dup, ec_pre_comp_free, ec_pre_comp_clear_free); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | if ((
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | ((void *)0)
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | generator = EC_GROUP_get0_generator(group); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | if (generator ==
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | ((void *)0)
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | ERR_put_error(16,(0xfff),(113),__FILE__,745); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | if (ctx ==
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | ((void *)0)
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | ctx = new_ctx = BN_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | if (ctx ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | if ((
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | ((void *)0)
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | if (!EC_GROUP_get_order(group, order, ctx)
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | if (((
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | ERR_put_error(16,(0xfff),(114),__FILE__,760); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | bits = BN_num_bits(order); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | blocksize = 8; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | w = 4; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | if (((
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | w = ((size_t) ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | numblocks = (bits + blocksize - 1) / blocksize; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | pre_points_per_block = (size_t) 1 << (w - 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | num = pre_points_per_block * numblocks; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | points = reallocarray( | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | , (num + 1), sizeof(EC_POINT *)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | if (!points
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | ERR_put_error(16,(0xfff),((1|64)),__FILE__,788); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | var = points; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | var[num] = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | for (i = 0; i < num
| 10-3360 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | if ((
| 0-3360 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | ((void *)0)
| 0-3360 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | ERR_put_error(16,(0xfff),((1|64)),__FILE__,795); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | } executed 3360 times by 1 test: end of blockExecuted by:
| 3360 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | if (!(tmp_point = EC_POINT_new(group))
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | ERR_put_error(16,(0xfff),((1|64)),__FILE__,801); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | if (!EC_POINT_copy(base, generator)
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | for (i = 0; i < numblocks
| 10-420 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | size_t j; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | if (!EC_POINT_dbl(group, tmp_point, base, ctx)
| 0-420 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | if (!EC_POINT_copy(*var++, base)
| 0-420 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | for (j = 1; j < pre_points_per_block
| 420-2940 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | if (!EC_POINT_add(group, *var, tmp_point, *(var - 1), ctx)
| 0-2940 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | } executed 2940 times by 1 test: end of blockExecuted by:
| 2940 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | if (i < numblocks - 1
| 10-410 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | size_t k; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | if (blocksize <= 2
| 0-410 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | ERR_put_error(16,(0xfff),((4|64)),__FILE__,831); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | if (!EC_POINT_dbl(group, base, tmp_point, ctx)
| 0-410 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | for (k = 2; k < blocksize
| 410-2460 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | if (!EC_POINT_dbl(group, base, base, ctx)
| 0-2460 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | } executed 2460 times by 1 test: end of blockExecuted by:
| 2460 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | } executed 410 times by 1 test: end of blockExecuted by:
| 410 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | } executed 420 times by 1 test: end of blockExecuted by:
| 420 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | if (!EC_POINTs_make_affine(group, num, points, ctx)
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | pre_comp->group = group; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | pre_comp->blocksize = blocksize; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | pre_comp->numblocks = numblocks; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | pre_comp->w = w; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | pre_comp->points = points; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | points = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | pre_comp->num = num; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | if (!EC_EX_DATA_set_data(&group->extra_data, pre_comp,
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | ec_pre_comp_dup, ec_pre_comp_free, ec_pre_comp_clear_free)
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | pre_comp = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | ret = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | err: code before this statement executed 10 times by 1 test: err:Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | if (ctx !=
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | ((void *)0)
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | BN_CTX_end(ctx); executed 10 times by 1 test: BN_CTX_end(ctx);Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | ec_pre_comp_free(pre_comp); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | if (points
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | EC_POINT **p; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | for (p = points; *
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | ; p++) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | EC_POINT_free(*p); never executed: EC_POINT_free(*p); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | free(points); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | EC_POINT_free(tmp_point); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | EC_POINT_free(base); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | return executed 10 times by 1 test: ret;return ret;Executed by:
executed 10 times by 1 test: return ret;Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | ec_wNAF_have_precompute_mult(const EC_GROUP * group) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | if (EC_EX_DATA_get_data(group->extra_data, ec_pre_comp_dup, ec_pre_comp_free, ec_pre_comp_clear_free) !=
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |