1 /* Do not modify this file. */
2 /* It is created automatically by the ASN.1 to Ethereal dissector compiler */
3 /* ./packet-pkix1explicit.c */
4 /* ../../tools/asn2eth.py -e -X -b -p pkix1explicit -c pkix1explicit.cnf -s packet-pkix1explicit-template PKIX1EXPLICIT93.asn */
6 /* Input file: packet-pkix1explicit-template.c */
8 #define BER_UNI_TAG_TeletexString 20 /* workaround bug in asn2eth */
10 /* packet-pkix1explicit.c
11 * Routines for PKIX1Explitic packet dissection
13 * $Id: packet-pkix1explicit-template.c 12203 2004-10-05 09:18:55Z guy $
15 * Ethereal - Network traffic analyzer
16 * By Gerald Combs <gerald@ethereal.com>
17 * Copyright 1998 Gerald Combs
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version 2
22 * of the License, or (at your option) any later version.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
39 #include <epan/packet.h>
40 #include <epan/conversation.h>
45 #include "packet-ber.h"
46 #include "packet-pkix1explicit.h"
47 #include "packet-x509af.h"
48 #include "packet-x509if.h"
50 #define PNAME "PKIX1Explitit"
51 #define PSNAME "PKIX1EXPLICIT"
52 #define PFNAME "pkix1explicit"
54 /* Initialize the protocol and registered fields */
55 static int proto_pkix1explicit = -1;
57 /*--- Included file: packet-pkix1explicit-hf.c ---*/
59 static int hf_pkix1explicit_DomainParameters_PDU = -1; /* DomainParameters */
60 static int hf_pkix1explicit_p = -1; /* INTEGER */
61 static int hf_pkix1explicit_g = -1; /* INTEGER */
62 static int hf_pkix1explicit_q = -1; /* INTEGER */
63 static int hf_pkix1explicit_j = -1; /* INTEGER */
64 static int hf_pkix1explicit_validationParms = -1; /* ValidationParms */
65 static int hf_pkix1explicit_seed = -1; /* BIT_STRING */
66 static int hf_pkix1explicit_pgenCounter = -1; /* INTEGER */
67 static int hf_pkix1explicit_type = -1; /* TeletexString */
68 static int hf_pkix1explicit_value = -1; /* TeletexString */
70 /*--- End of included file: packet-pkix1explicit-hf.c ---*/
73 /* Initialize the subtree pointers */
75 /*--- Included file: packet-pkix1explicit-ett.c ---*/
77 static gint ett_pkix1explicit_DomainParameters = -1;
78 static gint ett_pkix1explicit_ValidationParms = -1;
79 static gint ett_pkix1explicit_TeletexDomainDefinedAttribute = -1;
81 /*--- End of included file: packet-pkix1explicit-ett.c ---*/
86 dissect_pkix1explicit_CertificateSerialNumber(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
87 offset = dissect_x509af_CertificateSerialNumber(implicit_tag, tvb, offset, pinfo, tree, hf_index);
93 dissect_pkix1explicit_Name(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index) {
94 offset = dissect_x509if_Name(implicit_tag, tvb, offset, pinfo, tree, hf_index);
100 dissect_pkix1explicit_AlgorithmIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
101 offset = dissect_x509af_AlgorithmIdentifier(implicit_tag, tvb, offset, pinfo, tree, hf_index);
107 dissect_pkix1explicit_SubjectPublicKeyInfo(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index) {
108 offset = dissect_x509af_SubjectPublicKeyInfo(implicit_tag, tvb, offset, pinfo, tree, hf_index);
115 /*--- Included file: packet-pkix1explicit-fn.c ---*/
117 /*--- Fields for imported types ---*/
124 dissect_pkix1explicit_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
125 offset = dissect_ber_integer(pinfo, tree, tvb, offset, hf_index, NULL);
129 static int dissect_p(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
130 return dissect_pkix1explicit_INTEGER(FALSE, tvb, offset, pinfo, tree, hf_pkix1explicit_p);
132 static int dissect_g(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
133 return dissect_pkix1explicit_INTEGER(FALSE, tvb, offset, pinfo, tree, hf_pkix1explicit_g);
135 static int dissect_q(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
136 return dissect_pkix1explicit_INTEGER(FALSE, tvb, offset, pinfo, tree, hf_pkix1explicit_q);
138 static int dissect_j(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
139 return dissect_pkix1explicit_INTEGER(FALSE, tvb, offset, pinfo, tree, hf_pkix1explicit_j);
141 static int dissect_pgenCounter(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
142 return dissect_pkix1explicit_INTEGER(FALSE, tvb, offset, pinfo, tree, hf_pkix1explicit_pgenCounter);
147 dissect_pkix1explicit_BIT_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
148 offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
154 static int dissect_seed(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
155 return dissect_pkix1explicit_BIT_STRING(FALSE, tvb, offset, pinfo, tree, hf_pkix1explicit_seed);
158 static const ber_sequence ValidationParms_sequence[] = {
159 { BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_NOOWNTAG, dissect_seed },
160 { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_pgenCounter },
165 dissect_pkix1explicit_ValidationParms(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
166 offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
167 ValidationParms_sequence, hf_index, ett_pkix1explicit_ValidationParms);
171 static int dissect_validationParms(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
172 return dissect_pkix1explicit_ValidationParms(FALSE, tvb, offset, pinfo, tree, hf_pkix1explicit_validationParms);
175 static const ber_sequence DomainParameters_sequence[] = {
176 { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_p },
177 { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_g },
178 { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_q },
179 { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_j },
180 { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_validationParms },
185 dissect_pkix1explicit_DomainParameters(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
186 offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
187 DomainParameters_sequence, hf_index, ett_pkix1explicit_DomainParameters);
193 const value_string TerminalType_vals[] = {
196 { 5, "g3-facsimile" },
197 { 6, "g4-facsimile" },
198 { 7, "ia5-terminal" },
205 dissect_pkix1explicit_TerminalType(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
206 offset = dissect_ber_integer(pinfo, tree, tvb, offset, hf_index, NULL);
213 dissect_pkix1explicit_TeletexString(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
214 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_TeletexString,
215 pinfo, tree, tvb, offset, hf_index,
220 static int dissect_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
221 return dissect_pkix1explicit_TeletexString(FALSE, tvb, offset, pinfo, tree, hf_pkix1explicit_type);
223 static int dissect_value(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
224 return dissect_pkix1explicit_TeletexString(FALSE, tvb, offset, pinfo, tree, hf_pkix1explicit_value);
227 static const ber_sequence TeletexDomainDefinedAttribute_sequence[] = {
228 { BER_CLASS_UNI, BER_UNI_TAG_TeletexString, BER_FLAGS_NOOWNTAG, dissect_type },
229 { BER_CLASS_UNI, BER_UNI_TAG_TeletexString, BER_FLAGS_NOOWNTAG, dissect_value },
234 dissect_pkix1explicit_TeletexDomainDefinedAttribute(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
235 offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
236 TeletexDomainDefinedAttribute_sequence, hf_index, ett_pkix1explicit_TeletexDomainDefinedAttribute);
243 static void dissect_DomainParameters_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
244 dissect_pkix1explicit_DomainParameters(FALSE, tvb, 0, pinfo, tree, hf_pkix1explicit_DomainParameters_PDU);
248 /*--- End of included file: packet-pkix1explicit-fn.c ---*/
252 /*--- proto_register_pkix1explicit ----------------------------------------------*/
253 void proto_register_pkix1explicit(void) {
256 static hf_register_info hf[] = {
258 /*--- Included file: packet-pkix1explicit-hfarr.c ---*/
260 { &hf_pkix1explicit_DomainParameters_PDU,
261 { "DomainParameters", "pkix1explicit.DomainParameters",
262 FT_NONE, BASE_NONE, NULL, 0,
263 "DomainParameters", HFILL }},
264 { &hf_pkix1explicit_p,
265 { "p", "pkix1explicit.p",
266 FT_INT32, BASE_DEC, NULL, 0,
267 "DomainParameters/p", HFILL }},
268 { &hf_pkix1explicit_g,
269 { "g", "pkix1explicit.g",
270 FT_INT32, BASE_DEC, NULL, 0,
271 "DomainParameters/g", HFILL }},
272 { &hf_pkix1explicit_q,
273 { "q", "pkix1explicit.q",
274 FT_INT32, BASE_DEC, NULL, 0,
275 "DomainParameters/q", HFILL }},
276 { &hf_pkix1explicit_j,
277 { "j", "pkix1explicit.j",
278 FT_INT32, BASE_DEC, NULL, 0,
279 "DomainParameters/j", HFILL }},
280 { &hf_pkix1explicit_validationParms,
281 { "validationParms", "pkix1explicit.validationParms",
282 FT_NONE, BASE_NONE, NULL, 0,
283 "DomainParameters/validationParms", HFILL }},
284 { &hf_pkix1explicit_seed,
285 { "seed", "pkix1explicit.seed",
286 FT_BYTES, BASE_HEX, NULL, 0,
287 "ValidationParms/seed", HFILL }},
288 { &hf_pkix1explicit_pgenCounter,
289 { "pgenCounter", "pkix1explicit.pgenCounter",
290 FT_INT32, BASE_DEC, NULL, 0,
291 "ValidationParms/pgenCounter", HFILL }},
292 { &hf_pkix1explicit_type,
293 { "type", "pkix1explicit.type",
294 FT_STRING, BASE_NONE, NULL, 0,
295 "TeletexDomainDefinedAttribute/type", HFILL }},
296 { &hf_pkix1explicit_value,
297 { "value", "pkix1explicit.value",
298 FT_STRING, BASE_NONE, NULL, 0,
299 "TeletexDomainDefinedAttribute/value", HFILL }},
301 /*--- End of included file: packet-pkix1explicit-hfarr.c ---*/
305 /* List of subtrees */
306 static gint *ett[] = {
308 /*--- Included file: packet-pkix1explicit-ettarr.c ---*/
310 &ett_pkix1explicit_DomainParameters,
311 &ett_pkix1explicit_ValidationParms,
312 &ett_pkix1explicit_TeletexDomainDefinedAttribute,
314 /*--- End of included file: packet-pkix1explicit-ettarr.c ---*/
318 /* Register protocol */
319 proto_pkix1explicit = proto_register_protocol(PNAME, PSNAME, PFNAME);
321 /* Register fields and subtrees */
322 proto_register_field_array(proto_pkix1explicit, hf, array_length(hf));
323 proto_register_subtree_array(ett, array_length(ett));
328 /*--- proto_reg_handoff_pkix1explicit -------------------------------------------*/
329 void proto_reg_handoff_pkix1explicit(void) {
331 /*--- Included file: packet-pkix1explicit-dis-tab.c ---*/
333 register_ber_oid_dissector("1.2.840.10046.2.1", dissect_DomainParameters_PDU, proto_pkix1explicit, "dhpublicnumber");
336 /*--- End of included file: packet-pkix1explicit-dis-tab.c ---*/