8
9
* require a specific license from the United States Government.
9
10
* It is the responsibility of any person or organization contemplating
10
11
* export to obtain such a license before exporting.
12
13
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
13
14
* distribute this software and its documentation for any purpose and
14
15
* without fee is hereby granted, provided that the above copyright
32
33
asn1_error_code retval;
34
35
if (buf == NULL || buf->base == NULL ||
35
buf->bound - buf->next + 1 <= 0) {
36
t->tagnum = ASN1_TAGNUM_CEILING; /* emphatically not an EOC tag */
37
t->asn1class = UNIVERSAL;
38
t->construction = PRIMITIVE;
36
buf->bound - buf->next + 1 <= 0) {
37
t->tagnum = ASN1_TAGNUM_CEILING; /* emphatically not an EOC tag */
38
t->asn1class = UNIVERSAL;
39
t->construction = PRIMITIVE;
44
/* asn1_get_id(buf, t) */
45
/* asn1_get_id(buf, t) */
48
49
#define ASN1_CLASS_MASK 0xC0
49
50
#define ASN1_CONSTRUCTION_MASK 0x20
50
51
#define ASN1_TAG_NUMBER_MASK 0x1F
52
retval = asn1buf_remove_octet(buf,&o);
53
retval = asn1buf_remove_octet(buf,&o);
56
t->asn1class = (asn1_class)(o&ASN1_CLASS_MASK);
57
t->construction = (asn1_construction)(o&ASN1_CONSTRUCTION_MASK);
58
if ((o&ASN1_TAG_NUMBER_MASK) != ASN1_TAG_NUMBER_MASK){
59
/* low-tag-number form */
60
t->tagnum = (asn1_tagnum)(o&ASN1_TAG_NUMBER_MASK);
62
/* high-tag-number form */
64
retval = asn1buf_remove_octet(buf,&o);
65
if (retval) return retval;
66
tn = (tn<<7) + (asn1_tagnum)(o&0x7F);
57
t->asn1class = (asn1_class)(o&ASN1_CLASS_MASK);
58
t->construction = (asn1_construction)(o&ASN1_CONSTRUCTION_MASK);
59
if ((o&ASN1_TAG_NUMBER_MASK) != ASN1_TAG_NUMBER_MASK) {
60
/* low-tag-number form */
61
t->tagnum = (asn1_tagnum)(o&ASN1_TAG_NUMBER_MASK);
63
/* high-tag-number form */
65
retval = asn1buf_remove_octet(buf,&o);
66
if (retval) return retval;
67
tn = (tn<<7) + (asn1_tagnum)(o&0x7F);
73
/* asn1_get_length(buf, t) */
77
retval = asn1buf_remove_octet(buf,&o);
78
if (retval) return retval;
80
t->length = (int)(o&0x7F);
85
for (num = (int)(o&0x7F); num>0; num--) {
86
retval = asn1buf_remove_octet(buf,&o);
87
if(retval) return retval;
88
len = (len<<8) + (int)o;
74
/* asn1_get_length(buf, t) */
78
retval = asn1buf_remove_octet(buf,&o);
79
if (retval) return retval;
81
t->length = (int)(o&0x7F);
86
for (num = (int)(o&0x7F); num>0; num--) {
87
retval = asn1buf_remove_octet(buf,&o);
88
if (retval) return retval;
89
len = (len<<8) + (int)o;
97
98
if (t->indef && t->construction != CONSTRUCTED)
98
return ASN1_MISMATCH_INDEF;
99
return ASN1_MISMATCH_INDEF;