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

// clang-format off

enum x509_csr_actions {
	ACT_lc_x509_attribute_value_continue = 0,
	ACT_lc_x509_csr_version = 1,
	ACT_lc_x509_extract_attribute_name_segment = 2,
	ACT_lc_x509_extract_key_data = 3,
	ACT_lc_x509_note_algorithm_OID = 4,
	ACT_lc_x509_note_attribute_type_OID = 5,
	ACT_lc_x509_note_csr_info = 6,
	ACT_lc_x509_note_params = 7,
	ACT_lc_x509_note_signature = 8,
	ACT_lc_x509_note_subject = 9,
	ACT_lc_x509_signature_algorithm = 10,
	NR__x509_csr_actions = 11
};

static const asn1_action_t x509_csr_action_table[NR__x509_csr_actions] = {
	[   0] = lc_x509_attribute_value_continue,
	[   1] = lc_x509_csr_version,
	[   2] = lc_x509_extract_attribute_name_segment,
	[   3] = lc_x509_extract_key_data,
	[   4] = lc_x509_note_algorithm_OID,
	[   5] = lc_x509_note_attribute_type_OID,
	[   6] = lc_x509_note_csr_info,
	[   7] = lc_x509_note_params,
	[   8] = lc_x509_note_signature,
	[   9] = lc_x509_note_subject,
	[  10] = lc_x509_signature_algorithm,
};

static const asn1_action_enc_t x509_csr_action_table_enc[NR__x509_csr_actions] = {
	[   0] = lc_x509_attribute_value_continue_enc,
	[   1] = lc_x509_csr_version_enc,
	[   2] = lc_x509_extract_attribute_name_segment_enc,
	[   3] = lc_x509_extract_key_data_enc,
	[   4] = lc_x509_note_algorithm_OID_enc,
	[   5] = lc_x509_note_attribute_type_OID_enc,
	[   6] = lc_x509_note_csr_info_enc,
	[   7] = lc_x509_note_params_enc,
	[   8] = lc_x509_note_signature_enc,
	[   9] = lc_x509_note_subject_enc,
	[  10] = lc_x509_signature_algorithm_enc,
};

static const unsigned char x509_csr_machine[] = {
	// CertificationRequest
	[   0] = ASN1_OP_MATCH,
	[   1] = _tag(UNIV, CONS, SEQ),
	// CertificationRequestInfo
	[   2] =  ASN1_OP_MATCH,
	[   3] =  _tag(UNIV, CONS, SEQ),
	// Version
	[   4] =   ASN1_OP_MATCH,
	[   5] =   _tag(UNIV, PRIM, INT),
	[   6] =   ASN1_OP_ACT,
	[   7] =   _action(ACT_lc_x509_csr_version),
	// Name
	[   8] =   ASN1_OP_MATCH,
	[   9] =   _tag(UNIV, CONS, SEQ),
	// RelativeDistinguishedName
	[  10] =    ASN1_OP_MATCH,
	[  11] =    _tag(UNIV, CONS, SET),
	// AttributeValueAssertion
	[  12] =     ASN1_OP_MATCH,
	[  13] =     _tag(UNIV, CONS, SEQ),
	[  14] =      ASN1_OP_MATCH_ACT,		// attributeType
	[  15] =      _tag(UNIV, PRIM, OID),
	[  16] =      _action(ACT_lc_x509_note_attribute_type_OID),
	[  17] =      ASN1_OP_MATCH_ANY_ACT,		// attributeValue
	[  18] =      _action(ACT_lc_x509_extract_attribute_name_segment),
	[  19] =     ASN1_OP_END_SEQ,
	[  20] =    ASN1_OP_END_SET_OF,
	[  21] =    _jump_target(12),
	[  22] =    ASN1_OP_ACT,
	[  23] =    _action(ACT_lc_x509_attribute_value_continue),
	[  24] =   ASN1_OP_END_SEQ_OF,
	[  25] =   _jump_target(10),
	[  26] =   ASN1_OP_ACT,
	[  27] =   _action(ACT_lc_x509_note_subject),
	// SubjectPublicKeyInfo
	[  28] =   ASN1_OP_MATCH,
	[  29] =   _tag(UNIV, CONS, SEQ),
	// AlgorithmIdentifier
	[  30] =    ASN1_OP_MATCH_JUMP,
	[  31] =    _tag(UNIV, CONS, SEQ),
	[  32] =    _jump_target(51),		// --> AlgorithmIdentifier
	[  33] =    ASN1_OP_MATCH_ACT,		// subjectPublicKey
	[  34] =    _tag(UNIV, PRIM, BTS),
	[  35] =    _action(ACT_lc_x509_extract_key_data),
	[  36] =   ASN1_OP_END_SEQ,
	[  37] =   ASN1_OP_MATCH_ANY_OR_SKIP,		// attributes
	[  38] =  ASN1_OP_END_SEQ,
	[  39] =  ASN1_OP_ACT,
	[  40] =  _action(ACT_lc_x509_note_csr_info),
	// AlgorithmIdentifier
	[  41] =  ASN1_OP_MATCH_JUMP,
	[  42] =  _tag(UNIV, CONS, SEQ),
	[  43] =  _jump_target(51),		// --> AlgorithmIdentifier
	[  44] =  ASN1_OP_ACT,
	[  45] =  _action(ACT_lc_x509_signature_algorithm),
	[  46] =  ASN1_OP_MATCH_ACT,		// signature
	[  47] =  _tag(UNIV, PRIM, BTS),
	[  48] =  _action(ACT_lc_x509_note_signature),
	[  49] = ASN1_OP_END_SEQ,
	[  50] = ASN1_OP_COMPLETE,

	[  51] =  ASN1_OP_MATCH_ACT,		// algorithm
	[  52] =  _tag(UNIV, PRIM, OID),
	[  53] =  _action(ACT_lc_x509_note_algorithm_OID),
	[  54] =  ASN1_OP_MATCH_ANY_ACT_OR_SKIP,		// parameters
	[  55] =  _action(ACT_lc_x509_note_params),
	[  56] = ASN1_OP_END_SEQ,
	[  57] = ASN1_OP_RETURN,
};

const struct lc_asn1_decoder lc_x509_csr_decoder = {
	.machine = x509_csr_machine,
	.machlen = sizeof(x509_csr_machine),
	.actions = x509_csr_action_table,
};

const struct lc_asn1_encoder lc_x509_csr_encoder = {
	.machine = x509_csr_machine,
	.machlen = sizeof(x509_csr_machine),
	.actions = x509_csr_action_table_enc,
};

// clang-format on
