comparison libtomcrypt/src/pk/asn1/der/sequence/der_length_sequence.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 #include <stdarg.h>
13
14 12
15 /** 13 /**
16 @file der_length_sequence.c 14 @file der_length_sequence.c
17 ASN.1 DER, length a SEQUENCE, Tom St Denis 15 ASN.1 DER, length a SEQUENCE, Tom St Denis
18 */ 16 */
46 if (type == LTC_ASN1_EOL) { 44 if (type == LTC_ASN1_EOL) {
47 break; 45 break;
48 } 46 }
49 47
50 switch (type) { 48 switch (type) {
49 case LTC_ASN1_BOOLEAN:
50 if ((err = der_length_boolean(&x)) != CRYPT_OK) {
51 goto LBL_ERR;
52 }
53 y += x;
54 break;
55
51 case LTC_ASN1_INTEGER: 56 case LTC_ASN1_INTEGER:
52 if ((err = der_length_integer(data, &x)) != CRYPT_OK) { 57 if ((err = der_length_integer(data, &x)) != CRYPT_OK) {
53 goto LBL_ERR; 58 goto LBL_ERR;
54 } 59 }
55 y += x; 60 y += x;
99 goto LBL_ERR; 104 goto LBL_ERR;
100 } 105 }
101 y += x; 106 y += x;
102 break; 107 break;
103 108
109 case LTC_ASN1_UTCTIME:
110 if ((err = der_length_utctime(data, &x)) != CRYPT_OK) {
111 goto LBL_ERR;
112 }
113 y += x;
114 break;
115
116 case LTC_ASN1_UTF8_STRING:
117 if ((err = der_length_utf8_string(data, size, &x)) != CRYPT_OK) {
118 goto LBL_ERR;
119 }
120 y += x;
121 break;
122
123 case LTC_ASN1_SET:
124 case LTC_ASN1_SETOF:
104 case LTC_ASN1_SEQUENCE: 125 case LTC_ASN1_SEQUENCE:
105 if ((err = der_length_sequence(data, size, &x)) != CRYPT_OK) { 126 if ((err = der_length_sequence(data, size, &x)) != CRYPT_OK) {
106 goto LBL_ERR; 127 goto LBL_ERR;
107 } 128 }
108 y += x; 129 y += x;
140 LBL_ERR: 161 LBL_ERR:
141 return err; 162 return err;
142 } 163 }
143 164
144 #endif 165 #endif
166
167 /* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/sequence/der_length_sequence.c,v $ */
168 /* $Revision: 1.13 $ */
169 /* $Date: 2006/11/26 02:25:18 $ */