Home Home > GIT Browse > SLE12-SP4
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-07-16 14:46:35 +0200
committerTakashi Iwai <tiwai@suse.de>2019-07-16 14:46:56 +0200
commit02deed1b8ac5f404be93e30ba059d377c8303996 (patch)
tree6b55c2ea4e4c1d19c355c9820d3db1ce33bd5a58
parentf96c64241b45cbdecbcf2b70195392d46e1115a5 (diff)
crypto: talitos - check data blocksize in ablkcipher
(bsc#1051510).
-rw-r--r--patches.fixes/crypto-talitos-check-data-blocksize-in-ablkcipher.patch62
-rw-r--r--series.conf1
2 files changed, 63 insertions, 0 deletions
diff --git a/patches.fixes/crypto-talitos-check-data-blocksize-in-ablkcipher.patch b/patches.fixes/crypto-talitos-check-data-blocksize-in-ablkcipher.patch
new file mode 100644
index 0000000000..4ac40cadc7
--- /dev/null
+++ b/patches.fixes/crypto-talitos-check-data-blocksize-in-ablkcipher.patch
@@ -0,0 +1,62 @@
+From ee483d32ee1a1a7f7d7e918fbc350c790a5af64a Mon Sep 17 00:00:00 2001
+From: Christophe Leroy <christophe.leroy@c-s.fr>
+Date: Tue, 21 May 2019 13:34:12 +0000
+Subject: [PATCH] crypto: talitos - check data blocksize in ablkcipher.
+Git-commit: ee483d32ee1a1a7f7d7e918fbc350c790a5af64a
+Patch-mainline: v5.3-rc1
+References: bsc#1051510
+
+When data size is not a multiple of the alg's block size,
+the SEC generates an error interrupt and dumps the registers.
+And for NULL size, the SEC does just nothing and the interrupt
+is awaited forever.
+
+This patch ensures the data size is correct before submitting
+the request to the SEC engine.
+
+Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
+Fixes: 4de9d0b547b9 ("crypto: talitos - Add ablkcipher algorithms")
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ drivers/crypto/talitos.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
+index 8b9a529f1b66..1e5410f92166 100644
+--- a/drivers/crypto/talitos.c
++++ b/drivers/crypto/talitos.c
+@@ -1756,6 +1756,14 @@ static int ablkcipher_encrypt(struct ablkcipher_request *areq)
+ struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq);
+ struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher);
+ struct talitos_edesc *edesc;
++ unsigned int blocksize =
++ crypto_tfm_alg_blocksize(crypto_ablkcipher_tfm(cipher));
++
++ if (!areq->nbytes)
++ return 0;
++
++ if (areq->nbytes % blocksize)
++ return -EINVAL;
+
+ /* allocate extended descriptor */
+ edesc = ablkcipher_edesc_alloc(areq, true);
+@@ -1773,6 +1781,14 @@ static int ablkcipher_decrypt(struct ablkcipher_request *areq)
+ struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq);
+ struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher);
+ struct talitos_edesc *edesc;
++ unsigned int blocksize =
++ crypto_tfm_alg_blocksize(crypto_ablkcipher_tfm(cipher));
++
++ if (!areq->nbytes)
++ return 0;
++
++ if (areq->nbytes % blocksize)
++ return -EINVAL;
+
+ /* allocate extended descriptor */
+ edesc = ablkcipher_edesc_alloc(areq, false);
+--
+2.16.4
+
diff --git a/series.conf b/series.conf
index 83dbfbc189..7e5ff5b027 100644
--- a/series.conf
+++ b/series.conf
@@ -22818,6 +22818,7 @@
patches.fixes/crypto-talitos-rename-alternative-AEAD-algos.patch
patches.fixes/crypto-talitos-reduce-max-key-size-for-SEC1.patch
patches.fixes/crypto-talitos-fix-CTR-alg-blocksize.patch
+ patches.fixes/crypto-talitos-check-data-blocksize-in-ablkcipher.patch
patches.fixes/lib-scatterlist-Fix-mapping-iterator-when-sg-offset-.patch
patches.drivers/pwm-stm32-Use-3-cells-of_xlate.patch
patches.drivers/gpio-omap-fix-lack-of-irqstatus_raw0-for-OMAP4.patch