Commit b81126e0 authored by Ingo Franzki's avatar Ingo Franzki Committed by Martin Schwidefsky

s390/crypto: Fix return code checking in cbc_paes_crypt()

The return code of cpacf_kmc() is less than the number of
bytes to process in case of an error, not greater.
The crypt routines for the other cipher modes already have
this correctly.

Cc: stable@vger.kernel.org # v4.11+
Fixes: 27937843 ("s390/crypt: Add protected key AES module")
Signed-off-by: default avatarIngo Franzki <ifranzki@linux.ibm.com>
Acked-by: default avatarHarald Freudenberger <freude@linux.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 60c1f892
...@@ -208,7 +208,7 @@ static int cbc_paes_crypt(struct blkcipher_desc *desc, unsigned long modifier, ...@@ -208,7 +208,7 @@ static int cbc_paes_crypt(struct blkcipher_desc *desc, unsigned long modifier,
walk->dst.virt.addr, walk->src.virt.addr, n); walk->dst.virt.addr, walk->src.virt.addr, n);
if (k) if (k)
ret = blkcipher_walk_done(desc, walk, nbytes - k); ret = blkcipher_walk_done(desc, walk, nbytes - k);
if (n < k) { if (k < n) {
if (__cbc_paes_set_key(ctx) != 0) if (__cbc_paes_set_key(ctx) != 0)
return blkcipher_walk_done(desc, walk, -EIO); return blkcipher_walk_done(desc, walk, -EIO);
memcpy(param.key, ctx->pk.protkey, MAXPROTKEYSIZE); memcpy(param.key, ctx->pk.protkey, MAXPROTKEYSIZE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment