Re: Why the auxiliary cipher in gss_krb5_crypto.c?
From: David Howells
Date: Tue Dec 08 2020 - 09:16:21 EST
Ard Biesheuvel <ardb@xxxxxxxxxx> wrote:
> Apparently, it is permitted for gss_krb5_cts_crypt() to do a
> kmalloc(GFP_NOFS) in the context from where gss_krb5_aes_encrypt() is
> being invoked, and so I don't see why it wouldn't be possible to
> simply kmalloc() a scatterlist[] of the appropriate size, populate it
> with all the pages, bufs and whatever else gets passed into the
> skcipher, and pass it into the skcipher in one go.
I never said it wasn't possible. But doing a pair of order-1 allocations from
there might have a significant detrimental effect on performance - in which
case Trond and co. will say "no".
Remember: to crypt 1MiB of data on a 64-bit machine requires 2 x minimum 8KiB
scatterlist arrays. That's assuming the pages in the middle are contiguous,
which might not be the case for a direct I/O read/write. So for the DIO case,
it could be involve an order-2 allocation (or chaining of single pages).
David