- dissect_ber_object_identifier() returns value as tvb
[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$
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;              /* SEQUENCE_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;                    /* SEQUENCE_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;                /* SEQUENCE_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_SEQUENCE_OF_Request = -1;
122 static gint ett_ocsp_Signature = -1;
123 static gint ett_ocsp_SEQUENCE_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_SEQUENCE_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 const char *responseType_id;
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 ocsp_Version_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,
200                                   NULL);
201
202   return offset;
203 }
204 static int dissect_version(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
205   return dissect_ocsp_Version(FALSE, tvb, offset, pinfo, tree, hf_ocsp_version);
206 }
207
208
209
210 static int
211 dissect_ocsp_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
212   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
213                                        NULL);
214
215   return offset;
216 }
217 static int dissect_issuerNameHash(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
218   return dissect_ocsp_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_ocsp_issuerNameHash);
219 }
220 static int dissect_issuerKeyHash(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
221   return dissect_ocsp_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_ocsp_issuerKeyHash);
222 }
223
224
225 static const ber_sequence_t CertID_sequence[] = {
226   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_hashAlgorithm },
227   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_issuerNameHash },
228   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_issuerKeyHash },
229   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_serialNumber },
230   { 0, 0, 0, NULL }
231 };
232
233 static int
234 dissect_ocsp_CertID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
235   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
236                                    CertID_sequence, hf_index, ett_ocsp_CertID);
237
238   return offset;
239 }
240 static int dissect_reqCert(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
241   return dissect_ocsp_CertID(FALSE, tvb, offset, pinfo, tree, hf_ocsp_reqCert);
242 }
243 static int dissect_certID(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
244   return dissect_ocsp_CertID(FALSE, tvb, offset, pinfo, tree, hf_ocsp_certID);
245 }
246
247
248 static const ber_sequence_t Request_sequence[] = {
249   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_reqCert },
250   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_singleRequestExtensions },
251   { 0, 0, 0, NULL }
252 };
253
254 static int
255 dissect_ocsp_Request(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
256   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
257                                    Request_sequence, hf_index, ett_ocsp_Request);
258
259   return offset;
260 }
261 static int dissect_requestList_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
262   return dissect_ocsp_Request(FALSE, tvb, offset, pinfo, tree, hf_ocsp_requestList_item);
263 }
264
265
266 static const ber_sequence_t SEQUENCE_OF_Request_sequence_of[1] = {
267   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_requestList_item },
268 };
269
270 static int
271 dissect_ocsp_SEQUENCE_OF_Request(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
272   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
273                                       SEQUENCE_OF_Request_sequence_of, hf_index, ett_ocsp_SEQUENCE_OF_Request);
274
275   return offset;
276 }
277 static int dissect_requestList(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
278   return dissect_ocsp_SEQUENCE_OF_Request(FALSE, tvb, offset, pinfo, tree, hf_ocsp_requestList);
279 }
280
281
282 static const ber_sequence_t TBSRequest_sequence[] = {
283   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_version },
284   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_requestorName },
285   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_requestList },
286   { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL, dissect_requestExtensions },
287   { 0, 0, 0, NULL }
288 };
289
290 static int
291 dissect_ocsp_TBSRequest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
292   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
293                                    TBSRequest_sequence, hf_index, ett_ocsp_TBSRequest);
294
295   return offset;
296 }
297 static int dissect_tbsRequest(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
298   return dissect_ocsp_TBSRequest(FALSE, tvb, offset, pinfo, tree, hf_ocsp_tbsRequest);
299 }
300
301
302
303 static int
304 dissect_ocsp_BIT_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
305   offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
306                                     NULL, hf_index, -1,
307                                     NULL);
308
309   return offset;
310 }
311 static int dissect_signature(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
312   return dissect_ocsp_BIT_STRING(FALSE, tvb, offset, pinfo, tree, hf_ocsp_signature);
313 }
314
315
316 static const ber_sequence_t SEQUENCE_OF_Certificate_sequence_of[1] = {
317   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_certs_item },
318 };
319
320 static int
321 dissect_ocsp_SEQUENCE_OF_Certificate(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
322   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
323                                       SEQUENCE_OF_Certificate_sequence_of, hf_index, ett_ocsp_SEQUENCE_OF_Certificate);
324
325   return offset;
326 }
327 static int dissect_certs(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
328   return dissect_ocsp_SEQUENCE_OF_Certificate(FALSE, tvb, offset, pinfo, tree, hf_ocsp_certs);
329 }
330
331
332 static const ber_sequence_t Signature_sequence[] = {
333   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_signatureAlgorithm },
334   { BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_NOOWNTAG, dissect_signature },
335   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_certs },
336   { 0, 0, 0, NULL }
337 };
338
339 static int
340 dissect_ocsp_Signature(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
341   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
342                                    Signature_sequence, hf_index, ett_ocsp_Signature);
343
344   return offset;
345 }
346 static int dissect_optionalSignature(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
347   return dissect_ocsp_Signature(FALSE, tvb, offset, pinfo, tree, hf_ocsp_optionalSignature);
348 }
349
350
351 static const ber_sequence_t OCSPRequest_sequence[] = {
352   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_tbsRequest },
353   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_optionalSignature },
354   { 0, 0, 0, NULL }
355 };
356
357 static int
358 dissect_ocsp_OCSPRequest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
359   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
360                                    OCSPRequest_sequence, hf_index, ett_ocsp_OCSPRequest);
361
362   return offset;
363 }
364
365
366 static const value_string ocsp_OCSPResponseStatus_vals[] = {
367   {   0, "successful" },
368   {   1, "malformedRequest" },
369   {   2, "internalError" },
370   {   3, "tryLater" },
371   {   5, "sigRequired" },
372   {   6, "unauthorized" },
373   { 0, NULL }
374 };
375
376
377 static int
378 dissect_ocsp_OCSPResponseStatus(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
379   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
380                                   NULL);
381
382   return offset;
383 }
384 static int dissect_responseStatus(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
385   return dissect_ocsp_OCSPResponseStatus(FALSE, tvb, offset, pinfo, tree, hf_ocsp_responseStatus);
386 }
387
388
389
390 static int
391 dissect_ocsp_T_responseType(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
392   offset = dissect_ber_object_identifier_str(implicit_tag, pinfo, tree, tvb, offset, hf_ocsp_responseType_id, &responseType_id);
393
394   return offset;
395 }
396 static int dissect_responseType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
397   return dissect_ocsp_T_responseType(FALSE, tvb, offset, pinfo, tree, hf_ocsp_responseType);
398 }
399
400
401
402 static int
403 dissect_ocsp_T_response(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
404   gint8 class;
405   gboolean pc, ind;
406   gint32 tag;
407   guint32 len;
408   /* skip past the T and L  */
409   offset = dissect_ber_identifier(pinfo, tree, tvb, offset, &class, &pc, &tag);
410   offset = dissect_ber_length(pinfo, tree, tvb, offset, &len, &ind);
411   offset=call_ber_oid_callback(responseType_id, tvb, offset, pinfo, tree);
412
413
414   return offset;
415 }
416 static int dissect_response(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
417   return dissect_ocsp_T_response(FALSE, tvb, offset, pinfo, tree, hf_ocsp_response);
418 }
419
420
421 static const ber_sequence_t ResponseBytes_sequence[] = {
422   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_responseType },
423   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_response },
424   { 0, 0, 0, NULL }
425 };
426
427 static int
428 dissect_ocsp_ResponseBytes(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
429   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
430                                    ResponseBytes_sequence, hf_index, ett_ocsp_ResponseBytes);
431
432   return offset;
433 }
434 static int dissect_responseBytes(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
435   return dissect_ocsp_ResponseBytes(FALSE, tvb, offset, pinfo, tree, hf_ocsp_responseBytes);
436 }
437
438
439 static const ber_sequence_t OCSPResponse_sequence[] = {
440   { BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_responseStatus },
441   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_responseBytes },
442   { 0, 0, 0, NULL }
443 };
444
445 static int
446 dissect_ocsp_OCSPResponse(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
447   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
448                                    OCSPResponse_sequence, hf_index, ett_ocsp_OCSPResponse);
449
450   return offset;
451 }
452
453
454
455 static int
456 dissect_ocsp_KeyHash(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
457   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
458                                        NULL);
459
460   return offset;
461 }
462 static int dissect_byKey(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
463   return dissect_ocsp_KeyHash(FALSE, tvb, offset, pinfo, tree, hf_ocsp_byKey);
464 }
465
466
467 static const value_string ocsp_ResponderID_vals[] = {
468   {   1, "byName" },
469   {   2, "byKey" },
470   { 0, NULL }
471 };
472
473 static const ber_choice_t ResponderID_choice[] = {
474   {   1, BER_CLASS_CON, 1, 0, dissect_byName },
475   {   2, BER_CLASS_CON, 2, 0, dissect_byKey },
476   { 0, 0, 0, 0, NULL }
477 };
478
479 static int
480 dissect_ocsp_ResponderID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
481   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
482                                  ResponderID_choice, hf_index, ett_ocsp_ResponderID,
483                                  NULL);
484
485   return offset;
486 }
487 static int dissect_responderID(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
488   return dissect_ocsp_ResponderID(FALSE, tvb, offset, pinfo, tree, hf_ocsp_responderID);
489 }
490
491
492
493 static int
494 dissect_ocsp_GeneralizedTime(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
495   offset = dissect_ber_GeneralizedTime(implicit_tag, pinfo, tree, tvb, offset, hf_index);
496
497   return offset;
498 }
499 static int dissect_producedAt(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
500   return dissect_ocsp_GeneralizedTime(FALSE, tvb, offset, pinfo, tree, hf_ocsp_producedAt);
501 }
502 static int dissect_thisUpdate(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
503   return dissect_ocsp_GeneralizedTime(FALSE, tvb, offset, pinfo, tree, hf_ocsp_thisUpdate);
504 }
505 static int dissect_nextUpdate(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
506   return dissect_ocsp_GeneralizedTime(FALSE, tvb, offset, pinfo, tree, hf_ocsp_nextUpdate);
507 }
508 static int dissect_revocationTime(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
509   return dissect_ocsp_GeneralizedTime(FALSE, tvb, offset, pinfo, tree, hf_ocsp_revocationTime);
510 }
511 static int dissect_crlTime(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
512   return dissect_ocsp_GeneralizedTime(FALSE, tvb, offset, pinfo, tree, hf_ocsp_crlTime);
513 }
514
515
516
517 static int
518 dissect_ocsp_NULL(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
519   offset = dissect_ber_null(implicit_tag, pinfo, tree, tvb, offset, hf_index);
520
521   return offset;
522 }
523 static int dissect_good_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
524   return dissect_ocsp_NULL(TRUE, tvb, offset, pinfo, tree, hf_ocsp_good);
525 }
526
527
528 static const ber_sequence_t RevokedInfo_sequence[] = {
529   { BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_NOOWNTAG, dissect_revocationTime },
530   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_revocationReason },
531   { 0, 0, 0, NULL }
532 };
533
534 static int
535 dissect_ocsp_RevokedInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
536   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
537                                    RevokedInfo_sequence, hf_index, ett_ocsp_RevokedInfo);
538
539   return offset;
540 }
541 static int dissect_revoked_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
542   return dissect_ocsp_RevokedInfo(TRUE, tvb, offset, pinfo, tree, hf_ocsp_revoked);
543 }
544
545
546
547 static int
548 dissect_ocsp_UnknownInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
549   offset = dissect_ber_null(implicit_tag, pinfo, tree, tvb, offset, hf_index);
550
551   return offset;
552 }
553 static int dissect_unknown_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
554   return dissect_ocsp_UnknownInfo(TRUE, tvb, offset, pinfo, tree, hf_ocsp_unknown);
555 }
556
557
558 static const value_string ocsp_CertStatus_vals[] = {
559   {   0, "good" },
560   {   1, "revoked" },
561   {   2, "unknown" },
562   { 0, NULL }
563 };
564
565 static const ber_choice_t CertStatus_choice[] = {
566   {   0, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_good_impl },
567   {   1, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_revoked_impl },
568   {   2, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_unknown_impl },
569   { 0, 0, 0, 0, NULL }
570 };
571
572 static int
573 dissect_ocsp_CertStatus(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
574   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
575                                  CertStatus_choice, hf_index, ett_ocsp_CertStatus,
576                                  NULL);
577
578   return offset;
579 }
580 static int dissect_certStatus(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
581   return dissect_ocsp_CertStatus(FALSE, tvb, offset, pinfo, tree, hf_ocsp_certStatus);
582 }
583
584
585 static const ber_sequence_t SingleResponse_sequence[] = {
586   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_certID },
587   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_certStatus },
588   { BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_NOOWNTAG, dissect_thisUpdate },
589   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_nextUpdate },
590   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_singleExtensions },
591   { 0, 0, 0, NULL }
592 };
593
594 static int
595 dissect_ocsp_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(implicit_tag, pinfo, tree, tvb, offset,
597                                    SingleResponse_sequence, hf_index, ett_ocsp_SingleResponse);
598
599   return offset;
600 }
601 static int dissect_responses_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
602   return dissect_ocsp_SingleResponse(FALSE, tvb, offset, pinfo, tree, hf_ocsp_responses_item);
603 }
604
605
606 static const ber_sequence_t SEQUENCE_OF_SingleResponse_sequence_of[1] = {
607   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_responses_item },
608 };
609
610 static int
611 dissect_ocsp_SEQUENCE_OF_SingleResponse(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
612   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
613                                       SEQUENCE_OF_SingleResponse_sequence_of, hf_index, ett_ocsp_SEQUENCE_OF_SingleResponse);
614
615   return offset;
616 }
617 static int dissect_responses(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
618   return dissect_ocsp_SEQUENCE_OF_SingleResponse(FALSE, tvb, offset, pinfo, tree, hf_ocsp_responses);
619 }
620
621
622 static const ber_sequence_t ResponseData_sequence[] = {
623   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_version },
624   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_responderID },
625   { BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_NOOWNTAG, dissect_producedAt },
626   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_responses },
627   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_responseExtensions },
628   { 0, 0, 0, NULL }
629 };
630
631 static int
632 dissect_ocsp_ResponseData(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
633   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
634                                    ResponseData_sequence, hf_index, ett_ocsp_ResponseData);
635
636   return offset;
637 }
638 static int dissect_tbsResponseData(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
639   return dissect_ocsp_ResponseData(FALSE, tvb, offset, pinfo, tree, hf_ocsp_tbsResponseData);
640 }
641
642
643 static const ber_sequence_t BasicOCSPResponse_sequence[] = {
644   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_tbsResponseData },
645   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_signatureAlgorithm },
646   { BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_NOOWNTAG, dissect_signature },
647   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_certs },
648   { 0, 0, 0, NULL }
649 };
650
651 static int
652 dissect_ocsp_BasicOCSPResponse(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                                    BasicOCSPResponse_sequence, hf_index, ett_ocsp_BasicOCSPResponse);
655
656   return offset;
657 }
658
659
660
661 static int
662 dissect_ocsp_ArchiveCutoff(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
663   offset = dissect_ber_GeneralizedTime(implicit_tag, pinfo, tree, tvb, offset, hf_index);
664
665   return offset;
666 }
667
668
669
670 static int
671 dissect_ocsp_OBJECT_IDENTIFIER(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
672   offset = dissect_ber_object_identifier(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL);
673
674   return offset;
675 }
676 static int dissect_AcceptableResponses_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
677   return dissect_ocsp_OBJECT_IDENTIFIER(FALSE, tvb, offset, pinfo, tree, hf_ocsp_AcceptableResponses_item);
678 }
679
680
681 static const ber_sequence_t AcceptableResponses_sequence_of[1] = {
682   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_AcceptableResponses_item },
683 };
684
685 static int
686 dissect_ocsp_AcceptableResponses(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
687   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
688                                       AcceptableResponses_sequence_of, hf_index, ett_ocsp_AcceptableResponses);
689
690   return offset;
691 }
692
693
694 static const ber_sequence_t ServiceLocator_sequence[] = {
695   { BER_CLASS_ANY, -1, BER_FLAGS_NOOWNTAG, dissect_issuer },
696   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_locator },
697   { 0, 0, 0, NULL }
698 };
699
700 static int
701 dissect_ocsp_ServiceLocator(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
702   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
703                                    ServiceLocator_sequence, hf_index, ett_ocsp_ServiceLocator);
704
705   return offset;
706 }
707
708
709
710 static int
711 dissect_ocsp_IA5String(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
712   offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
713                                             pinfo, tree, tvb, offset, hf_index,
714                                             NULL);
715
716   return offset;
717 }
718 static int dissect_crlUrl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
719   return dissect_ocsp_IA5String(FALSE, tvb, offset, pinfo, tree, hf_ocsp_crlUrl);
720 }
721
722
723
724 static int
725 dissect_ocsp_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
726   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
727                                   NULL);
728
729   return offset;
730 }
731 static int dissect_crlNum(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
732   return dissect_ocsp_INTEGER(FALSE, tvb, offset, pinfo, tree, hf_ocsp_crlNum);
733 }
734
735
736 static const ber_sequence_t CrlID_sequence[] = {
737   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_crlUrl },
738   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_crlNum },
739   { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL, dissect_crlTime },
740   { 0, 0, 0, NULL }
741 };
742
743 static int
744 dissect_ocsp_CrlID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
745   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
746                                    CrlID_sequence, hf_index, ett_ocsp_CrlID);
747
748   return offset;
749 }
750
751 /*--- PDUs ---*/
752
753 static void dissect_BasicOCSPResponse_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
754   dissect_ocsp_BasicOCSPResponse(FALSE, tvb, 0, pinfo, tree, hf_ocsp_BasicOCSPResponse_PDU);
755 }
756 static void dissect_ArchiveCutoff_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
757   dissect_ocsp_ArchiveCutoff(FALSE, tvb, 0, pinfo, tree, hf_ocsp_ArchiveCutoff_PDU);
758 }
759 static void dissect_AcceptableResponses_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
760   dissect_ocsp_AcceptableResponses(FALSE, tvb, 0, pinfo, tree, hf_ocsp_AcceptableResponses_PDU);
761 }
762 static void dissect_ServiceLocator_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
763   dissect_ocsp_ServiceLocator(FALSE, tvb, 0, pinfo, tree, hf_ocsp_ServiceLocator_PDU);
764 }
765 static void dissect_CrlID_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
766   dissect_ocsp_CrlID(FALSE, tvb, 0, pinfo, tree, hf_ocsp_CrlID_PDU);
767 }
768
769
770 /*--- End of included file: packet-ocsp-fn.c ---*/
771
772
773
774 static int
775 dissect_ocsp_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
776 {
777         proto_item *item=NULL;
778         proto_tree *tree=NULL;
779
780         if (check_col(pinfo->cinfo, COL_PROTOCOL)) 
781                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "OCSP");
782
783         if (check_col(pinfo->cinfo, COL_INFO)) {
784                 col_clear(pinfo->cinfo, COL_INFO);
785                 
786                 col_add_fstr(pinfo->cinfo, COL_INFO, "Request");
787         }
788
789
790         if(parent_tree){
791                 item=proto_tree_add_item(parent_tree, proto_ocsp, tvb, 0, -1, FALSE);
792                 tree = proto_item_add_subtree(item, ett_ocsp);
793         }
794
795         return dissect_ocsp_OCSPRequest(FALSE, tvb, 0, pinfo, tree, -1);
796 }
797
798
799 static int
800 dissect_ocsp_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
801 {
802         proto_item *item=NULL;
803         proto_tree *tree=NULL;
804
805         if (check_col(pinfo->cinfo, COL_PROTOCOL)) 
806                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "OCSP");
807
808         if (check_col(pinfo->cinfo, COL_INFO)) {
809                 col_clear(pinfo->cinfo, COL_INFO);
810                 
811                 col_add_fstr(pinfo->cinfo, COL_INFO, "Response");
812         }
813
814
815         if(parent_tree){
816                 item=proto_tree_add_item(parent_tree, proto_ocsp, tvb, 0, -1, FALSE);
817                 tree = proto_item_add_subtree(item, ett_ocsp);
818         }
819
820         return dissect_ocsp_OCSPResponse(FALSE, tvb, 0, pinfo, tree, -1);
821 }
822
823 /*--- proto_register_ocsp ----------------------------------------------*/
824 void proto_register_ocsp(void) {
825
826   /* List of fields */
827   static hf_register_info hf[] = {
828     { &hf_ocsp_responseType_id,
829       { "ResponseType Id", "x509af.responseType.id",
830         FT_STRING, BASE_NONE, NULL, 0,
831         "ResponseType Id", HFILL }},
832
833 /*--- Included file: packet-ocsp-hfarr.c ---*/
834
835     { &hf_ocsp_BasicOCSPResponse_PDU,
836       { "BasicOCSPResponse", "ocsp.BasicOCSPResponse",
837         FT_NONE, BASE_NONE, NULL, 0,
838         "BasicOCSPResponse", HFILL }},
839     { &hf_ocsp_ArchiveCutoff_PDU,
840       { "ArchiveCutoff", "ocsp.ArchiveCutoff",
841         FT_STRING, BASE_NONE, NULL, 0,
842         "ArchiveCutoff", HFILL }},
843     { &hf_ocsp_AcceptableResponses_PDU,
844       { "AcceptableResponses", "ocsp.AcceptableResponses",
845         FT_UINT32, BASE_DEC, NULL, 0,
846         "AcceptableResponses", HFILL }},
847     { &hf_ocsp_ServiceLocator_PDU,
848       { "ServiceLocator", "ocsp.ServiceLocator",
849         FT_NONE, BASE_NONE, NULL, 0,
850         "ServiceLocator", HFILL }},
851     { &hf_ocsp_CrlID_PDU,
852       { "CrlID", "ocsp.CrlID",
853         FT_NONE, BASE_NONE, NULL, 0,
854         "CrlID", HFILL }},
855     { &hf_ocsp_tbsRequest,
856       { "tbsRequest", "ocsp.tbsRequest",
857         FT_NONE, BASE_NONE, NULL, 0,
858         "OCSPRequest/tbsRequest", HFILL }},
859     { &hf_ocsp_optionalSignature,
860       { "optionalSignature", "ocsp.optionalSignature",
861         FT_NONE, BASE_NONE, NULL, 0,
862         "OCSPRequest/optionalSignature", HFILL }},
863     { &hf_ocsp_version,
864       { "version", "ocsp.version",
865         FT_INT32, BASE_DEC, VALS(x509af_Version_vals), 0,
866         "", HFILL }},
867     { &hf_ocsp_requestorName,
868       { "requestorName", "ocsp.requestorName",
869         FT_UINT32, BASE_DEC, VALS(x509ce_GeneralName_vals), 0,
870         "TBSRequest/requestorName", HFILL }},
871     { &hf_ocsp_requestList,
872       { "requestList", "ocsp.requestList",
873         FT_UINT32, BASE_DEC, NULL, 0,
874         "TBSRequest/requestList", HFILL }},
875     { &hf_ocsp_requestList_item,
876       { "Item", "ocsp.requestList_item",
877         FT_NONE, BASE_NONE, NULL, 0,
878         "TBSRequest/requestList/_item", HFILL }},
879     { &hf_ocsp_requestExtensions,
880       { "requestExtensions", "ocsp.requestExtensions",
881         FT_UINT32, BASE_DEC, NULL, 0,
882         "TBSRequest/requestExtensions", HFILL }},
883     { &hf_ocsp_signatureAlgorithm,
884       { "signatureAlgorithm", "ocsp.signatureAlgorithm",
885         FT_NONE, BASE_NONE, NULL, 0,
886         "", HFILL }},
887     { &hf_ocsp_signature,
888       { "signature", "ocsp.signature",
889         FT_BYTES, BASE_HEX, NULL, 0,
890         "", HFILL }},
891     { &hf_ocsp_certs,
892       { "certs", "ocsp.certs",
893         FT_UINT32, BASE_DEC, NULL, 0,
894         "", HFILL }},
895     { &hf_ocsp_certs_item,
896       { "Item", "ocsp.certs_item",
897         FT_NONE, BASE_NONE, NULL, 0,
898         "", HFILL }},
899     { &hf_ocsp_reqCert,
900       { "reqCert", "ocsp.reqCert",
901         FT_NONE, BASE_NONE, NULL, 0,
902         "Request/reqCert", HFILL }},
903     { &hf_ocsp_singleRequestExtensions,
904       { "singleRequestExtensions", "ocsp.singleRequestExtensions",
905         FT_UINT32, BASE_DEC, NULL, 0,
906         "Request/singleRequestExtensions", HFILL }},
907     { &hf_ocsp_hashAlgorithm,
908       { "hashAlgorithm", "ocsp.hashAlgorithm",
909         FT_NONE, BASE_NONE, NULL, 0,
910         "CertID/hashAlgorithm", HFILL }},
911     { &hf_ocsp_issuerNameHash,
912       { "issuerNameHash", "ocsp.issuerNameHash",
913         FT_BYTES, BASE_HEX, NULL, 0,
914         "CertID/issuerNameHash", HFILL }},
915     { &hf_ocsp_issuerKeyHash,
916       { "issuerKeyHash", "ocsp.issuerKeyHash",
917         FT_BYTES, BASE_HEX, NULL, 0,
918         "CertID/issuerKeyHash", HFILL }},
919     { &hf_ocsp_serialNumber,
920       { "serialNumber", "ocsp.serialNumber",
921         FT_INT32, BASE_DEC, NULL, 0,
922         "CertID/serialNumber", HFILL }},
923     { &hf_ocsp_responseStatus,
924       { "responseStatus", "ocsp.responseStatus",
925         FT_UINT32, BASE_DEC, VALS(ocsp_OCSPResponseStatus_vals), 0,
926         "OCSPResponse/responseStatus", HFILL }},
927     { &hf_ocsp_responseBytes,
928       { "responseBytes", "ocsp.responseBytes",
929         FT_NONE, BASE_NONE, NULL, 0,
930         "OCSPResponse/responseBytes", HFILL }},
931     { &hf_ocsp_responseType,
932       { "responseType", "ocsp.responseType",
933         FT_STRING, BASE_NONE, NULL, 0,
934         "ResponseBytes/responseType", HFILL }},
935     { &hf_ocsp_response,
936       { "response", "ocsp.response",
937         FT_BYTES, BASE_HEX, NULL, 0,
938         "ResponseBytes/response", HFILL }},
939     { &hf_ocsp_tbsResponseData,
940       { "tbsResponseData", "ocsp.tbsResponseData",
941         FT_NONE, BASE_NONE, NULL, 0,
942         "BasicOCSPResponse/tbsResponseData", HFILL }},
943     { &hf_ocsp_responderID,
944       { "responderID", "ocsp.responderID",
945         FT_UINT32, BASE_DEC, VALS(ocsp_ResponderID_vals), 0,
946         "ResponseData/responderID", HFILL }},
947     { &hf_ocsp_producedAt,
948       { "producedAt", "ocsp.producedAt",
949         FT_STRING, BASE_NONE, NULL, 0,
950         "ResponseData/producedAt", HFILL }},
951     { &hf_ocsp_responses,
952       { "responses", "ocsp.responses",
953         FT_UINT32, BASE_DEC, NULL, 0,
954         "ResponseData/responses", HFILL }},
955     { &hf_ocsp_responses_item,
956       { "Item", "ocsp.responses_item",
957         FT_NONE, BASE_NONE, NULL, 0,
958         "ResponseData/responses/_item", HFILL }},
959     { &hf_ocsp_responseExtensions,
960       { "responseExtensions", "ocsp.responseExtensions",
961         FT_UINT32, BASE_DEC, NULL, 0,
962         "ResponseData/responseExtensions", HFILL }},
963     { &hf_ocsp_byName,
964       { "byName", "ocsp.byName",
965         FT_UINT32, BASE_DEC, NULL, 0,
966         "ResponderID/byName", HFILL }},
967     { &hf_ocsp_byKey,
968       { "byKey", "ocsp.byKey",
969         FT_BYTES, BASE_HEX, NULL, 0,
970         "ResponderID/byKey", HFILL }},
971     { &hf_ocsp_certID,
972       { "certID", "ocsp.certID",
973         FT_NONE, BASE_NONE, NULL, 0,
974         "SingleResponse/certID", HFILL }},
975     { &hf_ocsp_certStatus,
976       { "certStatus", "ocsp.certStatus",
977         FT_UINT32, BASE_DEC, VALS(ocsp_CertStatus_vals), 0,
978         "SingleResponse/certStatus", HFILL }},
979     { &hf_ocsp_thisUpdate,
980       { "thisUpdate", "ocsp.thisUpdate",
981         FT_STRING, BASE_NONE, NULL, 0,
982         "SingleResponse/thisUpdate", HFILL }},
983     { &hf_ocsp_nextUpdate,
984       { "nextUpdate", "ocsp.nextUpdate",
985         FT_STRING, BASE_NONE, NULL, 0,
986         "SingleResponse/nextUpdate", HFILL }},
987     { &hf_ocsp_singleExtensions,
988       { "singleExtensions", "ocsp.singleExtensions",
989         FT_UINT32, BASE_DEC, NULL, 0,
990         "SingleResponse/singleExtensions", HFILL }},
991     { &hf_ocsp_good,
992       { "good", "ocsp.good",
993         FT_NONE, BASE_NONE, NULL, 0,
994         "CertStatus/good", HFILL }},
995     { &hf_ocsp_revoked,
996       { "revoked", "ocsp.revoked",
997         FT_NONE, BASE_NONE, NULL, 0,
998         "CertStatus/revoked", HFILL }},
999     { &hf_ocsp_unknown,
1000       { "unknown", "ocsp.unknown",
1001         FT_NONE, BASE_NONE, NULL, 0,
1002         "CertStatus/unknown", HFILL }},
1003     { &hf_ocsp_revocationTime,
1004       { "revocationTime", "ocsp.revocationTime",
1005         FT_STRING, BASE_NONE, NULL, 0,
1006         "RevokedInfo/revocationTime", HFILL }},
1007     { &hf_ocsp_revocationReason,
1008       { "revocationReason", "ocsp.revocationReason",
1009         FT_UINT32, BASE_DEC, VALS(x509ce_CRLReason_vals), 0,
1010         "RevokedInfo/revocationReason", HFILL }},
1011     { &hf_ocsp_AcceptableResponses_item,
1012       { "Item", "ocsp.AcceptableResponses_item",
1013         FT_STRING, BASE_NONE, NULL, 0,
1014         "AcceptableResponses/_item", HFILL }},
1015     { &hf_ocsp_issuer,
1016       { "issuer", "ocsp.issuer",
1017         FT_UINT32, BASE_DEC, NULL, 0,
1018         "ServiceLocator/issuer", HFILL }},
1019     { &hf_ocsp_locator,
1020       { "locator", "ocsp.locator",
1021         FT_UINT32, BASE_DEC, NULL, 0,
1022         "ServiceLocator/locator", HFILL }},
1023     { &hf_ocsp_crlUrl,
1024       { "crlUrl", "ocsp.crlUrl",
1025         FT_STRING, BASE_NONE, NULL, 0,
1026         "CrlID/crlUrl", HFILL }},
1027     { &hf_ocsp_crlNum,
1028       { "crlNum", "ocsp.crlNum",
1029         FT_INT32, BASE_DEC, NULL, 0,
1030         "CrlID/crlNum", HFILL }},
1031     { &hf_ocsp_crlTime,
1032       { "crlTime", "ocsp.crlTime",
1033         FT_STRING, BASE_NONE, NULL, 0,
1034         "CrlID/crlTime", HFILL }},
1035
1036 /*--- End of included file: packet-ocsp-hfarr.c ---*/
1037
1038   };
1039
1040   /* List of subtrees */
1041   static gint *ett[] = {
1042     &ett_ocsp,
1043
1044 /*--- Included file: packet-ocsp-ettarr.c ---*/
1045
1046     &ett_ocsp_OCSPRequest,
1047     &ett_ocsp_TBSRequest,
1048     &ett_ocsp_SEQUENCE_OF_Request,
1049     &ett_ocsp_Signature,
1050     &ett_ocsp_SEQUENCE_OF_Certificate,
1051     &ett_ocsp_Request,
1052     &ett_ocsp_CertID,
1053     &ett_ocsp_OCSPResponse,
1054     &ett_ocsp_ResponseBytes,
1055     &ett_ocsp_BasicOCSPResponse,
1056     &ett_ocsp_ResponseData,
1057     &ett_ocsp_SEQUENCE_OF_SingleResponse,
1058     &ett_ocsp_ResponderID,
1059     &ett_ocsp_SingleResponse,
1060     &ett_ocsp_CertStatus,
1061     &ett_ocsp_RevokedInfo,
1062     &ett_ocsp_AcceptableResponses,
1063     &ett_ocsp_ServiceLocator,
1064     &ett_ocsp_CrlID,
1065
1066 /*--- End of included file: packet-ocsp-ettarr.c ---*/
1067
1068   };
1069
1070   /* Register protocol */
1071   proto_ocsp = proto_register_protocol(PNAME, PSNAME, PFNAME);
1072
1073   /* Register fields and subtrees */
1074   proto_register_field_array(proto_ocsp, hf, array_length(hf));
1075   proto_register_subtree_array(ett, array_length(ett));
1076
1077 }
1078
1079 /*--- proto_reg_handoff_ocsp -------------------------------------------*/
1080 void proto_reg_handoff_ocsp(void) {
1081         dissector_handle_t ocsp_request_handle;
1082         dissector_handle_t ocsp_response_handle;
1083
1084         ocsp_request_handle = new_create_dissector_handle(dissect_ocsp_request, proto_ocsp);
1085         ocsp_response_handle = new_create_dissector_handle(dissect_ocsp_response, proto_ocsp);
1086
1087         dissector_add_string("media_type", "application/ocsp-request", ocsp_request_handle);
1088         dissector_add_string("media_type", "application/ocsp-response", ocsp_response_handle);
1089
1090
1091 /*--- Included file: packet-ocsp-dis-tab.c ---*/
1092
1093   register_ber_oid_dissector("1.3.6.1.5.5.7.48.1.1", dissect_BasicOCSPResponse_PDU, proto_ocsp, "id-pkix-ocsp-basic");
1094   register_ber_oid_dissector("1.3.6.1.5.5.7.48.1.3", dissect_CrlID_PDU, proto_ocsp, "id-pkix-ocsp-crl");
1095   register_ber_oid_dissector("1.3.6.1.5.5.7.48.1.4", dissect_AcceptableResponses_PDU, proto_ocsp, "id-pkix-ocsp-response");
1096   register_ber_oid_dissector("1.3.6.1.5.5.7.48.1.6", dissect_ArchiveCutoff_PDU, proto_ocsp, "id-pkix-ocsp-archive-cutoff");
1097   register_ber_oid_dissector("1.3.6.1.5.5.7.48.1.7", dissect_ServiceLocator_PDU, proto_ocsp, "id-pkix-ocsp-service-locator");
1098
1099
1100 /*--- End of included file: packet-ocsp-dis-tab.c ---*/
1101
1102 }
1103