Skip to content

Commit

Permalink
crypto: cts - Weed out non-CBC algorithms
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
herbertx committed Jan 20, 2015
1 parent 3eda716 commit 988dc01
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crypto/cts.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 988dc01

Please sign in to comment.