Mercurial > dropbear
comparison libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_multi.c @ 478:d4f32c3443ac dbclient-netcat-alike
propagate from branch 'au.asn.ucc.matt.dropbear' (head f21045c791002d81fc6b8dde6537ea481e513eb2)
to branch 'au.asn.ucc.matt.dropbear.dbclient-netcat-alike' (head d1f69334581dc4c35f9ca16aa5355074c9dd315d)
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 14 Sep 2008 06:47:51 +0000 |
parents | 0cbe8f6dbf9e |
children | f849a5ca2efc |
comparison
equal
deleted
inserted
replaced
296:6b41e2cbf071 | 478:d4f32c3443ac |
---|---|
4 * algorithms in a highly modular and flexible manner. | 4 * algorithms in a highly modular and flexible manner. |
5 * | 5 * |
6 * The library is free for all purposes without any express | 6 * The library is free for all purposes without any express |
7 * guarantee it works. | 7 * guarantee it works. |
8 * | 8 * |
9 * Tom St Denis, [email protected], http://libtomcrypt.org | 9 * Tom St Denis, [email protected], http://libtomcrypt.com |
10 */ | 10 */ |
11 #include "tomcrypt.h" | 11 #include "tomcrypt.h" |
12 #include <stdarg.h> | 12 #include <stdarg.h> |
13 | 13 |
14 | 14 |
17 ASN.1 DER, decode a SEQUENCE, Tom St Denis | 17 ASN.1 DER, decode a SEQUENCE, Tom St Denis |
18 */ | 18 */ |
19 | 19 |
20 #ifdef LTC_DER | 20 #ifdef LTC_DER |
21 | 21 |
22 /** | |
23 Decode a SEQUENCE type using a VA list | |
24 @param in Input buffer | |
25 @param inlen Length of input in octets | |
26 @remark <...> is of the form <type, size, data> (int, unsigned long, void*) | |
27 @return CRYPT_OK on success | |
28 */ | |
22 int der_decode_sequence_multi(const unsigned char *in, unsigned long inlen, ...) | 29 int der_decode_sequence_multi(const unsigned char *in, unsigned long inlen, ...) |
23 { | 30 { |
24 int err, type; | 31 int err, type; |
25 unsigned long size, x; | 32 unsigned long size, x; |
26 void *data; | 33 void *data; |
40 if (type == LTC_ASN1_EOL) { | 47 if (type == LTC_ASN1_EOL) { |
41 break; | 48 break; |
42 } | 49 } |
43 | 50 |
44 switch (type) { | 51 switch (type) { |
52 case LTC_ASN1_BOOLEAN: | |
45 case LTC_ASN1_INTEGER: | 53 case LTC_ASN1_INTEGER: |
46 case LTC_ASN1_SHORT_INTEGER: | 54 case LTC_ASN1_SHORT_INTEGER: |
47 case LTC_ASN1_BIT_STRING: | 55 case LTC_ASN1_BIT_STRING: |
48 case LTC_ASN1_OCTET_STRING: | 56 case LTC_ASN1_OCTET_STRING: |
49 case LTC_ASN1_NULL: | 57 case LTC_ASN1_NULL: |
50 case LTC_ASN1_OBJECT_IDENTIFIER: | 58 case LTC_ASN1_OBJECT_IDENTIFIER: |
51 case LTC_ASN1_IA5_STRING: | 59 case LTC_ASN1_IA5_STRING: |
52 case LTC_ASN1_PRINTABLE_STRING: | 60 case LTC_ASN1_PRINTABLE_STRING: |
61 case LTC_ASN1_UTF8_STRING: | |
53 case LTC_ASN1_UTCTIME: | 62 case LTC_ASN1_UTCTIME: |
63 case LTC_ASN1_SET: | |
64 case LTC_ASN1_SETOF: | |
54 case LTC_ASN1_SEQUENCE: | 65 case LTC_ASN1_SEQUENCE: |
55 case LTC_ASN1_CHOICE: | 66 case LTC_ASN1_CHOICE: |
56 ++x; | 67 ++x; |
57 break; | 68 break; |
58 | 69 |
84 if (type == LTC_ASN1_EOL) { | 95 if (type == LTC_ASN1_EOL) { |
85 break; | 96 break; |
86 } | 97 } |
87 | 98 |
88 switch (type) { | 99 switch (type) { |
100 case LTC_ASN1_BOOLEAN: | |
89 case LTC_ASN1_INTEGER: | 101 case LTC_ASN1_INTEGER: |
90 case LTC_ASN1_SHORT_INTEGER: | 102 case LTC_ASN1_SHORT_INTEGER: |
91 case LTC_ASN1_BIT_STRING: | 103 case LTC_ASN1_BIT_STRING: |
92 case LTC_ASN1_OCTET_STRING: | 104 case LTC_ASN1_OCTET_STRING: |
93 case LTC_ASN1_NULL: | 105 case LTC_ASN1_NULL: |
94 case LTC_ASN1_OBJECT_IDENTIFIER: | 106 case LTC_ASN1_OBJECT_IDENTIFIER: |
95 case LTC_ASN1_IA5_STRING: | 107 case LTC_ASN1_IA5_STRING: |
96 case LTC_ASN1_PRINTABLE_STRING: | 108 case LTC_ASN1_PRINTABLE_STRING: |
109 case LTC_ASN1_UTF8_STRING: | |
97 case LTC_ASN1_UTCTIME: | 110 case LTC_ASN1_UTCTIME: |
98 case LTC_ASN1_SEQUENCE: | 111 case LTC_ASN1_SEQUENCE: |
112 case LTC_ASN1_SET: | |
113 case LTC_ASN1_SETOF: | |
99 case LTC_ASN1_CHOICE: | 114 case LTC_ASN1_CHOICE: |
100 list[x].type = type; | 115 list[x].type = type; |
101 list[x].size = size; | 116 list[x].size = size; |
102 list[x++].data = data; | 117 list[x++].data = data; |
103 break; | 118 break; |
118 | 133 |
119 #endif | 134 #endif |
120 | 135 |
121 | 136 |
122 /* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_multi.c,v $ */ | 137 /* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_multi.c,v $ */ |
123 /* $Revision: 1.7 $ */ | 138 /* $Revision: 1.12 $ */ |
124 /* $Date: 2005/06/18 19:20:23 $ */ | 139 /* $Date: 2006/11/26 02:25:18 $ */ |