vlm / asn1c

The ASN.1 Compiler
http://lionet.info/asn1c/
BSD 2-Clause "Simplified" License
1.03k stars 550 forks source link

Cannot parse PKIX1Explicit-2009.asn: (token "2"): syntax error, unexpected number #369

Open minfrin opened 4 years ago

minfrin commented 4 years ago

When trying to parse PKIX1Explicit-2009.asn from https://github.com/P1sec/pycrate/blob/master/pycrate_asn1dir/IETF_PKI_RFC5911/PKIX1Explicit-2009.asn, the following error is thrown:

[minfrin@bob asn1]$ ~/src/asn1/asn1c-trunk/asn1c/asn1c -E -F ./tmp/pycrate-master/pycrate_asn1dir/IETF_PKI_RFC5911/PKIX1Explicit-2009.asn ASN.1 grammar parse error near ./tmp/pycrate-master/pycrate_asn1dir/IETF_PKI_RFC5911/PKIX1Explicit-2009.asn:263 (token "2"): syntax error, unexpected number Cannot parse "./tmp/pycrate-master/pycrate_asn1dir/IETF_PKI_RFC5911/PKIX1Explicit-2009.asn"

Is this a known issue?

brchiu commented 4 years ago

You can read from asn1p_y.y, it does not support versionNumber: inside [[ ]]

minfrin commented 4 years ago

As a result of this bug, it is not possible for asn1c to parse the schemas from https://tools.ietf.org/html/rfc5912#section-14.

dkg commented 3 years ago

I'm seeing the same problem here, which makes it difficult to use asn1c to handle anything that depends on RFC 5912 as well.

dkg commented 3 years ago

To be specific, i'm running into this problem while trying to add support for x25519 and Ed25519 (from rfc 8410) to certlint, which depends on asn1c.

dkg commented 3 years ago

@brchiu, do you have any suggestion for how to adapt asn1p_y.y to support versionNumber inside [[ and ]]?

Looks like it has to do with TOK_VBracketLeft and TOK_VBracketRight, those only look usable in conjunction with ComponentTypeLists, and i don't understand yacc/etc well enough to know how to add it.