mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 09:12:07 +00:00
crypto: cbc - Ensure statesize is zero
The cbc template should not be applied on stream ciphers, especially
ones that have internal state. Enforce this by checking the state
size when the instance is created.
Reported-by: syzbot+050eeedd6c285d8c42f2@syzkaller.appspotmail.com
Fixes: 47309ea135
("crypto: arc4 - Add internal state")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
ccb88e9549
commit
69fba378ed
@ -148,6 +148,9 @@ static int crypto_cbc_create(struct crypto_template *tmpl, struct rtattr **tb)
|
|||||||
if (!is_power_of_2(inst->alg.co.base.cra_blocksize))
|
if (!is_power_of_2(inst->alg.co.base.cra_blocksize))
|
||||||
goto out_free_inst;
|
goto out_free_inst;
|
||||||
|
|
||||||
|
if (inst->alg.co.statesize)
|
||||||
|
goto out_free_inst;
|
||||||
|
|
||||||
inst->alg.encrypt = crypto_cbc_encrypt;
|
inst->alg.encrypt = crypto_cbc_encrypt;
|
||||||
inst->alg.decrypt = crypto_cbc_decrypt;
|
inst->alg.decrypt = crypto_cbc_decrypt;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user