| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/ec/ec_lib.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | EC_GROUP *EC_GROUP_new(const EC_METHOD *meth) | - | ||||||||||||||||||||||||
| 8 | { | - | ||||||||||||||||||||||||
| 9 | EC_GROUP *ret; | - | ||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||
| 11 | if (meth ==
| 0-69938 | ||||||||||||||||||||||||
| 12 | ((void *)0)
| 0-69938 | ||||||||||||||||||||||||
| 13 | ) { | - | ||||||||||||||||||||||||
| 14 | ERR_put_error(16,(108),(108),__FILE__,25); | - | ||||||||||||||||||||||||
| 15 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 16 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 17 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 18 | } | - | ||||||||||||||||||||||||
| 19 | if (meth->group_init == 0
| 0-69938 | ||||||||||||||||||||||||
| 20 | ERR_put_error(16,(108),((2|64)),__FILE__,29); | - | ||||||||||||||||||||||||
| 21 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 22 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 23 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 24 | } | - | ||||||||||||||||||||||||
| 25 | - | |||||||||||||||||||||||||
| 26 | ret = CRYPTO_zalloc(sizeof(*ret), __FILE__, 33); | - | ||||||||||||||||||||||||
| 27 | if (ret ==
| 0-69938 | ||||||||||||||||||||||||
| 28 | ((void *)0)
| 0-69938 | ||||||||||||||||||||||||
| 29 | ) { | - | ||||||||||||||||||||||||
| 30 | ERR_put_error(16,(108),((1|64)),__FILE__,35); | - | ||||||||||||||||||||||||
| 31 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 32 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 33 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 34 | } | - | ||||||||||||||||||||||||
| 35 | - | |||||||||||||||||||||||||
| 36 | ret->meth = meth; | - | ||||||||||||||||||||||||
| 37 | if ((
| 0-69938 | ||||||||||||||||||||||||
| 38 | ret->order = BN_new(); | - | ||||||||||||||||||||||||
| 39 | if (ret->order ==
| 0-69938 | ||||||||||||||||||||||||
| 40 | ((void *)0)
| 0-69938 | ||||||||||||||||||||||||
| 41 | ) | - | ||||||||||||||||||||||||
| 42 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 43 | ret->cofactor = BN_new(); | - | ||||||||||||||||||||||||
| 44 | if (ret->cofactor ==
| 0-69938 | ||||||||||||||||||||||||
| 45 | ((void *)0)
| 0-69938 | ||||||||||||||||||||||||
| 46 | ) | - | ||||||||||||||||||||||||
| 47 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 48 | } executed 69938 times by 2 tests: end of blockExecuted by:
| 69938 | ||||||||||||||||||||||||
| 49 | ret->asn1_flag = 0x001; | - | ||||||||||||||||||||||||
| 50 | ret->asn1_form = POINT_CONVERSION_UNCOMPRESSED; | - | ||||||||||||||||||||||||
| 51 | if (!meth->group_init(ret)
| 0-69938 | ||||||||||||||||||||||||
| 52 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 53 | return executed 69938 times by 2 tests: ret;return ret;Executed by:
executed 69938 times by 2 tests: return ret;Executed by:
| 69938 | ||||||||||||||||||||||||
| 54 | - | |||||||||||||||||||||||||
| 55 | err: | - | ||||||||||||||||||||||||
| 56 | BN_free(ret->order); | - | ||||||||||||||||||||||||
| 57 | BN_free(ret->cofactor); | - | ||||||||||||||||||||||||
| 58 | CRYPTO_free(ret, __FILE__, 57); | - | ||||||||||||||||||||||||
| 59 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 60 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 61 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 62 | } | - | ||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||
| 64 | void EC_pre_comp_free(EC_GROUP *group) | - | ||||||||||||||||||||||||
| 65 | { | - | ||||||||||||||||||||||||
| 66 | switch (group->pre_comp_type) { | - | ||||||||||||||||||||||||
| 67 | case executed 69933 times by 2 tests: PCT_none:case PCT_none:Executed by:
executed 69933 times by 2 tests: case PCT_none:Executed by:
| 69933 | ||||||||||||||||||||||||
| 68 | break; executed 69933 times by 2 tests: break;Executed by:
| 69933 | ||||||||||||||||||||||||
| 69 | case never executed: PCT_nistz256:case PCT_nistz256:never executed: case PCT_nistz256: | 0 | ||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||
| 71 | EC_nistz256_pre_comp_free(group->pre_comp.nistz256); | - | ||||||||||||||||||||||||
| 72 | - | |||||||||||||||||||||||||
| 73 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 74 | case never executed: PCT_nistp224:case PCT_nistp224:never executed: case PCT_nistp224: | 0 | ||||||||||||||||||||||||
| 75 | case never executed: PCT_nistp256:case PCT_nistp256:never executed: case PCT_nistp256: | 0 | ||||||||||||||||||||||||
| 76 | case never executed: PCT_nistp521:case PCT_nistp521:never executed: case PCT_nistp521: | 0 | ||||||||||||||||||||||||
| 77 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 78 | - | |||||||||||||||||||||||||
| 79 | case executed 51 times by 1 test: PCT_ec:case PCT_ec:Executed by:
executed 51 times by 1 test: case PCT_ec:Executed by:
| 51 | ||||||||||||||||||||||||
| 80 | EC_ec_pre_comp_free(group->pre_comp.ec); | - | ||||||||||||||||||||||||
| 81 | break; executed 51 times by 1 test: break;Executed by:
| 51 | ||||||||||||||||||||||||
| 82 | } | - | ||||||||||||||||||||||||
| 83 | group->pre_comp.ec = | - | ||||||||||||||||||||||||
| 84 | ((void *)0) | - | ||||||||||||||||||||||||
| 85 | ; | - | ||||||||||||||||||||||||
| 86 | } executed 69984 times by 2 tests: end of blockExecuted by:
| 69984 | ||||||||||||||||||||||||
| 87 | - | |||||||||||||||||||||||||
| 88 | void EC_GROUP_free(EC_GROUP *group) | - | ||||||||||||||||||||||||
| 89 | { | - | ||||||||||||||||||||||||
| 90 | if (!group
| 44578-69232 | ||||||||||||||||||||||||
| 91 | return; executed 44578 times by 2 tests: return;Executed by:
| 44578 | ||||||||||||||||||||||||
| 92 | - | |||||||||||||||||||||||||
| 93 | if (group->meth->group_finish != 0
| 0-69232 | ||||||||||||||||||||||||
| 94 | group->meth->group_finish(group); executed 69232 times by 2 tests: group->meth->group_finish(group);Executed by:
| 69232 | ||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||
| 96 | EC_pre_comp_free(group); | - | ||||||||||||||||||||||||
| 97 | BN_MONT_CTX_free(group->mont_data); | - | ||||||||||||||||||||||||
| 98 | EC_POINT_free(group->generator); | - | ||||||||||||||||||||||||
| 99 | BN_free(group->order); | - | ||||||||||||||||||||||||
| 100 | BN_free(group->cofactor); | - | ||||||||||||||||||||||||
| 101 | CRYPTO_free(group->seed, __FILE__, 107); | - | ||||||||||||||||||||||||
| 102 | CRYPTO_free(group, __FILE__, 108); | - | ||||||||||||||||||||||||
| 103 | } executed 69232 times by 2 tests: end of blockExecuted by:
| 69232 | ||||||||||||||||||||||||
| 104 | - | |||||||||||||||||||||||||
| 105 | void EC_GROUP_clear_free(EC_GROUP *group) | - | ||||||||||||||||||||||||
| 106 | { | - | ||||||||||||||||||||||||
| 107 | if (!group
| 706-2751 | ||||||||||||||||||||||||
| 108 | return; executed 2751 times by 1 test: return;Executed by:
| 2751 | ||||||||||||||||||||||||
| 109 | - | |||||||||||||||||||||||||
| 110 | if (group->meth->group_clear_finish != 0
| 0-706 | ||||||||||||||||||||||||
| 111 | group->meth->group_clear_finish(group); executed 706 times by 1 test: group->meth->group_clear_finish(group);Executed by:
| 706 | ||||||||||||||||||||||||
| 112 | else if (group->meth->group_finish != 0
| 0 | ||||||||||||||||||||||||
| 113 | group->meth->group_finish(group); never executed: group->meth->group_finish(group); | 0 | ||||||||||||||||||||||||
| 114 | - | |||||||||||||||||||||||||
| 115 | EC_pre_comp_free(group); | - | ||||||||||||||||||||||||
| 116 | BN_MONT_CTX_free(group->mont_data); | - | ||||||||||||||||||||||||
| 117 | EC_POINT_clear_free(group->generator); | - | ||||||||||||||||||||||||
| 118 | BN_clear_free(group->order); | - | ||||||||||||||||||||||||
| 119 | BN_clear_free(group->cofactor); | - | ||||||||||||||||||||||||
| 120 | CRYPTO_clear_free(group->seed, group->seed_len, __FILE__, 126); | - | ||||||||||||||||||||||||
| 121 | CRYPTO_clear_free(group, sizeof(*group), __FILE__, 127); | - | ||||||||||||||||||||||||
| 122 | } executed 706 times by 1 test: end of blockExecuted by:
| 706 | ||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||
| 124 | int EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src) | - | ||||||||||||||||||||||||
| 125 | { | - | ||||||||||||||||||||||||
| 126 | if (dest->meth->group_copy == 0
| 0-33939 | ||||||||||||||||||||||||
| 127 | ERR_put_error(16,(106),((2|64)),__FILE__,133); | - | ||||||||||||||||||||||||
| 128 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 129 | } | - | ||||||||||||||||||||||||
| 130 | if (dest->meth != src->meth
| 0-33939 | ||||||||||||||||||||||||
| 131 | ERR_put_error(16,(106),(101),__FILE__,137); | - | ||||||||||||||||||||||||
| 132 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 133 | } | - | ||||||||||||||||||||||||
| 134 | if (dest == src
| 0-33939 | ||||||||||||||||||||||||
| 135 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||
| 137 | dest->curve_name = src->curve_name; | - | ||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||
| 139 | - | |||||||||||||||||||||||||
| 140 | dest->pre_comp_type = src->pre_comp_type; | - | ||||||||||||||||||||||||
| 141 | switch (src->pre_comp_type) { | - | ||||||||||||||||||||||||
| 142 | case executed 33933 times by 2 tests: PCT_none:case PCT_none:Executed by:
executed 33933 times by 2 tests: case PCT_none:Executed by:
| 33933 | ||||||||||||||||||||||||
| 143 | dest->pre_comp.ec = | - | ||||||||||||||||||||||||
| 144 | ((void *)0) | - | ||||||||||||||||||||||||
| 145 | ; | - | ||||||||||||||||||||||||
| 146 | break; executed 33933 times by 2 tests: break;Executed by:
| 33933 | ||||||||||||||||||||||||
| 147 | case never executed: PCT_nistz256:case PCT_nistz256:never executed: case PCT_nistz256: | 0 | ||||||||||||||||||||||||
| 148 | - | |||||||||||||||||||||||||
| 149 | dest->pre_comp.nistz256 = EC_nistz256_pre_comp_dup(src->pre_comp.nistz256); | - | ||||||||||||||||||||||||
| 150 | - | |||||||||||||||||||||||||
| 151 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 152 | case never executed: PCT_nistp224:case PCT_nistp224:never executed: case PCT_nistp224: | 0 | ||||||||||||||||||||||||
| 153 | case never executed: PCT_nistp256:case PCT_nistp256:never executed: case PCT_nistp256: | 0 | ||||||||||||||||||||||||
| 154 | case never executed: PCT_nistp521:case PCT_nistp521:never executed: case PCT_nistp521: | 0 | ||||||||||||||||||||||||
| 155 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 156 | - | |||||||||||||||||||||||||
| 157 | case executed 6 times by 1 test: PCT_ec:case PCT_ec:Executed by:
executed 6 times by 1 test: case PCT_ec:Executed by:
| 6 | ||||||||||||||||||||||||
| 158 | dest->pre_comp.ec = EC_ec_pre_comp_dup(src->pre_comp.ec); | - | ||||||||||||||||||||||||
| 159 | break; executed 6 times by 1 test: break;Executed by:
| 6 | ||||||||||||||||||||||||
| 160 | } | - | ||||||||||||||||||||||||
| 161 | - | |||||||||||||||||||||||||
| 162 | if (src->mont_data !=
| 3-33936 | ||||||||||||||||||||||||
| 163 | ((void *)0)
| 3-33936 | ||||||||||||||||||||||||
| 164 | ) { | - | ||||||||||||||||||||||||
| 165 | if (dest->mont_data ==
| 0-33936 | ||||||||||||||||||||||||
| 166 | ((void *)0)
| 0-33936 | ||||||||||||||||||||||||
| 167 | ) { | - | ||||||||||||||||||||||||
| 168 | dest->mont_data = BN_MONT_CTX_new(); | - | ||||||||||||||||||||||||
| 169 | if (dest->mont_data ==
| 0-33936 | ||||||||||||||||||||||||
| 170 | ((void *)0)
| 0-33936 | ||||||||||||||||||||||||
| 171 | ) | - | ||||||||||||||||||||||||
| 172 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 173 | } executed 33936 times by 2 tests: end of blockExecuted by:
| 33936 | ||||||||||||||||||||||||
| 174 | if (!BN_MONT_CTX_copy(dest->mont_data, src->mont_data)
| 0-33936 | ||||||||||||||||||||||||
| 175 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 176 | } executed 33936 times by 2 tests: else {end of blockExecuted by:
| 33936 | ||||||||||||||||||||||||
| 177 | - | |||||||||||||||||||||||||
| 178 | BN_MONT_CTX_free(dest->mont_data); | - | ||||||||||||||||||||||||
| 179 | dest->mont_data = | - | ||||||||||||||||||||||||
| 180 | ((void *)0) | - | ||||||||||||||||||||||||
| 181 | ; | - | ||||||||||||||||||||||||
| 182 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||
| 184 | if (src->generator !=
| 2-33937 | ||||||||||||||||||||||||
| 185 | ((void *)0)
| 2-33937 | ||||||||||||||||||||||||
| 186 | ) { | - | ||||||||||||||||||||||||
| 187 | if (dest->generator ==
| 0-33937 | ||||||||||||||||||||||||
| 188 | ((void *)0)
| 0-33937 | ||||||||||||||||||||||||
| 189 | ) { | - | ||||||||||||||||||||||||
| 190 | dest->generator = EC_POINT_new(dest); | - | ||||||||||||||||||||||||
| 191 | if (dest->generator ==
| 0-33937 | ||||||||||||||||||||||||
| 192 | ((void *)0)
| 0-33937 | ||||||||||||||||||||||||
| 193 | ) | - | ||||||||||||||||||||||||
| 194 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 195 | } executed 33937 times by 2 tests: end of blockExecuted by:
| 33937 | ||||||||||||||||||||||||
| 196 | if (!EC_POINT_copy(dest->generator, src->generator)
| 0-33937 | ||||||||||||||||||||||||
| 197 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 198 | } executed 33937 times by 2 tests: else {end of blockExecuted by:
| 33937 | ||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||
| 200 | EC_POINT_clear_free(dest->generator); | - | ||||||||||||||||||||||||
| 201 | dest->generator = | - | ||||||||||||||||||||||||
| 202 | ((void *)0) | - | ||||||||||||||||||||||||
| 203 | ; | - | ||||||||||||||||||||||||
| 204 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 205 | - | |||||||||||||||||||||||||
| 206 | if ((
| 0-33939 | ||||||||||||||||||||||||
| 207 | if (!BN_copy(dest->order, src->order)
| 0-33939 | ||||||||||||||||||||||||
| 208 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 209 | if (!BN_copy(dest->cofactor, src->cofactor)
| 0-33939 | ||||||||||||||||||||||||
| 210 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 211 | } executed 33939 times by 2 tests: end of blockExecuted by:
| 33939 | ||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||
| 213 | dest->asn1_flag = src->asn1_flag; | - | ||||||||||||||||||||||||
| 214 | dest->asn1_form = src->asn1_form; | - | ||||||||||||||||||||||||
| 215 | - | |||||||||||||||||||||||||
| 216 | if (src->seed
| 9604-24335 | ||||||||||||||||||||||||
| 217 | CRYPTO_free(dest->seed, __FILE__, 216); | - | ||||||||||||||||||||||||
| 218 | if ((
| 0-24335 | ||||||||||||||||||||||||
| 219 | ((void *)0)
| 0-24335 | ||||||||||||||||||||||||
| 220 | ) { | - | ||||||||||||||||||||||||
| 221 | ERR_put_error(16,(106),((1|64)),__FILE__,218); | - | ||||||||||||||||||||||||
| 222 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 223 | } | - | ||||||||||||||||||||||||
| 224 | if (!memcpy(dest->seed, src->seed, src->seed_len)
| 0-24335 | ||||||||||||||||||||||||
| 225 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 226 | dest->seed_len = src->seed_len; | - | ||||||||||||||||||||||||
| 227 | } executed 24335 times by 1 test: else {end of blockExecuted by:
| 24335 | ||||||||||||||||||||||||
| 228 | CRYPTO_free(dest->seed, __FILE__, 225); | - | ||||||||||||||||||||||||
| 229 | dest->seed = | - | ||||||||||||||||||||||||
| 230 | ((void *)0) | - | ||||||||||||||||||||||||
| 231 | ; | - | ||||||||||||||||||||||||
| 232 | dest->seed_len = 0; | - | ||||||||||||||||||||||||
| 233 | } executed 9604 times by 2 tests: end of blockExecuted by:
| 9604 | ||||||||||||||||||||||||
| 234 | - | |||||||||||||||||||||||||
| 235 | return executed 33939 times by 2 tests: dest->meth->group_copy(dest, src);return dest->meth->group_copy(dest, src);Executed by:
executed 33939 times by 2 tests: return dest->meth->group_copy(dest, src);Executed by:
| 33939 | ||||||||||||||||||||||||
| 236 | } | - | ||||||||||||||||||||||||
| 237 | - | |||||||||||||||||||||||||
| 238 | EC_GROUP *EC_GROUP_dup(const EC_GROUP *a) | - | ||||||||||||||||||||||||
| 239 | { | - | ||||||||||||||||||||||||
| 240 | EC_GROUP *t = | - | ||||||||||||||||||||||||
| 241 | ((void *)0) | - | ||||||||||||||||||||||||
| 242 | ; | - | ||||||||||||||||||||||||
| 243 | int ok = 0; | - | ||||||||||||||||||||||||
| 244 | - | |||||||||||||||||||||||||
| 245 | if (a ==
| 0-33500 | ||||||||||||||||||||||||
| 246 | ((void *)0)
| 0-33500 | ||||||||||||||||||||||||
| 247 | ) | - | ||||||||||||||||||||||||
| 248 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 249 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 250 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 251 | - | |||||||||||||||||||||||||
| 252 | if ((
| 0-33500 | ||||||||||||||||||||||||
| 253 | ((void *)0)
| 0-33500 | ||||||||||||||||||||||||
| 254 | ) | - | ||||||||||||||||||||||||
| 255 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 256 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 257 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 258 | if (!EC_GROUP_copy(t, a)
| 0-33500 | ||||||||||||||||||||||||
| 259 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 260 | - | |||||||||||||||||||||||||
| 261 | ok = 1; | - | ||||||||||||||||||||||||
| 262 | - | |||||||||||||||||||||||||
| 263 | err: code before this statement executed 33500 times by 2 tests: err:Executed by:
| 33500 | ||||||||||||||||||||||||
| 264 | if (!ok
| 0-33500 | ||||||||||||||||||||||||
| 265 | EC_GROUP_free(t); | - | ||||||||||||||||||||||||
| 266 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 267 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 268 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 269 | } | - | ||||||||||||||||||||||||
| 270 | return executed 33500 times by 2 tests: t;return t;Executed by:
executed 33500 times by 2 tests: return t;Executed by:
| 33500 | ||||||||||||||||||||||||
| 271 | } | - | ||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||
| 273 | const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group) | - | ||||||||||||||||||||||||
| 274 | { | - | ||||||||||||||||||||||||
| 275 | return executed 12520 times by 1 test: group->meth;return group->meth;Executed by:
executed 12520 times by 1 test: return group->meth;Executed by:
| 12520 | ||||||||||||||||||||||||
| 276 | } | - | ||||||||||||||||||||||||
| 277 | - | |||||||||||||||||||||||||
| 278 | int EC_METHOD_get_field_type(const EC_METHOD *meth) | - | ||||||||||||||||||||||||
| 279 | { | - | ||||||||||||||||||||||||
| 280 | return executed 12081 times by 1 test: meth->field_type;return meth->field_type;Executed by:
executed 12081 times by 1 test: return meth->field_type;Executed by:
| 12081 | ||||||||||||||||||||||||
| 281 | } | - | ||||||||||||||||||||||||
| 282 | - | |||||||||||||||||||||||||
| 283 | static int ec_precompute_mont_data(EC_GROUP *); | - | ||||||||||||||||||||||||
| 284 | - | |||||||||||||||||||||||||
| 285 | int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, | - | ||||||||||||||||||||||||
| 286 | const BIGNUM *order, const BIGNUM *cofactor) | - | ||||||||||||||||||||||||
| 287 | { | - | ||||||||||||||||||||||||
| 288 | if (generator ==
| 0-35297 | ||||||||||||||||||||||||
| 289 | ((void *)0)
| 0-35297 | ||||||||||||||||||||||||
| 290 | ) { | - | ||||||||||||||||||||||||
| 291 | ERR_put_error(16,(111),((3|64)),__FILE__,272); | - | ||||||||||||||||||||||||
| 292 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 293 | } | - | ||||||||||||||||||||||||
| 294 | - | |||||||||||||||||||||||||
| 295 | if (group->generator ==
| 5-35292 | ||||||||||||||||||||||||
| 296 | ((void *)0)
| 5-35292 | ||||||||||||||||||||||||
| 297 | ) { | - | ||||||||||||||||||||||||
| 298 | group->generator = EC_POINT_new(group); | - | ||||||||||||||||||||||||
| 299 | if (group->generator ==
| 0-35292 | ||||||||||||||||||||||||
| 300 | ((void *)0)
| 0-35292 | ||||||||||||||||||||||||
| 301 | ) | - | ||||||||||||||||||||||||
| 302 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 303 | } executed 35292 times by 2 tests: end of blockExecuted by:
| 35292 | ||||||||||||||||||||||||
| 304 | if (!EC_POINT_copy(group->generator, generator)
| 0-35297 | ||||||||||||||||||||||||
| 305 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 306 | - | |||||||||||||||||||||||||
| 307 | if (order !=
| 0-35297 | ||||||||||||||||||||||||
| 308 | ((void *)0)
| 0-35297 | ||||||||||||||||||||||||
| 309 | ) { | - | ||||||||||||||||||||||||
| 310 | if (!BN_copy(group->order, order)
| 0-35297 | ||||||||||||||||||||||||
| 311 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 312 | } executed 35297 times by 2 tests: elseend of blockExecuted by:
| 35297 | ||||||||||||||||||||||||
| 313 | ( never executed: BN_set_word((group->order),0));(BN_set_word((group->order),0));never executed: (BN_set_word((group->order),0)); | 0 | ||||||||||||||||||||||||
| 314 | - | |||||||||||||||||||||||||
| 315 | if (cofactor !=
| 40-35257 | ||||||||||||||||||||||||
| 316 | ((void *)0)
| 40-35257 | ||||||||||||||||||||||||
| 317 | ) { | - | ||||||||||||||||||||||||
| 318 | if (!BN_copy(group->cofactor, cofactor)
| 0-35257 | ||||||||||||||||||||||||
| 319 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 320 | } executed 35257 times by 2 tests: elseend of blockExecuted by:
| 35257 | ||||||||||||||||||||||||
| 321 | ( executed 40 times by 1 test: BN_set_word((group->cofactor),0));(BN_set_word((group->cofactor),0));Executed by:
executed 40 times by 1 test: (BN_set_word((group->cofactor),0));Executed by:
| 40 | ||||||||||||||||||||||||
| 322 | - | |||||||||||||||||||||||||
| 323 | - | |||||||||||||||||||||||||
| 324 | - | |||||||||||||||||||||||||
| 325 | - | |||||||||||||||||||||||||
| 326 | - | |||||||||||||||||||||||||
| 327 | - | |||||||||||||||||||||||||
| 328 | if (BN_is_odd(group->order)
| 132-35165 | ||||||||||||||||||||||||
| 329 | return executed 35165 times by 2 tests: ec_precompute_mont_data(group);return ec_precompute_mont_data(group);Executed by:
executed 35165 times by 2 tests: return ec_precompute_mont_data(group);Executed by:
| 35165 | ||||||||||||||||||||||||
| 330 | } | - | ||||||||||||||||||||||||
| 331 | - | |||||||||||||||||||||||||
| 332 | BN_MONT_CTX_free(group->mont_data); | - | ||||||||||||||||||||||||
| 333 | group->mont_data = | - | ||||||||||||||||||||||||
| 334 | ((void *)0) | - | ||||||||||||||||||||||||
| 335 | ; | - | ||||||||||||||||||||||||
| 336 | return executed 132 times by 1 test: 1;return 1;Executed by:
executed 132 times by 1 test: return 1;Executed by:
| 132 | ||||||||||||||||||||||||
| 337 | } | - | ||||||||||||||||||||||||
| 338 | - | |||||||||||||||||||||||||
| 339 | const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group) | - | ||||||||||||||||||||||||
| 340 | { | - | ||||||||||||||||||||||||
| 341 | return executed 13407 times by 2 tests: group->generator;return group->generator;Executed by:
executed 13407 times by 2 tests: return group->generator;Executed by:
| 13407 | ||||||||||||||||||||||||
| 342 | } | - | ||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||
| 344 | BN_MONT_CTX *EC_GROUP_get_mont_data(const EC_GROUP *group) | - | ||||||||||||||||||||||||
| 345 | { | - | ||||||||||||||||||||||||
| 346 | return never executed: group->mont_data;return group->mont_data;never executed: return group->mont_data; | 0 | ||||||||||||||||||||||||
| 347 | } | - | ||||||||||||||||||||||||
| 348 | - | |||||||||||||||||||||||||
| 349 | int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 350 | { | - | ||||||||||||||||||||||||
| 351 | if (group->order ==
| 0-99 | ||||||||||||||||||||||||
| 352 | ((void *)0)
| 0-99 | ||||||||||||||||||||||||
| 353 | ) | - | ||||||||||||||||||||||||
| 354 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 355 | if (!BN_copy(order, group->order)
| 0-99 | ||||||||||||||||||||||||
| 356 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 357 | - | |||||||||||||||||||||||||
| 358 | return executed 99 times by 1 test: !BN_is_zero(order);return !BN_is_zero(order);Executed by:
executed 99 times by 1 test: return !BN_is_zero(order);Executed by:
| 99 | ||||||||||||||||||||||||
| 359 | } | - | ||||||||||||||||||||||||
| 360 | - | |||||||||||||||||||||||||
| 361 | const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group) | - | ||||||||||||||||||||||||
| 362 | { | - | ||||||||||||||||||||||||
| 363 | return executed 14676 times by 2 tests: group->order;return group->order;Executed by:
executed 14676 times by 2 tests: return group->order;Executed by:
| 14676 | ||||||||||||||||||||||||
| 364 | } | - | ||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||
| 366 | int EC_GROUP_order_bits(const EC_GROUP *group) | - | ||||||||||||||||||||||||
| 367 | { | - | ||||||||||||||||||||||||
| 368 | return executed 4444 times by 1 test: group->meth->group_order_bits(group);return group->meth->group_order_bits(group);Executed by:
executed 4444 times by 1 test: return group->meth->group_order_bits(group);Executed by:
| 4444 | ||||||||||||||||||||||||
| 369 | } | - | ||||||||||||||||||||||||
| 370 | - | |||||||||||||||||||||||||
| 371 | int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, | - | ||||||||||||||||||||||||
| 372 | BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 373 | { | - | ||||||||||||||||||||||||
| 374 | - | |||||||||||||||||||||||||
| 375 | if (group->cofactor ==
| 0-421 | ||||||||||||||||||||||||
| 376 | ((void *)0)
| 0-421 | ||||||||||||||||||||||||
| 377 | ) | - | ||||||||||||||||||||||||
| 378 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 379 | if (!BN_copy(cofactor, group->cofactor)
| 0-421 | ||||||||||||||||||||||||
| 380 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 381 | - | |||||||||||||||||||||||||
| 382 | return executed 421 times by 1 test: !BN_is_zero(group->cofactor);return !BN_is_zero(group->cofactor);Executed by:
executed 421 times by 1 test: return !BN_is_zero(group->cofactor);Executed by:
| 421 | ||||||||||||||||||||||||
| 383 | } | - | ||||||||||||||||||||||||
| 384 | - | |||||||||||||||||||||||||
| 385 | const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group) | - | ||||||||||||||||||||||||
| 386 | { | - | ||||||||||||||||||||||||
| 387 | return executed 12076 times by 1 test: group->cofactor;return group->cofactor;Executed by:
executed 12076 times by 1 test: return group->cofactor;Executed by:
| 12076 | ||||||||||||||||||||||||
| 388 | } | - | ||||||||||||||||||||||||
| 389 | - | |||||||||||||||||||||||||
| 390 | void EC_GROUP_set_curve_name(EC_GROUP *group, int nid) | - | ||||||||||||||||||||||||
| 391 | { | - | ||||||||||||||||||||||||
| 392 | group->curve_name = nid; | - | ||||||||||||||||||||||||
| 393 | } executed 35045 times by 1 test: end of blockExecuted by:
| 35045 | ||||||||||||||||||||||||
| 394 | - | |||||||||||||||||||||||||
| 395 | int EC_GROUP_get_curve_name(const EC_GROUP *group) | - | ||||||||||||||||||||||||
| 396 | { | - | ||||||||||||||||||||||||
| 397 | return executed 38680 times by 1 test: group->curve_name;return group->curve_name;Executed by:
executed 38680 times by 1 test: return group->curve_name;Executed by:
| 38680 | ||||||||||||||||||||||||
| 398 | } | - | ||||||||||||||||||||||||
| 399 | - | |||||||||||||||||||||||||
| 400 | void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag) | - | ||||||||||||||||||||||||
| 401 | { | - | ||||||||||||||||||||||||
| 402 | group->asn1_flag = flag; | - | ||||||||||||||||||||||||
| 403 | } executed 34077 times by 1 test: end of blockExecuted by:
| 34077 | ||||||||||||||||||||||||
| 404 | - | |||||||||||||||||||||||||
| 405 | int EC_GROUP_get_asn1_flag(const EC_GROUP *group) | - | ||||||||||||||||||||||||
| 406 | { | - | ||||||||||||||||||||||||
| 407 | return executed 13625 times by 1 test: group->asn1_flag;return group->asn1_flag;Executed by:
executed 13625 times by 1 test: return group->asn1_flag;Executed by:
| 13625 | ||||||||||||||||||||||||
| 408 | } | - | ||||||||||||||||||||||||
| 409 | - | |||||||||||||||||||||||||
| 410 | void EC_GROUP_set_point_conversion_form(EC_GROUP *group, | - | ||||||||||||||||||||||||
| 411 | point_conversion_form_t form) | - | ||||||||||||||||||||||||
| 412 | { | - | ||||||||||||||||||||||||
| 413 | group->asn1_form = form; | - | ||||||||||||||||||||||||
| 414 | } executed 513 times by 1 test: end of blockExecuted by:
| 513 | ||||||||||||||||||||||||
| 415 | - | |||||||||||||||||||||||||
| 416 | point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP | - | ||||||||||||||||||||||||
| 417 | *group) | - | ||||||||||||||||||||||||
| 418 | { | - | ||||||||||||||||||||||||
| 419 | return executed 92 times by 1 test: group->asn1_form;return group->asn1_form;Executed by:
executed 92 times by 1 test: return group->asn1_form;Executed by:
| 92 | ||||||||||||||||||||||||
| 420 | } | - | ||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||
| 422 | size_t EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *p, size_t len) | - | ||||||||||||||||||||||||
| 423 | { | - | ||||||||||||||||||||||||
| 424 | CRYPTO_free(group->seed, __FILE__, 391); | - | ||||||||||||||||||||||||
| 425 | group->seed = | - | ||||||||||||||||||||||||
| 426 | ((void *)0) | - | ||||||||||||||||||||||||
| 427 | ; | - | ||||||||||||||||||||||||
| 428 | group->seed_len = 0; | - | ||||||||||||||||||||||||
| 429 | - | |||||||||||||||||||||||||
| 430 | if (!len
| 0-25552 | ||||||||||||||||||||||||
| 431 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||
| 433 | if ((
| 0-25552 | ||||||||||||||||||||||||
| 434 | ((void *)0)
| 0-25552 | ||||||||||||||||||||||||
| 435 | ) { | - | ||||||||||||||||||||||||
| 436 | ERR_put_error(16,(286),((1|64)),__FILE__,399); | - | ||||||||||||||||||||||||
| 437 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 438 | } | - | ||||||||||||||||||||||||
| 439 | memcpy(group->seed, p, len); | - | ||||||||||||||||||||||||
| 440 | group->seed_len = len; | - | ||||||||||||||||||||||||
| 441 | - | |||||||||||||||||||||||||
| 442 | return executed 25552 times by 1 test: len;return len;Executed by:
executed 25552 times by 1 test: return len;Executed by:
| 25552 | ||||||||||||||||||||||||
| 443 | } | - | ||||||||||||||||||||||||
| 444 | - | |||||||||||||||||||||||||
| 445 | unsigned char *EC_GROUP_get0_seed(const EC_GROUP *group) | - | ||||||||||||||||||||||||
| 446 | { | - | ||||||||||||||||||||||||
| 447 | return executed 45 times by 1 test: group->seed;return group->seed;Executed by:
executed 45 times by 1 test: return group->seed;Executed by:
| 45 | ||||||||||||||||||||||||
| 448 | } | - | ||||||||||||||||||||||||
| 449 | - | |||||||||||||||||||||||||
| 450 | size_t EC_GROUP_get_seed_len(const EC_GROUP *group) | - | ||||||||||||||||||||||||
| 451 | { | - | ||||||||||||||||||||||||
| 452 | return executed 17 times by 1 test: group->seed_len;return group->seed_len;Executed by:
executed 17 times by 1 test: return group->seed_len;Executed by:
| 17 | ||||||||||||||||||||||||
| 453 | } | - | ||||||||||||||||||||||||
| 454 | - | |||||||||||||||||||||||||
| 455 | int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, | - | ||||||||||||||||||||||||
| 456 | const BIGNUM *b, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 457 | { | - | ||||||||||||||||||||||||
| 458 | if (group->meth->group_set_curve == 0
| 0-17925 | ||||||||||||||||||||||||
| 459 | ERR_put_error(16,(292),((2|64)),__FILE__,422); | - | ||||||||||||||||||||||||
| 460 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 461 | } | - | ||||||||||||||||||||||||
| 462 | return executed 17925 times by 2 tests: group->meth->group_set_curve(group, p, a, b, ctx);return group->meth->group_set_curve(group, p, a, b, ctx);Executed by:
executed 17925 times by 2 tests: return group->meth->group_set_curve(group, p, a, b, ctx);Executed by:
| 17925 | ||||||||||||||||||||||||
| 463 | } | - | ||||||||||||||||||||||||
| 464 | - | |||||||||||||||||||||||||
| 465 | int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, | - | ||||||||||||||||||||||||
| 466 | BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 467 | { | - | ||||||||||||||||||||||||
| 468 | if (group->meth->group_get_curve ==
| 0-158 | ||||||||||||||||||||||||
| 469 | ((void *)0)
| 0-158 | ||||||||||||||||||||||||
| 470 | ) { | - | ||||||||||||||||||||||||
| 471 | ERR_put_error(16,(291),((2|64)),__FILE__,432); | - | ||||||||||||||||||||||||
| 472 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 473 | } | - | ||||||||||||||||||||||||
| 474 | return executed 158 times by 2 tests: group->meth->group_get_curve(group, p, a, b, ctx);return group->meth->group_get_curve(group, p, a, b, ctx);Executed by:
executed 158 times by 2 tests: return group->meth->group_get_curve(group, p, a, b, ctx);Executed by:
| 158 | ||||||||||||||||||||||||
| 475 | } | - | ||||||||||||||||||||||||
| 476 | - | |||||||||||||||||||||||||
| 477 | - | |||||||||||||||||||||||||
| 478 | int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, | - | ||||||||||||||||||||||||
| 479 | const BIGNUM *b, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 480 | { | - | ||||||||||||||||||||||||
| 481 | return never executed: EC_GROUP_set_curve(group, p, a, b, ctx);return EC_GROUP_set_curve(group, p, a, b, ctx);never executed: return EC_GROUP_set_curve(group, p, a, b, ctx); | 0 | ||||||||||||||||||||||||
| 482 | } | - | ||||||||||||||||||||||||
| 483 | - | |||||||||||||||||||||||||
| 484 | int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, | - | ||||||||||||||||||||||||
| 485 | BIGNUM *b, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 486 | { | - | ||||||||||||||||||||||||
| 487 | return never executed: EC_GROUP_get_curve(group, p, a, b, ctx);return EC_GROUP_get_curve(group, p, a, b, ctx);never executed: return EC_GROUP_get_curve(group, p, a, b, ctx); | 0 | ||||||||||||||||||||||||
| 488 | } | - | ||||||||||||||||||||||||
| 489 | - | |||||||||||||||||||||||||
| 490 | - | |||||||||||||||||||||||||
| 491 | int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, | - | ||||||||||||||||||||||||
| 492 | const BIGNUM *b, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 493 | { | - | ||||||||||||||||||||||||
| 494 | return never executed: EC_GROUP_set_curve(group, p, a, b, ctx);return EC_GROUP_set_curve(group, p, a, b, ctx);never executed: return EC_GROUP_set_curve(group, p, a, b, ctx); | 0 | ||||||||||||||||||||||||
| 495 | } | - | ||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||
| 497 | int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, | - | ||||||||||||||||||||||||
| 498 | BIGNUM *b, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 499 | { | - | ||||||||||||||||||||||||
| 500 | return never executed: EC_GROUP_get_curve(group, p, a, b, ctx);return EC_GROUP_get_curve(group, p, a, b, ctx);never executed: return EC_GROUP_get_curve(group, p, a, b, ctx); | 0 | ||||||||||||||||||||||||
| 501 | } | - | ||||||||||||||||||||||||
| 502 | - | |||||||||||||||||||||||||
| 503 | - | |||||||||||||||||||||||||
| 504 | - | |||||||||||||||||||||||||
| 505 | int EC_GROUP_get_degree(const EC_GROUP *group) | - | ||||||||||||||||||||||||
| 506 | { | - | ||||||||||||||||||||||||
| 507 | if (group->meth->group_get_degree == 0
| 0-10931 | ||||||||||||||||||||||||
| 508 | ERR_put_error(16,(173),((2|64)),__FILE__,469); | - | ||||||||||||||||||||||||
| 509 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 510 | } | - | ||||||||||||||||||||||||
| 511 | return executed 10931 times by 1 test: group->meth->group_get_degree(group);return group->meth->group_get_degree(group);Executed by:
executed 10931 times by 1 test: return group->meth->group_get_degree(group);Executed by:
| 10931 | ||||||||||||||||||||||||
| 512 | } | - | ||||||||||||||||||||||||
| 513 | - | |||||||||||||||||||||||||
| 514 | int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 515 | { | - | ||||||||||||||||||||||||
| 516 | if (group->meth->group_check_discriminant == 0
| 0-216 | ||||||||||||||||||||||||
| 517 | ERR_put_error(16,(171),((2|64)),__FILE__,479) | - | ||||||||||||||||||||||||
| 518 | ; | - | ||||||||||||||||||||||||
| 519 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 520 | } | - | ||||||||||||||||||||||||
| 521 | return executed 216 times by 1 test: group->meth->group_check_discriminant(group, ctx);return group->meth->group_check_discriminant(group, ctx);Executed by:
executed 216 times by 1 test: return group->meth->group_check_discriminant(group, ctx);Executed by:
| 216 | ||||||||||||||||||||||||
| 522 | } | - | ||||||||||||||||||||||||
| 523 | - | |||||||||||||||||||||||||
| 524 | int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 525 | { | - | ||||||||||||||||||||||||
| 526 | int r = 0; | - | ||||||||||||||||||||||||
| 527 | BIGNUM *a1, *a2, *a3, *b1, *b2, *b3; | - | ||||||||||||||||||||||||
| 528 | BN_CTX *ctx_new = | - | ||||||||||||||||||||||||
| 529 | ((void *)0) | - | ||||||||||||||||||||||||
| 530 | ; | - | ||||||||||||||||||||||||
| 531 | - | |||||||||||||||||||||||||
| 532 | - | |||||||||||||||||||||||||
| 533 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(a)) !=
| 0-5992 | ||||||||||||||||||||||||
| 534 | EC_METHOD_get_field_type(EC_GROUP_method_of(b))
| 0-5992 | ||||||||||||||||||||||||
| 535 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 536 | - | |||||||||||||||||||||||||
| 537 | if (EC_GROUP_get_curve_name(a)
| 0-5992 | ||||||||||||||||||||||||
| 538 | EC_GROUP_get_curve_name(a) != EC_GROUP_get_curve_name(b)
| 0-5991 | ||||||||||||||||||||||||
| 539 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 540 | if (a->meth->flags & 0x2
| 0-5992 | ||||||||||||||||||||||||
| 541 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 542 | - | |||||||||||||||||||||||||
| 543 | if (ctx ==
| 0-5992 | ||||||||||||||||||||||||
| 544 | ((void *)0)
| 0-5992 | ||||||||||||||||||||||||
| 545 | ) | - | ||||||||||||||||||||||||
| 546 | ctx_new = ctx = BN_CTX_new(); executed 5992 times by 1 test: ctx_new = ctx = BN_CTX_new();Executed by:
| 5992 | ||||||||||||||||||||||||
| 547 | if (ctx ==
| 0-5992 | ||||||||||||||||||||||||
| 548 | ((void *)0)
| 0-5992 | ||||||||||||||||||||||||
| 549 | ) | - | ||||||||||||||||||||||||
| 550 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 551 | - | |||||||||||||||||||||||||
| 552 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||
| 553 | a1 = BN_CTX_get(ctx); | - | ||||||||||||||||||||||||
| 554 | a2 = BN_CTX_get(ctx); | - | ||||||||||||||||||||||||
| 555 | a3 = BN_CTX_get(ctx); | - | ||||||||||||||||||||||||
| 556 | b1 = BN_CTX_get(ctx); | - | ||||||||||||||||||||||||
| 557 | b2 = BN_CTX_get(ctx); | - | ||||||||||||||||||||||||
| 558 | b3 = BN_CTX_get(ctx); | - | ||||||||||||||||||||||||
| 559 | if (b3 ==
| 0-5992 | ||||||||||||||||||||||||
| 560 | ((void *)0)
| 0-5992 | ||||||||||||||||||||||||
| 561 | ) { | - | ||||||||||||||||||||||||
| 562 | BN_CTX_end(ctx); | - | ||||||||||||||||||||||||
| 563 | BN_CTX_free(ctx_new); | - | ||||||||||||||||||||||||
| 564 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 565 | } | - | ||||||||||||||||||||||||
| 566 | - | |||||||||||||||||||||||||
| 567 | - | |||||||||||||||||||||||||
| 568 | - | |||||||||||||||||||||||||
| 569 | - | |||||||||||||||||||||||||
| 570 | - | |||||||||||||||||||||||||
| 571 | if (!a->meth->group_get_curve(a, a1, a2, a3, ctx)
| 0-5992 | ||||||||||||||||||||||||
| 572 | !b->meth->group_get_curve(b, b1, b2, b3, ctx)
| 0-5992 | ||||||||||||||||||||||||
| 573 | r = 1; never executed: r = 1; | 0 | ||||||||||||||||||||||||
| 574 | - | |||||||||||||||||||||||||
| 575 | if (r
| 0-5992 | ||||||||||||||||||||||||
| 576 | r = 1; never executed: r = 1; | 0 | ||||||||||||||||||||||||
| 577 | - | |||||||||||||||||||||||||
| 578 | - | |||||||||||||||||||||||||
| 579 | if (r
| 0-5992 | ||||||||||||||||||||||||
| 580 | EC_GROUP_get0_generator(b), ctx)
| 0-5992 | ||||||||||||||||||||||||
| 581 | r = 1; never executed: r = 1; | 0 | ||||||||||||||||||||||||
| 582 | - | |||||||||||||||||||||||||
| 583 | if (!r
| 0-5992 | ||||||||||||||||||||||||
| 584 | const BIGNUM *ao, *bo, *ac, *bc; | - | ||||||||||||||||||||||||
| 585 | - | |||||||||||||||||||||||||
| 586 | ao = EC_GROUP_get0_order(a); | - | ||||||||||||||||||||||||
| 587 | bo = EC_GROUP_get0_order(b); | - | ||||||||||||||||||||||||
| 588 | ac = EC_GROUP_get0_cofactor(a); | - | ||||||||||||||||||||||||
| 589 | bc = EC_GROUP_get0_cofactor(b); | - | ||||||||||||||||||||||||
| 590 | if (ao ==
| 0-5992 | ||||||||||||||||||||||||
| 591 | ((void *)0)
| 0-5992 | ||||||||||||||||||||||||
| 592 | || bo ==
| 0-5992 | ||||||||||||||||||||||||
| 593 | ((void *)0)
| 0-5992 | ||||||||||||||||||||||||
| 594 | ) { | - | ||||||||||||||||||||||||
| 595 | BN_CTX_end(ctx); | - | ||||||||||||||||||||||||
| 596 | BN_CTX_free(ctx_new); | - | ||||||||||||||||||||||||
| 597 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 598 | } | - | ||||||||||||||||||||||||
| 599 | if (BN_cmp(ao, bo)
| 0-5992 | ||||||||||||||||||||||||
| 600 | r = 1; never executed: r = 1; | 0 | ||||||||||||||||||||||||
| 601 | } executed 5992 times by 1 test: end of blockExecuted by:
| 5992 | ||||||||||||||||||||||||
| 602 | - | |||||||||||||||||||||||||
| 603 | BN_CTX_end(ctx); | - | ||||||||||||||||||||||||
| 604 | BN_CTX_free(ctx_new); | - | ||||||||||||||||||||||||
| 605 | - | |||||||||||||||||||||||||
| 606 | return executed 5992 times by 1 test: r;return r;Executed by:
executed 5992 times by 1 test: return r;Executed by:
| 5992 | ||||||||||||||||||||||||
| 607 | } | - | ||||||||||||||||||||||||
| 608 | - | |||||||||||||||||||||||||
| 609 | - | |||||||||||||||||||||||||
| 610 | - | |||||||||||||||||||||||||
| 611 | EC_POINT *EC_POINT_new(const EC_GROUP *group) | - | ||||||||||||||||||||||||
| 612 | { | - | ||||||||||||||||||||||||
| 613 | EC_POINT *ret; | - | ||||||||||||||||||||||||
| 614 | - | |||||||||||||||||||||||||
| 615 | if (group ==
| 0-175336 | ||||||||||||||||||||||||
| 616 | ((void *)0)
| 0-175336 | ||||||||||||||||||||||||
| 617 | ) { | - | ||||||||||||||||||||||||
| 618 | ERR_put_error(16,(121),((3|64)),__FILE__,565); | - | ||||||||||||||||||||||||
| 619 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 620 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 621 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 622 | } | - | ||||||||||||||||||||||||
| 623 | if (group->meth->point_init ==
| 0-175336 | ||||||||||||||||||||||||
| 624 | ((void *)0)
| 0-175336 | ||||||||||||||||||||||||
| 625 | ) { | - | ||||||||||||||||||||||||
| 626 | ERR_put_error(16,(121),((2|64)),__FILE__,569); | - | ||||||||||||||||||||||||
| 627 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 628 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 629 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 630 | } | - | ||||||||||||||||||||||||
| 631 | - | |||||||||||||||||||||||||
| 632 | ret = CRYPTO_zalloc(sizeof(*ret), __FILE__, 573); | - | ||||||||||||||||||||||||
| 633 | if (ret ==
| 0-175336 | ||||||||||||||||||||||||
| 634 | ((void *)0)
| 0-175336 | ||||||||||||||||||||||||
| 635 | ) { | - | ||||||||||||||||||||||||
| 636 | ERR_put_error(16,(121),((1|64)),__FILE__,575); | - | ||||||||||||||||||||||||
| 637 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 638 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 639 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 640 | } | - | ||||||||||||||||||||||||
| 641 | - | |||||||||||||||||||||||||
| 642 | ret->meth = group->meth; | - | ||||||||||||||||||||||||
| 643 | ret->curve_name = group->curve_name; | - | ||||||||||||||||||||||||
| 644 | - | |||||||||||||||||||||||||
| 645 | if (!ret->meth->point_init(ret)
| 0-175336 | ||||||||||||||||||||||||
| 646 | CRYPTO_free(ret, __FILE__, 583); | - | ||||||||||||||||||||||||
| 647 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 648 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 649 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 650 | } | - | ||||||||||||||||||||||||
| 651 | - | |||||||||||||||||||||||||
| 652 | return executed 175336 times by 2 tests: ret;return ret;Executed by:
executed 175336 times by 2 tests: return ret;Executed by:
| 175336 | ||||||||||||||||||||||||
| 653 | } | - | ||||||||||||||||||||||||
| 654 | - | |||||||||||||||||||||||||
| 655 | void EC_POINT_free(EC_POINT *point) | - | ||||||||||||||||||||||||
| 656 | { | - | ||||||||||||||||||||||||
| 657 | if (!point
| 6352-163636 | ||||||||||||||||||||||||
| 658 | return; executed 6352 times by 2 tests: return;Executed by:
| 6352 | ||||||||||||||||||||||||
| 659 | - | |||||||||||||||||||||||||
| 660 | if (point->meth->point_finish != 0
| 0-163636 | ||||||||||||||||||||||||
| 661 | point->meth->point_finish(point); executed 163636 times by 2 tests: point->meth->point_finish(point);Executed by:
| 163636 | ||||||||||||||||||||||||
| 662 | CRYPTO_free(point, __FILE__, 597); | - | ||||||||||||||||||||||||
| 663 | } executed 163636 times by 2 tests: end of blockExecuted by:
| 163636 | ||||||||||||||||||||||||
| 664 | - | |||||||||||||||||||||||||
| 665 | void EC_POINT_clear_free(EC_POINT *point) | - | ||||||||||||||||||||||||
| 666 | { | - | ||||||||||||||||||||||||
| 667 | if (!point
| 3724-11700 | ||||||||||||||||||||||||
| 668 | return; executed 3724 times by 1 test: return;Executed by:
| 3724 | ||||||||||||||||||||||||
| 669 | - | |||||||||||||||||||||||||
| 670 | if (point->meth->point_clear_finish != 0
| 0-11700 | ||||||||||||||||||||||||
| 671 | point->meth->point_clear_finish(point); executed 11700 times by 2 tests: point->meth->point_clear_finish(point);Executed by:
| 11700 | ||||||||||||||||||||||||
| 672 | else if (point->meth->point_finish != 0
| 0 | ||||||||||||||||||||||||
| 673 | point->meth->point_finish(point); never executed: point->meth->point_finish(point); | 0 | ||||||||||||||||||||||||
| 674 | CRYPTO_clear_free(point, sizeof(*point), __FILE__, 609); | - | ||||||||||||||||||||||||
| 675 | } executed 11700 times by 2 tests: end of blockExecuted by:
| 11700 | ||||||||||||||||||||||||
| 676 | - | |||||||||||||||||||||||||
| 677 | int EC_POINT_copy(EC_POINT *dest, const EC_POINT *src) | - | ||||||||||||||||||||||||
| 678 | { | - | ||||||||||||||||||||||||
| 679 | if (dest->meth->point_copy == 0
| 0-124373 | ||||||||||||||||||||||||
| 680 | ERR_put_error(16,(114),((2|64)),__FILE__,615); | - | ||||||||||||||||||||||||
| 681 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 682 | } | - | ||||||||||||||||||||||||
| 683 | if (dest->meth != src->meth
| 0-124373 | ||||||||||||||||||||||||
| 684 | || (dest->curve_name != src->curve_name
| 0-124373 | ||||||||||||||||||||||||
| 685 | && dest->curve_name != 0
| 0 | ||||||||||||||||||||||||
| 686 | && src->curve_name != 0
| 0 | ||||||||||||||||||||||||
| 687 | ERR_put_error(16,(114),(101),__FILE__,622); | - | ||||||||||||||||||||||||
| 688 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 689 | } | - | ||||||||||||||||||||||||
| 690 | if (dest == src
| 38995-85378 | ||||||||||||||||||||||||
| 691 | return executed 38995 times by 1 test: 1;return 1;Executed by:
executed 38995 times by 1 test: return 1;Executed by:
| 38995 | ||||||||||||||||||||||||
| 692 | return executed 85378 times by 2 tests: dest->meth->point_copy(dest, src);return dest->meth->point_copy(dest, src);Executed by:
executed 85378 times by 2 tests: return dest->meth->point_copy(dest, src);Executed by:
| 85378 | ||||||||||||||||||||||||
| 693 | } | - | ||||||||||||||||||||||||
| 694 | - | |||||||||||||||||||||||||
| 695 | EC_POINT *EC_POINT_dup(const EC_POINT *a, const EC_GROUP *group) | - | ||||||||||||||||||||||||
| 696 | { | - | ||||||||||||||||||||||||
| 697 | EC_POINT *t; | - | ||||||||||||||||||||||||
| 698 | int r; | - | ||||||||||||||||||||||||
| 699 | - | |||||||||||||||||||||||||
| 700 | if (a ==
| 0-3 | ||||||||||||||||||||||||
| 701 | ((void *)0)
| 0-3 | ||||||||||||||||||||||||
| 702 | ) | - | ||||||||||||||||||||||||
| 703 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 704 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 705 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 706 | - | |||||||||||||||||||||||||
| 707 | t = EC_POINT_new(group); | - | ||||||||||||||||||||||||
| 708 | if (t ==
| 0-3 | ||||||||||||||||||||||||
| 709 | ((void *)0)
| 0-3 | ||||||||||||||||||||||||
| 710 | ) | - | ||||||||||||||||||||||||
| 711 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 712 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 713 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 714 | r = EC_POINT_copy(t, a); | - | ||||||||||||||||||||||||
| 715 | if (!r
| 0-3 | ||||||||||||||||||||||||
| 716 | EC_POINT_free(t); | - | ||||||||||||||||||||||||
| 717 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 718 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 719 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 720 | } | - | ||||||||||||||||||||||||
| 721 | return executed 3 times by 1 test: t;return t;Executed by:
executed 3 times by 1 test: return t;Executed by:
| 3 | ||||||||||||||||||||||||
| 722 | } | - | ||||||||||||||||||||||||
| 723 | - | |||||||||||||||||||||||||
| 724 | const EC_METHOD *EC_POINT_method_of(const EC_POINT *point) | - | ||||||||||||||||||||||||
| 725 | { | - | ||||||||||||||||||||||||
| 726 | return never executed: point->meth;return point->meth;never executed: return point->meth; | 0 | ||||||||||||||||||||||||
| 727 | } | - | ||||||||||||||||||||||||
| 728 | - | |||||||||||||||||||||||||
| 729 | int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point) | - | ||||||||||||||||||||||||
| 730 | { | - | ||||||||||||||||||||||||
| 731 | if (group->meth->point_set_to_infinity == 0
| 0-1380 | ||||||||||||||||||||||||
| 732 | ERR_put_error(16,(127),((2|64)),__FILE__,658) | - | ||||||||||||||||||||||||
| 733 | ; | - | ||||||||||||||||||||||||
| 734 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 735 | } | - | ||||||||||||||||||||||||
| 736 | if (group->meth != point->meth
| 0-1380 | ||||||||||||||||||||||||
| 737 | ERR_put_error(16,(127),(101),__FILE__,662); | - | ||||||||||||||||||||||||
| 738 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 739 | } | - | ||||||||||||||||||||||||
| 740 | return executed 1380 times by 1 test: group->meth->point_set_to_infinity(group, point);return group->meth->point_set_to_infinity(group, point);Executed by:
executed 1380 times by 1 test: return group->meth->point_set_to_infinity(group, point);Executed by:
| 1380 | ||||||||||||||||||||||||
| 741 | } | - | ||||||||||||||||||||||||
| 742 | - | |||||||||||||||||||||||||
| 743 | int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, | - | ||||||||||||||||||||||||
| 744 | EC_POINT *point, const BIGNUM *x, | - | ||||||||||||||||||||||||
| 745 | const BIGNUM *y, const BIGNUM *z, | - | ||||||||||||||||||||||||
| 746 | BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 747 | { | - | ||||||||||||||||||||||||
| 748 | if (group->meth->point_set_Jprojective_coordinates_GFp == 0
| 0-47761 | ||||||||||||||||||||||||
| 749 | ERR_put_error(16,(126),((2|64)),__FILE__,675) | - | ||||||||||||||||||||||||
| 750 | ; | - | ||||||||||||||||||||||||
| 751 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 752 | } | - | ||||||||||||||||||||||||
| 753 | if (!ec_point_is_compat(point, group)
| 0-47761 | ||||||||||||||||||||||||
| 754 | ERR_put_error(16,(126),(101),__FILE__,680) | - | ||||||||||||||||||||||||
| 755 | ; | - | ||||||||||||||||||||||||
| 756 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 757 | } | - | ||||||||||||||||||||||||
| 758 | return executed 47761 times by 2 tests: group->meth->point_set_Jprojective_coordinates_GFp(group, point, x,return group->meth->point_set_Jprojective_coordinates_GFp(group, point, x, y, z, ctx);Executed by:
executed 47761 times by 2 tests: return group->meth->point_set_Jprojective_coordinates_GFp(group, point, x, y, z, ctx);Executed by:
| 47761 | ||||||||||||||||||||||||
| 759 | y, z, ctx); executed 47761 times by 2 tests: return group->meth->point_set_Jprojective_coordinates_GFp(group, point, x, y, z, ctx);Executed by:
| 47761 | ||||||||||||||||||||||||
| 760 | } | - | ||||||||||||||||||||||||
| 761 | - | |||||||||||||||||||||||||
| 762 | int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, | - | ||||||||||||||||||||||||
| 763 | const EC_POINT *point, BIGNUM *x, | - | ||||||||||||||||||||||||
| 764 | BIGNUM *y, BIGNUM *z, | - | ||||||||||||||||||||||||
| 765 | BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 766 | { | - | ||||||||||||||||||||||||
| 767 | if (group->meth->point_get_Jprojective_coordinates_GFp == 0
| 0-1 | ||||||||||||||||||||||||
| 768 | ERR_put_error(16,(117),((2|64)),__FILE__,694) | - | ||||||||||||||||||||||||
| 769 | ; | - | ||||||||||||||||||||||||
| 770 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 771 | } | - | ||||||||||||||||||||||||
| 772 | if (!ec_point_is_compat(point, group)
| 0-1 | ||||||||||||||||||||||||
| 773 | ERR_put_error(16,(117),(101),__FILE__,699) | - | ||||||||||||||||||||||||
| 774 | ; | - | ||||||||||||||||||||||||
| 775 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 776 | } | - | ||||||||||||||||||||||||
| 777 | return executed 1 time by 1 test: group->meth->point_get_Jprojective_coordinates_GFp(group, point, x,return group->meth->point_get_Jprojective_coordinates_GFp(group, point, x, y, z, ctx);Executed by:
executed 1 time by 1 test: return group->meth->point_get_Jprojective_coordinates_GFp(group, point, x, y, z, ctx);Executed by:
| 1 | ||||||||||||||||||||||||
| 778 | y, z, ctx); executed 1 time by 1 test: return group->meth->point_get_Jprojective_coordinates_GFp(group, point, x, y, z, ctx);Executed by:
| 1 | ||||||||||||||||||||||||
| 779 | } | - | ||||||||||||||||||||||||
| 780 | - | |||||||||||||||||||||||||
| 781 | int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point, | - | ||||||||||||||||||||||||
| 782 | const BIGNUM *x, const BIGNUM *y, | - | ||||||||||||||||||||||||
| 783 | BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 784 | { | - | ||||||||||||||||||||||||
| 785 | if (group->meth->point_set_affine_coordinates ==
| 0-128367 | ||||||||||||||||||||||||
| 786 | ((void *)0)
| 0-128367 | ||||||||||||||||||||||||
| 787 | ) { | - | ||||||||||||||||||||||||
| 788 | ERR_put_error(16,(294),((2|64)),__FILE__,712) | - | ||||||||||||||||||||||||
| 789 | ; | - | ||||||||||||||||||||||||
| 790 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 791 | } | - | ||||||||||||||||||||||||
| 792 | if (!ec_point_is_compat(point, group)
| 0-128367 | ||||||||||||||||||||||||
| 793 | ERR_put_error(16,(294),(101),__FILE__,716); | - | ||||||||||||||||||||||||
| 794 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 795 | } | - | ||||||||||||||||||||||||
| 796 | if (!group->meth->point_set_affine_coordinates(group, point, x, y, ctx)
| 0-128367 | ||||||||||||||||||||||||
| 797 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 798 | - | |||||||||||||||||||||||||
| 799 | if (EC_POINT_is_on_curve(group, point, ctx) <= 0
| 1011-127356 | ||||||||||||||||||||||||
| 800 | ERR_put_error(16,(294),(107),__FILE__,723); | - | ||||||||||||||||||||||||
| 801 | return executed 1011 times by 1 test: 0;return 0;Executed by:
executed 1011 times by 1 test: return 0;Executed by:
| 1011 | ||||||||||||||||||||||||
| 802 | } | - | ||||||||||||||||||||||||
| 803 | return executed 127356 times by 2 tests: 1;return 1;Executed by:
executed 127356 times by 2 tests: return 1;Executed by:
| 127356 | ||||||||||||||||||||||||
| 804 | } | - | ||||||||||||||||||||||||
| 805 | - | |||||||||||||||||||||||||
| 806 | - | |||||||||||||||||||||||||
| 807 | int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, | - | ||||||||||||||||||||||||
| 808 | EC_POINT *point, const BIGNUM *x, | - | ||||||||||||||||||||||||
| 809 | const BIGNUM *y, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 810 | { | - | ||||||||||||||||||||||||
| 811 | return never executed: EC_POINT_set_affine_coordinates(group, point, x, y, ctx);return EC_POINT_set_affine_coordinates(group, point, x, y, ctx);never executed: return EC_POINT_set_affine_coordinates(group, point, x, y, ctx); | 0 | ||||||||||||||||||||||||
| 812 | } | - | ||||||||||||||||||||||||
| 813 | - | |||||||||||||||||||||||||
| 814 | - | |||||||||||||||||||||||||
| 815 | int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, | - | ||||||||||||||||||||||||
| 816 | EC_POINT *point, const BIGNUM *x, | - | ||||||||||||||||||||||||
| 817 | const BIGNUM *y, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 818 | { | - | ||||||||||||||||||||||||
| 819 | return never executed: EC_POINT_set_affine_coordinates(group, point, x, y, ctx);return EC_POINT_set_affine_coordinates(group, point, x, y, ctx);never executed: return EC_POINT_set_affine_coordinates(group, point, x, y, ctx); | 0 | ||||||||||||||||||||||||
| 820 | } | - | ||||||||||||||||||||||||
| 821 | - | |||||||||||||||||||||||||
| 822 | - | |||||||||||||||||||||||||
| 823 | - | |||||||||||||||||||||||||
| 824 | int EC_POINT_get_affine_coordinates(const EC_GROUP *group, | - | ||||||||||||||||||||||||
| 825 | const EC_POINT *point, BIGNUM *x, BIGNUM *y, | - | ||||||||||||||||||||||||
| 826 | BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 827 | { | - | ||||||||||||||||||||||||
| 828 | if (group->meth->point_get_affine_coordinates ==
| 0-16573 | ||||||||||||||||||||||||
| 829 | ((void *)0)
| 0-16573 | ||||||||||||||||||||||||
| 830 | ) { | - | ||||||||||||||||||||||||
| 831 | ERR_put_error(16,(293),((2|64)),__FILE__,753) | - | ||||||||||||||||||||||||
| 832 | ; | - | ||||||||||||||||||||||||
| 833 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 834 | } | - | ||||||||||||||||||||||||
| 835 | if (!ec_point_is_compat(point, group)
| 0-16573 | ||||||||||||||||||||||||
| 836 | ERR_put_error(16,(293),(101),__FILE__,757); | - | ||||||||||||||||||||||||
| 837 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 838 | } | - | ||||||||||||||||||||||||
| 839 | if (EC_POINT_is_at_infinity(group, point)
| 93-16480 | ||||||||||||||||||||||||
| 840 | ERR_put_error(16,(293),(106),__FILE__,761); | - | ||||||||||||||||||||||||
| 841 | return executed 93 times by 1 test: 0;return 0;Executed by:
executed 93 times by 1 test: return 0;Executed by:
| 93 | ||||||||||||||||||||||||
| 842 | } | - | ||||||||||||||||||||||||
| 843 | return executed 16480 times by 2 tests: group->meth->point_get_affine_coordinates(group, point, x, y, ctx);return group->meth->point_get_affine_coordinates(group, point, x, y, ctx);Executed by:
executed 16480 times by 2 tests: return group->meth->point_get_affine_coordinates(group, point, x, y, ctx);Executed by:
| 16480 | ||||||||||||||||||||||||
| 844 | } | - | ||||||||||||||||||||||||
| 845 | - | |||||||||||||||||||||||||
| 846 | - | |||||||||||||||||||||||||
| 847 | int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, | - | ||||||||||||||||||||||||
| 848 | const EC_POINT *point, BIGNUM *x, | - | ||||||||||||||||||||||||
| 849 | BIGNUM *y, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 850 | { | - | ||||||||||||||||||||||||
| 851 | return never executed: EC_POINT_get_affine_coordinates(group, point, x, y, ctx);return EC_POINT_get_affine_coordinates(group, point, x, y, ctx);never executed: return EC_POINT_get_affine_coordinates(group, point, x, y, ctx); | 0 | ||||||||||||||||||||||||
| 852 | } | - | ||||||||||||||||||||||||
| 853 | - | |||||||||||||||||||||||||
| 854 | - | |||||||||||||||||||||||||
| 855 | int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, | - | ||||||||||||||||||||||||
| 856 | const EC_POINT *point, BIGNUM *x, | - | ||||||||||||||||||||||||
| 857 | BIGNUM *y, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 858 | { | - | ||||||||||||||||||||||||
| 859 | return never executed: EC_POINT_get_affine_coordinates(group, point, x, y, ctx);return EC_POINT_get_affine_coordinates(group, point, x, y, ctx);never executed: return EC_POINT_get_affine_coordinates(group, point, x, y, ctx); | 0 | ||||||||||||||||||||||||
| 860 | } | - | ||||||||||||||||||||||||
| 861 | - | |||||||||||||||||||||||||
| 862 | - | |||||||||||||||||||||||||
| 863 | - | |||||||||||||||||||||||||
| 864 | int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | - | ||||||||||||||||||||||||
| 865 | const EC_POINT *b, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 866 | { | - | ||||||||||||||||||||||||
| 867 | if (group->meth->add == 0
| 0-108182 | ||||||||||||||||||||||||
| 868 | ERR_put_error(16,(112),((2|64)),__FILE__,789); | - | ||||||||||||||||||||||||
| 869 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 870 | } | - | ||||||||||||||||||||||||
| 871 | if (!ec_point_is_compat(r, group)
| 0-108182 | ||||||||||||||||||||||||
| 872 | || !ec_point_is_compat(b, group)
| 0-108182 | ||||||||||||||||||||||||
| 873 | ERR_put_error(16,(112),(101),__FILE__,794); | - | ||||||||||||||||||||||||
| 874 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 875 | } | - | ||||||||||||||||||||||||
| 876 | return executed 108182 times by 2 tests: group->meth->add(group, r, a, b, ctx);return group->meth->add(group, r, a, b, ctx);Executed by:
executed 108182 times by 2 tests: return group->meth->add(group, r, a, b, ctx);Executed by:
| 108182 | ||||||||||||||||||||||||
| 877 | } | - | ||||||||||||||||||||||||
| 878 | - | |||||||||||||||||||||||||
| 879 | int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | - | ||||||||||||||||||||||||
| 880 | BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 881 | { | - | ||||||||||||||||||||||||
| 882 | if (group->meth->dbl == 0
| 0-202847 | ||||||||||||||||||||||||
| 883 | ERR_put_error(16,(115),((2|64)),__FILE__,804); | - | ||||||||||||||||||||||||
| 884 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 885 | } | - | ||||||||||||||||||||||||
| 886 | if (!ec_point_is_compat(r, group)
| 0-202847 | ||||||||||||||||||||||||
| 887 | ERR_put_error(16,(115),(101),__FILE__,808); | - | ||||||||||||||||||||||||
| 888 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 889 | } | - | ||||||||||||||||||||||||
| 890 | return executed 202847 times by 2 tests: group->meth->dbl(group, r, a, ctx);return group->meth->dbl(group, r, a, ctx);Executed by:
executed 202847 times by 2 tests: return group->meth->dbl(group, r, a, ctx);Executed by:
| 202847 | ||||||||||||||||||||||||
| 891 | } | - | ||||||||||||||||||||||||
| 892 | - | |||||||||||||||||||||||||
| 893 | int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 894 | { | - | ||||||||||||||||||||||||
| 895 | if (group->meth->invert == 0
| 0-26993 | ||||||||||||||||||||||||
| 896 | ERR_put_error(16,(210),((2|64)),__FILE__,817); | - | ||||||||||||||||||||||||
| 897 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 898 | } | - | ||||||||||||||||||||||||
| 899 | if (!ec_point_is_compat(a, group)
| 0-26993 | ||||||||||||||||||||||||
| 900 | ERR_put_error(16,(210),(101),__FILE__,821); | - | ||||||||||||||||||||||||
| 901 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 902 | } | - | ||||||||||||||||||||||||
| 903 | return executed 26993 times by 2 tests: group->meth->invert(group, a, ctx);return group->meth->invert(group, a, ctx);Executed by:
executed 26993 times by 2 tests: return group->meth->invert(group, a, ctx);Executed by:
| 26993 | ||||||||||||||||||||||||
| 904 | } | - | ||||||||||||||||||||||||
| 905 | - | |||||||||||||||||||||||||
| 906 | int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) | - | ||||||||||||||||||||||||
| 907 | { | - | ||||||||||||||||||||||||
| 908 | if (group->meth->is_at_infinity == 0
| 0-724940 | ||||||||||||||||||||||||
| 909 | ERR_put_error(16,(118),((2|64)),__FILE__,831) | - | ||||||||||||||||||||||||
| 910 | ; | - | ||||||||||||||||||||||||
| 911 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 912 | } | - | ||||||||||||||||||||||||
| 913 | if (!ec_point_is_compat(point, group)
| 0-724940 | ||||||||||||||||||||||||
| 914 | ERR_put_error(16,(118),(101),__FILE__,835); | - | ||||||||||||||||||||||||
| 915 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 916 | } | - | ||||||||||||||||||||||||
| 917 | return executed 724940 times by 2 tests: group->meth->is_at_infinity(group, point);return group->meth->is_at_infinity(group, point);Executed by:
executed 724940 times by 2 tests: return group->meth->is_at_infinity(group, point);Executed by:
| 724940 | ||||||||||||||||||||||||
| 918 | } | - | ||||||||||||||||||||||||
| 919 | int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, | - | ||||||||||||||||||||||||
| 920 | BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 921 | { | - | ||||||||||||||||||||||||
| 922 | if (group->meth->is_on_curve == 0
| 0-128674 | ||||||||||||||||||||||||
| 923 | ERR_put_error(16,(119),((2|64)),__FILE__,852); | - | ||||||||||||||||||||||||
| 924 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 925 | } | - | ||||||||||||||||||||||||
| 926 | if (!ec_point_is_compat(point, group)
| 0-128674 | ||||||||||||||||||||||||
| 927 | ERR_put_error(16,(119),(101),__FILE__,856); | - | ||||||||||||||||||||||||
| 928 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 929 | } | - | ||||||||||||||||||||||||
| 930 | return executed 128674 times by 2 tests: group->meth->is_on_curve(group, point, ctx);return group->meth->is_on_curve(group, point, ctx);Executed by:
executed 128674 times by 2 tests: return group->meth->is_on_curve(group, point, ctx);Executed by:
| 128674 | ||||||||||||||||||||||||
| 931 | } | - | ||||||||||||||||||||||||
| 932 | - | |||||||||||||||||||||||||
| 933 | int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, | - | ||||||||||||||||||||||||
| 934 | BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 935 | { | - | ||||||||||||||||||||||||
| 936 | if (group->meth->point_cmp == 0
| 0-9899 | ||||||||||||||||||||||||
| 937 | ERR_put_error(16,(113),((2|64)),__FILE__,866); | - | ||||||||||||||||||||||||
| 938 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 939 | } | - | ||||||||||||||||||||||||
| 940 | if (!ec_point_is_compat(a, group)
| 0-9899 | ||||||||||||||||||||||||
| 941 | ERR_put_error(16,(113),(101),__FILE__,870); | - | ||||||||||||||||||||||||
| 942 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 943 | } | - | ||||||||||||||||||||||||
| 944 | return executed 9899 times by 1 test: group->meth->point_cmp(group, a, b, ctx);return group->meth->point_cmp(group, a, b, ctx);Executed by:
executed 9899 times by 1 test: return group->meth->point_cmp(group, a, b, ctx);Executed by:
| 9899 | ||||||||||||||||||||||||
| 945 | } | - | ||||||||||||||||||||||||
| 946 | - | |||||||||||||||||||||||||
| 947 | int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 948 | { | - | ||||||||||||||||||||||||
| 949 | if (group->meth->make_affine == 0
| 0-6230 | ||||||||||||||||||||||||
| 950 | ERR_put_error(16,(120),((2|64)),__FILE__,879); | - | ||||||||||||||||||||||||
| 951 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 952 | } | - | ||||||||||||||||||||||||
| 953 | if (!ec_point_is_compat(point, group)
| 0-6230 | ||||||||||||||||||||||||
| 954 | ERR_put_error(16,(120),(101),__FILE__,883); | - | ||||||||||||||||||||||||
| 955 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 956 | } | - | ||||||||||||||||||||||||
| 957 | return executed 6230 times by 1 test: group->meth->make_affine(group, point, ctx);return group->meth->make_affine(group, point, ctx);Executed by:
executed 6230 times by 1 test: return group->meth->make_affine(group, point, ctx);Executed by:
| 6230 | ||||||||||||||||||||||||
| 958 | } | - | ||||||||||||||||||||||||
| 959 | - | |||||||||||||||||||||||||
| 960 | int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, | - | ||||||||||||||||||||||||
| 961 | EC_POINT *points[], BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 962 | { | - | ||||||||||||||||||||||||
| 963 | size_t i; | - | ||||||||||||||||||||||||
| 964 | - | |||||||||||||||||||||||||
| 965 | if (group->meth->points_make_affine == 0
| 0-775 | ||||||||||||||||||||||||
| 966 | ERR_put_error(16,(136),((2|64)),__FILE__,895); | - | ||||||||||||||||||||||||
| 967 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 968 | } | - | ||||||||||||||||||||||||
| 969 | for (i = 0; i < num
| 775-22692 | ||||||||||||||||||||||||
| 970 | if (!ec_point_is_compat(points[i], group)
| 0-22692 | ||||||||||||||||||||||||
| 971 | ERR_put_error(16,(136),(101),__FILE__,900); | - | ||||||||||||||||||||||||
| 972 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 973 | } | - | ||||||||||||||||||||||||
| 974 | } executed 22692 times by 2 tests: end of blockExecuted by:
| 22692 | ||||||||||||||||||||||||
| 975 | return executed 775 times by 2 tests: group->meth->points_make_affine(group, num, points, ctx);return group->meth->points_make_affine(group, num, points, ctx);Executed by:
executed 775 times by 2 tests: return group->meth->points_make_affine(group, num, points, ctx);Executed by:
| 775 | ||||||||||||||||||||||||
| 976 | } | - | ||||||||||||||||||||||||
| 977 | - | |||||||||||||||||||||||||
| 978 | - | |||||||||||||||||||||||||
| 979 | - | |||||||||||||||||||||||||
| 980 | - | |||||||||||||||||||||||||
| 981 | - | |||||||||||||||||||||||||
| 982 | - | |||||||||||||||||||||||||
| 983 | - | |||||||||||||||||||||||||
| 984 | int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | - | ||||||||||||||||||||||||
| 985 | size_t num, const EC_POINT *points[], | - | ||||||||||||||||||||||||
| 986 | const BIGNUM *scalars[], BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 987 | { | - | ||||||||||||||||||||||||
| 988 | int ret = 0; | - | ||||||||||||||||||||||||
| 989 | size_t i = 0; | - | ||||||||||||||||||||||||
| 990 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||
| 991 | ((void *)0) | - | ||||||||||||||||||||||||
| 992 | ; | - | ||||||||||||||||||||||||
| 993 | - | |||||||||||||||||||||||||
| 994 | if ((
| 2473-3244 | ||||||||||||||||||||||||
| 995 | ((void *)0)
| 2473-3244 | ||||||||||||||||||||||||
| 996 | )
| 0-3244 | ||||||||||||||||||||||||
| 997 | 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 | ||||||||||||||||||||||||
| 998 | } | - | ||||||||||||||||||||||||
| 999 | - | |||||||||||||||||||||||||
| 1000 | if (!ec_point_is_compat(r, group)
| 0-5717 | ||||||||||||||||||||||||
| 1001 | ERR_put_error(16,(290),(101),__FILE__,926); | - | ||||||||||||||||||||||||
| 1002 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1003 | } | - | ||||||||||||||||||||||||
| 1004 | for (i = 0; i < num
| 4252-5717 | ||||||||||||||||||||||||
| 1005 | if (!ec_point_is_compat(points[i], group)
| 0-4252 | ||||||||||||||||||||||||
| 1006 | ERR_put_error(16,(290),(101),__FILE__,931); | - | ||||||||||||||||||||||||
| 1007 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1008 | } | - | ||||||||||||||||||||||||
| 1009 | } executed 4252 times by 2 tests: end of blockExecuted by:
| 4252 | ||||||||||||||||||||||||
| 1010 | - | |||||||||||||||||||||||||
| 1011 | if (ctx ==
| 402-5315 | ||||||||||||||||||||||||
| 1012 | ((void *)0)
| 402-5315 | ||||||||||||||||||||||||
| 1013 | && (
| 0-402 | ||||||||||||||||||||||||
| 1014 | ((void *)0)
| 0-402 | ||||||||||||||||||||||||
| 1015 | ) { | - | ||||||||||||||||||||||||
| 1016 | ERR_put_error(16,(290),((4|64)),__FILE__,937); | - | ||||||||||||||||||||||||
| 1017 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1018 | } | - | ||||||||||||||||||||||||
| 1019 | - | |||||||||||||||||||||||||
| 1020 | if (group->meth->mul !=
| 2529-3188 | ||||||||||||||||||||||||
| 1021 | ((void *)0)
| 2529-3188 | ||||||||||||||||||||||||
| 1022 | ) | - | ||||||||||||||||||||||||
| 1023 | ret = group->meth->mul(group, r, scalar, num, points, scalars, ctx); executed 3188 times by 1 test: ret = group->meth->mul(group, r, scalar, num, points, scalars, ctx);Executed by:
| 3188 | ||||||||||||||||||||||||
| 1024 | else | - | ||||||||||||||||||||||||
| 1025 | - | |||||||||||||||||||||||||
| 1026 | ret = ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); executed 2529 times by 2 tests: ret = ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx);Executed by:
| 2529 | ||||||||||||||||||||||||
| 1027 | - | |||||||||||||||||||||||||
| 1028 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||
| 1029 | return executed 5717 times by 2 tests: ret;return ret;Executed by:
executed 5717 times by 2 tests: return ret;Executed by:
| 5717 | ||||||||||||||||||||||||
| 1030 | } | - | ||||||||||||||||||||||||
| 1031 | - | |||||||||||||||||||||||||
| 1032 | int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, | - | ||||||||||||||||||||||||
| 1033 | const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 1034 | { | - | ||||||||||||||||||||||||
| 1035 | - | |||||||||||||||||||||||||
| 1036 | - | |||||||||||||||||||||||||
| 1037 | const EC_POINT *points[1]; | - | ||||||||||||||||||||||||
| 1038 | const BIGNUM *scalars[1]; | - | ||||||||||||||||||||||||
| 1039 | - | |||||||||||||||||||||||||
| 1040 | points[0] = point; | - | ||||||||||||||||||||||||
| 1041 | scalars[0] = p_scalar; | - | ||||||||||||||||||||||||
| 1042 | - | |||||||||||||||||||||||||
| 1043 | return executed 5317 times by 2 tests: EC_POINTs_mul(group, r, g_scalar,return EC_POINTs_mul(group, r, g_scalar, (point != ((void *)0) && p_scalar != ((void *)0) ), points, scalars, ctx);Executed by:
executed 5317 times by 2 tests: return EC_POINTs_mul(group, r, g_scalar, (point != ((void *)0) && p_scalar != ((void *)0) ), points, scalars, ctx);Executed by:
| 5317 | ||||||||||||||||||||||||
| 1044 | (point != executed 5317 times by 2 tests: return EC_POINTs_mul(group, r, g_scalar, (point != ((void *)0) && p_scalar != ((void *)0) ), points, scalars, ctx);Executed by:
| 5317 | ||||||||||||||||||||||||
| 1045 | ((void *)0) executed 5317 times by 2 tests: return EC_POINTs_mul(group, r, g_scalar, (point != ((void *)0) && p_scalar != ((void *)0) ), points, scalars, ctx);Executed by:
| 5317 | ||||||||||||||||||||||||
| 1046 | executed 5317 times by 2 tests: return EC_POINTs_mul(group, r, g_scalar, (point != ((void *)0) && p_scalar != ((void *)0) ), points, scalars, ctx);Executed by:
| 5317 | ||||||||||||||||||||||||
| 1047 | && p_scalar != executed 5317 times by 2 tests: return EC_POINTs_mul(group, r, g_scalar, (point != ((void *)0) && p_scalar != ((void *)0) ), points, scalars, ctx);Executed by:
| 5317 | ||||||||||||||||||||||||
| 1048 | ((void *)0) executed 5317 times by 2 tests: return EC_POINTs_mul(group, r, g_scalar, (point != ((void *)0) && p_scalar != ((void *)0) ), points, scalars, ctx);Executed by:
| 5317 | ||||||||||||||||||||||||
| 1049 | ), points, scalars, ctx); executed 5317 times by 2 tests: return EC_POINTs_mul(group, r, g_scalar, (point != ((void *)0) && p_scalar != ((void *)0) ), points, scalars, ctx);Executed by:
| 5317 | ||||||||||||||||||||||||
| 1050 | } | - | ||||||||||||||||||||||||
| 1051 | - | |||||||||||||||||||||||||
| 1052 | int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 1053 | { | - | ||||||||||||||||||||||||
| 1054 | if (group->meth->mul == 0
| 45-53 | ||||||||||||||||||||||||
| 1055 | - | |||||||||||||||||||||||||
| 1056 | return executed 45 times by 1 test: ec_wNAF_precompute_mult(group, ctx);return ec_wNAF_precompute_mult(group, ctx);Executed by:
executed 45 times by 1 test: return ec_wNAF_precompute_mult(group, ctx);Executed by:
| 45 | ||||||||||||||||||||||||
| 1057 | - | |||||||||||||||||||||||||
| 1058 | if (group->meth->precompute_mult != 0
| 1-52 | ||||||||||||||||||||||||
| 1059 | return executed 1 time by 1 test: group->meth->precompute_mult(group, ctx);return group->meth->precompute_mult(group, ctx);Executed by:
executed 1 time by 1 test: return group->meth->precompute_mult(group, ctx);Executed by:
| 1 | ||||||||||||||||||||||||
| 1060 | else | - | ||||||||||||||||||||||||
| 1061 | return executed 52 times by 1 test: 1;return 1;Executed by:
executed 52 times by 1 test: return 1;Executed by:
| 52 | ||||||||||||||||||||||||
| 1062 | } | - | ||||||||||||||||||||||||
| 1063 | - | |||||||||||||||||||||||||
| 1064 | int EC_GROUP_have_precompute_mult(const EC_GROUP *group) | - | ||||||||||||||||||||||||
| 1065 | { | - | ||||||||||||||||||||||||
| 1066 | if (group->meth->mul == 0
| 0 | ||||||||||||||||||||||||
| 1067 | - | |||||||||||||||||||||||||
| 1068 | return never executed: ec_wNAF_have_precompute_mult(group);return ec_wNAF_have_precompute_mult(group);never executed: return ec_wNAF_have_precompute_mult(group); | 0 | ||||||||||||||||||||||||
| 1069 | - | |||||||||||||||||||||||||
| 1070 | if (group->meth->have_precompute_mult != 0
| 0 | ||||||||||||||||||||||||
| 1071 | return never executed: group->meth->have_precompute_mult(group);return group->meth->have_precompute_mult(group);never executed: return group->meth->have_precompute_mult(group); | 0 | ||||||||||||||||||||||||
| 1072 | else | - | ||||||||||||||||||||||||
| 1073 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1074 | - | |||||||||||||||||||||||||
| 1075 | } | - | ||||||||||||||||||||||||
| 1076 | - | |||||||||||||||||||||||||
| 1077 | - | |||||||||||||||||||||||||
| 1078 | - | |||||||||||||||||||||||||
| 1079 | - | |||||||||||||||||||||||||
| 1080 | - | |||||||||||||||||||||||||
| 1081 | static int ec_precompute_mont_data(EC_GROUP *group) | - | ||||||||||||||||||||||||
| 1082 | { | - | ||||||||||||||||||||||||
| 1083 | BN_CTX *ctx = BN_CTX_new(); | - | ||||||||||||||||||||||||
| 1084 | int ret = 0; | - | ||||||||||||||||||||||||
| 1085 | - | |||||||||||||||||||||||||
| 1086 | BN_MONT_CTX_free(group->mont_data); | - | ||||||||||||||||||||||||
| 1087 | group->mont_data = | - | ||||||||||||||||||||||||
| 1088 | ((void *)0) | - | ||||||||||||||||||||||||
| 1089 | ; | - | ||||||||||||||||||||||||
| 1090 | - | |||||||||||||||||||||||||
| 1091 | if (ctx ==
| 0-35165 | ||||||||||||||||||||||||
| 1092 | ((void *)0)
| 0-35165 | ||||||||||||||||||||||||
| 1093 | ) | - | ||||||||||||||||||||||||
| 1094 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1095 | - | |||||||||||||||||||||||||
| 1096 | group->mont_data = BN_MONT_CTX_new(); | - | ||||||||||||||||||||||||
| 1097 | if (group->mont_data ==
| 0-35165 | ||||||||||||||||||||||||
| 1098 | ((void *)0)
| 0-35165 | ||||||||||||||||||||||||
| 1099 | ) | - | ||||||||||||||||||||||||
| 1100 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1101 | - | |||||||||||||||||||||||||
| 1102 | if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)
| 0-35165 | ||||||||||||||||||||||||
| 1103 | BN_MONT_CTX_free(group->mont_data); | - | ||||||||||||||||||||||||
| 1104 | group->mont_data = | - | ||||||||||||||||||||||||
| 1105 | ((void *)0) | - | ||||||||||||||||||||||||
| 1106 | ; | - | ||||||||||||||||||||||||
| 1107 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1108 | } | - | ||||||||||||||||||||||||
| 1109 | - | |||||||||||||||||||||||||
| 1110 | ret = 1; | - | ||||||||||||||||||||||||
| 1111 | - | |||||||||||||||||||||||||
| 1112 | err: code before this statement executed 35165 times by 2 tests: err:Executed by:
| 35165 | ||||||||||||||||||||||||
| 1113 | - | |||||||||||||||||||||||||
| 1114 | BN_CTX_free(ctx); | - | ||||||||||||||||||||||||
| 1115 | return executed 35165 times by 2 tests: ret;return ret;Executed by:
executed 35165 times by 2 tests: return ret;Executed by:
| 35165 | ||||||||||||||||||||||||
| 1116 | } | - | ||||||||||||||||||||||||
| 1117 | - | |||||||||||||||||||||||||
| 1118 | int EC_KEY_set_ex_data(EC_KEY *key, int idx, void *arg) | - | ||||||||||||||||||||||||
| 1119 | { | - | ||||||||||||||||||||||||
| 1120 | return never executed: CRYPTO_set_ex_data(&key->ex_data, idx, arg);return CRYPTO_set_ex_data(&key->ex_data, idx, arg);never executed: return CRYPTO_set_ex_data(&key->ex_data, idx, arg); | 0 | ||||||||||||||||||||||||
| 1121 | } | - | ||||||||||||||||||||||||
| 1122 | - | |||||||||||||||||||||||||
| 1123 | void *EC_KEY_get_ex_data(const EC_KEY *key, int idx) | - | ||||||||||||||||||||||||
| 1124 | { | - | ||||||||||||||||||||||||
| 1125 | return never executed: CRYPTO_get_ex_data(&key->ex_data, idx);return CRYPTO_get_ex_data(&key->ex_data, idx);never executed: return CRYPTO_get_ex_data(&key->ex_data, idx); | 0 | ||||||||||||||||||||||||
| 1126 | } | - | ||||||||||||||||||||||||
| 1127 | - | |||||||||||||||||||||||||
| 1128 | int ec_group_simple_order_bits(const EC_GROUP *group) | - | ||||||||||||||||||||||||
| 1129 | { | - | ||||||||||||||||||||||||
| 1130 | if (group->order ==
| 0-4444 | ||||||||||||||||||||||||
| 1131 | ((void *)0)
| 0-4444 | ||||||||||||||||||||||||
| 1132 | ) | - | ||||||||||||||||||||||||
| 1133 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1134 | return executed 4444 times by 1 test: BN_num_bits(group->order);return BN_num_bits(group->order);Executed by:
executed 4444 times by 1 test: return BN_num_bits(group->order);Executed by:
| 4444 | ||||||||||||||||||||||||
| 1135 | } | - | ||||||||||||||||||||||||
| 1136 | - | |||||||||||||||||||||||||
| 1137 | static int ec_field_inverse_mod_ord(const EC_GROUP *group, BIGNUM *r, | - | ||||||||||||||||||||||||
| 1138 | const BIGNUM *x, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 1139 | { | - | ||||||||||||||||||||||||
| 1140 | BIGNUM *e = | - | ||||||||||||||||||||||||
| 1141 | ((void *)0) | - | ||||||||||||||||||||||||
| 1142 | ; | - | ||||||||||||||||||||||||
| 1143 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||
| 1144 | ((void *)0) | - | ||||||||||||||||||||||||
| 1145 | ; | - | ||||||||||||||||||||||||
| 1146 | int ret = 0; | - | ||||||||||||||||||||||||
| 1147 | - | |||||||||||||||||||||||||
| 1148 | if (group->mont_data ==
| 0-541 | ||||||||||||||||||||||||
| 1149 | ((void *)0)
| 0-541 | ||||||||||||||||||||||||
| 1150 | ) | - | ||||||||||||||||||||||||
| 1151 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1152 | - | |||||||||||||||||||||||||
| 1153 | if (ctx ==
| 0-541 | ||||||||||||||||||||||||
| 1154 | ((void *)0)
| 0-541 | ||||||||||||||||||||||||
| 1155 | && (
| 0 | ||||||||||||||||||||||||
| 1156 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 1157 | ) | - | ||||||||||||||||||||||||
| 1158 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1159 | - | |||||||||||||||||||||||||
| 1160 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||
| 1161 | if ((
| 0-541 | ||||||||||||||||||||||||
| 1162 | ((void *)0)
| 0-541 | ||||||||||||||||||||||||
| 1163 | ) | - | ||||||||||||||||||||||||
| 1164 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1165 | - | |||||||||||||||||||||||||
| 1166 | - | |||||||||||||||||||||||||
| 1167 | - | |||||||||||||||||||||||||
| 1168 | - | |||||||||||||||||||||||||
| 1169 | - | |||||||||||||||||||||||||
| 1170 | if (!BN_set_word(e, 2)
| 0-541 | ||||||||||||||||||||||||
| 1171 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1172 | if (!BN_sub(e, group->order, e)
| 0-541 | ||||||||||||||||||||||||
| 1173 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1174 | - | |||||||||||||||||||||||||
| 1175 | - | |||||||||||||||||||||||||
| 1176 | - | |||||||||||||||||||||||||
| 1177 | - | |||||||||||||||||||||||||
| 1178 | if (!BN_mod_exp_mont(r, x, e, group->order, ctx, group->mont_data)
| 0-541 | ||||||||||||||||||||||||
| 1179 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1180 | - | |||||||||||||||||||||||||
| 1181 | ret = 1; | - | ||||||||||||||||||||||||
| 1182 | - | |||||||||||||||||||||||||
| 1183 | err: code before this statement executed 541 times by 2 tests: err:Executed by:
| 541 | ||||||||||||||||||||||||
| 1184 | if (ctx !=
| 0-541 | ||||||||||||||||||||||||
| 1185 | ((void *)0)
| 0-541 | ||||||||||||||||||||||||
| 1186 | ) | - | ||||||||||||||||||||||||
| 1187 | BN_CTX_end(ctx); executed 541 times by 2 tests: BN_CTX_end(ctx);Executed by:
| 541 | ||||||||||||||||||||||||
| 1188 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||
| 1189 | return executed 541 times by 2 tests: ret;return ret;Executed by:
executed 541 times by 2 tests: return ret;Executed by:
| 541 | ||||||||||||||||||||||||
| 1190 | } | - | ||||||||||||||||||||||||
| 1191 | int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res, | - | ||||||||||||||||||||||||
| 1192 | const BIGNUM *x, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 1193 | { | - | ||||||||||||||||||||||||
| 1194 | if (group->meth->field_inverse_mod_ord !=
| 413-541 | ||||||||||||||||||||||||
| 1195 | ((void *)0)
| 413-541 | ||||||||||||||||||||||||
| 1196 | ) | - | ||||||||||||||||||||||||
| 1197 | return executed 413 times by 1 test: group->meth->field_inverse_mod_ord(group, res, x, ctx);return group->meth->field_inverse_mod_ord(group, res, x, ctx);Executed by:
executed 413 times by 1 test: return group->meth->field_inverse_mod_ord(group, res, x, ctx);Executed by:
| 413 | ||||||||||||||||||||||||
| 1198 | else | - | ||||||||||||||||||||||||
| 1199 | return executed 541 times by 2 tests: ec_field_inverse_mod_ord(group, res, x, ctx);return ec_field_inverse_mod_ord(group, res, x, ctx);Executed by:
executed 541 times by 2 tests: return ec_field_inverse_mod_ord(group, res, x, ctx);Executed by:
| 541 | ||||||||||||||||||||||||
| 1200 | } | - | ||||||||||||||||||||||||
| 1201 | int ec_point_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx) | - | ||||||||||||||||||||||||
| 1202 | { | - | ||||||||||||||||||||||||
| 1203 | if (group->meth->blind_coordinates ==
| 2004-2126 | ||||||||||||||||||||||||
| 1204 | ((void *)0)
| 2004-2126 | ||||||||||||||||||||||||
| 1205 | ) | - | ||||||||||||||||||||||||
| 1206 | return executed 2126 times by 1 test: 1;return 1;Executed by:
executed 2126 times by 1 test: return 1;Executed by:
| 2126 | ||||||||||||||||||||||||
| 1207 | - | |||||||||||||||||||||||||
| 1208 | return executed 2004 times by 2 tests: group->meth->blind_coordinates(group, p, ctx);return group->meth->blind_coordinates(group, p, ctx);Executed by:
executed 2004 times by 2 tests: return group->meth->blind_coordinates(group, p, ctx);Executed by:
| 2004 | ||||||||||||||||||||||||
| 1209 | } | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |