static unsigned char asn1_id_decode(struct asn1_ctx *ctx, unsigned int *cls, unsigned int *con, unsigned int *tag) { unsigned char ch; if (!asn1_octet_decode(ctx, &ch)) return 0; *cls = (ch & 0xC0) >> 6; *con = (ch & 0x20) >> 5; *tag = (ch & 0x1F); if (*tag == 0x1F) { if (!asn1_tag_decode(ctx, tag)) return 0; } return 1; }
/* * NAME: asn1_id_decode * SYNOPSIS: int asn1_id_decode * ( * ASN1_SCK *asn1, * guint *cls, * guint *con, * guint *tag * ) * DESCRIPTION: Decodes an identifier. * RETURNS: ASN1_ERR value (ASN1_ERR_NOERROR on success) */ int asn1_id_decode(ASN1_SCK *asn1, guint *cls, guint *con, guint *tag) { int ret; guchar ch; *tag = 0; ret = asn1_octet_decode (asn1, &ch); if (ret != ASN1_ERR_NOERROR) return ret; *cls = (ch & 0xC0) >> 6; *con = (ch & 0x20) >> 5; *tag = (ch & 0x1F); if (*tag == 0x1F) { ret = asn1_tag_decode (asn1, tag); if (ret != ASN1_ERR_NOERROR) return ret; } return ASN1_ERR_NOERROR; }