packet-kerberos: remember in what frame a key was learned
[metze/wireshark/wip.git] / epan / dissectors / packet-kerberos.h
1 /* packet-kerberos.h
2  *
3  * $Id$
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23
24 #ifndef __PACKET_KERBEROS_H
25 #define __PACKET_KERBEROS_H
26
27 #include "ws_symbol_export.h"
28
29 /* This is a list of callback functions a caller can use to specify that
30    octet strings in kerberos to be passed back to application specific
31    dissectors, outside of kerberos.
32    This is used for dissection of application specific data for PacketCable
33    KRB_SAFE user data and eventually to pass kerberos session keys
34    to future DCERPC decryption and other uses.
35    The list is terminated by {0, NULL }
36 */
37 #define KRB_CBTAG_SAFE_USER_DATA                1
38 #define KRB_CBTAG_PRIV_USER_DATA                2
39 typedef struct _kerberos_callbacks {
40         int tag;
41         int (*callback)(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree);
42 } kerberos_callbacks;
43
44 /* Function prototypes */
45
46 gint
47 dissect_kerberos_main(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean do_col_info, kerberos_callbacks *cb);
48
49 int
50 dissect_krb5_Checksum(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
51
52 int
53 dissect_krb5_ctime(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
54
55 int dissect_krb5_cname(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
56 int dissect_krb5_realm(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
57 guint32 kerberos_output_keytype(void);
58
59 guint get_krb_pdu_len(packet_info *, tvbuff_t *tvb, int offset);
60
61 gint kerberos_rm_to_reclen(guint krb_rm);
62
63 void
64 show_krb_recordmark(proto_tree *tree, tvbuff_t *tvb, gint start, guint32 krb_rm);
65
66 #ifdef HAVE_KERBEROS
67 #define KRB_MAX_ORIG_LEN        256
68
69 #if defined(HAVE_HEIMDAL_KERBEROS) || defined(HAVE_MIT_KERBEROS)
70 typedef struct _enc_key_t {
71         struct _enc_key_t       *next;
72         int keytype;
73         int keylength;
74         char *keyvalue;
75         char                    key_origin[KRB_MAX_ORIG_LEN+1];
76         int fd_num; /* remember where we learned a key */
77 } enc_key_t;
78 extern enc_key_t *enc_key_list;
79
80 guint8 *
81 decrypt_krb5_data(proto_tree *tree, packet_info *pinfo,
82                         int usage,
83                         tvbuff_t *crypototvb,
84                         int keytype,
85                         int *datalen);
86
87 #endif /* HAVE_HEIMDAL_KERBEROS || HAVE_MIT_KERBEROS */
88
89 extern gboolean krb_decrypt;
90
91 WS_DLL_PUBLIC
92 void read_keytab_file_from_preferences(void);
93
94 #endif /* HAVE_KERBEROS */
95
96 #endif /* __PACKET_KERBEROS_H */