1 /* 2 * Automatically generated by asn1_compiler. Do not edit 3 * 4 * ASN.1 parser for x509 5 */ 6 #include <linux/asn1_ber_bytecode.h> 7 #include "x509.asn1.h" 8 9 enum x509_actions { 10 ACT_x509_extract_key_data = 0, 11 ACT_x509_extract_name_segment = 1, 12 ACT_x509_note_OID = 2, 13 ACT_x509_note_issuer = 3, 14 ACT_x509_note_not_after = 4, 15 ACT_x509_note_not_before = 5, 16 ACT_x509_note_params = 6, 17 ACT_x509_note_pkey_algo = 7, 18 ACT_x509_note_serial = 8, 19 ACT_x509_note_signature = 9, 20 ACT_x509_note_subject = 10, 21 ACT_x509_note_tbs_certificate = 11, 22 ACT_x509_process_extension = 12, 23 NR__x509_actions = 13 24 }; 25 26 static const asn1_action_t x509_action_table[NR__x509_actions] = { 27 [ 0] = x509_extract_key_data, 28 [ 1] = x509_extract_name_segment, 29 [ 2] = x509_note_OID, 30 [ 3] = x509_note_issuer, 31 [ 4] = x509_note_not_after, 32 [ 5] = x509_note_not_before, 33 [ 6] = x509_note_params, 34 [ 7] = x509_note_pkey_algo, 35 [ 8] = x509_note_serial, 36 [ 9] = x509_note_signature, 37 [ 10] = x509_note_subject, 38 [ 11] = x509_note_tbs_certificate, 39 [ 12] = x509_process_extension, 40 }; 41 42 static const unsigned char x509_machine[] = { 43 // Certificate 44 [ 0] = ASN1_OP_MATCH, 45 [ 1] = _tag(UNIV, CONS, SEQ), 46 // TBSCertificate 47 [ 2] = ASN1_OP_MATCH, 48 [ 3] = _tag(UNIV, CONS, SEQ), 49 [ 4] = ASN1_OP_MATCH_JUMP_OR_SKIP, // version 50 [ 5] = _tagn(CONT, CONS, 0), 51 [ 6] = _jump_target(70), 52 // CertificateSerialNumber 53 [ 7] = ASN1_OP_MATCH, 54 [ 8] = _tag(UNIV, PRIM, INT), 55 [ 9] = ASN1_OP_ACT, 56 [ 10] = _action(ACT_x509_note_serial), 57 // AlgorithmIdentifier 58 [ 11] = ASN1_OP_MATCH_JUMP, 59 [ 12] = _tag(UNIV, CONS, SEQ), 60 [ 13] = _jump_target(74), // --> AlgorithmIdentifier 61 [ 14] = ASN1_OP_ACT, 62 [ 15] = _action(ACT_x509_note_pkey_algo), 63 // Name 64 [ 16] = ASN1_OP_MATCH_JUMP, 65 [ 17] = _tag(UNIV, CONS, SEQ), 66 [ 18] = _jump_target(81), // --> Name 67 [ 19] = ASN1_OP_ACT, 68 [ 20] = _action(ACT_x509_note_issuer), 69 // Validity 70 [ 21] = ASN1_OP_MATCH, 71 [ 22] = _tag(UNIV, CONS, SEQ), 72 // Time 73 [ 23] = ASN1_OP_MATCH_OR_SKIP, // utcTime 74 [ 24] = _tag(UNIV, PRIM, UNITIM), 75 [ 25] = ASN1_OP_COND_MATCH_OR_SKIP, // generalTime 76 [ 26] = _tag(UNIV, PRIM, GENTIM), 77 [ 27] = ASN1_OP_COND_FAIL, 78 [ 28] = ASN1_OP_ACT, 79 [ 29] = _action(ACT_x509_note_not_before), 80 // Time 81 [ 30] = ASN1_OP_MATCH_OR_SKIP, // utcTime 82 [ 31] = _tag(UNIV, PRIM, UNITIM), 83 [ 32] = ASN1_OP_COND_MATCH_OR_SKIP, // generalTime 84 [ 33] = _tag(UNIV, PRIM, GENTIM), 85 [ 34] = ASN1_OP_COND_FAIL, 86 [ 35] = ASN1_OP_ACT, 87 [ 36] = _action(ACT_x509_note_not_after), 88 [ 37] = ASN1_OP_END_SEQ, 89 // Name 90 [ 38] = ASN1_OP_MATCH_JUMP, 91 [ 39] = _tag(UNIV, CONS, SEQ), 92 [ 40] = _jump_target(81), // --> Name 93 [ 41] = ASN1_OP_ACT, 94 [ 42] = _action(ACT_x509_note_subject), 95 // SubjectPublicKeyInfo 96 [ 43] = ASN1_OP_MATCH, 97 [ 44] = _tag(UNIV, CONS, SEQ), 98 // AlgorithmIdentifier 99 [ 45] = ASN1_OP_MATCH_JUMP, 100 [ 46] = _tag(UNIV, CONS, SEQ), 101 [ 47] = _jump_target(74), // --> AlgorithmIdentifier 102 [ 48] = ASN1_OP_MATCH_ACT, // subjectPublicKey 103 [ 49] = _tag(UNIV, PRIM, BTS), 104 [ 50] = _action(ACT_x509_extract_key_data), 105 [ 51] = ASN1_OP_END_SEQ, 106 // UniqueIdentifier 107 [ 52] = ASN1_OP_MATCH_OR_SKIP, // issuerUniqueID 108 [ 53] = _tagn(CONT, PRIM, 1), 109 // UniqueIdentifier 110 [ 54] = ASN1_OP_MATCH_OR_SKIP, // subjectUniqueID 111 [ 55] = _tagn(CONT, PRIM, 2), 112 [ 56] = ASN1_OP_MATCH_JUMP_OR_SKIP, // extensions 113 [ 57] = _tagn(CONT, CONS, 3), 114 [ 58] = _jump_target(96), 115 [ 59] = ASN1_OP_END_SEQ, 116 [ 60] = ASN1_OP_ACT, 117 [ 61] = _action(ACT_x509_note_tbs_certificate), 118 // AlgorithmIdentifier 119 [ 62] = ASN1_OP_MATCH_JUMP, 120 [ 63] = _tag(UNIV, CONS, SEQ), 121 [ 64] = _jump_target(74), // --> AlgorithmIdentifier 122 [ 65] = ASN1_OP_MATCH_ACT, // signature 123 [ 66] = _tag(UNIV, PRIM, BTS), 124 [ 67] = _action(ACT_x509_note_signature), 125 [ 68] = ASN1_OP_END_SEQ, 126 [ 69] = ASN1_OP_COMPLETE, 127 128 // Version 129 [ 70] = ASN1_OP_MATCH, 130 [ 71] = _tag(UNIV, PRIM, INT), 131 [ 72] = ASN1_OP_END_SEQ, 132 [ 73] = ASN1_OP_RETURN, 133 134 [ 74] = ASN1_OP_MATCH_ACT, // algorithm 135 [ 75] = _tag(UNIV, PRIM, OID), 136 [ 76] = _action(ACT_x509_note_OID), 137 [ 77] = ASN1_OP_MATCH_ANY_ACT_OR_SKIP, // parameters 138 [ 78] = _action(ACT_x509_note_params), 139 [ 79] = ASN1_OP_END_SEQ, 140 [ 80] = ASN1_OP_RETURN, 141 142 // RelativeDistinguishedName 143 [ 81] = ASN1_OP_MATCH, 144 [ 82] = _tag(UNIV, CONS, SET), 145 // AttributeValueAssertion 146 [ 83] = ASN1_OP_MATCH, 147 [ 84] = _tag(UNIV, CONS, SEQ), 148 [ 85] = ASN1_OP_MATCH_ACT, // attributeType 149 [ 86] = _tag(UNIV, PRIM, OID), 150 [ 87] = _action(ACT_x509_note_OID), 151 [ 88] = ASN1_OP_MATCH_ANY_ACT, // attributeValue 152 [ 89] = _action(ACT_x509_extract_name_segment), 153 [ 90] = ASN1_OP_END_SEQ, 154 [ 91] = ASN1_OP_END_SET_OF, 155 [ 92] = _jump_target(83), 156 [ 93] = ASN1_OP_END_SEQ_OF, 157 [ 94] = _jump_target(81), 158 [ 95] = ASN1_OP_RETURN, 159 160 // Extensions 161 [ 96] = ASN1_OP_MATCH, 162 [ 97] = _tag(UNIV, CONS, SEQ), 163 // Extension 164 [ 98] = ASN1_OP_MATCH, 165 [ 99] = _tag(UNIV, CONS, SEQ), 166 [ 100] = ASN1_OP_MATCH_ACT, // extnid 167 [ 101] = _tag(UNIV, PRIM, OID), 168 [ 102] = _action(ACT_x509_note_OID), 169 [ 103] = ASN1_OP_MATCH_OR_SKIP, // critical 170 [ 104] = _tag(UNIV, PRIM, BOOL), 171 [ 105] = ASN1_OP_MATCH_ACT, // extnValue 172 [ 106] = _tag(UNIV, PRIM, OTS), 173 [ 107] = _action(ACT_x509_process_extension), 174 [ 108] = ASN1_OP_END_SEQ, 175 [ 109] = ASN1_OP_END_SEQ_OF, 176 [ 110] = _jump_target(98), 177 [ 111] = ASN1_OP_END_SEQ, 178 [ 112] = ASN1_OP_RETURN, 179 }; 180 181 const struct asn1_decoder x509_decoder = { 182 .machine = x509_machine, 183 .machlen = sizeof(x509_machine), 184 .actions = x509_action_table, 185 }; 186