Skip to content

Commit

Permalink
Address TODO.
Browse files Browse the repository at this point in the history
  • Loading branch information
bbannier committed Sep 25, 2023
1 parent fea4cff commit 6039d76
Showing 1 changed file with 12 additions and 2 deletions.
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 6039d76

Please sign in to comment.