Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/ec/ecp_smpl.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
3 | const EC_METHOD * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
4 | EC_GFp_simple_method(void) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
5 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
6 | static const EC_METHOD ret = { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
7 | .flags = 0x1, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
8 | .field_type = 406, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
9 | .group_init = ec_GFp_simple_group_init, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
10 | .group_finish = ec_GFp_simple_group_finish, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
11 | .group_clear_finish = ec_GFp_simple_group_clear_finish, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
12 | .group_copy = ec_GFp_simple_group_copy, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
13 | .group_set_curve = ec_GFp_simple_group_set_curve, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
14 | .group_get_curve = ec_GFp_simple_group_get_curve, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
15 | .group_get_degree = ec_GFp_simple_group_get_degree, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
16 | .group_check_discriminant = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
17 | ec_GFp_simple_group_check_discriminant, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
18 | .point_init = ec_GFp_simple_point_init, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
19 | .point_finish = ec_GFp_simple_point_finish, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
20 | .point_clear_finish = ec_GFp_simple_point_clear_finish, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
21 | .point_copy = ec_GFp_simple_point_copy, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
22 | .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
23 | .point_set_Jprojective_coordinates_GFp = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
24 | ec_GFp_simple_set_Jprojective_coordinates_GFp, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
25 | .point_get_Jprojective_coordinates_GFp = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
26 | ec_GFp_simple_get_Jprojective_coordinates_GFp, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
27 | .point_set_affine_coordinates = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
28 | ec_GFp_simple_point_set_affine_coordinates, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
29 | .point_get_affine_coordinates = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
30 | ec_GFp_simple_point_get_affine_coordinates, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
31 | .add = ec_GFp_simple_add, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
32 | .dbl = ec_GFp_simple_dbl, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
33 | .invert = ec_GFp_simple_invert, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
34 | .is_at_infinity = ec_GFp_simple_is_at_infinity, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
35 | .is_on_curve = ec_GFp_simple_is_on_curve, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
36 | .point_cmp = ec_GFp_simple_cmp, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
37 | .make_affine = ec_GFp_simple_make_affine, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
38 | .points_make_affine = ec_GFp_simple_points_make_affine, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
39 | .mul_generator_ct = ec_GFp_simple_mul_generator_ct, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
40 | .mul_single_ct = ec_GFp_simple_mul_single_ct, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
41 | .mul_double_nonct = ec_GFp_simple_mul_double_nonct, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
42 | .field_mul = ec_GFp_simple_field_mul, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
43 | .field_sqr = ec_GFp_simple_field_sqr | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
44 | }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
45 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
46 | return never executed: &ret;return &ret; never executed: return &ret; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
47 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
48 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
49 | ec_GFp_simple_group_init(EC_GROUP * group) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
50 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
51 | BN_init(&group->field); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
52 | BN_init(&group->a); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
53 | BN_init(&group->b); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
54 | group->a_is_minus3 = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
55 | return executed 393 times by 4 tests: 1;return 1; Executed by:
executed 393 times by 4 tests: return 1; Executed by:
| 393 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
56 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
57 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
58 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
59 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
60 | ec_GFp_simple_group_finish(EC_GROUP * group) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
61 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
62 | BN_free(&group->field); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
63 | BN_free(&group->a); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
64 | BN_free(&group->b); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
65 | } executed 393 times by 4 tests: end of block Executed by:
| 393 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
66 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
67 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
68 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
69 | ec_GFp_simple_group_clear_finish(EC_GROUP * group) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
70 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
71 | BN_clear_free(&group->field); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
72 | BN_clear_free(&group->a); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
73 | BN_clear_free(&group->b); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
74 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
75 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
76 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
77 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
78 | ec_GFp_simple_group_copy(EC_GROUP * dest, const EC_GROUP * src) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
79 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
80 | if (!BN_copy(&dest->field, &src->field)
| 0-143 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
81 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
82 | if (!BN_copy(&dest->a, &src->a)
| 0-143 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
83 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
84 | if (!BN_copy(&dest->b, &src->b)
| 0-143 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
85 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
86 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
87 | dest->a_is_minus3 = src->a_is_minus3; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
88 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
89 | return executed 143 times by 3 tests: 1;return 1; Executed by:
executed 143 times by 3 tests: return 1; Executed by:
| 143 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
90 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
91 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
92 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
93 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
94 | ec_GFp_simple_group_set_curve(EC_GROUP * group, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
95 | const BIGNUM * p, const BIGNUM * a, const BIGNUM * b, BN_CTX * ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
96 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
97 | int ret = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
98 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
99 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
100 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
101 | BIGNUM *tmp_a; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
102 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
103 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
104 | if (BN_num_bits(p) <= 2
| 0-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
105 | ERR_put_error(16,(0xfff),(103),__FILE__,186); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
106 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
107 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
108 | if (ctx ==
| 0-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
109 | ((void *)0)
| 0-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
110 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
111 | ctx = new_ctx = BN_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
112 | if (ctx ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
113 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
114 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
115 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
116 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
117 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
118 | if ((
| 0-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
119 | ((void *)0)
| 0-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
120 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
121 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
122 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
123 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
124 | if (!BN_copy(&group->field, p)
| 0-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
125 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
126 | BN_set_negative(&group->field, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
127 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
128 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
129 | if (!BN_nnmod(tmp_a, a, p, ctx)
| 0-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
130 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
131 | if (group->meth->field_encode
| 0-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
132 | if (!group->meth->field_encode(group, &group->a, tmp_a, ctx)
| 0-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
133 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
134 | } executed 256 times by 4 tests: else if (!BN_copy(&group->a, tmp_a)end of block Executed by:
| 0-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
135 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
136 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
137 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
138 | if (!BN_nnmod(&group->b, b, p, ctx)
| 0-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
139 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
140 | if (group->meth->field_encode
| 0-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
141 | if (!group->meth->field_encode(group, &group->b, &group->b, ctx)
| 0-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
142 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
143 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
144 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
145 | if (!BN_add_word(tmp_a, 3)
| 0-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
146 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
147 | group->a_is_minus3 = (0 == BN_cmp(tmp_a, &group->field)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
148 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
149 | ret = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
150 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
151 | err: code before this statement executed 256 times by 4 tests: err: Executed by:
| 256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
152 | BN_CTX_end(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
153 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
154 | return executed 256 times by 4 tests: ret;return ret; Executed by:
executed 256 times by 4 tests: return ret; Executed by:
| 256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
155 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
156 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
157 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
158 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
159 | ec_GFp_simple_group_get_curve(const EC_GROUP * group, BIGNUM * p, BIGNUM * a, BIGNUM * b, BN_CTX * ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
160 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
161 | int ret = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
162 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
163 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
164 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
165 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
166 | if (p !=
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
167 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
168 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
169 | if (!BN_copy(p, &group->field)
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
170 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
171 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
172 | if (a !=
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
173 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
174 | || b !=
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
175 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
176 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
177 | if (group->meth->field_decode
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
178 | if (ctx ==
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
179 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
180 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
181 | ctx = new_ctx = BN_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
182 | if (ctx ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
183 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
184 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
185 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
186 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
187 | if (a !=
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
188 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
189 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
190 | if (!group->meth->field_decode(group, a, &group->a, ctx)
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
191 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
192 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
193 | if (b !=
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
194 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
195 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
196 | if (!group->meth->field_decode(group, b, &group->b, ctx)
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
197 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
198 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
199 | } executed 1 time by 1 test: else {end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
200 | if (a !=
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
201 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
202 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
203 | if (!BN_copy(a, &group->a)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
204 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
205 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
206 | if (b !=
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
207 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
208 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
209 | if (!BN_copy(b, &group->b)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
210 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
211 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
212 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
213 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
214 | ret = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
215 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
216 | err: code before this statement executed 1 time by 1 test: err: Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
217 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
218 | return executed 1 time by 1 test: ret;return ret; Executed by:
executed 1 time by 1 test: return ret; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
219 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
220 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
221 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
222 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
223 | ec_GFp_simple_group_get_degree(const EC_GROUP * group) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
224 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
225 | return executed 165 times by 4 tests: BN_num_bits(&group->field);return BN_num_bits(&group->field); Executed by:
executed 165 times by 4 tests: return BN_num_bits(&group->field); Executed by:
| 165 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
226 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
227 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
228 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
229 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
230 | ec_GFp_simple_group_check_discriminant(const EC_GROUP * group, BN_CTX * ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
231 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
232 | int ret = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
233 | BIGNUM *a, *b, *order, *tmp_1, *tmp_2; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
234 | const BIGNUM *p = &group->field; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
235 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
236 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
237 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
238 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
239 | if (ctx ==
| 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
240 | ((void *)0)
| 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
241 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
242 | ctx = new_ctx = BN_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
243 | if (ctx ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
244 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
245 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
246 | ERR_put_error(16,(0xfff),((1|64)),__FILE__,295); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
247 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
248 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
249 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
250 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
251 | if ((
| 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
252 | ((void *)0)
| 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
253 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
254 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
255 | if ((
| 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
256 | ((void *)0)
| 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
257 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
258 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
259 | if ((
| 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
260 | ((void *)0)
| 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
261 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
262 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
263 | if ((
| 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
264 | ((void *)0)
| 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
265 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
266 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
267 | if ((
| 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
268 | ((void *)0)
| 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
269 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
270 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
271 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
272 | if (group->meth->field_decode
| 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
273 | if (!group->meth->field_decode(group, a, &group->a, ctx)
| 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
274 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
275 | if (!group->meth->field_decode(group, b, &group->b, ctx)
| 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
276 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
277 | } executed 48 times by 1 test: else {end of block Executed by:
| 48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
278 | if (!BN_copy(a, &group->a)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
279 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
280 | if (!BN_copy(b, &group->b)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
281 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
282 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
283 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
284 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
285 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
286 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
287 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
288 | if (((
| 6-42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
289 | if (((
| 0-6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
290 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
291 | } executed 6 times by 1 test: else if (!((b)->top == 0)end of block Executed by:
| 0-42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
292 | if (!BN_mod_sqr(tmp_1, a, p, ctx)
| 0-42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
293 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
294 | if (!BN_mod_mul(tmp_2, tmp_1, a, p, ctx)
| 0-42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
295 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
296 | if (!BN_lshift(tmp_1, tmp_2, 2)
| 0-42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
297 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
298 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
299 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
300 | if (!BN_mod_sqr(tmp_2, b, p, ctx)
| 0-42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
301 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
302 | if (!BN_mul_word(tmp_2, 27)
| 0-42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
303 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
304 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
305 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
306 | if (!BN_mod_add(a, tmp_1, tmp_2, p, ctx)
| 0-42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
307 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
308 | if (((
| 0-42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
309 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
310 | } executed 42 times by 1 test: end of block Executed by:
| 42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
311 | ret = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
312 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
313 | err: code before this statement executed 48 times by 1 test: err: Executed by:
| 48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
314 | if (ctx !=
| 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
315 | ((void *)0)
| 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
316 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
317 | BN_CTX_end(ctx); executed 48 times by 1 test: BN_CTX_end(ctx); Executed by:
| 48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
318 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
319 | return executed 48 times by 1 test: ret;return ret; Executed by:
executed 48 times by 1 test: return ret; Executed by:
| 48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
320 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
321 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
322 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
323 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
324 | ec_GFp_simple_point_init(EC_POINT * point) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
325 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
326 | BN_init(&point->X); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
327 | BN_init(&point->Y); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
328 | BN_init(&point->Z); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
329 | point->Z_is_one = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
330 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
331 | return executed 3983 times by 4 tests: 1;return 1; Executed by:
executed 3983 times by 4 tests: return 1; Executed by:
| 3983 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
332 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
333 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
334 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
335 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
336 | ec_GFp_simple_point_finish(EC_POINT * point) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
337 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
338 | BN_free(&point->X); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
339 | BN_free(&point->Y); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
340 | BN_free(&point->Z); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
341 | } executed 1903 times by 4 tests: end of block Executed by:
| 1903 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
342 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
343 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
344 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
345 | ec_GFp_simple_point_clear_finish(EC_POINT * point) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
346 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
347 | BN_clear_free(&point->X); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
348 | BN_clear_free(&point->Y); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
349 | BN_clear_free(&point->Z); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
350 | point->Z_is_one = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
351 | } executed 2080 times by 1 test: end of block Executed by:
| 2080 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
352 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
353 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
354 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
355 | ec_GFp_simple_point_copy(EC_POINT * dest, const EC_POINT * src) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
356 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
357 | if (!BN_copy(&dest->X, &src->X)
| 0-1890 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
358 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
359 | if (!BN_copy(&dest->Y, &src->Y)
| 0-1890 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
360 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
361 | if (!BN_copy(&dest->Z, &src->Z)
| 0-1890 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
362 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
363 | dest->Z_is_one = src->Z_is_one; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
364 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
365 | return executed 1890 times by 4 tests: 1;return 1; Executed by:
executed 1890 times by 4 tests: return 1; Executed by:
| 1890 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
366 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
367 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
368 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
369 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
370 | ec_GFp_simple_point_set_to_infinity(const EC_GROUP * group, EC_POINT * point) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
371 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
372 | point->Z_is_one = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
373 | (BN_set_word((&point->Z),0)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
374 | return executed 2 times by 1 test: 1;return 1; Executed by:
executed 2 times by 1 test: return 1; Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
375 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
376 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
377 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
378 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
379 | ec_GFp_simple_set_Jprojective_coordinates_GFp(const EC_GROUP * group, EC_POINT * point, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
380 | const BIGNUM * x, const BIGNUM * y, const BIGNUM * z, BN_CTX * ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
381 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
382 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
383 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
384 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
385 | int ret = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
386 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
387 | if (ctx ==
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
388 | ((void *)0)
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
389 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
390 | ctx = new_ctx = BN_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
391 | if (ctx ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
392 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
393 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
394 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
395 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
396 | if (x !=
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
397 | ((void *)0)
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
398 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
399 | if (!BN_nnmod(&point->X, x, &group->field, ctx)
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
400 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
401 | if (group->meth->field_encode
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
402 | if (!group->meth->field_encode(group, &point->X, &point->X, ctx)
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
403 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
404 | } executed 305 times by 4 tests: end of block Executed by:
| 305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
405 | } executed 305 times by 4 tests: end of block Executed by:
| 305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
406 | if (y !=
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
407 | ((void *)0)
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
408 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
409 | if (!BN_nnmod(&point->Y, y, &group->field, ctx)
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
410 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
411 | if (group->meth->field_encode
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
412 | if (!group->meth->field_encode(group, &point->Y, &point->Y, ctx)
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
413 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
414 | } executed 305 times by 4 tests: end of block Executed by:
| 305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
415 | } executed 305 times by 4 tests: end of block Executed by:
| 305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
416 | if (z !=
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
417 | ((void *)0)
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
418 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
419 | int Z_is_one; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
420 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
421 | if (!BN_nnmod(&point->Z, z, &group->field, ctx)
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
422 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
423 | Z_is_one = ((((((
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
424 | if (group->meth->field_encode
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
425 | if (Z_is_one
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
426 | if (!group->meth->field_set_to_one(group, &point->Z, ctx)
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
427 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
428 | } executed 305 times by 4 tests: else {end of block Executed by:
| 305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
429 | if (!group->meth->field_encode(group, &point->Z, &point->Z, ctx)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
430 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
431 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
432 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
433 | point->Z_is_one = Z_is_one; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
434 | } executed 305 times by 4 tests: end of block Executed by:
| 305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
435 | ret = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
436 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
437 | err: code before this statement executed 305 times by 4 tests: err: Executed by:
| 305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
438 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
439 | return executed 305 times by 4 tests: ret;return ret; Executed by:
executed 305 times by 4 tests: return ret; Executed by:
| 305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
440 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
441 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
442 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
443 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
444 | ec_GFp_simple_get_Jprojective_coordinates_GFp(const EC_GROUP * group, const EC_POINT * point, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
445 | BIGNUM * x, BIGNUM * y, BIGNUM * z, BN_CTX * ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
446 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
447 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
448 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
449 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
450 | int ret = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
451 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
452 | if (group->meth->field_decode != 0
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
453 | if (ctx ==
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
454 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
455 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
456 | ctx = new_ctx = BN_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
457 | if (ctx ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
458 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
459 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
460 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
461 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
462 | if (x !=
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
463 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
464 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
465 | if (!group->meth->field_decode(group, x, &point->X, ctx)
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
466 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
467 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
468 | if (y !=
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
469 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
470 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
471 | if (!group->meth->field_decode(group, y, &point->Y, ctx)
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
472 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
473 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
474 | if (z !=
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
475 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
476 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
477 | if (!group->meth->field_decode(group, z, &point->Z, ctx)
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
478 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
479 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
480 | } executed 1 time by 1 test: else {end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
481 | if (x !=
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
482 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
483 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
484 | if (!BN_copy(x, &point->X)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
485 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
486 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
487 | if (y !=
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
488 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
489 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
490 | if (!BN_copy(y, &point->Y)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
491 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
492 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
493 | if (z !=
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
494 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
495 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
496 | if (!BN_copy(z, &point->Z)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
497 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
498 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
499 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
500 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
501 | ret = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
502 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
503 | err: code before this statement executed 1 time by 1 test: err: Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
504 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
505 | return executed 1 time by 1 test: ret;return ret; Executed by:
executed 1 time by 1 test: return ret; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
506 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
507 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
508 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
509 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
510 | ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP * group, EC_POINT * point, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
511 | const BIGNUM * x, const BIGNUM * y, BN_CTX * ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
512 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
513 | if (x ==
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
514 | ((void *)0)
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
515 | || y ==
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
516 | ((void *)0)
| 0-305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
517 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
518 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
519 | ERR_put_error(16,(0xfff),((3|64)),__FILE__,522); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
520 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
521 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
522 | return executed 305 times by 4 tests: EC_POINT_set_Jprojective_coordinates_GFp(group, point, x, y, BN_value_one(), ctx);return EC_POINT_set_Jprojective_coordinates_GFp(group, point, x, y, BN_value_one(), ctx); Executed by:
executed 305 times by 4 tests: return EC_POINT_set_Jprojective_coordinates_GFp(group, point, x, y, BN_value_one(), ctx); Executed by:
| 305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
523 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
524 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
525 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
526 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
527 | ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP * group, const EC_POINT * point, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
528 | BIGNUM * x, BIGNUM * y, BN_CTX * ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
529 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
530 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
531 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
532 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
533 | BIGNUM *Z, *Z_1, *Z_2, *Z_3; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
534 | const BIGNUM *Z_; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
535 | int ret = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
536 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
537 | if (EC_POINT_is_at_infinity(group, point) > 0
| 0-385 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
538 | ERR_put_error(16,(0xfff),(106),__FILE__,539); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
539 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
540 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
541 | if (ctx ==
| 0-385 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
542 | ((void *)0)
| 0-385 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
543 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
544 | ctx = new_ctx = BN_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
545 | if (ctx ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
546 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
547 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
548 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
549 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
550 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
551 | if ((
| 0-385 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
552 | ((void *)0)
| 0-385 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
553 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
554 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
555 | if ((
| 0-385 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
556 | ((void *)0)
| 0-385 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
557 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
558 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
559 | if ((
| 0-385 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
560 | ((void *)0)
| 0-385 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
561 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
562 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
563 | if ((
| 0-385 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
564 | ((void *)0)
| 0-385 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
565 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
566 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
567 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
568 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
569 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
570 | if (group->meth->field_decode
| 0-385 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
571 | if (!group->meth->field_decode(group, Z, &point->Z, ctx)
| 0-385 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
572 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
573 | Z_ = Z; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
574 | } executed 385 times by 4 tests: else {end of block Executed by:
| 385 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
575 | Z_ = &point->Z; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
576 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
577 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
578 | if (((((((
| 0-375 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
579 | if (group->meth->field_decode
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
580 | if (x !=
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
581 | ((void *)0)
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
582 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
583 | if (!group->meth->field_decode(group, x, &point->X, ctx)
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
584 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
585 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
586 | if (y !=
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
587 | ((void *)0)
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
588 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
589 | if (!group->meth->field_decode(group, y, &point->Y, ctx)
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
590 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
591 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
592 | } executed 10 times by 1 test: else {end of block Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
593 | if (x !=
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
594 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
595 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
596 | if (!BN_copy(x, &point->X)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
597 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
598 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
599 | if (y !=
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
600 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
601 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
602 | if (!BN_copy(y, &point->Y)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
603 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
604 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
605 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
606 | } else { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
607 | if (!BN_mod_inverse_ct(Z_1, Z_, &group->field, ctx)
| 0-375 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
608 | ERR_put_error(16,(0xfff),(3),__FILE__,589); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
609 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
610 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
611 | if (group->meth->field_encode == 0
| 0-375 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
612 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
613 | if (!group->meth->field_sqr(group, Z_2, Z_1, ctx)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
614 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
615 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
616 | if (!BN_mod_sqr(Z_2, Z_1, &group->field, ctx)
| 0-375 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
617 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
618 | } executed 375 times by 4 tests: end of block Executed by:
| 375 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
619 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
620 | if (x !=
| 0-375 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
621 | ((void *)0)
| 0-375 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
622 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
623 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
624 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
625 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
626 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
627 | if (!group->meth->field_mul(group, x, &point->X, Z_2, ctx)
| 0-375 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
628 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
629 | } executed 375 times by 4 tests: end of block Executed by:
| 375 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
630 | if (y !=
| 123-252 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
631 | ((void *)0)
| 123-252 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
632 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
633 | if (group->meth->field_encode == 0
| 0-123 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
634 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
635 | if (!group->meth->field_mul(group, Z_3, Z_2, Z_1, ctx)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
636 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
637 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
638 | if (!BN_mod_mul(Z_3, Z_2, Z_1, &group->field, ctx)
| 0-123 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
639 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
640 | } executed 123 times by 3 tests: end of block Executed by:
| 123 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
641 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
642 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
643 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
644 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
645 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
646 | if (!group->meth->field_mul(group, y, &point->Y, Z_3, ctx)
| 0-123 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
647 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
648 | } executed 123 times by 3 tests: end of block Executed by:
| 123 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
649 | } executed 375 times by 4 tests: end of block Executed by:
| 375 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
650 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
651 | ret = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
652 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
653 | err: code before this statement executed 385 times by 4 tests: err: Executed by:
| 385 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
654 | BN_CTX_end(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
655 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
656 | return executed 385 times by 4 tests: ret;return ret; Executed by:
executed 385 times by 4 tests: return ret; Executed by:
| 385 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
657 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
658 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
659 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
660 | ec_GFp_simple_add(const EC_GROUP * group, EC_POINT * r, const EC_POINT * a, const EC_POINT * b, BN_CTX * ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
661 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
662 | int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
663 | int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
664 | const BIGNUM *p; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
665 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
666 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
667 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
668 | BIGNUM *n0, *n1, *n2, *n3, *n4, *n5, *n6; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
669 | int ret = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
670 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
671 | if (a == b
| 0-134510 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
672 | return never executed: EC_POINT_dbl(group, r, a, ctx);return EC_POINT_dbl(group, r, a, ctx); never executed: return EC_POINT_dbl(group, r, a, ctx); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
673 | if (EC_POINT_is_at_infinity(group, a) > 0
| 5316-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
674 | return executed 5316 times by 2 tests: EC_POINT_copy(r, b);return EC_POINT_copy(r, b); Executed by:
executed 5316 times by 2 tests: return EC_POINT_copy(r, b); Executed by:
| 5316 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
675 | if (EC_POINT_is_at_infinity(group, b) > 0
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
676 | return never executed: EC_POINT_copy(r, a);return EC_POINT_copy(r, a); never executed: return EC_POINT_copy(r, a); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
677 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
678 | field_mul = group->meth->field_mul; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
679 | field_sqr = group->meth->field_sqr; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
680 | p = &group->field; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
681 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
682 | if (ctx ==
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
683 | ((void *)0)
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
684 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
685 | ctx = new_ctx = BN_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
686 | if (ctx ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
687 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
688 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
689 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
690 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
691 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
692 | if ((
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
693 | ((void *)0)
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
694 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
695 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
696 | if ((
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
697 | ((void *)0)
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
698 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
699 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
700 | if ((
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
701 | ((void *)0)
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
702 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
703 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
704 | if ((
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
705 | ((void *)0)
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
706 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
707 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
708 | if ((
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
709 | ((void *)0)
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
710 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
711 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
712 | if ((
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
713 | ((void *)0)
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
714 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
715 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
716 | if ((
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
717 | ((void *)0)
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
718 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
719 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
720 | if (b->Z_is_one
| 21377-107817 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
721 | if (!BN_copy(n1, &a->X)
| 0-21377 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
722 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
723 | if (!BN_copy(n2, &a->Y)
| 0-21377 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
724 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
725 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
726 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
727 | } executed 21377 times by 4 tests: else {end of block Executed by:
| 21377 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
728 | if (!field_sqr(group, n0, &b->Z, ctx)
| 0-107817 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
729 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
730 | if (!field_mul(group, n1, &a->X, n0, ctx)
| 0-107817 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
731 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
732 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
733 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
734 | if (!field_mul(group, n0, n0, &b->Z, ctx)
| 0-107817 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
735 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
736 | if (!field_mul(group, n2, &a->Y, n0, ctx)
| 0-107817 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
737 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
738 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
739 | } executed 107817 times by 4 tests: end of block Executed by:
| 107817 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
740 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
741 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
742 | if (a->Z_is_one
| 443-128751 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
743 | if (!BN_copy(n3, &b->X)
| 0-443 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
744 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
745 | if (!BN_copy(n4, &b->Y)
| 0-443 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
746 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
747 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
748 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
749 | } executed 443 times by 4 tests: else {end of block Executed by:
| 443 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
750 | if (!field_sqr(group, n0, &a->Z, ctx)
| 0-128751 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
751 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
752 | if (!field_mul(group, n3, &b->X, n0, ctx)
| 0-128751 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
753 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
754 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
755 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
756 | if (!field_mul(group, n0, n0, &a->Z, ctx)
| 0-128751 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
757 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
758 | if (!field_mul(group, n4, &b->Y, n0, ctx)
| 0-128751 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
759 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
760 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
761 | } executed 128751 times by 4 tests: end of block Executed by:
| 128751 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
762 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
763 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
764 | if (!BN_mod_sub_quick(n5, n1, n3, p)
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
765 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
766 | if (!BN_mod_sub_quick(n6, n2, n4, p)
| 0-129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
767 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
768 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
769 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
770 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
771 | if (((
| 106-129088 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
772 | if (((
| 1-105 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
773 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
774 | BN_CTX_end(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
775 | ret = EC_POINT_dbl(group, r, a, ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
776 | ctx = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
777 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
778 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
779 | goto executed 1 time by 1 test: end;goto end; Executed by:
executed 1 time by 1 test: goto end; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
780 | } else { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
781 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
782 | (BN_set_word((&r->Z),0)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
783 | r->Z_is_one = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
784 | ret = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
785 | goto executed 105 times by 2 tests: end;goto end; Executed by:
executed 105 times by 2 tests: goto end; Executed by:
| 105 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
786 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
787 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
788 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
789 | if (!BN_mod_add_quick(n1, n1, n3, p)
| 0-129088 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
790 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
791 | if (!BN_mod_add_quick(n2, n2, n4, p)
| 0-129088 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
792 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
793 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
794 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
795 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
796 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
797 | if (a->Z_is_one
| 40-128647 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
798 | if (!BN_copy(&r->Z, n5)
| 0-40 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
799 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
800 | } executed 40 times by 1 test: else {end of block Executed by:
| 40 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
801 | if (a->Z_is_one
| 401-128647 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
802 | if (!BN_copy(n0, &b->Z)
| 0-401 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
803 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
804 | } executed 401 times by 4 tests: else if (b->Z_is_oneend of block Executed by:
| 401-107313 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
805 | if (!BN_copy(n0, &a->Z)
| 0-21334 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
806 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
807 | } executed 21334 times by 4 tests: else {end of block Executed by:
| 21334 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
808 | if (!field_mul(group, n0, &a->Z, &b->Z, ctx)
| 0-107313 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
809 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
810 | } executed 107313 times by 4 tests: end of block Executed by:
| 107313 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
811 | if (!field_mul(group, &r->Z, n0, n5, ctx)
| 0-129048 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
812 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
813 | } executed 129048 times by 4 tests: end of block Executed by:
| 129048 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
814 | r->Z_is_one = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
815 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
816 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
817 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
818 | if (!field_sqr(group, n0, n6, ctx)
| 0-129088 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
819 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
820 | if (!field_sqr(group, n4, n5, ctx)
| 0-129088 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
821 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
822 | if (!field_mul(group, n3, n1, n4, ctx)
| 0-129088 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
823 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
824 | if (!BN_mod_sub_quick(&r->X, n0, n3, p)
| 0-129088 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
825 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
826 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
827 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
828 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
829 | if (!BN_mod_lshift1_quick(n0, &r->X, p)
| 0-129088 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
830 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
831 | if (!BN_mod_sub_quick(n0, n3, n0, p)
| 0-129088 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
832 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
833 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
834 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
835 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
836 | if (!field_mul(group, n0, n0, n6, ctx)
| 0-129088 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
837 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
838 | if (!field_mul(group, n5, n4, n5, ctx)
| 0-129088 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
839 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
840 | if (!field_mul(group, n1, n2, n5, ctx)
| 0-129088 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
841 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
842 | if (!BN_mod_sub_quick(n0, n0, n1, p)
| 0-129088 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
843 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
844 | if ((((
| 0-129088 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
845 | if (!BN_add(n0, n0, p)
| 0-64550 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
846 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
847 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
848 | if (!BN_rshift1(&r->Y, n0)
| 0-129088 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
849 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
850 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
851 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
852 | ret = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
853 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
854 | end: code before this statement executed 129088 times by 4 tests: end: Executed by:
| 129088 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
855 | if (ctx
| 1-129193 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
856 | BN_CTX_end(ctx); executed 129193 times by 4 tests: BN_CTX_end(ctx); Executed by:
| 129193 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
857 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
858 | return executed 129194 times by 4 tests: ret;return ret; Executed by:
executed 129194 times by 4 tests: return ret; Executed by:
| 129194 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
859 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
860 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
861 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
862 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
863 | ec_GFp_simple_dbl(const EC_GROUP * group, EC_POINT * r, const EC_POINT * a, BN_CTX * ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
864 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
865 | int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
866 | int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
867 | const BIGNUM *p; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
868 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
869 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
870 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
871 | BIGNUM *n0, *n1, *n2, *n3; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
872 | int ret = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
873 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
874 | if (EC_POINT_is_at_infinity(group, a) > 0
| 5332-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
875 | (BN_set_word((&r->Z),0)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
876 | r->Z_is_one = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
877 | return executed 5332 times by 2 tests: 1;return 1; Executed by:
executed 5332 times by 2 tests: return 1; Executed by:
| 5332 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
878 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
879 | field_mul = group->meth->field_mul; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
880 | field_sqr = group->meth->field_sqr; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
881 | p = &group->field; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
882 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
883 | if (ctx ==
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
884 | ((void *)0)
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
885 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
886 | ctx = new_ctx = BN_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
887 | if (ctx ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
888 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
889 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
890 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
891 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
892 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
893 | if ((
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
894 | ((void *)0)
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
895 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
896 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
897 | if ((
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
898 | ((void *)0)
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
899 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
900 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
901 | if ((
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
902 | ((void *)0)
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
903 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
904 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
905 | if ((
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
906 | ((void *)0)
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
907 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
908 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
909 | if (a->Z_is_one
| 909-162290 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
910 | if (!field_sqr(group, n0, &a->X, ctx)
| 0-909 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
911 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
912 | if (!BN_mod_lshift1_quick(n1, n0, p)
| 0-909 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
913 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
914 | if (!BN_mod_add_quick(n0, n0, n1, p)
| 0-909 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
915 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
916 | if (!BN_mod_add_quick(n1, n0, &group->a, p)
| 0-909 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
917 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
918 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
919 | } executed 909 times by 4 tests: else if (group->a_is_minus3end of block Executed by:
| 909-121241 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
920 | if (!field_sqr(group, n1, &a->Z, ctx)
| 0-121241 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
921 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
922 | if (!BN_mod_add_quick(n0, &a->X, n1, p)
| 0-121241 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
923 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
924 | if (!BN_mod_sub_quick(n2, &a->X, n1, p)
| 0-121241 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
925 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
926 | if (!field_mul(group, n1, n0, n2, ctx)
| 0-121241 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
927 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
928 | if (!BN_mod_lshift1_quick(n0, n1, p)
| 0-121241 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
929 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
930 | if (!BN_mod_add_quick(n1, n0, n1, p)
| 0-121241 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
931 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
932 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
933 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
934 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
935 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
936 | } executed 121241 times by 4 tests: else {end of block Executed by:
| 121241 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
937 | if (!field_sqr(group, n0, &a->X, ctx)
| 0-41049 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
938 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
939 | if (!BN_mod_lshift1_quick(n1, n0, p)
| 0-41049 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
940 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
941 | if (!BN_mod_add_quick(n0, n0, n1, p)
| 0-41049 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
942 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
943 | if (!field_sqr(group, n1, &a->Z, ctx)
| 0-41049 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
944 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
945 | if (!field_sqr(group, n1, n1, ctx)
| 0-41049 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
946 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
947 | if (!field_mul(group, n1, n1, &group->a, ctx)
| 0-41049 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
948 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
949 | if (!BN_mod_add_quick(n1, n1, n0, p)
| 0-41049 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
950 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
951 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
952 | } executed 41049 times by 3 tests: end of block Executed by:
| 41049 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
953 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
954 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
955 | if (a->Z_is_one
| 909-162290 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
956 | if (!BN_copy(n0, &a->Y)
| 0-909 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
957 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
958 | } executed 909 times by 4 tests: else {end of block Executed by:
| 909 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
959 | if (!field_mul(group, n0, &a->Y, &a->Z, ctx)
| 0-162290 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
960 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
961 | } executed 162290 times by 4 tests: end of block Executed by:
| 162290 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
962 | if (!BN_mod_lshift1_quick(&r->Z, n0, p)
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
963 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
964 | r->Z_is_one = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
965 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
966 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
967 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
968 | if (!field_sqr(group, n3, &a->Y, ctx)
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
969 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
970 | if (!field_mul(group, n2, &a->X, n3, ctx)
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
971 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
972 | if (!BN_mod_lshift_quick(n2, n2, 2, p)
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
973 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
974 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
975 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
976 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
977 | if (!BN_mod_lshift1_quick(n0, n2, p)
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
978 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
979 | if (!field_sqr(group, &r->X, n1, ctx)
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
980 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
981 | if (!BN_mod_sub_quick(&r->X, &r->X, n0, p)
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
982 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
983 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
984 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
985 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
986 | if (!field_sqr(group, n0, n3, ctx)
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
987 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
988 | if (!BN_mod_lshift_quick(n3, n0, 3, p)
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
989 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
990 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
991 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
992 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
993 | if (!BN_mod_sub_quick(n0, n2, &r->X, p)
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
994 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
995 | if (!field_mul(group, n0, n1, n0, ctx)
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
996 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
997 | if (!BN_mod_sub_quick(&r->Y, n0, n3, p)
| 0-163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
998 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
999 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1000 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1001 | ret = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1002 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1003 | err: code before this statement executed 163199 times by 4 tests: err: Executed by:
| 163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1004 | BN_CTX_end(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1005 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1006 | return executed 163199 times by 4 tests: ret;return ret; Executed by:
executed 163199 times by 4 tests: return ret; Executed by:
| 163199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1007 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1008 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1009 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1010 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1011 | ec_GFp_simple_invert(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1012 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1013 | if (EC_POINT_is_at_infinity(group, point) > 0
| 0-10524 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1014 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1015 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1016 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1017 | return executed 10524 times by 2 tests: BN_usub(&point->Y, &group->field, &point->Y);return BN_usub(&point->Y, &group->field, &point->Y); Executed by:
executed 10524 times by 2 tests: return BN_usub(&point->Y, &group->field, &point->Y); Executed by:
| 10524 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1018 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1019 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1020 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1021 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1022 | ec_GFp_simple_is_at_infinity(const EC_GROUP * group, const EC_POINT * point) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1023 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1024 | return executed 443739 times by 4 tests: ((&point->Z)->top == 0);return ((&point->Z)->top == 0); Executed by:
executed 443739 times by 4 tests: return ((&point->Z)->top == 0); Executed by:
| 443739 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1025 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1026 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1027 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1028 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1029 | ec_GFp_simple_is_on_curve(const EC_GROUP * group, const EC_POINT * point, BN_CTX * ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1030 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1031 | int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1032 | int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1033 | const BIGNUM *p; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1034 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1035 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1036 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1037 | BIGNUM *rh, *tmp, *Z4, *Z6; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1038 | int ret = -1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1039 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1040 | if (EC_POINT_is_at_infinity(group, point) > 0
| 0-209 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1041 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1042 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1043 | field_mul = group->meth->field_mul; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1044 | field_sqr = group->meth->field_sqr; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1045 | p = &group->field; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1046 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1047 | if (ctx ==
| 0-209 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1048 | ((void *)0)
| 0-209 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1049 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1050 | ctx = new_ctx = BN_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1051 | if (ctx ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1052 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1053 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1054 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1055 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1056 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1057 | if ((
| 0-209 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1058 | ((void *)0)
| 0-209 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1059 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1060 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1061 | if ((
| 0-209 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1062 | ((void *)0)
| 0-209 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1063 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1064 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1065 | if ((
| 0-209 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1066 | ((void *)0)
| 0-209 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1067 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1068 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1069 | if ((
| 0-209 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1070 | ((void *)0)
| 0-209 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1071 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1072 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1073 | if (!field_sqr(group, rh, &point->X, ctx)
| 0-209 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1074 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1075 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1076 | if (!point->Z_is_one
| 59-150 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1077 | if (!field_sqr(group, tmp, &point->Z, ctx)
| 0-59 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1078 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1079 | if (!field_sqr(group, Z4, tmp, ctx)
| 0-59 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1080 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1081 | if (!field_mul(group, Z6, Z4, tmp, ctx)
| 0-59 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1082 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1083 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1084 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1085 | if (group->a_is_minus3
| 19-40 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1086 | if (!BN_mod_lshift1_quick(tmp, Z4, p)
| 0-40 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1087 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1088 | if (!BN_mod_add_quick(tmp, tmp, Z4, p)
| 0-40 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1089 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1090 | if (!BN_mod_sub_quick(rh, rh, tmp, p)
| 0-40 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1091 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1092 | if (!field_mul(group, rh, rh, &point->X, ctx)
| 0-40 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1093 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1094 | } executed 40 times by 3 tests: else {end of block Executed by:
| 40 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1095 | if (!field_mul(group, tmp, Z4, &group->a, ctx)
| 0-19 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1096 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1097 | if (!BN_mod_add_quick(rh, rh, tmp, p)
| 0-19 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1098 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1099 | if (!field_mul(group, rh, rh, &point->X, ctx)
| 0-19 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1100 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1101 | } executed 19 times by 2 tests: end of block Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1102 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1103 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1104 | if (!field_mul(group, tmp, &group->b, Z6, ctx)
| 0-59 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1105 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1106 | if (!BN_mod_add_quick(rh, rh, tmp, p)
| 0-59 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1107 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1108 | } executed 59 times by 3 tests: else {end of block Executed by:
| 59 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1109 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1110 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1111 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1112 | if (!BN_mod_add_quick(rh, rh, &group->a, p)
| 0-150 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1113 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1114 | if (!field_mul(group, rh, rh, &point->X, ctx)
| 0-150 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1115 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1116 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1117 | if (!BN_mod_add_quick(rh, rh, &group->b, p)
| 0-150 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1118 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1119 | } executed 150 times by 2 tests: end of block Executed by:
| 150 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1120 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1121 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1122 | if (!field_sqr(group, tmp, &point->Y, ctx)
| 0-209 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1123 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1124 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1125 | ret = (0 == BN_ucmp(tmp, rh)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1126 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1127 | err: code before this statement executed 209 times by 4 tests: err: Executed by:
| 209 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1128 | BN_CTX_end(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1129 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1130 | return executed 209 times by 4 tests: ret;return ret; Executed by:
executed 209 times by 4 tests: return ret; Executed by:
| 209 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1131 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1132 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1133 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1134 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1135 | ec_GFp_simple_cmp(const EC_GROUP * group, const EC_POINT * a, const EC_POINT * b, BN_CTX * ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1136 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1137 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1138 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1139 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1140 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1141 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1142 | int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1143 | int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1144 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1145 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1146 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1147 | BIGNUM *tmp1, *tmp2, *Za23, *Zb23; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1148 | const BIGNUM *tmp1_, *tmp2_; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1149 | int ret = -1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1150 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1151 | if (EC_POINT_is_at_infinity(group, a) > 0
| 18-46 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1152 | return executed 18 times by 1 test: EC_POINT_is_at_infinity(group, b) > 0return EC_POINT_is_at_infinity(group, b) > 0 ? 0 : 1; Executed by:
executed 18 times by 1 test: return EC_POINT_is_at_infinity(group, b) > 0 ? 0 : 1; Executed by:
| 0-18 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1153 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1154 | if (EC_POINT_is_at_infinity(group, b) > 0
| 0-46 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1155 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1156 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1157 | if (a->Z_is_one
| 1-42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1158 | return executed 3 times by 1 test: ((return ((BN_cmp(&a->X, &b->X) == 0) && BN_cmp(&a->Y, &b->Y) == 0) ? 0 : 1; Executed by:
executed 3 times by 1 test: return ((BN_cmp(&a->X, &b->X) == 0) && BN_cmp(&a->Y, &b->Y) == 0) ? 0 : 1; Executed by:
| 0-3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1159 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1160 | field_mul = group->meth->field_mul; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1161 | field_sqr = group->meth->field_sqr; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1162 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1163 | if (ctx ==
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1164 | ((void *)0)
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1165 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1166 | ctx = new_ctx = BN_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1167 | if (ctx ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1168 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1169 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1170 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1171 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1172 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1173 | if ((
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1174 | ((void *)0)
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1175 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1176 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1177 | if ((
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1178 | ((void *)0)
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1179 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1180 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1181 | if ((
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1182 | ((void *)0)
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1183 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1184 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1185 | if ((
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1186 | ((void *)0)
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1187 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1188 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1189 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1190 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1191 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1192 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1193 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1194 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1195 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1196 | if (!b->Z_is_one
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1197 | if (!field_sqr(group, Zb23, &b->Z, ctx)
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1198 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1199 | if (!field_mul(group, tmp1, &a->X, Zb23, ctx)
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1200 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1201 | tmp1_ = tmp1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1202 | } executed 43 times by 2 tests: elseend of block Executed by:
| 43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1203 | tmp1_ = &a->X; never executed: tmp1_ = &a->X; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1204 | if (!a->Z_is_one
| 1-42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1205 | if (!field_sqr(group, Za23, &a->Z, ctx)
| 0-42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1206 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1207 | if (!field_mul(group, tmp2, &b->X, Za23, ctx)
| 0-42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1208 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1209 | tmp2_ = tmp2; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1210 | } executed 42 times by 1 test: elseend of block Executed by:
| 42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1211 | tmp2_ = &b->X; executed 1 time by 1 test: tmp2_ = &b->X; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1212 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1213 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1214 | if (BN_cmp(tmp1_, tmp2_) != 0
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1215 | ret = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1216 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1217 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1218 | if (!b->Z_is_one
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1219 | if (!field_mul(group, Zb23, Zb23, &b->Z, ctx)
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1220 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1221 | if (!field_mul(group, tmp1, &a->Y, Zb23, ctx)
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1222 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1223 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1224 | } executed 43 times by 2 tests: elseend of block Executed by:
| 43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1225 | tmp1_ = &a->Y; never executed: tmp1_ = &a->Y; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1226 | if (!a->Z_is_one
| 1-42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1227 | if (!field_mul(group, Za23, Za23, &a->Z, ctx)
| 0-42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1228 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1229 | if (!field_mul(group, tmp2, &b->Y, Za23, ctx)
| 0-42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1230 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1231 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1232 | } executed 42 times by 1 test: elseend of block Executed by:
| 42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1233 | tmp2_ = &b->Y; executed 1 time by 1 test: tmp2_ = &b->Y; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1234 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1235 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1236 | if (BN_cmp(tmp1_, tmp2_) != 0
| 0-43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1237 | ret = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1238 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1239 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1240 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1241 | ret = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1242 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1243 | end: code before this statement executed 43 times by 2 tests: end: Executed by:
| 43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1244 | BN_CTX_end(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1245 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1246 | return executed 43 times by 2 tests: ret;return ret; Executed by:
executed 43 times by 2 tests: return ret; Executed by:
| 43 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1247 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1248 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1249 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1250 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1251 | ec_GFp_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1252 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1253 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1254 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1255 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1256 | BIGNUM *x, *y; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1257 | int ret = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1258 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1259 | if (point->Z_is_one
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1260 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1261 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1262 | if (ctx ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1263 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1264 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1265 | ctx = new_ctx = BN_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1266 | if (ctx ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1267 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1268 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1269 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1270 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1271 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1272 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1273 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1274 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1275 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1276 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1277 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1278 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1279 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1280 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1281 | if (!EC_POINT_get_affine_coordinates_GFp(group, point, x, y, ctx)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1282 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1283 | if (!EC_POINT_set_affine_coordinates_GFp(group, point, x, y, ctx)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1284 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1285 | if (!point->Z_is_one
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1286 | ERR_put_error(16,(0xfff),((4|64)),__FILE__,1216); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1287 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1288 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1289 | ret = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1290 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1291 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1292 | BN_CTX_end(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1293 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1294 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1295 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1296 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1297 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1298 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1299 | ec_GFp_simple_points_make_affine(const EC_GROUP * group, size_t num, EC_POINT * points[], BN_CTX * ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1300 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1301 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1302 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1303 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1304 | BIGNUM *tmp0, *tmp1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1305 | size_t pow2 = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1306 | BIGNUM **heap = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1307 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1308 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1309 | size_t i; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1310 | int ret = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1311 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1312 | if (num == 0
| 0-210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1313 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1314 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1315 | if (ctx ==
| 0-210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1316 | ((void *)0)
| 0-210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1317 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1318 | ctx = new_ctx = BN_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1319 | if (ctx ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1320 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1321 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1322 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1323 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1324 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1325 | if ((
| 0-210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1326 | ((void *)0)
| 0-210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1327 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1328 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1329 | if ((
| 0-210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1330 | ((void *)0)
| 0-210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1331 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1332 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1333 | pow2 = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1334 | while (num > pow2
| 210-680 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1335 | pow2 <<= 1; executed 680 times by 1 test: pow2 <<= 1; Executed by:
| 680 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1336 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1337 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1338 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1339 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1340 | pow2 <<= 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1341 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1342 | heap = reallocarray( | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1343 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1344 | , pow2, sizeof heap[0]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1345 | if (heap ==
| 0-210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1346 | ((void *)0)
| 0-210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1347 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1348 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1349 | heap[0] = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1350 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1351 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1352 | for (i = pow2 / 2 - 1; i > 0
| 210-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1353 | heap[i] = executed 1870 times by 1 test: heap[i] = ((void *)0) ; Executed by:
| 1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1354 | ((void *)0) executed 1870 times by 1 test: heap[i] = ((void *)0) ; Executed by:
| 1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1355 | ; executed 1870 times by 1 test: heap[i] = ((void *)0) ; Executed by:
| 1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1356 | for (i = 0; i < num
| 210-2080 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1357 | heap[pow2 / 2 + i] = &points[i]->Z; executed 2080 times by 1 test: heap[pow2 / 2 + i] = &points[i]->Z; Executed by:
| 2080 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1358 | for (i = pow2 / 2 + num; i < pow2
| 0-210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1359 | heap[i] = never executed: heap[i] = ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1360 | ((void *)0) never executed: heap[i] = ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1361 | ; never executed: heap[i] = ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1362 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1363 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1364 | for (i = pow2 / 2 - 1; i > 0
| 210-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1365 | heap[i] = BN_new(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1366 | if (heap[i] ==
| 0-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1367 | ((void *)0)
| 0-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1368 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1369 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1370 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1371 | if (heap[2 * i] !=
| 0-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1372 | ((void *)0)
| 0-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1373 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1374 | if ((
| 0-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1375 | ((void *)0)
| 0-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1376 | )
| 0-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1377 | if (!BN_copy(heap[i], heap[2 * i])
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1378 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1379 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1380 | if (((
| 0-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1381 | if (!BN_copy(heap[i], heap[2 * i + 1])
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1382 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1383 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1384 | if (!group->meth->field_mul(group, heap[i],
| 0-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1385 | heap[2 * i], heap[2 * i + 1], ctx)
| 0-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1386 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1387 | } executed 1870 times by 1 test: end of block Executed by:
| 1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1388 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1389 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1390 | } executed 1870 times by 1 test: end of block Executed by:
| 1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1391 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1392 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1393 | if (!((heap[1])->top == 0)
| 0-210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1394 | if (!BN_mod_inverse_ct(heap[1], heap[1], &group->field, ctx)
| 0-210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1395 | ERR_put_error(16,(0xfff),(3),__FILE__,1319); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1396 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1397 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1398 | } executed 210 times by 1 test: end of block Executed by:
| 210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1399 | if (group->meth->field_encode != 0
| 0-210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1400 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1401 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1402 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1403 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1404 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1405 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1406 | if (!group->meth->field_encode(group, heap[1], heap[1], ctx)
| 0-210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1407 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1408 | if (!group->meth->field_encode(group, heap[1], heap[1], ctx)
| 0-210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1409 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1410 | } executed 210 times by 1 test: end of block Executed by:
| 210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1411 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1412 | for (i = 2; i < pow2 / 2 + num
| 210-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1413 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1414 | if ((
| 0-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1415 | ((void *)0)
| 0-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1416 | )
| 0-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1417 | if (!group->meth->field_mul(group, tmp0, heap[i / 2], heap[i + 1], ctx)
| 0-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1418 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1419 | if (!group->meth->field_mul(group, tmp1, heap[i / 2], heap[i], ctx)
| 0-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1420 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1421 | if (!BN_copy(heap[i], tmp0)
| 0-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1422 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1423 | if (!BN_copy(heap[i + 1], tmp1)
| 0-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1424 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1425 | } executed 1870 times by 1 test: else {end of block Executed by:
| 1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1426 | if (!BN_copy(heap[i], heap[i / 2])
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1427 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1428 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1429 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1430 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1431 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1432 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1433 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1434 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1435 | for (i = 0; i < num
| 210-2080 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1436 | EC_POINT *p = points[i]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1437 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1438 | if (!((&p->Z)->top == 0)
| 0-2080 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1439 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1440 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1441 | if (!group->meth->field_sqr(group, tmp1, &p->Z, ctx)
| 0-2080 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1442 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1443 | if (!group->meth->field_mul(group, &p->X, &p->X, tmp1, ctx)
| 0-2080 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1444 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1445 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1446 | if (!group->meth->field_mul(group, tmp1, tmp1, &p->Z, ctx)
| 0-2080 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1447 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1448 | if (!group->meth->field_mul(group, &p->Y, &p->Y, tmp1, ctx)
| 0-2080 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1449 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1450 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1451 | if (group->meth->field_set_to_one != 0
| 0-2080 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1452 | if (!group->meth->field_set_to_one(group, &p->Z, ctx)
| 0-2080 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1453 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1454 | } executed 2080 times by 1 test: else {end of block Executed by:
| 2080 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1455 | if (!(BN_set_word((&p->Z),1))
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1456 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1457 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1458 | p->Z_is_one = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1459 | } executed 2080 times by 1 test: end of block Executed by:
| 2080 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1460 | } executed 2080 times by 1 test: end of block Executed by:
| 2080 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1461 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1462 | ret = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1463 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1464 | err: code before this statement executed 210 times by 1 test: err: Executed by:
| 210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1465 | BN_CTX_end(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1466 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1467 | if (heap !=
| 0-210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1468 | ((void *)0)
| 0-210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1469 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1470 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1471 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1472 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1473 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1474 | for (i = pow2 / 2 - 1; i > 0
| 210-1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1475 | BN_clear_free(heap[i]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1476 | } executed 1870 times by 1 test: end of block Executed by:
| 1870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1477 | free(heap); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1478 | } executed 210 times by 1 test: end of block Executed by:
| 210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1479 | return executed 210 times by 1 test: ret;return ret; Executed by:
executed 210 times by 1 test: return ret; Executed by:
| 210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1480 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1481 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1482 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1483 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1484 | ec_GFp_simple_field_mul(const EC_GROUP * group, BIGNUM * r, const BIGNUM * a, const BIGNUM * b, BN_CTX * ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1485 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1486 | return never executed: BN_mod_mul(r, a, b, &group->field, ctx);return BN_mod_mul(r, a, b, &group->field, ctx); never executed: return BN_mod_mul(r, a, b, &group->field, ctx); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1487 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1488 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1489 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1490 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1491 | ec_GFp_simple_field_sqr(const EC_GROUP * group, BIGNUM * r, const BIGNUM * a, BN_CTX * ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1492 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1493 | return never executed: BN_mod_sqr(r, a, &group->field, ctx);return BN_mod_sqr(r, a, &group->field, ctx); never executed: return BN_mod_sqr(r, a, &group->field, ctx); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1494 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1495 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1496 | ec_GFp_simple_mul_ct(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1497 | const EC_POINT *point, BN_CTX *ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1498 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1499 | int i, cardinality_bits, group_top, kbit, pbit, Z_is_one; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1500 | EC_POINT *s = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1501 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1502 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1503 | BIGNUM *k = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1504 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1505 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1506 | BIGNUM *lambda = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1507 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1508 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1509 | BIGNUM *cardinality = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1510 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1511 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1512 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1513 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1514 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1515 | int ret = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1516 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1517 | if (ctx ==
| 6-708 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1518 | ((void *)0)
| 6-708 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1519 | && (
| 0-6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1520 | ((void *)0)
| 0-6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1521 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1522 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1523 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1524 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1525 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1526 | if ((
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1527 | ((void *)0)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1528 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1529 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1530 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1531 | if (point ==
| 206-508 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1532 | ((void *)0)
| 206-508 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1533 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1534 | if (!EC_POINT_copy(s, group->generator)
| 0-508 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1535 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1536 | } executed 508 times by 4 tests: else {end of block Executed by:
| 508 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1537 | if (!EC_POINT_copy(s, point)
| 0-206 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1538 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1539 | } executed 206 times by 4 tests: end of block Executed by:
| 206 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1540 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1541 | do { ((&(s)->X)->flags|=((0x04))); ((&(s)->Y)->flags|=((0x04))); ((&(s)->Z)->flags|=((0x04))); } while(0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1542 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1543 | if ((
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1544 | ((void *)0)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1545 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1546 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1547 | if ((
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1548 | ((void *)0)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1549 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1550 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1551 | if ((
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1552 | ((void *)0)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1553 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1554 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1555 | if (!BN_mul(cardinality, &group->order, &group->cofactor, ctx)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1556 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1557 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1558 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1559 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1560 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1561 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1562 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1563 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1564 | cardinality_bits = BN_num_bits(cardinality); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1565 | group_top = cardinality->top; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1566 | if (((((
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1567 | ((void *)0)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1568 | )
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1569 | ((((
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1570 | ((void *)0)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1571 | )
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1572 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1573 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1574 | if (!BN_copy(k, scalar)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1575 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1576 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1577 | ((k)->flags|=(0x04)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1578 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1579 | if (BN_num_bits(k) > cardinality_bits
| 16-656 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1580 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1581 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1582 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1583 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1584 | if (!BN_nnmod(k, k, cardinality, ctx)
| 0-74 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1585 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1586 | } executed 74 times by 2 tests: end of block Executed by:
| 74 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1587 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1588 | if (!BN_add(lambda, k, cardinality)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1589 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1590 | ((lambda)->flags|=(0x04)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1591 | if (!BN_add(k, lambda, cardinality)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1592 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1593 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1594 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1595 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1596 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1597 | kbit = BN_is_bit_set(lambda, cardinality_bits); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1598 | if (!BN_swap_ct(kbit, k, lambda, group_top + 1)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1599 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1600 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1601 | group_top = group->field.top; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1602 | if (((((
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1603 | ((void *)0)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1604 | )
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1605 | ((((
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1606 | ((void *)0)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1607 | )
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1608 | ((((
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1609 | ((void *)0)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1610 | )
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1611 | ((((
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1612 | ((void *)0)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1613 | )
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1614 | ((((
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1615 | ((void *)0)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1616 | )
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1617 | ((((
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1618 | ((void *)0)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1619 | )
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1620 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1621 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1622 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1623 | if (!EC_POINT_copy(r, s)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1624 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1625 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1626 | do { ((&(r)->X)->flags|=((0x04))); ((&(r)->Y)->flags|=((0x04))); ((&(r)->Z)->flags|=((0x04))); } while(0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1627 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1628 | if (!EC_POINT_dbl(group, s, s, ctx)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1629 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1630 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1631 | pbit = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1632 | for (i = cardinality_bits - 1; i >= 0
| 714-195481 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1633 | kbit = BN_is_bit_set(k, i) ^ pbit; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1634 | do { if (!BN_swap_ct(kbit, &(r)->X, &(s)->X, group_top)
never executed: err;goto err; never executed: Z_is_one = ((r)->Z_is_one ^ (s)->Z_is_one) & (kbit); (r)->Z_is_one ^= (Z_is_one); (s)->Z_is_one ^= (Z_is_one); } while(0);goto err; | 0-195481 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1635 | if (!EC_POINT_add(group, s, r, s, ctx)
| 0-195481 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1636 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1637 | if (!EC_POINT_dbl(group, r, r, ctx)
| 0-195481 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1638 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1639 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1640 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1641 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1642 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1643 | pbit ^= kbit; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1644 | } executed 195481 times by 4 tests: end of block Executed by:
| 195481 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1645 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1646 | do { if (!BN_swap_ct(pbit, &(r)->X, &(s)->X, group_top)
never executed: err;goto err; never executed: Z_is_one = ((r)->Z_is_one ^ (s)->Z_is_one) & (pbit); (r)->Z_is_one ^= (Z_is_one); (s)->Z_is_one ^= (Z_is_one); } while(0);goto err; | 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1647 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1648 | ret = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1649 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1650 | err: code before this statement executed 714 times by 4 tests: err: Executed by:
| 714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1651 | EC_POINT_free(s); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1652 | if (ctx !=
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1653 | ((void *)0)
| 0-714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1654 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1655 | BN_CTX_end(ctx); executed 714 times by 4 tests: BN_CTX_end(ctx); Executed by:
| 714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1656 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1657 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1658 | return executed 714 times by 4 tests: ret;return ret; Executed by:
executed 714 times by 4 tests: return ret; Executed by:
| 714 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1659 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1660 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1661 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1662 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1663 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1664 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1665 | ec_GFp_simple_mul_generator_ct(const EC_GROUP *group, EC_POINT *r, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1666 | const BIGNUM *scalar, BN_CTX *ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1667 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1668 | return executed 508 times by 4 tests: ec_GFp_simple_mul_ct(group, r, scalar, return ec_GFp_simple_mul_ct(group, r, scalar, ((void *)0) , ctx); Executed by:
executed 508 times by 4 tests: return ec_GFp_simple_mul_ct(group, r, scalar, ((void *)0) , ctx); Executed by:
| 508 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1669 | ((void *)0) executed 508 times by 4 tests: return ec_GFp_simple_mul_ct(group, r, scalar, ((void *)0) , ctx); Executed by:
| 508 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1670 | , ctx); executed 508 times by 4 tests: return ec_GFp_simple_mul_ct(group, r, scalar, ((void *)0) , ctx); Executed by:
| 508 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1671 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1672 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1673 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1674 | ec_GFp_simple_mul_single_ct(const EC_GROUP *group, EC_POINT *r, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1675 | const BIGNUM *scalar, const EC_POINT *point, BN_CTX *ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1676 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1677 | return executed 206 times by 4 tests: ec_GFp_simple_mul_ct(group, r, scalar, point, ctx);return ec_GFp_simple_mul_ct(group, r, scalar, point, ctx); Executed by:
executed 206 times by 4 tests: return ec_GFp_simple_mul_ct(group, r, scalar, point, ctx); Executed by:
| 206 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1678 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1679 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
1680 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1681 | ec_GFp_simple_mul_double_nonct(const EC_GROUP *group, EC_POINT *r, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1682 | const BIGNUM *g_scalar, const BIGNUM *p_scalar, const EC_POINT *point, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1683 | BN_CTX *ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1684 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1685 | return executed 379 times by 1 test: ec_wNAF_mul(group, r, g_scalar, 1, &point, &p_scalar, ctx);return ec_wNAF_mul(group, r, g_scalar, 1, &point, &p_scalar, ctx); Executed by:
executed 379 times by 1 test: return ec_wNAF_mul(group, r, g_scalar, 1, &point, &p_scalar, ctx); Executed by:
| 379 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
1686 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |