Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-ocsp.c
blobb1e7bcd1335590dc6ddec7d911bb04248b936ced
1 /* Do not modify this file. Changes will be overwritten. */
2 /* Generated automatically by the ASN.1 to Wireshark dissector compiler */
3 /* packet-ocsp.c */
4 /* asn2wrs.py -b -q -L -p ocsp -c ./ocsp.cnf -s ./packet-ocsp-template -D . -O ../.. OCSP.asn */
6 /* packet-ocsp.c
7 * Routines for Online Certificate Status Protocol (RFC2560) packet dissection
8 * Ronnie Sahlberg 2004
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * SPDX-License-Identifier: GPL-2.0-or-later
17 #include "config.h"
19 #include <epan/packet.h>
20 #include <wsutil/array.h>
22 #include <asn1.h>
24 #include "packet-ber.h"
25 #include "packet-ocsp.h"
26 #include "packet-x509af.h"
27 #include "packet-x509ce.h"
28 #include "packet-pkix1implicit.h"
29 #include "packet-pkix1explicit.h"
31 #define PNAME "Online Certificate Status Protocol"
32 #define PSNAME "OCSP"
33 #define PFNAME "ocsp"
35 void proto_register_ocsp(void);
36 void proto_reg_handoff_ocsp(void);
38 static dissector_handle_t ocsp_request_handle;
39 static dissector_handle_t ocsp_response_handle;
41 /* Initialize the protocol and registered fields */
42 int proto_ocsp;
43 static int hf_ocsp_responseType_id;
44 static int hf_ocsp_BasicOCSPResponse_PDU; /* BasicOCSPResponse */
45 static int hf_ocsp_ArchiveCutoff_PDU; /* ArchiveCutoff */
46 static int hf_ocsp_AcceptableResponses_PDU; /* AcceptableResponses */
47 static int hf_ocsp_ServiceLocator_PDU; /* ServiceLocator */
48 static int hf_ocsp_CrlID_PDU; /* CrlID */
49 static int hf_ocsp_ReOcspNonce_PDU; /* ReOcspNonce */
50 static int hf_ocsp_NULL_PDU; /* NULL */
51 static int hf_ocsp_tbsRequest; /* TBSRequest */
52 static int hf_ocsp_optionalSignature; /* Signature */
53 static int hf_ocsp_version; /* Version */
54 static int hf_ocsp_requestorName; /* GeneralName */
55 static int hf_ocsp_requestList; /* SEQUENCE_OF_Request */
56 static int hf_ocsp_requestList_item; /* Request */
57 static int hf_ocsp_requestExtensions; /* Extensions */
58 static int hf_ocsp_signatureAlgorithm; /* AlgorithmIdentifier */
59 static int hf_ocsp_signature; /* BIT_STRING */
60 static int hf_ocsp_certs; /* SEQUENCE_OF_Certificate */
61 static int hf_ocsp_certs_item; /* Certificate */
62 static int hf_ocsp_reqCert; /* CertID */
63 static int hf_ocsp_singleRequestExtensions; /* Extensions */
64 static int hf_ocsp_hashAlgorithm; /* AlgorithmIdentifier */
65 static int hf_ocsp_issuerNameHash; /* OCTET_STRING */
66 static int hf_ocsp_issuerKeyHash; /* OCTET_STRING */
67 static int hf_ocsp_serialNumber; /* CertificateSerialNumber */
68 static int hf_ocsp_responseStatus; /* OCSPResponseStatus */
69 static int hf_ocsp_responseBytes; /* ResponseBytes */
70 static int hf_ocsp_responseType; /* T_responseType */
71 static int hf_ocsp_response; /* T_response */
72 static int hf_ocsp_tbsResponseData; /* ResponseData */
73 static int hf_ocsp_responderID; /* ResponderID */
74 static int hf_ocsp_producedAt; /* GeneralizedTime */
75 static int hf_ocsp_responses; /* SEQUENCE_OF_SingleResponse */
76 static int hf_ocsp_responses_item; /* SingleResponse */
77 static int hf_ocsp_responseExtensions; /* Extensions */
78 static int hf_ocsp_byName; /* Name */
79 static int hf_ocsp_byKey; /* KeyHash */
80 static int hf_ocsp_certID; /* CertID */
81 static int hf_ocsp_certStatus; /* CertStatus */
82 static int hf_ocsp_thisUpdate; /* GeneralizedTime */
83 static int hf_ocsp_nextUpdate; /* GeneralizedTime */
84 static int hf_ocsp_singleExtensions; /* Extensions */
85 static int hf_ocsp_good; /* NULL */
86 static int hf_ocsp_revoked; /* RevokedInfo */
87 static int hf_ocsp_unknown; /* UnknownInfo */
88 static int hf_ocsp_revocationTime; /* GeneralizedTime */
89 static int hf_ocsp_revocationReason; /* CRLReason */
90 static int hf_ocsp_AcceptableResponses_item; /* OBJECT_IDENTIFIER */
91 static int hf_ocsp_issuer; /* Name */
92 static int hf_ocsp_locator; /* AuthorityInfoAccessSyntax */
93 static int hf_ocsp_crlUrl; /* IA5String */
94 static int hf_ocsp_crlNum; /* INTEGER */
95 static int hf_ocsp_crlTime; /* GeneralizedTime */
97 /* Initialize the subtree pointers */
98 static int ett_ocsp;
99 static int ett_ocsp_OCSPRequest;
100 static int ett_ocsp_TBSRequest;
101 static int ett_ocsp_SEQUENCE_OF_Request;
102 static int ett_ocsp_Signature;
103 static int ett_ocsp_SEQUENCE_OF_Certificate;
104 static int ett_ocsp_Request;
105 static int ett_ocsp_CertID;
106 static int ett_ocsp_OCSPResponse;
107 static int ett_ocsp_ResponseBytes;
108 static int ett_ocsp_BasicOCSPResponse;
109 static int ett_ocsp_ResponseData;
110 static int ett_ocsp_SEQUENCE_OF_SingleResponse;
111 static int ett_ocsp_ResponderID;
112 static int ett_ocsp_SingleResponse;
113 static int ett_ocsp_CertStatus;
114 static int ett_ocsp_RevokedInfo;
115 static int ett_ocsp_AcceptableResponses;
116 static int ett_ocsp_ServiceLocator;
117 static int ett_ocsp_CrlID;
121 static int
122 dissect_ocsp_Version(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
123 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
124 NULL);
126 return offset;
131 static int
132 dissect_ocsp_OCTET_STRING(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
133 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
134 NULL);
136 return offset;
140 static const ber_sequence_t CertID_sequence[] = {
141 { &hf_ocsp_hashAlgorithm , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_x509af_AlgorithmIdentifier },
142 { &hf_ocsp_issuerNameHash , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ocsp_OCTET_STRING },
143 { &hf_ocsp_issuerKeyHash , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ocsp_OCTET_STRING },
144 { &hf_ocsp_serialNumber , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_pkix1explicit_CertificateSerialNumber },
145 { NULL, 0, 0, 0, NULL }
148 static int
149 dissect_ocsp_CertID(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
150 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
151 CertID_sequence, hf_index, ett_ocsp_CertID);
153 return offset;
157 static const ber_sequence_t Request_sequence[] = {
158 { &hf_ocsp_reqCert , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ocsp_CertID },
159 { &hf_ocsp_singleRequestExtensions, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_pkix1explicit_Extensions },
160 { NULL, 0, 0, 0, NULL }
163 static int
164 dissect_ocsp_Request(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
165 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
166 Request_sequence, hf_index, ett_ocsp_Request);
168 return offset;
172 static const ber_sequence_t SEQUENCE_OF_Request_sequence_of[1] = {
173 { &hf_ocsp_requestList_item, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ocsp_Request },
176 static int
177 dissect_ocsp_SEQUENCE_OF_Request(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
178 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
179 SEQUENCE_OF_Request_sequence_of, hf_index, ett_ocsp_SEQUENCE_OF_Request);
181 return offset;
185 static const ber_sequence_t TBSRequest_sequence[] = {
186 { &hf_ocsp_version , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_ocsp_Version },
187 { &hf_ocsp_requestorName , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_pkix1explicit_GeneralName },
188 { &hf_ocsp_requestList , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ocsp_SEQUENCE_OF_Request },
189 { &hf_ocsp_requestExtensions, BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL, dissect_pkix1explicit_Extensions },
190 { NULL, 0, 0, 0, NULL }
193 static int
194 dissect_ocsp_TBSRequest(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
195 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
196 TBSRequest_sequence, hf_index, ett_ocsp_TBSRequest);
198 return offset;
203 static int
204 dissect_ocsp_BIT_STRING(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
205 offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
206 NULL, 0, hf_index, -1,
207 NULL);
209 return offset;
213 static const ber_sequence_t SEQUENCE_OF_Certificate_sequence_of[1] = {
214 { &hf_ocsp_certs_item , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_x509af_Certificate },
217 static int
218 dissect_ocsp_SEQUENCE_OF_Certificate(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
219 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
220 SEQUENCE_OF_Certificate_sequence_of, hf_index, ett_ocsp_SEQUENCE_OF_Certificate);
222 return offset;
226 static const ber_sequence_t Signature_sequence[] = {
227 { &hf_ocsp_signatureAlgorithm, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_x509af_AlgorithmIdentifier },
228 { &hf_ocsp_signature , BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_NOOWNTAG, dissect_ocsp_BIT_STRING },
229 { &hf_ocsp_certs , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_ocsp_SEQUENCE_OF_Certificate },
230 { NULL, 0, 0, 0, NULL }
233 static int
234 dissect_ocsp_Signature(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
235 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
236 Signature_sequence, hf_index, ett_ocsp_Signature);
238 return offset;
242 static const ber_sequence_t OCSPRequest_sequence[] = {
243 { &hf_ocsp_tbsRequest , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ocsp_TBSRequest },
244 { &hf_ocsp_optionalSignature, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_ocsp_Signature },
245 { NULL, 0, 0, 0, NULL }
248 static int
249 dissect_ocsp_OCSPRequest(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
250 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
251 OCSPRequest_sequence, hf_index, ett_ocsp_OCSPRequest);
253 return offset;
257 static const value_string ocsp_OCSPResponseStatus_vals[] = {
258 { 0, "successful" },
259 { 1, "malformedRequest" },
260 { 2, "internalError" },
261 { 3, "tryLater" },
262 { 5, "sigRequired" },
263 { 6, "unauthorized" },
264 { 0, NULL }
268 static int
269 dissect_ocsp_OCSPResponseStatus(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
270 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
271 NULL);
273 return offset;
278 static int
279 dissect_ocsp_T_responseType(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
280 offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_ocsp_responseType_id, &actx->external.direct_reference);
282 actx->external.direct_ref_present = (actx->external.direct_reference != NULL) ? true : false;
285 return offset;
290 static int
291 dissect_ocsp_T_response(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
292 int8_t appclass;
293 bool pc, ind;
294 int32_t tag;
295 uint32_t len;
296 /* skip past the T and L */
297 offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &appclass, &pc, &tag);
298 offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, &ind);
299 if (actx->external.direct_ref_present) {
300 offset = call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL);
304 return offset;
308 static const ber_sequence_t ResponseBytes_sequence[] = {
309 { &hf_ocsp_responseType , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_ocsp_T_responseType },
310 { &hf_ocsp_response , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ocsp_T_response },
311 { NULL, 0, 0, 0, NULL }
314 static int
315 dissect_ocsp_ResponseBytes(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
316 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
317 ResponseBytes_sequence, hf_index, ett_ocsp_ResponseBytes);
319 return offset;
323 static const ber_sequence_t OCSPResponse_sequence[] = {
324 { &hf_ocsp_responseStatus , BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_ocsp_OCSPResponseStatus },
325 { &hf_ocsp_responseBytes , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_ocsp_ResponseBytes },
326 { NULL, 0, 0, 0, NULL }
330 dissect_ocsp_OCSPResponse(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
331 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
332 OCSPResponse_sequence, hf_index, ett_ocsp_OCSPResponse);
334 return offset;
339 static int
340 dissect_ocsp_KeyHash(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
341 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
342 NULL);
344 return offset;
348 static const value_string ocsp_ResponderID_vals[] = {
349 { 1, "byName" },
350 { 2, "byKey" },
351 { 0, NULL }
354 static const ber_choice_t ResponderID_choice[] = {
355 { 1, &hf_ocsp_byName , BER_CLASS_CON, 1, 0, dissect_pkix1explicit_Name },
356 { 2, &hf_ocsp_byKey , BER_CLASS_CON, 2, 0, dissect_ocsp_KeyHash },
357 { 0, NULL, 0, 0, 0, NULL }
360 static int
361 dissect_ocsp_ResponderID(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
362 offset = dissect_ber_choice(actx, tree, tvb, offset,
363 ResponderID_choice, hf_index, ett_ocsp_ResponderID,
364 NULL);
366 return offset;
371 static int
372 dissect_ocsp_GeneralizedTime(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
373 offset = dissect_ber_GeneralizedTime(implicit_tag, actx, tree, tvb, offset, hf_index);
375 return offset;
380 static int
381 dissect_ocsp_NULL(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
382 offset = dissect_ber_null(implicit_tag, actx, tree, tvb, offset, hf_index);
384 return offset;
388 static const ber_sequence_t RevokedInfo_sequence[] = {
389 { &hf_ocsp_revocationTime , BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_NOOWNTAG, dissect_ocsp_GeneralizedTime },
390 { &hf_ocsp_revocationReason, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_x509ce_CRLReason },
391 { NULL, 0, 0, 0, NULL }
394 static int
395 dissect_ocsp_RevokedInfo(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
396 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
397 RevokedInfo_sequence, hf_index, ett_ocsp_RevokedInfo);
399 return offset;
404 static int
405 dissect_ocsp_UnknownInfo(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
406 offset = dissect_ber_null(implicit_tag, actx, tree, tvb, offset, hf_index);
408 return offset;
412 static const value_string ocsp_CertStatus_vals[] = {
413 { 0, "good" },
414 { 1, "revoked" },
415 { 2, "unknown" },
416 { 0, NULL }
419 static const ber_choice_t CertStatus_choice[] = {
420 { 0, &hf_ocsp_good , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_ocsp_NULL },
421 { 1, &hf_ocsp_revoked , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_ocsp_RevokedInfo },
422 { 2, &hf_ocsp_unknown , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_ocsp_UnknownInfo },
423 { 0, NULL, 0, 0, 0, NULL }
426 static int
427 dissect_ocsp_CertStatus(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
428 offset = dissect_ber_choice(actx, tree, tvb, offset,
429 CertStatus_choice, hf_index, ett_ocsp_CertStatus,
430 NULL);
432 return offset;
436 static const ber_sequence_t SingleResponse_sequence[] = {
437 { &hf_ocsp_certID , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ocsp_CertID },
438 { &hf_ocsp_certStatus , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ocsp_CertStatus },
439 { &hf_ocsp_thisUpdate , BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_NOOWNTAG, dissect_ocsp_GeneralizedTime },
440 { &hf_ocsp_nextUpdate , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_ocsp_GeneralizedTime },
441 { &hf_ocsp_singleExtensions, BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_pkix1explicit_Extensions },
442 { NULL, 0, 0, 0, NULL }
445 static int
446 dissect_ocsp_SingleResponse(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
447 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
448 SingleResponse_sequence, hf_index, ett_ocsp_SingleResponse);
450 return offset;
454 static const ber_sequence_t SEQUENCE_OF_SingleResponse_sequence_of[1] = {
455 { &hf_ocsp_responses_item , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ocsp_SingleResponse },
458 static int
459 dissect_ocsp_SEQUENCE_OF_SingleResponse(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
460 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
461 SEQUENCE_OF_SingleResponse_sequence_of, hf_index, ett_ocsp_SEQUENCE_OF_SingleResponse);
463 return offset;
467 static const ber_sequence_t ResponseData_sequence[] = {
468 { &hf_ocsp_version , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_ocsp_Version },
469 { &hf_ocsp_responderID , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ocsp_ResponderID },
470 { &hf_ocsp_producedAt , BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_NOOWNTAG, dissect_ocsp_GeneralizedTime },
471 { &hf_ocsp_responses , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ocsp_SEQUENCE_OF_SingleResponse },
472 { &hf_ocsp_responseExtensions, BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_pkix1explicit_Extensions },
473 { NULL, 0, 0, 0, NULL }
476 static int
477 dissect_ocsp_ResponseData(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
478 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
479 ResponseData_sequence, hf_index, ett_ocsp_ResponseData);
481 return offset;
485 static const ber_sequence_t BasicOCSPResponse_sequence[] = {
486 { &hf_ocsp_tbsResponseData, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ocsp_ResponseData },
487 { &hf_ocsp_signatureAlgorithm, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_x509af_AlgorithmIdentifier },
488 { &hf_ocsp_signature , BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_NOOWNTAG, dissect_ocsp_BIT_STRING },
489 { &hf_ocsp_certs , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_ocsp_SEQUENCE_OF_Certificate },
490 { NULL, 0, 0, 0, NULL }
493 static int
494 dissect_ocsp_BasicOCSPResponse(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
495 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
496 BasicOCSPResponse_sequence, hf_index, ett_ocsp_BasicOCSPResponse);
498 return offset;
503 static int
504 dissect_ocsp_ArchiveCutoff(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
505 offset = dissect_ber_GeneralizedTime(implicit_tag, actx, tree, tvb, offset, hf_index);
507 return offset;
512 static int
513 dissect_ocsp_OBJECT_IDENTIFIER(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
514 offset = dissect_ber_object_identifier(implicit_tag, actx, tree, tvb, offset, hf_index, NULL);
516 return offset;
520 static const ber_sequence_t AcceptableResponses_sequence_of[1] = {
521 { &hf_ocsp_AcceptableResponses_item, BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_ocsp_OBJECT_IDENTIFIER },
524 static int
525 dissect_ocsp_AcceptableResponses(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
526 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
527 AcceptableResponses_sequence_of, hf_index, ett_ocsp_AcceptableResponses);
529 return offset;
533 static const ber_sequence_t ServiceLocator_sequence[] = {
534 { &hf_ocsp_issuer , BER_CLASS_ANY, -1, BER_FLAGS_NOOWNTAG, dissect_pkix1explicit_Name },
535 { &hf_ocsp_locator , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pkix1implicit_AuthorityInfoAccessSyntax },
536 { NULL, 0, 0, 0, NULL }
539 static int
540 dissect_ocsp_ServiceLocator(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
541 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
542 ServiceLocator_sequence, hf_index, ett_ocsp_ServiceLocator);
544 return offset;
549 static int
550 dissect_ocsp_IA5String(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
551 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
552 actx, tree, tvb, offset, hf_index,
553 NULL);
555 return offset;
560 static int
561 dissect_ocsp_INTEGER(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
562 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
563 NULL);
565 return offset;
569 static const ber_sequence_t CrlID_sequence[] = {
570 { &hf_ocsp_crlUrl , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_ocsp_IA5String },
571 { &hf_ocsp_crlNum , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_ocsp_INTEGER },
572 { &hf_ocsp_crlTime , BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL, dissect_ocsp_GeneralizedTime },
573 { NULL, 0, 0, 0, NULL }
576 static int
577 dissect_ocsp_CrlID(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
578 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
579 CrlID_sequence, hf_index, ett_ocsp_CrlID);
581 return offset;
586 static int
587 dissect_ocsp_ReOcspNonce(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
588 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
589 NULL);
591 return offset;
594 /*--- PDUs ---*/
596 static int dissect_BasicOCSPResponse_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
597 int offset = 0;
598 asn1_ctx_t asn1_ctx;
599 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
600 offset = dissect_ocsp_BasicOCSPResponse(false, tvb, offset, &asn1_ctx, tree, hf_ocsp_BasicOCSPResponse_PDU);
601 return offset;
603 static int dissect_ArchiveCutoff_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
604 int offset = 0;
605 asn1_ctx_t asn1_ctx;
606 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
607 offset = dissect_ocsp_ArchiveCutoff(false, tvb, offset, &asn1_ctx, tree, hf_ocsp_ArchiveCutoff_PDU);
608 return offset;
610 static int dissect_AcceptableResponses_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
611 int offset = 0;
612 asn1_ctx_t asn1_ctx;
613 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
614 offset = dissect_ocsp_AcceptableResponses(false, tvb, offset, &asn1_ctx, tree, hf_ocsp_AcceptableResponses_PDU);
615 return offset;
617 static int dissect_ServiceLocator_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
618 int offset = 0;
619 asn1_ctx_t asn1_ctx;
620 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
621 offset = dissect_ocsp_ServiceLocator(false, tvb, offset, &asn1_ctx, tree, hf_ocsp_ServiceLocator_PDU);
622 return offset;
624 static int dissect_CrlID_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
625 int offset = 0;
626 asn1_ctx_t asn1_ctx;
627 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
628 offset = dissect_ocsp_CrlID(false, tvb, offset, &asn1_ctx, tree, hf_ocsp_CrlID_PDU);
629 return offset;
631 static int dissect_ReOcspNonce_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
632 int offset = 0;
633 asn1_ctx_t asn1_ctx;
634 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
635 offset = dissect_ocsp_ReOcspNonce(false, tvb, offset, &asn1_ctx, tree, hf_ocsp_ReOcspNonce_PDU);
636 return offset;
638 static int dissect_NULL_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
639 int offset = 0;
640 asn1_ctx_t asn1_ctx;
641 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
642 offset = dissect_ocsp_NULL(false, tvb, offset, &asn1_ctx, tree, hf_ocsp_NULL_PDU);
643 return offset;
648 static int
649 dissect_ocsp_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data _U_)
651 proto_item *item=NULL;
652 proto_tree *tree=NULL;
653 asn1_ctx_t asn1_ctx;
654 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
656 col_set_str(pinfo->cinfo, COL_PROTOCOL, "OCSP");
658 col_set_str(pinfo->cinfo, COL_INFO, "Request");
661 if(parent_tree){
662 item=proto_tree_add_item(parent_tree, proto_ocsp, tvb, 0, -1, ENC_NA);
663 tree = proto_item_add_subtree(item, ett_ocsp);
666 return dissect_ocsp_OCSPRequest(false, tvb, 0, &asn1_ctx, tree, -1);
670 static int
671 dissect_ocsp_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data _U_)
673 proto_item *item=NULL;
674 proto_tree *tree=NULL;
675 asn1_ctx_t asn1_ctx;
676 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
678 col_set_str(pinfo->cinfo, COL_PROTOCOL, "OCSP");
680 col_set_str(pinfo->cinfo, COL_INFO, "Response");
683 if(parent_tree){
684 item=proto_tree_add_item(parent_tree, proto_ocsp, tvb, 0, -1, ENC_NA);
685 tree = proto_item_add_subtree(item, ett_ocsp);
688 return dissect_ocsp_OCSPResponse(false, tvb, 0, &asn1_ctx, tree, -1);
691 /*--- proto_register_ocsp ----------------------------------------------*/
692 void proto_register_ocsp(void) {
694 /* List of fields */
695 static hf_register_info hf[] = {
696 { &hf_ocsp_responseType_id,
697 { "ResponseType Id", "ocsp.responseType.id",
698 FT_STRING, BASE_NONE, NULL, 0,
699 NULL, HFILL }},
700 { &hf_ocsp_BasicOCSPResponse_PDU,
701 { "BasicOCSPResponse", "ocsp.BasicOCSPResponse_element",
702 FT_NONE, BASE_NONE, NULL, 0,
703 NULL, HFILL }},
704 { &hf_ocsp_ArchiveCutoff_PDU,
705 { "ArchiveCutoff", "ocsp.ArchiveCutoff",
706 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0,
707 NULL, HFILL }},
708 { &hf_ocsp_AcceptableResponses_PDU,
709 { "AcceptableResponses", "ocsp.AcceptableResponses",
710 FT_UINT32, BASE_DEC, NULL, 0,
711 NULL, HFILL }},
712 { &hf_ocsp_ServiceLocator_PDU,
713 { "ServiceLocator", "ocsp.ServiceLocator_element",
714 FT_NONE, BASE_NONE, NULL, 0,
715 NULL, HFILL }},
716 { &hf_ocsp_CrlID_PDU,
717 { "CrlID", "ocsp.CrlID_element",
718 FT_NONE, BASE_NONE, NULL, 0,
719 NULL, HFILL }},
720 { &hf_ocsp_ReOcspNonce_PDU,
721 { "ReOcspNonce", "ocsp.ReOcspNonce",
722 FT_BYTES, BASE_NONE, NULL, 0,
723 NULL, HFILL }},
724 { &hf_ocsp_NULL_PDU,
725 { "NULL", "ocsp.NULL_element",
726 FT_NONE, BASE_NONE, NULL, 0,
727 NULL, HFILL }},
728 { &hf_ocsp_tbsRequest,
729 { "tbsRequest", "ocsp.tbsRequest_element",
730 FT_NONE, BASE_NONE, NULL, 0,
731 NULL, HFILL }},
732 { &hf_ocsp_optionalSignature,
733 { "optionalSignature", "ocsp.optionalSignature_element",
734 FT_NONE, BASE_NONE, NULL, 0,
735 "Signature", HFILL }},
736 { &hf_ocsp_version,
737 { "version", "ocsp.version",
738 FT_INT32, BASE_DEC, VALS(pkix1explicit_Version_vals), 0,
739 NULL, HFILL }},
740 { &hf_ocsp_requestorName,
741 { "requestorName", "ocsp.requestorName",
742 FT_UINT32, BASE_DEC, VALS(x509ce_GeneralName_vals), 0,
743 "GeneralName", HFILL }},
744 { &hf_ocsp_requestList,
745 { "requestList", "ocsp.requestList",
746 FT_UINT32, BASE_DEC, NULL, 0,
747 "SEQUENCE_OF_Request", HFILL }},
748 { &hf_ocsp_requestList_item,
749 { "Request", "ocsp.Request_element",
750 FT_NONE, BASE_NONE, NULL, 0,
751 NULL, HFILL }},
752 { &hf_ocsp_requestExtensions,
753 { "requestExtensions", "ocsp.requestExtensions",
754 FT_UINT32, BASE_DEC, NULL, 0,
755 "Extensions", HFILL }},
756 { &hf_ocsp_signatureAlgorithm,
757 { "signatureAlgorithm", "ocsp.signatureAlgorithm_element",
758 FT_NONE, BASE_NONE, NULL, 0,
759 "AlgorithmIdentifier", HFILL }},
760 { &hf_ocsp_signature,
761 { "signature", "ocsp.signature",
762 FT_BYTES, BASE_NONE, NULL, 0,
763 "BIT_STRING", HFILL }},
764 { &hf_ocsp_certs,
765 { "certs", "ocsp.certs",
766 FT_UINT32, BASE_DEC, NULL, 0,
767 "SEQUENCE_OF_Certificate", HFILL }},
768 { &hf_ocsp_certs_item,
769 { "Certificate", "ocsp.Certificate_element",
770 FT_NONE, BASE_NONE, NULL, 0,
771 NULL, HFILL }},
772 { &hf_ocsp_reqCert,
773 { "reqCert", "ocsp.reqCert_element",
774 FT_NONE, BASE_NONE, NULL, 0,
775 "CertID", HFILL }},
776 { &hf_ocsp_singleRequestExtensions,
777 { "singleRequestExtensions", "ocsp.singleRequestExtensions",
778 FT_UINT32, BASE_DEC, NULL, 0,
779 "Extensions", HFILL }},
780 { &hf_ocsp_hashAlgorithm,
781 { "hashAlgorithm", "ocsp.hashAlgorithm_element",
782 FT_NONE, BASE_NONE, NULL, 0,
783 "AlgorithmIdentifier", HFILL }},
784 { &hf_ocsp_issuerNameHash,
785 { "issuerNameHash", "ocsp.issuerNameHash",
786 FT_BYTES, BASE_NONE, NULL, 0,
787 "OCTET_STRING", HFILL }},
788 { &hf_ocsp_issuerKeyHash,
789 { "issuerKeyHash", "ocsp.issuerKeyHash",
790 FT_BYTES, BASE_NONE, NULL, 0,
791 "OCTET_STRING", HFILL }},
792 { &hf_ocsp_serialNumber,
793 { "serialNumber", "ocsp.serialNumber",
794 FT_BYTES, BASE_NONE, NULL, 0,
795 "CertificateSerialNumber", HFILL }},
796 { &hf_ocsp_responseStatus,
797 { "responseStatus", "ocsp.responseStatus",
798 FT_UINT32, BASE_DEC, VALS(ocsp_OCSPResponseStatus_vals), 0,
799 "OCSPResponseStatus", HFILL }},
800 { &hf_ocsp_responseBytes,
801 { "responseBytes", "ocsp.responseBytes_element",
802 FT_NONE, BASE_NONE, NULL, 0,
803 NULL, HFILL }},
804 { &hf_ocsp_responseType,
805 { "responseType", "ocsp.responseType",
806 FT_OID, BASE_NONE, NULL, 0,
807 NULL, HFILL }},
808 { &hf_ocsp_response,
809 { "response", "ocsp.response",
810 FT_BYTES, BASE_NONE, NULL, 0,
811 NULL, HFILL }},
812 { &hf_ocsp_tbsResponseData,
813 { "tbsResponseData", "ocsp.tbsResponseData_element",
814 FT_NONE, BASE_NONE, NULL, 0,
815 "ResponseData", HFILL }},
816 { &hf_ocsp_responderID,
817 { "responderID", "ocsp.responderID",
818 FT_UINT32, BASE_DEC, VALS(ocsp_ResponderID_vals), 0,
819 NULL, HFILL }},
820 { &hf_ocsp_producedAt,
821 { "producedAt", "ocsp.producedAt",
822 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0,
823 "GeneralizedTime", HFILL }},
824 { &hf_ocsp_responses,
825 { "responses", "ocsp.responses",
826 FT_UINT32, BASE_DEC, NULL, 0,
827 "SEQUENCE_OF_SingleResponse", HFILL }},
828 { &hf_ocsp_responses_item,
829 { "SingleResponse", "ocsp.SingleResponse_element",
830 FT_NONE, BASE_NONE, NULL, 0,
831 NULL, HFILL }},
832 { &hf_ocsp_responseExtensions,
833 { "responseExtensions", "ocsp.responseExtensions",
834 FT_UINT32, BASE_DEC, NULL, 0,
835 "Extensions", HFILL }},
836 { &hf_ocsp_byName,
837 { "byName", "ocsp.byName",
838 FT_UINT32, BASE_DEC, NULL, 0,
839 "Name", HFILL }},
840 { &hf_ocsp_byKey,
841 { "byKey", "ocsp.byKey",
842 FT_BYTES, BASE_NONE, NULL, 0,
843 "KeyHash", HFILL }},
844 { &hf_ocsp_certID,
845 { "certID", "ocsp.certID_element",
846 FT_NONE, BASE_NONE, NULL, 0,
847 NULL, HFILL }},
848 { &hf_ocsp_certStatus,
849 { "certStatus", "ocsp.certStatus",
850 FT_UINT32, BASE_DEC, VALS(ocsp_CertStatus_vals), 0,
851 NULL, HFILL }},
852 { &hf_ocsp_thisUpdate,
853 { "thisUpdate", "ocsp.thisUpdate",
854 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0,
855 "GeneralizedTime", HFILL }},
856 { &hf_ocsp_nextUpdate,
857 { "nextUpdate", "ocsp.nextUpdate",
858 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0,
859 "GeneralizedTime", HFILL }},
860 { &hf_ocsp_singleExtensions,
861 { "singleExtensions", "ocsp.singleExtensions",
862 FT_UINT32, BASE_DEC, NULL, 0,
863 "Extensions", HFILL }},
864 { &hf_ocsp_good,
865 { "good", "ocsp.good_element",
866 FT_NONE, BASE_NONE, NULL, 0,
867 NULL, HFILL }},
868 { &hf_ocsp_revoked,
869 { "revoked", "ocsp.revoked_element",
870 FT_NONE, BASE_NONE, NULL, 0,
871 "RevokedInfo", HFILL }},
872 { &hf_ocsp_unknown,
873 { "unknown", "ocsp.unknown_element",
874 FT_NONE, BASE_NONE, NULL, 0,
875 "UnknownInfo", HFILL }},
876 { &hf_ocsp_revocationTime,
877 { "revocationTime", "ocsp.revocationTime",
878 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0,
879 "GeneralizedTime", HFILL }},
880 { &hf_ocsp_revocationReason,
881 { "revocationReason", "ocsp.revocationReason",
882 FT_UINT32, BASE_DEC, VALS(x509ce_CRLReason_vals), 0,
883 "CRLReason", HFILL }},
884 { &hf_ocsp_AcceptableResponses_item,
885 { "AcceptableResponses item", "ocsp.AcceptableResponses_item",
886 FT_OID, BASE_NONE, NULL, 0,
887 "OBJECT_IDENTIFIER", HFILL }},
888 { &hf_ocsp_issuer,
889 { "issuer", "ocsp.issuer",
890 FT_UINT32, BASE_DEC, NULL, 0,
891 "Name", HFILL }},
892 { &hf_ocsp_locator,
893 { "locator", "ocsp.locator",
894 FT_UINT32, BASE_DEC, NULL, 0,
895 "AuthorityInfoAccessSyntax", HFILL }},
896 { &hf_ocsp_crlUrl,
897 { "crlUrl", "ocsp.crlUrl",
898 FT_STRING, BASE_NONE, NULL, 0,
899 "IA5String", HFILL }},
900 { &hf_ocsp_crlNum,
901 { "crlNum", "ocsp.crlNum",
902 FT_INT32, BASE_DEC, NULL, 0,
903 "INTEGER", HFILL }},
904 { &hf_ocsp_crlTime,
905 { "crlTime", "ocsp.crlTime",
906 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0,
907 "GeneralizedTime", HFILL }},
910 /* List of subtrees */
911 static int *ett[] = {
912 &ett_ocsp,
913 &ett_ocsp_OCSPRequest,
914 &ett_ocsp_TBSRequest,
915 &ett_ocsp_SEQUENCE_OF_Request,
916 &ett_ocsp_Signature,
917 &ett_ocsp_SEQUENCE_OF_Certificate,
918 &ett_ocsp_Request,
919 &ett_ocsp_CertID,
920 &ett_ocsp_OCSPResponse,
921 &ett_ocsp_ResponseBytes,
922 &ett_ocsp_BasicOCSPResponse,
923 &ett_ocsp_ResponseData,
924 &ett_ocsp_SEQUENCE_OF_SingleResponse,
925 &ett_ocsp_ResponderID,
926 &ett_ocsp_SingleResponse,
927 &ett_ocsp_CertStatus,
928 &ett_ocsp_RevokedInfo,
929 &ett_ocsp_AcceptableResponses,
930 &ett_ocsp_ServiceLocator,
931 &ett_ocsp_CrlID,
934 /* Register protocol */
935 proto_ocsp = proto_register_protocol(PNAME, PSNAME, PFNAME);
937 /* Register fields and subtrees */
938 proto_register_field_array(proto_ocsp, hf, array_length(hf));
939 proto_register_subtree_array(ett, array_length(ett));
941 /* Register dissectors */
942 ocsp_request_handle = register_dissector(PFNAME "_req", dissect_ocsp_request, proto_ocsp);
943 ocsp_response_handle = register_dissector(PFNAME "_res", dissect_ocsp_response, proto_ocsp);
946 /*--- proto_reg_handoff_ocsp -------------------------------------------*/
947 void proto_reg_handoff_ocsp(void) {
948 dissector_add_string("media_type", "application/ocsp-request", ocsp_request_handle);
949 dissector_add_string("media_type", "application/ocsp-response", ocsp_response_handle);
951 register_ber_oid_dissector("1.3.6.1.5.5.7.48.1.1", dissect_BasicOCSPResponse_PDU, proto_ocsp, "id-pkix-ocsp-basic");
952 register_ber_oid_dissector("1.3.6.1.5.5.7.48.1.2", dissect_ReOcspNonce_PDU, proto_ocsp, "id-pkix-ocsp-nonce");
953 register_ber_oid_dissector("1.3.6.1.5.5.7.48.1.3", dissect_CrlID_PDU, proto_ocsp, "id-pkix-ocsp-crl");
954 register_ber_oid_dissector("1.3.6.1.5.5.7.48.1.4", dissect_AcceptableResponses_PDU, proto_ocsp, "id-pkix-ocsp-response");
955 register_ber_oid_dissector("1.3.6.1.5.5.7.48.1.5", dissect_NULL_PDU, proto_ocsp, "id-pkix-ocsp-nocheck");
956 register_ber_oid_dissector("1.3.6.1.5.5.7.48.1.6", dissect_ArchiveCutoff_PDU, proto_ocsp, "id-pkix-ocsp-archive-cutoff");
957 register_ber_oid_dissector("1.3.6.1.5.5.7.48.1.7", dissect_ServiceLocator_PDU, proto_ocsp, "id-pkix-ocsp-service-locator");