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