Re: [PATCH v4 04/35] crypto: x86/chacha - expose SIMD ChaCha routine as library function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 17, 2019 at 09:09:01PM +0200, Ard Biesheuvel wrote:
> +void chacha_crypt_arch(u32 *state, u8 *dst, const u8 *src, unsigned int bytes,
> +		       int nrounds)
> +{
> +	state = PTR_ALIGN(state, CHACHA_STATE_ALIGN);
> +
> +	if (!static_branch_likely(&chacha_use_simd) || !crypto_simd_usable() ||
> +	    bytes <= CHACHA_BLOCK_SIZE)
> +		return chacha_crypt_generic(state, dst, src, bytes, nrounds);
> +
> +	kernel_fpu_begin();
> +	chacha_dosimd(state, dst, src, bytes, nrounds);
> +	kernel_fpu_end();
> +}
> +EXPORT_SYMBOL(chacha_crypt_arch);

This can process an arbitrary amount of data with preemption disabled.
Shouldn't the library functions limit the amount of data processed per
fpu_begin/fpu_end region?  I see that some of them do...

- Eric



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux