diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2001-01-04 20:53:48 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2001-01-04 20:53:48 +0100 |
commit | a8312c0e24a73e70b25d9811de2106f50b32081b (patch) | |
tree | 9bcba6edf3346e4401ebedebacc1429c14a32e6a /crypto/asn1 | |
parent | Update OCSP API. (diff) | |
download | openssl-a8312c0e24a73e70b25d9811de2106f50b32081b.tar.xz openssl-a8312c0e24a73e70b25d9811de2106f50b32081b.zip |
Fix typo in OCSP nonce extension.
Set correct type in ASN1_STRING for
INTEGER and ENUMERATED types.
Make ASN1_INTEGER_get() and ASN1_ENUMERATED_get()
return -1 for invalid type rather than 0 (which is
often valid). -1 may also be valid but this is less
likely.
Load OCSP error strings in ERR_load_crypto_strings().
Diffstat (limited to 'crypto/asn1')
-rw-r--r-- | crypto/asn1/a_enum.c | 4 | ||||
-rw-r--r-- | crypto/asn1/a_int.c | 4 | ||||
-rw-r--r-- | crypto/asn1/tasn_dec.c | 6 |
3 files changed, 9 insertions, 5 deletions
diff --git a/crypto/asn1/a_enum.c b/crypto/asn1/a_enum.c index b507c5ee44..8a315fa371 100644 --- a/crypto/asn1/a_enum.c +++ b/crypto/asn1/a_enum.c @@ -114,7 +114,7 @@ long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a) if (i == V_ASN1_NEG_ENUMERATED) neg=1; else if (i != V_ASN1_ENUMERATED) - return(0); + return -1; if (a->length > sizeof(long)) { @@ -122,7 +122,7 @@ long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a) return(0xffffffffL); } if (a->data == NULL) - return(0); + return 0; for (i=0; i<a->length; i++) { diff --git a/crypto/asn1/a_int.c b/crypto/asn1/a_int.c index c18376be48..b0fc97ea27 100644 --- a/crypto/asn1/a_int.c +++ b/crypto/asn1/a_int.c @@ -360,7 +360,7 @@ long ASN1_INTEGER_get(ASN1_INTEGER *a) if (i == V_ASN1_NEG_INTEGER) neg=1; else if (i != V_ASN1_INTEGER) - return(0); + return -1; if (a->length > sizeof(long)) { @@ -368,7 +368,7 @@ long ASN1_INTEGER_get(ASN1_INTEGER *a) return(0xffffffffL); } if (a->data == NULL) - return(0); + return 0; for (i=0; i<a->length; i++) { diff --git a/crypto/asn1/tasn_dec.c b/crypto/asn1/tasn_dec.c index 930ee7025b..22e5b4ab52 100644 --- a/crypto/asn1/tasn_dec.c +++ b/crypto/asn1/tasn_dec.c @@ -657,6 +657,7 @@ int asn1_ex_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char ASN1_TYPE *typ = NULL; int ret = 0; const ASN1_PRIMITIVE_FUNCS *pf; + ASN1_INTEGER **tint; pf = it->funcs; if(pf && pf->prim_c2i) return pf->prim_c2i(pval, cont, len, utype, free_cont, it); /* If ANY type clear type and set pointer to internal value */ @@ -700,7 +701,10 @@ int asn1_ex_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char case V_ASN1_NEG_INTEGER: case V_ASN1_ENUMERATED: case V_ASN1_NEG_ENUMERATED: - if(!c2i_ASN1_INTEGER((ASN1_INTEGER **)pval, &cont, len)) goto err; + tint = (ASN1_INTEGER **)pval; + if(!c2i_ASN1_INTEGER(tint, &cont, len)) goto err; + /* Fixup type to match the expected form */ + (*tint)->type = utype | ((*tint)->type & V_ASN1_NEG); break; case V_ASN1_OCTET_STRING: |