Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6233627 authored by David Sterba's avatar David Sterba Committed by Alistair Delva
Browse files

UPSTREAM: crypto: blake2b - open code set last block helper



The helper is trival and called once, inlining makes things simpler.
There's a comment to tie it back to the idea behind the code.

Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>

(cherry picked from commit a2e4bdce0f6e69c6cf9e460c4fe158bcc0db351f)
Bug: 178411248
Change-Id: Iba1276dfcdb29240206f66bf98902d0e587a590f
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
parent 00e77739
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -65,11 +65,6 @@ static const u8 blake2b_sigma[12][16] = {
	{ 14, 10,  4,  8,  9, 15, 13,  6,  1, 12,  0,  2, 11,  7,  5,  3 }
};

static void blake2b_set_lastblock(struct blake2b_state *S)
{
	S->f[0] = (u64)-1;
}

static void blake2b_increment_counter(struct blake2b_state *S, const u64 inc)
{
	S->t[0] += inc;
@@ -231,7 +226,8 @@ static int blake2b_final(struct shash_desc *desc, u8 *out)
	size_t i;

	blake2b_increment_counter(state, state->buflen);
	blake2b_set_lastblock(state);
	/* Set last block */
	state->f[0] = (u64)-1;
	/* Padding */
	memset(state->buf + state->buflen, 0, BLAKE2B_BLOCKBYTES - state->buflen);
	blake2b_compress(state, state->buf);