OpenCoverage

bio_ndef.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/bio_ndef.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2typedef struct ndef_aux_st {-
3-
4 ASN1_VALUE *val;-
5 const ASN1_ITEM *it;-
6-
7 BIO *ndef_bio;-
8-
9 BIO *out;-
10-
11 unsigned char **boundary;-
12-
13 unsigned char *derbuf;-
14} NDEF_SUPPORT;-
15-
16static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg);-
17static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen,-
18 void *parg);-
19static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg);-
20static int ndef_suffix_free(BIO *b, unsigned char **pbuf, int *plen,-
21 void *parg);-
22-
23BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it)-
24{-
25 NDEF_SUPPORT *ndef_aux = -
26 ((void *)0)-
27 ;-
28 BIO *asn_bio = -
29 ((void *)0)-
30 ;-
31 const ASN1_AUX *aux = it->funcs;-
32 ASN1_STREAM_ARG sarg;-
33-
34 if (!aux
!auxDescription
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| !aux->asn1_cb
!aux->asn1_cbDescription
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-45
35 ERR_put_error(13,(208),(202),__FILE__,60);-
36 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
37 ((void *)0)
never executed: return ((void *)0) ;
0
38 ;
never executed: return ((void *)0) ;
0
39 }-
40 ndef_aux = CRYPTO_zalloc(sizeof(*ndef_aux), __FILE__, 63);-
41 asn_bio = BIO_new(BIO_f_asn1());-
42 if (ndef_aux ==
ndef_aux == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-45
43 ((void *)0)
ndef_aux == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-45
44 || asn_bio ==
asn_bio == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-45
45 ((void *)0)
asn_bio == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-45
46 )-
47 goto
never executed: goto err;
err;
never executed: goto err;
0
48-
49-
50 out = BIO_push(asn_bio, out);-
51 if (out ==
out == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-45
52 ((void *)0)
out == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-45
53 )-
54 goto
never executed: goto err;
err;
never executed: goto err;
0
55-
56 BIO_asn1_set_prefix(asn_bio, ndef_prefix, ndef_prefix_free);-
57 BIO_asn1_set_suffix(asn_bio, ndef_suffix, ndef_suffix_free);-
58-
59-
60-
61-
62-
63-
64 sarg.out = out;-
65 sarg.ndef_bio = -
66 ((void *)0)-
67 ;-
68 sarg.boundary = -
69 ((void *)0)-
70 ;-
71-
72 if (aux->asn1_cb(10, &val, it, &sarg) <= 0
aux->asn1_cb(1...t, &sarg) <= 0Description
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-45
73 goto
never executed: goto err;
err;
never executed: goto err;
0
74-
75 ndef_aux->val = val;-
76 ndef_aux->it = it;-
77 ndef_aux->ndef_bio = sarg.ndef_bio;-
78 ndef_aux->boundary = sarg.boundary;-
79 ndef_aux->out = out;-
80-
81 BIO_ctrl(asn_bio, 153, 0, ndef_aux);-
82-
83 return
executed 45 times by 1 test: return sarg.ndef_bio;
Executed by:
  • libcrypto.so.1.1
sarg.ndef_bio;
executed 45 times by 1 test: return sarg.ndef_bio;
Executed by:
  • libcrypto.so.1.1
45
84-
85 err:-
86 BIO_free(asn_bio);-
87 CRYPTO_free(ndef_aux, __FILE__, 100);-
88 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
89 ((void *)0)
never executed: return ((void *)0) ;
0
90 ;
never executed: return ((void *)0) ;
0
91}-
92-
93static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg)-
94{-
95 NDEF_SUPPORT *ndef_aux;-
96 unsigned char *p;-
97 int derlen;-
98-
99 if (!parg
!pargDescription
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-45
100 return
never executed: return 0;
0;
never executed: return 0;
0
101-
102 ndef_aux = *(NDEF_SUPPORT **)parg;-
103-
104 derlen = ASN1_item_ndef_i2d(ndef_aux->val, -
105 ((void *)0)-
106 , ndef_aux->it);-
107 if ((
(p = CRYPTO_ma...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
p = CRYPTO_malloc(derlen, __FILE__, 116)) ==
(p = CRYPTO_ma...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-45
108 ((void *)0)
(p = CRYPTO_ma...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-45
109 ) {-
110 ERR_put_error(13,(127),((1|64)),__FILE__,117);-
111 return
never executed: return 0;
0;
never executed: return 0;
0
112 }-
113-
114 ndef_aux->derbuf = p;-
115 *pbuf = p;-
116 derlen = ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it);-
117-
118 if (!*ndef_aux->boundary
!*ndef_aux->boundaryDescription
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-45
119 return
never executed: return 0;
0;
never executed: return 0;
0
120-
121 *plen = *ndef_aux->boundary - *pbuf;-
122-
123 return
executed 45 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 45 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
45
124}-
125-
126static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen,-
127 void *parg)-
128{-
129 NDEF_SUPPORT *ndef_aux;-
130-
131 if (!parg
!pargDescription
TRUEnever evaluated
FALSEevaluated 90 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-90
132 return
never executed: return 0;
0;
never executed: return 0;
0
133-
134 ndef_aux = *(NDEF_SUPPORT **)parg;-
135-
136 CRYPTO_free(ndef_aux->derbuf, __FILE__, 143);-
137-
138 ndef_aux->derbuf = -
139 ((void *)0)-
140 ;-
141 *pbuf = -
142 ((void *)0)-
143 ;-
144 *plen = 0;-
145 return
executed 90 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 90 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
90
146}-
147-
148static int ndef_suffix_free(BIO *b, unsigned char **pbuf, int *plen,-
149 void *parg)-
150{-
151 NDEF_SUPPORT **pndef_aux = (NDEF_SUPPORT **)parg;-
152 if (!ndef_prefix_free(b, pbuf, plen, parg)
!ndef_prefix_f...f, plen, parg)Description
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-45
153 return
never executed: return 0;
0;
never executed: return 0;
0
154 CRYPTO_free(*pndef_aux, __FILE__, 157);-
155 *pndef_aux = -
156 ((void *)0)-
157 ;-
158 return
executed 45 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 45 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
45
159}-
160-
161static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg)-
162{-
163 NDEF_SUPPORT *ndef_aux;-
164 unsigned char *p;-
165 int derlen;-
166 const ASN1_AUX *aux;-
167 ASN1_STREAM_ARG sarg;-
168-
169 if (!parg
!pargDescription
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-45
170 return
never executed: return 0;
0;
never executed: return 0;
0
171-
172 ndef_aux = *(NDEF_SUPPORT **)parg;-
173-
174 aux = ndef_aux->it->funcs;-
175-
176-
177 sarg.ndef_bio = ndef_aux->ndef_bio;-
178 sarg.out = ndef_aux->out;-
179 sarg.boundary = ndef_aux->boundary;-
180 if (aux->asn1_cb(11,
aux->asn1_cb(1...t, &sarg) <= 0Description
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-45
181 &ndef_aux->val, ndef_aux->it, &sarg) <= 0
aux->asn1_cb(1...t, &sarg) <= 0Description
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-45
182 return
never executed: return 0;
0;
never executed: return 0;
0
183-
184 derlen = ASN1_item_ndef_i2d(ndef_aux->val, -
185 ((void *)0)-
186 , ndef_aux->it);-
187 if ((
(p = CRYPTO_ma...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
p = CRYPTO_malloc(derlen, __FILE__, 186)) ==
(p = CRYPTO_ma...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-45
188 ((void *)0)
(p = CRYPTO_ma...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-45
189 ) {-
190 ERR_put_error(13,(136),((1|64)),__FILE__,187);-
191 return
never executed: return 0;
0;
never executed: return 0;
0
192 }-
193-
194 ndef_aux->derbuf = p;-
195 *pbuf = p;-
196 derlen = ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it);-
197-
198 if (!*ndef_aux->boundary
!*ndef_aux->boundaryDescription
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-45
199 return
never executed: return 0;
0;
never executed: return 0;
0
200 *pbuf = *ndef_aux->boundary;-
201 *plen = derlen - (*ndef_aux->boundary - ndef_aux->derbuf);-
202-
203 return
executed 45 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 45 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
45
204}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2