Lines Matching refs:it
18 static int asn1_item_embed_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
21 static int asn1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
23 static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
27 static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
29 ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it)
32 if (ASN1_item_ex_new(&ret, it) > 0)
37 ASN1_VALUE *ASN1_item_new_ex(const ASN1_ITEM *it, OSSL_LIB_CTX *libctx,
41 if (asn1_item_embed_new(&ret, it, 0, libctx, propq) > 0)
49 int ossl_asn1_item_ex_new_intern(ASN1_VALUE **pval, const ASN1_ITEM *it,
52 return asn1_item_embed_new(pval, it, 0, libctx, propq);
55 int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
57 return asn1_item_embed_new(pval, it, 0, NULL, NULL);
60 int asn1_item_embed_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed,
65 const ASN1_AUX *aux = it->funcs;
74 switch (it->itype) {
77 ef = it->funcs;
80 if (!ef->asn1_ex_new_ex(pval, it, libctx, propq))
83 if (!ef->asn1_ex_new(pval, it))
90 if (it->templates) {
91 if (!asn1_template_new(pval, it->templates, libctx, propq))
93 } else if (!asn1_primitive_new(pval, it, embed))
98 if (!asn1_primitive_new(pval, it, embed))
104 i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
112 memset(*pval, 0, it->size);
114 *pval = OPENSSL_zalloc(it->size);
118 ossl_asn1_set_choice_selector(pval, -1, it);
119 if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
126 i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
134 memset(*pval, 0, it->size);
136 *pval = OPENSSL_zalloc(it->size);
141 if (ossl_asn1_do_lock(pval, 0, it) < 0) {
148 ossl_asn1_enc_init(pval, it);
149 for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
154 if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
161 ossl_asn1_item_embed_free(pval, it, embed);
167 ossl_asn1_item_embed_free(pval, it, embed);
174 static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
178 switch (it->itype) {
181 ef = it->funcs;
183 ef->asn1_ex_clear(pval, it);
189 if (it->templates)
190 asn1_template_clear(pval, it->templates);
192 asn1_primitive_clear(pval, it);
196 asn1_primitive_clear(pval, it);
210 const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item);
241 /* Otherwise pass it back to the item routine */
242 ret = asn1_item_embed_new(pval, it, embed, libctx, propq);
261 static int asn1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
268 if (!it)
271 if (it->funcs) {
272 const ASN1_PRIMITIVE_FUNCS *pf = it->funcs;
275 pf->prim_clear(pval, it);
279 return pf->prim_new(pval, it);
283 if (it->itype == ASN1_ITYPE_MSTRING)
286 utype = it->utype;
293 *(ASN1_BOOLEAN *)pval = it->size;
320 if (it->itype == ASN1_ITYPE_MSTRING && str)
329 static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
332 if (it && it->funcs) {
333 const ASN1_PRIMITIVE_FUNCS *pf = it->funcs;
335 pf->prim_clear(pval, it);
340 if (!it || (it->itype == ASN1_ITYPE_MSTRING))
343 utype = it->utype;
345 *(ASN1_BOOLEAN *)pval = it->size;