OpenCoverage

ecp_oct.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/ec/ecp_oct.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4int 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 ==
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4526 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4526
19 ((void *)0)
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4526 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4526
20 ) {-
21 ctx = new_ctx = BN_CTX_new();-
22 if (ctx ==
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
23 ((void *)0)
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
24 )-
25 return
never executed: return 0;
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 ==
y == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4526 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4526
36 ((void *)0)
y == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4526 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4526
37 )-
38 goto
never executed: goto err;
err;
never executed: goto err;
0
39 if (!BN_nnmod(x, x_, group->field, ctx)
!BN_nnmod(x, x...p->field, ctx)Description
TRUEnever evaluated
FALSEevaluated 4526 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-4526
40 goto
never executed: goto err;
err;
never executed: goto err;
0
41 if (group->meth->field_decode == 0
group->meth->field_decode == 0Description
TRUEnever evaluated
FALSEevaluated 4526 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-4526
42-
43 if (!group->meth->field_sqr(group, tmp2, x_, ctx)
!group->meth->...tmp2, x_, ctx)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
44 goto
never executed: goto err;
err;
never executed: goto err;
0
45 if (!group->meth->field_mul(group, tmp1, tmp2, x_, ctx)
!group->meth->...tmp2, x_, ctx)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
46 goto
never executed: goto err;
err;
never executed: goto err;
0
47 }
never executed: end of block
else {
0
48 if (!BN_mod_sqr(tmp2, x_, group->field, ctx)
!BN_mod_sqr(tm...p->field, ctx)Description
TRUEnever evaluated
FALSEevaluated 4526 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-4526
49 goto
never executed: goto err;
err;
never executed: goto err;
0
50 if (!BN_mod_mul(tmp1, tmp2, x_, group->field, ctx)
!BN_mod_mul(tm...p->field, ctx)Description
TRUEnever evaluated
FALSEevaluated 4526 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-4526
51 goto
never executed: goto err;
err;
never executed: goto err;
0
52 }
executed 4526 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
4526
53-
54-
55 if (group->a_is_minus3
group->a_is_minus3Description
TRUEevaluated 3739 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 787 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
787-3739
56 if (!BN_mod_lshift1_quick(tmp2, x, group->field)
!BN_mod_lshift... group->field)Description
TRUEnever evaluated
FALSEevaluated 3739 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-3739
57 goto
never executed: goto err;
err;
never executed: goto err;
0
58 if (!BN_mod_add_quick(tmp2, tmp2, x, group->field)
!BN_mod_add_qu... group->field)Description
TRUEnever evaluated
FALSEevaluated 3739 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-3739
59 goto
never executed: goto err;
err;
never executed: goto err;
0
60 if (!BN_mod_sub_quick(tmp1, tmp1, tmp2, group->field)
!BN_mod_sub_qu... group->field)Description
TRUEnever evaluated
FALSEevaluated 3739 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-3739
61 goto
never executed: goto err;
err;
never executed: goto err;
0
62 }
executed 3739 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
3739
63 if (group->meth->field_decode
group->meth->field_decodeDescription
TRUEevaluated 787 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-787
64 if (!group->meth->field_decode(group, tmp2, group->a, ctx)
!group->meth->...group->a, ctx)Description
TRUEnever evaluated
FALSEevaluated 787 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-787
65 goto
never executed: goto err;
err;
never executed: goto err;
0
66 if (!BN_mod_mul(tmp2, tmp2, x, group->field, ctx)
!BN_mod_mul(tm...p->field, ctx)Description
TRUEnever evaluated
FALSEevaluated 787 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-787
67 goto
never executed: goto err;
err;
never executed: goto err;
0
68 }
executed 787 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
787
69-
70 if (!group->meth->field_mul(group, tmp2, group->a, x, ctx)
!group->meth->...up->a, x, ctx)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
71 goto
never executed: goto err;
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)
!BN_mod_add_qu... group->field)Description
TRUEnever evaluated
FALSEevaluated 787 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-787
75 goto
never executed: goto err;
err;
never executed: goto err;
0
76 }
executed 787 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
787
77-
78-
79 if (group->meth->field_decode
group->meth->field_decodeDescription
TRUEevaluated 4526 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-4526
80 if (!group->meth->field_decode(group, tmp2, group->b, ctx)
!group->meth->...group->b, ctx)Description
TRUEnever evaluated
FALSEevaluated 4526 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-4526
81 goto
never executed: goto err;
err;
never executed: goto err;
0
82 if (!BN_mod_add_quick(tmp1, tmp1, tmp2, group->field)
!BN_mod_add_qu... group->field)Description
TRUEnever evaluated
FALSEevaluated 4526 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-4526
83 goto
never executed: goto err;
err;
never executed: goto err;
0
84 }
executed 4526 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
4526
85 if (!BN_mod_add_quick(tmp1, tmp1, group->b, group->field)
!BN_mod_add_qu... group->field)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
86 goto
never executed: goto err;
err;
never executed: goto err;
0
87 }
never executed: end of block
0
88-
89 if (!BN_mod_sqrt(y, tmp1, group->field, ctx)
!BN_mod_sqrt(y...p->field, ctx)Description
TRUEevaluated 1279 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3247 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1279-3247
90 unsigned long err = ERR_peek_last_error();-
91-
92 if ((
(int)(((err) >...& 0x0FFL) == 3Description
TRUEevaluated 1279 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
int)(((err) >> 24L) & 0x0FFL) == 3
(int)(((err) >...& 0x0FFL) == 3Description
TRUEevaluated 1279 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1279
93 && (
(int)( (err) & 0xFFFL) == 111Description
TRUEevaluated 1265 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
int)( (err) & 0xFFFL) == 111
(int)( (err) & 0xFFFL) == 111Description
TRUEevaluated 1265 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
14-1265
94 ERR_clear_error();-
95 ERR_put_error(16,(169),(110),__FILE__,108)-
96 ;-
97 }
executed 1265 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else
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:
  • libcrypto.so.1.1
14
99 ;
executed 14 times by 1 test: ERR_put_error(16,(169),(3),__FILE__,111) ;
Executed by:
  • libcrypto.so.1.1
14
100 goto
executed 1279 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
err;
executed 1279 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
1279
101 }-
102-
103 if (y_bit != BN_is_odd(y)
y_bit != BN_is_odd(y)Description
TRUEevaluated 1477 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1770 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1477-1770
104 if (BN_is_zero(y)
BN_is_zero(y)Description
TRUEnever evaluated
FALSEevaluated 1477 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-1477
105 int kron;-
106-
107 kron = BN_kronecker(x, group->field, ctx);-
108 if (kron == -2
kron == -2Description
TRUEnever evaluated
FALSEnever evaluated
)
0
109 goto
never executed: goto err;
err;
never executed: goto err;
0
110-
111 if (kron == 1
kron == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
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: goto err;
err;
never executed: goto err;
0
121 }-
122 if (!BN_usub(y, group->field, y)
!BN_usub(y, group->field, y)Description
TRUEnever evaluated
FALSEevaluated 1477 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-1477
123 goto
never executed: goto err;
err;
never executed: goto err;
0
124 }
executed 1477 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1477
125 if (y_bit != BN_is_odd(y)
y_bit != BN_is_odd(y)Description
TRUEnever evaluated
FALSEevaluated 3247 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-3247
126 ERR_put_error(16,(169),((4|64)),__FILE__,139)-
127 ;-
128 goto
never executed: goto err;
err;
never executed: goto err;
0
129 }-
130-
131 if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx)
!EC_POINT_set_...nt, x, y, ctx)Description
TRUEnever evaluated
FALSEevaluated 3247 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-3247
132 goto
never executed: goto err;
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:
  • libcrypto.so.1.1
3247
137 BN_CTX_end(ctx);-
138 BN_CTX_free(new_ctx);-
139 return
executed 4526 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 4526 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
4526
140}-
141-
142size_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 ((
(form != POINT...ON_COMPRESSED)Description
TRUEevaluated 41437 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 217 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
form != POINT_CONVERSION_COMPRESSED)
(form != POINT...ON_COMPRESSED)Description
TRUEevaluated 41437 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 217 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
217-41437
155 && (
(form != POINT..._UNCOMPRESSED)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 41425 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
form != POINT_CONVERSION_UNCOMPRESSED)
(form != POINT..._UNCOMPRESSED)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 41425 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
12-41425
156 && (
(form != POINT...ERSION_HYBRID)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 11 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
form != POINT_CONVERSION_HYBRID)
(form != POINT...ERSION_HYBRID)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 11 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1-11
157 ERR_put_error(16,(104),(104),__FILE__,167);-
158 goto
executed 1 time by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
err;
executed 1 time by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
1
159 }-
160-
161 if (EC_POINT_is_at_infinity(group, point)
EC_POINT_is_at...(group, point)Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 41625 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
28-41625
162-
163 if (buf !=
buf != ((void *)0)Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
14
164 ((void *)0)
buf != ((void *)0)Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
14
165 ) {-
166 if (len < 1
len < 1Description
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-14
167 ERR_put_error(16,(104),(100),__FILE__,175);-
168 return
never executed: return 0;
0;
never executed: return 0;
0
169 }-
170 buf[0] = 0;-
171 }
executed 14 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
14
172 return
executed 28 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 28 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
28
173 }-
174-
175-
176 field_len = ((BN_num_bits(group->field)+7)/8);-
177 ret =-
178 (
(form == POINT...ON_COMPRESSED)Description
TRUEevaluated 217 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 41408 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
form ==
(form == POINT...ON_COMPRESSED)Description
TRUEevaluated 217 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 41408 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
217-41408
179 POINT_CONVERSION_COMPRESSED)
(form == POINT...ON_COMPRESSED)Description
TRUEevaluated 217 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 41408 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
? 1 + field_len : 1 + 2 * field_len;
217-41408
180-
181-
182 if (buf !=
buf != ((void *)0)Description
TRUEevaluated 14268 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 27357 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
14268-27357
183 ((void *)0)
buf != ((void *)0)Description
TRUEevaluated 14268 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 27357 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
14268-27357
184 ) {-
185 if (len < ret
len < retDescription
TRUEnever evaluated
FALSEevaluated 14268 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-14268
186 ERR_put_error(16,(104),(100),__FILE__,192);-
187 goto
never executed: goto err;
err;
never executed: goto err;
0
188 }-
189-
190 if (ctx ==
ctx == ((void *)0)Description
TRUEevaluated 14220 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 48 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
48-14220
191 ((void *)0)
ctx == ((void *)0)Description
TRUEevaluated 14220 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 48 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
48-14220
192 ) {-
193 ctx = new_ctx = BN_CTX_new();-
194 if (ctx ==
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 14220 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-14220
195 ((void *)0)
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 14220 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-14220
196 )-
197 return
never executed: return 0;
0;
never executed: return 0;
0
198 }
executed 14220 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
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 ==
y == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 14268 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-14268
205 ((void *)0)
y == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 14268 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-14268
206 )-
207 goto
never executed: goto err;
err;
never executed: goto err;
0
208-
209 if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx)
!EC_POINT_get_...nt, x, y, ctx)Description
TRUEnever evaluated
FALSEevaluated 14268 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-14268
210 goto
never executed: goto err;
err;
never executed: goto err;
0
211-
212 if ((form == POINT_CONVERSION_COMPRESSED
form == POINT_...ION_COMPRESSEDDescription
TRUEevaluated 109 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14159 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
109-14159
213 || form == POINT_CONVERSION_HYBRID
form == POINT_...VERSION_HYBRIDDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14153 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) && BN_is_odd(y)
BN_is_odd(y)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 103 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
6-14153
214 buf[0] = form + 1;
executed 12 times by 1 test: buf[0] = form + 1;
Executed by:
  • libcrypto.so.1.1
12
215 else-
216 buf[0] = form;
executed 14256 times by 1 test: buf[0] = form;
Executed by:
  • libcrypto.so.1.1
14256
217-
218 i = 1;-
219-
220 skip = field_len - ((BN_num_bits(x)+7)/8);-
221 if (skip > field_len
skip > field_lenDescription
TRUEnever evaluated
FALSEevaluated 14268 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-14268
222 ERR_put_error(16,(104),((4|64)),__FILE__,222);-
223 goto
never executed: goto err;
err;
never executed: goto err;
0
224 }-
225 while (skip > 0
skip > 0Description
TRUEevaluated 736 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14268 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
736-14268
226 buf[i++] = 0;-
227 skip--;-
228 }
executed 736 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
736
229 skip = BN_bn2bin(x, buf + i);-
230 i += skip;-
231 if (i != 1 + field_len
i != 1 + field_lenDescription
TRUEnever evaluated
FALSEevaluated 14268 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-14268
232 ERR_put_error(16,(104),((4|64)),__FILE__,232);-
233 goto
never executed: goto err;
err;
never executed: goto err;
0
234 }-
235-
236 if (form == POINT_CONVERSION_UNCOMPRESSED
form == POINT_...N_UNCOMPRESSEDDescription
TRUEevaluated 14153 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 115 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
115-14153
237 || form == POINT_CONVERSION_HYBRID
form == POINT_...VERSION_HYBRIDDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 109 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
6-109
238 skip = field_len - ((BN_num_bits(y)+7)/8);-
239 if (skip > field_len
skip > field_lenDescription
TRUEnever evaluated
FALSEevaluated 14159 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-14159
240 ERR_put_error(16,(104),((4|64)),__FILE__,240);-
241 goto
never executed: goto err;
err;
never executed: goto err;
0
242 }-
243 while (skip > 0
skip > 0Description
TRUEevaluated 339 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14159 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
339-14159
244 buf[i++] = 0;-
245 skip--;-
246 }
executed 339 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
339
247 skip = BN_bn2bin(y, buf + i);-
248 i += skip;-
249 }
executed 14159 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
14159
250-
251 if (i != ret
i != retDescription
TRUEnever evaluated
FALSEevaluated 14268 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-14268
252 ERR_put_error(16,(104),((4|64)),__FILE__,252);-
253 goto
never executed: goto err;
err;
never executed: goto err;
0
254 }-
255 }
executed 14268 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
14268
256-
257 if (used_ctx
used_ctxDescription
TRUEevaluated 14268 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 27357 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
14268-27357
258 BN_CTX_end(ctx);
executed 14268 times by 1 test: BN_CTX_end(ctx);
Executed by:
  • libcrypto.so.1.1
14268
259 BN_CTX_free(new_ctx);-
260 return
executed 41625 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 41625 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
41625
261-
262 err:-
263 if (used_ctx
used_ctxDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
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: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 1 time by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
1
267}-
268-
269int 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
len == 0Description
TRUEevaluated 276 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 24879 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
276-24879
282 ERR_put_error(16,(103),(100),__FILE__,280);-
283 return
executed 276 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 276 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
276
284 }-
285 form = buf[0];-
286 y_bit = form & 1;-
287 form = form & ~1U;-
288 if ((
(form != 0)Description
TRUEevaluated 24417 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 462 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
form != 0)
(form != 0)Description
TRUEevaluated 24417 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 462 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& (
(form != POINT...ON_COMPRESSED)Description
TRUEevaluated 19559 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4858 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
form != POINT_CONVERSION_COMPRESSED)
(form != POINT...ON_COMPRESSED)Description
TRUEevaluated 19559 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4858 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
462-24417
289 && (
(form != POINT..._UNCOMPRESSED)Description
TRUEevaluated 551 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 19008 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
form != POINT_CONVERSION_UNCOMPRESSED)
(form != POINT..._UNCOMPRESSED)Description
TRUEevaluated 551 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 19008 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
551-19008
290 && (
(form != POINT...ERSION_HYBRID)Description
TRUEevaluated 250 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 301 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
form != POINT_CONVERSION_HYBRID)
(form != POINT...ERSION_HYBRID)Description
TRUEevaluated 250 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 301 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
250-301
291 ERR_put_error(16,(103),(102),__FILE__,289);-
292 return
executed 250 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 250 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
250
293 }-
294 if ((form == 0
form == 0Description
TRUEevaluated 462 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 24167 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| form == POINT_CONVERSION_UNCOMPRESSED
form == POINT_...N_UNCOMPRESSEDDescription
TRUEevaluated 19008 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5159 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) && y_bit
y_bitDescription
TRUEevaluated 74 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 19396 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
74-24167
295 ERR_put_error(16,(103),(102),__FILE__,293);-
296 return
executed 74 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 74 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
74
297 }-
298-
299 if (form == 0
form == 0Description
TRUEevaluated 393 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 24162 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
393-24162
300 if (len != 1
len != 1Description
TRUEevaluated 80 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 313 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
80-313
301 ERR_put_error(16,(103),(102),__FILE__,299);-
302 return
executed 80 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 80 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
80
303 }-
304-
305 return
executed 313 times by 1 test: return EC_POINT_set_to_infinity(group, point);
Executed by:
  • libcrypto.so.1.1
EC_POINT_set_to_infinity(group, point);
executed 313 times by 1 test: return EC_POINT_set_to_infinity(group, point);
Executed by:
  • libcrypto.so.1.1
313
306 }-
307-
308 field_len = ((BN_num_bits(group->field)+7)/8);-
309 enc_len =-
310 (
(form == POINT...ON_COMPRESSED)Description
TRUEevaluated 4858 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 19304 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
form ==
(form == POINT...ON_COMPRESSED)Description
TRUEevaluated 4858 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 19304 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4858-19304
311 POINT_CONVERSION_COMPRESSED)
(form == POINT...ON_COMPRESSED)Description
TRUEevaluated 4858 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 19304 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
? 1 + field_len : 1 + 2 * field_len;
4858-19304
312-
313 if (len != enc_len
len != enc_lenDescription
TRUEevaluated 360 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 23802 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
360-23802
314 ERR_put_error(16,(103),(102),__FILE__,312);-
315 return
executed 360 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 360 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
360
316 }-
317-
318 if (ctx ==
ctx == ((void *)0)Description
TRUEevaluated 23799 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
3-23799
319 ((void *)0)
ctx == ((void *)0)Description
TRUEevaluated 23799 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
3-23799
320 ) {-
321 ctx = new_ctx = BN_CTX_new();-
322 if (ctx ==
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 23799 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-23799
323 ((void *)0)
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 23799 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-23799
324 )-
325 return
never executed: return 0;
0;
never executed: return 0;
0
326 }
executed 23799 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
23799
327-
328 BN_CTX_start(ctx);-
329 x = BN_CTX_get(ctx);-
330 y = BN_CTX_get(ctx);-
331 if (y ==
y == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 23802 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-23802
332 ((void *)0)
y == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 23802 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-23802
333 )-
334 goto
never executed: goto err;
err;
never executed: goto err;
0
335-
336 if (!BN_bin2bn(buf + 1, field_len, x)
!BN_bin2bn(buf... field_len, x)Description
TRUEnever evaluated
FALSEevaluated 23802 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-23802
337 goto
never executed: goto err;
err;
never executed: goto err;
0
338 if (BN_ucmp(x, group->field) >= 0
BN_ucmp(x, group->field) >= 0Description
TRUEevaluated 91 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 23711 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
91-23711
339 ERR_put_error(16,(103),(102),__FILE__,331);-
340 goto
executed 91 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
err;
executed 91 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
91
341 }-
342-
343 if (form == POINT_CONVERSION_COMPRESSED
form == POINT_...ION_COMPRESSEDDescription
TRUEevaluated 4520 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 19191 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
4520-19191
344 if (!EC_POINT_set_compressed_coordinates(group, point, x, y_bit, ctx)
!EC_POINT_set_...x, y_bit, ctx)Description
TRUEevaluated 1279 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3241 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
1279-3241
345 goto
executed 1279 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
err;
executed 1279 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
1279
346 }
executed 3241 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
3241
347 if (!BN_bin2bn(buf + 1 + field_len, field_len, y)
!BN_bin2bn(buf... field_len, y)Description
TRUEnever evaluated
FALSEevaluated 19191 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-19191
348 goto
never executed: goto err;
err;
never executed: goto err;
0
349 if (BN_ucmp(y, group->field) >= 0
BN_ucmp(y, group->field) >= 0Description
TRUEevaluated 84 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 19107 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
84-19107
350 ERR_put_error(16,(103),(102),__FILE__,342);-
351 goto
executed 84 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
err;
executed 84 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
84
352 }-
353 if (form == POINT_CONVERSION_HYBRID
form == POINT_...VERSION_HYBRIDDescription
TRUEevaluated 173 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 18934 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
173-18934
354 if (y_bit != BN_is_odd(y)
y_bit != BN_is_odd(y)Description
TRUEevaluated 73 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 100 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
73-100
355 ERR_put_error(16,(103),(102),__FILE__,347);-
356 goto
executed 73 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
err;
executed 73 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
73
357 }-
358 }
executed 100 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
100
359-
360-
361-
362-
363-
364 if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx)
!EC_POINT_set_...nt, x, y, ctx)Description
TRUEevaluated 479 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 18555 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
479-18555
365 goto
executed 479 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
err;
executed 479 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
479
366 }
executed 18555 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
18555
367-
368 ret = 1;-
369-
370 err:
code before this statement executed 21796 times by 1 test: err:
Executed by:
  • libcrypto.so.1.1
21796
371 BN_CTX_end(ctx);-
372 BN_CTX_free(new_ctx);-
373 return
executed 23802 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 23802 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
23802
374}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2