Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/topic/bbannier/spicy-1.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
bbannier committed Sep 25, 2023
2 parents fea4cff + 69c1d9c commit 43cd332
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion analyzer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
14 changes: 12 additions & 2 deletions analyzer/asn1.spicy
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>($$);
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;
Expand All @@ -102,6 +111,7 @@ type ASN1Tag = unit {
self.class = ASN1Class($$.class);
self.constructed = cast<bool>($$.constructed);
}
@endif
};

#- ASN.1 bit string -----------------------------------------------------------
Expand Down

0 comments on commit 43cd332

Please sign in to comment.