summaryrefslogtreecommitdiff
path: root/compat/verification/x509.asn1.c
diff options
context:
space:
mode:
Diffstat (limited to 'compat/verification/x509.asn1.c')
-rw-r--r--compat/verification/x509.asn1.c185
1 files changed, 185 insertions, 0 deletions
diff --git a/compat/verification/x509.asn1.c b/compat/verification/x509.asn1.c
new file mode 100644
index 0000000..e68864b
--- /dev/null
+++ b/compat/verification/x509.asn1.c
@@ -0,0 +1,185 @@
+/*
+ * Automatically generated by asn1_compiler. Do not edit
+ *
+ * ASN.1 parser for x509
+ */
+#include <linux/asn1_ber_bytecode.h>
+#include "x509.asn1.h"
+
+enum x509_actions {
+ ACT_x509_extract_key_data = 0,
+ ACT_x509_extract_name_segment = 1,
+ ACT_x509_note_OID = 2,
+ ACT_x509_note_issuer = 3,
+ ACT_x509_note_not_after = 4,
+ ACT_x509_note_not_before = 5,
+ ACT_x509_note_params = 6,
+ ACT_x509_note_pkey_algo = 7,
+ ACT_x509_note_serial = 8,
+ ACT_x509_note_signature = 9,
+ ACT_x509_note_subject = 10,
+ ACT_x509_note_tbs_certificate = 11,
+ ACT_x509_process_extension = 12,
+ NR__x509_actions = 13
+};
+
+static const asn1_action_t x509_action_table[NR__x509_actions] = {
+ [ 0] = x509_extract_key_data,
+ [ 1] = x509_extract_name_segment,
+ [ 2] = x509_note_OID,
+ [ 3] = x509_note_issuer,
+ [ 4] = x509_note_not_after,
+ [ 5] = x509_note_not_before,
+ [ 6] = x509_note_params,
+ [ 7] = x509_note_pkey_algo,
+ [ 8] = x509_note_serial,
+ [ 9] = x509_note_signature,
+ [ 10] = x509_note_subject,
+ [ 11] = x509_note_tbs_certificate,
+ [ 12] = x509_process_extension,
+};
+
+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(70),
+ // 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(74), // --> AlgorithmIdentifier
+ [ 14] = ASN1_OP_ACT,
+ [ 15] = _action(ACT_x509_note_pkey_algo),
+ // Name
+ [ 16] = ASN1_OP_MATCH_JUMP,
+ [ 17] = _tag(UNIV, CONS, SEQ),
+ [ 18] = _jump_target(81), // --> 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_OR_SKIP, // utcTime
+ [ 24] = _tag(UNIV, PRIM, UNITIM),
+ [ 25] = ASN1_OP_COND_MATCH_OR_SKIP, // generalTime
+ [ 26] = _tag(UNIV, PRIM, GENTIM),
+ [ 27] = ASN1_OP_COND_FAIL,
+ [ 28] = ASN1_OP_ACT,
+ [ 29] = _action(ACT_x509_note_not_before),
+ // Time
+ [ 30] = ASN1_OP_MATCH_OR_SKIP, // utcTime
+ [ 31] = _tag(UNIV, PRIM, UNITIM),
+ [ 32] = ASN1_OP_COND_MATCH_OR_SKIP, // generalTime
+ [ 33] = _tag(UNIV, PRIM, GENTIM),
+ [ 34] = ASN1_OP_COND_FAIL,
+ [ 35] = ASN1_OP_ACT,
+ [ 36] = _action(ACT_x509_note_not_after),
+ [ 37] = ASN1_OP_END_SEQ,
+ // Name
+ [ 38] = ASN1_OP_MATCH_JUMP,
+ [ 39] = _tag(UNIV, CONS, SEQ),
+ [ 40] = _jump_target(81), // --> Name
+ [ 41] = ASN1_OP_ACT,
+ [ 42] = _action(ACT_x509_note_subject),
+ // SubjectPublicKeyInfo
+ [ 43] = ASN1_OP_MATCH,
+ [ 44] = _tag(UNIV, CONS, SEQ),
+ // AlgorithmIdentifier
+ [ 45] = ASN1_OP_MATCH_JUMP,
+ [ 46] = _tag(UNIV, CONS, SEQ),
+ [ 47] = _jump_target(74), // --> AlgorithmIdentifier
+ [ 48] = ASN1_OP_MATCH_ACT, // subjectPublicKey
+ [ 49] = _tag(UNIV, PRIM, BTS),
+ [ 50] = _action(ACT_x509_extract_key_data),
+ [ 51] = ASN1_OP_END_SEQ,
+ // UniqueIdentifier
+ [ 52] = ASN1_OP_MATCH_OR_SKIP, // issuerUniqueID
+ [ 53] = _tagn(CONT, PRIM, 1),
+ // UniqueIdentifier
+ [ 54] = ASN1_OP_MATCH_OR_SKIP, // subjectUniqueID
+ [ 55] = _tagn(CONT, PRIM, 2),
+ [ 56] = ASN1_OP_MATCH_JUMP_OR_SKIP, // extensions
+ [ 57] = _tagn(CONT, CONS, 3),
+ [ 58] = _jump_target(96),
+ [ 59] = ASN1_OP_END_SEQ,
+ [ 60] = ASN1_OP_ACT,
+ [ 61] = _action(ACT_x509_note_tbs_certificate),
+ // AlgorithmIdentifier
+ [ 62] = ASN1_OP_MATCH_JUMP,
+ [ 63] = _tag(UNIV, CONS, SEQ),
+ [ 64] = _jump_target(74), // --> AlgorithmIdentifier
+ [ 65] = ASN1_OP_MATCH_ACT, // signature
+ [ 66] = _tag(UNIV, PRIM, BTS),
+ [ 67] = _action(ACT_x509_note_signature),
+ [ 68] = ASN1_OP_END_SEQ,
+ [ 69] = ASN1_OP_COMPLETE,
+
+ // Version
+ [ 70] = ASN1_OP_MATCH,
+ [ 71] = _tag(UNIV, PRIM, INT),
+ [ 72] = ASN1_OP_END_SEQ,
+ [ 73] = ASN1_OP_RETURN,
+
+ [ 74] = ASN1_OP_MATCH_ACT, // algorithm
+ [ 75] = _tag(UNIV, PRIM, OID),
+ [ 76] = _action(ACT_x509_note_OID),
+ [ 77] = ASN1_OP_MATCH_ANY_ACT_OR_SKIP, // parameters
+ [ 78] = _action(ACT_x509_note_params),
+ [ 79] = ASN1_OP_END_SEQ,
+ [ 80] = ASN1_OP_RETURN,
+
+ // RelativeDistinguishedName
+ [ 81] = ASN1_OP_MATCH,
+ [ 82] = _tag(UNIV, CONS, SET),
+ // AttributeValueAssertion
+ [ 83] = ASN1_OP_MATCH,
+ [ 84] = _tag(UNIV, CONS, SEQ),
+ [ 85] = ASN1_OP_MATCH_ACT, // attributeType
+ [ 86] = _tag(UNIV, PRIM, OID),
+ [ 87] = _action(ACT_x509_note_OID),
+ [ 88] = ASN1_OP_MATCH_ANY_ACT, // attributeValue
+ [ 89] = _action(ACT_x509_extract_name_segment),
+ [ 90] = ASN1_OP_END_SEQ,
+ [ 91] = ASN1_OP_END_SET_OF,
+ [ 92] = _jump_target(83),
+ [ 93] = ASN1_OP_END_SEQ_OF,
+ [ 94] = _jump_target(81),
+ [ 95] = ASN1_OP_RETURN,
+
+ // Extensions
+ [ 96] = ASN1_OP_MATCH,
+ [ 97] = _tag(UNIV, CONS, SEQ),
+ // Extension
+ [ 98] = ASN1_OP_MATCH,
+ [ 99] = _tag(UNIV, CONS, SEQ),
+ [ 100] = ASN1_OP_MATCH_ACT, // extnid
+ [ 101] = _tag(UNIV, PRIM, OID),
+ [ 102] = _action(ACT_x509_note_OID),
+ [ 103] = ASN1_OP_MATCH_OR_SKIP, // critical
+ [ 104] = _tag(UNIV, PRIM, BOOL),
+ [ 105] = ASN1_OP_MATCH_ACT, // extnValue
+ [ 106] = _tag(UNIV, PRIM, OTS),
+ [ 107] = _action(ACT_x509_process_extension),
+ [ 108] = ASN1_OP_END_SEQ,
+ [ 109] = ASN1_OP_END_SEQ_OF,
+ [ 110] = _jump_target(98),
+ [ 111] = ASN1_OP_END_SEQ,
+ [ 112] = ASN1_OP_RETURN,
+};
+
+const struct asn1_decoder x509_decoder = {
+ .machine = x509_machine,
+ .machlen = sizeof(x509_machine),
+ .actions = x509_action_table,
+};