Lines Matching refs:it

68 static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
70 static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
72 static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
74 ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it)
77 if (ASN1_item_ex_new(&ret, it) > 0)
84 int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
86 return asn1_item_ex_combine_new(pval, it, 0);
89 static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
95 const ASN1_AUX *aux = it->funcs;
105 if (it->sname)
106 CRYPTO_push_info(it->sname);
109 switch (it->itype) {
112 ef = it->funcs;
114 if (!ef->asn1_ex_new(pval, it))
120 cf = it->funcs;
129 if (it->templates) {
130 if (!ASN1_template_new(pval, it->templates))
132 } else if (!ASN1_primitive_new(pval, it))
137 if (!ASN1_primitive_new(pval, it))
143 i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
148 if (it->sname)
155 *pval = OPENSSL_malloc(it->size);
158 memset(*pval, 0, it->size);
160 asn1_set_choice_selector(pval, -1, it);
161 if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
168 i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
173 if (it->sname)
180 *pval = OPENSSL_malloc(it->size);
183 memset(*pval, 0, it->size);
184 asn1_do_lock(pval, 0, it);
185 asn1_enc_init(pval, it);
187 for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
192 if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
197 if (it->sname)
203 asn1_item_combine_free(pval, it, combine);
207 if (it->sname)
213 asn1_item_combine_free(pval, it, combine);
217 if (it->sname)
224 static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
228 switch (it->itype) {
231 ef = it->funcs;
233 ef->asn1_ex_clear(pval, it);
239 if (it->templates)
240 asn1_template_clear(pval, it->templates);
242 asn1_primitive_clear(pval, it);
246 asn1_primitive_clear(pval, it);
260 const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item);
289 /* Otherwise pass it back to the item routine */
290 ret = asn1_item_ex_combine_new(pval, it, tt->flags & ASN1_TFLG_COMBINE);
293 if (it->sname)
313 int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
319 if (!it)
322 if (it->funcs) {
323 const ASN1_PRIMITIVE_FUNCS *pf = it->funcs;
325 return pf->prim_new(pval, it);
328 if (it->itype == ASN1_ITYPE_MSTRING)
331 utype = it->utype;
338 *(ASN1_BOOLEAN *)pval = it->size;
356 if (it->itype == ASN1_ITYPE_MSTRING && str)
366 static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
369 if (it && it->funcs) {
370 const ASN1_PRIMITIVE_FUNCS *pf = it->funcs;
372 pf->prim_clear(pval, it);
377 if (!it || (it->itype == ASN1_ITYPE_MSTRING))
380 utype = it->utype;
382 *(ASN1_BOOLEAN *)pval = it->size;