Re: [PATCH v4 06/35] crypto: arm64/chacha - expose arm64 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:03PM +0200, Ard Biesheuvel wrote:
> +void hchacha_block_arch(const u32 *state, u32 *stream, int nrounds)
> +{
> +	if (!static_branch_likely(&have_neon) || !crypto_simd_usable()) {
> +		hchacha_block_generic(state, stream, nrounds);
> +	} else {
> +		kernel_neon_begin();
> +		hchacha_block_neon(state, stream, nrounds);
> +		kernel_neon_end();
> +	}
> +}
> +EXPORT_SYMBOL(hchacha_block_arch);
[...]

> @@ -110,7 +145,7 @@ static int xchacha_neon(struct skcipher_request *req)
>  
>  	chacha_init_generic(state, ctx->key, req->iv);
>  
> -	if (crypto_simd_usable()) {
> +	if (static_branch_likely(&have_neon) && crypto_simd_usable()) {
>  		kernel_neon_begin();
>  		hchacha_block_neon(state, subctx.key, ctx->nrounds);
>  		kernel_neon_end();

Shouldn't xchacha_neon() call hchacha_block_arch(), rather than implement the
same logic itself?

- Eric



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

  Powered by Linux