1 /* Do not modify this file. Changes will be overwritten. */
2 /* Generated automatically by the ASN.1 to Wireshark dissector compiler */
3 /* packet-kerberos.h */
4 /* asn2wrs.py -b -q -L -p kerberos -c ./kerberos.cnf -s ./packet-kerberos-template -D . -O ../.. KerberosV5Spec2.asn k5.asn RFC3244.asn RFC6113.asn SPAKE.asn */
7 * Routines for kerberos packet dissection
8 * Copyright 2007, Anders Broman <anders.broman@ericsson.com>
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * SPDX-License-Identifier: GPL-2.0-or-later
17 #ifndef __PACKET_KERBEROS_H
18 #define __PACKET_KERBEROS_H
20 #include "ws_symbol_export.h"
24 #endif /* __cplusplus */
26 #ifndef KRB5_KU_USAGE_ACCEPTOR_SEAL
27 #define KRB5_KU_USAGE_ACCEPTOR_SEAL 22
29 #ifndef KRB5_KU_USAGE_ACCEPTOR_SIGN
30 #define KRB5_KU_USAGE_ACCEPTOR_SIGN 23
32 #ifndef KRB5_KU_USAGE_INITIATOR_SEAL
33 #define KRB5_KU_USAGE_INITIATOR_SEAL 24
35 #ifndef KRB5_KU_USAGE_INITIATOR_SIGN
36 #define KRB5_KU_USAGE_INITIATOR_SIGN 25
39 /* This is a list of callback functions a caller can use to specify that
40 octet strings in kerberos to be passed back to application specific
41 dissectors, outside of kerberos.
42 This is used for dissection of application specific data for PacketCable
43 KRB_SAFE user data and eventually to pass kerberos session keys
44 to future DCERPC decryption and other uses.
45 The list is terminated by {0, NULL }
47 #define KRB_CBTAG_SAFE_USER_DATA 1
48 #define KRB_CBTAG_PRIV_USER_DATA 2
49 typedef struct _kerberos_callbacks
{
51 int (*callback
)(packet_info
*pinfo
, tvbuff_t
*tvb
, proto_tree
*tree
);
54 #include <epan/asn1.h>
56 /* Function prototypes */
59 dissect_krb5_PAC_NDRHEADERBLOB(proto_tree
*parent_tree
, tvbuff_t
*tvb
, int offset
, uint8_t *drep
);
62 kerberos_is_win2k_pkinit(asn1_ctx_t
*actx
);
65 dissect_kerberos_main(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, bool do_col_info
, kerberos_callbacks
*cb
);
68 dissect_krb5_Checksum(proto_tree
*tree
, tvbuff_t
*tvb
, int offset
, asn1_ctx_t
*actx _U_
);
71 dissect_krb5_ctime(proto_tree
*tree
, tvbuff_t
*tvb
, int offset
, asn1_ctx_t
*actx _U_
);
73 int dissect_krb5_cname(proto_tree
*tree
, tvbuff_t
*tvb
, int offset
, asn1_ctx_t
*actx _U_
);
74 int dissect_krb5_realm(proto_tree
*tree
, tvbuff_t
*tvb
, int offset
, asn1_ctx_t
*actx _U_
);
75 uint32_t kerberos_output_keytype(void);
77 unsigned get_krb_pdu_len(packet_info
*, tvbuff_t
*tvb
, int offset
, void *data _U_
);
79 int kerberos_rm_to_reclen(unsigned krb_rm
);
82 show_krb_recordmark(proto_tree
*tree
, tvbuff_t
*tvb
, int start
, uint32_t krb_rm
);
85 dissect_kerberos_KERB_TICKET_LOGON(tvbuff_t
*tvb
, int offset
, asn1_ctx_t
*actx
, proto_tree
*tree
);
88 #define KRB_MAX_ORIG_LEN 256
89 #define KRB_MAX_KEY_LENGTH 32
91 * "18446744073709551615.18446744073709551615"
92 * sizeof("18446744073709551615") includes '\0',
93 * which is used once for '.' and then for '\0'.
95 * And we add some spare space for a prefix...
97 #define KRB_MAX_ID_STR_LEN (sizeof("18446744073709551615")*3)
99 #if defined(HAVE_HEIMDAL_KERBEROS) || defined(HAVE_MIT_KERBEROS)
100 typedef struct _enc_key_t
{
101 struct _enc_key_t
*next
;
104 uint8_t keyvalue
[KRB_MAX_KEY_LENGTH
];
105 char key_origin
[KRB_MAX_ORIG_LEN
+1];
106 int fd_num
; /* remember where we learned a key */
107 unsigned id
; /* a unique id of the key, relative to fd_num */
108 char id_str
[KRB_MAX_ID_STR_LEN
+1];
109 /* EncTicketPart_key */
111 /* EncAPRepPart_subkey */
114 * for now taken from dissect_krb5_PAC_UPN_DNS_INFO,
115 * we could also use dissect_krb5_PAC_LOGON_INFO if needed
117 * we get device_sid from dissect_krb5_PAC_DEVICE_INFO if available.
119 * We remember these from the PAC and
120 * attach it to EncTicketPart_key so it
121 * might be valid if is_ticket_key is true.
123 * When learning a EncAPRepPart_subkey
124 * we copy the details from the EncTicketPart_key,
125 * so when is_ap_rep_key is true we may also have it.
127 * So application protocols like SMB2 could use the
128 * is_ap_rep_key=true key details in order to identify
129 * the authenticated user.
132 const char *account_name
;
133 const char *account_domain
;
134 const char *account_sid
;
135 const char *device_sid
;
137 struct _enc_key_t
*same_list
;
139 struct _enc_key_t
*src1
;
140 struct _enc_key_t
*src2
;
142 extern enc_key_t
*enc_key_list
;
143 extern enc_key_t
*kerberos_last_decryption_key
;
144 extern wmem_map_t
*kerberos_longterm_keys
;
147 kerberos_inject_longterm_key(packet_info
*pinfo
,
148 proto_tree
*key_tree
,
149 proto_item
*key_hidden_item
,
151 int keytype
, int keylength
, const uint8_t *keyvalue
,
155 decrypt_krb5_data(proto_tree
*tree
, packet_info
*pinfo
,
157 tvbuff_t
*crypototvb
,
162 decrypt_krb5_krb_cfx_dce(proto_tree
*tree
,
166 tvbuff_t
*gssapi_header_tvb
,
167 tvbuff_t
*gssapi_encrypted_tvb
,
168 tvbuff_t
*gssapi_trailer_tvb
,
169 tvbuff_t
*checksum_tvb
);
171 #endif /* HAVE_HEIMDAL_KERBEROS || HAVE_MIT_KERBEROS */
173 extern bool krb_decrypt
;
175 #endif /* HAVE_KERBEROS */
179 #endif /* __cplusplus */
182 /* enumerated values for Applications */
183 #define KERBEROS_APPLICATIONS_TICKET 1
184 #define KERBEROS_APPLICATIONS_AUTHENTICATOR 2
185 #define KERBEROS_APPLICATIONS_ENCTICKETPART 3
186 #define KERBEROS_APPLICATIONS_AS_REQ 10
187 #define KERBEROS_APPLICATIONS_AS_REP 11
188 #define KERBEROS_APPLICATIONS_TGS_REQ 12
189 #define KERBEROS_APPLICATIONS_TGS_REP 13
190 #define KERBEROS_APPLICATIONS_AP_REQ 14
191 #define KERBEROS_APPLICATIONS_AP_REP 15
192 #define KERBEROS_APPLICATIONS_KRB_SAFE 20
193 #define KERBEROS_APPLICATIONS_KRB_PRIV 21
194 #define KERBEROS_APPLICATIONS_KRB_CRED 22
195 #define KERBEROS_APPLICATIONS_ENCASREPPART 25
196 #define KERBEROS_APPLICATIONS_ENCTGSREPPART 26
197 #define KERBEROS_APPLICATIONS_ENCAPREPPART 27
198 #define KERBEROS_APPLICATIONS_ENCKRBPRIVPART 28
199 #define KERBEROS_APPLICATIONS_ENCKRBCREDPART 29
200 #define KERBEROS_APPLICATIONS_KRB_ERROR 30
201 int dissect_kerberos_TGT_REQ(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
);
202 int dissect_kerberos_TGT_REP(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
);
203 int dissect_kerberos_ChangePasswdData(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
);
205 #endif /* __PACKET_KERBEROS_H */