[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4256916.YlTHG9RRyR@tauon.chronox.de>
Date: Wed, 29 May 2019 16:18:18 +0200
From: Stephan Mueller <smueller@...onox.de>
To: David Gstir <david@...ma-star.at>
Cc: Linux Crypto Mailing List <linux-crypto@...r.kernel.org>,
linux-kernel@...r.kernel.org, Richard Weinberger <richard@....at>
Subject: Re: Can an ahash driver be used through shash API?
Am Mittwoch, 29. Mai 2019, 16:04:47 CEST schrieb David Gstir:
Hi David,
> Hi!
>
> I've done some testing with hardware acceleration of hash functions
> and noticed that, when using the synchronous message digest API (shash),
> some drivers are not usable. In my case the CAAM driver for SHA256.
> Using the asynchronous interface (ahash), everything works as expected.
> Looking at the driver source, the CAAM driver only implements the ahash
> interface.
>
> I'm wondering if there a way to use an ahash driver through the shash
> interface?
Short: no.
>
> I've seen that it does actually work the other way around, since
> crypto_init_shash_ops_async() in crypto/shash.c takes care of translating
> calls from ahash to shash and that's how the *-generic drivers are usable
> through the ahash API.
The crypto_alloc_shash will only identify cipher implementations that were
registered with the CRYPTO_ALG_TYPE_SHASH flag. That flag is set when a cipher
is registered using crypto_register_shash.
Thus, ciphers registered with crypto_register_ahash will not bear this flag
and thus will not be found by the allocation function.
Ciao
Stephan
Powered by blists - more mailing lists