Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
asn1_ber_bytecode.h
Go to the documentation of this file.
1 /* ASN.1 BER/DER/CER parsing state machine internal definitions
2  *
3  * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
4  * Written by David Howells ([email protected])
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public Licence
8  * as published by the Free Software Foundation; either version
9  * 2 of the Licence, or (at your option) any later version.
10  */
11 
12 #ifndef _LINUX_ASN1_BER_BYTECODE_H
13 #define _LINUX_ASN1_BER_BYTECODE_H
14 
15 #ifdef __KERNEL__
16 #include <linux/types.h>
17 #endif
18 #include <linux/asn1.h>
19 
20 typedef int (*asn1_action_t)(void *context,
21  size_t hdrlen, /* In case of ANY type */
22  unsigned char tag, /* In case of ANY type */
23  const void *value, size_t vlen);
24 
25 struct asn1_decoder {
26  const unsigned char *machine;
27  size_t machlen;
29 };
30 
32  /* The tag-matching ops come first and the odd-numbered slots
33  * are for OR_SKIP ops.
34  */
35 #define ASN1_OP_MATCH__SKIP 0x01
36 #define ASN1_OP_MATCH__ACT 0x02
37 #define ASN1_OP_MATCH__JUMP 0x04
38 #define ASN1_OP_MATCH__ANY 0x08
39 #define ASN1_OP_MATCH__COND 0x10
40 
41  ASN1_OP_MATCH = 0x00,
49  /* Everything before here matches unconditionally */
50 
56 
57  /* Everything before here will want a tag from the data */
58 #define ASN1_OP__MATCHES_TAG ASN1_OP_COND_MATCH_ANY_ACT
59 
60  /* These are here to help fill up space */
63  ASN1_OP_ACT = 0x1d,
65 
66  /* The following eight have bit 0 -> SET, 1 -> OF, 2 -> ACT */
75 #define ASN1_OP_END__SET 0x01
76 #define ASN1_OP_END__OF 0x02
77 #define ASN1_OP_END__ACT 0x04
78 
80 };
81 
82 #define _tag(CLASS, CP, TAG) ((ASN1_##CLASS << 6) | (ASN1_##CP << 5) | ASN1_##TAG)
83 #define _tagn(CLASS, CP, TAG) ((ASN1_##CLASS << 6) | (ASN1_##CP << 5) | TAG)
84 #define _jump_target(N) (N)
85 #define _action(N) (N)
86 
87 #endif /* _LINUX_ASN1_BER_BYTECODE_H */