
/*
 * Automatically generated by asn1_compiler.  Do not edit
 *
 * ASN.1 parser for x509
 */
#include "asn1_ber_bytecode.h"
#include "x509.asn1.h"

// clang-format off

enum x509_actions {
	ACT_x509_attribute_value_continue = 0,
	ACT_x509_extension_OID = 1,
	ACT_x509_extension_continue = 2,
	ACT_x509_extension_critical = 3,
	ACT_x509_extract_attribute_name_segment = 4,
	ACT_x509_extract_key_data = 5,
	ACT_x509_note_algorithm_OID = 6,
	ACT_x509_note_attribute_type_OID = 7,
	ACT_x509_note_issuer = 8,
	ACT_x509_note_not_after = 9,
	ACT_x509_note_not_before = 10,
	ACT_x509_note_params = 11,
	ACT_x509_note_serial = 12,
	ACT_x509_note_sig_algo = 13,
	ACT_x509_note_signature = 14,
	ACT_x509_note_subject = 15,
	ACT_x509_note_tbs_certificate = 16,
	ACT_x509_process_extension = 17,
	ACT_x509_set_gen_time = 18,
	ACT_x509_set_uct_time = 19,
	ACT_x509_signature_algorithm = 20,
	ACT_x509_version = 21,
	NR__x509_actions = 22
};

static const asn1_action_t x509_action_table[NR__x509_actions] = {
	[   0] = x509_attribute_value_continue,
	[   1] = x509_extension_OID,
	[   2] = x509_extension_continue,
	[   3] = x509_extension_critical,
	[   4] = x509_extract_attribute_name_segment,
	[   5] = x509_extract_key_data,
	[   6] = x509_note_algorithm_OID,
	[   7] = x509_note_attribute_type_OID,
	[   8] = x509_note_issuer,
	[   9] = x509_note_not_after,
	[  10] = x509_note_not_before,
	[  11] = x509_note_params,
	[  12] = x509_note_serial,
	[  13] = x509_note_sig_algo,
	[  14] = x509_note_signature,
	[  15] = x509_note_subject,
	[  16] = x509_note_tbs_certificate,
	[  17] = x509_process_extension,
	[  18] = x509_set_gen_time,
	[  19] = x509_set_uct_time,
	[  20] = x509_signature_algorithm,
	[  21] = x509_version,
};

static const asn1_action_enc_t x509_action_table_enc[NR__x509_actions] = {
	[   0] = x509_attribute_value_continue_enc,
	[   1] = x509_extension_OID_enc,
	[   2] = x509_extension_continue_enc,
	[   3] = x509_extension_critical_enc,
	[   4] = x509_extract_attribute_name_segment_enc,
	[   5] = x509_extract_key_data_enc,
	[   6] = x509_note_algorithm_OID_enc,
	[   7] = x509_note_attribute_type_OID_enc,
	[   8] = x509_note_issuer_enc,
	[   9] = x509_note_not_after_enc,
	[  10] = x509_note_not_before_enc,
	[  11] = x509_note_params_enc,
	[  12] = x509_note_serial_enc,
	[  13] = x509_note_sig_algo_enc,
	[  14] = x509_note_signature_enc,
	[  15] = x509_note_subject_enc,
	[  16] = x509_note_tbs_certificate_enc,
	[  17] = x509_process_extension_enc,
	[  18] = x509_set_gen_time_enc,
	[  19] = x509_set_uct_time_enc,
	[  20] = x509_signature_algorithm_enc,
	[  21] = x509_version_enc,
};

static const unsigned char x509_machine[] = {
	// Certificate
	[   0] = ASN1_OP_MATCH,
	[   1] = _tag(UNIV, CONS, SEQ),
	// TBSCertificate
	[   2] =  ASN1_OP_MATCH,
	[   3] =  _tag(UNIV, CONS, SEQ),
	[   4] =   ASN1_OP_MATCH_JUMP_OR_SKIP,		// version
	[   5] =   _tagn(CONT, CONS,  0),
	[   6] =   _jump_target(76),
	// CertificateSerialNumber
	[   7] =   ASN1_OP_MATCH,
	[   8] =   _tag(UNIV, PRIM, INT),
	[   9] =   ASN1_OP_ACT,
	[  10] =   _action(ACT_x509_note_serial),
	// AlgorithmIdentifier
	[  11] =   ASN1_OP_MATCH_JUMP,
	[  12] =   _tag(UNIV, CONS, SEQ),
	[  13] =   _jump_target(82),		// --> AlgorithmIdentifier
	[  14] =   ASN1_OP_ACT,
	[  15] =   _action(ACT_x509_note_sig_algo),
	// Name
	[  16] =   ASN1_OP_MATCH_JUMP,
	[  17] =   _tag(UNIV, CONS, SEQ),
	[  18] =   _jump_target(89),		// --> Name
	[  19] =   ASN1_OP_ACT,
	[  20] =   _action(ACT_x509_note_issuer),
	// Validity
	[  21] =   ASN1_OP_MATCH,
	[  22] =   _tag(UNIV, CONS, SEQ),
	// Time
	[  23] =    ASN1_OP_MATCH_ACT_OR_SKIP,		// utcTime
	[  24] =    _tag(UNIV, PRIM, UNITIM),
	[  25] =    _action(ACT_x509_set_uct_time),
	[  26] =    ASN1_OP_COND_MATCH_ACT_OR_SKIP,		// generalTime
	[  27] =    _tag(UNIV, PRIM, GENTIM),
	[  28] =    _action(ACT_x509_set_gen_time),
	[  29] =    ASN1_OP_COND_FAIL,
	[  30] =    ASN1_OP_ACT,
	[  31] =    _action(ACT_x509_note_not_before),
	// Time
	[  32] =    ASN1_OP_MATCH_ACT_OR_SKIP,		// utcTime
	[  33] =    _tag(UNIV, PRIM, UNITIM),
	[  34] =    _action(ACT_x509_set_uct_time),
	[  35] =    ASN1_OP_COND_MATCH_ACT_OR_SKIP,		// generalTime
	[  36] =    _tag(UNIV, PRIM, GENTIM),
	[  37] =    _action(ACT_x509_set_gen_time),
	[  38] =    ASN1_OP_COND_FAIL,
	[  39] =    ASN1_OP_ACT,
	[  40] =    _action(ACT_x509_note_not_after),
	[  41] =   ASN1_OP_END_SEQ,
	// Name
	[  42] =   ASN1_OP_MATCH_JUMP,
	[  43] =   _tag(UNIV, CONS, SEQ),
	[  44] =   _jump_target(89),		// --> Name
	[  45] =   ASN1_OP_ACT,
	[  46] =   _action(ACT_x509_note_subject),
	// SubjectPublicKeyInfo
	[  47] =   ASN1_OP_MATCH,
	[  48] =   _tag(UNIV, CONS, SEQ),
	// AlgorithmIdentifier
	[  49] =    ASN1_OP_MATCH_JUMP,
	[  50] =    _tag(UNIV, CONS, SEQ),
	[  51] =    _jump_target(82),		// --> AlgorithmIdentifier
	[  52] =    ASN1_OP_MATCH_ACT,		// subjectPublicKey
	[  53] =    _tag(UNIV, PRIM, BTS),
	[  54] =    _action(ACT_x509_extract_key_data),
	[  55] =   ASN1_OP_END_SEQ,
	// UniqueIdentifier
	[  56] =   ASN1_OP_MATCH_OR_SKIP,		// issuerUniqueID
	[  57] =   _tagn(CONT, PRIM,  1),
	// UniqueIdentifier
	[  58] =   ASN1_OP_MATCH_OR_SKIP,		// subjectUniqueID
	[  59] =   _tagn(CONT, PRIM,  2),
	[  60] =   ASN1_OP_MATCH_JUMP_OR_SKIP,		// extensions
	[  61] =   _tagn(CONT, CONS,  3),
	[  62] =   _jump_target(106),
	[  63] =  ASN1_OP_END_SEQ,
	[  64] =  ASN1_OP_ACT,
	[  65] =  _action(ACT_x509_note_tbs_certificate),
	// AlgorithmIdentifier
	[  66] =  ASN1_OP_MATCH_JUMP,
	[  67] =  _tag(UNIV, CONS, SEQ),
	[  68] =  _jump_target(82),		// --> AlgorithmIdentifier
	[  69] =  ASN1_OP_ACT,
	[  70] =  _action(ACT_x509_signature_algorithm),
	[  71] =  ASN1_OP_MATCH_ACT,		// signature
	[  72] =  _tag(UNIV, PRIM, BTS),
	[  73] =  _action(ACT_x509_note_signature),
	[  74] = ASN1_OP_END_SEQ,
	[  75] = ASN1_OP_COMPLETE,

	// Version
	[  76] =  ASN1_OP_MATCH,
	[  77] =  _tag(UNIV, PRIM, INT),
	[  78] =  ASN1_OP_ACT,
	[  79] =  _action(ACT_x509_version),
	[  80] = ASN1_OP_END_SEQ,
	[  81] = ASN1_OP_RETURN,

	[  82] =  ASN1_OP_MATCH_ACT,		// algorithm
	[  83] =  _tag(UNIV, PRIM, OID),
	[  84] =  _action(ACT_x509_note_algorithm_OID),
	[  85] =  ASN1_OP_MATCH_ANY_ACT_OR_SKIP,		// parameters
	[  86] =  _action(ACT_x509_note_params),
	[  87] = ASN1_OP_END_SEQ,
	[  88] = ASN1_OP_RETURN,

	// RelativeDistinguishedName
	[  89] =  ASN1_OP_MATCH,
	[  90] =  _tag(UNIV, CONS, SET),
	// AttributeValueAssertion
	[  91] =   ASN1_OP_MATCH,
	[  92] =   _tag(UNIV, CONS, SEQ),
	[  93] =    ASN1_OP_MATCH_ACT,		// attributeType
	[  94] =    _tag(UNIV, PRIM, OID),
	[  95] =    _action(ACT_x509_note_attribute_type_OID),
	[  96] =    ASN1_OP_MATCH_ANY_ACT,		// attributeValue
	[  97] =    _action(ACT_x509_extract_attribute_name_segment),
	[  98] =   ASN1_OP_END_SEQ,
	[  99] =  ASN1_OP_END_SET_OF,
	[ 100] =  _jump_target(91),
	[ 101] =  ASN1_OP_ACT,
	[ 102] =  _action(ACT_x509_attribute_value_continue),
	[ 103] = ASN1_OP_END_SEQ_OF,
	[ 104] = _jump_target(89),
	[ 105] = ASN1_OP_RETURN,

	// Extensions
	[ 106] =  ASN1_OP_MATCH,
	[ 107] =  _tag(UNIV, CONS, SEQ),
	// Extension
	[ 108] =   ASN1_OP_MATCH,
	[ 109] =   _tag(UNIV, CONS, SEQ),
	[ 110] =    ASN1_OP_MATCH_ACT,		// extnid
	[ 111] =    _tag(UNIV, PRIM, OID),
	[ 112] =    _action(ACT_x509_extension_OID),
	[ 113] =    ASN1_OP_MATCH_ACT_OR_SKIP,		// critical
	[ 114] =    _tag(UNIV, PRIM, BOOL),
	[ 115] =    _action(ACT_x509_extension_critical),
	[ 116] =    ASN1_OP_MATCH_ACT,		// extnValue
	[ 117] =    _tag(UNIV, PRIM, OTS),
	[ 118] =    _action(ACT_x509_process_extension),
	[ 119] =   ASN1_OP_END_SEQ_ACT,
	[ 120] =   _action(ACT_x509_extension_continue),
	[ 121] =  ASN1_OP_END_SEQ_OF,
	[ 122] =  _jump_target(108),
	[ 123] = ASN1_OP_END_SEQ,
	[ 124] = ASN1_OP_RETURN,
};

const struct asn1_decoder x509_decoder = {
	.machine = x509_machine,
	.machlen = sizeof(x509_machine),
	.actions = x509_action_table,
};

const struct asn1_encoder x509_encoder = {
	.machine = x509_machine,
	.machlen = sizeof(x509_machine),
	.actions = x509_action_table_enc,
};

// clang-format on
