> -----Original Message----- > From: Horia Geantă <horia.geanta@xxxxxxx> > Sent: Monday, August 10, 2020 4:34 PM > To: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>; Van Leeuwen, Pascal <pvanleeuwen@xxxxxxxxxx> > Cc: Andrei Botila (OSS) <andrei.botila@xxxxxxxxxxx>; David S. Miller <davem@xxxxxxxxxxxxx>; linux-crypto@xxxxxxxxxxxxxxx; linux- > arm-kernel@xxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linuxppc-dev@xxxxxxxxxxxxxxxx; linux-s390@xxxxxxxxxxxxxxx; > x86@xxxxxxxxxx; linux-arm-kernel@xxxxxxxx; Andrei Botila <andrei.botila@xxxxxxx>; Antoine Tenart <antoine.tenart@xxxxxxxxxxx> > Subject: Re: [PATCH 19/22] crypto: inside-secure - add check for xts input length equal to zero > > <<< External Email >>> > On 8/10/2020 4:45 PM, Herbert Xu wrote: > > On Mon, Aug 10, 2020 at 10:20:20AM +0000, Van Leeuwen, Pascal wrote: > >> > >> With all due respect, but this makes no sense. > > > > I agree. This is a lot of churn for no gain. > > > I would say the gain is that all skcipher algorithms would behave the same > when input length equals zero - i.e. treat the request as a no-op. > XTS already behaves differently because it can accept any byte amount as long as it is not in the range 0 -16. So far, you got an EINVAL error for lengths < 16. The special exception on top of that for length 0 does not improve anything. Treating a request of length 0 as a no-op is not a useful feature here, as there is no use case where that would make sense. XTS encrypts blocks (usually disk sectors), and cannot be chained. So an attempt to encrypt a zero length block is most certainly some kind of error (e.g. trying to use XTS for something it was not designed to do - big security mistake!). > We can't say "no input" has any meaning to the other skcipher algorithms, > but the convention is to accept this case and just return 0. > I don't see why XTS has to be handled differently. > I don't see why you would blindly follow some historical convention ... unless maybe there was some existing real use case that would benefit? BTW: for generic ciphers I could think of some use cases where the zero length request being a no-op makes sense if the application does not bother to check how much data it has gathered to process (which may be nothing), but I can't see how this could apply to XTS, being block-based. > Thanks, > Horia Regards, Pascal van Leeuwen Silicon IP Architect Multi-Protocol Engines, Rambus Security Rambus ROTW Holding BV +31-73 6581953 Note: The Inside Secure/Verimatrix Silicon IP team was recently acquired by Rambus. Please be so kind to update your e-mail address book with my new e-mail address. ** This message and any attachments are for the sole use of the intended recipient(s). It may contain information that is confidential and privileged. If you are not the intended recipient of this message, you are prohibited from printing, copying, forwarding or saving it. Please delete the message and attachments and notify the sender immediately. ** Rambus Inc.<http://www.rambus.com>