OpenCoverage

ec2_oct.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/ec/ec2_oct.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/* $OpenBSD: ec2_oct.c,v 1.11 2018/07/15 16:27:39 tb Exp $ */-
2/* ====================================================================-
3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.-
4 *-
5 * The Elliptic Curve Public-Key Crypto Library (ECC Code) included-
6 * herein is developed by SUN MICROSYSTEMS, INC., and is contributed-
7 * to the OpenSSL project.-
8 *-
9 * The ECC Code is licensed pursuant to the OpenSSL open source-
10 * license provided below.-
11 *-
12 * The software is originally written by Sheueling Chang Shantz and-
13 * Douglas Stebila of Sun Microsystems Laboratories.-
14 *-
15 */-
16/* ====================================================================-
17 * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved.-
18 *-
19 * Redistribution and use in source and binary forms, with or without-
20 * modification, are permitted provided that the following conditions-
21 * are met:-
22 *-
23 * 1. Redistributions of source code must retain the above copyright-
24 * notice, this list of conditions and the following disclaimer.-
25 *-
26 * 2. Redistributions in binary form must reproduce the above copyright-
27 * notice, this list of conditions and the following disclaimer in-
28 * the documentation and/or other materials provided with the-
29 * distribution.-
30 *-
31 * 3. All advertising materials mentioning features or use of this-
32 * software must display the following acknowledgment:-
33 * "This product includes software developed by the OpenSSL Project-
34 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"-
35 *-
36 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to-
37 * endorse or promote products derived from this software without-
38 * prior written permission. For written permission, please contact-
39 * openssl-core@openssl.org.-
40 *-
41 * 5. Products derived from this software may not be called "OpenSSL"-
42 * nor may "OpenSSL" appear in their names without prior written-
43 * permission of the OpenSSL Project.-
44 *-
45 * 6. Redistributions of any form whatsoever must retain the following-
46 * acknowledgment:-
47 * "This product includes software developed by the OpenSSL Project-
48 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"-
49 *-
50 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY-
51 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE-
52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR-
53 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR-
54 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,-
55 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT-
56 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;-
57 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)-
58 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,-
59 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)-
60 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED-
61 * OF THE POSSIBILITY OF SUCH DAMAGE.-
62 * ====================================================================-
63 *-
64 * This product includes cryptographic software written by Eric Young-
65 * (eay@cryptsoft.com). This product includes software written by Tim-
66 * Hudson (tjh@cryptsoft.com).-
67 *-
68 */-
69-
70#include <openssl/opensslconf.h>-
71-
72#include <openssl/err.h>-
73-
74#include "ec_lcl.h"-
75-
76#ifndef OPENSSL_NO_EC2M-
77-
78/* Calculates and sets the affine coordinates of an EC_POINT from the given-
79 * compressed coordinates. Uses algorithm 2.3.4 of SEC 1.-
80 * Note that the simple implementation only uses affine coordinates.-
81 *-
82 * The method is from the following publication:-
83 *-
84 * Harper, Menezes, Vanstone:-
85 * "Public-Key Cryptosystems with Very Small Key Lengths",-
86 * EUROCRYPT '92, Springer-Verlag LNCS 658,-
87 * published February 1993-
88 *-
89 * US Patents 6,141,420 and 6,618,483 (Vanstone, Mullin, Agnew) describe-
90 * the same method, but claim no priority date earlier than July 29, 1994-
91 * (and additionally fail to cite the EUROCRYPT '92 publication as prior art).-
92 */-
93int -
94ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point,-
95 const BIGNUM *x_, int y_bit, BN_CTX *ctx)-
96{-
97 BN_CTX *new_ctx = NULL;-
98 BIGNUM *tmp, *x, *y, *z;-
99 int ret = 0, z0;-
100-
101 /* clear error queue */-
102 ERR_clear_error();-
103-
104 if (ctx == NULL) {
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
105 ctx = new_ctx = BN_CTX_new();-
106 if (ctx == NULL)
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
107 return 0;
never executed: return 0;
0
108 }
never executed: end of block
0
109 y_bit = (y_bit != 0) ? 1 : 0;
(y_bit != 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
110-
111 BN_CTX_start(ctx);-
112 if ((tmp = BN_CTX_get(ctx)) == NULL)
(tmp = BN_CTX_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
113 goto err;
never executed: goto err;
0
114 if ((x = BN_CTX_get(ctx)) == NULL)
(x = BN_CTX_ge...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
115 goto err;
never executed: goto err;
0
116 if ((y = BN_CTX_get(ctx)) == NULL)
(y = BN_CTX_ge...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
117 goto err;
never executed: goto err;
0
118 if ((z = BN_CTX_get(ctx)) == NULL)
(z = BN_CTX_ge...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
119 goto err;
never executed: goto err;
0
120-
121 if (!BN_GF2m_mod_arr(x, x_, group->poly))
!BN_GF2m_mod_a..., group->poly)Description
TRUEnever evaluated
FALSEnever evaluated
0
122 goto err;
never executed: goto err;
0
123 if (BN_is_zero(x)) {
((x)->top == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
124 if (!BN_GF2m_mod_sqrt_arr(y, &group->b, group->poly, ctx))
!BN_GF2m_mod_s...up->poly, ctx)Description
TRUEnever evaluated
FALSEnever evaluated
0
125 goto err;
never executed: goto err;
0
126 } else {
never executed: end of block
0
127 if (!group->meth->field_sqr(group, tmp, x, ctx))
!group->meth->..., tmp, x, ctx)Description
TRUEnever evaluated
FALSEnever evaluated
0
128 goto err;
never executed: goto err;
0
129 if (!group->meth->field_div(group, tmp, &group->b, tmp, ctx))
!group->meth->...->b, tmp, ctx)Description
TRUEnever evaluated
FALSEnever evaluated
0
130 goto err;
never executed: goto err;
0
131 if (!BN_GF2m_add(tmp, &group->a, tmp))
!BN_GF2m_add(t...group->a, tmp)Description
TRUEnever evaluated
FALSEnever evaluated
0
132 goto err;
never executed: goto err;
0
133 if (!BN_GF2m_add(tmp, x, tmp))
!BN_GF2m_add(tmp, x, tmp)Description
TRUEnever evaluated
FALSEnever evaluated
0
134 goto err;
never executed: goto err;
0
135 if (!BN_GF2m_mod_solve_quad_arr(z, tmp, group->poly, ctx)) {
!BN_GF2m_mod_s...up->poly, ctx)Description
TRUEnever evaluated
FALSEnever evaluated
0
136 unsigned long err = ERR_peek_last_error();-
137-
138 if (ERR_GET_LIB(err) == ERR_LIB_BN &&
(int)((((unsig...L)&0xffL) == 3Description
TRUEnever evaluated
FALSEnever evaluated
0
139 ERR_GET_REASON(err) == BN_R_NO_SOLUTION) {
(int)((err)&0xfffL) == 116Description
TRUEnever evaluated
FALSEnever evaluated
0
140 ERR_clear_error();-
141 ECerror(EC_R_INVALID_COMPRESSED_POINT);-
142 } else
never executed: end of block
0
143 ECerror(ERR_R_BN_LIB);
never executed: ERR_put_error(16,(0xfff),(3),__FILE__,143);
0
144 goto err;
never executed: goto err;
0
145 }-
146 z0 = (BN_is_odd(z)) ? 1 : 0;
((z)->top > 0)Description
TRUEnever evaluated
FALSEnever evaluated
((z)->d[0] & 1)Description
TRUEnever evaluated
FALSEnever evaluated
0
147 if (!group->meth->field_mul(group, y, x, z, ctx))
!group->meth->... y, x, z, ctx)Description
TRUEnever evaluated
FALSEnever evaluated
0
148 goto err;
never executed: goto err;
0
149 if (z0 != y_bit) {
z0 != y_bitDescription
TRUEnever evaluated
FALSEnever evaluated
0
150 if (!BN_GF2m_add(y, y, x))
!BN_GF2m_add(y, y, x)Description
TRUEnever evaluated
FALSEnever evaluated
0
151 goto err;
never executed: goto err;
0
152 }
never executed: end of block
0
153 }
never executed: end of block
0
154-
155 if (!EC_POINT_set_affine_coordinates_GF2m(group, point, x, y, ctx))
!EC_POINT_set_...nt, x, y, ctx)Description
TRUEnever evaluated
FALSEnever evaluated
0
156 goto err;
never executed: goto err;
0
157-
158 ret = 1;-
159-
160 err:
code before this statement never executed: err:
0
161 BN_CTX_end(ctx);-
162 BN_CTX_free(new_ctx);-
163 return ret;
never executed: return ret;
0
164}-
165-
166-
167/* Converts an EC_POINT to an octet string.-
168 * If buf is NULL, the encoded length will be returned.-
169 * If the length len of buf is smaller than required an error will be returned.-
170 */-
171size_t -
172ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point,-
173 point_conversion_form_t form,-
174 unsigned char *buf, size_t len, BN_CTX * ctx)-
175{-
176 size_t ret;-
177 BN_CTX *new_ctx = NULL;-
178 int used_ctx = 0;-
179 BIGNUM *x, *y, *yxi;-
180 size_t field_len, i, skip;-
181-
182 if ((form != POINT_CONVERSION_COMPRESSED)
(form != POINT...ON_COMPRESSED)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • ectest
FALSEnever evaluated
0-1
183 && (form != POINT_CONVERSION_UNCOMPRESSED)
(form != POINT..._UNCOMPRESSED)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
184 && (form != POINT_CONVERSION_HYBRID)) {
(form != POINT...ERSION_HYBRID)Description
TRUEnever evaluated
FALSEnever evaluated
0
185 ECerror(EC_R_INVALID_FORM);-
186 goto err;
never executed: goto err;
0
187 }-
188 if (EC_POINT_is_at_infinity(group, point) > 0) {
EC_POINT_is_at...up, point) > 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
189 /* encodes to a single 0 octet */-
190 if (buf != NULL) {
buf != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
191 if (len < 1) {
len < 1Description
TRUEnever evaluated
FALSEnever evaluated
0
192 ECerror(EC_R_BUFFER_TOO_SMALL);-
193 return 0;
never executed: return 0;
0
194 }-
195 buf[0] = 0;-
196 }
never executed: end of block
0
197 return 1;
never executed: return 1;
0
198 }-
199 /* ret := required output buffer length */-
200 field_len = (EC_GROUP_get_degree(group) + 7) / 8;-
201 ret = (form == POINT_CONVERSION_COMPRESSED) ? 1 + field_len :
(form == POINT...ON_COMPRESSED)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
202 1 + 2 * field_len;-
203-
204 /* if 'buf' is NULL, just return required length */-
205 if (buf != NULL) {
buf != ((void *)0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • ectest
FALSEnever evaluated
0-1
206 if (len < ret) {
len < retDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
207 ECerror(EC_R_BUFFER_TOO_SMALL);-
208 goto err;
never executed: goto err;
0
209 }-
210 if (ctx == NULL) {
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
211 ctx = new_ctx = BN_CTX_new();-
212 if (ctx == NULL)
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
213 return 0;
never executed: return 0;
0
214 }
never executed: end of block
0
215 BN_CTX_start(ctx);-
216 used_ctx = 1;-
217 if ((x = BN_CTX_get(ctx)) == NULL)
(x = BN_CTX_ge...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
218 goto err;
never executed: goto err;
0
219 if ((y = BN_CTX_get(ctx)) == NULL)
(y = BN_CTX_ge...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
220 goto err;
never executed: goto err;
0
221 if ((yxi = BN_CTX_get(ctx)) == NULL)
(yxi = BN_CTX_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
222 goto err;
never executed: goto err;
0
223-
224 if (!EC_POINT_get_affine_coordinates_GF2m(group, point, x, y, ctx))
!EC_POINT_get_...nt, x, y, ctx)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
225 goto err;
never executed: goto err;
0
226-
227 buf[0] = form;-
228 if ((form != POINT_CONVERSION_UNCOMPRESSED) && !BN_is_zero(x)) {
(form != POINT..._UNCOMPRESSED)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
!((x)->top == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0-1
229 if (!group->meth->field_div(group, yxi, y, x, ctx))
!group->meth->...xi, y, x, ctx)Description
TRUEnever evaluated
FALSEnever evaluated
0
230 goto err;
never executed: goto err;
0
231 if (BN_is_odd(yxi))
((yxi)->top > 0)Description
TRUEnever evaluated
FALSEnever evaluated
((yxi)->d[0] & 1)Description
TRUEnever evaluated
FALSEnever evaluated
0
232 buf[0]++;
never executed: buf[0]++;
0
233 }
never executed: end of block
0
234 i = 1;-
235-
236 skip = field_len - BN_num_bytes(x);-
237 if (skip > field_len) {
skip > field_lenDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
238 ECerror(ERR_R_INTERNAL_ERROR);-
239 goto err;
never executed: goto err;
0
240 }-
241 while (skip > 0) {
skip > 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
242 buf[i++] = 0;-
243 skip--;-
244 }
never executed: end of block
0
245 skip = BN_bn2bin(x, buf + i);-
246 i += skip;-
247 if (i != 1 + field_len) {
i != 1 + field_lenDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
248 ECerror(ERR_R_INTERNAL_ERROR);-
249 goto err;
never executed: goto err;
0
250 }-
251 if (form == POINT_CONVERSION_UNCOMPRESSED ||
form == POINT_...N_UNCOMPRESSEDDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • ectest
FALSEnever evaluated
0-1
252 form == POINT_CONVERSION_HYBRID) {
form == POINT_...VERSION_HYBRIDDescription
TRUEnever evaluated
FALSEnever evaluated
0
253 skip = field_len - BN_num_bytes(y);-
254 if (skip > field_len) {
skip > field_lenDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
255 ECerror(ERR_R_INTERNAL_ERROR);-
256 goto err;
never executed: goto err;
0
257 }-
258 while (skip > 0) {
skip > 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
259 buf[i++] = 0;-
260 skip--;-
261 }
never executed: end of block
0
262 skip = BN_bn2bin(y, buf + i);-
263 i += skip;-
264 }
executed 1 time by 1 test: end of block
Executed by:
  • ectest
1
265 if (i != ret) {
i != retDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
266 ECerror(ERR_R_INTERNAL_ERROR);-
267 goto err;
never executed: goto err;
0
268 }-
269 }
executed 1 time by 1 test: end of block
Executed by:
  • ectest
1
270 if (used_ctx)
used_ctxDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • ectest
FALSEnever evaluated
0-1
271 BN_CTX_end(ctx);
executed 1 time by 1 test: BN_CTX_end(ctx);
Executed by:
  • ectest
1
272 BN_CTX_free(new_ctx);-
273 return ret;
executed 1 time by 1 test: return ret;
Executed by:
  • ectest
1
274-
275 err:-
276 if (used_ctx)
used_ctxDescription
TRUEnever evaluated
FALSEnever evaluated
0
277 BN_CTX_end(ctx);
never executed: BN_CTX_end(ctx);
0
278 BN_CTX_free(new_ctx);-
279 return 0;
never executed: return 0;
0
280}-
281-
282-
283/* Converts an octet string representation to an EC_POINT.-
284 * Note that the simple implementation only uses affine coordinates.-
285 */-
286int -
287ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,-
288 const unsigned char *buf, size_t len, BN_CTX *ctx)-
289{-
290 point_conversion_form_t form;-
291 int y_bit;-
292 BN_CTX *new_ctx = NULL;-
293 BIGNUM *x, *y, *yxi;-
294 size_t field_len, enc_len;-
295 int ret = 0;-
296-
297 if (len == 0) {
len == 0Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • ectest
0-2
298 ECerror(EC_R_BUFFER_TOO_SMALL);-
299 return 0;
never executed: return 0;
0
300 }-
301 form = buf[0];-
302 y_bit = form & 1;-
303 form = form & ~1U;-
304 if ((form != 0) && (form != POINT_CONVERSION_COMPRESSED) &&
(form != 0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • ectest
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
(form != POINT...ON_COMPRESSED)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • ectest
FALSEnever evaluated
0-1
305 (form != POINT_CONVERSION_UNCOMPRESSED) &&
(form != POINT..._UNCOMPRESSED)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
306 (form != POINT_CONVERSION_HYBRID)) {
(form != POINT...ERSION_HYBRID)Description
TRUEnever evaluated
FALSEnever evaluated
0
307 ECerror(EC_R_INVALID_ENCODING);-
308 return 0;
never executed: return 0;
0
309 }-
310 if ((form == 0 || form == POINT_CONVERSION_UNCOMPRESSED) && y_bit) {
form == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • ectest
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
form == POINT_...N_UNCOMPRESSEDDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • ectest
FALSEnever evaluated
y_bitDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • ectest
0-2
311 ECerror(EC_R_INVALID_ENCODING);-
312 return 0;
never executed: return 0;
0
313 }-
314 if (form == 0) {
form == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • ectest
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
1
315 if (len != 1) {
len != 1Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
316 ECerror(EC_R_INVALID_ENCODING);-
317 return 0;
never executed: return 0;
0
318 }-
319 return EC_POINT_set_to_infinity(group, point);
executed 1 time by 1 test: return EC_POINT_set_to_infinity(group, point);
Executed by:
  • ectest
1
320 }-
321 field_len = (EC_GROUP_get_degree(group) + 7) / 8;-
322 enc_len = (form == POINT_CONVERSION_COMPRESSED) ? 1 + field_len :
(form == POINT...ON_COMPRESSED)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
323 1 + 2 * field_len;-
324-
325 if (len != enc_len) {
len != enc_lenDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
326 ECerror(EC_R_INVALID_ENCODING);-
327 return 0;
never executed: return 0;
0
328 }-
329 if (ctx == NULL) {
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
330 ctx = new_ctx = BN_CTX_new();-
331 if (ctx == NULL)
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
332 return 0;
never executed: return 0;
0
333 }
never executed: end of block
0
334 BN_CTX_start(ctx);-
335 if ((x = BN_CTX_get(ctx)) == NULL)
(x = BN_CTX_ge...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
336 goto err;
never executed: goto err;
0
337 if ((y = BN_CTX_get(ctx)) == NULL)
(y = BN_CTX_ge...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
338 goto err;
never executed: goto err;
0
339 if ((yxi = BN_CTX_get(ctx)) == NULL)
(yxi = BN_CTX_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
340 goto err;
never executed: goto err;
0
341-
342 if (!BN_bin2bn(buf + 1, field_len, x))
!BN_bin2bn(buf... field_len, x)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
343 goto err;
never executed: goto err;
0
344 if (BN_ucmp(x, &group->field) >= 0) {
BN_ucmp(x, &group->field) >= 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
345 ECerror(EC_R_INVALID_ENCODING);-
346 goto err;
never executed: goto err;
0
347 }-
348 if (form == POINT_CONVERSION_COMPRESSED) {
form == POINT_...ION_COMPRESSEDDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
349 if (!EC_POINT_set_compressed_coordinates_GF2m(group, point, x, y_bit, ctx))
!EC_POINT_set_...x, y_bit, ctx)Description
TRUEnever evaluated
FALSEnever evaluated
0
350 goto err;
never executed: goto err;
0
351 } else {
never executed: end of block
0
352 if (!BN_bin2bn(buf + 1 + field_len, field_len, y))
!BN_bin2bn(buf... field_len, y)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
353 goto err;
never executed: goto err;
0
354 if (BN_ucmp(y, &group->field) >= 0) {
BN_ucmp(y, &group->field) >= 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
355 ECerror(EC_R_INVALID_ENCODING);-
356 goto err;
never executed: goto err;
0
357 }-
358 if (form == POINT_CONVERSION_HYBRID) {
form == POINT_...VERSION_HYBRIDDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
359 if (!group->meth->field_div(group, yxi, y, x, ctx))
!group->meth->...xi, y, x, ctx)Description
TRUEnever evaluated
FALSEnever evaluated
0
360 goto err;
never executed: goto err;
0
361 if (y_bit != BN_is_odd(yxi)) {
y_bit != (((yx...i)->d[0] & 1))Description
TRUEnever evaluated
FALSEnever evaluated
((yxi)->top > 0)Description
TRUEnever evaluated
FALSEnever evaluated
((yxi)->d[0] & 1)Description
TRUEnever evaluated
FALSEnever evaluated
0
362 ECerror(EC_R_INVALID_ENCODING);-
363 goto err;
never executed: goto err;
0
364 }-
365 }
never executed: end of block
0
366 if (!EC_POINT_set_affine_coordinates_GF2m(group, point, x, y, ctx))
!EC_POINT_set_...nt, x, y, ctx)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
367 goto err;
never executed: goto err;
0
368 }
executed 1 time by 1 test: end of block
Executed by:
  • ectest
1
369-
370 /* test required by X9.62 */-
371 if (EC_POINT_is_on_curve(group, point, ctx) <= 0) {
EC_POINT_is_on...int, ctx) <= 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • ectest
0-1
372 ECerror(EC_R_POINT_IS_NOT_ON_CURVE);-
373 goto err;
never executed: goto err;
0
374 }-
375 ret = 1;-
376-
377 err:
code before this statement executed 1 time by 1 test: err:
Executed by:
  • ectest
1
378 BN_CTX_end(ctx);-
379 BN_CTX_free(new_ctx);-
380 return ret;
executed 1 time by 1 test: return ret;
Executed by:
  • ectest
1
381}-
382#endif-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2