OpenCoverage

asn1_lib.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/asn1_lib.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,-
3 long max);-
4static void asn1_put_length(unsigned char **pp, int length);-
5-
6static int _asn1_check_infinite_end(const unsigned char **p, long len)-
7{-
8-
9-
10-
11 if (len <= 0
len <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
12 return
never executed: return 1;
1;
never executed: return 1;
0
13 else if ((
(len >= 2)Description
TRUEnever evaluated
FALSEnever evaluated
len >= 2)
(len >= 2)Description
TRUEnever evaluated
FALSEnever evaluated
&& ((*
((*p)[0] == 0)Description
TRUEnever evaluated
FALSEnever evaluated
p)[0] == 0)
((*p)[0] == 0)Description
TRUEnever evaluated
FALSEnever evaluated
&& ((*
((*p)[1] == 0)Description
TRUEnever evaluated
FALSEnever evaluated
p)[1] == 0)
((*p)[1] == 0)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
14 (*p) += 2;-
15 return
never executed: return 1;
1;
never executed: return 1;
0
16 }-
17 return
never executed: return 0;
0;
never executed: return 0;
0
18}-
19-
20int ASN1_check_infinite_end(unsigned char **p, long len)-
21{-
22 return
never executed: return _asn1_check_infinite_end((const unsigned char **)p, len);
_asn1_check_infinite_end((const unsigned char **)p, len);
never executed: return _asn1_check_infinite_end((const unsigned char **)p, len);
0
23}-
24-
25int ASN1_const_check_infinite_end(const unsigned char **p, long len)-
26{-
27 return
never executed: return _asn1_check_infinite_end(p, len);
_asn1_check_infinite_end(p, len);
never executed: return _asn1_check_infinite_end(p, len);
0
28}-
29-
30int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,-
31 int *pclass, long omax)-
32{-
33 int i, ret;-
34 long l;-
35 const unsigned char *p = *pp;-
36 int tag, xclass, inf;-
37 long max = omax;-
38-
39 if (!max
!maxDescription
TRUEevaluated 2805 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 12288196 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
2805-12288196
40 goto
executed 2805 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
err;
executed 2805 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
2805
41 ret = (*p & 0x20);-
42 xclass = (*p & 0xc0);-
43 i = *p & 0x1f;-
44 if (i == 0x1f
i == 0x1fDescription
TRUEevaluated 42636 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 12245560 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
42636-12245560
45 p++;-
46 if (--
--max == 0Description
TRUEevaluated 1080 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 41556 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
max == 0
--max == 0Description
TRUEevaluated 1080 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 41556 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
1080-41556
47 goto
executed 1080 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
err;
executed 1080 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
1080
48 l = 0;-
49 while (*
*p & 0x80Description
TRUEevaluated 19850 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 39885 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
p & 0x80
*p & 0x80Description
TRUEevaluated 19850 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 39885 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
19850-39885
50 l <<= 7L;-
51 l |= *(p++) & 0x7f;-
52 if (--
--max == 0Description
TRUEevaluated 819 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 19031 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
max == 0
--max == 0Description
TRUEevaluated 819 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 19031 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
819-19031
53 goto
executed 819 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
err;
executed 819 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
819
54 if (l > (0x7fffffff >> 7L)
l > (0x7fffffff >> 7L)Description
TRUEevaluated 852 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 18179 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
852-18179
55 goto
executed 852 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
err;
executed 852 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
852
56 }
executed 18179 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
18179
57 l <<= 7L;-
58 l |= *(p++) & 0x7f;-
59 tag = (int)l;-
60 if (--
--max == 0Description
TRUEevaluated 1219 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 38666 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
max == 0
--max == 0Description
TRUEevaluated 1219 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 38666 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
1219-38666
61 goto
executed 1219 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
err;
executed 1219 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
1219
62 }
executed 38666 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
38666
63 tag = i;-
64 p++;-
65 if (--
--max == 0Description
TRUEevaluated 8459 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 12237101 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
max == 0
--max == 0Description
TRUEevaluated 8459 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 12237101 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
8459-12237101
66 goto
executed 8459 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
err;
executed 8459 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
8459
67 }
executed 12237101 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
12237101
68 *ptag = tag;-
69 *pclass = xclass;-
70 if (!asn1_get_length(&p, &inf, plength, max)
!asn1_get_leng... plength, max)Description
TRUEevaluated 9320 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 12266447 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
9320-12266447
71 goto
executed 9320 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
err;
executed 9320 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
9320
72-
73 if (inf
infDescription
TRUEevaluated 3662987 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8603460 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
&& !(ret & 0x20)
!(ret & 0x20)Description
TRUEevaluated 2136 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3660851 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
2136-8603460
74 goto
executed 2136 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
err;
executed 2136 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
2136
75-
76 if (*
*plength > (omax - (p - *pp))Description
TRUEevaluated 46553 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 12217758 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
plength > (omax - (p - *pp))
*plength > (omax - (p - *pp))Description
TRUEevaluated 46553 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 12217758 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
46553-12217758
77 ERR_put_error(13,(114),(155),__FILE__,91);-
78-
79-
80-
81-
82 ret |= 0x80;-
83 }
executed 46553 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
46553
84 *pp = p;-
85 return
executed 12264311 times by 2 tests: return ret | inf;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
ret | inf;
executed 12264311 times by 2 tests: return ret | inf;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
12264311
86 err:-
87 ERR_put_error(13,(114),(123),__FILE__,101);-
88 return
executed 26690 times by 1 test: return 0x80;
Executed by:
  • libcrypto.so.1.1
0x80;
executed 26690 times by 1 test: return 0x80;
Executed by:
  • libcrypto.so.1.1
26690
89}-
90static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,-
91 long max)-
92{-
93 const unsigned char *p = *pp;-
94 unsigned long ret = 0;-
95 int i;-
96-
97 if (max-- < 1
max-- < 1Description
TRUEnever evaluated
FALSEevaluated 12275767 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-12275767
98 return
never executed: return 0;
0;
never executed: return 0;
0
99 if (*
*p == 0x80Description
TRUEevaluated 3662987 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8612780 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
p == 0x80
*p == 0x80Description
TRUEevaluated 3662987 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8612780 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
3662987-8612780
100 *inf = 1;-
101 p++;-
102 }
executed 3662987 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
3662987
103 *inf = 0;-
104 i = *p & 0x7f;-
105 if (*
*p++ & 0x80Description
TRUEevaluated 376881 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8235899 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
p++ & 0x80
*p++ & 0x80Description
TRUEevaluated 376881 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8235899 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
376881-8235899
106 if (max < i + 1
max < i + 1Description
TRUEevaluated 7311 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 369570 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
7311-369570
107 return
executed 7311 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 7311 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
7311
108-
109 while (i > 0
i > 0Description
TRUEevaluated 375212 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 66369 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& *
*p == 0Description
TRUEevaluated 72011 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 303201 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
p == 0
*p == 0Description
TRUEevaluated 72011 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 303201 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
66369-375212
110 p++;-
111 i--;-
112 }
executed 72011 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
72011
113 if (i > (int)sizeof(long)
i > (int)sizeof(long)Description
TRUEevaluated 1099 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 368471 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
1099-368471
114 return
executed 1099 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 1099 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
1099
115 while (i > 0
i > 0Description
TRUEevaluated 441726 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 368471 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
368471-441726
116 ret <<= 8;-
117 ret |= *p++;-
118 i--;-
119 }
executed 441726 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
441726
120 if (ret > 0x7fffffffffffffffL
ret > 0x7fffffffffffffffLDescription
TRUEevaluated 910 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 367561 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
910-367561
121 return
executed 910 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 910 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
910
122 }
executed 367561 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else
367561
123 ret = i;
executed 8235899 times by 2 tests: ret = i;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
8235899
124 }-
125 *pp = p;-
126 *rl = (long)ret;-
127 return
executed 12266447 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 12266447 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
12266447
128}-
129-
130-
131-
132-
133void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag,-
134 int xclass)-
135{-
136 unsigned char *p = *pp;-
137 int i, ttag;-
138-
139 i = (
(constructed)Description
TRUEevaluated 477168 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 661176 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
constructed)
(constructed)Description
TRUEevaluated 477168 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 661176 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
? 0x20 : 0;
477168-661176
140 i |= (xclass & 0xc0);-
141 if (tag < 31
tag < 31Description
TRUEevaluated 1130656 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 7688 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
7688-1130656
142 *(
executed 1130656 times by 2 tests: *(p++) = i | (tag & 0x1f);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
p++) = i | (tag & 0x1f);
executed 1130656 times by 2 tests: *(p++) = i | (tag & 0x1f);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1130656
143 else {-
144 *(p++) = i | 0x1f;-
145 for (i = 0, ttag = tag; ttag > 0
ttag > 0Description
TRUEevaluated 15736 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 7688 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i++)
7688-15736
146 ttag >>= 7;
executed 15736 times by 1 test: ttag >>= 7;
Executed by:
  • libcrypto.so.1.1
15736
147 ttag = i;-
148 while (i-- > 0
i-- > 0Description
TRUEevaluated 15736 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 7688 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
7688-15736
149 p[i] = tag & 0x7f;-
150 if (i != (ttag - 1)
i != (ttag - 1)Description
TRUEevaluated 8048 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 7688 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
7688-8048
151 p[i] |= 0x80;
executed 8048 times by 1 test: p[i] |= 0x80;
Executed by:
  • libcrypto.so.1.1
8048
152 tag >>= 7;-
153 }
executed 15736 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
15736
154 p += ttag;-
155 }
executed 7688 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
7688
156 if (constructed == 2
constructed == 2Description
TRUEevaluated 480 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1137864 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
480-1137864
157 *(
executed 480 times by 1 test: *(p++) = 0x80;
Executed by:
  • libcrypto.so.1.1
p++) = 0x80;
executed 480 times by 1 test: *(p++) = 0x80;
Executed by:
  • libcrypto.so.1.1
480
158 else-
159 asn1_put_length(&p, length);
executed 1137864 times by 2 tests: asn1_put_length(&p, length);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1137864
160 *pp = p;-
161}
executed 1138344 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1138344
162-
163int ASN1_put_eoc(unsigned char **pp)-
164{-
165 unsigned char *p = *pp;-
166 *p++ = 0;-
167 *p++ = 0;-
168 *pp = p;-
169 return
executed 480 times by 1 test: return 2;
Executed by:
  • libcrypto.so.1.1
2;
executed 480 times by 1 test: return 2;
Executed by:
  • libcrypto.so.1.1
480
170}-
171-
172static void asn1_put_length(unsigned char **pp, int length)-
173{-
174 unsigned char *p = *pp;-
175 int i, l;-
176 if (length <= 127
length <= 127Description
TRUEevaluated 1084378 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 53486 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
53486-1084378
177 *(
executed 1084378 times by 2 tests: *(p++) = (unsigned char)length;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
p++) = (unsigned char)length;
executed 1084378 times by 2 tests: *(p++) = (unsigned char)length;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1084378
178 else {-
179 l = length;-
180 for (i = 0; l > 0
l > 0Description
TRUEevaluated 96912 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 53486 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i++)
53486-96912
181 l >>= 8;
executed 96912 times by 1 test: l >>= 8;
Executed by:
  • libcrypto.so.1.1
96912
182 *(p++) = i | 0x80;-
183 l = i;-
184 while (i-- > 0
i-- > 0Description
TRUEevaluated 96912 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 53486 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
53486-96912
185 p[i] = length & 0xff;-
186 length >>= 8;-
187 }
executed 96912 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
96912
188 p += l;-
189 }
executed 53486 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
53486
190 *pp = p;-
191}
executed 1137864 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1137864
192-
193int ASN1_object_size(int constructed, int length, int tag)-
194{-
195 int ret = 1;-
196 if (length < 0
length < 0Description
TRUEnever evaluated
FALSEevaluated 4202881 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-4202881
197 return
never executed: return -1;
-1;
never executed: return -1;
0
198 if (tag >= 31
tag >= 31Description
TRUEevaluated 32684 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4170197 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
32684-4170197
199 while (tag > 0
tag > 0Description
TRUEevaluated 68037 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 32684 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
32684-68037
200 tag >>= 7;-
201 ret++;-
202 }
executed 68037 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
68037
203 }
executed 32684 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
32684
204 if (constructed == 2
constructed == 2Description
TRUEevaluated 2016 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4200865 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
2016-4200865
205 ret += 3;-
206 }
executed 2016 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
2016
207 ret++;-
208 if (length > 127
length > 127Description
TRUEevaluated 139698 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4061167 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
139698-4061167
209 int tmplen = length;-
210 while (tmplen > 0
tmplen > 0Description
TRUEevaluated 252444 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 139698 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
139698-252444
211 tmplen >>= 8;-
212 ret++;-
213 }
executed 252444 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
252444
214 }
executed 139698 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
139698
215 }
executed 4200865 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
4200865
216 if (ret >= 0x7fffffff - length
ret >= 0x7fffffff - lengthDescription
TRUEnever evaluated
FALSEevaluated 4202881 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-4202881
217 return
never executed: return -1;
-1;
never executed: return -1;
0
218 return
executed 4202881 times by 2 tests: return ret + length;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
ret + length;
executed 4202881 times by 2 tests: return ret + length;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
4202881
219}-
220-
221int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str)-
222{-
223 if (str ==
str == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 25360 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-25360
224 ((void *)0)
str == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 25360 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-25360
225 )-
226 return
never executed: return 0;
0;
never executed: return 0;
0
227 dst->type = str->type;-
228 if (!ASN1_STRING_set(dst, str->data, str->length)
!ASN1_STRING_s..., str->length)Description
TRUEnever evaluated
FALSEevaluated 25360 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-25360
229 return
never executed: return 0;
0;
never executed: return 0;
0
230-
231 dst->flags &= 0x080;-
232 dst->flags |= str->flags & ~0x080;-
233 return
executed 25360 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 25360 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
25360
234}-
235-
236ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *str)-
237{-
238 ASN1_STRING *ret;-
239 if (!str
!strDescription
TRUEnever evaluated
FALSEevaluated 2849 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-2849
240 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
241 ((void *)0)
never executed: return ((void *)0) ;
0
242 ;
never executed: return ((void *)0) ;
0
243 ret = ASN1_STRING_new();-
244 if (ret ==
ret == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2849 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2849
245 ((void *)0)
ret == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2849 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2849
246 )-
247 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
248 ((void *)0)
never executed: return ((void *)0) ;
0
249 ;
never executed: return ((void *)0) ;
0
250 if (!ASN1_STRING_copy(ret, str)
!ASN1_STRING_copy(ret, str)Description
TRUEnever evaluated
FALSEevaluated 2849 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-2849
251 ASN1_STRING_free(ret);-
252 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
253 ((void *)0)
never executed: return ((void *)0) ;
0
254 ;
never executed: return ((void *)0) ;
0
255 }-
256 return
executed 2849 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 2849 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
2849
257}-
258-
259int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)-
260{-
261 unsigned char *c;-
262 const char *data = _data;-
263-
264 if (len < 0
len < 0Description
TRUEevaluated 102 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1135926 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
102-1135926
265 if (data ==
data == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 102 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-102
266 ((void *)0)
data == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 102 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-102
267 )-
268 return
never executed: return 0;
0;
never executed: return 0;
0
269 else-
270 len = strlen(data);
executed 102 times by 1 test: len = strlen(data);
Executed by:
  • libcrypto.so.1.1
102
271 }-
272 if ((
(str->length <= len)Description
TRUEevaluated 1136028 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
str->length <= len)
(str->length <= len)Description
TRUEevaluated 1136028 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
|| (
(str->data == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
str->data ==
(str->data == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0-1136028
273 ((void *)0)
(str->data == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
274 )
(str->data == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
275 c = str->data;-
276 str->data = CRYPTO_realloc(c, len + 1, __FILE__, 284);-
277 if (str->data ==
str->data == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1136028 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1136028
278 ((void *)0)
str->data == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1136028 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1136028
279 ) {-
280 ERR_put_error(13,(186),((1|64)),__FILE__,286);-
281 str->data = c;-
282 return
never executed: return 0;
0;
never executed: return 0;
0
283 }-
284 }
executed 1136028 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1136028
285 str->length = len;-
286 if (data !=
data != ((void *)0)Description
TRUEevaluated 858141 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 277887 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
277887-858141
287 ((void *)0)
data != ((void *)0)Description
TRUEevaluated 858141 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 277887 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
277887-858141
288 ) {-
289 memcpy(str->data, data, len);-
290-
291 str->data[len] = '\0';-
292 }
executed 858141 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
858141
293 return
executed 1136028 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 1136028 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1136028
294}-
295-
296void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len)-
297{-
298 CRYPTO_free(str->data, __FILE__, 302);-
299 str->data = data;-
300 str->length = len;-
301}
executed 483 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
483
302-
303ASN1_STRING *ASN1_STRING_new(void)-
304{-
305 return
executed 11214 times by 1 test: return ASN1_STRING_type_new(4);
Executed by:
  • libcrypto.so.1.1
ASN1_STRING_type_new(4);
executed 11214 times by 1 test: return ASN1_STRING_type_new(4);
Executed by:
  • libcrypto.so.1.1
11214
306}-
307-
308ASN1_STRING *ASN1_STRING_type_new(int type)-
309{-
310 ASN1_STRING *ret;-
311-
312 ret = CRYPTO_zalloc(sizeof(*ret), __FILE__, 316);-
313 if (ret ==
ret == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1331089 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1331089
314 ((void *)0)
ret == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1331089 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1331089
315 ) {-
316 ERR_put_error(13,(130),((1|64)),__FILE__,318);-
317 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
318 ((void *)0)
never executed: return ((void *)0) ;
0
319 ;
never executed: return ((void *)0) ;
0
320 }-
321 ret->type = type;-
322 return
executed 1331089 times by 2 tests: return ret;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
ret;
executed 1331089 times by 2 tests: return ret;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1331089
323}-
324-
325void asn1_string_embed_free(ASN1_STRING *a, int embed)-
326{-
327 if (a ==
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1704197 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1704197
328 ((void *)0)
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1704197 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1704197
329 )-
330 return;
never executed: return;
0
331 if (!(a->flags & 0x010)
!(a->flags & 0x010)Description
TRUEevaluated 1704152 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
45-1704152
332 CRYPTO_free(a->data, __FILE__, 330);
executed 1704152 times by 2 tests: CRYPTO_free(a->data, __FILE__, 330);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1704152
333 if (embed == 0
embed == 0Description
TRUEevaluated 1331089 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 373108 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
373108-1331089
334 CRYPTO_free(a, __FILE__, 332);
executed 1331089 times by 2 tests: CRYPTO_free(a, __FILE__, 332);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1331089
335}
executed 1704197 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1704197
336-
337void ASN1_STRING_free(ASN1_STRING *a)-
338{-
339 if (a ==
a == ((void *)0)Description
TRUEevaluated 541406 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 258109 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
258109-541406
340 ((void *)0)
a == ((void *)0)Description
TRUEevaluated 541406 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 258109 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
258109-541406
341 )-
342 return;
executed 541406 times by 1 test: return;
Executed by:
  • libcrypto.so.1.1
541406
343 asn1_string_embed_free(a, a->flags & 0x080);-
344}
executed 258109 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
258109
345-
346void ASN1_STRING_clear_free(ASN1_STRING *a)-
347{-
348 if (a ==
a == ((void *)0)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 65 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
3-65
349 ((void *)0)
a == ((void *)0)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 65 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
3-65
350 )-
351 return;
executed 3 times by 1 test: return;
Executed by:
  • libcrypto.so.1.1
3
352 if (a->data
a->dataDescription
TRUEevaluated 65 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
&& !(a->flags & 0x010)
!(a->flags & 0x010)Description
TRUEevaluated 65 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-65
353 OPENSSL_cleanse(a->data, a->length);
executed 65 times by 1 test: OPENSSL_cleanse(a->data, a->length);
Executed by:
  • libcrypto.so.1.1
65
354 ASN1_STRING_free(a);-
355}
executed 65 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
65
356-
357int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b)-
358{-
359 int i;-
360-
361 i = (a->length - b->length);-
362 if (i == 0
i == 0Description
TRUEevaluated 2878 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
9-2878
363 i = memcmp(a->data, b->data, a->length);-
364 if (i == 0
i == 0Description
TRUEevaluated 2736 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 142 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
142-2736
365 return
executed 2736 times by 1 test: return a->type - b->type;
Executed by:
  • libcrypto.so.1.1
a->type - b->type;
executed 2736 times by 1 test: return a->type - b->type;
Executed by:
  • libcrypto.so.1.1
2736
366 else-
367 return
executed 142 times by 1 test: return i;
Executed by:
  • libcrypto.so.1.1
i;
executed 142 times by 1 test: return i;
Executed by:
  • libcrypto.so.1.1
142
368 } else-
369 return
executed 9 times by 1 test: return i;
Executed by:
  • libcrypto.so.1.1
i;
executed 9 times by 1 test: return i;
Executed by:
  • libcrypto.so.1.1
9
370}-
371-
372int ASN1_STRING_length(const ASN1_STRING *x)-
373{-
374 return
executed 208482 times by 1 test: return x->length;
Executed by:
  • libcrypto.so.1.1
x->length;
executed 208482 times by 1 test: return x->length;
Executed by:
  • libcrypto.so.1.1
208482
375}-
376-
377void ASN1_STRING_length_set(ASN1_STRING *x, int len)-
378{-
379 x->length = len;-
380}
never executed: end of block
0
381-
382int ASN1_STRING_type(const ASN1_STRING *x)-
383{-
384 return
never executed: return x->type;
x->type;
never executed: return x->type;
0
385}-
386-
387const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x)-
388{-
389 return
executed 210900 times by 1 test: return x->data;
Executed by:
  • libcrypto.so.1.1
x->data;
executed 210900 times by 1 test: return x->data;
Executed by:
  • libcrypto.so.1.1
210900
390}-
391-
392-
393unsigned char *ASN1_STRING_data(ASN1_STRING *x)-
394{-
395 return
never executed: return x->data;
x->data;
never executed: return x->data;
0
396}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2