update to cms to use workaround to lack of ANY and reducing the template significantly
svn path=/trunk/; revision=12434
This commit is contained in:
parent
076d4710ec
commit
b2160d6d25
|
@ -11,6 +11,8 @@ BEGIN
|
|||
-- own purposes.
|
||||
|
||||
IMPORTS
|
||||
Any
|
||||
FROM DummyCms { 0 }
|
||||
|
||||
-- Directory Information Framework (X.501)
|
||||
Name
|
||||
|
@ -28,11 +30,10 @@ IMPORTS
|
|||
--
|
||||
|
||||
|
||||
-- Implemented by hand in the template
|
||||
--ContentInfo ::= SEQUENCE {
|
||||
-- contentType ContentType,
|
||||
-- content [0] EXPLICIT ANY DEFINED BY contentType
|
||||
--}
|
||||
ContentInfo ::= SEQUENCE {
|
||||
contentType ContentType,
|
||||
content [0] EXPLICIT Any
|
||||
}
|
||||
|
||||
|
||||
ContentType ::= OBJECT IDENTIFIER
|
||||
|
@ -223,10 +224,9 @@ CMSVersion ::= INTEGER { v0(0), v1(1), v2(2), v3(3), v4(4) }
|
|||
|
||||
UserKeyingMaterial ::= OCTET STRING
|
||||
|
||||
-- Implemented by hand in the template
|
||||
OtherKeyAttribute ::= SEQUENCE {
|
||||
-- keyAttrId OBJECT IDENTIFIER,
|
||||
-- keyAttr ANY DEFINED BY keyAttrId OPTIONAL }
|
||||
keyAttrId OBJECT IDENTIFIER,
|
||||
keyAttr Any OPTIONAL
|
||||
}
|
||||
|
||||
-- CMS Attributes
|
||||
|
|
|
@ -9,11 +9,15 @@ InformationFramework x509if
|
|||
|
||||
#.INCLUDE ../x509af/x509af_exp.cnf
|
||||
#.INCLUDE ../x509if/x509if_exp.cnf
|
||||
#.INCLUDE ./cms_dummy.cnf
|
||||
|
||||
#.EXPORTS
|
||||
ContentInfo
|
||||
EncapsulatedContentInfo
|
||||
SignedData
|
||||
Countersignature
|
||||
IssuerAndSerialNumber
|
||||
OtherKeyAttribute
|
||||
|
||||
#.REGISTER
|
||||
SignedData B "1.2.840.113549.1.7.2" "id-signedData"
|
||||
|
@ -23,8 +27,6 @@ EncryptedData B "1.2.840.113549.1.7.6" "id-encryptedData"
|
|||
AuthenticatedData B "1.2.840.113549.1.9.16.1.2" "id-ct-authenticatedData"
|
||||
|
||||
#.NO_EMIT
|
||||
OtherKeyAttribute
|
||||
EncapsulatedContentInfo
|
||||
|
||||
#.TYPE_RENAME
|
||||
|
||||
|
@ -32,6 +34,37 @@ EncapsulatedContentInfo
|
|||
SignerInfo/signature signatureValue
|
||||
RecipientEncryptedKey/rid rekRid
|
||||
|
||||
#.FN_BODY ContentInfo/contentType
|
||||
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
|
||||
hf_cms_ci_contentType, object_identifier_id);
|
||||
|
||||
#.FN_BODY ContentInfo/content
|
||||
offset=call_ber_oid_callback(object_identifier_id, tvb, offset, pinfo, tree);
|
||||
|
||||
#.FN_BODY EncapsulatedContentInfo/eContentType
|
||||
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
|
||||
hf_cms_ci_contentType, object_identifier_id);
|
||||
|
||||
#.FN_BODY EncapsulatedContentInfo/eContent
|
||||
guint8 class;
|
||||
gboolean pc, ind;
|
||||
guint32 tag, len;
|
||||
int pdu_offset = offset;
|
||||
|
||||
/* XXX Do we care about printing out the octet string? */
|
||||
offset = dissect_cms_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cms_eContent);
|
||||
|
||||
pdu_offset = get_ber_identifier(tvb, pdu_offset, &class, &pc, &tag);
|
||||
pdu_offset = get_ber_length(tvb, pdu_offset, &len, &ind);
|
||||
pdu_offset = call_ber_oid_callback(object_identifier_id, tvb, pdu_offset, pinfo, tree);
|
||||
|
||||
#.FN_BODY OtherKeyAttribute/keyAttrId
|
||||
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
|
||||
hf_cms_ci_contentType, object_identifier_id);
|
||||
|
||||
#.FN_BODY OtherKeyAttribute/keyAttr
|
||||
offset=call_ber_oid_callback(object_identifier_id, tvb, offset, pinfo, tree);
|
||||
|
||||
#.END
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# this dummy is to handle Any type until compiler knows
|
||||
# about ANY
|
||||
|
||||
#.IMPORT_TAG
|
||||
Any BER_CLASS_ANY 0
|
|
@ -44,128 +44,17 @@
|
|||
|
||||
/* Initialize the protocol and registered fields */
|
||||
int proto_cms = -1;
|
||||
static int hf_cms_keyAttr_id = -1;
|
||||
static int hf_cms_ci_contentType = -1;
|
||||
static int hf_cms_eci_eContentType = -1;
|
||||
#include "packet-cms-hf.c"
|
||||
|
||||
/* Initialize the subtree pointers */
|
||||
static gint ett_cms_ContentInfo = -1;
|
||||
#include "packet-cms-ett.c"
|
||||
|
||||
static int dissect_cms_OtherKeyAttribute(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index);
|
||||
|
||||
static char object_identifier_id[64]; /*64 chars should be long enough? */
|
||||
|
||||
#include "packet-cms-fn.c"
|
||||
|
||||
|
||||
static char keyAttr_id[64]; /*64 chars should be long enough? */
|
||||
static int
|
||||
dissect_keyAttrId(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
|
||||
{
|
||||
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
|
||||
hf_cms_keyAttr_id, keyAttr_id);
|
||||
return offset;
|
||||
}
|
||||
|
||||
static int
|
||||
dissect_keyAttr_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
|
||||
{
|
||||
offset=call_ber_oid_callback(keyAttr_id, tvb, offset, pinfo, tree);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
static const ber_sequence OtherKeyAttribute_sequence[] = {
|
||||
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_keyAttrId },
|
||||
{ BER_CLASS_ANY, 0, 0, dissect_keyAttr_type },
|
||||
{ 0, 0, 0, NULL }
|
||||
};
|
||||
|
||||
static int
|
||||
dissect_cms_OtherKeyAttribute(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
|
||||
OtherKeyAttribute_sequence, hf_index, ett_cms_OtherKeyAttribute);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ContentInfo can not yet be handled by the compiler */
|
||||
static char ci_contentType[64]; /*64 chars should be long enough? */
|
||||
static int
|
||||
dissect_hf_cms_contentType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
|
||||
{
|
||||
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
|
||||
hf_cms_ci_contentType, ci_contentType);
|
||||
return offset;
|
||||
}
|
||||
static int
|
||||
dissect_hf_cms_contentType_content(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
|
||||
{
|
||||
offset=call_ber_oid_callback(ci_contentType, tvb, offset, pinfo, tree);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
static const ber_sequence ContentInfo_sequence[] = {
|
||||
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_hf_cms_contentType },
|
||||
{ BER_CLASS_ANY, 0, 0, dissect_hf_cms_contentType_content },
|
||||
{ 0, 0, 0, NULL }
|
||||
};
|
||||
|
||||
int
|
||||
dissect_cms_ContentInfo(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index) {
|
||||
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
|
||||
ContentInfo_sequence, hf_index, ett_cms_ContentInfo);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
/* Do the same thing for EncapsulatedContentInfo */
|
||||
static char eci_eContentType[64]; /*64 chars should be long enough? */
|
||||
static int
|
||||
dissect_hf_cms_eContentType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
|
||||
{
|
||||
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
|
||||
hf_cms_eci_eContentType, eci_eContentType);
|
||||
return offset;
|
||||
}
|
||||
static int
|
||||
dissect_hf_cms_eContentType_content(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
|
||||
{
|
||||
guint8 class;
|
||||
gboolean pc, ind;
|
||||
guint32 tag, len;
|
||||
int pdu_offset = offset;
|
||||
|
||||
/* XXX Do we care about printing out the octet string? */
|
||||
offset = dissect_cms_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cms_eContent);
|
||||
|
||||
pdu_offset = get_ber_identifier(tvb, pdu_offset, &class, &pc, &tag);
|
||||
pdu_offset = get_ber_length(tvb, pdu_offset, &len, &ind);
|
||||
pdu_offset = call_ber_oid_callback(eci_eContentType, tvb, pdu_offset, pinfo, tree);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
static const ber_sequence EncapsulatedContentInfo_sequence[] = {
|
||||
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_hf_cms_eContentType },
|
||||
{ BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_hf_cms_eContentType_content },
|
||||
{ 0, 0, 0, NULL }
|
||||
};
|
||||
|
||||
int
|
||||
dissect_cms_EncapsulatedContentInfo(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index) {
|
||||
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
|
||||
EncapsulatedContentInfo_sequence, hf_index, ett_cms_EncapsulatedContentInfo);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
/*--- proto_register_cms ----------------------------------------------*/
|
||||
void proto_register_cms(void) {
|
||||
|
||||
|
@ -175,21 +64,11 @@ void proto_register_cms(void) {
|
|||
{ "contentType", "cms.contentInfo.contentType",
|
||||
FT_STRING, BASE_NONE, NULL, 0,
|
||||
"ContentType", HFILL }},
|
||||
{ &hf_cms_eci_eContentType,
|
||||
{ "eContentType", "cms.encapContentInfo.eContentType",
|
||||
FT_STRING, BASE_NONE, NULL, 0,
|
||||
"EncapsulatedContentType", HFILL }},
|
||||
{ &hf_cms_keyAttr_id,
|
||||
{ "keyAttr_id", "cms.keyAttr_id",
|
||||
FT_STRING, BASE_NONE, NULL, 0,
|
||||
"keyAttr_id", HFILL }},
|
||||
#include "packet-cms-hfarr.c"
|
||||
};
|
||||
|
||||
/* List of subtrees */
|
||||
static gint *ett[] = {
|
||||
&ett_cms_ContentInfo,
|
||||
&ett_cms_EncapsulatedContentInfo,
|
||||
#include "packet-cms-ettarr.c"
|
||||
};
|
||||
|
||||
|
|
|
@ -25,9 +25,6 @@
|
|||
#ifndef PACKET_CMS_H
|
||||
#define PACKET_CMS_H
|
||||
|
||||
int dissect_cms_ContentInfo(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index);
|
||||
int dissect_cms_EncapsulatedContentInfo(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index);
|
||||
|
||||
#include "packet-cms-exp.h"
|
||||
|
||||
#endif /* PACKET_CMS_H */
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
/* packet-cms.c
|
||||
* Routines for RFC2630 Cryptographic Message Syntax packet dissection
|
||||
*
|
||||
* $Id: packet-cms-template.c 12394 2004-10-26 13:54:09Z sahlberg $
|
||||
* $Id: packet-cms-template.c 12426 2004-10-28 22:06:55Z gerald $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -51,9 +51,7 @@
|
|||
|
||||
/* Initialize the protocol and registered fields */
|
||||
int proto_cms = -1;
|
||||
static int hf_cms_keyAttr_id = -1;
|
||||
static int hf_cms_ci_contentType = -1;
|
||||
static int hf_cms_eci_eContentType = -1;
|
||||
|
||||
/*--- Included file: packet-cms-hf.c ---*/
|
||||
|
||||
|
@ -62,6 +60,8 @@ static int hf_cms_EnvelopedData_PDU = -1; /* EnvelopedData */
|
|||
static int hf_cms_DigestedData_PDU = -1; /* DigestedData */
|
||||
static int hf_cms_EncryptedData_PDU = -1; /* EncryptedData */
|
||||
static int hf_cms_AuthenticatedData_PDU = -1; /* AuthenticatedData */
|
||||
static int hf_cms_contentType = -1; /* T_contentType */
|
||||
static int hf_cms_content = -1; /* T_content */
|
||||
static int hf_cms_version = -1; /* CMSVersion */
|
||||
static int hf_cms_digestAlgorithms = -1; /* DigestAlgorithmIdentifiers */
|
||||
static int hf_cms_encapContentInfo = -1; /* EncapsulatedContentInfo */
|
||||
|
@ -70,8 +70,8 @@ static int hf_cms_crls = -1; /* CertificateRevocationLists
|
|||
static int hf_cms_signerInfos = -1; /* SignerInfos */
|
||||
static int hf_cms_DigestAlgorithmIdentifiers_item = -1; /* DigestAlgorithmIdentifier */
|
||||
static int hf_cms_SignerInfos_item = -1; /* SignerInfo */
|
||||
static int hf_cms_eContentType = -1; /* ContentType */
|
||||
static int hf_cms_eContent = -1; /* OCTET_STRING */
|
||||
static int hf_cms_eContentType = -1; /* T_eContentType */
|
||||
static int hf_cms_eContent = -1; /* T_eContent */
|
||||
static int hf_cms_sid = -1; /* SignerIdentifier */
|
||||
static int hf_cms_digestAlgorithm = -1; /* DigestAlgorithmIdentifier */
|
||||
static int hf_cms_signedAttrs = -1; /* SignedAttributes */
|
||||
|
@ -89,7 +89,7 @@ static int hf_cms_encryptedContentInfo = -1; /* EncryptedContentInfo */
|
|||
static int hf_cms_unprotectedAttrs = -1; /* UnprotectedAttributes */
|
||||
static int hf_cms_certs = -1; /* CertificateSet */
|
||||
static int hf_cms_RecipientInfos_item = -1; /* RecipientInfo */
|
||||
static int hf_cms_contentType = -1; /* ContentType */
|
||||
static int hf_cms_contentType1 = -1; /* ContentType */
|
||||
static int hf_cms_contentEncryptionAlgorithm = -1; /* ContentEncryptionAlgorithmIdentifier */
|
||||
static int hf_cms_encryptedContent = -1; /* EncryptedContent */
|
||||
static int hf_cms_UnprotectedAttributes_item = -1; /* Attribute */
|
||||
|
@ -126,6 +126,8 @@ static int hf_cms_attrCert = -1; /* AttributeCertificate */
|
|||
static int hf_cms_CertificateSet_item = -1; /* CertificateChoices */
|
||||
static int hf_cms_issuer = -1; /* Name */
|
||||
static int hf_cms_serialNumber = -1; /* CertificateSerialNumber */
|
||||
static int hf_cms_keyAttrId = -1; /* T_keyAttrId */
|
||||
static int hf_cms_keyAttr = -1; /* T_keyAttr */
|
||||
static int hf_cms_extendedCertificateInfo = -1; /* ExtendedCertificateInfo */
|
||||
static int hf_cms_signature = -1; /* Signature */
|
||||
static int hf_cms_attributes = -1; /* UnauthAttributes */
|
||||
|
@ -134,10 +136,10 @@ static int hf_cms_attributes = -1; /* UnauthAttributes */
|
|||
|
||||
|
||||
/* Initialize the subtree pointers */
|
||||
static gint ett_cms_ContentInfo = -1;
|
||||
|
||||
/*--- Included file: packet-cms-ett.c ---*/
|
||||
|
||||
static gint ett_cms_ContentInfo = -1;
|
||||
static gint ett_cms_SignedData = -1;
|
||||
static gint ett_cms_DigestAlgorithmIdentifiers = -1;
|
||||
static gint ett_cms_SignerInfos = -1;
|
||||
|
@ -180,8 +182,7 @@ static gint ett_cms_ExtendedCertificateInfo = -1;
|
|||
/*--- End of included file: packet-cms-ett.c ---*/
|
||||
|
||||
|
||||
static int dissect_cms_OtherKeyAttribute(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index);
|
||||
|
||||
static char object_identifier_id[64]; /*64 chars should be long enough? */
|
||||
|
||||
|
||||
/*--- Included file: packet-cms-fn.c ---*/
|
||||
|
@ -215,11 +216,47 @@ dissect_cms_ContentType(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, pa
|
|||
|
||||
return offset;
|
||||
}
|
||||
static int dissect_eContentType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
|
||||
return dissect_cms_ContentType(FALSE, tvb, offset, pinfo, tree, hf_cms_eContentType);
|
||||
static int dissect_contentType1(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
|
||||
return dissect_cms_ContentType(FALSE, tvb, offset, pinfo, tree, hf_cms_contentType1);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
dissect_cms_T_contentType(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
|
||||
hf_cms_ci_contentType, object_identifier_id);
|
||||
|
||||
|
||||
return offset;
|
||||
}
|
||||
static int dissect_contentType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
|
||||
return dissect_cms_ContentType(FALSE, tvb, offset, pinfo, tree, hf_cms_contentType);
|
||||
return dissect_cms_T_contentType(FALSE, tvb, offset, pinfo, tree, hf_cms_contentType);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
dissect_cms_T_content(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
offset=call_ber_oid_callback(object_identifier_id, tvb, offset, pinfo, tree);
|
||||
|
||||
|
||||
return offset;
|
||||
}
|
||||
static int dissect_content(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
|
||||
return dissect_cms_T_content(FALSE, tvb, offset, pinfo, tree, hf_cms_content);
|
||||
}
|
||||
|
||||
static const ber_sequence ContentInfo_sequence[] = {
|
||||
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_contentType },
|
||||
{ BER_CLASS_CON, 0, 0, dissect_content },
|
||||
{ 0, 0, 0, NULL }
|
||||
};
|
||||
|
||||
int
|
||||
dissect_cms_ContentInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
|
||||
ContentInfo_sequence, hf_index, ett_cms_ContentInfo);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
|
@ -277,19 +314,52 @@ static int dissect_digestAlgorithms(packet_info *pinfo, proto_tree *tree, tvbuff
|
|||
|
||||
|
||||
static int
|
||||
dissect_cms_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
|
||||
NULL);
|
||||
dissect_cms_T_eContentType(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
|
||||
hf_cms_ci_contentType, object_identifier_id);
|
||||
|
||||
|
||||
return offset;
|
||||
}
|
||||
static int dissect_eContentType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
|
||||
return dissect_cms_T_eContentType(FALSE, tvb, offset, pinfo, tree, hf_cms_eContentType);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
dissect_cms_T_eContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
guint8 class;
|
||||
gboolean pc, ind;
|
||||
guint32 tag, len;
|
||||
int pdu_offset = offset;
|
||||
|
||||
/* XXX Do we care about printing out the octet string? */
|
||||
offset = dissect_cms_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cms_eContent);
|
||||
|
||||
pdu_offset = get_ber_identifier(tvb, pdu_offset, &class, &pc, &tag);
|
||||
pdu_offset = get_ber_length(tvb, pdu_offset, &len, &ind);
|
||||
pdu_offset = call_ber_oid_callback(object_identifier_id, tvb, pdu_offset, pinfo, tree);
|
||||
|
||||
|
||||
return offset;
|
||||
}
|
||||
static int dissect_eContent(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
|
||||
return dissect_cms_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cms_eContent);
|
||||
}
|
||||
static int dissect_keyIdentifier(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
|
||||
return dissect_cms_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cms_keyIdentifier);
|
||||
return dissect_cms_T_eContent(FALSE, tvb, offset, pinfo, tree, hf_cms_eContent);
|
||||
}
|
||||
|
||||
static const ber_sequence EncapsulatedContentInfo_sequence[] = {
|
||||
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_eContentType },
|
||||
{ BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_eContent },
|
||||
{ 0, 0, 0, NULL }
|
||||
};
|
||||
|
||||
int
|
||||
dissect_cms_EncapsulatedContentInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
|
||||
EncapsulatedContentInfo_sequence, hf_index, ett_cms_EncapsulatedContentInfo);
|
||||
|
||||
return offset;
|
||||
}
|
||||
static int dissect_encapContentInfo(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
|
||||
return dissect_cms_EncapsulatedContentInfo(FALSE, tvb, offset, pinfo, tree, hf_cms_encapContentInfo);
|
||||
}
|
||||
|
@ -786,6 +856,44 @@ static int dissect_date(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int
|
|||
return dissect_cms_GeneralizedTime(FALSE, tvb, offset, pinfo, tree, hf_cms_date);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
dissect_cms_T_keyAttrId(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
|
||||
hf_cms_ci_contentType, object_identifier_id);
|
||||
|
||||
|
||||
return offset;
|
||||
}
|
||||
static int dissect_keyAttrId(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
|
||||
return dissect_cms_T_keyAttrId(FALSE, tvb, offset, pinfo, tree, hf_cms_keyAttrId);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
dissect_cms_T_keyAttr(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
offset=call_ber_oid_callback(object_identifier_id, tvb, offset, pinfo, tree);
|
||||
|
||||
|
||||
return offset;
|
||||
}
|
||||
static int dissect_keyAttr(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
|
||||
return dissect_cms_T_keyAttr(FALSE, tvb, offset, pinfo, tree, hf_cms_keyAttr);
|
||||
}
|
||||
|
||||
static const ber_sequence OtherKeyAttribute_sequence[] = {
|
||||
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_keyAttrId },
|
||||
{ BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_keyAttr },
|
||||
{ 0, 0, 0, NULL }
|
||||
};
|
||||
|
||||
int
|
||||
dissect_cms_OtherKeyAttribute(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
|
||||
OtherKeyAttribute_sequence, hf_index, ett_cms_OtherKeyAttribute);
|
||||
|
||||
return offset;
|
||||
}
|
||||
static int dissect_other(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
|
||||
return dissect_cms_OtherKeyAttribute(FALSE, tvb, offset, pinfo, tree, hf_cms_other);
|
||||
}
|
||||
|
@ -884,6 +992,18 @@ static int dissect_kari_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb
|
|||
return dissect_cms_KeyAgreeRecipientInfo(TRUE, tvb, offset, pinfo, tree, hf_cms_kari);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
dissect_cms_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
|
||||
NULL);
|
||||
|
||||
return offset;
|
||||
}
|
||||
static int dissect_keyIdentifier(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
|
||||
return dissect_cms_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cms_keyIdentifier);
|
||||
}
|
||||
|
||||
static const ber_sequence KEKIdentifier_sequence[] = {
|
||||
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_keyIdentifier },
|
||||
{ BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_date },
|
||||
|
@ -986,7 +1106,7 @@ static int dissect_encryptedContent_impl(packet_info *pinfo, proto_tree *tree, t
|
|||
}
|
||||
|
||||
static const ber_sequence EncryptedContentInfo_sequence[] = {
|
||||
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_contentType },
|
||||
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_contentType1 },
|
||||
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_contentEncryptionAlgorithm },
|
||||
{ BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_encryptedContent_impl },
|
||||
{ 0, 0, 0, NULL }
|
||||
|
@ -1168,113 +1288,6 @@ static void dissect_AuthenticatedData_PDU(tvbuff_t *tvb, packet_info *pinfo, pro
|
|||
|
||||
|
||||
|
||||
static char keyAttr_id[64]; /*64 chars should be long enough? */
|
||||
static int
|
||||
dissect_keyAttrId(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
|
||||
{
|
||||
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
|
||||
hf_cms_keyAttr_id, keyAttr_id);
|
||||
return offset;
|
||||
}
|
||||
|
||||
static int
|
||||
dissect_keyAttr_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
|
||||
{
|
||||
offset=call_ber_oid_callback(keyAttr_id, tvb, offset, pinfo, tree);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
static const ber_sequence OtherKeyAttribute_sequence[] = {
|
||||
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_keyAttrId },
|
||||
{ BER_CLASS_ANY, 0, 0, dissect_keyAttr_type },
|
||||
{ 0, 0, 0, NULL }
|
||||
};
|
||||
|
||||
static int
|
||||
dissect_cms_OtherKeyAttribute(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
|
||||
OtherKeyAttribute_sequence, hf_index, ett_cms_OtherKeyAttribute);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ContentInfo can not yet be handled by the compiler */
|
||||
static char ci_contentType[64]; /*64 chars should be long enough? */
|
||||
static int
|
||||
dissect_hf_cms_contentType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
|
||||
{
|
||||
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
|
||||
hf_cms_ci_contentType, ci_contentType);
|
||||
return offset;
|
||||
}
|
||||
static int
|
||||
dissect_hf_cms_contentType_content(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
|
||||
{
|
||||
offset=call_ber_oid_callback(ci_contentType, tvb, offset, pinfo, tree);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
static const ber_sequence ContentInfo_sequence[] = {
|
||||
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_hf_cms_contentType },
|
||||
{ BER_CLASS_ANY, 0, 0, dissect_hf_cms_contentType_content },
|
||||
{ 0, 0, 0, NULL }
|
||||
};
|
||||
|
||||
int
|
||||
dissect_cms_ContentInfo(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index) {
|
||||
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
|
||||
ContentInfo_sequence, hf_index, ett_cms_ContentInfo);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
/* Do the same thing for EncapsulatedContentInfo */
|
||||
static char eci_eContentType[64]; /*64 chars should be long enough? */
|
||||
static int
|
||||
dissect_hf_cms_eContentType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
|
||||
{
|
||||
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
|
||||
hf_cms_eci_eContentType, eci_eContentType);
|
||||
return offset;
|
||||
}
|
||||
static int
|
||||
dissect_hf_cms_eContentType_content(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
|
||||
{
|
||||
guint8 class;
|
||||
gboolean pc, ind;
|
||||
guint32 tag, len;
|
||||
int pdu_offset = offset;
|
||||
|
||||
/* XXX Do we care about printing out the octet string? */
|
||||
offset = dissect_cms_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cms_eContent);
|
||||
|
||||
pdu_offset = get_ber_identifier(tvb, pdu_offset, &class, &pc, &tag);
|
||||
pdu_offset = get_ber_length(tvb, pdu_offset, &len, &ind);
|
||||
pdu_offset = call_ber_oid_callback(eci_eContentType, tvb, pdu_offset, pinfo, tree);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
static const ber_sequence EncapsulatedContentInfo_sequence[] = {
|
||||
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_hf_cms_eContentType },
|
||||
{ BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_hf_cms_eContentType_content },
|
||||
{ 0, 0, 0, NULL }
|
||||
};
|
||||
|
||||
int
|
||||
dissect_cms_EncapsulatedContentInfo(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index) {
|
||||
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
|
||||
EncapsulatedContentInfo_sequence, hf_index, ett_cms_EncapsulatedContentInfo);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
/*--- proto_register_cms ----------------------------------------------*/
|
||||
void proto_register_cms(void) {
|
||||
|
||||
|
@ -1284,14 +1297,6 @@ void proto_register_cms(void) {
|
|||
{ "contentType", "cms.contentInfo.contentType",
|
||||
FT_STRING, BASE_NONE, NULL, 0,
|
||||
"ContentType", HFILL }},
|
||||
{ &hf_cms_eci_eContentType,
|
||||
{ "eContentType", "cms.encapContentInfo.eContentType",
|
||||
FT_STRING, BASE_NONE, NULL, 0,
|
||||
"EncapsulatedContentType", HFILL }},
|
||||
{ &hf_cms_keyAttr_id,
|
||||
{ "keyAttr_id", "cms.keyAttr_id",
|
||||
FT_STRING, BASE_NONE, NULL, 0,
|
||||
"keyAttr_id", HFILL }},
|
||||
|
||||
/*--- Included file: packet-cms-hfarr.c ---*/
|
||||
|
||||
|
@ -1315,6 +1320,14 @@ void proto_register_cms(void) {
|
|||
{ "AuthenticatedData", "cms.AuthenticatedData",
|
||||
FT_NONE, BASE_NONE, NULL, 0,
|
||||
"AuthenticatedData", HFILL }},
|
||||
{ &hf_cms_contentType,
|
||||
{ "contentType", "cms.contentType",
|
||||
FT_STRING, BASE_NONE, NULL, 0,
|
||||
"ContentInfo/contentType", HFILL }},
|
||||
{ &hf_cms_content,
|
||||
{ "content", "cms.content",
|
||||
FT_NONE, BASE_NONE, NULL, 0,
|
||||
"ContentInfo/content", HFILL }},
|
||||
{ &hf_cms_version,
|
||||
{ "version", "cms.version",
|
||||
FT_INT32, BASE_DEC, VALS(CMSVersion_vals), 0,
|
||||
|
@ -1423,7 +1436,7 @@ void proto_register_cms(void) {
|
|||
{ "Item", "cms.RecipientInfos_item",
|
||||
FT_UINT32, BASE_DEC, VALS(RecipientInfo_vals), 0,
|
||||
"RecipientInfos/_item", HFILL }},
|
||||
{ &hf_cms_contentType,
|
||||
{ &hf_cms_contentType1,
|
||||
{ "contentType", "cms.contentType",
|
||||
FT_STRING, BASE_NONE, NULL, 0,
|
||||
"EncryptedContentInfo/contentType", HFILL }},
|
||||
|
@ -1571,6 +1584,14 @@ void proto_register_cms(void) {
|
|||
{ "serialNumber", "cms.serialNumber",
|
||||
FT_INT32, BASE_DEC, NULL, 0,
|
||||
"IssuerAndSerialNumber/serialNumber", HFILL }},
|
||||
{ &hf_cms_keyAttrId,
|
||||
{ "keyAttrId", "cms.keyAttrId",
|
||||
FT_STRING, BASE_NONE, NULL, 0,
|
||||
"OtherKeyAttribute/keyAttrId", HFILL }},
|
||||
{ &hf_cms_keyAttr,
|
||||
{ "keyAttr", "cms.keyAttr",
|
||||
FT_NONE, BASE_NONE, NULL, 0,
|
||||
"OtherKeyAttribute/keyAttr", HFILL }},
|
||||
{ &hf_cms_extendedCertificateInfo,
|
||||
{ "extendedCertificateInfo", "cms.extendedCertificateInfo",
|
||||
FT_NONE, BASE_NONE, NULL, 0,
|
||||
|
@ -1590,11 +1611,10 @@ void proto_register_cms(void) {
|
|||
|
||||
/* List of subtrees */
|
||||
static gint *ett[] = {
|
||||
&ett_cms_ContentInfo,
|
||||
&ett_cms_EncapsulatedContentInfo,
|
||||
|
||||
/*--- Included file: packet-cms-ettarr.c ---*/
|
||||
|
||||
&ett_cms_ContentInfo,
|
||||
&ett_cms_SignedData,
|
||||
&ett_cms_DigestAlgorithmIdentifiers,
|
||||
&ett_cms_SignerInfos,
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
/* packet-cms.h
|
||||
* Routines for RFC2630 Cryptographic Message Syntax packet dissection
|
||||
*
|
||||
* $Id: packet-cms-template.h 12203 2004-10-05 09:18:55Z guy $
|
||||
* $Id: packet-cms-template.h 12426 2004-10-28 22:06:55Z gerald $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -32,14 +32,14 @@
|
|||
#ifndef PACKET_CMS_H
|
||||
#define PACKET_CMS_H
|
||||
|
||||
int dissect_cms_ContentInfo(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index);
|
||||
int dissect_cms_EncapsulatedContentInfo(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index);
|
||||
|
||||
|
||||
/*--- Included file: packet-cms-exp.h ---*/
|
||||
|
||||
int dissect_cms_ContentInfo(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index);
|
||||
int dissect_cms_SignedData(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index);
|
||||
int dissect_cms_EncapsulatedContentInfo(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index);
|
||||
int dissect_cms_IssuerAndSerialNumber(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index);
|
||||
int dissect_cms_OtherKeyAttribute(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index);
|
||||
int dissect_cms_Countersignature(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index);
|
||||
|
||||
/*--- End of included file: packet-cms-exp.h ---*/
|
||||
|
|
Loading…
Reference in New Issue