Go to the source code of this file.
Data Structures | |
| struct | asn1_cursor |
| A DER-encoded ASN.1 object cursor. More... | |
Defines | |
| #define | ASN1_INTEGER 0x02 |
| #define | ASN1_BIT_STRING 0x03 |
| #define | ASN1_OCTET_STRING 0x04 |
| #define | ASN1_NULL 0x05 |
| #define | ASN1_OID 0x06 |
| #define | ASN1_SEQUENCE 0x30 |
| #define | ASN1_IP_ADDRESS 0x40 |
| #define | ASN1_EXPLICIT_TAG 0xa0 |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| int | asn1_enter (struct asn1_cursor *cursor, unsigned int type) |
| Enter ASN.1 object. | |
| int | asn1_skip (struct asn1_cursor *cursor, unsigned int type) |
| Skip ASN.1 object. | |
Definition in file asn1.h.
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| int asn1_enter | ( | struct asn1_cursor * | cursor, | |
| unsigned int | type | |||
| ) |
Enter ASN.1 object.
| cursor | ASN.1 object cursor | |
| type | Expected type |
| rc | Return status code |
Definition at line 122 of file asn1.c.
References asn1_start(), DBGC, and asn1_cursor::len.
Referenced by x509_public_key(), and x509_rsa_public_key().
00122 { 00123 int len; 00124 00125 len = asn1_start ( cursor, type ); 00126 if ( len < 0 ) 00127 return len; 00128 00129 cursor->len = len; 00130 DBGC ( cursor, "ASN1 %p entered object type %02x (len %x)\n", 00131 cursor, type, len ); 00132 00133 return 0; 00134 }
| int asn1_skip | ( | struct asn1_cursor * | cursor, | |
| unsigned int | type | |||
| ) |
Skip ASN.1 object.
| cursor | ASN.1 object cursor | |
| type | Expected type |
| rc | Return status code |
Definition at line 147 of file asn1.c.
References asn1_start(), asn1_cursor::data, DBGC, ENOENT, asn1_cursor::len, and NULL.
Referenced by x509_public_key(), and x509_rsa_public_key().
00147 { 00148 int len; 00149 00150 len = asn1_start ( cursor, type ); 00151 if ( len < 0 ) 00152 return len; 00153 00154 cursor->data += len; 00155 cursor->len -= len; 00156 DBGC ( cursor, "ASN1 %p skipped object type %02x (len %x)\n", 00157 cursor, type, len ); 00158 00159 if ( ! cursor->len ) { 00160 DBGC ( cursor, "ASN1 %p reached end of object\n", cursor ); 00161 cursor->data = NULL; 00162 return -ENOENT; 00163 } 00164 00165 return 0; 00166 }
1.5.7.1