Blame view
include/linux/asn1_ber_bytecode.h
2.52 KB
b4d0d230c treewide: Replace... |
1 |
/* SPDX-License-Identifier: GPL-2.0-or-later */ |
4520c6a49 X.509: Add simple... |
2 3 4 5 |
/* ASN.1 BER/DER/CER parsing state machine internal definitions * * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) |
4520c6a49 X.509: Add simple... |
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
*/ #ifndef _LINUX_ASN1_BER_BYTECODE_H #define _LINUX_ASN1_BER_BYTECODE_H #ifdef __KERNEL__ #include <linux/types.h> #endif #include <linux/asn1.h> typedef int (*asn1_action_t)(void *context, size_t hdrlen, /* In case of ANY type */ unsigned char tag, /* In case of ANY type */ const void *value, size_t vlen); struct asn1_decoder { const unsigned char *machine; size_t machlen; const asn1_action_t *actions; }; enum asn1_opcode { /* The tag-matching ops come first and the odd-numbered slots * are for OR_SKIP ops. */ #define ASN1_OP_MATCH__SKIP 0x01 #define ASN1_OP_MATCH__ACT 0x02 #define ASN1_OP_MATCH__JUMP 0x04 #define ASN1_OP_MATCH__ANY 0x08 #define ASN1_OP_MATCH__COND 0x10 ASN1_OP_MATCH = 0x00, ASN1_OP_MATCH_OR_SKIP = 0x01, ASN1_OP_MATCH_ACT = 0x02, ASN1_OP_MATCH_ACT_OR_SKIP = 0x03, ASN1_OP_MATCH_JUMP = 0x04, ASN1_OP_MATCH_JUMP_OR_SKIP = 0x05, ASN1_OP_MATCH_ANY = 0x08, |
233ce79db ASN.1: Handle 'AN... |
44 |
ASN1_OP_MATCH_ANY_OR_SKIP = 0x09, |
4520c6a49 X.509: Add simple... |
45 |
ASN1_OP_MATCH_ANY_ACT = 0x0a, |
233ce79db ASN.1: Handle 'AN... |
46 |
ASN1_OP_MATCH_ANY_ACT_OR_SKIP = 0x0b, |
4520c6a49 X.509: Add simple... |
47 48 49 50 51 52 |
/* Everything before here matches unconditionally */ ASN1_OP_COND_MATCH_OR_SKIP = 0x11, ASN1_OP_COND_MATCH_ACT_OR_SKIP = 0x13, ASN1_OP_COND_MATCH_JUMP_OR_SKIP = 0x15, ASN1_OP_COND_MATCH_ANY = 0x18, |
233ce79db ASN.1: Handle 'AN... |
53 |
ASN1_OP_COND_MATCH_ANY_OR_SKIP = 0x19, |
4520c6a49 X.509: Add simple... |
54 |
ASN1_OP_COND_MATCH_ANY_ACT = 0x1a, |
233ce79db ASN.1: Handle 'AN... |
55 |
ASN1_OP_COND_MATCH_ANY_ACT_OR_SKIP = 0x1b, |
4520c6a49 X.509: Add simple... |
56 57 |
/* Everything before here will want a tag from the data */ |
233ce79db ASN.1: Handle 'AN... |
58 |
#define ASN1_OP__MATCHES_TAG ASN1_OP_COND_MATCH_ANY_ACT_OR_SKIP |
4520c6a49 X.509: Add simple... |
59 60 |
/* These are here to help fill up space */ |
233ce79db ASN.1: Handle 'AN... |
61 62 63 64 |
ASN1_OP_COND_FAIL = 0x1c, ASN1_OP_COMPLETE = 0x1d, ASN1_OP_ACT = 0x1e, ASN1_OP_MAYBE_ACT = 0x1f, |
4520c6a49 X.509: Add simple... |
65 66 67 68 69 70 71 72 73 74 75 76 77 |
/* The following eight have bit 0 -> SET, 1 -> OF, 2 -> ACT */ ASN1_OP_END_SEQ = 0x20, ASN1_OP_END_SET = 0x21, ASN1_OP_END_SEQ_OF = 0x22, ASN1_OP_END_SET_OF = 0x23, ASN1_OP_END_SEQ_ACT = 0x24, ASN1_OP_END_SET_ACT = 0x25, ASN1_OP_END_SEQ_OF_ACT = 0x26, ASN1_OP_END_SET_OF_ACT = 0x27, #define ASN1_OP_END__SET 0x01 #define ASN1_OP_END__OF 0x02 #define ASN1_OP_END__ACT 0x04 |
233ce79db ASN.1: Handle 'AN... |
78 |
ASN1_OP_RETURN = 0x28, |
4520c6a49 X.509: Add simple... |
79 80 81 82 83 84 85 86 87 |
ASN1_OP__NR }; #define _tag(CLASS, CP, TAG) ((ASN1_##CLASS << 6) | (ASN1_##CP << 5) | ASN1_##TAG) #define _tagn(CLASS, CP, TAG) ((ASN1_##CLASS << 6) | (ASN1_##CP << 5) | TAG) #define _jump_target(N) (N) #define _action(N) (N) #endif /* _LINUX_ASN1_BER_BYTECODE_H */ |