diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2004-10-29 12:11:42 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2004-10-29 12:11:42 +0000 |
commit | b2160d6d259568a69e411d1e7af689b30a3ea7a7 (patch) | |
tree | 26818d081beb1e352fa062cbeecd1600841aaeb0 /asn1 | |
parent | 076d4710ecb611008ca83c42b422e8ed1745726c (diff) | |
download | wireshark-b2160d6d259568a69e411d1e7af689b30a3ea7a7.tar.gz wireshark-b2160d6d259568a69e411d1e7af689b30a3ea7a7.tar.bz2 wireshark-b2160d6d259568a69e411d1e7af689b30a3ea7a7.zip |
update to cms to use workaround to lack of ANY and reducing the template significantly
svn path=/trunk/; revision=12434
Diffstat (limited to 'asn1')
-rw-r--r-- | asn1/cms/CryptographicMessageSyntax.asn | 16 | ||||
-rw-r--r-- | asn1/cms/cms.cnf | 37 | ||||
-rw-r--r-- | asn1/cms/cms_dummy.cnf | 5 | ||||
-rw-r--r-- | asn1/cms/packet-cms-template.c | 123 | ||||
-rw-r--r-- | asn1/cms/packet-cms-template.h | 3 |
5 files changed, 49 insertions, 135 deletions
diff --git a/asn1/cms/CryptographicMessageSyntax.asn b/asn1/cms/CryptographicMessageSyntax.asn index 08a431fbc5..9753922875 100644 --- a/asn1/cms/CryptographicMessageSyntax.asn +++ b/asn1/cms/CryptographicMessageSyntax.asn @@ -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 diff --git a/asn1/cms/cms.cnf b/asn1/cms/cms.cnf index ddf3b742dd..100c3656fe 100644 --- a/asn1/cms/cms.cnf +++ b/asn1/cms/cms.cnf @@ -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 diff --git a/asn1/cms/cms_dummy.cnf b/asn1/cms/cms_dummy.cnf new file mode 100644 index 0000000000..a672cfcb6a --- /dev/null +++ b/asn1/cms/cms_dummy.cnf @@ -0,0 +1,5 @@ +# this dummy is to handle Any type until compiler knows +# about ANY + +#.IMPORT_TAG +Any BER_CLASS_ANY 0 diff --git a/asn1/cms/packet-cms-template.c b/asn1/cms/packet-cms-template.c index 600b0b004e..86d478fd14 100644 --- a/asn1/cms/packet-cms-template.c +++ b/asn1/cms/packet-cms-template.c @@ -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" }; diff --git a/asn1/cms/packet-cms-template.h b/asn1/cms/packet-cms-template.h index 6fdba19a13..3479f9a55f 100644 --- a/asn1/cms/packet-cms-template.h +++ b/asn1/cms/packet-cms-template.h @@ -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 */ |