[dm-devel] [PATCH] dm: switch dm-verity to async hash crypto API

Gilad Ben-Yossef gilad at benyossef.com
Sun Jan 29 07:39:20 UTC 2017


Hi Odrej,

On Thu, Jan 26, 2017 at 1:34 PM, Ondrej Mosnáček
<omosnacek+linux-crypto at gmail.com> wrote:
> Hi Gilad,
>
> 2017-01-24 15:38 GMT+01:00 Gilad Ben-Yossef <gilad at benyossef.com>:
>> -       v->tfm = crypto_alloc_shash(v->alg_name, 0, 0);
>> +       v->tfm = crypto_alloc_ahash(v->alg_name, 0, CRYPTO_ALG_ASYNC);
>
> I believe you should pass zero as the mask here. When flags == 0 and
> mask == CRYPTO_ALG_ASYNC, you are basically saying "I want only algs
> that have flags & CRYPTO_ALG_ASYNC == 0", which means you should only
> get ahash tfms that are always synchronous (see [1]). However, since
> you set a non-NULL callback in verity_hash_init, I don't think this
> was your intention. By setting the mask to zero, you should be able to
> get also an actual async tfm.
>
> Thanks,
> Ondrej
>
> [1] https://lkml.org/lkml/2016/12/13/904

Thank you very much for the review.

I am the first to admit that I find the Crypto API very cryptic (pun
intended)... :-)

I actually followed the example in Documentation/crypto/api-intro.txt.
I see now the example is
not doing what I though it was doing. Thank you for clarifying this. I
will send out a 2nd version.

The thing I find puzzling in this is that I saw a difference in
latency when a async algorythm
provider driver with high priority (3000) was loaded vs. not. Based on
your description I would
expect the performance not to change. I will retest with the change
and will publish the results.

Thanks!
Gilad




-- 
Gilad Ben-Yossef
Chief Coffee Drinker

"If you take a class in large-scale robotics, can you end up in a
situation where the homework eats your dog?"
 -- Jean-Baptiste Queru




More information about the dm-devel mailing list