ASN.1 context specific tag (decoding)
Karel Miko
10 years ago
485 | 485 |
/** Flag used to indicate optional items in ASN.1 sequences */
|
486 | 486 |
int optional;
|
487 | 487 |
/** Flag used to indicate context specific tags on ASN.1 sequence items */
|
488 | |
int tag;
|
|
488 |
unsigned char tag;
|
489 | 489 |
/** prev/next entry in the list */
|
490 | 490 |
struct ltc_asn1_list_ *prev, *next, *child, *parent;
|
491 | 491 |
} ltc_asn1_list;
|
90 | 90 |
|
91 | 91 |
if (type == LTC_ASN1_EOL) {
|
92 | 92 |
break;
|
|
93 |
}
|
|
94 |
|
|
95 |
/* handle context specific tags - just skip the tag + len bytes */
|
|
96 |
z = 0;
|
|
97 |
if (list[i].tag > 0 && list[i].tag == in[x + z++]) {
|
|
98 |
if (in[x+z] & 0x80) {
|
|
99 |
y = in[x + z++] & 0x7F;
|
|
100 |
if (y == 0 || y > 2) { return CRYPT_INVALID_PACKET; }
|
|
101 |
z += y;
|
|
102 |
} else {
|
|
103 |
z++;
|
|
104 |
}
|
|
105 |
x += z;
|
|
106 |
inlen -= z;
|
93 | 107 |
}
|
94 | 108 |
|
95 | 109 |
switch (type) {
|