aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/asn1
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2001-04-21 12:06:01 +0000
committerDr. Stephen Henson <steve@openssl.org>2001-04-21 12:06:01 +0000
commitc962479bdf4379bcd21733e55bb8d3e6cabca055 (patch)
tree6e01ea534b74649f4f52382d442c0024f90f7b33 /crypto/asn1
parentb31ccc362cf1bd27b1f292f67c799cb5296ca73e (diff)
downloadopenssl-c962479bdf4379bcd21733e55bb8d3e6cabca055.tar.gz
Fix ASN1 bug when decoding OTHER type.
Various S/MIME DSA related fixes.
Diffstat (limited to 'crypto/asn1')
-rw-r--r--crypto/asn1/tasn_dec.c9
-rw-r--r--crypto/asn1/x_pubkey.c2
2 files changed, 8 insertions, 3 deletions
diff --git a/crypto/asn1/tasn_dec.c b/crypto/asn1/tasn_dec.c
index 7237f7e93c..bd0a7d50a2 100644
--- a/crypto/asn1/tasn_dec.c
+++ b/crypto/asn1/tasn_dec.c
@@ -611,8 +611,13 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, unsigned char **in, long inl
} else if(ret == -1) return -1;
/* SEQUENCE, SET and "OTHER" are left in encoded form */
if((utype == V_ASN1_SEQUENCE) || (utype == V_ASN1_SET) || (utype == V_ASN1_OTHER)) {
+ /* Clear context cache for type OTHER because the auto clear when
+ * we have a exact match wont work
+ */
+ if(utype == V_ASN1_OTHER) {
+ asn1_tlc_clear(ctx);
/* SEQUENCE and SET must be constructed */
- if((utype != V_ASN1_OTHER) && !cst) {
+ } else if(!cst) {
ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_TYPE_NOT_CONSTRUCTED);
return 0;
}
@@ -899,7 +904,7 @@ static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, char *i
}
}
}
-
+
if(i & 0x80) {
ASN1err(ASN1_F_ASN1_CHECK_TLEN, ASN1_R_BAD_OBJECT_HEADER);
asn1_tlc_clear(ctx);
diff --git a/crypto/asn1/x_pubkey.c b/crypto/asn1/x_pubkey.c
index c4a849aff1..9f28daf781 100644
--- a/crypto/asn1/x_pubkey.c
+++ b/crypto/asn1/x_pubkey.c
@@ -198,7 +198,7 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
a=key->algor;
if (ret->type == EVP_PKEY_DSA)
{
- if (a->parameter->type == V_ASN1_SEQUENCE)
+ if (a->parameter && (a->parameter->type == V_ASN1_SEQUENCE))
{
ret->pkey.dsa->write_params=0;
cp=p=a->parameter->value.sequence->data;