diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/tasn_enc.c')
-rw-r--r-- | src/lib/libcrypto/asn1/tasn_enc.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/lib/libcrypto/asn1/tasn_enc.c b/src/lib/libcrypto/asn1/tasn_enc.c index d103c4d096..d0a569fd8a 100644 --- a/src/lib/libcrypto/asn1/tasn_enc.c +++ b/src/lib/libcrypto/asn1/tasn_enc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tasn_enc.c,v 1.22 2019/04/01 15:48:04 jsing Exp $ */ | 1 | /* $OpenBSD: tasn_enc.c,v 1.22.6.1 2020/12/08 15:10:03 tb 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 | */ |
@@ -61,6 +61,7 @@ | |||
61 | 61 | ||
62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
64 | #include <openssl/err.h> | ||
64 | #include <openssl/objects.h> | 65 | #include <openssl/objects.h> |
65 | 66 | ||
66 | static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out, | 67 | static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out, |
@@ -152,9 +153,27 @@ ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, | |||
152 | break; | 153 | break; |
153 | 154 | ||
154 | case ASN1_ITYPE_MSTRING: | 155 | case ASN1_ITYPE_MSTRING: |
156 | /* | ||
157 | * It never makes sense for multi-strings to have implicit | ||
158 | * tagging, so if tag != -1, then this looks like an error in | ||
159 | * the template. | ||
160 | */ | ||
161 | if (tag != -1) { | ||
162 | ASN1error(ASN1_R_BAD_TEMPLATE); | ||
163 | return 0; | ||
164 | } | ||
155 | return asn1_i2d_ex_primitive(pval, out, it, -1, aclass); | 165 | return asn1_i2d_ex_primitive(pval, out, it, -1, aclass); |
156 | 166 | ||
157 | case ASN1_ITYPE_CHOICE: | 167 | case ASN1_ITYPE_CHOICE: |
168 | /* | ||
169 | * It never makes sense for CHOICE types to have implicit | ||
170 | * tagging, so if tag != -1, then this looks like an error in | ||
171 | * the template. | ||
172 | */ | ||
173 | if (tag != -1) { | ||
174 | ASN1error(ASN1_R_BAD_TEMPLATE); | ||
175 | return 0; | ||
176 | } | ||
158 | if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it, NULL)) | 177 | if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it, NULL)) |
159 | return 0; | 178 | return 0; |
160 | i = asn1_get_choice_selector(pval, it); | 179 | i = asn1_get_choice_selector(pval, it); |