comparison libtomcrypt/src/pk/asn1/der/choice/der_decode_choice.c @ 382:0cbe8f6dbf9e

propagate from branch 'au.asn.ucc.matt.ltc.dropbear' (head 2af22fb4e878750b88f80f90d439b316d229796f) to branch 'au.asn.ucc.matt.dropbear' (head 02c413252c90e9de8e03d91e9939dde3029f5c0a)
author Matt Johnston <matt@ucc.asn.au>
date Thu, 11 Jan 2007 02:41:05 +0000
parents 1b9e69c058d2
children f849a5ca2efc
comparison
equal deleted inserted replaced
379:b66a00272a90 382:0cbe8f6dbf9e
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 12
13 /** 13 /**
14 @file der_decode_choice.c 14 @file der_decode_choice.c
94 break; 94 break;
95 95
96 case LTC_ASN1_NULL: 96 case LTC_ASN1_NULL:
97 if (*inlen == 2 && in[x] == 0x05 && in[x+1] == 0x00) { 97 if (*inlen == 2 && in[x] == 0x05 && in[x+1] == 0x00) {
98 *inlen = 2; 98 *inlen = 2;
99 list[x].used = 1;
99 return CRYPT_OK; 100 return CRYPT_OK;
100 } 101 }
101 break; 102 break;
102 103
103 case LTC_ASN1_OBJECT_IDENTIFIER: 104 case LTC_ASN1_OBJECT_IDENTIFIER:
132 return CRYPT_OK; 133 return CRYPT_OK;
133 } 134 }
134 } 135 }
135 break; 136 break;
136 137
138 case LTC_ASN1_UTF8_STRING:
139 if (der_decode_utf8_string(in, *inlen, data, &size) == CRYPT_OK) {
140 if (der_length_utf8_string(data, size, &z) == CRYPT_OK) {
141 list[x].used = 1;
142 list[x].size = size;
143 *inlen = z;
144 return CRYPT_OK;
145 }
146 }
147 break;
148
137 case LTC_ASN1_UTCTIME: 149 case LTC_ASN1_UTCTIME:
138 z = *inlen; 150 z = *inlen;
139 if (der_decode_utctime(in, &z, data) == CRYPT_OK) { 151 if (der_decode_utctime(in, &z, data) == CRYPT_OK) {
140 list[x].used = 1; 152 list[x].used = 1;
141 *inlen = z; 153 *inlen = z;
142 return CRYPT_OK; 154 return CRYPT_OK;
143 } 155 }
144 break; 156 break;
145 157
158 case LTC_ASN1_SET:
159 case LTC_ASN1_SETOF:
146 case LTC_ASN1_SEQUENCE: 160 case LTC_ASN1_SEQUENCE:
147 if (der_decode_sequence(in, *inlen, data, size) == CRYPT_OK) { 161 if (der_decode_sequence(in, *inlen, data, size) == CRYPT_OK) {
148 if (der_length_sequence(data, size, &z) == CRYPT_OK) { 162 if (der_length_sequence(data, size, &z) == CRYPT_OK) {
149 list[x].used = 1; 163 list[x].used = 1;
150 *inlen = z; 164 *inlen = z;
162 } 176 }
163 177
164 #endif 178 #endif
165 179
166 /* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/choice/der_decode_choice.c,v $ */ 180 /* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/choice/der_decode_choice.c,v $ */
167 /* $Revision: 1.4 $ */ 181 /* $Revision: 1.8 $ */
168 /* $Date: 2005/06/19 11:25:01 $ */ 182 /* $Date: 2006/12/06 02:23:49 $ */