On Thu, Sep 26, 2019 at 9:01 PM Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> wrote: > > So there is really no async overhead in the crypto API AFAICS if > you're always doing sync. What you see as overheads are probably > the result of having to support multiple underlying algorithms > (not just accelerations which can indeed be handled without > indirection at least for CPU-based ones). Fair enough, and sounds good. The biggest overhead is that indirection for the state data, and the fact that the code indirect calls the actual function. If that could be avoided by just statically saying crypto_xyz_encrypt() (with the xyz being the crypto algorithm you want) and having the state be explicit, then yes, that would remove most of the overhead. It would still leave setting the callback fields etc that are unnecessary for the synchronous case and that I think could be done differently, but that's probably just a couple of stores, so not particularly noticeable. Linus