Commit a6b40844 authored by Ard Biesheuvel's avatar Ard Biesheuvel
Browse files

crypto/arm64: sha3 - Switch to 'ksimd' scoped guard API



Switch to the more abstract 'scoped_ksimd()' API, which will be modified
in a future patch to transparently allocate a kernel mode FP/SIMD state
buffer on the stack, so that kernel mode FP/SIMD code remains
preemptible in principe, but without the memory overhead that adds 528
bytes to the size of struct task_struct.

Reviewed-by: default avatarEric Biggers <ebiggers@kernel.org>
Reviewed-by: default avatarJonathan Cameron <jonathan.cameron@huawei.com>
Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
parent 931ceb57
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -46,9 +46,8 @@ static int sha3_update(struct shash_desc *desc, const u8 *data,
	do {
		int rem;

		kernel_neon_begin();
		scoped_ksimd()
			rem = sha3_ce_transform(sctx->st, data, blocks, ds);
		kernel_neon_end();
		data += (blocks - rem) * bs;
		blocks = rem;
	} while (blocks);
@@ -73,9 +72,8 @@ static int sha3_finup(struct shash_desc *desc, const u8 *src, unsigned int len,
	memset(block + len, 0, bs - len);
	block[bs - 1] |= 0x80;

	kernel_neon_begin();
	scoped_ksimd()
		sha3_ce_transform(sctx->st, block, 1, ds);
	kernel_neon_end();
	memzero_explicit(block , sizeof(block));

	for (i = 0; i < ds / 8; i++)