Mercurial > dropbear
comparison libtomcrypt/src/pk/asn1/der/sequence/der_sequence_shrink.c @ 1471:6dba84798cd5
Update to libtomcrypt 1.18.1, merged with Dropbear changes
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 09 Feb 2018 21:44:05 +0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1470:8bba51a55704 | 1471:6dba84798cd5 |
---|---|
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis | |
2 * | |
3 * LibTomCrypt is a library that provides various cryptographic | |
4 * algorithms in a highly modular and flexible manner. | |
5 * | |
6 * The library is free for all purposes without any express | |
7 * guarantee it works. | |
8 */ | |
9 #include "tomcrypt.h" | |
10 | |
11 /** | |
12 @file der_sequence_shrink.c | |
13 Free memory allocated for CONSTRUCTED, SET or SEQUENCE elements by der_decode_sequence_flexi(), Steffen Jaeckel | |
14 */ | |
15 | |
16 #ifdef LTC_DER | |
17 | |
18 /** | |
19 Free memory allocated for CONSTRUCTED, | |
20 SET or SEQUENCE elements by der_decode_sequence_flexi() | |
21 @param in The list to shrink | |
22 */ | |
23 void der_sequence_shrink(ltc_asn1_list *in) | |
24 { | |
25 if (!in) return; | |
26 | |
27 /* now walk the list and free stuff */ | |
28 while (in != NULL) { | |
29 /* is there a child? */ | |
30 if (in->child) { | |
31 der_sequence_shrink(in->child); | |
32 } | |
33 | |
34 switch (in->type) { | |
35 case LTC_ASN1_CONSTRUCTED: | |
36 case LTC_ASN1_SET: | |
37 case LTC_ASN1_SEQUENCE : if (in->data != NULL) { XFREE(in->data); in->data = NULL; } break; | |
38 default: break; | |
39 } | |
40 | |
41 /* move to next and free current */ | |
42 in = in->next; | |
43 } | |
44 } | |
45 | |
46 #endif | |
47 | |
48 /* ref: $Format:%D$ */ | |
49 /* git commit: $Format:%H$ */ | |
50 /* commit time: $Format:%ai$ */ |