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

// clang-format off

enum pkcs8_actions {
	ACT_lc_pkcs8_note_OID = 0,
	ACT_lc_pkcs8_note_algo = 1,
	ACT_lc_pkcs8_note_key = 2,
	ACT_lc_pkcs8_note_version = 3,
	NR__pkcs8_actions = 4
};

static const asn1_action_t pkcs8_action_table[NR__pkcs8_actions] = {
	[   0] = lc_pkcs8_note_OID,
	[   1] = lc_pkcs8_note_algo,
	[   2] = lc_pkcs8_note_key,
	[   3] = lc_pkcs8_note_version,
};

static const asn1_action_enc_t pkcs8_action_table_enc[NR__pkcs8_actions] = {
	[   0] = lc_pkcs8_note_OID_enc,
	[   1] = lc_pkcs8_note_algo_enc,
	[   2] = lc_pkcs8_note_key_enc,
	[   3] = lc_pkcs8_note_version_enc,
};

static const unsigned char pkcs8_machine[] = {
	// PrivateKeyInfo
	[   0] = ASN1_OP_MATCH,
	[   1] = _tag(UNIV, CONS, SEQ),
	// Version
	[   2] =  ASN1_OP_MATCH_ACT,
	[   3] =  _tag(UNIV, PRIM, INT),
	[   4] =  _action(ACT_lc_pkcs8_note_version),
	// PrivateKeyAlgorithmIdentifier
	// AlgorithmIdentifier
	[   5] =  ASN1_OP_MATCH,
	[   6] =  _tag(UNIV, CONS, SEQ),
	[   7] =   ASN1_OP_MATCH_ACT,		// algorithm
	[   8] =   _tag(UNIV, PRIM, OID),
	[   9] =   _action(ACT_lc_pkcs8_note_OID),
	[  10] =   ASN1_OP_MATCH_ANY_OR_SKIP,		// parameters
	[  11] =  ASN1_OP_END_SEQ,
	[  12] =  ASN1_OP_ACT,
	[  13] =  _action(ACT_lc_pkcs8_note_algo),
	// PrivateKey
	[  14] =  ASN1_OP_MATCH_ACT,
	[  15] =  _tag(UNIV, PRIM, OTS),
	[  16] =  _action(ACT_lc_pkcs8_note_key),
	// Attributes
	[  17] =  ASN1_OP_MATCH_JUMP_OR_SKIP,		// attributes
	[  18] =  _tagn(CONT, CONS,  0),
	[  19] =  _jump_target(22),		// --> Attributes
	[  20] = ASN1_OP_END_SEQ,
	[  21] = ASN1_OP_COMPLETE,

	// Attribute
	[  22] =  ASN1_OP_MATCH_ANY,
	[  23] = ASN1_OP_END_SET_OF,
	[  24] = _jump_target(22),
	[  25] = ASN1_OP_RETURN,
};

const struct lc_asn1_decoder lc_pkcs8_decoder = {
	.machine = pkcs8_machine,
	.machlen = sizeof(pkcs8_machine),
	.actions = pkcs8_action_table,
};

const struct lc_asn1_encoder lc_pkcs8_encoder = {
	.machine = pkcs8_machine,
	.machlen = sizeof(pkcs8_machine),
	.actions = pkcs8_action_table_enc,
};

// clang-format on
