fix pkinit
[metze/wireshark/wip.git] / epan / dissectors / asn1 / pkinit / packet-pkinit-template.c
1 /* packet-pkinit.c
2  * Routines for PKINIT packet dissection
3  *  Ronnie Sahlberg 2004
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
11
12 #include "config.h"
13
14 #include <epan/packet.h>
15 #include <epan/asn1.h>
16
17 #include "packet-ber.h"
18 #include "packet-pkinit.h"
19 #include "packet-cms.h"
20 #include "packet-pkix1explicit.h"
21 #include "packet-kerberos.h"
22
23 #define PNAME  "PKINIT"
24 #define PSNAME "PKInit"
25 #define PFNAME "pkinit"
26
27 void proto_register_pkinit(void);
28 void proto_reg_handoff_pkinit(void);
29
30 /* Initialize the protocol and registered fields */
31 static int proto_pkinit = -1;
32 #include "packet-pkinit-hf.c"
33
34 /* Initialize the subtree pointers */
35 #include "packet-pkinit-ett.c"
36
37 static int dissect_KerberosV5Spec2_KerberosTime(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,  asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_);
38 static int dissect_KerberosV5Spec2_Realm(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,  asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_);
39 static int dissect_KerberosV5Spec2_PrincipalName(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,  asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_);
40 static int dissect_pkinit_PKAuthenticator_Win2k(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
41
42 #include "packet-pkinit-fn.c"
43
44 int
45 dissect_pkinit_PA_PK_AS_REQ(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) {
46   offset = dissect_pkinit_PaPkAsReq(FALSE, tvb, offset, actx, tree, -1);
47   return offset;
48 }
49
50 int
51 dissect_pkinit_PA_PK_AS_REP(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) {
52   offset = dissect_pkinit_PaPkAsRep(FALSE, tvb, offset, actx, tree, -1);
53   return offset;
54 }
55
56 static int
57 dissect_KerberosV5Spec2_KerberosTime(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) {
58   offset = dissect_krb5_ctime(tree, tvb, offset, actx);
59   return offset;
60 }
61
62 static int
63 dissect_KerberosV5Spec2_Realm(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) {
64   offset = dissect_krb5_realm(tree, tvb, offset, actx);
65   return offset;
66 }
67
68 static int
69 dissect_KerberosV5Spec2_PrincipalName(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) {
70   offset = dissect_krb5_cname(tree, tvb, offset, actx);
71   return offset;
72 }
73
74
75 /*--- proto_register_pkinit ----------------------------------------------*/
76 void proto_register_pkinit(void) {
77
78   /* List of fields */
79   static hf_register_info hf[] = {
80 #include "packet-pkinit-hfarr.c"
81   };
82
83   /* List of subtrees */
84   static gint *ett[] = {
85 #include "packet-pkinit-ettarr.c"
86   };
87
88   /* Register protocol */
89   proto_pkinit = proto_register_protocol(PNAME, PSNAME, PFNAME);
90
91   /* Register fields and subtrees */
92   proto_register_field_array(proto_pkinit, hf, array_length(hf));
93   proto_register_subtree_array(ett, array_length(ett));
94
95 }
96
97
98 /*--- proto_reg_handoff_pkinit -------------------------------------------*/
99 void proto_reg_handoff_pkinit(void) {
100 #include "packet-pkinit-dis-tab.c"
101 }
102