Skip to content

Commit

Permalink
Reinstante inline(always) in chacha20 private functions due to major …
Browse files Browse the repository at this point in the history
…performance regression.
  • Loading branch information
brycx committed Jan 29, 2019
1 parent 41fe2bb commit 5ca7e15
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/hazardous/stream/chacha20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl Drop for InternalState {
}

impl InternalState {
#[inline]
#[inline(always)]
/// Perform a single round on index `x`, `y` and `z` with an
/// `n_bit_rotation` left-rotation.
fn round(&mut self, x: usize, y: usize, z: usize, n_bit_rotation: u32) {
Expand All @@ -151,7 +151,7 @@ impl InternalState {
self.state[y] = self.state[y].rotate_left(n_bit_rotation);
}

#[inline]
#[inline(always)]
/// ChaCha quarter round on a `InternalState`. Indexed by four `usize`s.
fn quarter_round(&mut self, x: usize, y: usize, z: usize, w: usize) {
self.round(x, w, y, 16);
Expand All @@ -160,7 +160,7 @@ impl InternalState {
self.round(z, y, w, 7);
}

#[inline]
#[inline(always)]
/// Performs 8 `quarter_round` function calls to process a inner block.
fn process_inner_block(&mut self) {
// Perform column rounds
Expand All @@ -176,7 +176,7 @@ impl InternalState {
}

#[must_use]
#[inline]
#[inline(always)]
/// Initialize either a ChaCha or HChaCha state with a `secret_key` and
/// `nonce`.
fn init_state(
Expand Down Expand Up @@ -209,7 +209,7 @@ impl InternalState {
}

#[must_use]
#[inline]
#[inline(always)]
/// Process either a ChaCha20 or HChaCha20 block.
fn process_block(
&mut self,
Expand Down Expand Up @@ -248,7 +248,7 @@ impl InternalState {
}

#[must_use]
#[inline]
#[inline(always)]
/// Serialize a keystream block of 16 u32's, into a little-endian byte
/// array.
fn serialize_block(
Expand Down

0 comments on commit 5ca7e15

Please sign in to comment.