waste a couple of bytes per tcp conversation and make the tree for acked_packets...
[obnox/wireshark/wip.git] / epan / dissectors / packet-cmp.c
1 /* Do not modify this file.                                                   */
2 /* It is created automatically by the ASN.1 to Ethereal dissector compiler    */
3 /* ./packet-cmp.c                                                             */
4 /* ../../tools/asn2eth.py -X -b -e -p cmp -c cmp.cnf -s packet-cmp-template CMP.asn */
5
6 /* Input file: packet-cmp-template.c */
7
8 #line 1 "packet-cmp-template.c"
9 /* packet-cmp.c
10  * Routines for RFC2510 Certificate Management Protocol packet dissection
11  *   Ronnie Sahlberg 2004
12  *
13  * $Id$
14  *
15  * Ethereal - Network traffic analyzer
16  * By Gerald Combs <gerald@ethereal.com>
17  * Copyright 1998 Gerald Combs
18  *
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.
23  *
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.
28  *
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.
32  */
33
34 #ifdef HAVE_CONFIG_H
35 # include "config.h"
36 #endif
37
38 #include <glib.h>
39 #include <epan/packet.h>
40 #include <epan/conversation.h>
41
42 #include <stdio.h>
43 #include <string.h>
44
45 #include "packet-ber.h"
46 #include "packet-cmp.h"
47 #include "packet-crmf.h"
48 #include "packet-pkix1explicit.h"
49 #include "packet-pkix1implicit.h"
50 #include <epan/emem.h>
51 #include "packet-tcp.h"
52 #include <epan/prefs.h>
53 #include <epan/nstime.h>
54
55 #define PNAME  "Certificate Management Protocol"
56 #define PSNAME "CMP"
57 #define PFNAME "cmp"
58
59 #define TCP_PORT_CMP 829
60
61 /* desegmentation of CMP over TCP */
62 static gboolean cmp_desegment = TRUE;
63
64 /* Initialize the protocol and registered fields */
65 int proto_cmp = -1;
66 static int hf_cmp_type_oid = -1;
67 static int hf_cmp_rm = -1;
68 static int hf_cmp_type = -1;
69 static int hf_cmp_poll_ref = -1;
70 static int hf_cmp_next_poll_ref = -1;
71 static int hf_cmp_ttcb = -1;
72
73 /*--- Included file: packet-cmp-hf.c ---*/
74 #line 1 "packet-cmp-hf.c"
75 static int hf_cmp_header = -1;                    /* PKIHeader */
76 static int hf_cmp_body = -1;                      /* PKIBody */
77 static int hf_cmp_protection = -1;                /* PKIProtection */
78 static int hf_cmp_extraCerts = -1;                /* SEQUENCE_SIZE_1_MAX_OF_Certificate */
79 static int hf_cmp_extraCerts_item = -1;           /* Certificate */
80 static int hf_cmp_pvno = -1;                      /* T_pvno */
81 static int hf_cmp_sender = -1;                    /* GeneralName */
82 static int hf_cmp_recipient = -1;                 /* GeneralName */
83 static int hf_cmp_messageTime = -1;               /* GeneralizedTime */
84 static int hf_cmp_protectionAlg = -1;             /* AlgorithmIdentifier */
85 static int hf_cmp_senderKID = -1;                 /* KeyIdentifier */
86 static int hf_cmp_recipKID = -1;                  /* KeyIdentifier */
87 static int hf_cmp_transactionID = -1;             /* OCTET_STRING */
88 static int hf_cmp_senderNonce = -1;               /* OCTET_STRING */
89 static int hf_cmp_recipNonce = -1;                /* OCTET_STRING */
90 static int hf_cmp_freeText = -1;                  /* PKIFreeText */
91 static int hf_cmp_generalInfo = -1;               /* SEQUENCE_SIZE_1_MAX_OF_InfoTypeAndValue */
92 static int hf_cmp_generalInfo_item = -1;          /* InfoTypeAndValue */
93 static int hf_cmp_PKIFreeText_item = -1;          /* UTF8String */
94 static int hf_cmp_ir = -1;                        /* CertReqMessages */
95 static int hf_cmp_ip = -1;                        /* CertRepMessage */
96 static int hf_cmp_cr = -1;                        /* CertReqMessages */
97 static int hf_cmp_cp = -1;                        /* CertRepMessage */
98 static int hf_cmp_popdecc = -1;                   /* POPODecKeyChallContent */
99 static int hf_cmp_popdecr = -1;                   /* POPODecKeyRespContent */
100 static int hf_cmp_kur = -1;                       /* CertReqMessages */
101 static int hf_cmp_kup = -1;                       /* CertRepMessage */
102 static int hf_cmp_krr = -1;                       /* CertReqMessages */
103 static int hf_cmp_krp = -1;                       /* KeyRecRepContent */
104 static int hf_cmp_rr = -1;                        /* RevReqContent */
105 static int hf_cmp_rp = -1;                        /* RevRepContent */
106 static int hf_cmp_ccr = -1;                       /* CertReqMessages */
107 static int hf_cmp_ccp = -1;                       /* CertRepMessage */
108 static int hf_cmp_ckuann = -1;                    /* CAKeyUpdAnnContent */
109 static int hf_cmp_cann = -1;                      /* CertAnnContent */
110 static int hf_cmp_rann = -1;                      /* RevAnnContent */
111 static int hf_cmp_crlann = -1;                    /* CRLAnnContent */
112 static int hf_cmp_conf = -1;                      /* PKIConfirmContent */
113 static int hf_cmp_nested = -1;                    /* NestedMessageContent */
114 static int hf_cmp_genm = -1;                      /* GenMsgContent */
115 static int hf_cmp_genp = -1;                      /* GenRepContent */
116 static int hf_cmp_error = -1;                     /* ErrorMsgContent */
117 static int hf_cmp_salt = -1;                      /* OCTET_STRING */
118 static int hf_cmp_owf = -1;                       /* AlgorithmIdentifier */
119 static int hf_cmp_iterationCount = -1;            /* INTEGER */
120 static int hf_cmp_mac = -1;                       /* AlgorithmIdentifier */
121 static int hf_cmp_status = -1;                    /* PKIStatus */
122 static int hf_cmp_statusString = -1;              /* PKIFreeText */
123 static int hf_cmp_failInfo = -1;                  /* PKIFailureInfo */
124 static int hf_cmp_hashAlg = -1;                   /* AlgorithmIdentifier */
125 static int hf_cmp_certId = -1;                    /* CertId */
126 static int hf_cmp_hashVal = -1;                   /* BIT_STRING */
127 static int hf_cmp_POPODecKeyChallContent_item = -1;  /* Challenge */
128 static int hf_cmp_witness = -1;                   /* OCTET_STRING */
129 static int hf_cmp_challenge = -1;                 /* OCTET_STRING */
130 static int hf_cmp_POPODecKeyRespContent_item = -1;  /* INTEGER */
131 static int hf_cmp_caPubs = -1;                    /* SEQUENCE_SIZE_1_MAX_OF_Certificate */
132 static int hf_cmp_caPubs_item = -1;               /* Certificate */
133 static int hf_cmp_response = -1;                  /* SEQUENCE_OF_CertResponse */
134 static int hf_cmp_response_item = -1;             /* CertResponse */
135 static int hf_cmp_certReqId = -1;                 /* INTEGER */
136 static int hf_cmp_status1 = -1;                   /* PKIStatusInfo */
137 static int hf_cmp_certifiedKeyPair = -1;          /* CertifiedKeyPair */
138 static int hf_cmp_rspInfo = -1;                   /* OCTET_STRING */
139 static int hf_cmp_certOrEncCert = -1;             /* CertOrEncCert */
140 static int hf_cmp_privateKey = -1;                /* EncryptedValue */
141 static int hf_cmp_publicationInfo = -1;           /* PKIPublicationInfo */
142 static int hf_cmp_certificate = -1;               /* Certificate */
143 static int hf_cmp_encryptedCert = -1;             /* EncryptedValue */
144 static int hf_cmp_newSigCert = -1;                /* Certificate */
145 static int hf_cmp_caCerts = -1;                   /* SEQUENCE_SIZE_1_MAX_OF_Certificate */
146 static int hf_cmp_caCerts_item = -1;              /* Certificate */
147 static int hf_cmp_keyPairHist = -1;               /* SEQUENCE_SIZE_1_MAX_OF_CertifiedKeyPair */
148 static int hf_cmp_keyPairHist_item = -1;          /* CertifiedKeyPair */
149 static int hf_cmp_RevReqContent_item = -1;        /* RevDetails */
150 static int hf_cmp_certDetails = -1;               /* CertTemplate */
151 static int hf_cmp_revocationReason = -1;          /* ReasonFlags */
152 static int hf_cmp_badSinceDate = -1;              /* GeneralizedTime */
153 static int hf_cmp_crlEntryDetails = -1;           /* Extensions */
154 static int hf_cmp_status2 = -1;                   /* SEQUENCE_SIZE_1_MAX_OF_PKIStatusInfo */
155 static int hf_cmp_status_item = -1;               /* PKIStatusInfo */
156 static int hf_cmp_revCerts = -1;                  /* SEQUENCE_SIZE_1_MAX_OF_CertId */
157 static int hf_cmp_revCerts_item = -1;             /* CertId */
158 static int hf_cmp_crls = -1;                      /* SEQUENCE_SIZE_1_MAX_OF_CertificateList */
159 static int hf_cmp_crls_item = -1;                 /* CertificateList */
160 static int hf_cmp_oldWithNew = -1;                /* Certificate */
161 static int hf_cmp_newWithOld = -1;                /* Certificate */
162 static int hf_cmp_newWithNew = -1;                /* Certificate */
163 static int hf_cmp_willBeRevokedAt = -1;           /* GeneralizedTime */
164 static int hf_cmp_crlDetails = -1;                /* Extensions */
165 static int hf_cmp_CRLAnnContent_item = -1;        /* CertificateList */
166 static int hf_cmp_infoType = -1;                  /* T_infoType */
167 static int hf_cmp_infoValue = -1;                 /* T_infoValue */
168 static int hf_cmp_GenMsgContent_item = -1;        /* InfoTypeAndValue */
169 static int hf_cmp_GenRepContent_item = -1;        /* InfoTypeAndValue */
170 static int hf_cmp_pKIStatusInfo = -1;             /* PKIStatusInfo */
171 static int hf_cmp_errorCode = -1;                 /* INTEGER */
172 static int hf_cmp_errorDetails = -1;              /* PKIFreeText */
173 /* named bits */
174 static int hf_cmp_PKIFailureInfo_badAlg = -1;
175 static int hf_cmp_PKIFailureInfo_badMessageCheck = -1;
176 static int hf_cmp_PKIFailureInfo_badRequest = -1;
177 static int hf_cmp_PKIFailureInfo_badTime = -1;
178 static int hf_cmp_PKIFailureInfo_badCertId = -1;
179 static int hf_cmp_PKIFailureInfo_badDataFormat = -1;
180 static int hf_cmp_PKIFailureInfo_wrongAuthority = -1;
181 static int hf_cmp_PKIFailureInfo_incorrectData = -1;
182 static int hf_cmp_PKIFailureInfo_missingTimeStamp = -1;
183 static int hf_cmp_PKIFailureInfo_badPOP = -1;
184
185 /*--- End of included file: packet-cmp-hf.c ---*/
186 #line 65 "packet-cmp-template.c"
187
188 /* Initialize the subtree pointers */
189 static gint ett_cmp = -1;
190
191 /*--- Included file: packet-cmp-ett.c ---*/
192 #line 1 "packet-cmp-ett.c"
193 static gint ett_cmp_PKIMessage = -1;
194 static gint ett_cmp_SEQUENCE_SIZE_1_MAX_OF_Certificate = -1;
195 static gint ett_cmp_PKIHeader = -1;
196 static gint ett_cmp_SEQUENCE_SIZE_1_MAX_OF_InfoTypeAndValue = -1;
197 static gint ett_cmp_PKIFreeText = -1;
198 static gint ett_cmp_PKIBody = -1;
199 static gint ett_cmp_ProtectedPart = -1;
200 static gint ett_cmp_PBMParameter = -1;
201 static gint ett_cmp_DHBMParameter = -1;
202 static gint ett_cmp_PKIFailureInfo = -1;
203 static gint ett_cmp_PKIStatusInfo = -1;
204 static gint ett_cmp_OOBCertHash = -1;
205 static gint ett_cmp_POPODecKeyChallContent = -1;
206 static gint ett_cmp_Challenge = -1;
207 static gint ett_cmp_POPODecKeyRespContent = -1;
208 static gint ett_cmp_CertRepMessage = -1;
209 static gint ett_cmp_SEQUENCE_OF_CertResponse = -1;
210 static gint ett_cmp_CertResponse = -1;
211 static gint ett_cmp_CertifiedKeyPair = -1;
212 static gint ett_cmp_CertOrEncCert = -1;
213 static gint ett_cmp_KeyRecRepContent = -1;
214 static gint ett_cmp_SEQUENCE_SIZE_1_MAX_OF_CertifiedKeyPair = -1;
215 static gint ett_cmp_RevReqContent = -1;
216 static gint ett_cmp_RevDetails = -1;
217 static gint ett_cmp_RevRepContent = -1;
218 static gint ett_cmp_SEQUENCE_SIZE_1_MAX_OF_PKIStatusInfo = -1;
219 static gint ett_cmp_SEQUENCE_SIZE_1_MAX_OF_CertId = -1;
220 static gint ett_cmp_SEQUENCE_SIZE_1_MAX_OF_CertificateList = -1;
221 static gint ett_cmp_CAKeyUpdAnnContent = -1;
222 static gint ett_cmp_RevAnnContent = -1;
223 static gint ett_cmp_CRLAnnContent = -1;
224 static gint ett_cmp_InfoTypeAndValue = -1;
225 static gint ett_cmp_GenMsgContent = -1;
226 static gint ett_cmp_GenRepContent = -1;
227 static gint ett_cmp_ErrorMsgContent = -1;
228
229 /*--- End of included file: packet-cmp-ett.c ---*/
230 #line 69 "packet-cmp-template.c"
231
232 static const char *object_identifier_id;
233
234
235
236 /*--- Included file: packet-cmp-fn.c ---*/
237 #line 1 "packet-cmp-fn.c"
238 /*--- Cyclic dependencies ---*/
239
240 /* PKIMessage -> PKIBody -> NestedMessageContent -> PKIMessage */
241 int dissect_cmp_PKIMessage(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index);
242
243
244
245 /*--- Fields for imported types ---*/
246
247 static int dissect_extraCerts_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
248   return dissect_pkix1explicit_Certificate(FALSE, tvb, offset, pinfo, tree, hf_cmp_extraCerts_item);
249 }
250 static int dissect_sender(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
251   return dissect_pkix1implicit_GeneralName(FALSE, tvb, offset, pinfo, tree, hf_cmp_sender);
252 }
253 static int dissect_recipient(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
254   return dissect_pkix1implicit_GeneralName(FALSE, tvb, offset, pinfo, tree, hf_cmp_recipient);
255 }
256 static int dissect_protectionAlg(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
257   return dissect_pkix1explicit_AlgorithmIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cmp_protectionAlg);
258 }
259 static int dissect_ir(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
260   return dissect_crmf_CertReqMessages(FALSE, tvb, offset, pinfo, tree, hf_cmp_ir);
261 }
262 static int dissect_cr(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
263   return dissect_crmf_CertReqMessages(FALSE, tvb, offset, pinfo, tree, hf_cmp_cr);
264 }
265 static int dissect_kur(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
266   return dissect_crmf_CertReqMessages(FALSE, tvb, offset, pinfo, tree, hf_cmp_kur);
267 }
268 static int dissect_krr(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
269   return dissect_crmf_CertReqMessages(FALSE, tvb, offset, pinfo, tree, hf_cmp_krr);
270 }
271 static int dissect_ccr(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
272   return dissect_crmf_CertReqMessages(FALSE, tvb, offset, pinfo, tree, hf_cmp_ccr);
273 }
274 static int dissect_owf(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
275   return dissect_pkix1explicit_AlgorithmIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cmp_owf);
276 }
277 static int dissect_mac(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
278   return dissect_pkix1explicit_AlgorithmIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cmp_mac);
279 }
280 static int dissect_hashAlg(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
281   return dissect_pkix1explicit_AlgorithmIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cmp_hashAlg);
282 }
283 static int dissect_certId(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
284   return dissect_crmf_CertId(FALSE, tvb, offset, pinfo, tree, hf_cmp_certId);
285 }
286 static int dissect_caPubs_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
287   return dissect_pkix1explicit_Certificate(FALSE, tvb, offset, pinfo, tree, hf_cmp_caPubs_item);
288 }
289 static int dissect_privateKey(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
290   return dissect_crmf_EncryptedValue(FALSE, tvb, offset, pinfo, tree, hf_cmp_privateKey);
291 }
292 static int dissect_publicationInfo(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
293   return dissect_crmf_PKIPublicationInfo(FALSE, tvb, offset, pinfo, tree, hf_cmp_publicationInfo);
294 }
295 static int dissect_certificate(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
296   return dissect_pkix1explicit_Certificate(FALSE, tvb, offset, pinfo, tree, hf_cmp_certificate);
297 }
298 static int dissect_encryptedCert(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
299   return dissect_crmf_EncryptedValue(FALSE, tvb, offset, pinfo, tree, hf_cmp_encryptedCert);
300 }
301 static int dissect_newSigCert(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
302   return dissect_pkix1explicit_Certificate(FALSE, tvb, offset, pinfo, tree, hf_cmp_newSigCert);
303 }
304 static int dissect_caCerts_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
305   return dissect_pkix1explicit_Certificate(FALSE, tvb, offset, pinfo, tree, hf_cmp_caCerts_item);
306 }
307 static int dissect_certDetails(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
308   return dissect_crmf_CertTemplate(FALSE, tvb, offset, pinfo, tree, hf_cmp_certDetails);
309 }
310 static int dissect_revocationReason(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
311   return dissect_pkix1implicit_ReasonFlags(FALSE, tvb, offset, pinfo, tree, hf_cmp_revocationReason);
312 }
313 static int dissect_crlEntryDetails(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
314   return dissect_pkix1explicit_Extensions(FALSE, tvb, offset, pinfo, tree, hf_cmp_crlEntryDetails);
315 }
316 static int dissect_revCerts_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
317   return dissect_crmf_CertId(FALSE, tvb, offset, pinfo, tree, hf_cmp_revCerts_item);
318 }
319 static int dissect_crls_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
320   return dissect_pkix1explicit_CertificateList(FALSE, tvb, offset, pinfo, tree, hf_cmp_crls_item);
321 }
322 static int dissect_oldWithNew(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
323   return dissect_pkix1explicit_Certificate(FALSE, tvb, offset, pinfo, tree, hf_cmp_oldWithNew);
324 }
325 static int dissect_newWithOld(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
326   return dissect_pkix1explicit_Certificate(FALSE, tvb, offset, pinfo, tree, hf_cmp_newWithOld);
327 }
328 static int dissect_newWithNew(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
329   return dissect_pkix1explicit_Certificate(FALSE, tvb, offset, pinfo, tree, hf_cmp_newWithNew);
330 }
331 static int dissect_crlDetails(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
332   return dissect_pkix1explicit_Extensions(FALSE, tvb, offset, pinfo, tree, hf_cmp_crlDetails);
333 }
334 static int dissect_CRLAnnContent_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
335   return dissect_pkix1explicit_CertificateList(FALSE, tvb, offset, pinfo, tree, hf_cmp_CRLAnnContent_item);
336 }
337
338
339
340 static int
341 dissect_cmp_KeyIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
342   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
343                                        NULL);
344
345   return offset;
346 }
347 static int dissect_senderKID(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
348   return dissect_cmp_KeyIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cmp_senderKID);
349 }
350 static int dissect_recipKID(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
351   return dissect_cmp_KeyIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cmp_recipKID);
352 }
353
354
355 static const value_string cmp_T_pvno_vals[] = {
356   {   1, "ietf-version2" },
357   { 0, NULL }
358 };
359
360
361 static int
362 dissect_cmp_T_pvno(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
363   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
364                                   NULL);
365
366   return offset;
367 }
368 static int dissect_pvno(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
369   return dissect_cmp_T_pvno(FALSE, tvb, offset, pinfo, tree, hf_cmp_pvno);
370 }
371
372
373
374 static int
375 dissect_cmp_GeneralizedTime(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
376   offset = dissect_ber_GeneralizedTime(implicit_tag, pinfo, tree, tvb, offset, hf_index);
377
378   return offset;
379 }
380 static int dissect_messageTime(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
381   return dissect_cmp_GeneralizedTime(FALSE, tvb, offset, pinfo, tree, hf_cmp_messageTime);
382 }
383 static int dissect_badSinceDate(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
384   return dissect_cmp_GeneralizedTime(FALSE, tvb, offset, pinfo, tree, hf_cmp_badSinceDate);
385 }
386 static int dissect_willBeRevokedAt(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
387   return dissect_cmp_GeneralizedTime(FALSE, tvb, offset, pinfo, tree, hf_cmp_willBeRevokedAt);
388 }
389
390
391
392 static int
393 dissect_cmp_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
394   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
395                                        NULL);
396
397   return offset;
398 }
399 static int dissect_transactionID(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
400   return dissect_cmp_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cmp_transactionID);
401 }
402 static int dissect_senderNonce(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
403   return dissect_cmp_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cmp_senderNonce);
404 }
405 static int dissect_recipNonce(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
406   return dissect_cmp_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cmp_recipNonce);
407 }
408 static int dissect_salt(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
409   return dissect_cmp_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cmp_salt);
410 }
411 static int dissect_witness(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
412   return dissect_cmp_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cmp_witness);
413 }
414 static int dissect_challenge(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
415   return dissect_cmp_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cmp_challenge);
416 }
417 static int dissect_rspInfo(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
418   return dissect_cmp_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cmp_rspInfo);
419 }
420
421
422
423 static int
424 dissect_cmp_UTF8String(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
425   offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_UTF8String,
426                                             pinfo, tree, tvb, offset, hf_index,
427                                             NULL);
428
429   return offset;
430 }
431 static int dissect_PKIFreeText_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
432   return dissect_cmp_UTF8String(FALSE, tvb, offset, pinfo, tree, hf_cmp_PKIFreeText_item);
433 }
434
435
436 static const ber_sequence_t PKIFreeText_sequence_of[1] = {
437   { BER_CLASS_UNI, BER_UNI_TAG_UTF8String, BER_FLAGS_NOOWNTAG, dissect_PKIFreeText_item },
438 };
439
440 int
441 dissect_cmp_PKIFreeText(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
442   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
443                                       PKIFreeText_sequence_of, hf_index, ett_cmp_PKIFreeText);
444
445   return offset;
446 }
447 static int dissect_freeText(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
448   return dissect_cmp_PKIFreeText(FALSE, tvb, offset, pinfo, tree, hf_cmp_freeText);
449 }
450 static int dissect_statusString(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
451   return dissect_cmp_PKIFreeText(FALSE, tvb, offset, pinfo, tree, hf_cmp_statusString);
452 }
453 static int dissect_errorDetails(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
454   return dissect_cmp_PKIFreeText(FALSE, tvb, offset, pinfo, tree, hf_cmp_errorDetails);
455 }
456
457
458
459 static int
460 dissect_cmp_T_infoType(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
461   offset = dissect_ber_object_identifier_str(implicit_tag, pinfo, tree, tvb, offset, hf_cmp_type_oid, &object_identifier_id);
462
463   return offset;
464 }
465 static int dissect_infoType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
466   return dissect_cmp_T_infoType(FALSE, tvb, offset, pinfo, tree, hf_cmp_infoType);
467 }
468
469
470
471 static int
472 dissect_cmp_T_infoValue(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
473 #line 66 "cmp.cnf"
474   offset=call_ber_oid_callback(object_identifier_id, tvb, offset, pinfo, tree);
475
476
477
478   return offset;
479 }
480 static int dissect_infoValue(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
481   return dissect_cmp_T_infoValue(FALSE, tvb, offset, pinfo, tree, hf_cmp_infoValue);
482 }
483
484
485 static const ber_sequence_t InfoTypeAndValue_sequence[] = {
486   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_infoType },
487   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_infoValue },
488   { 0, 0, 0, NULL }
489 };
490
491 int
492 dissect_cmp_InfoTypeAndValue(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
493   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
494                                    InfoTypeAndValue_sequence, hf_index, ett_cmp_InfoTypeAndValue);
495
496   return offset;
497 }
498 static int dissect_generalInfo_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
499   return dissect_cmp_InfoTypeAndValue(FALSE, tvb, offset, pinfo, tree, hf_cmp_generalInfo_item);
500 }
501 static int dissect_GenMsgContent_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
502   return dissect_cmp_InfoTypeAndValue(FALSE, tvb, offset, pinfo, tree, hf_cmp_GenMsgContent_item);
503 }
504 static int dissect_GenRepContent_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
505   return dissect_cmp_InfoTypeAndValue(FALSE, tvb, offset, pinfo, tree, hf_cmp_GenRepContent_item);
506 }
507
508
509 static const ber_sequence_t SEQUENCE_SIZE_1_MAX_OF_InfoTypeAndValue_sequence_of[1] = {
510   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_generalInfo_item },
511 };
512
513 static int
514 dissect_cmp_SEQUENCE_SIZE_1_MAX_OF_InfoTypeAndValue(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
515   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
516                                       SEQUENCE_SIZE_1_MAX_OF_InfoTypeAndValue_sequence_of, hf_index, ett_cmp_SEQUENCE_SIZE_1_MAX_OF_InfoTypeAndValue);
517
518   return offset;
519 }
520 static int dissect_generalInfo(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
521   return dissect_cmp_SEQUENCE_SIZE_1_MAX_OF_InfoTypeAndValue(FALSE, tvb, offset, pinfo, tree, hf_cmp_generalInfo);
522 }
523
524
525 static const ber_sequence_t PKIHeader_sequence[] = {
526   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_pvno },
527   { BER_CLASS_CON, -1/*choice*/, BER_FLAGS_NOOWNTAG, dissect_sender },
528   { BER_CLASS_CON, -1/*choice*/, BER_FLAGS_NOOWNTAG, dissect_recipient },
529   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_messageTime },
530   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_protectionAlg },
531   { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL, dissect_senderKID },
532   { BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL, dissect_recipKID },
533   { BER_CLASS_CON, 4, BER_FLAGS_OPTIONAL, dissect_transactionID },
534   { BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL, dissect_senderNonce },
535   { BER_CLASS_CON, 6, BER_FLAGS_OPTIONAL, dissect_recipNonce },
536   { BER_CLASS_CON, 7, BER_FLAGS_OPTIONAL, dissect_freeText },
537   { BER_CLASS_CON, 8, BER_FLAGS_OPTIONAL, dissect_generalInfo },
538   { 0, 0, 0, NULL }
539 };
540
541 int
542 dissect_cmp_PKIHeader(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
543   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
544                                    PKIHeader_sequence, hf_index, ett_cmp_PKIHeader);
545
546   return offset;
547 }
548 static int dissect_header(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
549   return dissect_cmp_PKIHeader(FALSE, tvb, offset, pinfo, tree, hf_cmp_header);
550 }
551
552
553 static const ber_sequence_t SEQUENCE_SIZE_1_MAX_OF_Certificate_sequence_of[1] = {
554   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_extraCerts_item },
555 };
556
557 static int
558 dissect_cmp_SEQUENCE_SIZE_1_MAX_OF_Certificate(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
559   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
560                                       SEQUENCE_SIZE_1_MAX_OF_Certificate_sequence_of, hf_index, ett_cmp_SEQUENCE_SIZE_1_MAX_OF_Certificate);
561
562   return offset;
563 }
564 static int dissect_extraCerts(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
565   return dissect_cmp_SEQUENCE_SIZE_1_MAX_OF_Certificate(FALSE, tvb, offset, pinfo, tree, hf_cmp_extraCerts);
566 }
567 static int dissect_caPubs(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
568   return dissect_cmp_SEQUENCE_SIZE_1_MAX_OF_Certificate(FALSE, tvb, offset, pinfo, tree, hf_cmp_caPubs);
569 }
570 static int dissect_caCerts(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
571   return dissect_cmp_SEQUENCE_SIZE_1_MAX_OF_Certificate(FALSE, tvb, offset, pinfo, tree, hf_cmp_caCerts);
572 }
573
574
575
576 static int
577 dissect_cmp_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
578   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
579                                   NULL);
580
581   return offset;
582 }
583 static int dissect_iterationCount(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
584   return dissect_cmp_INTEGER(FALSE, tvb, offset, pinfo, tree, hf_cmp_iterationCount);
585 }
586 static int dissect_POPODecKeyRespContent_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
587   return dissect_cmp_INTEGER(FALSE, tvb, offset, pinfo, tree, hf_cmp_POPODecKeyRespContent_item);
588 }
589 static int dissect_certReqId(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
590   return dissect_cmp_INTEGER(FALSE, tvb, offset, pinfo, tree, hf_cmp_certReqId);
591 }
592 static int dissect_errorCode(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
593   return dissect_cmp_INTEGER(FALSE, tvb, offset, pinfo, tree, hf_cmp_errorCode);
594 }
595
596
597 const value_string cmp_PKIStatus_vals[] = {
598   {   0, "granted" },
599   {   1, "grantedWithMods" },
600   {   2, "rejection" },
601   {   3, "waiting" },
602   {   4, "revocationWarning" },
603   {   5, "revocationNotification" },
604   {   6, "keyUpdateWarning" },
605   { 0, NULL }
606 };
607
608
609 int
610 dissect_cmp_PKIStatus(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
611   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
612                                   NULL);
613
614   return offset;
615 }
616 static int dissect_status(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
617   return dissect_cmp_PKIStatus(FALSE, tvb, offset, pinfo, tree, hf_cmp_status);
618 }
619
620
621 static const asn_namedbit PKIFailureInfo_bits[] = {
622   {  0, &hf_cmp_PKIFailureInfo_badAlg, -1, -1, "badAlg", NULL },
623   {  1, &hf_cmp_PKIFailureInfo_badMessageCheck, -1, -1, "badMessageCheck", NULL },
624   {  2, &hf_cmp_PKIFailureInfo_badRequest, -1, -1, "badRequest", NULL },
625   {  3, &hf_cmp_PKIFailureInfo_badTime, -1, -1, "badTime", NULL },
626   {  4, &hf_cmp_PKIFailureInfo_badCertId, -1, -1, "badCertId", NULL },
627   {  5, &hf_cmp_PKIFailureInfo_badDataFormat, -1, -1, "badDataFormat", NULL },
628   {  6, &hf_cmp_PKIFailureInfo_wrongAuthority, -1, -1, "wrongAuthority", NULL },
629   {  7, &hf_cmp_PKIFailureInfo_incorrectData, -1, -1, "incorrectData", NULL },
630   {  8, &hf_cmp_PKIFailureInfo_missingTimeStamp, -1, -1, "missingTimeStamp", NULL },
631   {  9, &hf_cmp_PKIFailureInfo_badPOP, -1, -1, "badPOP", NULL },
632   { 0, NULL, 0, 0, NULL, NULL }
633 };
634
635 int
636 dissect_cmp_PKIFailureInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
637   offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
638                                     PKIFailureInfo_bits, hf_index, ett_cmp_PKIFailureInfo,
639                                     NULL);
640
641   return offset;
642 }
643 static int dissect_failInfo(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
644   return dissect_cmp_PKIFailureInfo(FALSE, tvb, offset, pinfo, tree, hf_cmp_failInfo);
645 }
646
647
648 static const ber_sequence_t PKIStatusInfo_sequence[] = {
649   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_status },
650   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_statusString },
651   { BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_failInfo },
652   { 0, 0, 0, NULL }
653 };
654
655 int
656 dissect_cmp_PKIStatusInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
657   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
658                                    PKIStatusInfo_sequence, hf_index, ett_cmp_PKIStatusInfo);
659
660   return offset;
661 }
662 static int dissect_status1(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
663   return dissect_cmp_PKIStatusInfo(FALSE, tvb, offset, pinfo, tree, hf_cmp_status1);
664 }
665 static int dissect_status_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
666   return dissect_cmp_PKIStatusInfo(FALSE, tvb, offset, pinfo, tree, hf_cmp_status_item);
667 }
668 static int dissect_pKIStatusInfo(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
669   return dissect_cmp_PKIStatusInfo(FALSE, tvb, offset, pinfo, tree, hf_cmp_pKIStatusInfo);
670 }
671
672
673 const value_string cmp_CertOrEncCert_vals[] = {
674   {   0, "certificate" },
675   {   1, "encryptedCert" },
676   { 0, NULL }
677 };
678
679 static const ber_choice_t CertOrEncCert_choice[] = {
680   {   0, BER_CLASS_CON, 0, 0, dissect_certificate },
681   {   1, BER_CLASS_CON, 1, 0, dissect_encryptedCert },
682   { 0, 0, 0, 0, NULL }
683 };
684
685 int
686 dissect_cmp_CertOrEncCert(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
687   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
688                                  CertOrEncCert_choice, hf_index, ett_cmp_CertOrEncCert,
689                                  NULL);
690
691   return offset;
692 }
693 static int dissect_certOrEncCert(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
694   return dissect_cmp_CertOrEncCert(FALSE, tvb, offset, pinfo, tree, hf_cmp_certOrEncCert);
695 }
696
697
698 static const ber_sequence_t CertifiedKeyPair_sequence[] = {
699   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_certOrEncCert },
700   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_privateKey },
701   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_publicationInfo },
702   { 0, 0, 0, NULL }
703 };
704
705 int
706 dissect_cmp_CertifiedKeyPair(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
707   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
708                                    CertifiedKeyPair_sequence, hf_index, ett_cmp_CertifiedKeyPair);
709
710   return offset;
711 }
712 static int dissect_certifiedKeyPair(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
713   return dissect_cmp_CertifiedKeyPair(FALSE, tvb, offset, pinfo, tree, hf_cmp_certifiedKeyPair);
714 }
715 static int dissect_keyPairHist_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
716   return dissect_cmp_CertifiedKeyPair(FALSE, tvb, offset, pinfo, tree, hf_cmp_keyPairHist_item);
717 }
718
719
720 static const ber_sequence_t CertResponse_sequence[] = {
721   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_certReqId },
722   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_status1 },
723   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_certifiedKeyPair },
724   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_rspInfo },
725   { 0, 0, 0, NULL }
726 };
727
728 int
729 dissect_cmp_CertResponse(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
730   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
731                                    CertResponse_sequence, hf_index, ett_cmp_CertResponse);
732
733   return offset;
734 }
735 static int dissect_response_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
736   return dissect_cmp_CertResponse(FALSE, tvb, offset, pinfo, tree, hf_cmp_response_item);
737 }
738
739
740 static const ber_sequence_t SEQUENCE_OF_CertResponse_sequence_of[1] = {
741   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_response_item },
742 };
743
744 static int
745 dissect_cmp_SEQUENCE_OF_CertResponse(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
746   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
747                                       SEQUENCE_OF_CertResponse_sequence_of, hf_index, ett_cmp_SEQUENCE_OF_CertResponse);
748
749   return offset;
750 }
751 static int dissect_response(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
752   return dissect_cmp_SEQUENCE_OF_CertResponse(FALSE, tvb, offset, pinfo, tree, hf_cmp_response);
753 }
754
755
756 static const ber_sequence_t CertRepMessage_sequence[] = {
757   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_caPubs },
758   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_response },
759   { 0, 0, 0, NULL }
760 };
761
762 int
763 dissect_cmp_CertRepMessage(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
764   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
765                                    CertRepMessage_sequence, hf_index, ett_cmp_CertRepMessage);
766
767   return offset;
768 }
769 static int dissect_ip(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
770   return dissect_cmp_CertRepMessage(FALSE, tvb, offset, pinfo, tree, hf_cmp_ip);
771 }
772 static int dissect_cp(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
773   return dissect_cmp_CertRepMessage(FALSE, tvb, offset, pinfo, tree, hf_cmp_cp);
774 }
775 static int dissect_kup(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
776   return dissect_cmp_CertRepMessage(FALSE, tvb, offset, pinfo, tree, hf_cmp_kup);
777 }
778 static int dissect_ccp(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
779   return dissect_cmp_CertRepMessage(FALSE, tvb, offset, pinfo, tree, hf_cmp_ccp);
780 }
781
782
783 static const ber_sequence_t Challenge_sequence[] = {
784   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_owf },
785   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_witness },
786   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_challenge },
787   { 0, 0, 0, NULL }
788 };
789
790 int
791 dissect_cmp_Challenge(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
792   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
793                                    Challenge_sequence, hf_index, ett_cmp_Challenge);
794
795   return offset;
796 }
797 static int dissect_POPODecKeyChallContent_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
798   return dissect_cmp_Challenge(FALSE, tvb, offset, pinfo, tree, hf_cmp_POPODecKeyChallContent_item);
799 }
800
801
802 static const ber_sequence_t POPODecKeyChallContent_sequence_of[1] = {
803   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_POPODecKeyChallContent_item },
804 };
805
806 int
807 dissect_cmp_POPODecKeyChallContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
808   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
809                                       POPODecKeyChallContent_sequence_of, hf_index, ett_cmp_POPODecKeyChallContent);
810
811   return offset;
812 }
813 static int dissect_popdecc(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
814   return dissect_cmp_POPODecKeyChallContent(FALSE, tvb, offset, pinfo, tree, hf_cmp_popdecc);
815 }
816
817
818 static const ber_sequence_t POPODecKeyRespContent_sequence_of[1] = {
819   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_POPODecKeyRespContent_item },
820 };
821
822 int
823 dissect_cmp_POPODecKeyRespContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
824   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
825                                       POPODecKeyRespContent_sequence_of, hf_index, ett_cmp_POPODecKeyRespContent);
826
827   return offset;
828 }
829 static int dissect_popdecr(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
830   return dissect_cmp_POPODecKeyRespContent(FALSE, tvb, offset, pinfo, tree, hf_cmp_popdecr);
831 }
832
833
834 static const ber_sequence_t SEQUENCE_SIZE_1_MAX_OF_CertifiedKeyPair_sequence_of[1] = {
835   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_keyPairHist_item },
836 };
837
838 static int
839 dissect_cmp_SEQUENCE_SIZE_1_MAX_OF_CertifiedKeyPair(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
840   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
841                                       SEQUENCE_SIZE_1_MAX_OF_CertifiedKeyPair_sequence_of, hf_index, ett_cmp_SEQUENCE_SIZE_1_MAX_OF_CertifiedKeyPair);
842
843   return offset;
844 }
845 static int dissect_keyPairHist(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
846   return dissect_cmp_SEQUENCE_SIZE_1_MAX_OF_CertifiedKeyPair(FALSE, tvb, offset, pinfo, tree, hf_cmp_keyPairHist);
847 }
848
849
850 static const ber_sequence_t KeyRecRepContent_sequence[] = {
851   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_status1 },
852   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_newSigCert },
853   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_caCerts },
854   { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL, dissect_keyPairHist },
855   { 0, 0, 0, NULL }
856 };
857
858 int
859 dissect_cmp_KeyRecRepContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
860   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
861                                    KeyRecRepContent_sequence, hf_index, ett_cmp_KeyRecRepContent);
862
863   return offset;
864 }
865 static int dissect_krp(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
866   return dissect_cmp_KeyRecRepContent(FALSE, tvb, offset, pinfo, tree, hf_cmp_krp);
867 }
868
869
870 static const ber_sequence_t RevDetails_sequence[] = {
871   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_certDetails },
872   { BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_revocationReason },
873   { BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_badSinceDate },
874   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_crlEntryDetails },
875   { 0, 0, 0, NULL }
876 };
877
878 int
879 dissect_cmp_RevDetails(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
880   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
881                                    RevDetails_sequence, hf_index, ett_cmp_RevDetails);
882
883   return offset;
884 }
885 static int dissect_RevReqContent_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
886   return dissect_cmp_RevDetails(FALSE, tvb, offset, pinfo, tree, hf_cmp_RevReqContent_item);
887 }
888
889
890 static const ber_sequence_t RevReqContent_sequence_of[1] = {
891   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_RevReqContent_item },
892 };
893
894 int
895 dissect_cmp_RevReqContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
896   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
897                                       RevReqContent_sequence_of, hf_index, ett_cmp_RevReqContent);
898
899   return offset;
900 }
901 static int dissect_rr(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
902   return dissect_cmp_RevReqContent(FALSE, tvb, offset, pinfo, tree, hf_cmp_rr);
903 }
904
905
906 static const ber_sequence_t SEQUENCE_SIZE_1_MAX_OF_PKIStatusInfo_sequence_of[1] = {
907   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_status_item },
908 };
909
910 static int
911 dissect_cmp_SEQUENCE_SIZE_1_MAX_OF_PKIStatusInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
912   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
913                                       SEQUENCE_SIZE_1_MAX_OF_PKIStatusInfo_sequence_of, hf_index, ett_cmp_SEQUENCE_SIZE_1_MAX_OF_PKIStatusInfo);
914
915   return offset;
916 }
917 static int dissect_status2(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
918   return dissect_cmp_SEQUENCE_SIZE_1_MAX_OF_PKIStatusInfo(FALSE, tvb, offset, pinfo, tree, hf_cmp_status2);
919 }
920
921
922 static const ber_sequence_t SEQUENCE_SIZE_1_MAX_OF_CertId_sequence_of[1] = {
923   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_revCerts_item },
924 };
925
926 static int
927 dissect_cmp_SEQUENCE_SIZE_1_MAX_OF_CertId(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
928   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
929                                       SEQUENCE_SIZE_1_MAX_OF_CertId_sequence_of, hf_index, ett_cmp_SEQUENCE_SIZE_1_MAX_OF_CertId);
930
931   return offset;
932 }
933 static int dissect_revCerts(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
934   return dissect_cmp_SEQUENCE_SIZE_1_MAX_OF_CertId(FALSE, tvb, offset, pinfo, tree, hf_cmp_revCerts);
935 }
936
937
938 static const ber_sequence_t SEQUENCE_SIZE_1_MAX_OF_CertificateList_sequence_of[1] = {
939   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_crls_item },
940 };
941
942 static int
943 dissect_cmp_SEQUENCE_SIZE_1_MAX_OF_CertificateList(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
944   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
945                                       SEQUENCE_SIZE_1_MAX_OF_CertificateList_sequence_of, hf_index, ett_cmp_SEQUENCE_SIZE_1_MAX_OF_CertificateList);
946
947   return offset;
948 }
949 static int dissect_crls(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
950   return dissect_cmp_SEQUENCE_SIZE_1_MAX_OF_CertificateList(FALSE, tvb, offset, pinfo, tree, hf_cmp_crls);
951 }
952
953
954 static const ber_sequence_t RevRepContent_sequence[] = {
955   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_status2 },
956   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_revCerts },
957   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_crls },
958   { 0, 0, 0, NULL }
959 };
960
961 int
962 dissect_cmp_RevRepContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
963   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
964                                    RevRepContent_sequence, hf_index, ett_cmp_RevRepContent);
965
966   return offset;
967 }
968 static int dissect_rp(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
969   return dissect_cmp_RevRepContent(FALSE, tvb, offset, pinfo, tree, hf_cmp_rp);
970 }
971
972
973 static const ber_sequence_t CAKeyUpdAnnContent_sequence[] = {
974   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_oldWithNew },
975   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_newWithOld },
976   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_newWithNew },
977   { 0, 0, 0, NULL }
978 };
979
980 int
981 dissect_cmp_CAKeyUpdAnnContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
982   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
983                                    CAKeyUpdAnnContent_sequence, hf_index, ett_cmp_CAKeyUpdAnnContent);
984
985   return offset;
986 }
987 static int dissect_ckuann(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
988   return dissect_cmp_CAKeyUpdAnnContent(FALSE, tvb, offset, pinfo, tree, hf_cmp_ckuann);
989 }
990
991
992
993 int
994 dissect_cmp_CertAnnContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
995   offset = dissect_pkix1explicit_Certificate(implicit_tag, tvb, offset, pinfo, tree, hf_index);
996
997   return offset;
998 }
999 static int dissect_cann(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1000   return dissect_cmp_CertAnnContent(FALSE, tvb, offset, pinfo, tree, hf_cmp_cann);
1001 }
1002
1003
1004 static const ber_sequence_t RevAnnContent_sequence[] = {
1005   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_status },
1006   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_certId },
1007   { BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_NOOWNTAG, dissect_willBeRevokedAt },
1008   { BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_NOOWNTAG, dissect_badSinceDate },
1009   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_crlDetails },
1010   { 0, 0, 0, NULL }
1011 };
1012
1013 int
1014 dissect_cmp_RevAnnContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1015   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1016                                    RevAnnContent_sequence, hf_index, ett_cmp_RevAnnContent);
1017
1018   return offset;
1019 }
1020 static int dissect_rann(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1021   return dissect_cmp_RevAnnContent(FALSE, tvb, offset, pinfo, tree, hf_cmp_rann);
1022 }
1023
1024
1025 static const ber_sequence_t CRLAnnContent_sequence_of[1] = {
1026   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_CRLAnnContent_item },
1027 };
1028
1029 int
1030 dissect_cmp_CRLAnnContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1031   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
1032                                       CRLAnnContent_sequence_of, hf_index, ett_cmp_CRLAnnContent);
1033
1034   return offset;
1035 }
1036 static int dissect_crlann(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1037   return dissect_cmp_CRLAnnContent(FALSE, tvb, offset, pinfo, tree, hf_cmp_crlann);
1038 }
1039
1040
1041
1042 int
1043 dissect_cmp_PKIConfirmContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1044   offset = dissect_ber_null(implicit_tag, pinfo, tree, tvb, offset, hf_index);
1045
1046   return offset;
1047 }
1048 static int dissect_conf(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1049   return dissect_cmp_PKIConfirmContent(FALSE, tvb, offset, pinfo, tree, hf_cmp_conf);
1050 }
1051
1052
1053
1054 int
1055 dissect_cmp_NestedMessageContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1056   offset = dissect_cmp_PKIMessage(implicit_tag, tvb, offset, pinfo, tree, hf_index);
1057
1058   return offset;
1059 }
1060 static int dissect_nested(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1061   return dissect_cmp_NestedMessageContent(FALSE, tvb, offset, pinfo, tree, hf_cmp_nested);
1062 }
1063
1064
1065 static const ber_sequence_t GenMsgContent_sequence_of[1] = {
1066   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_GenMsgContent_item },
1067 };
1068
1069 int
1070 dissect_cmp_GenMsgContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1071   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
1072                                       GenMsgContent_sequence_of, hf_index, ett_cmp_GenMsgContent);
1073
1074   return offset;
1075 }
1076 static int dissect_genm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1077   return dissect_cmp_GenMsgContent(FALSE, tvb, offset, pinfo, tree, hf_cmp_genm);
1078 }
1079
1080
1081 static const ber_sequence_t GenRepContent_sequence_of[1] = {
1082   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_GenRepContent_item },
1083 };
1084
1085 int
1086 dissect_cmp_GenRepContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1087   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
1088                                       GenRepContent_sequence_of, hf_index, ett_cmp_GenRepContent);
1089
1090   return offset;
1091 }
1092 static int dissect_genp(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1093   return dissect_cmp_GenRepContent(FALSE, tvb, offset, pinfo, tree, hf_cmp_genp);
1094 }
1095
1096
1097 static const ber_sequence_t ErrorMsgContent_sequence[] = {
1098   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pKIStatusInfo },
1099   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_errorCode },
1100   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_errorDetails },
1101   { 0, 0, 0, NULL }
1102 };
1103
1104 int
1105 dissect_cmp_ErrorMsgContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1106   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1107                                    ErrorMsgContent_sequence, hf_index, ett_cmp_ErrorMsgContent);
1108
1109   return offset;
1110 }
1111 static int dissect_error(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1112   return dissect_cmp_ErrorMsgContent(FALSE, tvb, offset, pinfo, tree, hf_cmp_error);
1113 }
1114
1115
1116 const value_string cmp_PKIBody_vals[] = {
1117   {   0, "ir" },
1118   {   1, "ip" },
1119   {   2, "cr" },
1120   {   3, "cp" },
1121   {   5, "popdecc" },
1122   {   6, "popdecr" },
1123   {   7, "kur" },
1124   {   8, "kup" },
1125   {   9, "krr" },
1126   {  10, "krp" },
1127   {  11, "rr" },
1128   {  12, "rp" },
1129   {  13, "ccr" },
1130   {  14, "ccp" },
1131   {  15, "ckuann" },
1132   {  16, "cann" },
1133   {  17, "rann" },
1134   {  18, "crlann" },
1135   {  19, "conf" },
1136   {  20, "nested" },
1137   {  21, "genm" },
1138   {  22, "genp" },
1139   {  23, "error" },
1140   { 0, NULL }
1141 };
1142
1143 static const ber_choice_t PKIBody_choice[] = {
1144   {   0, BER_CLASS_CON, 0, 0, dissect_ir },
1145   {   1, BER_CLASS_CON, 1, 0, dissect_ip },
1146   {   2, BER_CLASS_CON, 2, 0, dissect_cr },
1147   {   3, BER_CLASS_CON, 3, 0, dissect_cp },
1148   {   5, BER_CLASS_CON, 5, 0, dissect_popdecc },
1149   {   6, BER_CLASS_CON, 6, 0, dissect_popdecr },
1150   {   7, BER_CLASS_CON, 7, 0, dissect_kur },
1151   {   8, BER_CLASS_CON, 8, 0, dissect_kup },
1152   {   9, BER_CLASS_CON, 9, 0, dissect_krr },
1153   {  10, BER_CLASS_CON, 10, 0, dissect_krp },
1154   {  11, BER_CLASS_CON, 11, 0, dissect_rr },
1155   {  12, BER_CLASS_CON, 12, 0, dissect_rp },
1156   {  13, BER_CLASS_CON, 13, 0, dissect_ccr },
1157   {  14, BER_CLASS_CON, 14, 0, dissect_ccp },
1158   {  15, BER_CLASS_CON, 15, 0, dissect_ckuann },
1159   {  16, BER_CLASS_CON, 16, 0, dissect_cann },
1160   {  17, BER_CLASS_CON, 17, 0, dissect_rann },
1161   {  18, BER_CLASS_CON, 18, 0, dissect_crlann },
1162   {  19, BER_CLASS_CON, 19, 0, dissect_conf },
1163   {  20, BER_CLASS_CON, 20, 0, dissect_nested },
1164   {  21, BER_CLASS_CON, 21, 0, dissect_genm },
1165   {  22, BER_CLASS_CON, 22, 0, dissect_genp },
1166   {  23, BER_CLASS_CON, 23, 0, dissect_error },
1167   { 0, 0, 0, 0, NULL }
1168 };
1169
1170 int
1171 dissect_cmp_PKIBody(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1172   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
1173                                  PKIBody_choice, hf_index, ett_cmp_PKIBody,
1174                                  NULL);
1175
1176   return offset;
1177 }
1178 static int dissect_body(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1179   return dissect_cmp_PKIBody(FALSE, tvb, offset, pinfo, tree, hf_cmp_body);
1180 }
1181
1182
1183
1184 int
1185 dissect_cmp_PKIProtection(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1186   offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
1187                                     NULL, hf_index, -1,
1188                                     NULL);
1189
1190   return offset;
1191 }
1192 static int dissect_protection(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1193   return dissect_cmp_PKIProtection(FALSE, tvb, offset, pinfo, tree, hf_cmp_protection);
1194 }
1195
1196
1197 static const ber_sequence_t PKIMessage_sequence[] = {
1198   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_header },
1199   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_body },
1200   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_protection },
1201   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_extraCerts },
1202   { 0, 0, 0, NULL }
1203 };
1204
1205 int
1206 dissect_cmp_PKIMessage(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1207   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1208                                    PKIMessage_sequence, hf_index, ett_cmp_PKIMessage);
1209
1210   return offset;
1211 }
1212
1213
1214 static const ber_sequence_t ProtectedPart_sequence[] = {
1215   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_header },
1216   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_body },
1217   { 0, 0, 0, NULL }
1218 };
1219
1220 int
1221 dissect_cmp_ProtectedPart(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1222   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1223                                    ProtectedPart_sequence, hf_index, ett_cmp_ProtectedPart);
1224
1225   return offset;
1226 }
1227
1228
1229
1230 int
1231 dissect_cmp_PasswordBasedMac(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1232   offset = dissect_ber_object_identifier(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL);
1233
1234   return offset;
1235 }
1236
1237
1238 static const ber_sequence_t PBMParameter_sequence[] = {
1239   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_salt },
1240   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_owf },
1241   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_iterationCount },
1242   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_mac },
1243   { 0, 0, 0, NULL }
1244 };
1245
1246 int
1247 dissect_cmp_PBMParameter(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1248   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1249                                    PBMParameter_sequence, hf_index, ett_cmp_PBMParameter);
1250
1251   return offset;
1252 }
1253
1254
1255
1256 int
1257 dissect_cmp_DHBasedMac(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1258   offset = dissect_ber_object_identifier(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL);
1259
1260   return offset;
1261 }
1262
1263
1264 static const ber_sequence_t DHBMParameter_sequence[] = {
1265   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_owf },
1266   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_mac },
1267   { 0, 0, 0, NULL }
1268 };
1269
1270 int
1271 dissect_cmp_DHBMParameter(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1272   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1273                                    DHBMParameter_sequence, hf_index, ett_cmp_DHBMParameter);
1274
1275   return offset;
1276 }
1277
1278
1279
1280 int
1281 dissect_cmp_OOBCert(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1282   offset = dissect_pkix1explicit_Certificate(implicit_tag, tvb, offset, pinfo, tree, hf_index);
1283
1284   return offset;
1285 }
1286
1287
1288
1289 static int
1290 dissect_cmp_BIT_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1291   offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
1292                                     NULL, hf_index, -1,
1293                                     NULL);
1294
1295   return offset;
1296 }
1297 static int dissect_hashVal(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1298   return dissect_cmp_BIT_STRING(FALSE, tvb, offset, pinfo, tree, hf_cmp_hashVal);
1299 }
1300
1301
1302 static const ber_sequence_t OOBCertHash_sequence[] = {
1303   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_hashAlg },
1304   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_certId },
1305   { BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_NOOWNTAG, dissect_hashVal },
1306   { 0, 0, 0, NULL }
1307 };
1308
1309 int
1310 dissect_cmp_OOBCertHash(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1311   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1312                                    OOBCertHash_sequence, hf_index, ett_cmp_OOBCertHash);
1313
1314   return offset;
1315 }
1316
1317
1318 /*--- End of included file: packet-cmp-fn.c ---*/
1319 #line 74 "packet-cmp-template.c"
1320
1321 static int
1322 dissect_cmp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1323 {
1324         return dissect_cmp_PKIMessage(FALSE, tvb, 0, pinfo, tree, -1);
1325 }
1326
1327 #define CMP_TYPE_PKIMSG         0
1328 #define CMP_TYPE_POLLREP        1
1329 #define CMP_TYPE_POLLREQ        2
1330 #define CMP_TYPE_NEGPOLLREP     3
1331 #define CMP_TYPE_PARTIALMSGREP  4
1332 #define CMP_TYPE_FINALMSGREP    5
1333 #define CMP_TYPE_ERRORMSGREP    6
1334 static const value_string cmp_pdu_types[] = {
1335         { CMP_TYPE_PKIMSG,              "pkiMsg" },
1336         { CMP_TYPE_POLLREP,             "pollRep" },
1337         { CMP_TYPE_POLLREQ,             "pollReq" },
1338         { CMP_TYPE_NEGPOLLREP,          "negPollRep" },
1339         { CMP_TYPE_PARTIALMSGREP,       "partialMsgRep" },
1340         { CMP_TYPE_FINALMSGREP,         "finalMsgRep" },
1341         { CMP_TYPE_ERRORMSGREP,         "errorMsgRep" },
1342         { 0, NULL },
1343 };
1344
1345 static void dissect_cmp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
1346 {
1347         tvbuff_t   *next_tvb;
1348         guint32 pdu_len;
1349         guint8 pdu_type;
1350         nstime_t        ts;
1351
1352         proto_item *item=NULL;
1353         proto_tree *tree=NULL;
1354
1355         if (check_col(pinfo->cinfo, COL_PROTOCOL)) 
1356                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "CMP");
1357
1358         if (check_col(pinfo->cinfo, COL_INFO)) {
1359                 col_clear(pinfo->cinfo, COL_INFO);
1360                 
1361                 col_add_fstr(pinfo->cinfo, COL_INFO, "PKIXCMP");
1362         }
1363
1364
1365         if(parent_tree){
1366                 item=proto_tree_add_item(parent_tree, proto_cmp, tvb, 0, -1, FALSE);
1367                 tree = proto_item_add_subtree(item, ett_cmp);
1368         }
1369
1370         pdu_len=tvb_get_ntohl(tvb, 0);
1371         pdu_type=tvb_get_guint8(tvb, 4);
1372
1373         proto_tree_add_uint(tree, hf_cmp_rm, tvb, 0, 4, pdu_len);
1374         proto_tree_add_uint(tree, hf_cmp_type, tvb, 4, 1, pdu_type);
1375
1376         if (check_col (pinfo->cinfo, COL_INFO)) {
1377             col_set_str (pinfo->cinfo, COL_INFO, val_to_str (pdu_type, cmp_pdu_types, "0x%x"));
1378         }
1379
1380         switch(pdu_type){
1381         case CMP_TYPE_PKIMSG:
1382                 next_tvb = tvb_new_subset(tvb, 5, tvb_length_remaining(tvb, 5), pdu_len);
1383                 dissect_cmp_pdu(next_tvb, pinfo, tree);
1384                 break;
1385         case CMP_TYPE_POLLREP:
1386                 proto_tree_add_item(tree, hf_cmp_poll_ref, tvb, 0, 4, FALSE);
1387
1388                 ts.secs = tvb_get_ntohl(tvb, 4);
1389                 ts.nsecs = 0;
1390                 proto_tree_add_time(tree, hf_cmp_ttcb, tvb, 4, 4, &ts);
1391                 break;
1392         case CMP_TYPE_POLLREQ:
1393                 proto_tree_add_item(tree, hf_cmp_poll_ref, tvb, 0, 4, FALSE);
1394                 break;
1395         case CMP_TYPE_NEGPOLLREP:
1396                 break;
1397         case CMP_TYPE_PARTIALMSGREP:
1398                 proto_tree_add_item(tree, hf_cmp_next_poll_ref, tvb, 0, 4, FALSE);
1399
1400                 ts.secs = tvb_get_ntohl(tvb, 4);
1401                 ts.nsecs = 0;
1402                 proto_tree_add_time(tree, hf_cmp_ttcb, tvb, 4, 4, &ts);
1403
1404                 next_tvb = tvb_new_subset(tvb, 13, tvb_length_remaining(tvb, 13), pdu_len);
1405                 dissect_cmp_pdu(next_tvb, pinfo, tree);
1406                 break;
1407         case CMP_TYPE_FINALMSGREP:
1408                 next_tvb = tvb_new_subset(tvb, 5, tvb_length_remaining(tvb, 5), pdu_len);
1409                 dissect_cmp_pdu(next_tvb, pinfo, tree);
1410                 break;
1411         case CMP_TYPE_ERRORMSGREP:
1412                 /*XXX to be added*/
1413                 break;
1414         }
1415
1416 }
1417
1418 static guint get_cmp_pdu_len(tvbuff_t *tvb, int offset)
1419 {
1420   guint32 plen;
1421
1422   /*
1423    * Get the length of the CMP-over-TCP packet.
1424    */
1425   plen = tvb_get_ntohl(tvb, offset);
1426
1427   return plen+4;
1428 }
1429
1430 /* CMP over TCP    RFC2510 section 5.2 */
1431 static int
1432 dissect_cmp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
1433 {
1434         guint32 pdu_len;
1435         guint8 pdu_type;
1436
1437         /* only attempt to dissect it as CMP over TCP if we have
1438          * at least 5 bytes.
1439          */
1440         if (!tvb_bytes_exist(tvb, 0, 5)) {
1441                 return 0;
1442         }
1443
1444         pdu_len=tvb_get_ntohl(tvb, 0);
1445         pdu_type=tvb_get_guint8(tvb, 4);
1446
1447         /* arbitrary limit: assume a CMP over TCP pdu is never >10000 bytes 
1448          * in size.
1449          * It is definitely at least 1 byte to accomodate the flags byte 
1450          */
1451         if((pdu_len<=0)||(pdu_len>10000)){
1452                 return 0;
1453         }
1454         /* type is between 0 and 6 */
1455         if(pdu_type>6){
1456                 return 0;
1457         }
1458         /* type 0 contains a PKI message and must therefore be >= 3 bytes 
1459          * long (flags + BER TAG + BER LENGTH
1460          */
1461         if((pdu_type==0)&&(pdu_len<3)){
1462                 return 0;
1463         }
1464
1465         tcp_dissect_pdus(tvb, pinfo, parent_tree, cmp_desegment, 4, get_cmp_pdu_len,
1466                 dissect_cmp_tcp_pdu);
1467
1468         return tvb_length(tvb);
1469 }
1470
1471 static int
1472 dissect_cmp_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
1473 {
1474         proto_item *item=NULL;
1475         proto_tree *tree=NULL;
1476
1477         if (check_col(pinfo->cinfo, COL_PROTOCOL)) 
1478                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "CMP");
1479
1480         if (check_col(pinfo->cinfo, COL_INFO)) {
1481                 col_clear(pinfo->cinfo, COL_INFO);
1482                 
1483                 col_add_fstr(pinfo->cinfo, COL_INFO, "PKIXCMP");
1484         }
1485
1486
1487         if(parent_tree){
1488                 item=proto_tree_add_item(parent_tree, proto_cmp, tvb, 0, -1, FALSE);
1489                 tree = proto_item_add_subtree(item, ett_cmp);
1490         }
1491
1492         dissect_cmp_pdu(tvb, pinfo, tree);
1493 }
1494
1495
1496 /*--- proto_register_cmp ----------------------------------------------*/
1497 void proto_register_cmp(void) {
1498
1499   /* List of fields */
1500   static hf_register_info hf[] = {
1501     { &hf_cmp_type_oid,
1502       { "InfoType", "cmp.type.oid",
1503         FT_STRING, BASE_NONE, NULL, 0,
1504         "Type of InfoTypeAndValue", HFILL }},
1505     { &hf_cmp_rm,
1506       { "Record Marker", "cmp.rm",
1507         FT_UINT32, BASE_DEC, NULL, 0,
1508         "Record Marker  length of PDU in bytes", HFILL }},
1509     { &hf_cmp_type,
1510       { "Type", "cmp.type",
1511         FT_UINT8, BASE_DEC, VALS(cmp_pdu_types), 0,
1512         "PDU Type", HFILL }},
1513     { &hf_cmp_poll_ref,
1514       { "Polling Reference", "cmp.poll_ref",
1515         FT_UINT32, BASE_HEX, NULL, 0,
1516         "", HFILL }},
1517     { &hf_cmp_next_poll_ref,
1518       { "Next Polling Reference", "cmp.next_poll_ref",
1519         FT_UINT32, BASE_HEX, NULL, 0,
1520         "", HFILL }},
1521     { &hf_cmp_ttcb,
1522       { "Time to check Back", "cmp.ttcb",
1523         FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0,
1524         "", HFILL }},
1525
1526 /*--- Included file: packet-cmp-hfarr.c ---*/
1527 #line 1 "packet-cmp-hfarr.c"
1528     { &hf_cmp_header,
1529       { "header", "cmp.header",
1530         FT_NONE, BASE_NONE, NULL, 0,
1531         "", HFILL }},
1532     { &hf_cmp_body,
1533       { "body", "cmp.body",
1534         FT_UINT32, BASE_DEC, VALS(cmp_PKIBody_vals), 0,
1535         "", HFILL }},
1536     { &hf_cmp_protection,
1537       { "protection", "cmp.protection",
1538         FT_BYTES, BASE_HEX, NULL, 0,
1539         "PKIMessage/protection", HFILL }},
1540     { &hf_cmp_extraCerts,
1541       { "extraCerts", "cmp.extraCerts",
1542         FT_UINT32, BASE_DEC, NULL, 0,
1543         "PKIMessage/extraCerts", HFILL }},
1544     { &hf_cmp_extraCerts_item,
1545       { "Item", "cmp.extraCerts_item",
1546         FT_NONE, BASE_NONE, NULL, 0,
1547         "PKIMessage/extraCerts/_item", HFILL }},
1548     { &hf_cmp_pvno,
1549       { "pvno", "cmp.pvno",
1550         FT_INT32, BASE_DEC, VALS(cmp_T_pvno_vals), 0,
1551         "PKIHeader/pvno", HFILL }},
1552     { &hf_cmp_sender,
1553       { "sender", "cmp.sender",
1554         FT_UINT32, BASE_DEC, NULL, 0,
1555         "PKIHeader/sender", HFILL }},
1556     { &hf_cmp_recipient,
1557       { "recipient", "cmp.recipient",
1558         FT_UINT32, BASE_DEC, NULL, 0,
1559         "PKIHeader/recipient", HFILL }},
1560     { &hf_cmp_messageTime,
1561       { "messageTime", "cmp.messageTime",
1562         FT_STRING, BASE_NONE, NULL, 0,
1563         "PKIHeader/messageTime", HFILL }},
1564     { &hf_cmp_protectionAlg,
1565       { "protectionAlg", "cmp.protectionAlg",
1566         FT_NONE, BASE_NONE, NULL, 0,
1567         "PKIHeader/protectionAlg", HFILL }},
1568     { &hf_cmp_senderKID,
1569       { "senderKID", "cmp.senderKID",
1570         FT_BYTES, BASE_HEX, NULL, 0,
1571         "PKIHeader/senderKID", HFILL }},
1572     { &hf_cmp_recipKID,
1573       { "recipKID", "cmp.recipKID",
1574         FT_BYTES, BASE_HEX, NULL, 0,
1575         "PKIHeader/recipKID", HFILL }},
1576     { &hf_cmp_transactionID,
1577       { "transactionID", "cmp.transactionID",
1578         FT_BYTES, BASE_HEX, NULL, 0,
1579         "PKIHeader/transactionID", HFILL }},
1580     { &hf_cmp_senderNonce,
1581       { "senderNonce", "cmp.senderNonce",
1582         FT_BYTES, BASE_HEX, NULL, 0,
1583         "PKIHeader/senderNonce", HFILL }},
1584     { &hf_cmp_recipNonce,
1585       { "recipNonce", "cmp.recipNonce",
1586         FT_BYTES, BASE_HEX, NULL, 0,
1587         "PKIHeader/recipNonce", HFILL }},
1588     { &hf_cmp_freeText,
1589       { "freeText", "cmp.freeText",
1590         FT_UINT32, BASE_DEC, NULL, 0,
1591         "PKIHeader/freeText", HFILL }},
1592     { &hf_cmp_generalInfo,
1593       { "generalInfo", "cmp.generalInfo",
1594         FT_UINT32, BASE_DEC, NULL, 0,
1595         "PKIHeader/generalInfo", HFILL }},
1596     { &hf_cmp_generalInfo_item,
1597       { "Item", "cmp.generalInfo_item",
1598         FT_NONE, BASE_NONE, NULL, 0,
1599         "PKIHeader/generalInfo/_item", HFILL }},
1600     { &hf_cmp_PKIFreeText_item,
1601       { "Item", "cmp.PKIFreeText_item",
1602         FT_STRING, BASE_NONE, NULL, 0,
1603         "PKIFreeText/_item", HFILL }},
1604     { &hf_cmp_ir,
1605       { "ir", "cmp.ir",
1606         FT_UINT32, BASE_DEC, NULL, 0,
1607         "PKIBody/ir", HFILL }},
1608     { &hf_cmp_ip,
1609       { "ip", "cmp.ip",
1610         FT_NONE, BASE_NONE, NULL, 0,
1611         "PKIBody/ip", HFILL }},
1612     { &hf_cmp_cr,
1613       { "cr", "cmp.cr",
1614         FT_UINT32, BASE_DEC, NULL, 0,
1615         "PKIBody/cr", HFILL }},
1616     { &hf_cmp_cp,
1617       { "cp", "cmp.cp",
1618         FT_NONE, BASE_NONE, NULL, 0,
1619         "PKIBody/cp", HFILL }},
1620     { &hf_cmp_popdecc,
1621       { "popdecc", "cmp.popdecc",
1622         FT_UINT32, BASE_DEC, NULL, 0,
1623         "PKIBody/popdecc", HFILL }},
1624     { &hf_cmp_popdecr,
1625       { "popdecr", "cmp.popdecr",
1626         FT_UINT32, BASE_DEC, NULL, 0,
1627         "PKIBody/popdecr", HFILL }},
1628     { &hf_cmp_kur,
1629       { "kur", "cmp.kur",
1630         FT_UINT32, BASE_DEC, NULL, 0,
1631         "PKIBody/kur", HFILL }},
1632     { &hf_cmp_kup,
1633       { "kup", "cmp.kup",
1634         FT_NONE, BASE_NONE, NULL, 0,
1635         "PKIBody/kup", HFILL }},
1636     { &hf_cmp_krr,
1637       { "krr", "cmp.krr",
1638         FT_UINT32, BASE_DEC, NULL, 0,
1639         "PKIBody/krr", HFILL }},
1640     { &hf_cmp_krp,
1641       { "krp", "cmp.krp",
1642         FT_NONE, BASE_NONE, NULL, 0,
1643         "PKIBody/krp", HFILL }},
1644     { &hf_cmp_rr,
1645       { "rr", "cmp.rr",
1646         FT_UINT32, BASE_DEC, NULL, 0,
1647         "PKIBody/rr", HFILL }},
1648     { &hf_cmp_rp,
1649       { "rp", "cmp.rp",
1650         FT_NONE, BASE_NONE, NULL, 0,
1651         "PKIBody/rp", HFILL }},
1652     { &hf_cmp_ccr,
1653       { "ccr", "cmp.ccr",
1654         FT_UINT32, BASE_DEC, NULL, 0,
1655         "PKIBody/ccr", HFILL }},
1656     { &hf_cmp_ccp,
1657       { "ccp", "cmp.ccp",
1658         FT_NONE, BASE_NONE, NULL, 0,
1659         "PKIBody/ccp", HFILL }},
1660     { &hf_cmp_ckuann,
1661       { "ckuann", "cmp.ckuann",
1662         FT_NONE, BASE_NONE, NULL, 0,
1663         "PKIBody/ckuann", HFILL }},
1664     { &hf_cmp_cann,
1665       { "cann", "cmp.cann",
1666         FT_NONE, BASE_NONE, NULL, 0,
1667         "PKIBody/cann", HFILL }},
1668     { &hf_cmp_rann,
1669       { "rann", "cmp.rann",
1670         FT_NONE, BASE_NONE, NULL, 0,
1671         "PKIBody/rann", HFILL }},
1672     { &hf_cmp_crlann,
1673       { "crlann", "cmp.crlann",
1674         FT_UINT32, BASE_DEC, NULL, 0,
1675         "PKIBody/crlann", HFILL }},
1676     { &hf_cmp_conf,
1677       { "conf", "cmp.conf",
1678         FT_NONE, BASE_NONE, NULL, 0,
1679         "PKIBody/conf", HFILL }},
1680     { &hf_cmp_nested,
1681       { "nested", "cmp.nested",
1682         FT_NONE, BASE_NONE, NULL, 0,
1683         "PKIBody/nested", HFILL }},
1684     { &hf_cmp_genm,
1685       { "genm", "cmp.genm",
1686         FT_UINT32, BASE_DEC, NULL, 0,
1687         "PKIBody/genm", HFILL }},
1688     { &hf_cmp_genp,
1689       { "genp", "cmp.genp",
1690         FT_UINT32, BASE_DEC, NULL, 0,
1691         "PKIBody/genp", HFILL }},
1692     { &hf_cmp_error,
1693       { "error", "cmp.error",
1694         FT_NONE, BASE_NONE, NULL, 0,
1695         "PKIBody/error", HFILL }},
1696     { &hf_cmp_salt,
1697       { "salt", "cmp.salt",
1698         FT_BYTES, BASE_HEX, NULL, 0,
1699         "PBMParameter/salt", HFILL }},
1700     { &hf_cmp_owf,
1701       { "owf", "cmp.owf",
1702         FT_NONE, BASE_NONE, NULL, 0,
1703         "", HFILL }},
1704     { &hf_cmp_iterationCount,
1705       { "iterationCount", "cmp.iterationCount",
1706         FT_INT32, BASE_DEC, NULL, 0,
1707         "PBMParameter/iterationCount", HFILL }},
1708     { &hf_cmp_mac,
1709       { "mac", "cmp.mac",
1710         FT_NONE, BASE_NONE, NULL, 0,
1711         "", HFILL }},
1712     { &hf_cmp_status,
1713       { "status", "cmp.status",
1714         FT_INT32, BASE_DEC, VALS(cmp_PKIStatus_vals), 0,
1715         "", HFILL }},
1716     { &hf_cmp_statusString,
1717       { "statusString", "cmp.statusString",
1718         FT_UINT32, BASE_DEC, NULL, 0,
1719         "PKIStatusInfo/statusString", HFILL }},
1720     { &hf_cmp_failInfo,
1721       { "failInfo", "cmp.failInfo",
1722         FT_BYTES, BASE_HEX, NULL, 0,
1723         "PKIStatusInfo/failInfo", HFILL }},
1724     { &hf_cmp_hashAlg,
1725       { "hashAlg", "cmp.hashAlg",
1726         FT_NONE, BASE_NONE, NULL, 0,
1727         "OOBCertHash/hashAlg", HFILL }},
1728     { &hf_cmp_certId,
1729       { "certId", "cmp.certId",
1730         FT_NONE, BASE_NONE, NULL, 0,
1731         "", HFILL }},
1732     { &hf_cmp_hashVal,
1733       { "hashVal", "cmp.hashVal",
1734         FT_BYTES, BASE_HEX, NULL, 0,
1735         "OOBCertHash/hashVal", HFILL }},
1736     { &hf_cmp_POPODecKeyChallContent_item,
1737       { "Item", "cmp.POPODecKeyChallContent_item",
1738         FT_NONE, BASE_NONE, NULL, 0,
1739         "POPODecKeyChallContent/_item", HFILL }},
1740     { &hf_cmp_witness,
1741       { "witness", "cmp.witness",
1742         FT_BYTES, BASE_HEX, NULL, 0,
1743         "Challenge/witness", HFILL }},
1744     { &hf_cmp_challenge,
1745       { "challenge", "cmp.challenge",
1746         FT_BYTES, BASE_HEX, NULL, 0,
1747         "Challenge/challenge", HFILL }},
1748     { &hf_cmp_POPODecKeyRespContent_item,
1749       { "Item", "cmp.POPODecKeyRespContent_item",
1750         FT_INT32, BASE_DEC, NULL, 0,
1751         "POPODecKeyRespContent/_item", HFILL }},
1752     { &hf_cmp_caPubs,
1753       { "caPubs", "cmp.caPubs",
1754         FT_UINT32, BASE_DEC, NULL, 0,
1755         "CertRepMessage/caPubs", HFILL }},
1756     { &hf_cmp_caPubs_item,
1757       { "Item", "cmp.caPubs_item",
1758         FT_NONE, BASE_NONE, NULL, 0,
1759         "CertRepMessage/caPubs/_item", HFILL }},
1760     { &hf_cmp_response,
1761       { "response", "cmp.response",
1762         FT_UINT32, BASE_DEC, NULL, 0,
1763         "CertRepMessage/response", HFILL }},
1764     { &hf_cmp_response_item,
1765       { "Item", "cmp.response_item",
1766         FT_NONE, BASE_NONE, NULL, 0,
1767         "CertRepMessage/response/_item", HFILL }},
1768     { &hf_cmp_certReqId,
1769       { "certReqId", "cmp.certReqId",
1770         FT_INT32, BASE_DEC, NULL, 0,
1771         "CertResponse/certReqId", HFILL }},
1772     { &hf_cmp_status1,
1773       { "status", "cmp.status",
1774         FT_NONE, BASE_NONE, NULL, 0,
1775         "", HFILL }},
1776     { &hf_cmp_certifiedKeyPair,
1777       { "certifiedKeyPair", "cmp.certifiedKeyPair",
1778         FT_NONE, BASE_NONE, NULL, 0,
1779         "CertResponse/certifiedKeyPair", HFILL }},
1780     { &hf_cmp_rspInfo,
1781       { "rspInfo", "cmp.rspInfo",
1782         FT_BYTES, BASE_HEX, NULL, 0,
1783         "CertResponse/rspInfo", HFILL }},
1784     { &hf_cmp_certOrEncCert,
1785       { "certOrEncCert", "cmp.certOrEncCert",
1786         FT_UINT32, BASE_DEC, VALS(cmp_CertOrEncCert_vals), 0,
1787         "CertifiedKeyPair/certOrEncCert", HFILL }},
1788     { &hf_cmp_privateKey,
1789       { "privateKey", "cmp.privateKey",
1790         FT_NONE, BASE_NONE, NULL, 0,
1791         "CertifiedKeyPair/privateKey", HFILL }},
1792     { &hf_cmp_publicationInfo,
1793       { "publicationInfo", "cmp.publicationInfo",
1794         FT_NONE, BASE_NONE, NULL, 0,
1795         "CertifiedKeyPair/publicationInfo", HFILL }},
1796     { &hf_cmp_certificate,
1797       { "certificate", "cmp.certificate",
1798         FT_NONE, BASE_NONE, NULL, 0,
1799         "CertOrEncCert/certificate", HFILL }},
1800     { &hf_cmp_encryptedCert,
1801       { "encryptedCert", "cmp.encryptedCert",
1802         FT_NONE, BASE_NONE, NULL, 0,
1803         "CertOrEncCert/encryptedCert", HFILL }},
1804     { &hf_cmp_newSigCert,
1805       { "newSigCert", "cmp.newSigCert",
1806         FT_NONE, BASE_NONE, NULL, 0,
1807         "KeyRecRepContent/newSigCert", HFILL }},
1808     { &hf_cmp_caCerts,
1809       { "caCerts", "cmp.caCerts",
1810         FT_UINT32, BASE_DEC, NULL, 0,
1811         "KeyRecRepContent/caCerts", HFILL }},
1812     { &hf_cmp_caCerts_item,
1813       { "Item", "cmp.caCerts_item",
1814         FT_NONE, BASE_NONE, NULL, 0,
1815         "KeyRecRepContent/caCerts/_item", HFILL }},
1816     { &hf_cmp_keyPairHist,
1817       { "keyPairHist", "cmp.keyPairHist",
1818         FT_UINT32, BASE_DEC, NULL, 0,
1819         "KeyRecRepContent/keyPairHist", HFILL }},
1820     { &hf_cmp_keyPairHist_item,
1821       { "Item", "cmp.keyPairHist_item",
1822         FT_NONE, BASE_NONE, NULL, 0,
1823         "KeyRecRepContent/keyPairHist/_item", HFILL }},
1824     { &hf_cmp_RevReqContent_item,
1825       { "Item", "cmp.RevReqContent_item",
1826         FT_NONE, BASE_NONE, NULL, 0,
1827         "RevReqContent/_item", HFILL }},
1828     { &hf_cmp_certDetails,
1829       { "certDetails", "cmp.certDetails",
1830         FT_NONE, BASE_NONE, NULL, 0,
1831         "RevDetails/certDetails", HFILL }},
1832     { &hf_cmp_revocationReason,
1833       { "revocationReason", "cmp.revocationReason",
1834         FT_BYTES, BASE_HEX, NULL, 0,
1835         "RevDetails/revocationReason", HFILL }},
1836     { &hf_cmp_badSinceDate,
1837       { "badSinceDate", "cmp.badSinceDate",
1838         FT_STRING, BASE_NONE, NULL, 0,
1839         "", HFILL }},
1840     { &hf_cmp_crlEntryDetails,
1841       { "crlEntryDetails", "cmp.crlEntryDetails",
1842         FT_UINT32, BASE_DEC, NULL, 0,
1843         "RevDetails/crlEntryDetails", HFILL }},
1844     { &hf_cmp_status2,
1845       { "status", "cmp.status",
1846         FT_UINT32, BASE_DEC, NULL, 0,
1847         "RevRepContent/status", HFILL }},
1848     { &hf_cmp_status_item,
1849       { "Item", "cmp.status_item",
1850         FT_NONE, BASE_NONE, NULL, 0,
1851         "RevRepContent/status/_item", HFILL }},
1852     { &hf_cmp_revCerts,
1853       { "revCerts", "cmp.revCerts",
1854         FT_UINT32, BASE_DEC, NULL, 0,
1855         "RevRepContent/revCerts", HFILL }},
1856     { &hf_cmp_revCerts_item,
1857       { "Item", "cmp.revCerts_item",
1858         FT_NONE, BASE_NONE, NULL, 0,
1859         "RevRepContent/revCerts/_item", HFILL }},
1860     { &hf_cmp_crls,
1861       { "crls", "cmp.crls",
1862         FT_UINT32, BASE_DEC, NULL, 0,
1863         "RevRepContent/crls", HFILL }},
1864     { &hf_cmp_crls_item,
1865       { "Item", "cmp.crls_item",
1866         FT_NONE, BASE_NONE, NULL, 0,
1867         "RevRepContent/crls/_item", HFILL }},
1868     { &hf_cmp_oldWithNew,
1869       { "oldWithNew", "cmp.oldWithNew",
1870         FT_NONE, BASE_NONE, NULL, 0,
1871         "CAKeyUpdAnnContent/oldWithNew", HFILL }},
1872     { &hf_cmp_newWithOld,
1873       { "newWithOld", "cmp.newWithOld",
1874         FT_NONE, BASE_NONE, NULL, 0,
1875         "CAKeyUpdAnnContent/newWithOld", HFILL }},
1876     { &hf_cmp_newWithNew,
1877       { "newWithNew", "cmp.newWithNew",
1878         FT_NONE, BASE_NONE, NULL, 0,
1879         "CAKeyUpdAnnContent/newWithNew", HFILL }},
1880     { &hf_cmp_willBeRevokedAt,
1881       { "willBeRevokedAt", "cmp.willBeRevokedAt",
1882         FT_STRING, BASE_NONE, NULL, 0,
1883         "RevAnnContent/willBeRevokedAt", HFILL }},
1884     { &hf_cmp_crlDetails,
1885       { "crlDetails", "cmp.crlDetails",
1886         FT_UINT32, BASE_DEC, NULL, 0,
1887         "RevAnnContent/crlDetails", HFILL }},
1888     { &hf_cmp_CRLAnnContent_item,
1889       { "Item", "cmp.CRLAnnContent_item",
1890         FT_NONE, BASE_NONE, NULL, 0,
1891         "CRLAnnContent/_item", HFILL }},
1892     { &hf_cmp_infoType,
1893       { "infoType", "cmp.infoType",
1894         FT_OID, BASE_NONE, NULL, 0,
1895         "InfoTypeAndValue/infoType", HFILL }},
1896     { &hf_cmp_infoValue,
1897       { "infoValue", "cmp.infoValue",
1898         FT_NONE, BASE_NONE, NULL, 0,
1899         "InfoTypeAndValue/infoValue", HFILL }},
1900     { &hf_cmp_GenMsgContent_item,
1901       { "Item", "cmp.GenMsgContent_item",
1902         FT_NONE, BASE_NONE, NULL, 0,
1903         "GenMsgContent/_item", HFILL }},
1904     { &hf_cmp_GenRepContent_item,
1905       { "Item", "cmp.GenRepContent_item",
1906         FT_NONE, BASE_NONE, NULL, 0,
1907         "GenRepContent/_item", HFILL }},
1908     { &hf_cmp_pKIStatusInfo,
1909       { "pKIStatusInfo", "cmp.pKIStatusInfo",
1910         FT_NONE, BASE_NONE, NULL, 0,
1911         "ErrorMsgContent/pKIStatusInfo", HFILL }},
1912     { &hf_cmp_errorCode,
1913       { "errorCode", "cmp.errorCode",
1914         FT_INT32, BASE_DEC, NULL, 0,
1915         "ErrorMsgContent/errorCode", HFILL }},
1916     { &hf_cmp_errorDetails,
1917       { "errorDetails", "cmp.errorDetails",
1918         FT_UINT32, BASE_DEC, NULL, 0,
1919         "ErrorMsgContent/errorDetails", HFILL }},
1920     { &hf_cmp_PKIFailureInfo_badAlg,
1921       { "badAlg", "cmp.badAlg",
1922         FT_BOOLEAN, 8, NULL, 0x80,
1923         "", HFILL }},
1924     { &hf_cmp_PKIFailureInfo_badMessageCheck,
1925       { "badMessageCheck", "cmp.badMessageCheck",
1926         FT_BOOLEAN, 8, NULL, 0x40,
1927         "", HFILL }},
1928     { &hf_cmp_PKIFailureInfo_badRequest,
1929       { "badRequest", "cmp.badRequest",
1930         FT_BOOLEAN, 8, NULL, 0x20,
1931         "", HFILL }},
1932     { &hf_cmp_PKIFailureInfo_badTime,
1933       { "badTime", "cmp.badTime",
1934         FT_BOOLEAN, 8, NULL, 0x10,
1935         "", HFILL }},
1936     { &hf_cmp_PKIFailureInfo_badCertId,
1937       { "badCertId", "cmp.badCertId",
1938         FT_BOOLEAN, 8, NULL, 0x08,
1939         "", HFILL }},
1940     { &hf_cmp_PKIFailureInfo_badDataFormat,
1941       { "badDataFormat", "cmp.badDataFormat",
1942         FT_BOOLEAN, 8, NULL, 0x04,
1943         "", HFILL }},
1944     { &hf_cmp_PKIFailureInfo_wrongAuthority,
1945       { "wrongAuthority", "cmp.wrongAuthority",
1946         FT_BOOLEAN, 8, NULL, 0x02,
1947         "", HFILL }},
1948     { &hf_cmp_PKIFailureInfo_incorrectData,
1949       { "incorrectData", "cmp.incorrectData",
1950         FT_BOOLEAN, 8, NULL, 0x01,
1951         "", HFILL }},
1952     { &hf_cmp_PKIFailureInfo_missingTimeStamp,
1953       { "missingTimeStamp", "cmp.missingTimeStamp",
1954         FT_BOOLEAN, 8, NULL, 0x80,
1955         "", HFILL }},
1956     { &hf_cmp_PKIFailureInfo_badPOP,
1957       { "badPOP", "cmp.badPOP",
1958         FT_BOOLEAN, 8, NULL, 0x40,
1959         "", HFILL }},
1960
1961 /*--- End of included file: packet-cmp-hfarr.c ---*/
1962 #line 280 "packet-cmp-template.c"
1963   };
1964
1965   /* List of subtrees */
1966   static gint *ett[] = {
1967     &ett_cmp,
1968
1969 /*--- Included file: packet-cmp-ettarr.c ---*/
1970 #line 1 "packet-cmp-ettarr.c"
1971     &ett_cmp_PKIMessage,
1972     &ett_cmp_SEQUENCE_SIZE_1_MAX_OF_Certificate,
1973     &ett_cmp_PKIHeader,
1974     &ett_cmp_SEQUENCE_SIZE_1_MAX_OF_InfoTypeAndValue,
1975     &ett_cmp_PKIFreeText,
1976     &ett_cmp_PKIBody,
1977     &ett_cmp_ProtectedPart,
1978     &ett_cmp_PBMParameter,
1979     &ett_cmp_DHBMParameter,
1980     &ett_cmp_PKIFailureInfo,
1981     &ett_cmp_PKIStatusInfo,
1982     &ett_cmp_OOBCertHash,
1983     &ett_cmp_POPODecKeyChallContent,
1984     &ett_cmp_Challenge,
1985     &ett_cmp_POPODecKeyRespContent,
1986     &ett_cmp_CertRepMessage,
1987     &ett_cmp_SEQUENCE_OF_CertResponse,
1988     &ett_cmp_CertResponse,
1989     &ett_cmp_CertifiedKeyPair,
1990     &ett_cmp_CertOrEncCert,
1991     &ett_cmp_KeyRecRepContent,
1992     &ett_cmp_SEQUENCE_SIZE_1_MAX_OF_CertifiedKeyPair,
1993     &ett_cmp_RevReqContent,
1994     &ett_cmp_RevDetails,
1995     &ett_cmp_RevRepContent,
1996     &ett_cmp_SEQUENCE_SIZE_1_MAX_OF_PKIStatusInfo,
1997     &ett_cmp_SEQUENCE_SIZE_1_MAX_OF_CertId,
1998     &ett_cmp_SEQUENCE_SIZE_1_MAX_OF_CertificateList,
1999     &ett_cmp_CAKeyUpdAnnContent,
2000     &ett_cmp_RevAnnContent,
2001     &ett_cmp_CRLAnnContent,
2002     &ett_cmp_InfoTypeAndValue,
2003     &ett_cmp_GenMsgContent,
2004     &ett_cmp_GenRepContent,
2005     &ett_cmp_ErrorMsgContent,
2006
2007 /*--- End of included file: packet-cmp-ettarr.c ---*/
2008 #line 286 "packet-cmp-template.c"
2009   };
2010   module_t *cmp_module;
2011
2012   /* Register protocol */
2013   proto_cmp = proto_register_protocol(PNAME, PSNAME, PFNAME);
2014
2015   /* Register fields and subtrees */
2016   proto_register_field_array(proto_cmp, hf, array_length(hf));
2017   proto_register_subtree_array(ett, array_length(ett));
2018
2019   cmp_module = prefs_register_protocol(proto_cmp, NULL);
2020   prefs_register_bool_preference(cmp_module, "desegment",
2021                 "Reassemble CMP-over-TCP messages spanning multiple TCP segments",
2022                 "Whether the CMP-over-TCP dissector should reassemble messages spanning multiple TCP segments. "
2023                 "To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
2024                 &cmp_desegment);
2025 }
2026
2027
2028 /*--- proto_reg_handoff_cmp -------------------------------------------*/
2029 void proto_reg_handoff_cmp(void) {
2030         dissector_handle_t cmp_http_handle;
2031         dissector_handle_t cmp_tcp_handle;
2032
2033         cmp_http_handle = new_create_dissector_handle(dissect_cmp_http, proto_cmp);
2034         dissector_add_string("media_type", "application/pkixcmp", cmp_http_handle);
2035
2036         cmp_tcp_handle = new_create_dissector_handle(dissect_cmp_tcp, proto_cmp);
2037         dissector_add("tcp.port", TCP_PORT_CMP, cmp_tcp_handle);
2038
2039 /*#include "packet-cmp-dis-tab.c"*/
2040 }
2041