Index: openssl/crypto/asn1/tasn_dec.c |
=================================================================== |
--- openssl/crypto/asn1/tasn_dec.c (revision 105093) |
+++ openssl/crypto/asn1/tasn_dec.c (working copy) |
@@ -114,6 +114,8 @@ |
/* Macro to initialize and invalidate the cache */ |
#define asn1_tlc_clear(c) if (c) (c)->valid = 0 |
+/* Version to avoid compiler warning about 'c' always non-NULL */ |
+#define asn1_tlc_clear_nc(c) (c)->valid = 0 |
/* Decode an ASN1 item, this currently behaves just |
* like a standard 'd2i' function. 'in' points to |
@@ -130,7 +132,7 @@ |
ASN1_VALUE *ptmpval = NULL; |
if (!pval) |
pval = &ptmpval; |
- c.valid = 0; |
+ asn1_tlc_clear_nc(&c); |
if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) |
return *pval; |
return NULL; |
@@ -140,7 +142,7 @@ |
const unsigned char **in, long len, const ASN1_TEMPLATE *tt) |
{ |
ASN1_TLC c; |
- c.valid = 0; |
+ asn1_tlc_clear_nc(&c); |
return asn1_template_ex_d2i(pval, in, len, tt, 0, &c); |
} |
@@ -166,7 +168,7 @@ |
int i; |
int otag; |
int ret = 0; |
- ASN1_VALUE *pchval, **pchptr, *ptmpval; |
+ ASN1_VALUE **pchptr, *ptmpval; |
if (!pval) |
return 0; |
if (aux && aux->asn1_cb) |
@@ -306,7 +308,7 @@ |
case ASN1_ITYPE_CHOICE: |
- if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it)) |
+ if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL)) |
goto auxerr; |
/* Allocate structure */ |
@@ -317,7 +319,6 @@ |
goto err; |
} |
/* CHOICE type, try each possibility in turn */ |
- pchval = NULL; |
p = *in; |
for (i = 0, tt=it->templates; i < it->tcount; i++, tt++) |
{ |
@@ -356,7 +357,7 @@ |
asn1_set_choice_selector(pval, i, it); |
*in = p; |
- if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it)) |
+ if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL)) |
goto auxerr; |
return 1; |
@@ -403,7 +404,7 @@ |
goto err; |
} |
- if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it)) |
+ if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL)) |
goto auxerr; |
/* Get each field entry */ |
@@ -505,7 +506,7 @@ |
if (!asn1_enc_save(pval, *in, p - *in, it)) |
goto auxerr; |
*in = p; |
- if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it)) |
+ if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL)) |
goto auxerr; |
return 1; |
@@ -665,11 +666,12 @@ |
else |
{ |
/* We've got a valid STACK: free up any items present */ |
- STACK *sktmp = (STACK *)*val; |
+ STACK_OF(ASN1_VALUE) *sktmp |
+ = (STACK_OF(ASN1_VALUE) *)*val; |
ASN1_VALUE *vtmp; |
- while(sk_num(sktmp) > 0) |
+ while(sk_ASN1_VALUE_num(sktmp) > 0) |
{ |
- vtmp = (ASN1_VALUE *)sk_pop(sktmp); |
+ vtmp = sk_ASN1_VALUE_pop(sktmp); |
ASN1_item_ex_free(&vtmp, |
ASN1_ITEM_ptr(tt->item)); |
} |
@@ -710,7 +712,8 @@ |
goto err; |
} |
len -= p - q; |
- if (!sk_push((STACK *)*val, (char *)skfield)) |
+ if (!sk_ASN1_VALUE_push((STACK_OF(ASN1_VALUE) *)*val, |
+ skfield)) |
{ |
ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, |
ERR_R_MALLOC_FAILURE); |