Skip to content

Commit

Permalink
universal-hash: add UhfBackend::blocks_needed_to_align
Browse files Browse the repository at this point in the history
Originally suggested by @str4d here:

#965 (comment)

The use case is ensuring unbuffered processing of the input AEAD message
body when the AAD does not line up with the number of blocks it's
processing in parallel.

This number of blocks can be input from the start of the message body to
finish completely filling the buffer, ensuring all subsequent processing
occurs at the start of the buffer.
  • Loading branch information
tarcieri committed Jul 24, 2022
1 parent 0b2a4a2 commit ba6d24d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions universal-hash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ pub trait UhfBackend: ParBlocksSizeUser {
self.proc_block(block);
}
}

/// Returns the number of blocks that should be passed to `Self::proc_block` before
/// `Self::proc_par_blocks` can be used efficiently. This is always less than
/// `Self::ParBlocksSize`.
fn blocks_needed_to_align(&self) -> usize {
0
}
}

/// Trait for [`UhfBackend`] users.
Expand Down

0 comments on commit ba6d24d

Please sign in to comment.