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