Adapt allocation to free squaring. (#507)

This commit is contained in:
th4s
2024-06-19 15:50:20 +02:00
committed by sinu.eth
parent 5698d22718
commit bd4ff5f5b0

View File

@@ -128,7 +128,11 @@ where
#[instrument(level = "debug", fields(thread = %self.context.id()), skip_all, err)]
async fn setup(&mut self) -> Result<(), UniversalHashError> {
self.converter.alloc(self.config.max_block_count);
// We need only half the number of `max_block_count` M2As because of the free squaring trick
// and we need one extra A2M conversion in the beginning. Both M2A and A2M, each require a single
// OLE.
let ole_count = self.config.max_block_count / 2 + 1;
self.converter.alloc(ole_count);
Ok(())
}