summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/tasn_new.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/tasn_new.c')
-rw-r--r--src/lib/libcrypto/asn1/tasn_new.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/lib/libcrypto/asn1/tasn_new.c b/src/lib/libcrypto/asn1/tasn_new.c
index 5c6a2ebd4d..0d9e78cc7c 100644
--- a/src/lib/libcrypto/asn1/tasn_new.c
+++ b/src/lib/libcrypto/asn1/tasn_new.c
@@ -68,7 +68,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
68 int combine); 68 int combine);
69static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); 69static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
70static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); 70static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
71void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); 71static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
72 72
73ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it) 73ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it)
74 { 74 {
@@ -146,7 +146,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
146 case ASN1_ITYPE_CHOICE: 146 case ASN1_ITYPE_CHOICE:
147 if (asn1_cb) 147 if (asn1_cb)
148 { 148 {
149 i = asn1_cb(ASN1_OP_NEW_PRE, pval, it); 149 i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
150 if (!i) 150 if (!i)
151 goto auxerr; 151 goto auxerr;
152 if (i==2) 152 if (i==2)
@@ -166,7 +166,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
166 memset(*pval, 0, it->size); 166 memset(*pval, 0, it->size);
167 } 167 }
168 asn1_set_choice_selector(pval, -1, it); 168 asn1_set_choice_selector(pval, -1, it);
169 if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it)) 169 if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
170 goto auxerr; 170 goto auxerr;
171 break; 171 break;
172 172
@@ -174,7 +174,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
174 case ASN1_ITYPE_SEQUENCE: 174 case ASN1_ITYPE_SEQUENCE:
175 if (asn1_cb) 175 if (asn1_cb)
176 { 176 {
177 i = asn1_cb(ASN1_OP_NEW_PRE, pval, it); 177 i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
178 if (!i) 178 if (!i)
179 goto auxerr; 179 goto auxerr;
180 if (i==2) 180 if (i==2)
@@ -201,7 +201,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
201 if (!ASN1_template_new(pseqval, tt)) 201 if (!ASN1_template_new(pseqval, tt))
202 goto memerr; 202 goto memerr;
203 } 203 }
204 if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it)) 204 if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
205 goto auxerr; 205 goto auxerr;
206 break; 206 break;
207 } 207 }
@@ -325,6 +325,7 @@ static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
325int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) 325int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
326 { 326 {
327 ASN1_TYPE *typ; 327 ASN1_TYPE *typ;
328 ASN1_STRING *str;
328 int utype; 329 int utype;
329 330
330 if (it && it->funcs) 331 if (it && it->funcs)
@@ -345,10 +346,7 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
345 return 1; 346 return 1;
346 347
347 case V_ASN1_BOOLEAN: 348 case V_ASN1_BOOLEAN:
348 if (it) 349 *(ASN1_BOOLEAN *)pval = it->size;
349 *(ASN1_BOOLEAN *)pval = it->size;
350 else
351 *(ASN1_BOOLEAN *)pval = -1;
352 return 1; 350 return 1;
353 351
354 case V_ASN1_NULL: 352 case V_ASN1_NULL:
@@ -365,7 +363,10 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
365 break; 363 break;
366 364
367 default: 365 default:
368 *pval = (ASN1_VALUE *)ASN1_STRING_type_new(utype); 366 str = ASN1_STRING_type_new(utype);
367 if (it->itype == ASN1_ITYPE_MSTRING && str)
368 str->flags |= ASN1_STRING_FLAG_MSTRING;
369 *pval = (ASN1_VALUE *)str;
369 break; 370 break;
370 } 371 }
371 if (*pval) 372 if (*pval)
@@ -373,7 +374,7 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
373 return 0; 374 return 0;
374 } 375 }
375 376
376void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it) 377static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
377 { 378 {
378 int utype; 379 int utype;
379 if (it && it->funcs) 380 if (it && it->funcs)