comparison libtomcrypt/src/pk/asn1/der/sequence/der_length_sequence.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>
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 $ */