1 | /*
|
---|
2 | Unix SMB/CIFS implementation.
|
---|
3 | simple ASN1 code
|
---|
4 | Copyright (C) Andrew Tridgell 2001
|
---|
5 |
|
---|
6 | This program is free software; you can redistribute it and/or modify
|
---|
7 | it under the terms of the GNU General Public License as published by
|
---|
8 | the Free Software Foundation; either version 3 of the License, or
|
---|
9 | (at your option) any later version.
|
---|
10 |
|
---|
11 | This program is distributed in the hope that it will be useful,
|
---|
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | GNU General Public License for more details.
|
---|
15 |
|
---|
16 | You should have received a copy of the GNU General Public License
|
---|
17 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
18 | */
|
---|
19 |
|
---|
20 | #ifndef _ASN_1_H
|
---|
21 | #define _ASN_1_H
|
---|
22 |
|
---|
23 | struct nesting {
|
---|
24 | off_t start;
|
---|
25 | size_t taglen; /* for parsing */
|
---|
26 | struct nesting *next;
|
---|
27 | };
|
---|
28 |
|
---|
29 | typedef struct asn1_data {
|
---|
30 | uint8 *data;
|
---|
31 | size_t length;
|
---|
32 | off_t ofs;
|
---|
33 | struct nesting *nesting;
|
---|
34 | bool has_error;
|
---|
35 | } ASN1_DATA;
|
---|
36 |
|
---|
37 |
|
---|
38 | #define ASN1_APPLICATION(x) ((x)+0x60)
|
---|
39 | #define ASN1_APPLICATION_SIMPLE(x) ((x)+0x40)
|
---|
40 | #define ASN1_SEQUENCE(x) ((x)+0x30)
|
---|
41 | #define ASN1_CONTEXT(x) ((x)+0xa0)
|
---|
42 | #define ASN1_CONTEXT_SIMPLE(x) ((x)+0x80)
|
---|
43 | #define ASN1_GENERAL_STRING 0x1b
|
---|
44 | #define ASN1_OCTET_STRING 0x4
|
---|
45 | #define ASN1_OID 0x6
|
---|
46 | #define ASN1_BOOLEAN 0x1
|
---|
47 | #define ASN1_INTEGER 0x2
|
---|
48 | #define ASN1_BITFIELD 0x3
|
---|
49 | #define ASN1_ENUMERATED 0xa
|
---|
50 | #define ASN1_SET 0x31
|
---|
51 |
|
---|
52 | #define ASN1_MAX_OIDS 20
|
---|
53 |
|
---|
54 | /* some well known object IDs */
|
---|
55 | #define OID_SPNEGO "1 3 6 1 5 5 2"
|
---|
56 | #define OID_NTLMSSP "1 3 6 1 4 1 311 2 2 10"
|
---|
57 | #define OID_KERBEROS5_OLD "1 2 840 48018 1 2 2"
|
---|
58 | #define OID_KERBEROS5 "1 2 840 113554 1 2 2"
|
---|
59 |
|
---|
60 | #define SPNEGO_NEG_RESULT_ACCEPT 0
|
---|
61 | #define SPNEGO_NEG_RESULT_INCOMPLETE 1
|
---|
62 | #define SPNEGO_NEG_RESULT_REJECT 2
|
---|
63 |
|
---|
64 | /* not really ASN.1, but RFC 1964 */
|
---|
65 | #define TOK_ID_KRB_AP_REQ (uchar*)"\x01\x00"
|
---|
66 | #define TOK_ID_KRB_AP_REP (uchar*)"\x02\x00"
|
---|
67 | #define TOK_ID_KRB_ERROR (uchar*)"\x03\x00"
|
---|
68 | #define TOK_ID_GSS_GETMIC (uchar*)"\x01\x01"
|
---|
69 | #define TOK_ID_GSS_WRAP (uchar*)"\x02\x01"
|
---|
70 |
|
---|
71 | #endif /* _ASN_1_H */
|
---|