linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [LTP PATCH 0/2] ltp: fix af_alg02 to specify control data
@ 2020-08-20 18:19 Eric Biggers
  2020-08-20 18:19 ` [LTP PATCH 1/2] lib/tst_af_alg: add tst_alg_sendmsg() Eric Biggers
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Biggers @ 2020-08-20 18:19 UTC (permalink / raw)
  To: ltp; +Cc: linux-crypto, Naresh Kamboju

It isn't clearly defined what happens if you read from an AF_ALG request
socket without previously sending the control data to begin an
encryption or decryption operation.  On some kernels the read will
return 0, while on others it will block.

Testing this corner case isn't the purpose of af_alg02; it just wants to
try to encrypt a zero-length message.  So, change it to explicitly send
a zero-length message with control data.

This fixes the test failure reported at
https://lkml.kernel.org/r/CA+G9fYtebf78TH-XpqArunHc1L6s9mHdLEbpY1EY9tSyDjp=sg@mail.gmail.com

Fixing the test in this way was also previously suggested at
https://lkml.kernel.org/r/20200702033221.GA19367@gondor.apana.org.au

Note, this patch doesn't change the fact that the read() still blocks on
pre-4.14 kernels (which is a kernel bug), and thus the timeout logic in
the test is still needed.

Eric Biggers (2):
  lib/tst_af_alg: add tst_alg_sendmsg()
  crypto/af_alg02: send message with control data before reading

 include/tst_af_alg.h               | 32 +++++++++++++++
 lib/tst_af_alg.c                   | 64 ++++++++++++++++++++++++++++++
 testcases/kernel/crypto/af_alg02.c | 21 ++++++++--
 3 files changed, 114 insertions(+), 3 deletions(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-21  6:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-20 18:19 [LTP PATCH 0/2] ltp: fix af_alg02 to specify control data Eric Biggers
2020-08-20 18:19 ` [LTP PATCH 1/2] lib/tst_af_alg: add tst_alg_sendmsg() Eric Biggers
2020-08-20 18:19 ` [LTP PATCH 2/2] crypto/af_alg02: send message with control data before reading Eric Biggers
2020-08-21  6:50 ` [LTP] [LTP PATCH 0/2] ltp: fix af_alg02 to specify control data Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).