Coverage Report

Created: 2026-09-28 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-ns_cert_exts.c
Line
Count
Source
1
/* Do not modify this file. Changes will be overwritten.                      */
2
/* Generated automatically by the ASN.1 to Wireshark dissector compiler       */
3
/* packet-ns_cert_exts.c                                                      */
4
/* asn2wrs.py -b -q -L -p ns_cert_exts -c ./ns_cert_exts.cnf -s ./packet-ns_cert_exts-template -D . -O ../.. NETSCAPE-CERT-EXTS.asn */
5
6
/* packet-ns_cert_exts.c
7
 * Routines for NetScape Certificate Extensions packet dissection
8
 *   Ronnie Sahlberg 2004
9
 *
10
 * Wireshark - Network traffic analyzer
11
 * By Gerald Combs <gerald@wireshark.org>
12
 * Copyright 1998 Gerald Combs
13
 *
14
 * SPDX-License-Identifier: GPL-2.0-or-later
15
 */
16
17
#include "config.h"
18
19
#include <epan/packet.h>
20
#include <wsutil/array.h>
21
22
#include "packet-ber.h"
23
24
void proto_register_ns_cert_exts(void);
25
void proto_reg_handoff_ns_cert_exts(void);
26
27
/* Initialize the protocol and registered fields */
28
static int proto_ns_cert_exts;
29
static int hf_ns_cert_exts_BaseUrl_PDU;           /* BaseUrl */
30
static int hf_ns_cert_exts_RevocationUrl_PDU;     /* RevocationUrl */
31
static int hf_ns_cert_exts_CaRevocationUrl_PDU;   /* CaRevocationUrl */
32
static int hf_ns_cert_exts_CaPolicyUrl_PDU;       /* CaPolicyUrl */
33
static int hf_ns_cert_exts_Comment_PDU;           /* Comment */
34
static int hf_ns_cert_exts_SslServerName_PDU;     /* SslServerName */
35
static int hf_ns_cert_exts_CertRenewalUrl_PDU;    /* CertRenewalUrl */
36
static int hf_ns_cert_exts_CertType_PDU;          /* CertType */
37
/* named bits */
38
static int hf_ns_cert_exts_CertType_ssl_client;
39
static int hf_ns_cert_exts_CertType_ssl_server;
40
static int hf_ns_cert_exts_CertType_smime;
41
static int hf_ns_cert_exts_CertType_object_signing;
42
static int hf_ns_cert_exts_CertType_reserved_for_future_use;
43
static int hf_ns_cert_exts_CertType_ssl_ca;
44
static int hf_ns_cert_exts_CertType_smime_ca;
45
static int hf_ns_cert_exts_CertType_object_signing_ca;
46
47
/* Initialize the subtree pointers */
48
static int ett_ns_cert_exts_CertType;
49
50
51
52
static unsigned
53
0
dissect_ns_cert_exts_BaseUrl(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
54
0
  offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
55
0
                                            actx, tree, tvb, offset, hf_index,
56
0
                                            NULL);
57
58
0
  return offset;
59
0
}
60
61
62
63
static unsigned
64
0
dissect_ns_cert_exts_RevocationUrl(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
65
0
  offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
66
0
                                            actx, tree, tvb, offset, hf_index,
67
0
                                            NULL);
68
69
0
  return offset;
70
0
}
71
72
73
74
static unsigned
75
0
dissect_ns_cert_exts_CaRevocationUrl(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
76
0
  offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
77
0
                                            actx, tree, tvb, offset, hf_index,
78
0
                                            NULL);
79
80
0
  return offset;
81
0
}
82
83
84
85
static unsigned
86
0
dissect_ns_cert_exts_CaPolicyUrl(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
87
0
  offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
88
0
                                            actx, tree, tvb, offset, hf_index,
89
0
                                            NULL);
90
91
0
  return offset;
92
0
}
93
94
95
96
static unsigned
97
0
dissect_ns_cert_exts_Comment(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
98
0
  offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
99
0
                                            actx, tree, tvb, offset, hf_index,
100
0
                                            NULL);
101
102
0
  return offset;
103
0
}
104
105
106
107
static unsigned
108
0
dissect_ns_cert_exts_SslServerName(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
109
0
  offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
110
0
                                            actx, tree, tvb, offset, hf_index,
111
0
                                            NULL);
112
113
0
  return offset;
114
0
}
115
116
117
118
static unsigned
119
0
dissect_ns_cert_exts_CertRenewalUrl(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
120
0
  offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
121
0
                                            actx, tree, tvb, offset, hf_index,
122
0
                                            NULL);
123
124
0
  return offset;
125
0
}
126
127
128
static int * const CertType_bits[] = {
129
  &hf_ns_cert_exts_CertType_ssl_client,
130
  &hf_ns_cert_exts_CertType_ssl_server,
131
  &hf_ns_cert_exts_CertType_smime,
132
  &hf_ns_cert_exts_CertType_object_signing,
133
  &hf_ns_cert_exts_CertType_reserved_for_future_use,
134
  &hf_ns_cert_exts_CertType_ssl_ca,
135
  &hf_ns_cert_exts_CertType_smime_ca,
136
  &hf_ns_cert_exts_CertType_object_signing_ca,
137
  NULL
138
};
139
140
static unsigned
141
0
dissect_ns_cert_exts_CertType(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
142
0
  offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
143
0
                                    CertType_bits, 8, hf_index, ett_ns_cert_exts_CertType,
144
0
                                    NULL);
145
146
0
  return offset;
147
0
}
148
149
/*--- PDUs ---*/
150
151
0
static int dissect_BaseUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
152
0
  unsigned offset = 0;
153
0
  asn1_ctx_t asn1_ctx;
154
0
  asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
155
0
  offset = dissect_ns_cert_exts_BaseUrl(false, tvb, offset, &asn1_ctx, tree, hf_ns_cert_exts_BaseUrl_PDU);
156
0
  return offset;
157
0
}
158
0
static int dissect_RevocationUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
159
0
  unsigned offset = 0;
160
0
  asn1_ctx_t asn1_ctx;
161
0
  asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
162
0
  offset = dissect_ns_cert_exts_RevocationUrl(false, tvb, offset, &asn1_ctx, tree, hf_ns_cert_exts_RevocationUrl_PDU);
163
0
  return offset;
164
0
}
165
0
static int dissect_CaRevocationUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
166
0
  unsigned offset = 0;
167
0
  asn1_ctx_t asn1_ctx;
168
0
  asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
169
0
  offset = dissect_ns_cert_exts_CaRevocationUrl(false, tvb, offset, &asn1_ctx, tree, hf_ns_cert_exts_CaRevocationUrl_PDU);
170
0
  return offset;
171
0
}
172
0
static int dissect_CaPolicyUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
173
0
  unsigned offset = 0;
174
0
  asn1_ctx_t asn1_ctx;
175
0
  asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
176
0
  offset = dissect_ns_cert_exts_CaPolicyUrl(false, tvb, offset, &asn1_ctx, tree, hf_ns_cert_exts_CaPolicyUrl_PDU);
177
0
  return offset;
178
0
}
179
0
static int dissect_Comment_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
180
0
  unsigned offset = 0;
181
0
  asn1_ctx_t asn1_ctx;
182
0
  asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
183
0
  offset = dissect_ns_cert_exts_Comment(false, tvb, offset, &asn1_ctx, tree, hf_ns_cert_exts_Comment_PDU);
184
0
  return offset;
185
0
}
186
0
static int dissect_SslServerName_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
187
0
  unsigned offset = 0;
188
0
  asn1_ctx_t asn1_ctx;
189
0
  asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
190
0
  offset = dissect_ns_cert_exts_SslServerName(false, tvb, offset, &asn1_ctx, tree, hf_ns_cert_exts_SslServerName_PDU);
191
0
  return offset;
192
0
}
193
0
static int dissect_CertRenewalUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
194
0
  unsigned offset = 0;
195
0
  asn1_ctx_t asn1_ctx;
196
0
  asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
197
0
  offset = dissect_ns_cert_exts_CertRenewalUrl(false, tvb, offset, &asn1_ctx, tree, hf_ns_cert_exts_CertRenewalUrl_PDU);
198
0
  return offset;
199
0
}
200
0
static int dissect_CertType_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
201
0
  unsigned offset = 0;
202
0
  asn1_ctx_t asn1_ctx;
203
0
  asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
204
0
  offset = dissect_ns_cert_exts_CertType(false, tvb, offset, &asn1_ctx, tree, hf_ns_cert_exts_CertType_PDU);
205
0
  return offset;
206
0
}
207
208
209
210
/*--- proto_register_ns_cert_exts -------------------------------------------*/
211
16
void proto_register_ns_cert_exts(void) {
212
213
  /* List of fields */
214
16
  static hf_register_info hf[] = {
215
16
    { &hf_ns_cert_exts_BaseUrl_PDU,
216
16
      { "BaseUrl", "ns_cert_exts.BaseUrl",
217
16
        FT_STRING, BASE_NONE, NULL, 0,
218
16
        NULL, HFILL }},
219
16
    { &hf_ns_cert_exts_RevocationUrl_PDU,
220
16
      { "RevocationUrl", "ns_cert_exts.RevocationUrl",
221
16
        FT_STRING, BASE_NONE, NULL, 0,
222
16
        NULL, HFILL }},
223
16
    { &hf_ns_cert_exts_CaRevocationUrl_PDU,
224
16
      { "CaRevocationUrl", "ns_cert_exts.CaRevocationUrl",
225
16
        FT_STRING, BASE_NONE, NULL, 0,
226
16
        NULL, HFILL }},
227
16
    { &hf_ns_cert_exts_CaPolicyUrl_PDU,
228
16
      { "CaPolicyUrl", "ns_cert_exts.CaPolicyUrl",
229
16
        FT_STRING, BASE_NONE, NULL, 0,
230
16
        NULL, HFILL }},
231
16
    { &hf_ns_cert_exts_Comment_PDU,
232
16
      { "Comment", "ns_cert_exts.Comment",
233
16
        FT_STRING, BASE_NONE, NULL, 0,
234
16
        NULL, HFILL }},
235
16
    { &hf_ns_cert_exts_SslServerName_PDU,
236
16
      { "SslServerName", "ns_cert_exts.SslServerName",
237
16
        FT_STRING, BASE_NONE, NULL, 0,
238
16
        NULL, HFILL }},
239
16
    { &hf_ns_cert_exts_CertRenewalUrl_PDU,
240
16
      { "CertRenewalUrl", "ns_cert_exts.CertRenewalUrl",
241
16
        FT_STRING, BASE_NONE, NULL, 0,
242
16
        NULL, HFILL }},
243
16
    { &hf_ns_cert_exts_CertType_PDU,
244
16
      { "CertType", "ns_cert_exts.CertType",
245
16
        FT_BYTES, BASE_NONE, NULL, 0,
246
16
        NULL, HFILL }},
247
16
    { &hf_ns_cert_exts_CertType_ssl_client,
248
16
      { "ssl-client", "ns.cert.exts.CertType.ssl.client",
249
16
        FT_BOOLEAN, 8, NULL, 0x80,
250
16
        NULL, HFILL }},
251
16
    { &hf_ns_cert_exts_CertType_ssl_server,
252
16
      { "ssl-server", "ns.cert.exts.CertType.ssl.server",
253
16
        FT_BOOLEAN, 8, NULL, 0x40,
254
16
        NULL, HFILL }},
255
16
    { &hf_ns_cert_exts_CertType_smime,
256
16
      { "smime", "ns.cert.exts.CertType.smime",
257
16
        FT_BOOLEAN, 8, NULL, 0x20,
258
16
        NULL, HFILL }},
259
16
    { &hf_ns_cert_exts_CertType_object_signing,
260
16
      { "object-signing", "ns.cert.exts.CertType.object.signing",
261
16
        FT_BOOLEAN, 8, NULL, 0x10,
262
16
        NULL, HFILL }},
263
16
    { &hf_ns_cert_exts_CertType_reserved_for_future_use,
264
16
      { "reserved-for-future-use", "ns.cert.exts.CertType.reserved.for.future.use",
265
16
        FT_BOOLEAN, 8, NULL, 0x08,
266
16
        NULL, HFILL }},
267
16
    { &hf_ns_cert_exts_CertType_ssl_ca,
268
16
      { "ssl-ca", "ns.cert.exts.CertType.ssl.ca",
269
16
        FT_BOOLEAN, 8, NULL, 0x04,
270
16
        NULL, HFILL }},
271
16
    { &hf_ns_cert_exts_CertType_smime_ca,
272
16
      { "smime-ca", "ns.cert.exts.CertType.smime.ca",
273
16
        FT_BOOLEAN, 8, NULL, 0x02,
274
16
        NULL, HFILL }},
275
16
    { &hf_ns_cert_exts_CertType_object_signing_ca,
276
16
      { "object-signing-ca", "ns.cert.exts.CertType.object.signing.ca",
277
16
        FT_BOOLEAN, 8, NULL, 0x01,
278
16
        NULL, HFILL }},
279
16
  };
280
281
  /* List of subtrees */
282
16
  static int *ett[] = {
283
16
    &ett_ns_cert_exts_CertType,
284
16
  };
285
286
  /* Register protocol */
287
16
  proto_ns_cert_exts = proto_register_protocol("NetScape Certificate Extensions", "NS_CERT_EXTS", "ns_cert_exts");
288
289
  /* Register fields and subtrees */
290
16
  proto_register_field_array(proto_ns_cert_exts, hf, array_length(hf));
291
16
  proto_register_subtree_array(ett, array_length(ett));
292
293
16
}
294
295
296
/*--- proto_reg_handoff_ns_cert_exts ---------------------------------------*/
297
16
void proto_reg_handoff_ns_cert_exts(void) {
298
16
  register_ber_oid_dissector("2.16.840.1.113730.1.1", dissect_CertType_PDU, proto_ns_cert_exts, "ns_cert_exts.cert_type");
299
16
  register_ber_oid_dissector("2.16.840.1.113730.1.2", dissect_BaseUrl_PDU, proto_ns_cert_exts, "ns_cert_exts.base_url");
300
16
  register_ber_oid_dissector("2.16.840.1.113730.1.3", dissect_RevocationUrl_PDU, proto_ns_cert_exts, "ns_cert_exts.revocation-url");
301
16
  register_ber_oid_dissector("2.16.840.1.113730.1.4", dissect_CaRevocationUrl_PDU, proto_ns_cert_exts, "ns_cert_exts.ca-revocation-url");
302
16
  register_ber_oid_dissector("2.16.840.1.113730.1.7", dissect_CertRenewalUrl_PDU, proto_ns_cert_exts, "ns_cert_exts.cert-renewal-url");
303
16
  register_ber_oid_dissector("2.16.840.1.113730.1.8", dissect_CaPolicyUrl_PDU, proto_ns_cert_exts, "ns_cert_exts.ca-policy-url");
304
16
  register_ber_oid_dissector("2.16.840.1.113730.1.12", dissect_SslServerName_PDU, proto_ns_cert_exts, "ns_cert_exts.ssl-server-name");
305
16
  register_ber_oid_dissector("2.16.840.1.113730.1.13", dissect_Comment_PDU, proto_ns_cert_exts, "ns_cert_exts.comment");
306
307
16
}
308