s390/crypto: xts-aes-s390 fix extra run-time crypto self tests finding
authorHarald Freudenberger <freude@linux.ibm.com>
Thu, 5 Sep 2019 07:38:17 +0000 (09:38 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Oct 2019 10:30:27 +0000 (12:30 +0200)
commit64f1b2e882a320540b3b27f9f178a2afad4c7486
treecf9f838c82c718d08ee537eb3e3b2bbac0b15358
parentd641e70f40f70e676093ecd8687c53393c463d97
s390/crypto: xts-aes-s390 fix extra run-time crypto self tests finding

[ Upstream commit 9e323d45ba94262620a073a3f9945ca927c07c71 ]

With 'extra run-time crypto self tests' enabled, the selftest
for s390-xts fails with

  alg: skcipher: xts-aes-s390 encryption unexpectedly succeeded on
  test vector "random: len=0 klen=64"; expected_error=-22,
  cfg="random: inplace use_digest nosimd src_divs=[2.61%@+4006,
  84.44%@+21, 1.55%@+13, 4.50%@+344, 4.26%@+21, 2.64%@+27]"

This special case with nbytes=0 is not handled correctly and this
fix now makes sure that -EINVAL is returned when there is en/decrypt
called with 0 bytes to en/decrypt.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/s390/crypto/aes_s390.c