[PATCH 03/26] lib/crypto: sha1: Add SHA-1 library functions

Elliott, Robert (Servers) elliott at hpe.com
Sun Jul 13 08:05:16 PDT 2025



> -----Original Message-----
> From: Eric Biggers <ebiggers at kernel.org>
> Sent: Saturday, July 12, 2025 6:23 PM
> Subject: [PATCH 03/26] lib/crypto: sha1: Add SHA-1 library functions
...
> +static void __maybe_unused sha1_blocks_generic(struct sha1_block_state
> *state,
> +					       const u8 *data, size_t nblocks)
> +{
> +	u32 workspace[SHA1_WORKSPACE_WORDS];
> +
> +	do {
> +		sha1_transform(state->h, data, workspace);
> +		data += SHA1_BLOCK_SIZE;
> +	} while (--nblocks);
> +
> +	memzero_explicit(workspace, sizeof(workspace));
> +}

That assumes the caller will never pass nblocks of 0... should that be
checked first?




More information about the linux-arm-kernel mailing list