diff options
author | Harald Freudenberger <freude@linux.vnet.ibm.com> | 2014-05-07 10:51:29 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-05-08 09:46:09 -0400 |
commit | 3901c1124ec5099254a9396085f7798153a7293f (patch) | |
tree | 262732628ea2c21750399ef0196c90688a6ff494 | |
parent | 27c5fb7a84242b66bf1e0b2fe6bf40d19bcc5c04 (diff) |
crypto: s390 - fix aes,des ctr mode concurrency finding.
An additional testcase found an issue with the last
series of patches applied: the fallback solution may
not save the iv value after operation. This very small
fix just makes sure the iv is copied back to the
walk/desc struct.
Cc: <stable@vger.kernel.org> # 3.14+
Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | arch/s390/crypto/aes_s390.c | 3 | ||||
-rw-r--r-- | arch/s390/crypto/des_s390.c | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c index cf3c0089bef2..23223cd63e54 100644 --- a/arch/s390/crypto/aes_s390.c +++ b/arch/s390/crypto/aes_s390.c | |||
@@ -820,6 +820,9 @@ static int ctr_aes_crypt(struct blkcipher_desc *desc, long func, | |||
820 | else | 820 | else |
821 | memcpy(walk->iv, ctrptr, AES_BLOCK_SIZE); | 821 | memcpy(walk->iv, ctrptr, AES_BLOCK_SIZE); |
822 | spin_unlock(&ctrblk_lock); | 822 | spin_unlock(&ctrblk_lock); |
823 | } else { | ||
824 | if (!nbytes) | ||
825 | memcpy(walk->iv, ctrptr, AES_BLOCK_SIZE); | ||
823 | } | 826 | } |
824 | /* | 827 | /* |
825 | * final block may be < AES_BLOCK_SIZE, copy only nbytes | 828 | * final block may be < AES_BLOCK_SIZE, copy only nbytes |
diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c index 0a5aac8a9412..7acb77f7ef1a 100644 --- a/arch/s390/crypto/des_s390.c +++ b/arch/s390/crypto/des_s390.c | |||
@@ -429,6 +429,9 @@ static int ctr_desall_crypt(struct blkcipher_desc *desc, long func, | |||
429 | else | 429 | else |
430 | memcpy(walk->iv, ctrptr, DES_BLOCK_SIZE); | 430 | memcpy(walk->iv, ctrptr, DES_BLOCK_SIZE); |
431 | spin_unlock(&ctrblk_lock); | 431 | spin_unlock(&ctrblk_lock); |
432 | } else { | ||
433 | if (!nbytes) | ||
434 | memcpy(walk->iv, ctrptr, DES_BLOCK_SIZE); | ||
432 | } | 435 | } |
433 | /* final block may be < DES_BLOCK_SIZE, copy only nbytes */ | 436 | /* final block may be < DES_BLOCK_SIZE, copy only nbytes */ |
434 | if (nbytes) { | 437 | if (nbytes) { |