From 6039d761023f395a60ba59aa3dff83c0677ad700 Mon Sep 17 00:00:00 2001 From: Benjamin Bannier Date: Mon, 25 Sep 2023 10:48:20 +0200 Subject: [PATCH 1/2] Address TODO. --- analyzer/asn1.spicy | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/analyzer/asn1.spicy b/analyzer/asn1.spicy index 24f35f9..5a3f0b1 100644 --- a/analyzer/asn1.spicy +++ b/analyzer/asn1.spicy @@ -88,12 +88,21 @@ type LengthType = unit { }; type ASN1Tag = unit { +@if SPICY_VERSION >= 10900 + : bitfield(8) { + type_: 0..4 &convert=ASN1Type($$); + constructed: 5 &convert=cast($$); + class: 6..7 &convert=ASN1Class($$); + }; + +@else + # Version before spicy-1.9 do not support lifting + # anonymous bitfields into parent unit. var type_: ASN1Type; var class: ASN1Class; var constructed: bool; - # TODO(bbannier): Use an anonymous bitfield here once zeek/spicy#1533 is fixed. - bits: bitfield(8) { + : bitfield(8) { num: 0..4; constructed: 5; class: 6..7; @@ -102,6 +111,7 @@ type ASN1Tag = unit { self.class = ASN1Class($$.class); self.constructed = cast($$.constructed); } +@endif }; #- ASN.1 bit string ----------------------------------------------------------- From 69c1d9c00ae7bfcf399862d5ffcf4b200cc85fa0 Mon Sep 17 00:00:00 2001 From: Benjamin Bannier Date: Mon, 25 Sep 2023 10:48:51 +0200 Subject: [PATCH 2/2] Add explicit dependency on `asn1.spicy`. --- analyzer/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analyzer/CMakeLists.txt b/analyzer/CMakeLists.txt index 094fe4a..18c03c4 100644 --- a/analyzer/CMakeLists.txt +++ b/analyzer/CMakeLists.txt @@ -1,5 +1,5 @@ spicy_add_analyzer( NAME LDAP PACKAGE_NAME spicy-ldap - SOURCES ldap.spicy ldap.evt ldap_zeek.spicy + SOURCES ldap.spicy ldap.evt ldap_zeek.spicy asn1.spicy SCRIPTS __load__.zeek main.zeek dpd.sig)