Skip to content

Commit

Permalink
Remove incorrect compose_len from rrsig (#313)
Browse files Browse the repository at this point in the history
ProtoRrsig is used to produce the data that is signed. According to
RFC 4034, this serialization begins with the first rdata field which is
type_covered, however ProtoRrsig is inserting a length at the beginning. As
such, signatures produced by SortedRecords::sign() are invalid. Fix this by
removing that length from the serialization.
  • Loading branch information
achow101 authored May 10, 2024
1 parent e302148 commit 053dbc1
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/rdata/dnssec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,22 +505,10 @@ impl<Name: ToName> ProtoRrsig<Name> {
self.signer_name.compose_canonical(target)
}

fn compose_len(&self) -> u16 {
Rtype::COMPOSE_LEN
+ SecAlg::COMPOSE_LEN
+ u8::COMPOSE_LEN
+ u32::COMPOSE_LEN
+ Timestamp::COMPOSE_LEN
+ Timestamp::COMPOSE_LEN
+ u16::COMPOSE_LEN
+ self.signer_name.compose_len()
}

fn compose_head<Target: Composer + ?Sized>(
&self,
target: &mut Target,
) -> Result<(), Target::AppendError> {
self.compose_len().compose(target)?;
self.type_covered.compose(target)?;
self.algorithm.compose(target)?;
self.labels.compose(target)?;
Expand Down

0 comments on commit 053dbc1

Please sign in to comment.