Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/ec/ecp_oct.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||
4 | int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group, | - | ||||||||||||||||||||||||
5 | EC_POINT *point, | - | ||||||||||||||||||||||||
6 | const BIGNUM *x_, int y_bit, | - | ||||||||||||||||||||||||
7 | BN_CTX *ctx) | - | ||||||||||||||||||||||||
8 | { | - | ||||||||||||||||||||||||
9 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||
10 | ((void *)0) | - | ||||||||||||||||||||||||
11 | ; | - | ||||||||||||||||||||||||
12 | BIGNUM *tmp1, *tmp2, *x, *y; | - | ||||||||||||||||||||||||
13 | int ret = 0; | - | ||||||||||||||||||||||||
14 | - | |||||||||||||||||||||||||
15 | - | |||||||||||||||||||||||||
16 | ERR_clear_error(); | - | ||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||
18 | if (ctx ==
| 0-4526 | ||||||||||||||||||||||||
19 | ((void *)0)
| 0-4526 | ||||||||||||||||||||||||
20 | ) { | - | ||||||||||||||||||||||||
21 | ctx = new_ctx = BN_CTX_new(); | - | ||||||||||||||||||||||||
22 | if (ctx ==
| 0 | ||||||||||||||||||||||||
23 | ((void *)0)
| 0 | ||||||||||||||||||||||||
24 | ) | - | ||||||||||||||||||||||||
25 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
26 | } never executed: end of block | 0 | ||||||||||||||||||||||||
27 | - | |||||||||||||||||||||||||
28 | y_bit = (y_bit != 0); | - | ||||||||||||||||||||||||
29 | - | |||||||||||||||||||||||||
30 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||
31 | tmp1 = BN_CTX_get(ctx); | - | ||||||||||||||||||||||||
32 | tmp2 = BN_CTX_get(ctx); | - | ||||||||||||||||||||||||
33 | x = BN_CTX_get(ctx); | - | ||||||||||||||||||||||||
34 | y = BN_CTX_get(ctx); | - | ||||||||||||||||||||||||
35 | if (y ==
| 0-4526 | ||||||||||||||||||||||||
36 | ((void *)0)
| 0-4526 | ||||||||||||||||||||||||
37 | ) | - | ||||||||||||||||||||||||
38 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
39 | if (!BN_nnmod(x, x_, group->field, ctx)
| 0-4526 | ||||||||||||||||||||||||
40 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
41 | if (group->meth->field_decode == 0
| 0-4526 | ||||||||||||||||||||||||
42 | - | |||||||||||||||||||||||||
43 | if (!group->meth->field_sqr(group, tmp2, x_, ctx)
| 0 | ||||||||||||||||||||||||
44 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
45 | if (!group->meth->field_mul(group, tmp1, tmp2, x_, ctx)
| 0 | ||||||||||||||||||||||||
46 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
47 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
48 | if (!BN_mod_sqr(tmp2, x_, group->field, ctx)
| 0-4526 | ||||||||||||||||||||||||
49 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
50 | if (!BN_mod_mul(tmp1, tmp2, x_, group->field, ctx)
| 0-4526 | ||||||||||||||||||||||||
51 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
52 | } executed 4526 times by 1 test: end of block Executed by:
| 4526 | ||||||||||||||||||||||||
53 | - | |||||||||||||||||||||||||
54 | - | |||||||||||||||||||||||||
55 | if (group->a_is_minus3
| 787-3739 | ||||||||||||||||||||||||
56 | if (!BN_mod_lshift1_quick(tmp2, x, group->field)
| 0-3739 | ||||||||||||||||||||||||
57 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
58 | if (!BN_mod_add_quick(tmp2, tmp2, x, group->field)
| 0-3739 | ||||||||||||||||||||||||
59 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
60 | if (!BN_mod_sub_quick(tmp1, tmp1, tmp2, group->field)
| 0-3739 | ||||||||||||||||||||||||
61 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
62 | } executed 3739 times by 1 test: else {end of block Executed by:
| 3739 | ||||||||||||||||||||||||
63 | if (group->meth->field_decode
| 0-787 | ||||||||||||||||||||||||
64 | if (!group->meth->field_decode(group, tmp2, group->a, ctx)
| 0-787 | ||||||||||||||||||||||||
65 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
66 | if (!BN_mod_mul(tmp2, tmp2, x, group->field, ctx)
| 0-787 | ||||||||||||||||||||||||
67 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
68 | } executed 787 times by 1 test: else {end of block Executed by:
| 787 | ||||||||||||||||||||||||
69 | - | |||||||||||||||||||||||||
70 | if (!group->meth->field_mul(group, tmp2, group->a, x, ctx)
| 0 | ||||||||||||||||||||||||
71 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
72 | } never executed: end of block | 0 | ||||||||||||||||||||||||
73 | - | |||||||||||||||||||||||||
74 | if (!BN_mod_add_quick(tmp1, tmp1, tmp2, group->field)
| 0-787 | ||||||||||||||||||||||||
75 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
76 | } executed 787 times by 1 test: end of block Executed by:
| 787 | ||||||||||||||||||||||||
77 | - | |||||||||||||||||||||||||
78 | - | |||||||||||||||||||||||||
79 | if (group->meth->field_decode
| 0-4526 | ||||||||||||||||||||||||
80 | if (!group->meth->field_decode(group, tmp2, group->b, ctx)
| 0-4526 | ||||||||||||||||||||||||
81 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
82 | if (!BN_mod_add_quick(tmp1, tmp1, tmp2, group->field)
| 0-4526 | ||||||||||||||||||||||||
83 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
84 | } executed 4526 times by 1 test: else {end of block Executed by:
| 4526 | ||||||||||||||||||||||||
85 | if (!BN_mod_add_quick(tmp1, tmp1, group->b, group->field)
| 0 | ||||||||||||||||||||||||
86 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
87 | } never executed: end of block | 0 | ||||||||||||||||||||||||
88 | - | |||||||||||||||||||||||||
89 | if (!BN_mod_sqrt(y, tmp1, group->field, ctx)
| 1279-3247 | ||||||||||||||||||||||||
90 | unsigned long err = ERR_peek_last_error(); | - | ||||||||||||||||||||||||
91 | - | |||||||||||||||||||||||||
92 | if ((
| 0-1279 | ||||||||||||||||||||||||
93 | && (
| 14-1265 | ||||||||||||||||||||||||
94 | ERR_clear_error(); | - | ||||||||||||||||||||||||
95 | ERR_put_error(16,(169),(110),__FILE__,108) | - | ||||||||||||||||||||||||
96 | ; | - | ||||||||||||||||||||||||
97 | } executed 1265 times by 1 test: elseend of block Executed by:
| 1265 | ||||||||||||||||||||||||
98 | ERR_put_error(16,(169),(3),__FILE__,111) executed 14 times by 1 test: ERR_put_error(16,(169),(3),__FILE__,111) ; Executed by:
| 14 | ||||||||||||||||||||||||
99 | ; executed 14 times by 1 test: ERR_put_error(16,(169),(3),__FILE__,111) ; Executed by:
| 14 | ||||||||||||||||||||||||
100 | goto executed 1279 times by 1 test: err;goto err; Executed by:
executed 1279 times by 1 test: goto err; Executed by:
| 1279 | ||||||||||||||||||||||||
101 | } | - | ||||||||||||||||||||||||
102 | - | |||||||||||||||||||||||||
103 | if (y_bit != BN_is_odd(y)
| 1477-1770 | ||||||||||||||||||||||||
104 | if (BN_is_zero(y)
| 0-1477 | ||||||||||||||||||||||||
105 | int kron; | - | ||||||||||||||||||||||||
106 | - | |||||||||||||||||||||||||
107 | kron = BN_kronecker(x, group->field, ctx); | - | ||||||||||||||||||||||||
108 | if (kron == -2
| 0 | ||||||||||||||||||||||||
109 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
110 | - | |||||||||||||||||||||||||
111 | if (kron == 1
| 0 | ||||||||||||||||||||||||
112 | ERR_put_error(16,(169),(109),__FILE__,125) never executed: ERR_put_error(16,(169),(109),__FILE__,125) ; | 0 | ||||||||||||||||||||||||
113 | ; never executed: ERR_put_error(16,(169),(109),__FILE__,125) ; | 0 | ||||||||||||||||||||||||
114 | else | - | ||||||||||||||||||||||||
115 | - | |||||||||||||||||||||||||
116 | - | |||||||||||||||||||||||||
117 | - | |||||||||||||||||||||||||
118 | ERR_put_error(16,(169),(110),__FILE__,131) never executed: ERR_put_error(16,(169),(110),__FILE__,131) ; | 0 | ||||||||||||||||||||||||
119 | ; never executed: ERR_put_error(16,(169),(110),__FILE__,131) ; | 0 | ||||||||||||||||||||||||
120 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
121 | } | - | ||||||||||||||||||||||||
122 | if (!BN_usub(y, group->field, y)
| 0-1477 | ||||||||||||||||||||||||
123 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
124 | } executed 1477 times by 1 test: end of block Executed by:
| 1477 | ||||||||||||||||||||||||
125 | if (y_bit != BN_is_odd(y)
| 0-3247 | ||||||||||||||||||||||||
126 | ERR_put_error(16,(169),((4|64)),__FILE__,139) | - | ||||||||||||||||||||||||
127 | ; | - | ||||||||||||||||||||||||
128 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
129 | } | - | ||||||||||||||||||||||||
130 | - | |||||||||||||||||||||||||
131 | if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx)
| 0-3247 | ||||||||||||||||||||||||
132 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
133 | - | |||||||||||||||||||||||||
134 | ret = 1; | - | ||||||||||||||||||||||||
135 | - | |||||||||||||||||||||||||
136 | err: code before this statement executed 3247 times by 1 test: err: Executed by:
| 3247 | ||||||||||||||||||||||||
137 | BN_CTX_end(ctx); | - | ||||||||||||||||||||||||
138 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||
139 | return executed 4526 times by 1 test: ret;return ret; Executed by:
executed 4526 times by 1 test: return ret; Executed by:
| 4526 | ||||||||||||||||||||||||
140 | } | - | ||||||||||||||||||||||||
141 | - | |||||||||||||||||||||||||
142 | size_t ec_GFp_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, | - | ||||||||||||||||||||||||
143 | point_conversion_form_t form, | - | ||||||||||||||||||||||||
144 | unsigned char *buf, size_t len, BN_CTX *ctx) | - | ||||||||||||||||||||||||
145 | { | - | ||||||||||||||||||||||||
146 | size_t ret; | - | ||||||||||||||||||||||||
147 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||
148 | ((void *)0) | - | ||||||||||||||||||||||||
149 | ; | - | ||||||||||||||||||||||||
150 | int used_ctx = 0; | - | ||||||||||||||||||||||||
151 | BIGNUM *x, *y; | - | ||||||||||||||||||||||||
152 | size_t field_len, i, skip; | - | ||||||||||||||||||||||||
153 | - | |||||||||||||||||||||||||
154 | if ((
| 217-41437 | ||||||||||||||||||||||||
155 | && (
| 12-41425 | ||||||||||||||||||||||||
156 | && (
| 1-11 | ||||||||||||||||||||||||
157 | ERR_put_error(16,(104),(104),__FILE__,167); | - | ||||||||||||||||||||||||
158 | goto executed 1 time by 1 test: err;goto err; Executed by:
executed 1 time by 1 test: goto err; Executed by:
| 1 | ||||||||||||||||||||||||
159 | } | - | ||||||||||||||||||||||||
160 | - | |||||||||||||||||||||||||
161 | if (EC_POINT_is_at_infinity(group, point)
| 28-41625 | ||||||||||||||||||||||||
162 | - | |||||||||||||||||||||||||
163 | if (buf !=
| 14 | ||||||||||||||||||||||||
164 | ((void *)0)
| 14 | ||||||||||||||||||||||||
165 | ) { | - | ||||||||||||||||||||||||
166 | if (len < 1
| 0-14 | ||||||||||||||||||||||||
167 | ERR_put_error(16,(104),(100),__FILE__,175); | - | ||||||||||||||||||||||||
168 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
169 | } | - | ||||||||||||||||||||||||
170 | buf[0] = 0; | - | ||||||||||||||||||||||||
171 | } executed 14 times by 1 test: end of block Executed by:
| 14 | ||||||||||||||||||||||||
172 | return executed 28 times by 1 test: 1;return 1; Executed by:
executed 28 times by 1 test: return 1; Executed by:
| 28 | ||||||||||||||||||||||||
173 | } | - | ||||||||||||||||||||||||
174 | - | |||||||||||||||||||||||||
175 | - | |||||||||||||||||||||||||
176 | field_len = ((BN_num_bits(group->field)+7)/8); | - | ||||||||||||||||||||||||
177 | ret = | - | ||||||||||||||||||||||||
178 | (
| 217-41408 | ||||||||||||||||||||||||
179 | POINT_CONVERSION_COMPRESSED)
| 217-41408 | ||||||||||||||||||||||||
180 | - | |||||||||||||||||||||||||
181 | - | |||||||||||||||||||||||||
182 | if (buf !=
| 14268-27357 | ||||||||||||||||||||||||
183 | ((void *)0)
| 14268-27357 | ||||||||||||||||||||||||
184 | ) { | - | ||||||||||||||||||||||||
185 | if (len < ret
| 0-14268 | ||||||||||||||||||||||||
186 | ERR_put_error(16,(104),(100),__FILE__,192); | - | ||||||||||||||||||||||||
187 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
188 | } | - | ||||||||||||||||||||||||
189 | - | |||||||||||||||||||||||||
190 | if (ctx ==
| 48-14220 | ||||||||||||||||||||||||
191 | ((void *)0)
| 48-14220 | ||||||||||||||||||||||||
192 | ) { | - | ||||||||||||||||||||||||
193 | ctx = new_ctx = BN_CTX_new(); | - | ||||||||||||||||||||||||
194 | if (ctx ==
| 0-14220 | ||||||||||||||||||||||||
195 | ((void *)0)
| 0-14220 | ||||||||||||||||||||||||
196 | ) | - | ||||||||||||||||||||||||
197 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
198 | } executed 14220 times by 1 test: end of block Executed by:
| 14220 | ||||||||||||||||||||||||
199 | - | |||||||||||||||||||||||||
200 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||
201 | used_ctx = 1; | - | ||||||||||||||||||||||||
202 | x = BN_CTX_get(ctx); | - | ||||||||||||||||||||||||
203 | y = BN_CTX_get(ctx); | - | ||||||||||||||||||||||||
204 | if (y ==
| 0-14268 | ||||||||||||||||||||||||
205 | ((void *)0)
| 0-14268 | ||||||||||||||||||||||||
206 | ) | - | ||||||||||||||||||||||||
207 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
208 | - | |||||||||||||||||||||||||
209 | if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx)
| 0-14268 | ||||||||||||||||||||||||
210 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
211 | - | |||||||||||||||||||||||||
212 | if ((form == POINT_CONVERSION_COMPRESSED
| 109-14159 | ||||||||||||||||||||||||
213 | || form == POINT_CONVERSION_HYBRID
| 6-14153 | ||||||||||||||||||||||||
214 | buf[0] = form + 1; executed 12 times by 1 test: buf[0] = form + 1; Executed by:
| 12 | ||||||||||||||||||||||||
215 | else | - | ||||||||||||||||||||||||
216 | buf[0] = form; executed 14256 times by 1 test: buf[0] = form; Executed by:
| 14256 | ||||||||||||||||||||||||
217 | - | |||||||||||||||||||||||||
218 | i = 1; | - | ||||||||||||||||||||||||
219 | - | |||||||||||||||||||||||||
220 | skip = field_len - ((BN_num_bits(x)+7)/8); | - | ||||||||||||||||||||||||
221 | if (skip > field_len
| 0-14268 | ||||||||||||||||||||||||
222 | ERR_put_error(16,(104),((4|64)),__FILE__,222); | - | ||||||||||||||||||||||||
223 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
224 | } | - | ||||||||||||||||||||||||
225 | while (skip > 0
| 736-14268 | ||||||||||||||||||||||||
226 | buf[i++] = 0; | - | ||||||||||||||||||||||||
227 | skip--; | - | ||||||||||||||||||||||||
228 | } executed 736 times by 1 test: end of block Executed by:
| 736 | ||||||||||||||||||||||||
229 | skip = BN_bn2bin(x, buf + i); | - | ||||||||||||||||||||||||
230 | i += skip; | - | ||||||||||||||||||||||||
231 | if (i != 1 + field_len
| 0-14268 | ||||||||||||||||||||||||
232 | ERR_put_error(16,(104),((4|64)),__FILE__,232); | - | ||||||||||||||||||||||||
233 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
234 | } | - | ||||||||||||||||||||||||
235 | - | |||||||||||||||||||||||||
236 | if (form == POINT_CONVERSION_UNCOMPRESSED
| 115-14153 | ||||||||||||||||||||||||
237 | || form == POINT_CONVERSION_HYBRID
| 6-109 | ||||||||||||||||||||||||
238 | skip = field_len - ((BN_num_bits(y)+7)/8); | - | ||||||||||||||||||||||||
239 | if (skip > field_len
| 0-14159 | ||||||||||||||||||||||||
240 | ERR_put_error(16,(104),((4|64)),__FILE__,240); | - | ||||||||||||||||||||||||
241 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
242 | } | - | ||||||||||||||||||||||||
243 | while (skip > 0
| 339-14159 | ||||||||||||||||||||||||
244 | buf[i++] = 0; | - | ||||||||||||||||||||||||
245 | skip--; | - | ||||||||||||||||||||||||
246 | } executed 339 times by 1 test: end of block Executed by:
| 339 | ||||||||||||||||||||||||
247 | skip = BN_bn2bin(y, buf + i); | - | ||||||||||||||||||||||||
248 | i += skip; | - | ||||||||||||||||||||||||
249 | } executed 14159 times by 1 test: end of block Executed by:
| 14159 | ||||||||||||||||||||||||
250 | - | |||||||||||||||||||||||||
251 | if (i != ret
| 0-14268 | ||||||||||||||||||||||||
252 | ERR_put_error(16,(104),((4|64)),__FILE__,252); | - | ||||||||||||||||||||||||
253 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
254 | } | - | ||||||||||||||||||||||||
255 | } executed 14268 times by 1 test: end of block Executed by:
| 14268 | ||||||||||||||||||||||||
256 | - | |||||||||||||||||||||||||
257 | if (used_ctx
| 14268-27357 | ||||||||||||||||||||||||
258 | BN_CTX_end(ctx); executed 14268 times by 1 test: BN_CTX_end(ctx); Executed by:
| 14268 | ||||||||||||||||||||||||
259 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||
260 | return executed 41625 times by 1 test: ret;return ret; Executed by:
executed 41625 times by 1 test: return ret; Executed by:
| 41625 | ||||||||||||||||||||||||
261 | - | |||||||||||||||||||||||||
262 | err: | - | ||||||||||||||||||||||||
263 | if (used_ctx
| 0-1 | ||||||||||||||||||||||||
264 | BN_CTX_end(ctx); never executed: BN_CTX_end(ctx); | 0 | ||||||||||||||||||||||||
265 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||
266 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||||||||
267 | } | - | ||||||||||||||||||||||||
268 | - | |||||||||||||||||||||||||
269 | int ec_GFp_simple_oct2point(const EC_GROUP *group, EC_POINT *point, | - | ||||||||||||||||||||||||
270 | const unsigned char *buf, size_t len, BN_CTX *ctx) | - | ||||||||||||||||||||||||
271 | { | - | ||||||||||||||||||||||||
272 | point_conversion_form_t form; | - | ||||||||||||||||||||||||
273 | int y_bit; | - | ||||||||||||||||||||||||
274 | BN_CTX *new_ctx = | - | ||||||||||||||||||||||||
275 | ((void *)0) | - | ||||||||||||||||||||||||
276 | ; | - | ||||||||||||||||||||||||
277 | BIGNUM *x, *y; | - | ||||||||||||||||||||||||
278 | size_t field_len, enc_len; | - | ||||||||||||||||||||||||
279 | int ret = 0; | - | ||||||||||||||||||||||||
280 | - | |||||||||||||||||||||||||
281 | if (len == 0
| 276-24879 | ||||||||||||||||||||||||
282 | ERR_put_error(16,(103),(100),__FILE__,280); | - | ||||||||||||||||||||||||
283 | return executed 276 times by 1 test: 0;return 0; Executed by:
executed 276 times by 1 test: return 0; Executed by:
| 276 | ||||||||||||||||||||||||
284 | } | - | ||||||||||||||||||||||||
285 | form = buf[0]; | - | ||||||||||||||||||||||||
286 | y_bit = form & 1; | - | ||||||||||||||||||||||||
287 | form = form & ~1U; | - | ||||||||||||||||||||||||
288 | if ((
| 462-24417 | ||||||||||||||||||||||||
289 | && (
| 551-19008 | ||||||||||||||||||||||||
290 | && (
| 250-301 | ||||||||||||||||||||||||
291 | ERR_put_error(16,(103),(102),__FILE__,289); | - | ||||||||||||||||||||||||
292 | return executed 250 times by 1 test: 0;return 0; Executed by:
executed 250 times by 1 test: return 0; Executed by:
| 250 | ||||||||||||||||||||||||
293 | } | - | ||||||||||||||||||||||||
294 | if ((form == 0
| 74-24167 | ||||||||||||||||||||||||
295 | ERR_put_error(16,(103),(102),__FILE__,293); | - | ||||||||||||||||||||||||
296 | return executed 74 times by 1 test: 0;return 0; Executed by:
executed 74 times by 1 test: return 0; Executed by:
| 74 | ||||||||||||||||||||||||
297 | } | - | ||||||||||||||||||||||||
298 | - | |||||||||||||||||||||||||
299 | if (form == 0
| 393-24162 | ||||||||||||||||||||||||
300 | if (len != 1
| 80-313 | ||||||||||||||||||||||||
301 | ERR_put_error(16,(103),(102),__FILE__,299); | - | ||||||||||||||||||||||||
302 | return executed 80 times by 1 test: 0;return 0; Executed by:
executed 80 times by 1 test: return 0; Executed by:
| 80 | ||||||||||||||||||||||||
303 | } | - | ||||||||||||||||||||||||
304 | - | |||||||||||||||||||||||||
305 | return executed 313 times by 1 test: EC_POINT_set_to_infinity(group, point);return EC_POINT_set_to_infinity(group, point); Executed by:
executed 313 times by 1 test: return EC_POINT_set_to_infinity(group, point); Executed by:
| 313 | ||||||||||||||||||||||||
306 | } | - | ||||||||||||||||||||||||
307 | - | |||||||||||||||||||||||||
308 | field_len = ((BN_num_bits(group->field)+7)/8); | - | ||||||||||||||||||||||||
309 | enc_len = | - | ||||||||||||||||||||||||
310 | (
| 4858-19304 | ||||||||||||||||||||||||
311 | POINT_CONVERSION_COMPRESSED)
| 4858-19304 | ||||||||||||||||||||||||
312 | - | |||||||||||||||||||||||||
313 | if (len != enc_len
| 360-23802 | ||||||||||||||||||||||||
314 | ERR_put_error(16,(103),(102),__FILE__,312); | - | ||||||||||||||||||||||||
315 | return executed 360 times by 1 test: 0;return 0; Executed by:
executed 360 times by 1 test: return 0; Executed by:
| 360 | ||||||||||||||||||||||||
316 | } | - | ||||||||||||||||||||||||
317 | - | |||||||||||||||||||||||||
318 | if (ctx ==
| 3-23799 | ||||||||||||||||||||||||
319 | ((void *)0)
| 3-23799 | ||||||||||||||||||||||||
320 | ) { | - | ||||||||||||||||||||||||
321 | ctx = new_ctx = BN_CTX_new(); | - | ||||||||||||||||||||||||
322 | if (ctx ==
| 0-23799 | ||||||||||||||||||||||||
323 | ((void *)0)
| 0-23799 | ||||||||||||||||||||||||
324 | ) | - | ||||||||||||||||||||||||
325 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
326 | } executed 23799 times by 1 test: end of block Executed by:
| 23799 | ||||||||||||||||||||||||
327 | - | |||||||||||||||||||||||||
328 | BN_CTX_start(ctx); | - | ||||||||||||||||||||||||
329 | x = BN_CTX_get(ctx); | - | ||||||||||||||||||||||||
330 | y = BN_CTX_get(ctx); | - | ||||||||||||||||||||||||
331 | if (y ==
| 0-23802 | ||||||||||||||||||||||||
332 | ((void *)0)
| 0-23802 | ||||||||||||||||||||||||
333 | ) | - | ||||||||||||||||||||||||
334 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
335 | - | |||||||||||||||||||||||||
336 | if (!BN_bin2bn(buf + 1, field_len, x)
| 0-23802 | ||||||||||||||||||||||||
337 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
338 | if (BN_ucmp(x, group->field) >= 0
| 91-23711 | ||||||||||||||||||||||||
339 | ERR_put_error(16,(103),(102),__FILE__,331); | - | ||||||||||||||||||||||||
340 | goto executed 91 times by 1 test: err;goto err; Executed by:
executed 91 times by 1 test: goto err; Executed by:
| 91 | ||||||||||||||||||||||||
341 | } | - | ||||||||||||||||||||||||
342 | - | |||||||||||||||||||||||||
343 | if (form == POINT_CONVERSION_COMPRESSED
| 4520-19191 | ||||||||||||||||||||||||
344 | if (!EC_POINT_set_compressed_coordinates(group, point, x, y_bit, ctx)
| 1279-3241 | ||||||||||||||||||||||||
345 | goto executed 1279 times by 1 test: err;goto err; Executed by:
executed 1279 times by 1 test: goto err; Executed by:
| 1279 | ||||||||||||||||||||||||
346 | } executed 3241 times by 1 test: else {end of block Executed by:
| 3241 | ||||||||||||||||||||||||
347 | if (!BN_bin2bn(buf + 1 + field_len, field_len, y)
| 0-19191 | ||||||||||||||||||||||||
348 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
349 | if (BN_ucmp(y, group->field) >= 0
| 84-19107 | ||||||||||||||||||||||||
350 | ERR_put_error(16,(103),(102),__FILE__,342); | - | ||||||||||||||||||||||||
351 | goto executed 84 times by 1 test: err;goto err; Executed by:
executed 84 times by 1 test: goto err; Executed by:
| 84 | ||||||||||||||||||||||||
352 | } | - | ||||||||||||||||||||||||
353 | if (form == POINT_CONVERSION_HYBRID
| 173-18934 | ||||||||||||||||||||||||
354 | if (y_bit != BN_is_odd(y)
| 73-100 | ||||||||||||||||||||||||
355 | ERR_put_error(16,(103),(102),__FILE__,347); | - | ||||||||||||||||||||||||
356 | goto executed 73 times by 1 test: err;goto err; Executed by:
executed 73 times by 1 test: goto err; Executed by:
| 73 | ||||||||||||||||||||||||
357 | } | - | ||||||||||||||||||||||||
358 | } executed 100 times by 1 test: end of block Executed by:
| 100 | ||||||||||||||||||||||||
359 | - | |||||||||||||||||||||||||
360 | - | |||||||||||||||||||||||||
361 | - | |||||||||||||||||||||||||
362 | - | |||||||||||||||||||||||||
363 | - | |||||||||||||||||||||||||
364 | if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx)
| 479-18555 | ||||||||||||||||||||||||
365 | goto executed 479 times by 1 test: err;goto err; Executed by:
executed 479 times by 1 test: goto err; Executed by:
| 479 | ||||||||||||||||||||||||
366 | } executed 18555 times by 1 test: end of block Executed by:
| 18555 | ||||||||||||||||||||||||
367 | - | |||||||||||||||||||||||||
368 | ret = 1; | - | ||||||||||||||||||||||||
369 | - | |||||||||||||||||||||||||
370 | err: code before this statement executed 21796 times by 1 test: err: Executed by:
| 21796 | ||||||||||||||||||||||||
371 | BN_CTX_end(ctx); | - | ||||||||||||||||||||||||
372 | BN_CTX_free(new_ctx); | - | ||||||||||||||||||||||||
373 | return executed 23802 times by 1 test: ret;return ret; Executed by:
executed 23802 times by 1 test: return ret; Executed by:
| 23802 | ||||||||||||||||||||||||
374 | } | - | ||||||||||||||||||||||||
Switch to Source code | Preprocessed file |