Ethereal-dev: Re: [Ethereal-dev] Problem with current version of asn2eth

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Tomas Kukosa <tomas.kukosa@xxxxxxxxxxx>
Date: Tue, 12 Oct 2004 09:45:46 +0200
The attached patch to the asn2eth compiler contains following changes:
- avoids assignemnt to None which is deprecated in Python 2.3
- fix bug when one filed is used both with and without implicit tag

Tom

Guy Harris wrote:

I regenerated the ASN.1-based dissectors with the current version of asn2eth; most of them worked, but packet-cms.c didn't:

packet-cms.c:576: error: `dissect_digestAlgorithm' undeclared here (not in a function)
packet-cms.c:576: error: initializer element is not constant
packet-cms.c:576: error: (near initialization for `SignerInfo_sequence[2].func')
packet-cms.c:576: warning: missing initializer
packet-cms.c:576: warning: (near initialization for `SignerInfo_sequence[2].func')
packet-cms.c:576: error: initializer element is not constant
packet-cms.c:576: error: (near initialization for `SignerInfo_sequence[2]')
packet-cms.c:577: error: initializer element is not constant
packet-cms.c:577: error: (near initialization for `SignerInfo_sequence[3]')
packet-cms.c:578: error: initializer element is not constant
packet-cms.c:578: error: (near initialization for `SignerInfo_sequence[4]')
packet-cms.c:579: error: initializer element is not constant
packet-cms.c:579: error: (near initialization for `SignerInfo_sequence[5]')
packet-cms.c:580: error: initializer element is not constant
packet-cms.c:580: error: (near initialization for `SignerInfo_sequence[6]')
packet-cms.c:581: error: initializer element is not constant
packet-cms.c:581: error: (near initialization for `SignerInfo_sequence[7]')
packet-cms.c:795: error: `dissect_subjectKeyIdentifier' undeclared here (not in a function)
packet-cms.c:795: error: initializer element is not constant
packet-cms.c:795: error: (near initialization for `RecipientKeyIdentifier_sequence[0].func')
packet-cms.c:795: warning: missing initializer
packet-cms.c:795: warning: (near initialization for `RecipientKeyIdentifier_sequence[0].func')
packet-cms.c:795: error: initializer element is not constant
packet-cms.c:795: error: (near initialization for `RecipientKeyIdentifier_sequence[0]')
packet-cms.c:796: error: initializer element is not constant
packet-cms.c:796: error: (near initialization for `RecipientKeyIdentifier_sequence[1]')
packet-cms.c:797: error: initializer element is not constant
packet-cms.c:797: error: (near initialization for `RecipientKeyIdentifier_sequence[2]')
packet-cms.c:798: error: initializer element is not constant
packet-cms.c:798: error: (near initialization for `RecipientKeyIdentifier_sequence[3]') packet-cms.c:1053: error: `dissect_digestAlgorithm' undeclared here (not in a function)
packet-cms.c:1053: error: initializer element is not constant
packet-cms.c:1053: error: (near initialization for `DigestedData_sequence[1].func')
packet-cms.c:1053: warning: missing initializer
packet-cms.c:1053: warning: (near initialization for `DigestedData_sequence[1].func')
packet-cms.c:1053: error: initializer element is not constant
packet-cms.c:1053: error: (near initialization for `DigestedData_sequence[1]')
packet-cms.c:1054: error: initializer element is not constant
packet-cms.c:1054: error: (near initialization for `DigestedData_sequence[2]')
packet-cms.c:1055: error: initializer element is not constant
packet-cms.c:1055: error: (near initialization for `DigestedData_sequence[3]')
packet-cms.c:1056: error: initializer element is not constant
packet-cms.c:1056: error: (near initialization for `DigestedData_sequence[4]')

The problem appears to be that packet-cms.c defines "dissect_digestAlgorithm_impl()", but refers to "dissect_digestAlgorithm()" in some of the data structures.

There are also some warnings generated when asn2eth is run to generate packet-cms.c:

../../tools/asn2eth.py:2422: SyntaxWarning: assignment to None
  (vals, None) = self.get_vals_maxv(proto, tname, ectx)
../../tools/asn2eth.py:2428: SyntaxWarning: assignment to None
  (None, maxv) = self.get_vals_maxv(proto, tname, ectx)
yacc: Generating SLR parsing table...
yacc: 20 shift/reduce conflicts
yacc: 4 reduce/reduce conflicts
ASN.1 to Ethereal dissector compiler
:: UserWarning: The same field names for different types. Explicit field renaming is recommended.
rid
 rid1                 KeyAgreeRecipientIdentifier RecipientEncryptedKey/rid
 rid                  RecipientIdentifier  KeyTransRecipientInfo/rid

:: UserWarning: The same field names for different types. Explicit field renaming is recommended.
signature
 signature1           Signature            ExtendedCertificate/signature
 signature            SignatureValue       SignerInfo/signature

There were some other warnings and errors generated when I re-generated the other ASN.1-based dissectors.

Attachment: asn2eth.py.diff.gz
Description: GNU Zip compressed data