fix usage of "if(tree) {" to display the right things, even if no coloring rule is set
[obnox/wireshark/wip.git] / epan / dissectors / packet-ocsp.c
1 /* Do not modify this file.                                                   */
2 /* It is created automatically by the ASN.1 to Ethereal dissector compiler    */
3 /* ./packet-ocsp.c                                                            */
4 /* ../../tools/asn2eth.py -X -b -e -p ocsp -c ocsp.cnf -s packet-ocsp-template OCSP.asn */
5
6 /* Input file: packet-ocsp-template.c */
7
8 /* packet-ocsp.c
9  * Routines for Online Certificate Status Protocol (RFC2560) packet dissection
10  *  Ronnie Sahlberg 2004
11  *
12  * $Id: packet-ocsp-template.c 12573 2004-11-22 03:36:26Z sahlberg $
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
40 #include <stdio.h>
41 #include <string.h>
42
43 #include "packet-ber.h"
44 #include "packet-ocsp.h"
45 #include "packet-x509af.h"
46 #include "packet-x509ce.h"
47 #include "packet-pkix1implicit.h"
48 #include "packet-pkix1explicit.h"
49
50 #define PNAME  "Online Certificate Status Protocol"
51 #define PSNAME "OCSP"
52 #define PFNAME "ocsp"
53
54 /* Initialize the protocol and registered fields */
55 static int proto_ocsp = -1;
56 static int hf_ocsp_responseType_id = -1;
57
58 /*--- Included file: packet-ocsp-hf.c ---*/
59
60 static int hf_ocsp_BasicOCSPResponse_PDU = -1;    /* BasicOCSPResponse */
61 static int hf_ocsp_ArchiveCutoff_PDU = -1;        /* ArchiveCutoff */
62 static int hf_ocsp_AcceptableResponses_PDU = -1;  /* AcceptableResponses */
63 static int hf_ocsp_ServiceLocator_PDU = -1;       /* ServiceLocator */
64 static int hf_ocsp_CrlID_PDU = -1;                /* CrlID */
65 static int hf_ocsp_tbsRequest = -1;               /* TBSRequest */
66 static int hf_ocsp_optionalSignature = -1;        /* Signature */
67 static int hf_ocsp_version = -1;                  /* Version */
68 static int hf_ocsp_requestorName = -1;            /* GeneralName */
69 static int hf_ocsp_requestList = -1;              /* SEQUNCE_OF_Request */
70 static int hf_ocsp_requestList_item = -1;         /* Request */
71 static int hf_ocsp_requestExtensions = -1;        /* Extensions */
72 static int hf_ocsp_signatureAlgorithm = -1;       /* AlgorithmIdentifier */
73 static int hf_ocsp_signature = -1;                /* BIT_STRING */
74 static int hf_ocsp_certs = -1;                    /* SEQUNCE_OF_Certificate */
75 static int hf_ocsp_certs_item = -1;               /* Certificate */
76 static int hf_ocsp_reqCert = -1;                  /* CertID */
77 static int hf_ocsp_singleRequestExtensions = -1;  /* Extensions */
78 static int hf_ocsp_hashAlgorithm = -1;            /* AlgorithmIdentifier */
79 static int hf_ocsp_issuerNameHash = -1;           /* OCTET_STRING */
80 static int hf_ocsp_issuerKeyHash = -1;            /* OCTET_STRING */
81 static int hf_ocsp_serialNumber = -1;             /* CertificateSerialNumber */
82 static int hf_ocsp_responseStatus = -1;           /* OCSPResponseStatus */
83 static int hf_ocsp_responseBytes = -1;            /* ResponseBytes */
84 static int hf_ocsp_responseType = -1;             /* T_responseType */
85 static int hf_ocsp_response = -1;                 /* T_response */
86 static int hf_ocsp_tbsResponseData = -1;          /* ResponseData */
87 static int hf_ocsp_responderID = -1;              /* ResponderID */
88 static int hf_ocsp_producedAt = -1;               /* GeneralizedTime */
89 static int hf_ocsp_responses = -1;                /* SEQUNCE_OF_SingleResponse */
90 static int hf_ocsp_responses_item = -1;           /* SingleResponse */
91 static int hf_ocsp_responseExtensions = -1;       /* Extensions */
92 static int hf_ocsp_byName = -1;                   /* Name */
93 static int hf_ocsp_byKey = -1;                    /* KeyHash */
94 static int hf_ocsp_certID = -1;                   /* CertID */
95 static int hf_ocsp_certStatus = -1;               /* CertStatus */
96 static int hf_ocsp_thisUpdate = -1;               /* GeneralizedTime */
97 static int hf_ocsp_nextUpdate = -1;               /* GeneralizedTime */
98 static int hf_ocsp_singleExtensions = -1;         /* Extensions */
99 static int hf_ocsp_good = -1;                     /* NULL */
100 static int hf_ocsp_revoked = -1;                  /* RevokedInfo */
101 static int hf_ocsp_unknown = -1;                  /* UnknownInfo */
102 static int hf_ocsp_revocationTime = -1;           /* GeneralizedTime */
103 static int hf_ocsp_revocationReason = -1;         /* CRLReason */
104 static int hf_ocsp_AcceptableResponses_item = -1;  /* OBJECT_IDENTIFIER */
105 static int hf_ocsp_issuer = -1;                   /* Name */
106 static int hf_ocsp_locator = -1;                  /* AuthorityInfoAccessSyntax */
107 static int hf_ocsp_crlUrl = -1;                   /* IA5String */
108 static int hf_ocsp_crlNum = -1;                   /* INTEGER */
109 static int hf_ocsp_crlTime = -1;                  /* GeneralizedTime */
110
111 /*--- End of included file: packet-ocsp-hf.c ---*/
112
113
114 /* Initialize the subtree pointers */
115 static gint ett_ocsp = -1;
116
117 /*--- Included file: packet-ocsp-ett.c ---*/
118
119 static gint ett_ocsp_OCSPRequest = -1;
120 static gint ett_ocsp_TBSRequest = -1;
121 static gint ett_ocsp_SEQUNCE_OF_Request = -1;
122 static gint ett_ocsp_Signature = -1;
123 static gint ett_ocsp_SEQUNCE_OF_Certificate = -1;
124 static gint ett_ocsp_Request = -1;
125 static gint ett_ocsp_CertID = -1;
126 static gint ett_ocsp_OCSPResponse = -1;
127 static gint ett_ocsp_ResponseBytes = -1;
128 static gint ett_ocsp_BasicOCSPResponse = -1;
129 static gint ett_ocsp_ResponseData = -1;
130 static gint ett_ocsp_SEQUNCE_OF_SingleResponse = -1;
131 static gint ett_ocsp_ResponderID = -1;
132 static gint ett_ocsp_SingleResponse = -1;
133 static gint ett_ocsp_CertStatus = -1;
134 static gint ett_ocsp_RevokedInfo = -1;
135 static gint ett_ocsp_AcceptableResponses = -1;
136 static gint ett_ocsp_ServiceLocator = -1;
137 static gint ett_ocsp_CrlID = -1;
138
139 /*--- End of included file: packet-ocsp-ett.c ---*/
140
141
142 static char responseType_id[64]; /*64 chars should be long enough? */
143
144
145
146 /*--- Included file: packet-ocsp-fn.c ---*/
147
148 /*--- Fields for imported types ---*/
149
150 static int dissect_requestorName(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
151   return dissect_pkix1explicit_GeneralName(FALSE, tvb, offset, pinfo, tree, hf_ocsp_requestorName);
152 }
153 static int dissect_requestExtensions(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
154   return dissect_pkix1explicit_Extensions(FALSE, tvb, offset, pinfo, tree, hf_ocsp_requestExtensions);
155 }
156 static int dissect_signatureAlgorithm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
157   return dissect_x509af_AlgorithmIdentifier(FALSE, tvb, offset, pinfo, tree, hf_ocsp_signatureAlgorithm);
158 }
159 static int dissect_certs_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
160   return dissect_x509af_Certificate(FALSE, tvb, offset, pinfo, tree, hf_ocsp_certs_item);
161 }
162 static int dissect_singleRequestExtensions(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
163   return dissect_pkix1explicit_Extensions(FALSE, tvb, offset, pinfo, tree, hf_ocsp_singleRequestExtensions);
164 }
165 static int dissect_hashAlgorithm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
166   return dissect_x509af_AlgorithmIdentifier(FALSE, tvb, offset, pinfo, tree, hf_ocsp_hashAlgorithm);
167 }
168 static int dissect_serialNumber(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
169   return dissect_pkix1explicit_CertificateSerialNumber(FALSE, tvb, offset, pinfo, tree, hf_ocsp_serialNumber);
170 }
171 static int dissect_responseExtensions(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
172   return dissect_pkix1explicit_Extensions(FALSE, tvb, offset, pinfo, tree, hf_ocsp_responseExtensions);
173 }
174 static int dissect_byName(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
175   return dissect_pkix1explicit_Name(FALSE, tvb, offset, pinfo, tree, hf_ocsp_byName);
176 }
177 static int dissect_singleExtensions(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
178   return dissect_pkix1explicit_Extensions(FALSE, tvb, offset, pinfo, tree, hf_ocsp_singleExtensions);
179 }
180 static int dissect_revocationReason(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
181   return dissect_x509ce_CRLReason(FALSE, tvb, offset, pinfo, tree, hf_ocsp_revocationReason);
182 }
183 static int dissect_issuer(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
184   return dissect_pkix1explicit_Name(FALSE, tvb, offset, pinfo, tree, hf_ocsp_issuer);
185 }
186 static int dissect_locator(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
187   return dissect_pkix1implicit_AuthorityInfoAccessSyntax(FALSE, tvb, offset, pinfo, tree, hf_ocsp_locator);
188 }
189
190
191 static const value_string OCSPVersion_vals[] = {
192   {   0, "v1" },
193   { 0, NULL }
194 };
195
196
197 static int
198 dissect_ocsp_Version(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
199   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL);
200
201   return offset;
202 }
203 static int dissect_version(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
204   return dissect_ocsp_Version(FALSE, tvb, offset, pinfo, tree, hf_ocsp_version);
205 }
206
207
208 static int
209 dissect_ocsp_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
210   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
211                                     NULL);
212
213   return offset;
214 }
215 static int dissect_issuerNameHash(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
216   return dissect_ocsp_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_ocsp_issuerNameHash);
217 }
218 static int dissect_issuerKeyHash(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
219   return dissect_ocsp_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_ocsp_issuerKeyHash);
220 }
221
222 static const ber_sequence_t CertID_sequence[] = {
223   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_hashAlgorithm },
224   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_issuerNameHash },
225   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_issuerKeyHash },
226   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_serialNumber },
227   { 0, 0, 0, NULL }
228 };
229
230 static int
231 dissect_ocsp_CertID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
232   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
233                                 CertID_sequence, hf_index, ett_ocsp_CertID);
234
235   return offset;
236 }
237 static int dissect_reqCert(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
238   return dissect_ocsp_CertID(FALSE, tvb, offset, pinfo, tree, hf_ocsp_reqCert);
239 }
240 static int dissect_certID(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
241   return dissect_ocsp_CertID(FALSE, tvb, offset, pinfo, tree, hf_ocsp_certID);
242 }
243
244 static const ber_sequence_t Request_sequence[] = {
245   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_reqCert },
246   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_singleRequestExtensions },
247   { 0, 0, 0, NULL }
248 };
249
250 static int
251 dissect_ocsp_Request(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
252   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
253                                 Request_sequence, hf_index, ett_ocsp_Request);
254
255   return offset;
256 }
257 static int dissect_requestList_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
258   return dissect_ocsp_Request(FALSE, tvb, offset, pinfo, tree, hf_ocsp_requestList_item);
259 }
260
261 static const ber_sequence_t SEQUNCE_OF_Request_sequence_of[1] = {
262   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_requestList_item },
263 };
264
265 static int
266 dissect_ocsp_SEQUNCE_OF_Request(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
267   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
268                                    SEQUNCE_OF_Request_sequence_of, hf_index, ett_ocsp_SEQUNCE_OF_Request);
269
270   return offset;
271 }
272 static int dissect_requestList(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
273   return dissect_ocsp_SEQUNCE_OF_Request(FALSE, tvb, offset, pinfo, tree, hf_ocsp_requestList);
274 }
275
276 static const ber_sequence_t TBSRequest_sequence[] = {
277   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_version },
278   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_requestorName },
279   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_requestList },
280   { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL, dissect_requestExtensions },
281   { 0, 0, 0, NULL }
282 };
283
284 static int
285 dissect_ocsp_TBSRequest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
286   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
287                                 TBSRequest_sequence, hf_index, ett_ocsp_TBSRequest);
288
289   return offset;
290 }
291 static int dissect_tbsRequest(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
292   return dissect_ocsp_TBSRequest(FALSE, tvb, offset, pinfo, tree, hf_ocsp_tbsRequest);
293 }
294
295
296 static int
297 dissect_ocsp_BIT_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
298   offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
299                                  NULL, hf_index, -1,
300                                  NULL);
301
302   return offset;
303 }
304 static int dissect_signature(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
305   return dissect_ocsp_BIT_STRING(FALSE, tvb, offset, pinfo, tree, hf_ocsp_signature);
306 }
307
308 static const ber_sequence_t SEQUNCE_OF_Certificate_sequence_of[1] = {
309   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_certs_item },
310 };
311
312 static int
313 dissect_ocsp_SEQUNCE_OF_Certificate(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
314   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
315                                    SEQUNCE_OF_Certificate_sequence_of, hf_index, ett_ocsp_SEQUNCE_OF_Certificate);
316
317   return offset;
318 }
319 static int dissect_certs(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
320   return dissect_ocsp_SEQUNCE_OF_Certificate(FALSE, tvb, offset, pinfo, tree, hf_ocsp_certs);
321 }
322
323 static const ber_sequence_t Signature_sequence[] = {
324   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_signatureAlgorithm },
325   { BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_NOOWNTAG, dissect_signature },
326   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_certs },
327   { 0, 0, 0, NULL }
328 };
329
330 static int
331 dissect_ocsp_Signature(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
332   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
333                                 Signature_sequence, hf_index, ett_ocsp_Signature);
334
335   return offset;
336 }
337 static int dissect_optionalSignature(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
338   return dissect_ocsp_Signature(FALSE, tvb, offset, pinfo, tree, hf_ocsp_optionalSignature);
339 }
340
341 static const ber_sequence_t OCSPRequest_sequence[] = {
342   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_tbsRequest },
343   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_optionalSignature },
344   { 0, 0, 0, NULL }
345 };
346
347 static int
348 dissect_ocsp_OCSPRequest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
349   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
350                                 OCSPRequest_sequence, hf_index, ett_ocsp_OCSPRequest);
351
352   return offset;
353 }
354
355
356 static const value_string OCSPResponseStatus_vals[] = {
357   {   0, "successful" },
358   {   1, "malformedRequest" },
359   {   2, "internalError" },
360   {   3, "tryLater" },
361   {   5, "sigRequired" },
362   {   6, "unauthorized" },
363   { 0, NULL }
364 };
365
366
367 static int
368 dissect_ocsp_OCSPResponseStatus(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
369   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL);
370
371   return offset;
372 }
373 static int dissect_responseStatus(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
374   return dissect_ocsp_OCSPResponseStatus(FALSE, tvb, offset, pinfo, tree, hf_ocsp_responseStatus);
375 }
376
377
378 static int
379 dissect_ocsp_T_responseType(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
380   offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
381                                  hf_ocsp_responseType_id, responseType_id);
382
383
384   return offset;
385 }
386 static int dissect_responseType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
387   return dissect_ocsp_T_responseType(FALSE, tvb, offset, pinfo, tree, hf_ocsp_responseType);
388 }
389
390
391 static int
392 dissect_ocsp_T_response(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
393   guint8 class;
394   gboolean pc, ind;
395   guint32 tag;
396   guint32 len;
397   /* skip past the T and L  */
398   offset = dissect_ber_identifier(pinfo, tree, tvb, offset, &class, &pc, &tag);
399   offset = dissect_ber_length(pinfo, tree, tvb, offset, &len, &ind);
400   offset=call_ber_oid_callback(responseType_id, tvb, offset, pinfo, tree);
401
402
403   return offset;
404 }
405 static int dissect_response(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
406   return dissect_ocsp_T_response(FALSE, tvb, offset, pinfo, tree, hf_ocsp_response);
407 }
408
409 static const ber_sequence_t ResponseBytes_sequence[] = {
410   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_responseType },
411   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_response },
412   { 0, 0, 0, NULL }
413 };
414
415 static int
416 dissect_ocsp_ResponseBytes(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
417   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
418                                 ResponseBytes_sequence, hf_index, ett_ocsp_ResponseBytes);
419
420   return offset;
421 }
422 static int dissect_responseBytes(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
423   return dissect_ocsp_ResponseBytes(FALSE, tvb, offset, pinfo, tree, hf_ocsp_responseBytes);
424 }
425
426 static const ber_sequence_t OCSPResponse_sequence[] = {
427   { BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_responseStatus },
428   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_responseBytes },
429   { 0, 0, 0, NULL }
430 };
431
432 static int
433 dissect_ocsp_OCSPResponse(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
434   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
435                                 OCSPResponse_sequence, hf_index, ett_ocsp_OCSPResponse);
436
437   return offset;
438 }
439
440
441 static int
442 dissect_ocsp_KeyHash(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
443   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
444                                     NULL);
445
446   return offset;
447 }
448 static int dissect_byKey(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
449   return dissect_ocsp_KeyHash(FALSE, tvb, offset, pinfo, tree, hf_ocsp_byKey);
450 }
451
452
453 static const value_string ResponderID_vals[] = {
454   {   1, "byName" },
455   {   2, "byKey" },
456   { 0, NULL }
457 };
458
459 static const ber_choice_t ResponderID_choice[] = {
460   {   1, BER_CLASS_CON, 1, 0, dissect_byName },
461   {   2, BER_CLASS_CON, 2, 0, dissect_byKey },
462   { 0, 0, 0, 0, NULL }
463 };
464
465 static int
466 dissect_ocsp_ResponderID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
467   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
468                               ResponderID_choice, hf_index, ett_ocsp_ResponderID);
469
470   return offset;
471 }
472 static int dissect_responderID(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
473   return dissect_ocsp_ResponderID(FALSE, tvb, offset, pinfo, tree, hf_ocsp_responderID);
474 }
475
476
477 static int
478 dissect_ocsp_GeneralizedTime(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
479   offset = dissect_ber_GeneralizedTime(implicit_tag, pinfo, tree, tvb, offset, hf_index);
480
481   return offset;
482 }
483 static int dissect_producedAt(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
484   return dissect_ocsp_GeneralizedTime(FALSE, tvb, offset, pinfo, tree, hf_ocsp_producedAt);
485 }
486 static int dissect_thisUpdate(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
487   return dissect_ocsp_GeneralizedTime(FALSE, tvb, offset, pinfo, tree, hf_ocsp_thisUpdate);
488 }
489 static int dissect_nextUpdate(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
490   return dissect_ocsp_GeneralizedTime(FALSE, tvb, offset, pinfo, tree, hf_ocsp_nextUpdate);
491 }
492 static int dissect_revocationTime(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
493   return dissect_ocsp_GeneralizedTime(FALSE, tvb, offset, pinfo, tree, hf_ocsp_revocationTime);
494 }
495 static int dissect_crlTime(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
496   return dissect_ocsp_GeneralizedTime(FALSE, tvb, offset, pinfo, tree, hf_ocsp_crlTime);
497 }
498
499
500 static int
501 dissect_ocsp_NULL(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
502   { proto_item *ti_tmp;
503   ti_tmp = proto_tree_add_item(tree, hf_index, tvb, offset>>8, 0, FALSE);
504   proto_item_append_text(ti_tmp, ": NULL");
505   }
506
507   return offset;
508 }
509 static int dissect_good_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
510   return dissect_ocsp_NULL(TRUE, tvb, offset, pinfo, tree, hf_ocsp_good);
511 }
512
513 static const ber_sequence_t RevokedInfo_sequence[] = {
514   { BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_NOOWNTAG, dissect_revocationTime },
515   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_revocationReason },
516   { 0, 0, 0, NULL }
517 };
518
519 static int
520 dissect_ocsp_RevokedInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
521   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
522                                 RevokedInfo_sequence, hf_index, ett_ocsp_RevokedInfo);
523
524   return offset;
525 }
526 static int dissect_revoked_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
527   return dissect_ocsp_RevokedInfo(TRUE, tvb, offset, pinfo, tree, hf_ocsp_revoked);
528 }
529
530
531 static int
532 dissect_ocsp_UnknownInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
533   { proto_item *ti_tmp;
534   ti_tmp = proto_tree_add_item(tree, hf_index, tvb, offset>>8, 0, FALSE);
535   proto_item_append_text(ti_tmp, ": NULL");
536   }
537
538   return offset;
539 }
540 static int dissect_unknown_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
541   return dissect_ocsp_UnknownInfo(TRUE, tvb, offset, pinfo, tree, hf_ocsp_unknown);
542 }
543
544
545 static const value_string CertStatus_vals[] = {
546   {   0, "good" },
547   {   1, "revoked" },
548   {   2, "unknown" },
549   { 0, NULL }
550 };
551
552 static const ber_choice_t CertStatus_choice[] = {
553   {   0, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_good_impl },
554   {   1, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_revoked_impl },
555   {   2, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_unknown_impl },
556   { 0, 0, 0, 0, NULL }
557 };
558
559 static int
560 dissect_ocsp_CertStatus(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
561   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
562                               CertStatus_choice, hf_index, ett_ocsp_CertStatus);
563
564   return offset;
565 }
566 static int dissect_certStatus(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
567   return dissect_ocsp_CertStatus(FALSE, tvb, offset, pinfo, tree, hf_ocsp_certStatus);
568 }
569
570 static const ber_sequence_t SingleResponse_sequence[] = {
571   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_certID },
572   { BER_CLASS_CON, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_certStatus },
573   { BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_NOOWNTAG, dissect_thisUpdate },
574   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_nextUpdate },
575   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_singleExtensions },
576   { 0, 0, 0, NULL }
577 };
578
579 static int
580 dissect_ocsp_SingleResponse(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
581   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
582                                 SingleResponse_sequence, hf_index, ett_ocsp_SingleResponse);
583
584   return offset;
585 }
586 static int dissect_responses_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
587   return dissect_ocsp_SingleResponse(FALSE, tvb, offset, pinfo, tree, hf_ocsp_responses_item);
588 }
589
590 static const ber_sequence_t SEQUNCE_OF_SingleResponse_sequence_of[1] = {
591   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_responses_item },
592 };
593
594 static int
595 dissect_ocsp_SEQUNCE_OF_SingleResponse(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
596   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
597                                    SEQUNCE_OF_SingleResponse_sequence_of, hf_index, ett_ocsp_SEQUNCE_OF_SingleResponse);
598
599   return offset;
600 }
601 static int dissect_responses(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
602   return dissect_ocsp_SEQUNCE_OF_SingleResponse(FALSE, tvb, offset, pinfo, tree, hf_ocsp_responses);
603 }
604
605 static const ber_sequence_t ResponseData_sequence[] = {
606   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_version },
607   { BER_CLASS_CON, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_responderID },
608   { BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_NOOWNTAG, dissect_producedAt },
609   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_responses },
610   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_responseExtensions },
611   { 0, 0, 0, NULL }
612 };
613
614 static int
615 dissect_ocsp_ResponseData(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
616   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
617                                 ResponseData_sequence, hf_index, ett_ocsp_ResponseData);
618
619   return offset;
620 }
621 static int dissect_tbsResponseData(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
622   return dissect_ocsp_ResponseData(FALSE, tvb, offset, pinfo, tree, hf_ocsp_tbsResponseData);
623 }
624
625 static const ber_sequence_t BasicOCSPResponse_sequence[] = {
626   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_tbsResponseData },
627   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_signatureAlgorithm },
628   { BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_NOOWNTAG, dissect_signature },
629   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_certs },
630   { 0, 0, 0, NULL }
631 };
632
633 static int
634 dissect_ocsp_BasicOCSPResponse(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
635   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
636                                 BasicOCSPResponse_sequence, hf_index, ett_ocsp_BasicOCSPResponse);
637
638   return offset;
639 }
640
641
642 static int
643 dissect_ocsp_ArchiveCutoff(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
644   offset = dissect_ber_GeneralizedTime(implicit_tag, pinfo, tree, tvb, offset, hf_index);
645
646   return offset;
647 }
648
649
650 static int
651 dissect_ocsp_OBJECT_IDENTIFIER(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
652   offset = dissect_ber_object_identifier(implicit_tag, pinfo, tree, tvb, offset,
653                                          hf_index, NULL);
654
655   return offset;
656 }
657 static int dissect_AcceptableResponses_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
658   return dissect_ocsp_OBJECT_IDENTIFIER(FALSE, tvb, offset, pinfo, tree, hf_ocsp_AcceptableResponses_item);
659 }
660
661 static const ber_sequence_t AcceptableResponses_sequence_of[1] = {
662   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_AcceptableResponses_item },
663 };
664
665 static int
666 dissect_ocsp_AcceptableResponses(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
667   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
668                                    AcceptableResponses_sequence_of, hf_index, ett_ocsp_AcceptableResponses);
669
670   return offset;
671 }
672
673 static const ber_sequence_t ServiceLocator_sequence[] = {
674   { BER_CLASS_ANY, -1, BER_FLAGS_NOOWNTAG, dissect_issuer },
675   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_locator },
676   { 0, 0, 0, NULL }
677 };
678
679 static int
680 dissect_ocsp_ServiceLocator(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
681   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
682                                 ServiceLocator_sequence, hf_index, ett_ocsp_ServiceLocator);
683
684   return offset;
685 }
686
687
688 static int
689 dissect_ocsp_IA5String(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
690   offset = dissect_ber_restricted_string(implicit_tag, 0,
691                                          pinfo, tree, tvb, offset, hf_index,
692                                          NULL);
693
694   return offset;
695 }
696 static int dissect_crlUrl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
697   return dissect_ocsp_IA5String(FALSE, tvb, offset, pinfo, tree, hf_ocsp_crlUrl);
698 }
699
700
701
702 static int
703 dissect_ocsp_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
704   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL);
705
706   return offset;
707 }
708 static int dissect_crlNum(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
709   return dissect_ocsp_INTEGER(FALSE, tvb, offset, pinfo, tree, hf_ocsp_crlNum);
710 }
711
712 static const ber_sequence_t CrlID_sequence[] = {
713   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_crlUrl },
714   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_crlNum },
715   { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL, dissect_crlTime },
716   { 0, 0, 0, NULL }
717 };
718
719 static int
720 dissect_ocsp_CrlID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
721   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
722                                 CrlID_sequence, hf_index, ett_ocsp_CrlID);
723
724   return offset;
725 }
726
727 /*--- PDUs ---*/
728
729 static void dissect_BasicOCSPResponse_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
730   dissect_ocsp_BasicOCSPResponse(FALSE, tvb, 0, pinfo, tree, hf_ocsp_BasicOCSPResponse_PDU);
731 }
732 static void dissect_ArchiveCutoff_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
733   dissect_ocsp_ArchiveCutoff(FALSE, tvb, 0, pinfo, tree, hf_ocsp_ArchiveCutoff_PDU);
734 }
735 static void dissect_AcceptableResponses_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
736   dissect_ocsp_AcceptableResponses(FALSE, tvb, 0, pinfo, tree, hf_ocsp_AcceptableResponses_PDU);
737 }
738 static void dissect_ServiceLocator_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
739   dissect_ocsp_ServiceLocator(FALSE, tvb, 0, pinfo, tree, hf_ocsp_ServiceLocator_PDU);
740 }
741 static void dissect_CrlID_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
742   dissect_ocsp_CrlID(FALSE, tvb, 0, pinfo, tree, hf_ocsp_CrlID_PDU);
743 }
744
745
746 /*--- End of included file: packet-ocsp-fn.c ---*/
747
748
749
750 static int
751 dissect_ocsp_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
752 {
753         proto_item *item=NULL;
754         proto_tree *tree=NULL;
755
756         if (check_col(pinfo->cinfo, COL_PROTOCOL)) 
757                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "OCSP");
758
759         if (check_col(pinfo->cinfo, COL_INFO)) {
760                 col_clear(pinfo->cinfo, COL_INFO);
761                 
762                 col_add_fstr(pinfo->cinfo, COL_INFO, "Request");
763         }
764
765
766         if(parent_tree){
767                 item=proto_tree_add_item(parent_tree, proto_ocsp, tvb, 0, -1, FALSE);
768                 tree = proto_item_add_subtree(item, ett_ocsp);
769         }
770
771         return dissect_ocsp_OCSPRequest(FALSE, tvb, 0, pinfo, tree, -1);
772 }
773
774
775 static int
776 dissect_ocsp_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
777 {
778         proto_item *item=NULL;
779         proto_tree *tree=NULL;
780
781         if (check_col(pinfo->cinfo, COL_PROTOCOL)) 
782                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "OCSP");
783
784         if (check_col(pinfo->cinfo, COL_INFO)) {
785                 col_clear(pinfo->cinfo, COL_INFO);
786                 
787                 col_add_fstr(pinfo->cinfo, COL_INFO, "Response");
788         }
789
790
791         if(parent_tree){
792                 item=proto_tree_add_item(parent_tree, proto_ocsp, tvb, 0, -1, FALSE);
793                 tree = proto_item_add_subtree(item, ett_ocsp);
794         }
795
796         return dissect_ocsp_OCSPResponse(FALSE, tvb, 0, pinfo, tree, -1);
797 }
798
799 /*--- proto_register_ocsp ----------------------------------------------*/
800 void proto_register_ocsp(void) {
801
802   /* List of fields */
803   static hf_register_info hf[] = {
804     { &hf_ocsp_responseType_id,
805       { "ResponseType Id", "x509af.responseType.id",
806         FT_STRING, BASE_NONE, NULL, 0,
807         "ResponseType Id", HFILL }},
808
809 /*--- Included file: packet-ocsp-hfarr.c ---*/
810
811     { &hf_ocsp_BasicOCSPResponse_PDU,
812       { "BasicOCSPResponse", "ocsp.BasicOCSPResponse",
813         FT_NONE, BASE_NONE, NULL, 0,
814         "BasicOCSPResponse", HFILL }},
815     { &hf_ocsp_ArchiveCutoff_PDU,
816       { "ArchiveCutoff", "ocsp.ArchiveCutoff",
817         FT_STRING, BASE_NONE, NULL, 0,
818         "ArchiveCutoff", HFILL }},
819     { &hf_ocsp_AcceptableResponses_PDU,
820       { "AcceptableResponses", "ocsp.AcceptableResponses",
821         FT_NONE, BASE_NONE, NULL, 0,
822         "AcceptableResponses", HFILL }},
823     { &hf_ocsp_ServiceLocator_PDU,
824       { "ServiceLocator", "ocsp.ServiceLocator",
825         FT_NONE, BASE_NONE, NULL, 0,
826         "ServiceLocator", HFILL }},
827     { &hf_ocsp_CrlID_PDU,
828       { "CrlID", "ocsp.CrlID",
829         FT_NONE, BASE_NONE, NULL, 0,
830         "CrlID", HFILL }},
831     { &hf_ocsp_tbsRequest,
832       { "tbsRequest", "ocsp.tbsRequest",
833         FT_NONE, BASE_NONE, NULL, 0,
834         "OCSPRequest/tbsRequest", HFILL }},
835     { &hf_ocsp_optionalSignature,
836       { "optionalSignature", "ocsp.optionalSignature",
837         FT_NONE, BASE_NONE, NULL, 0,
838         "OCSPRequest/optionalSignature", HFILL }},
839     { &hf_ocsp_version,
840       { "version", "ocsp.version",
841         FT_INT32, BASE_DEC, VALS(OCSPVersion_vals), 0,
842         "", HFILL }},
843     { &hf_ocsp_requestorName,
844       { "requestorName", "ocsp.requestorName",
845         FT_UINT32, BASE_DEC, VALS(GeneralName_vals), 0,
846         "TBSRequest/requestorName", HFILL }},
847     { &hf_ocsp_requestList,
848       { "requestList", "ocsp.requestList",
849         FT_NONE, BASE_NONE, NULL, 0,
850         "TBSRequest/requestList", HFILL }},
851     { &hf_ocsp_requestList_item,
852       { "Item", "ocsp.requestList_item",
853         FT_NONE, BASE_NONE, NULL, 0,
854         "TBSRequest/requestList/_item", HFILL }},
855     { &hf_ocsp_requestExtensions,
856       { "requestExtensions", "ocsp.requestExtensions",
857         FT_NONE, BASE_NONE, NULL, 0,
858         "TBSRequest/requestExtensions", HFILL }},
859     { &hf_ocsp_signatureAlgorithm,
860       { "signatureAlgorithm", "ocsp.signatureAlgorithm",
861         FT_NONE, BASE_NONE, NULL, 0,
862         "", HFILL }},
863     { &hf_ocsp_signature,
864       { "signature", "ocsp.signature",
865         FT_BYTES, BASE_HEX, NULL, 0,
866         "", HFILL }},
867     { &hf_ocsp_certs,
868       { "certs", "ocsp.certs",
869         FT_NONE, BASE_NONE, NULL, 0,
870         "", HFILL }},
871     { &hf_ocsp_certs_item,
872       { "Item", "ocsp.certs_item",
873         FT_NONE, BASE_NONE, NULL, 0,
874         "", HFILL }},
875     { &hf_ocsp_reqCert,
876       { "reqCert", "ocsp.reqCert",
877         FT_NONE, BASE_NONE, NULL, 0,
878         "Request/reqCert", HFILL }},
879     { &hf_ocsp_singleRequestExtensions,
880       { "singleRequestExtensions", "ocsp.singleRequestExtensions",
881         FT_NONE, BASE_NONE, NULL, 0,
882         "Request/singleRequestExtensions", HFILL }},
883     { &hf_ocsp_hashAlgorithm,
884       { "hashAlgorithm", "ocsp.hashAlgorithm",
885         FT_NONE, BASE_NONE, NULL, 0,
886         "CertID/hashAlgorithm", HFILL }},
887     { &hf_ocsp_issuerNameHash,
888       { "issuerNameHash", "ocsp.issuerNameHash",
889         FT_BYTES, BASE_HEX, NULL, 0,
890         "CertID/issuerNameHash", HFILL }},
891     { &hf_ocsp_issuerKeyHash,
892       { "issuerKeyHash", "ocsp.issuerKeyHash",
893         FT_BYTES, BASE_HEX, NULL, 0,
894         "CertID/issuerKeyHash", HFILL }},
895     { &hf_ocsp_serialNumber,
896       { "serialNumber", "ocsp.serialNumber",
897         FT_INT32, BASE_DEC, NULL, 0,
898         "CertID/serialNumber", HFILL }},
899     { &hf_ocsp_responseStatus,
900       { "responseStatus", "ocsp.responseStatus",
901         FT_UINT32, BASE_DEC, VALS(OCSPResponseStatus_vals), 0,
902         "OCSPResponse/responseStatus", HFILL }},
903     { &hf_ocsp_responseBytes,
904       { "responseBytes", "ocsp.responseBytes",
905         FT_NONE, BASE_NONE, NULL, 0,
906         "OCSPResponse/responseBytes", HFILL }},
907     { &hf_ocsp_responseType,
908       { "responseType", "ocsp.responseType",
909         FT_STRING, BASE_NONE, NULL, 0,
910         "ResponseBytes/responseType", HFILL }},
911     { &hf_ocsp_response,
912       { "response", "ocsp.response",
913         FT_BYTES, BASE_HEX, NULL, 0,
914         "ResponseBytes/response", HFILL }},
915     { &hf_ocsp_tbsResponseData,
916       { "tbsResponseData", "ocsp.tbsResponseData",
917         FT_NONE, BASE_NONE, NULL, 0,
918         "BasicOCSPResponse/tbsResponseData", HFILL }},
919     { &hf_ocsp_responderID,
920       { "responderID", "ocsp.responderID",
921         FT_UINT32, BASE_DEC, VALS(ResponderID_vals), 0,
922         "ResponseData/responderID", HFILL }},
923     { &hf_ocsp_producedAt,
924       { "producedAt", "ocsp.producedAt",
925         FT_STRING, BASE_NONE, NULL, 0,
926         "ResponseData/producedAt", HFILL }},
927     { &hf_ocsp_responses,
928       { "responses", "ocsp.responses",
929         FT_NONE, BASE_NONE, NULL, 0,
930         "ResponseData/responses", HFILL }},
931     { &hf_ocsp_responses_item,
932       { "Item", "ocsp.responses_item",
933         FT_NONE, BASE_NONE, NULL, 0,
934         "ResponseData/responses/_item", HFILL }},
935     { &hf_ocsp_responseExtensions,
936       { "responseExtensions", "ocsp.responseExtensions",
937         FT_NONE, BASE_NONE, NULL, 0,
938         "ResponseData/responseExtensions", HFILL }},
939     { &hf_ocsp_byName,
940       { "byName", "ocsp.byName",
941         FT_UINT32, BASE_DEC, NULL, 0,
942         "ResponderID/byName", HFILL }},
943     { &hf_ocsp_byKey,
944       { "byKey", "ocsp.byKey",
945         FT_BYTES, BASE_HEX, NULL, 0,
946         "ResponderID/byKey", HFILL }},
947     { &hf_ocsp_certID,
948       { "certID", "ocsp.certID",
949         FT_NONE, BASE_NONE, NULL, 0,
950         "SingleResponse/certID", HFILL }},
951     { &hf_ocsp_certStatus,
952       { "certStatus", "ocsp.certStatus",
953         FT_UINT32, BASE_DEC, VALS(CertStatus_vals), 0,
954         "SingleResponse/certStatus", HFILL }},
955     { &hf_ocsp_thisUpdate,
956       { "thisUpdate", "ocsp.thisUpdate",
957         FT_STRING, BASE_NONE, NULL, 0,
958         "SingleResponse/thisUpdate", HFILL }},
959     { &hf_ocsp_nextUpdate,
960       { "nextUpdate", "ocsp.nextUpdate",
961         FT_STRING, BASE_NONE, NULL, 0,
962         "SingleResponse/nextUpdate", HFILL }},
963     { &hf_ocsp_singleExtensions,
964       { "singleExtensions", "ocsp.singleExtensions",
965         FT_NONE, BASE_NONE, NULL, 0,
966         "SingleResponse/singleExtensions", HFILL }},
967     { &hf_ocsp_good,
968       { "good", "ocsp.good",
969         FT_NONE, BASE_NONE, NULL, 0,
970         "CertStatus/good", HFILL }},
971     { &hf_ocsp_revoked,
972       { "revoked", "ocsp.revoked",
973         FT_NONE, BASE_NONE, NULL, 0,
974         "CertStatus/revoked", HFILL }},
975     { &hf_ocsp_unknown,
976       { "unknown", "ocsp.unknown",
977         FT_NONE, BASE_NONE, NULL, 0,
978         "CertStatus/unknown", HFILL }},
979     { &hf_ocsp_revocationTime,
980       { "revocationTime", "ocsp.revocationTime",
981         FT_STRING, BASE_NONE, NULL, 0,
982         "RevokedInfo/revocationTime", HFILL }},
983     { &hf_ocsp_revocationReason,
984       { "revocationReason", "ocsp.revocationReason",
985         FT_UINT32, BASE_DEC, VALS(CRLReason_vals), 0,
986         "RevokedInfo/revocationReason", HFILL }},
987     { &hf_ocsp_AcceptableResponses_item,
988       { "Item", "ocsp.AcceptableResponses_item",
989         FT_STRING, BASE_NONE, NULL, 0,
990         "AcceptableResponses/_item", HFILL }},
991     { &hf_ocsp_issuer,
992       { "issuer", "ocsp.issuer",
993         FT_UINT32, BASE_DEC, NULL, 0,
994         "ServiceLocator/issuer", HFILL }},
995     { &hf_ocsp_locator,
996       { "locator", "ocsp.locator",
997         FT_UINT32, BASE_DEC, NULL, 0,
998         "ServiceLocator/locator", HFILL }},
999     { &hf_ocsp_crlUrl,
1000       { "crlUrl", "ocsp.crlUrl",
1001         FT_STRING, BASE_NONE, NULL, 0,
1002         "CrlID/crlUrl", HFILL }},
1003     { &hf_ocsp_crlNum,
1004       { "crlNum", "ocsp.crlNum",
1005         FT_INT32, BASE_DEC, NULL, 0,
1006         "CrlID/crlNum", HFILL }},
1007     { &hf_ocsp_crlTime,
1008       { "crlTime", "ocsp.crlTime",
1009         FT_STRING, BASE_NONE, NULL, 0,
1010         "CrlID/crlTime", HFILL }},
1011
1012 /*--- End of included file: packet-ocsp-hfarr.c ---*/
1013
1014   };
1015
1016   /* List of subtrees */
1017   static gint *ett[] = {
1018     &ett_ocsp,
1019
1020 /*--- Included file: packet-ocsp-ettarr.c ---*/
1021
1022     &ett_ocsp_OCSPRequest,
1023     &ett_ocsp_TBSRequest,
1024     &ett_ocsp_SEQUNCE_OF_Request,
1025     &ett_ocsp_Signature,
1026     &ett_ocsp_SEQUNCE_OF_Certificate,
1027     &ett_ocsp_Request,
1028     &ett_ocsp_CertID,
1029     &ett_ocsp_OCSPResponse,
1030     &ett_ocsp_ResponseBytes,
1031     &ett_ocsp_BasicOCSPResponse,
1032     &ett_ocsp_ResponseData,
1033     &ett_ocsp_SEQUNCE_OF_SingleResponse,
1034     &ett_ocsp_ResponderID,
1035     &ett_ocsp_SingleResponse,
1036     &ett_ocsp_CertStatus,
1037     &ett_ocsp_RevokedInfo,
1038     &ett_ocsp_AcceptableResponses,
1039     &ett_ocsp_ServiceLocator,
1040     &ett_ocsp_CrlID,
1041
1042 /*--- End of included file: packet-ocsp-ettarr.c ---*/
1043
1044   };
1045
1046   /* Register protocol */
1047   proto_ocsp = proto_register_protocol(PNAME, PSNAME, PFNAME);
1048
1049   /* Register fields and subtrees */
1050   proto_register_field_array(proto_ocsp, hf, array_length(hf));
1051   proto_register_subtree_array(ett, array_length(ett));
1052
1053 }
1054
1055 /*--- proto_reg_handoff_ocsp -------------------------------------------*/
1056 void proto_reg_handoff_ocsp(void) {
1057         dissector_handle_t ocsp_request_handle;
1058         dissector_handle_t ocsp_response_handle;
1059
1060         ocsp_request_handle = new_create_dissector_handle(dissect_ocsp_request, proto_ocsp);
1061         ocsp_response_handle = new_create_dissector_handle(dissect_ocsp_response, proto_ocsp);
1062
1063         dissector_add_string("media_type", "application/ocsp-request", ocsp_request_handle);
1064         dissector_add_string("media_type", "application/ocsp-response", ocsp_response_handle);
1065
1066
1067 /*--- Included file: packet-ocsp-dis-tab.c ---*/
1068
1069  register_ber_oid_dissector("1.3.6.1.5.5.7.48.1.1", dissect_BasicOCSPResponse_PDU, proto_ocsp, "id-pkix-ocsp-basic");
1070  register_ber_oid_dissector("1.3.6.1.5.5.7.48.1.3", dissect_CrlID_PDU, proto_ocsp, "id-pkix-ocsp-crl");
1071  register_ber_oid_dissector("1.3.6.1.5.5.7.48.1.4", dissect_AcceptableResponses_PDU, proto_ocsp, "id-pkix-ocsp-response");
1072  register_ber_oid_dissector("1.3.6.1.5.5.7.48.1.6", dissect_ArchiveCutoff_PDU, proto_ocsp, "id-pkix-ocsp-archive-cutoff");
1073  register_ber_oid_dissector("1.3.6.1.5.5.7.48.1.7", dissect_ServiceLocator_PDU, proto_ocsp, "id-pkix-ocsp-service-locator");
1074
1075
1076 /*--- End of included file: packet-ocsp-dis-tab.c ---*/
1077
1078 }
1079