summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2006-01-19 17:17:33 +0000
committerDr. Stephen Henson <steve@openssl.org>2006-01-19 17:17:33 +0000
commit02df47d3497c49f28c5307b26d812ca7e02d0d7a (patch)
tree67d9c72d60d9bfa44fa90403cf832af4b5790a7e /crypto
parent41c39e33667024efa19a19b0188da5f57045df43 (diff)
Fixes for BOOL handling: produce errors for invalid string for mini-compiler,
correctly encode FALSE for BOOL in ASN1_TYPE.
Diffstat (limited to 'crypto')
-rw-r--r--crypto/asn1/asn1_gen.c2
-rw-r--r--crypto/asn1/tasn_enc.c13
2 files changed, 10 insertions, 5 deletions
diff --git a/crypto/asn1/asn1_gen.c b/crypto/asn1/asn1_gen.c
index e6e04a1cd7..26c832781e 100644
--- a/crypto/asn1/asn1_gen.c
+++ b/crypto/asn1/asn1_gen.c
@@ -658,6 +658,8 @@ static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype)
ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_NOT_ASCII_FORMAT);
goto bad_form;
}
+ vtmp.name = NULL;
+ vtmp.section = NULL;
vtmp.value = (char *)str;
if (!X509V3_get_value_bool(&vtmp, &atmp->value.boolean))
{
diff --git a/crypto/asn1/tasn_enc.c b/crypto/asn1/tasn_enc.c
index 0f950db244..25c94aa1d9 100644
--- a/crypto/asn1/tasn_enc.c
+++ b/crypto/asn1/tasn_enc.c
@@ -618,11 +618,14 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype,
tbool = (ASN1_BOOLEAN *)pval;
if (*tbool == -1)
return -1;
- /* Default handling if value == size field then omit */
- if (*tbool && (it->size > 0))
- return -1;
- if (!*tbool && !it->size)
- return -1;
+ if (it->utype != V_ASN1_ANY)
+ {
+ /* Default handling if value == size field then omit */
+ if (*tbool && (it->size > 0))
+ return -1;
+ if (!*tbool && !it->size)
+ return -1;
+ }
c = (unsigned char)*tbool;
cont = &c;
len = 1;