summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/tasn_dec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/tasn_dec.c')
-rw-r--r--src/lib/libcrypto/asn1/tasn_dec.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c
index 22d8006d0a..457f526e71 100644
--- a/src/lib/libcrypto/asn1/tasn_dec.c
+++ b/src/lib/libcrypto/asn1/tasn_dec.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tasn_dec.c,v 1.79 2022/09/03 18:45:51 jsing Exp $ */ 1/* $OpenBSD: tasn_dec.c,v 1.80 2022/09/03 18:52:18 jsing Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -467,13 +467,14 @@ asn1_d2i_primitive_content(ASN1_VALUE **pval, CBS *cbs, CBS *cbs_object,
467 CBS_dup(cbs, &cbs_initial); 467 CBS_dup(cbs, &cbs_initial);
468 CBS_init(&cbs_content, NULL, 0); 468 CBS_init(&cbs_content, NULL, 0);
469 469
470 /* XXX - check primitive vs constructed based on utype. */ 470 if (asn1_must_be_constructed(utype) && !constructed) {
471
472 /* SEQUENCE and SET must be constructed. */
473 if ((utype == V_ASN1_SEQUENCE || utype == V_ASN1_SET) && !constructed) {
474 ASN1error(ASN1_R_TYPE_NOT_CONSTRUCTED); 471 ASN1error(ASN1_R_TYPE_NOT_CONSTRUCTED);
475 goto err; 472 goto err;
476 } 473 }
474 if (asn1_must_be_primitive(utype) && constructed) {
475 ASN1error(ASN1_R_TYPE_NOT_PRIMITIVE);
476 goto err;
477 }
477 478
478 /* SEQUENCE, SET and "OTHER" are left in encoded form. */ 479 /* SEQUENCE, SET and "OTHER" are left in encoded form. */
479 if (utype == V_ASN1_SEQUENCE || utype == V_ASN1_SET || 480 if (utype == V_ASN1_SEQUENCE || utype == V_ASN1_SET ||