198 lines
8.8 KiB
Diff
198 lines
8.8 KiB
Diff
|
|
From 34d2e0d5318d0a7e9889498c721639e5cbf4ce45 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Pascal Quantin <pascal@wireshark.org>
|
||
|
|
Date: Mon, 4 Nov 2019 15:08:22 +0100
|
||
|
|
Subject: [PATCH] CMS: reset object_identifier_id after dissecting ContentInfo
|
||
|
|
MIME-Version: 1.0
|
||
|
|
Content-Type: text/plain; charset=UTF-8
|
||
|
|
Content-Transfer-Encoding: 8bit
|
||
|
|
|
||
|
|
Bug: 15961
|
||
|
|
Change-Id: I3d6b3e96103b69f88fcb512da81fa20ff6a1c40e
|
||
|
|
Reviewed-on: https://code.wireshark.org/review/34960
|
||
|
|
Petri-Dish: Pascal Quantin <pascal@wireshark.org>
|
||
|
|
Tested-by: Petri Dish Buildbot
|
||
|
|
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
|
||
|
|
Reviewed-by: Roland Knall <rknall@gmail.com>
|
||
|
|
(cherry picked from commit 23850a3342d64b9c9808f14c20bfea6d22b7dc08)
|
||
|
|
Conflicts:
|
||
|
|
epan/dissectors/packet-cms.c
|
||
|
|
Reviewed-on: https://code.wireshark.org/review/34975
|
||
|
|
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
|
||
|
|
---
|
||
|
|
epan/dissectors/asn1/cms/cms.cnf | 1 +
|
||
|
|
.../dissectors/asn1/cms/packet-cms-template.c | 2 +-
|
||
|
|
epan/dissectors/packet-cms.c | 31 ++++++++++---------
|
||
|
|
3 files changed, 18 insertions(+), 16 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/epan/dissectors/asn1/cms/cms.cnf b/epan/dissectors/asn1/cms/cms.cnf
|
||
|
|
index 06ff8d239f..4384fd0ae7 100644
|
||
|
|
--- a/epan/dissectors/asn1/cms/cms.cnf
|
||
|
|
+++ b/epan/dissectors/asn1/cms/cms.cnf
|
||
|
|
@@ -97,6 +97,7 @@ FirmwarePackageLoadError/version fwErrorVersion
|
||
|
|
top_tree = tree;
|
||
|
|
%(DEFAULT_BODY)s
|
||
|
|
content_tvb = NULL;
|
||
|
|
+ object_identifier_id = NULL;
|
||
|
|
top_tree = NULL;
|
||
|
|
|
||
|
|
#.FN_PARS ContentType
|
||
|
|
diff --git a/epan/dissectors/asn1/cms/packet-cms-template.c b/epan/dissectors/asn1/cms/packet-cms-template.c
|
||
|
|
index b03c96421b..199353cd85 100644
|
||
|
|
--- a/epan/dissectors/asn1/cms/packet-cms-template.c
|
||
|
|
+++ b/epan/dissectors/asn1/cms/packet-cms-template.c
|
||
|
|
@@ -43,7 +43,7 @@ static int hf_cms_ci_contentType = -1;
|
||
|
|
static int dissect_cms_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) ; /* XXX kill a compiler warning until asn2wrs stops generating these silly wrappers */
|
||
|
|
|
||
|
|
|
||
|
|
-static const char *object_identifier_id;
|
||
|
|
+static const char *object_identifier_id = NULL;
|
||
|
|
static tvbuff_t *content_tvb = NULL;
|
||
|
|
|
||
|
|
static proto_tree *top_tree=NULL;
|
||
|
|
diff --git a/epan/dissectors/packet-cms.c b/epan/dissectors/packet-cms.c
|
||
|
|
index c62c92be44..592af2dad0 100644
|
||
|
|
--- a/epan/dissectors/packet-cms.c
|
||
|
|
+++ b/epan/dissectors/packet-cms.c
|
||
|
|
@@ -309,7 +309,7 @@ static gint ett_cms_FirmwarePackageMessageDigest = -1;
|
||
|
|
static int dissect_cms_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) ; /* XXX kill a compiler warning until asn2wrs stops generating these silly wrappers */
|
||
|
|
|
||
|
|
|
||
|
|
-static const char *object_identifier_id;
|
||
|
|
+static const char *object_identifier_id = NULL;
|
||
|
|
static tvbuff_t *content_tvb = NULL;
|
||
|
|
|
||
|
|
static proto_tree *top_tree=NULL;
|
||
|
|
@@ -371,7 +371,7 @@ cms_verify_msg_digest(proto_item *pi, tvbuff_t *content, const char *alg, tvbuff
|
||
|
|
|
||
|
|
int
|
||
|
|
dissect_cms_ContentType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
||
|
|
-#line 106 "./asn1/cms/cms.cnf"
|
||
|
|
+#line 107 "./asn1/cms/cms.cnf"
|
||
|
|
const char *name = NULL;
|
||
|
|
|
||
|
|
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &object_identifier_id);
|
||
|
|
@@ -391,7 +391,7 @@ dissect_cms_ContentType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
|
||
|
|
|
||
|
|
static int
|
||
|
|
dissect_cms_T_content(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
||
|
|
-#line 116 "./asn1/cms/cms.cnf"
|
||
|
|
+#line 117 "./asn1/cms/cms.cnf"
|
||
|
|
offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL);
|
||
|
|
|
||
|
|
|
||
|
|
@@ -415,6 +415,7 @@ dissect_cms_ContentInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
|
||
|
|
ContentInfo_sequence, hf_index, ett_cms_ContentInfo);
|
||
|
|
|
||
|
|
content_tvb = NULL;
|
||
|
|
+ object_identifier_id = NULL;
|
||
|
|
top_tree = NULL;
|
||
|
|
|
||
|
|
|
||
|
|
@@ -468,7 +469,7 @@ dissect_cms_DigestAlgorithmIdentifiers(gboolean implicit_tag _U_, tvbuff_t *tvb
|
||
|
|
|
||
|
|
static int
|
||
|
|
dissect_cms_T_eContent(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
||
|
|
-#line 120 "./asn1/cms/cms.cnf"
|
||
|
|
+#line 121 "./asn1/cms/cms.cnf"
|
||
|
|
|
||
|
|
offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_index, &content_tvb);
|
||
|
|
|
||
|
|
@@ -502,7 +503,7 @@ dissect_cms_EncapsulatedContentInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_
|
||
|
|
|
||
|
|
static int
|
||
|
|
dissect_cms_T_attrType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
||
|
|
-#line 150 "./asn1/cms/cms.cnf"
|
||
|
|
+#line 151 "./asn1/cms/cms.cnf"
|
||
|
|
const char *name = NULL;
|
||
|
|
|
||
|
|
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_cms_attrType, &object_identifier_id);
|
||
|
|
@@ -522,7 +523,7 @@ dissect_cms_T_attrType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
|
||
|
|
|
||
|
|
static int
|
||
|
|
dissect_cms_AttributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
||
|
|
-#line 160 "./asn1/cms/cms.cnf"
|
||
|
|
+#line 161 "./asn1/cms/cms.cnf"
|
||
|
|
|
||
|
|
offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL);
|
||
|
|
|
||
|
|
@@ -784,7 +785,7 @@ dissect_cms_T_otherRevInfoFormat(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, i
|
||
|
|
|
||
|
|
static int
|
||
|
|
dissect_cms_T_otherRevInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
||
|
|
-#line 144 "./asn1/cms/cms.cnf"
|
||
|
|
+#line 145 "./asn1/cms/cms.cnf"
|
||
|
|
offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL);
|
||
|
|
|
||
|
|
|
||
|
|
@@ -1121,7 +1122,7 @@ dissect_cms_T_keyAttrId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
|
||
|
|
|
||
|
|
static int
|
||
|
|
dissect_cms_T_keyAttr(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
||
|
|
-#line 139 "./asn1/cms/cms.cnf"
|
||
|
|
+#line 140 "./asn1/cms/cms.cnf"
|
||
|
|
offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL);
|
||
|
|
|
||
|
|
|
||
|
|
@@ -1309,7 +1310,7 @@ dissect_cms_T_oriType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _
|
||
|
|
|
||
|
|
static int
|
||
|
|
dissect_cms_T_oriValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
||
|
|
-#line 133 "./asn1/cms/cms.cnf"
|
||
|
|
+#line 134 "./asn1/cms/cms.cnf"
|
||
|
|
offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL);
|
||
|
|
|
||
|
|
|
||
|
|
@@ -1386,14 +1387,14 @@ dissect_cms_ContentEncryptionAlgorithmIdentifier(gboolean implicit_tag _U_, tvbu
|
||
|
|
|
||
|
|
static int
|
||
|
|
dissect_cms_EncryptedContent(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
||
|
|
-#line 210 "./asn1/cms/cms.cnf"
|
||
|
|
+#line 211 "./asn1/cms/cms.cnf"
|
||
|
|
tvbuff_t *encrypted_tvb;
|
||
|
|
proto_item *item;
|
||
|
|
|
||
|
|
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
|
||
|
|
&encrypted_tvb);
|
||
|
|
|
||
|
|
-#line 215 "./asn1/cms/cms.cnf"
|
||
|
|
+#line 216 "./asn1/cms/cms.cnf"
|
||
|
|
|
||
|
|
item = actx->created_item;
|
||
|
|
|
||
|
|
@@ -1551,7 +1552,7 @@ dissect_cms_AuthenticatedData(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
|
||
|
|
|
||
|
|
static int
|
||
|
|
dissect_cms_MessageDigest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
||
|
|
-#line 164 "./asn1/cms/cms.cnf"
|
||
|
|
+#line 165 "./asn1/cms/cms.cnf"
|
||
|
|
proto_item *pi;
|
||
|
|
int old_offset = offset;
|
||
|
|
|
||
|
|
@@ -1626,7 +1627,7 @@ dissect_cms_Countersignature(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o
|
||
|
|
|
||
|
|
static int
|
||
|
|
dissect_cms_RC2ParameterVersion(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
||
|
|
-#line 200 "./asn1/cms/cms.cnf"
|
||
|
|
+#line 201 "./asn1/cms/cms.cnf"
|
||
|
|
guint32 length = 0;
|
||
|
|
|
||
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
||
|
|
@@ -1694,7 +1695,7 @@ dissect_cms_DigestInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
|
||
|
|
|
||
|
|
static int
|
||
|
|
dissect_cms_T_capability(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
||
|
|
-#line 182 "./asn1/cms/cms.cnf"
|
||
|
|
+#line 183 "./asn1/cms/cms.cnf"
|
||
|
|
const char *name = NULL;
|
||
|
|
|
||
|
|
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_cms_attrType, &object_identifier_id);
|
||
|
|
@@ -1715,7 +1716,7 @@ dissect_cms_T_capability(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
|
||
|
|
|
||
|
|
static int
|
||
|
|
dissect_cms_T_parameters(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
||
|
|
-#line 193 "./asn1/cms/cms.cnf"
|
||
|
|
+#line 194 "./asn1/cms/cms.cnf"
|
||
|
|
|
||
|
|
offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL);
|
||
|
|
|