comparison src/pk/asn1/der/choice/der_decode_choice.c @ 380:d5faf4814ddb libtomcrypt-orig libtomcrypt-1.16

Update to LibTomCrypt 1.16
author Matt Johnston <matt@ucc.asn.au>
date Thu, 11 Jan 2007 02:22:00 +0000
parents 59400faa4b44
children
comparison
equal deleted inserted replaced
280:59400faa4b44 380:d5faf4814ddb
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 $ */