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