OpenCoverage

tasn_enc.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/tasn_enc.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out,-
3 const ASN1_ITEM *it, int tag, int aclass);-
4static int asn1_set_seq_out(struct stack_st_ASN1_VALUE *sk, unsigned char **out,-
5 int skcontlen, const ASN1_ITEM *item,-
6 int do_sort, int iclass);-
7static int asn1_template_ex_i2d(ASN1_VALUE **pval, unsigned char **out,-
8 const ASN1_TEMPLATE *tt, int tag, int aclass);-
9static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out,-
10 const ASN1_ITEM *it, int flags);-
11static int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype,-
12 const ASN1_ITEM *it);-
13-
14-
15-
16-
17-
18-
19int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out,-
20 const ASN1_ITEM *it)-
21{-
22 return
executed 180 times by 1 test: return asn1_item_flags_i2d(val, out, it, (0x1<<11));
Executed by:
  • libcrypto.so.1.1
asn1_item_flags_i2d(val, out, it, (0x1<<11));
executed 180 times by 1 test: return asn1_item_flags_i2d(val, out, it, (0x1<<11));
Executed by:
  • libcrypto.so.1.1
180
23}-
24-
25int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it)-
26{-
27 return
executed 137929 times by 2 tests: return asn1_item_flags_i2d(val, out, it, 0);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
asn1_item_flags_i2d(val, out, it, 0);
executed 137929 times by 2 tests: return asn1_item_flags_i2d(val, out, it, 0);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
137929
28}-
29static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out,-
30 const ASN1_ITEM *it, int flags)-
31{-
32 if (out
outDescription
TRUEevaluated 121463 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 16646 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& !*out
!*outDescription
TRUEevaluated 110666 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 10797 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
10797-121463
33 unsigned char *p, *buf;-
34 int len;-
35-
36 len = ASN1_item_ex_i2d(&val, -
37 ((void *)0)-
38 , it, -1, flags);-
39 if (len <= 0
len <= 0Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 110656 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
10-110656
40 return
executed 10 times by 1 test: return len;
Executed by:
  • libcrypto.so.1.1
len;
executed 10 times by 1 test: return len;
Executed by:
  • libcrypto.so.1.1
10
41 if ((
(buf = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 110656 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
buf = CRYPTO_malloc(len, __FILE__, 64)) ==
(buf = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 110656 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-110656
42 ((void *)0)
(buf = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 110656 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-110656
43 ) {-
44 ERR_put_error(13,(118),((1|64)),__FILE__,65);-
45 return
never executed: return -1;
-1;
never executed: return -1;
0
46 }-
47 p = buf;-
48 ASN1_item_ex_i2d(&val, &p, it, -1, flags);-
49 *out = buf;-
50 return
executed 110656 times by 1 test: return len;
Executed by:
  • libcrypto.so.1.1
len;
executed 110656 times by 1 test: return len;
Executed by:
  • libcrypto.so.1.1
110656
51 }-
52-
53 return
executed 27443 times by 2 tests: return ASN1_item_ex_i2d(&val, out, it, -1, flags);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
ASN1_item_ex_i2d(&val, out, it, -1, flags);
executed 27443 times by 2 tests: return ASN1_item_ex_i2d(&val, out, it, -1, flags);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
27443
54}-
55-
56-
57-
58-
59-
60-
61int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out,-
62 const ASN1_ITEM *it, int tag, int aclass)-
63{-
64 const ASN1_TEMPLATE *tt = -
65 ((void *)0)-
66 ;-
67 int i, seqcontlen, seqlen, ndef = 1;-
68 const ASN1_EXTERN_FUNCS *ef;-
69 const ASN1_AUX *aux = it->funcs;-
70 ASN1_aux_cb *asn1_cb = 0;-
71-
72 if ((
(it->itype != 0x0)Description
TRUEevaluated 1948017 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2978213 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
it->itype != 0x0)
(it->itype != 0x0)Description
TRUEevaluated 1948017 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2978213 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
&& !*pval
!*pvalDescription
TRUEevaluated 37110 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1910907 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
37110-2978213
73 return
executed 37110 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 37110 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
37110
74-
75 if (aux
auxDescription
TRUEevaluated 678503 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 4210617 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
&& aux->asn1_cb
aux->asn1_cbDescription
TRUEevaluated 591504 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 86999 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
86999-4210617
76 asn1_cb = aux->asn1_cb;
executed 591504 times by 2 tests: asn1_cb = aux->asn1_cb;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
591504
77-
78 switch (it->itype) {-
79-
80 case
executed 2978213 times by 2 tests: case 0x0:
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
0x0:
executed 2978213 times by 2 tests: case 0x0:
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
2978213
81 if (it->templates
it->templatesDescription
TRUEevaluated 233184 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2745029 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
233184-2745029
82 return
executed 233184 times by 1 test: return asn1_template_ex_i2d(pval, out, it->templates, tag, aclass);
Executed by:
  • libcrypto.so.1.1
asn1_template_ex_i2d(pval, out, it->templates,
executed 233184 times by 1 test: return asn1_template_ex_i2d(pval, out, it->templates, tag, aclass);
Executed by:
  • libcrypto.so.1.1
233184
83 tag, aclass);
executed 233184 times by 1 test: return asn1_template_ex_i2d(pval, out, it->templates, tag, aclass);
Executed by:
  • libcrypto.so.1.1
233184
84 return
executed 2745029 times by 2 tests: return asn1_i2d_ex_primitive(pval, out, it, tag, aclass);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
asn1_i2d_ex_primitive(pval, out, it, tag, aclass);
executed 2745029 times by 2 tests: return asn1_i2d_ex_primitive(pval, out, it, tag, aclass);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
2745029
85-
86 case
executed 592012 times by 1 test: case 0x5:
Executed by:
  • libcrypto.so.1.1
0x5:
executed 592012 times by 1 test: case 0x5:
Executed by:
  • libcrypto.so.1.1
592012
87 return
executed 592012 times by 1 test: return asn1_i2d_ex_primitive(pval, out, it, -1, aclass);
Executed by:
  • libcrypto.so.1.1
asn1_i2d_ex_primitive(pval, out, it, -1, aclass);
executed 592012 times by 1 test: return asn1_i2d_ex_primitive(pval, out, it, -1, aclass);
Executed by:
  • libcrypto.so.1.1
592012
88-
89 case
executed 77111 times by 1 test: case 0x2:
Executed by:
  • libcrypto.so.1.1
0x2:
executed 77111 times by 1 test: case 0x2:
Executed by:
  • libcrypto.so.1.1
77111
90 if (asn1_cb
asn1_cbDescription
TRUEevaluated 31841 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 45270 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& !asn1_cb(6, pval, it,
!asn1_cb(6, pv... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 31841 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-45270
91 ((void *)0)
!asn1_cb(6, pv... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 31841 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-31841
92 )
!asn1_cb(6, pv... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 31841 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-31841
93 return
never executed: return 0;
0;
never executed: return 0;
0
94 i = asn1_get_choice_selector(pval, it);-
95 if ((
(i >= 0)Description
TRUEevaluated 77111 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
i >= 0)
(i >= 0)Description
TRUEevaluated 77111 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
&& (
(i < it->tcount)Description
TRUEevaluated 77111 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
i < it->tcount)
(i < it->tcount)Description
TRUEevaluated 77111 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-77111
96 ASN1_VALUE **pchval;-
97 const ASN1_TEMPLATE *chtt;-
98 chtt = it->templates + i;-
99 pchval = asn1_get_field_ptr(pval, chtt);-
100 return
executed 77111 times by 1 test: return asn1_template_ex_i2d(pchval, out, chtt, -1, aclass);
Executed by:
  • libcrypto.so.1.1
asn1_template_ex_i2d(pchval, out, chtt, -1, aclass);
executed 77111 times by 1 test: return asn1_template_ex_i2d(pchval, out, chtt, -1, aclass);
Executed by:
  • libcrypto.so.1.1
77111
101 }-
102-
103 if (asn1_cb
asn1_cbDescription
TRUEnever evaluated
FALSEnever evaluated
&& !asn1_cb(7, pval, it,
!asn1_cb(7, pv... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
104 ((void *)0)
!asn1_cb(7, pv... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
105 )
!asn1_cb(7, pv... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
)
0
106 return
never executed: return 0;
0;
never executed: return 0;
0
107 break;
never executed: break;
0
108-
109 case
executed 32353 times by 1 test: case 0x4:
Executed by:
  • libcrypto.so.1.1
0x4:
executed 32353 times by 1 test: case 0x4:
Executed by:
  • libcrypto.so.1.1
32353
110-
111 ef = it->funcs;-
112 return
executed 32353 times by 1 test: return ef->asn1_ex_i2d(pval, out, it, tag, aclass);
Executed by:
  • libcrypto.so.1.1
ef->asn1_ex_i2d(pval, out, it, tag, aclass);
executed 32353 times by 1 test: return ef->asn1_ex_i2d(pval, out, it, tag, aclass);
Executed by:
  • libcrypto.so.1.1
32353
113-
114 case
executed 6848 times by 1 test: case 0x6:
Executed by:
  • libcrypto.so.1.1
0x6:
executed 6848 times by 1 test: case 0x6:
Executed by:
  • libcrypto.so.1.1
6848
115-
116 if (aclass & (0x1<<11)
aclass & (0x1<<11)Description
TRUEevaluated 972 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5876 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
972-5876
117 ndef = 2;
executed 972 times by 1 test: ndef = 2;
Executed by:
  • libcrypto.so.1.1
972
118-
119-
120 case
executed 1202583 times by 2 tests: case 0x1:
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
0x1:
executed 1202583 times by 2 tests: case 0x1:
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
code before this statement executed 6848 times by 1 test: case 0x1:
Executed by:
  • libcrypto.so.1.1
6848-1202583
121 i = asn1_enc_restore(&seqcontlen, out, pval, it);-
122-
123 if (i < 0
i < 0Description
TRUEnever evaluated
FALSEevaluated 1209431 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-1209431
124 return
never executed: return 0;
0;
never executed: return 0;
0
125-
126 if (i > 0
i > 0Description
TRUEevaluated 163825 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1045606 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
163825-1045606
127 return
executed 163825 times by 1 test: return seqcontlen;
Executed by:
  • libcrypto.so.1.1
seqcontlen;
executed 163825 times by 1 test: return seqcontlen;
Executed by:
  • libcrypto.so.1.1
163825
128-
129 seqcontlen = 0;-
130-
131 if (tag == -1
tag == -1Description
TRUEevaluated 1012132 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 33474 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
33474-1012132
132 tag = 16;-
133-
134 aclass = (aclass & ~(0x3<<6))-
135 | 0x00;-
136 }
executed 1012132 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1012132
137 if (asn1_cb
asn1_cbDescription
TRUEevaluated 162422 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 883184 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
&& !asn1_cb(6, pval, it,
!asn1_cb(6, pv... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 162422 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-883184
138 ((void *)0)
!asn1_cb(6, pv... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 162422 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-162422
139 )
!asn1_cb(6, pv... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 162422 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-162422
140 return
never executed: return 0;
0;
never executed: return 0;
0
141-
142 for (i = 0, tt = it->templates; i < it->tcount
i < it->tcountDescription
TRUEevaluated 2578593 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1045606 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
; tt++, i++) {
1045606-2578593
143 const ASN1_TEMPLATE *seqtt;-
144 ASN1_VALUE **pseqval;-
145 int tmplen;-
146 seqtt = asn1_do_adb(pval, tt, 1);-
147 if (!seqtt
!seqttDescription
TRUEnever evaluated
FALSEevaluated 2578593 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-2578593
148 return
never executed: return 0;
0;
never executed: return 0;
0
149 pseqval = asn1_get_field_ptr(pval, seqtt);-
150 tmplen = asn1_template_ex_i2d(pseqval, -
151 ((void *)0)-
152 , seqtt, -1, aclass);-
153 if (tmplen == -1
tmplen == -1Description
TRUEnever evaluated
FALSEevaluated 2578593 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
|| (
(tmplen > 0x7f... - seqcontlen)Description
TRUEnever evaluated
FALSEevaluated 2578593 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
tmplen > 0x7fffffff - seqcontlen)
(tmplen > 0x7f... - seqcontlen)Description
TRUEnever evaluated
FALSEevaluated 2578593 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-2578593
154 return
never executed: return -1;
-1;
never executed: return -1;
0
155 seqcontlen += tmplen;-
156 }
executed 2578593 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
2578593
157-
158 seqlen = ASN1_object_size(ndef, seqcontlen, tag);-
159 if (!out
!outDescription
TRUEevaluated 700744 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 344862 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
|| seqlen == -1
seqlen == -1Description
TRUEnever evaluated
FALSEevaluated 344862 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-700744
160 return
executed 700744 times by 1 test: return seqlen;
Executed by:
  • libcrypto.so.1.1
seqlen;
executed 700744 times by 1 test: return seqlen;
Executed by:
  • libcrypto.so.1.1
700744
161-
162 ASN1_put_object(out, ndef, seqcontlen, tag, aclass);-
163 for (i = 0, tt = it->templates; i < it->tcount
i < it->tcountDescription
TRUEevaluated 873704 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 344862 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
; tt++, i++) {
344862-873704
164 const ASN1_TEMPLATE *seqtt;-
165 ASN1_VALUE **pseqval;-
166 seqtt = asn1_do_adb(pval, tt, 1);-
167 if (!seqtt
!seqttDescription
TRUEnever evaluated
FALSEevaluated 873704 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-873704
168 return
never executed: return 0;
0;
never executed: return 0;
0
169 pseqval = asn1_get_field_ptr(pval, seqtt);-
170-
171 asn1_template_ex_i2d(pseqval, out, seqtt, -1, aclass);-
172 }
executed 873704 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
873704
173 if (ndef == 2
ndef == 2Description
TRUEevaluated 266 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 344596 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
266-344596
174 ASN1_put_eoc(out);
executed 266 times by 1 test: ASN1_put_eoc(out);
Executed by:
  • libcrypto.so.1.1
266
175 if (asn1_cb
asn1_cbDescription
TRUEevaluated 74425 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 270437 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
&& !asn1_cb(7, pval, it,
!asn1_cb(7, pv... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 74425 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-270437
176 ((void *)0)
!asn1_cb(7, pv... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 74425 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-74425
177 )
!asn1_cb(7, pv... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 74425 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-74425
178 return
never executed: return 0;
0;
never executed: return 0;
0
179 return
executed 344862 times by 2 tests: return seqlen;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
seqlen;
executed 344862 times by 2 tests: return seqlen;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
344862
180-
181 default
never executed: default:
:
never executed: default:
0
182 return
never executed: return 0;
0;
never executed: return 0;
0
183-
184 }-
185 return
never executed: return 0;
0;
never executed: return 0;
0
186}-
187-
188static int asn1_template_ex_i2d(ASN1_VALUE **pval, unsigned char **out,-
189 const ASN1_TEMPLATE *tt, int tag, int iclass)-
190{-
191 int i, ret, flags, ttag, tclass, ndef;-
192 ASN1_VALUE *tval;-
193 flags = tt->flags;-
194-
195-
196-
197-
198-
199 if (flags & (0x1 << 12)
flags & (0x1 << 12)Description
TRUEevaluated 721182 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3041410 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
721182-3041410
200 tval = (ASN1_VALUE *)pval;-
201 pval = &tval;-
202 }
executed 721182 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
721182
203-
204-
205-
206-
207-
208-
209-
210 if (flags & (0x3 << 3)
flags & (0x3 << 3)Description
TRUEevaluated 367177 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3395415 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
367177-3395415
211-
212 if (tag != -1
tag != -1Description
TRUEnever evaluated
FALSEevaluated 367177 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-367177
213-
214 return
never executed: return -1;
-1;
never executed: return -1;
0
215-
216 ttag = tt->tag;-
217 tclass = flags & (0x3<<6);-
218 }
executed 367177 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else if (tag != -1
tag != -1Description
TRUEnever evaluated
FALSEevaluated 3395415 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
0-3395415
219-
220 ttag = tag;-
221 tclass = iclass & (0x3<<6);-
222 }
never executed: end of block
else {
0
223 ttag = -1;-
224 tclass = 0;-
225 }
executed 3395415 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3395415
226-
227-
228-
229 iclass &= ~(0x3<<6);-
230-
231-
232-
233-
234-
235-
236-
237 if ((
(flags & (0x1<<11))Description
TRUEevaluated 2896 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3759696 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
flags & (0x1<<11))
(flags & (0x1<<11))Description
TRUEevaluated 2896 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3759696 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
&& (
(iclass & (0x1<<11))Description
TRUEevaluated 474 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2422 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
iclass & (0x1<<11))
(iclass & (0x1<<11))Description
TRUEevaluated 474 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2422 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
474-3759696
238 ndef = 2;
executed 474 times by 1 test: ndef = 2;
Executed by:
  • libcrypto.so.1.1
474
239 else-
240 ndef = 1;
executed 3762118 times by 2 tests: ndef = 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3762118
241-
242 if (flags & (0x3 << 1)
flags & (0x3 << 1)Description
TRUEevaluated 298804 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3463788 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
298804-3463788
243-
244 struct stack_st_ASN1_VALUE *sk = (struct stack_st_ASN1_VALUE *)*pval;-
245 int isset, sktag, skaclass;-
246 int skcontlen, sklen;-
247 ASN1_VALUE *skitem;-
248-
249 if (!*pval
!*pvalDescription
TRUEevaluated 23239 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 275565 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
23239-275565
250 return
executed 23239 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 23239 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
23239
251-
252 if (flags & (0x1 << 1)
flags & (0x1 << 1)Description
TRUEevaluated 244521 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 31044 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
31044-244521
253 isset = 1;-
254-
255 if (flags & (0x2 << 1)
flags & (0x2 << 1)Description
TRUEevaluated 210 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 244311 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
210-244311
256 isset = 2;
executed 210 times by 1 test: isset = 2;
Executed by:
  • libcrypto.so.1.1
210
257 }
executed 244521 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else
244521
258 isset = 0;
executed 31044 times by 1 test: isset = 0;
Executed by:
  • libcrypto.so.1.1
31044
259-
260-
261-
262-
263-
264 if ((
(ttag != -1)Description
TRUEevaluated 9227 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 266338 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ttag != -1)
(ttag != -1)Description
TRUEevaluated 9227 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 266338 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& !(flags & (0x2 << 3))
!(flags & (0x2 << 3))Description
TRUEevaluated 9111 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 116 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
116-266338
265 sktag = ttag;-
266 skaclass = tclass;-
267 }
executed 9111 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
9111
268 skaclass = 0x00;-
269 if (isset
issetDescription
TRUEevaluated 239430 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 27024 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
27024-239430
270 sktag = 17;
executed 239430 times by 1 test: sktag = 17;
Executed by:
  • libcrypto.so.1.1
239430
271 else-
272 sktag = 16;
executed 27024 times by 1 test: sktag = 16;
Executed by:
  • libcrypto.so.1.1
27024
273 }-
274-
275-
276 skcontlen = 0;-
277 for (i = 0; i < sk_ASN1_VALUE_num(sk)
i < sk_ASN1_VALUE_num(sk)Description
TRUEevaluated 780284 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 275565 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i++) {
275565-780284
278 int tmplen;-
279 skitem = sk_ASN1_VALUE_value(sk, i);-
280 tmplen = ASN1_item_ex_i2d(&skitem, -
281 ((void *)0)-
282 , (tt->item),-
283 -1, iclass);-
284 if (tmplen == -1
tmplen == -1Description
TRUEnever evaluated
FALSEevaluated 780284 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| (
(skcontlen > 0...ffff - tmplen)Description
TRUEnever evaluated
FALSEevaluated 780284 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
skcontlen > 0x7fffffff - tmplen)
(skcontlen > 0...ffff - tmplen)Description
TRUEnever evaluated
FALSEevaluated 780284 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-780284
285 return
never executed: return -1;
-1;
never executed: return -1;
0
286 skcontlen += tmplen;-
287 }
executed 780284 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
780284
288 sklen = ASN1_object_size(ndef, skcontlen, sktag);-
289 if (sklen == -1
sklen == -1Description
TRUEnever evaluated
FALSEevaluated 275565 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-275565
290 return
never executed: return -1;
-1;
never executed: return -1;
0
291-
292 if (flags & (0x2 << 3)
flags & (0x2 << 3)Description
TRUEevaluated 116 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 275449 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
116-275449
293 ret = ASN1_object_size(ndef, sklen, ttag);
executed 116 times by 1 test: ret = ASN1_object_size(ndef, sklen, ttag);
Executed by:
  • libcrypto.so.1.1
116
294 else-
295 ret = sklen;
executed 275449 times by 1 test: ret = sklen;
Executed by:
  • libcrypto.so.1.1
275449
296-
297 if (!out
!outDescription
TRUEevaluated 162969 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 112596 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| ret == -1
ret == -1Description
TRUEnever evaluated
FALSEevaluated 112596 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-162969
298 return
executed 162969 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 162969 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
162969
299-
300-
301-
302 if (flags & (0x2 << 3)
flags & (0x2 << 3)Description
TRUEevaluated 35 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 112561 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
35-112561
303 ASN1_put_object(out, ndef, sklen, ttag, tclass);
executed 35 times by 1 test: ASN1_put_object(out, ndef, sklen, ttag, tclass);
Executed by:
  • libcrypto.so.1.1
35
304-
305 ASN1_put_object(out, ndef, skcontlen, sktag, skaclass);-
306-
307 asn1_set_seq_out(sk, out, skcontlen, (tt->item),-
308 isset, iclass);-
309 if (ndef == 2
ndef == 2Description
TRUEnever evaluated
FALSEevaluated 112596 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-112596
310 ASN1_put_eoc(out);-
311 if (flags & (0x2 << 3)
flags & (0x2 << 3)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
312 ASN1_put_eoc(out);
never executed: ASN1_put_eoc(out);
0
313 }
never executed: end of block
0
314-
315 return
executed 112596 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 112596 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
112596
316 }-
317-
318 if (flags & (0x2 << 3)
flags & (0x2 << 3)Description
TRUEevaluated 234511 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3229277 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
234511-3229277
319-
320-
321 i = ASN1_item_ex_i2d(pval, -
322 ((void *)0)-
323 , (tt->item), -1, iclass);-
324 if (!i
!iDescription
TRUEevaluated 167936 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 66575 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
66575-167936
325 return
executed 167936 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 167936 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
167936
326-
327 ret = ASN1_object_size(ndef, i, ttag);-
328 if (out
outDescription
TRUEevaluated 19585 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 46990 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& ret != -1
ret != -1Description
TRUEevaluated 19585 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-46990
329-
330 ASN1_put_object(out, ndef, i, ttag, tclass);-
331 ASN1_item_ex_i2d(pval, out, (tt->item), -1, iclass);-
332 if (ndef == 2
ndef == 2Description
TRUEevaluated 124 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 19461 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
124-19461
333 ASN1_put_eoc(out);
executed 124 times by 1 test: ASN1_put_eoc(out);
Executed by:
  • libcrypto.so.1.1
124
334 }
executed 19585 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
19585
335 return
executed 66575 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 66575 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
66575
336 }-
337-
338-
339 return
executed 3229277 times by 2 tests: return ASN1_item_ex_i2d(pval, out, (tt->item), ttag, tclass | iclass);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
ASN1_item_ex_i2d(pval, out, (tt->item),
executed 3229277 times by 2 tests: return ASN1_item_ex_i2d(pval, out, (tt->item), ttag, tclass | iclass);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3229277
340 ttag, tclass | iclass);
executed 3229277 times by 2 tests: return ASN1_item_ex_i2d(pval, out, (tt->item), ttag, tclass | iclass);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3229277
341-
342}-
343-
344-
345-
346typedef struct {-
347 unsigned char *data;-
348 int length;-
349 ASN1_VALUE *field;-
350} DER_ENC;-
351-
352static int der_cmp(const void *a, const void *b)-
353{-
354 const DER_ENC *d1 = a, *d2 = b;-
355 int cmplen, i;-
356 cmplen = (
(d1->length < d2->length)Description
TRUEevaluated 18274 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 340247 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
d1->length < d2->length)
(d1->length < d2->length)Description
TRUEevaluated 18274 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 340247 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
? d1->length : d2->length;
18274-340247
357 i = memcmp(d1->data, d2->data, cmplen);-
358 if (i
iDescription
TRUEevaluated 179406 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 179115 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
179115-179406
359 return
executed 179406 times by 1 test: return i;
Executed by:
  • libcrypto.so.1.1
i;
executed 179406 times by 1 test: return i;
Executed by:
  • libcrypto.so.1.1
179406
360 return
executed 179115 times by 1 test: return d1->length - d2->length;
Executed by:
  • libcrypto.so.1.1
d1->length - d2->length;
executed 179115 times by 1 test: return d1->length - d2->length;
Executed by:
  • libcrypto.so.1.1
179115
361}-
362-
363-
364-
365static int asn1_set_seq_out(struct stack_st_ASN1_VALUE *sk, unsigned char **out,-
366 int skcontlen, const ASN1_ITEM *item,-
367 int do_sort, int iclass)-
368{-
369 int i;-
370 ASN1_VALUE *skitem;-
371 unsigned char *tmpdat = -
372 ((void *)0)-
373 , *p = -
374 ((void *)0)-
375 ;-
376 DER_ENC *derlst = -
377 ((void *)0)-
378 , *tder;-
379 if (do_sort
do_sortDescription
TRUEevaluated 102408 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 10188 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
10188-102408
380-
381 if (sk_ASN1_VALUE_num(sk) < 2
sk_ASN1_VALUE_num(sk) < 2Description
TRUEevaluated 98006 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4402 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
4402-98006
382 do_sort = 0;
executed 98006 times by 1 test: do_sort = 0;
Executed by:
  • libcrypto.so.1.1
98006
383 else {-
384 derlst = CRYPTO_malloc(sk_ASN1_VALUE_num(sk) * sizeof(*derlst),-
385 __FILE__-
386 ,-
387 384-
388 )-
389 ;-
390 if (derlst ==
derlst == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4402 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4402
391 ((void *)0)
derlst == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4402 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4402
392 )-
393 return
never executed: return 0;
0;
never executed: return 0;
0
394 tmpdat = CRYPTO_malloc(skcontlen, __FILE__, 387);-
395 if (tmpdat ==
tmpdat == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4402 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4402
396 ((void *)0)
tmpdat == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4402 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4402
397 ) {-
398 CRYPTO_free(derlst, __FILE__, 389);-
399 return
never executed: return 0;
0;
never executed: return 0;
0
400 }-
401 }
executed 4402 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
4402
402 }-
403-
404 if (!do_sort
!do_sortDescription
TRUEevaluated 108194 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4402 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
4402-108194
405 for (i = 0; i < sk_ASN1_VALUE_num(sk)
i < sk_ASN1_VALUE_num(sk)Description
TRUEevaluated 173283 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 108194 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i++) {
108194-173283
406 skitem = sk_ASN1_VALUE_value(sk, i);-
407 ASN1_item_ex_i2d(&skitem, out, item, -1, iclass);-
408 }
executed 173283 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
173283
409 return
executed 108194 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 108194 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
108194
410 }-
411 p = tmpdat;-
412-
413-
414 for (i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk)
i < sk_ASN1_VALUE_num(sk)Description
TRUEevaluated 80947 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4402 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i++, tder++) {
4402-80947
415 skitem = sk_ASN1_VALUE_value(sk, i);-
416 tder->data = p;-
417 tder->length = ASN1_item_ex_i2d(&skitem, &p, item, -1, iclass);-
418 tder->field = skitem;-
419 }
executed 80947 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
80947
420-
421-
422 qsort(derlst, sk_ASN1_VALUE_num(sk), sizeof(*derlst), der_cmp);-
423-
424 p = *out;-
425 for (i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk)
i < sk_ASN1_VALUE_num(sk)Description
TRUEevaluated 80947 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4402 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i++, tder++) {
4402-80947
426 memcpy(p, tder->data, tder->length);-
427 p += tder->length;-
428 }
executed 80947 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
80947
429 *out = p;-
430-
431 if (do_sort == 2
do_sort == 2Description
TRUEevaluated 83 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4319 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
83-4319
432 for (i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk)
i < sk_ASN1_VALUE_num(sk)Description
TRUEevaluated 783 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 83 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i++, tder++)
83-783
433 (
executed 783 times by 1 test: (void)sk_ASN1_VALUE_set(sk, i, tder->field);
Executed by:
  • libcrypto.so.1.1
void)sk_ASN1_VALUE_set(sk, i, tder->field);
executed 783 times by 1 test: (void)sk_ASN1_VALUE_set(sk, i, tder->field);
Executed by:
  • libcrypto.so.1.1
783
434 }
executed 83 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
83
435 CRYPTO_free(derlst, __FILE__, 426);-
436 CRYPTO_free(tmpdat, __FILE__, 427);-
437 return
executed 4402 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 4402 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
4402
438}-
439-
440static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out,-
441 const ASN1_ITEM *it, int tag, int aclass)-
442{-
443 int len;-
444 int utype;-
445 int usetag;-
446 int ndef = 0;-
447-
448 utype = it->utype;-
449-
450-
451-
452-
453-
454 len = asn1_ex_i2c(pval, -
455 ((void *)0)-
456 , &utype, it);-
457-
458-
459-
460-
461-
462-
463 if ((
(utype == 16)Description
TRUEevaluated 66334 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3270707 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
utype == 16)
(utype == 16)Description
TRUEevaluated 66334 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3270707 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
|| (
(utype == 17)Description
TRUEevaluated 8940 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3261767 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
utype == 17)
(utype == 17)Description
TRUEevaluated 8940 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3261767 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
||
8940-3270707
464 (
(utype == -3)Description
TRUEevaluated 59936 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3201831 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
utype == -3)
(utype == -3)Description
TRUEevaluated 59936 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3201831 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
59936-3201831
465 usetag = 0;
executed 135210 times by 1 test: usetag = 0;
Executed by:
  • libcrypto.so.1.1
135210
466 else-
467 usetag = 1;
executed 3201831 times by 2 tests: usetag = 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3201831
468-
469-
470-
471 if (len == -1
len == -1Description
TRUEevaluated 388204 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2948837 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
388204-2948837
472 return
executed 388204 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 388204 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
388204
473-
474-
475 if (len == -2
len == -2Description
TRUEevaluated 570 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2948267 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
570-2948267
476 ndef = 2;-
477 len = 0;-
478 }
executed 570 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
570
479-
480-
481 if (tag == -1
tag == -1Description
TRUEevaluated 2921143 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 27694 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
27694-2921143
482 tag = utype;
executed 2921143 times by 2 tests: tag = utype;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
2921143
483-
484-
485 if (out
outDescription
TRUEevaluated 694848 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2253989 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
694848-2253989
486 if (usetag
usetagDescription
TRUEevaluated 661099 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 33749 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
33749-661099
487 ASN1_put_object(out, ndef, len, tag, aclass);
executed 661099 times by 2 tests: ASN1_put_object(out, ndef, len, tag, aclass);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
661099
488 asn1_ex_i2c(pval, *out, &utype, it);-
489 if (ndef
ndefDescription
TRUEevaluated 90 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 694758 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
90-694758
490 ASN1_put_eoc(out);
executed 90 times by 1 test: ASN1_put_eoc(out);
Executed by:
  • libcrypto.so.1.1
90
491 else-
492 *
executed 694758 times by 2 tests: *out += len;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
out += len;
executed 694758 times by 2 tests: *out += len;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
694758
493 }-
494-
495 if (usetag
usetagDescription
TRUEevaluated 2813627 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 135210 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
135210-2813627
496 return
executed 2813627 times by 2 tests: return ASN1_object_size(ndef, len, tag);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
ASN1_object_size(ndef, len, tag);
executed 2813627 times by 2 tests: return ASN1_object_size(ndef, len, tag);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
2813627
497 return
executed 135210 times by 1 test: return len;
Executed by:
  • libcrypto.so.1.1
len;
executed 135210 times by 1 test: return len;
Executed by:
  • libcrypto.so.1.1
135210
498}-
499-
500-
501-
502static int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype,-
503 const ASN1_ITEM *it)-
504{-
505 ASN1_BOOLEAN *tbool = -
506 ((void *)0)-
507 ;-
508 ASN1_STRING *strtmp;-
509 ASN1_OBJECT *otmp;-
510 int utype;-
511 const unsigned char *cont;-
512 unsigned char c;-
513 int len;-
514 const ASN1_PRIMITIVE_FUNCS *pf;-
515 pf = it->funcs;-
516 if (pf
pfDescription
TRUEevaluated 341805 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 3690084 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
&& pf->prim_i2c
pf->prim_i2cDescription
TRUEevaluated 341805 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
)
0-3690084
517 return
executed 341805 times by 2 tests: return pf->prim_i2c(pval, cout, putype, it);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
pf->prim_i2c(pval, cout, putype, it);
executed 341805 times by 2 tests: return pf->prim_i2c(pval, cout, putype, it);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
341805
518-
519-
520 if ((
(it->itype != 0x0)Description
TRUEevaluated 739541 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2950543 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
it->itype != 0x0)
(it->itype != 0x0)Description
TRUEevaluated 739541 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2950543 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
739541-2950543
521 || (
(it->utype != 1)Description
TRUEevaluated 2859177 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 91366 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
it->utype != 1)
(it->utype != 1)Description
TRUEevaluated 2859177 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 91366 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
91366-2859177
522 if (!*pval
!*pvalDescription
TRUEevaluated 248951 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3349767 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
248951-3349767
523 return
executed 248951 times by 1 test: return -1;
Executed by:
  • libcrypto.so.1.1
-1;
executed 248951 times by 1 test: return -1;
Executed by:
  • libcrypto.so.1.1
248951
524 }
executed 3349767 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3349767
525-
526 if (it->itype == 0x5
it->itype == 0x5Description
TRUEevaluated 739541 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2701592 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
739541-2701592
527-
528 strtmp = (ASN1_STRING *)*pval;-
529 utype = strtmp->type;-
530 *putype = utype;-
531 }
executed 739541 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else if (it->utype == -4
it->utype == -4Description
TRUEevaluated 714522 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1987070 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
714522-1987070
532-
533 ASN1_TYPE *typ;-
534 typ = (ASN1_TYPE *)*pval;-
535 utype = typ->type;-
536 *putype = utype;-
537 pval = &typ->value.asn1_value;-
538 }
executed 714522 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else
714522
539 utype = *putype;
executed 1987070 times by 2 tests: utype = *putype;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1987070
540-
541 switch (utype) {-
542 case
executed 1389267 times by 1 test: case 6:
Executed by:
  • libcrypto.so.1.1
6:
executed 1389267 times by 1 test: case 6:
Executed by:
  • libcrypto.so.1.1
1389267
543 otmp = (ASN1_OBJECT *)*pval;-
544 cont = otmp->data;-
545 len = otmp->length;-
546 if (cont ==
cont == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1389267 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1389267
547 ((void *)0)
cont == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1389267 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1389267
548 || len == 0
len == 0Description
TRUEnever evaluated
FALSEevaluated 1389267 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-1389267
549 return
never executed: return -1;
-1;
never executed: return -1;
0
550 break;
executed 1389267 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
1389267
551-
552 case
executed 181560 times by 1 test: case 5:
Executed by:
  • libcrypto.so.1.1
5:
executed 181560 times by 1 test: case 5:
Executed by:
  • libcrypto.so.1.1
181560
553 cont = -
554 ((void *)0)-
555 ;-
556 len = 0;-
557 break;
executed 181560 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
181560
558-
559 case
executed 96883 times by 1 test: case 1:
Executed by:
  • libcrypto.so.1.1
1:
executed 96883 times by 1 test: case 1:
Executed by:
  • libcrypto.so.1.1
96883
560 tbool = (ASN1_BOOLEAN *)pval;-
561 if (*
*tbool == -1Description
TRUEevaluated 82463 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14420 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
tbool == -1
*tbool == -1Description
TRUEevaluated 82463 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14420 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
14420-82463
562 return
executed 82463 times by 1 test: return -1;
Executed by:
  • libcrypto.so.1.1
-1;
executed 82463 times by 1 test: return -1;
Executed by:
  • libcrypto.so.1.1
82463
563 if (it->utype != -4
it->utype != -4Description
TRUEevaluated 8903 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5517 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
5517-8903
564-
565-
566-
567 if (*
*tboolDescription
TRUEevaluated 4555 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4348 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
tbool
*tboolDescription
TRUEevaluated 4555 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4348 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& (
(it->size > 0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4554 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
it->size > 0)
(it->size > 0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4554 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
1-4555
568 return
executed 1 time by 1 test: return -1;
Executed by:
  • libcrypto.so.1.1
-1;
executed 1 time by 1 test: return -1;
Executed by:
  • libcrypto.so.1.1
1
569 if (!*tbool
!*tboolDescription
TRUEevaluated 4348 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4554 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& !it->size
!it->sizeDescription
TRUEevaluated 1839 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2509 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
1839-4554
570 return
executed 1839 times by 1 test: return -1;
Executed by:
  • libcrypto.so.1.1
-1;
executed 1839 times by 1 test: return -1;
Executed by:
  • libcrypto.so.1.1
1839
571 }
executed 7063 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
7063
572 c = (unsigned char)*tbool;-
573 cont = &c;-
574 len = 1;-
575 break;
executed 12580 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
12580
576-
577 case
executed 309577 times by 1 test: case 3:
Executed by:
  • libcrypto.so.1.1
3:
executed 309577 times by 1 test: case 3:
Executed by:
  • libcrypto.so.1.1
309577
578 return
executed 309577 times by 1 test: return i2c_ASN1_BIT_STRING((ASN1_BIT_STRING *)*pval, cout ? &cout : ((void *)0) );
Executed by:
  • libcrypto.so.1.1
i2c_ASN1_BIT_STRING((ASN1_BIT_STRING *)*pval,
executed 309577 times by 1 test: return i2c_ASN1_BIT_STRING((ASN1_BIT_STRING *)*pval, cout ? &cout : ((void *)0) );
Executed by:
  • libcrypto.so.1.1
309577
579 cout ? &cout :
executed 309577 times by 1 test: return i2c_ASN1_BIT_STRING((ASN1_BIT_STRING *)*pval, cout ? &cout : ((void *)0) );
Executed by:
  • libcrypto.so.1.1
309577
580 ((void *)0)
executed 309577 times by 1 test: return i2c_ASN1_BIT_STRING((ASN1_BIT_STRING *)*pval, cout ? &cout : ((void *)0) );
Executed by:
  • libcrypto.so.1.1
309577
581 );
executed 309577 times by 1 test: return i2c_ASN1_BIT_STRING((ASN1_BIT_STRING *)*pval, cout ? &cout : ((void *)0) );
Executed by:
  • libcrypto.so.1.1
309577
582-
583 case
executed 116344 times by 1 test: case 2:
Executed by:
  • libcrypto.so.1.1
2:
executed 116344 times by 1 test: case 2:
Executed by:
  • libcrypto.so.1.1
116344
584 case
executed 10863 times by 1 test: case 10:
Executed by:
  • libcrypto.so.1.1
10:
executed 10863 times by 1 test: case 10:
Executed by:
  • libcrypto.so.1.1
10863
585-
586-
587-
588 return
executed 127207 times by 1 test: return i2c_ASN1_INTEGER((ASN1_INTEGER *)*pval, cout ? &cout : ((void *)0) );
Executed by:
  • libcrypto.so.1.1
i2c_ASN1_INTEGER((ASN1_INTEGER *)*pval, cout ? &cout :
executed 127207 times by 1 test: return i2c_ASN1_INTEGER((ASN1_INTEGER *)*pval, cout ? &cout : ((void *)0) );
Executed by:
  • libcrypto.so.1.1
127207
589 ((void *)0)
executed 127207 times by 1 test: return i2c_ASN1_INTEGER((ASN1_INTEGER *)*pval, cout ? &cout : ((void *)0) );
Executed by:
  • libcrypto.so.1.1
127207
590 );
executed 127207 times by 1 test: return i2c_ASN1_INTEGER((ASN1_INTEGER *)*pval, cout ? &cout : ((void *)0) );
Executed by:
  • libcrypto.so.1.1
127207
591-
592 case
executed 240812 times by 2 tests: case 4:
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
4:
executed 240812 times by 2 tests: case 4:
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
240812
593 case
executed 41879 times by 1 test: case 18:
Executed by:
  • libcrypto.so.1.1
18:
executed 41879 times by 1 test: case 18:
Executed by:
  • libcrypto.so.1.1
41879
594 case
executed 11684 times by 1 test: case 19:
Executed by:
  • libcrypto.so.1.1
19:
executed 11684 times by 1 test: case 19:
Executed by:
  • libcrypto.so.1.1
11684
595 case
executed 76427 times by 1 test: case 20:
Executed by:
  • libcrypto.so.1.1
20:
executed 76427 times by 1 test: case 20:
Executed by:
  • libcrypto.so.1.1
76427
596 case
executed 460 times by 1 test: case 21:
Executed by:
  • libcrypto.so.1.1
21:
executed 460 times by 1 test: case 21:
Executed by:
  • libcrypto.so.1.1
460
597 case
executed 11918 times by 1 test: case 22:
Executed by:
  • libcrypto.so.1.1
22:
executed 11918 times by 1 test: case 22:
Executed by:
  • libcrypto.so.1.1
11918
598 case
executed 4171 times by 1 test: case 23:
Executed by:
  • libcrypto.so.1.1
23:
executed 4171 times by 1 test: case 23:
Executed by:
  • libcrypto.so.1.1
4171
599 case
executed 11892 times by 1 test: case 24:
Executed by:
  • libcrypto.so.1.1
24:
executed 11892 times by 1 test: case 24:
Executed by:
  • libcrypto.so.1.1
11892
600 case
executed 6952 times by 1 test: case 25:
Executed by:
  • libcrypto.so.1.1
25:
executed 6952 times by 1 test: case 25:
Executed by:
  • libcrypto.so.1.1
6952
601 case
executed 8334 times by 1 test: case 26:
Executed by:
  • libcrypto.so.1.1
26:
executed 8334 times by 1 test: case 26:
Executed by:
  • libcrypto.so.1.1
8334
602 case
executed 7780 times by 1 test: case 27:
Executed by:
  • libcrypto.so.1.1
27:
executed 7780 times by 1 test: case 27:
Executed by:
  • libcrypto.so.1.1
7780
603 case
executed 51715 times by 1 test: case 28:
Executed by:
  • libcrypto.so.1.1
28:
executed 51715 times by 1 test: case 28:
Executed by:
  • libcrypto.so.1.1
51715
604 case
executed 31457 times by 1 test: case 30:
Executed by:
  • libcrypto.so.1.1
30:
executed 31457 times by 1 test: case 30:
Executed by:
  • libcrypto.so.1.1
31457
605 case
executed 530827 times by 1 test: case 12:
Executed by:
  • libcrypto.so.1.1
12:
executed 530827 times by 1 test: case 12:
Executed by:
  • libcrypto.so.1.1
530827
606 case
executed 85325 times by 1 test: case 16:
Executed by:
  • libcrypto.so.1.1
16:
executed 85325 times by 1 test: case 16:
Executed by:
  • libcrypto.so.1.1
85325
607 case
executed 10772 times by 1 test: case 17:
Executed by:
  • libcrypto.so.1.1
17:
executed 10772 times by 1 test: case 17:
Executed by:
  • libcrypto.so.1.1
10772
608 default
executed 204234 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
:
executed 204234 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
204234
609-
610 strtmp = (ASN1_STRING *)*pval;-
611-
612 if ((
(it->size == (0x1<<11))Description
TRUEevaluated 852 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1335787 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
it->size == (0x1<<11))
(it->size == (0x1<<11))Description
TRUEevaluated 852 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1335787 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
852-1335787
613 && (
(strtmp->flags & 0x010)Description
TRUEevaluated 660 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 192 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
strtmp->flags & 0x010)
(strtmp->flags & 0x010)Description
TRUEevaluated 660 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 192 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
192-660
614 if (cout
coutDescription
TRUEevaluated 90 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 570 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
90-570
615 strtmp->data = cout;-
616 strtmp->length = 0;-
617 }
executed 90 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
90
618-
619 return
executed 660 times by 1 test: return -2;
Executed by:
  • libcrypto.so.1.1
-2;
executed 660 times by 1 test: return -2;
Executed by:
  • libcrypto.so.1.1
660
620 }-
621 cont = strtmp->data;-
622 len = strtmp->length;-
623-
624 break;
executed 1335979 times by 2 tests: break;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1335979
625-
626 }-
627 if (cout
coutDescription
TRUEevaluated 548505 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2370881 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
&& len
lenDescription
TRUEevaluated 444637 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 103868 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
103868-2370881
628 memcpy(cout, cont, len);
executed 444637 times by 2 tests: memcpy(cout, cont, len);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
444637
629 return
executed 2919386 times by 2 tests: return len;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
len;
executed 2919386 times by 2 tests: return len;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
2919386
630}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2