diff options
author | djm <> | 2010-10-01 22:59:01 +0000 |
---|---|---|
committer | djm <> | 2010-10-01 22:59:01 +0000 |
commit | fe047d8b632246cb2db3234a0a4f32e5c318857b (patch) | |
tree | 939b752540947d33507b3acc48d76a8bfb7c3dc3 /src/lib/libcrypto/asn1/tasn_dec.c | |
parent | 2ea67f4aa254b09ded62e6e14fc893bbe6381579 (diff) | |
download | openbsd-fe047d8b632246cb2db3234a0a4f32e5c318857b.tar.gz openbsd-fe047d8b632246cb2db3234a0a4f32e5c318857b.tar.bz2 openbsd-fe047d8b632246cb2db3234a0a4f32e5c318857b.zip |
resolve conflicts, fix local changes
Diffstat (limited to 'src/lib/libcrypto/asn1/tasn_dec.c')
-rw-r--r-- | src/lib/libcrypto/asn1/tasn_dec.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c index 48bc1c0d4d..3bee439968 100644 --- a/src/lib/libcrypto/asn1/tasn_dec.c +++ b/src/lib/libcrypto/asn1/tasn_dec.c | |||
@@ -114,6 +114,8 @@ unsigned long ASN1_tag2bit(int tag) | |||
114 | /* Macro to initialize and invalidate the cache */ | 114 | /* Macro to initialize and invalidate the cache */ |
115 | 115 | ||
116 | #define asn1_tlc_clear(c) if (c) (c)->valid = 0 | 116 | #define asn1_tlc_clear(c) if (c) (c)->valid = 0 |
117 | /* Version to avoid compiler warning about 'c' always non-NULL */ | ||
118 | #define asn1_tlc_clear_nc(c) (c)->valid = 0 | ||
117 | 119 | ||
118 | /* Decode an ASN1 item, this currently behaves just | 120 | /* Decode an ASN1 item, this currently behaves just |
119 | * like a standard 'd2i' function. 'in' points to | 121 | * like a standard 'd2i' function. 'in' points to |
@@ -130,7 +132,7 @@ ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, | |||
130 | ASN1_VALUE *ptmpval = NULL; | 132 | ASN1_VALUE *ptmpval = NULL; |
131 | if (!pval) | 133 | if (!pval) |
132 | pval = &ptmpval; | 134 | pval = &ptmpval; |
133 | c.valid = 0; | 135 | asn1_tlc_clear_nc(&c); |
134 | if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) | 136 | if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) |
135 | return *pval; | 137 | return *pval; |
136 | return NULL; | 138 | return NULL; |
@@ -140,7 +142,7 @@ int ASN1_template_d2i(ASN1_VALUE **pval, | |||
140 | const unsigned char **in, long len, const ASN1_TEMPLATE *tt) | 142 | const unsigned char **in, long len, const ASN1_TEMPLATE *tt) |
141 | { | 143 | { |
142 | ASN1_TLC c; | 144 | ASN1_TLC c; |
143 | c.valid = 0; | 145 | asn1_tlc_clear_nc(&c); |
144 | return asn1_template_ex_d2i(pval, in, len, tt, 0, &c); | 146 | return asn1_template_ex_d2i(pval, in, len, tt, 0, &c); |
145 | } | 147 | } |
146 | 148 | ||
@@ -306,7 +308,7 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, | |||
306 | 308 | ||
307 | 309 | ||
308 | case ASN1_ITYPE_CHOICE: | 310 | case ASN1_ITYPE_CHOICE: |
309 | if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it)) | 311 | if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL)) |
310 | goto auxerr; | 312 | goto auxerr; |
311 | 313 | ||
312 | /* Allocate structure */ | 314 | /* Allocate structure */ |
@@ -356,7 +358,7 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, | |||
356 | 358 | ||
357 | asn1_set_choice_selector(pval, i, it); | 359 | asn1_set_choice_selector(pval, i, it); |
358 | *in = p; | 360 | *in = p; |
359 | if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it)) | 361 | if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL)) |
360 | goto auxerr; | 362 | goto auxerr; |
361 | return 1; | 363 | return 1; |
362 | 364 | ||
@@ -403,7 +405,7 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, | |||
403 | goto err; | 405 | goto err; |
404 | } | 406 | } |
405 | 407 | ||
406 | if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it)) | 408 | if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL)) |
407 | goto auxerr; | 409 | goto auxerr; |
408 | 410 | ||
409 | /* Get each field entry */ | 411 | /* Get each field entry */ |
@@ -505,7 +507,7 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, | |||
505 | if (!asn1_enc_save(pval, *in, p - *in, it)) | 507 | if (!asn1_enc_save(pval, *in, p - *in, it)) |
506 | goto auxerr; | 508 | goto auxerr; |
507 | *in = p; | 509 | *in = p; |
508 | if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it)) | 510 | if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL)) |
509 | goto auxerr; | 511 | goto auxerr; |
510 | return 1; | 512 | return 1; |
511 | 513 | ||
@@ -665,11 +667,12 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val, | |||
665 | else | 667 | else |
666 | { | 668 | { |
667 | /* We've got a valid STACK: free up any items present */ | 669 | /* We've got a valid STACK: free up any items present */ |
668 | STACK *sktmp = (STACK *)*val; | 670 | STACK_OF(ASN1_VALUE) *sktmp |
671 | = (STACK_OF(ASN1_VALUE) *)*val; | ||
669 | ASN1_VALUE *vtmp; | 672 | ASN1_VALUE *vtmp; |
670 | while(sk_num(sktmp) > 0) | 673 | while(sk_ASN1_VALUE_num(sktmp) > 0) |
671 | { | 674 | { |
672 | vtmp = (ASN1_VALUE *)sk_pop(sktmp); | 675 | vtmp = sk_ASN1_VALUE_pop(sktmp); |
673 | ASN1_item_ex_free(&vtmp, | 676 | ASN1_item_ex_free(&vtmp, |
674 | ASN1_ITEM_ptr(tt->item)); | 677 | ASN1_ITEM_ptr(tt->item)); |
675 | } | 678 | } |
@@ -710,7 +713,8 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val, | |||
710 | goto err; | 713 | goto err; |
711 | } | 714 | } |
712 | len -= p - q; | 715 | len -= p - q; |
713 | if (!sk_push((STACK *)*val, (char *)skfield)) | 716 | if (!sk_ASN1_VALUE_push((STACK_OF(ASN1_VALUE) *)*val, |
717 | skfield)) | ||
714 | { | 718 | { |
715 | ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, | 719 | ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, |
716 | ERR_R_MALLOC_FAILURE); | 720 | ERR_R_MALLOC_FAILURE); |