Propagate zero-length requests down to the lskcipher algorithm as otherwise the return value could be different, e.g., zero vs. -EINVAL for xts. Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> --- crypto/lskcipher.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crypto/lskcipher.c b/crypto/lskcipher.c index 8660d6e3ccce..00ea963a2d2d 100644 --- a/crypto/lskcipher.c +++ b/crypto/lskcipher.c @@ -227,6 +227,11 @@ static int crypto_lskcipher_crypt_sg(struct skcipher_request *req, if (!(req->base.flags & CRYPTO_SKCIPHER_REQ_NOTFINAL)) flags |= CRYPTO_LSKCIPHER_FLAG_FINAL; + if (unlikely(!req->cryptlen)) { + err = crypt(tfm, NULL, NULL, 0, ivs, flags); + goto out; + } + do { err = skcipher_walk_virt(&walk, req, false); morethanone = walk.nbytes != walk.total; @@ -245,6 +250,7 @@ static int crypto_lskcipher_crypt_sg(struct skcipher_request *req, return err; } while (!secondpass++ && !isincremental && morethanone); +out: if (flags & CRYPTO_LSKCIPHER_FLAG_FINAL) memcpy(req->iv, ivs, ivsize); -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt