summaryrefslogtreecommitdiff
path: root/crypto/cts.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-01-16 19:38:17 +1100
committerHerbert Xu <herbert@gondor.apana.org.au>2015-01-20 14:44:15 +1100
commitaa3e312a9b98552a28b22fa166597b0767952ba0 (patch)
treef49393c74d5f9bdc5eb2461a63c471fe582ba780 /crypto/cts.c
parent05253b62d8bcd34511158c90ab84d3ed18a03954 (diff)
downloadlinux-crypto-aa3e312a9b98552a28b22fa166597b0767952ba0.tar.gz
linux-crypto-aa3e312a9b98552a28b22fa166597b0767952ba0.zip
crypto: cts - Weed out non-CBC algorithms
The cts algorithm as currently implemented assumes the underlying is a CBC-mode algorithm. So this patch adds a check for that to eliminate bogus combinations of cts with non-CBC modes. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/cts.c')
-rw-r--r--crypto/cts.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/cts.c b/crypto/cts.c
index 6a8089c4..e467ec0a 100644
--- a/crypto/cts.c
+++ b/crypto/cts.c
@@ -290,6 +290,9 @@ static struct crypto_instance *crypto_cts_alloc(struct rtattr **tb)
if (!is_power_of_2(alg->cra_blocksize))
goto out_put_alg;
+ if (strncmp(alg->cra_name, "cbc(", 4))
+ goto out_put_alg;
+
inst = crypto_alloc_instance("cts", alg);
if (IS_ERR(inst))
goto out_put_alg;