Mercurial > dropbear
comparison libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_flexi.c @ 1711:e9dba7abd939
Merge libtomcrypt v1.18.2
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 10 Jun 2020 23:16:13 +0800 |
parents | 6dba84798cd5 |
children |
comparison
equal
deleted
inserted
replaced
1710:1ff2a1034c52 | 1711:e9dba7abd939 |
---|---|
77 @param out [out] A pointer to the linked list | 77 @param out [out] A pointer to the linked list |
78 @return CRYPT_OK on success. | 78 @return CRYPT_OK on success. |
79 */ | 79 */ |
80 int der_decode_sequence_flexi(const unsigned char *in, unsigned long *inlen, ltc_asn1_list **out) | 80 int der_decode_sequence_flexi(const unsigned char *in, unsigned long *inlen, ltc_asn1_list **out) |
81 { | 81 { |
82 ltc_asn1_list *l; | 82 ltc_asn1_list *l, *t; |
83 unsigned long err, type, len, totlen, data_offset; | 83 unsigned long err, type, len, totlen, data_offset, len_len; |
84 void *realloc_tmp; | 84 void *realloc_tmp; |
85 | 85 |
86 LTC_ARGCHK(in != NULL); | 86 LTC_ARGCHK(in != NULL); |
87 LTC_ARGCHK(inlen != NULL); | 87 LTC_ARGCHK(inlen != NULL); |
88 LTC_ARGCHK(out != NULL); | 88 LTC_ARGCHK(out != NULL); |
403 | 403 |
404 /* the flexi decoder can also do nothing, so make sure a child has been allocated */ | 404 /* the flexi decoder can also do nothing, so make sure a child has been allocated */ |
405 if (l->child) { | 405 if (l->child) { |
406 /* link them up y0 */ | 406 /* link them up y0 */ |
407 l->child->parent = l; | 407 l->child->parent = l; |
408 } | |
409 | |
410 t = l; | |
411 len_len = 0; | |
412 while((t != NULL) && (t->child != NULL)) { | |
413 len_len++; | |
414 t = t->child; | |
415 } | |
416 if (len_len > LTC_DER_MAX_RECURSION) { | |
417 err = CRYPT_ERROR; | |
418 goto error; | |
408 } | 419 } |
409 | 420 |
410 break; | 421 break; |
411 | 422 |
412 case 0x80: /* Context-specific */ | 423 case 0x80: /* Context-specific */ |