mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
[CRYPTO] Check cra_alignmask against cra_blocksize
The cipher code relies on the fact that the block size is a multiple of the required alignment. So we should check this at the time of algorith registration. We also ensure that the block size is bounded by the page size. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
6df5b9f48d
commit
1b40efd772
1 changed files with 4 additions and 1 deletions
|
@ -215,7 +215,10 @@ int crypto_register_alg(struct crypto_alg *alg)
|
|||
if (alg->cra_alignmask & (alg->cra_alignmask + 1))
|
||||
return -EINVAL;
|
||||
|
||||
if (alg->cra_alignmask > PAGE_SIZE)
|
||||
if (alg->cra_alignmask & alg->cra_blocksize)
|
||||
return -EINVAL;
|
||||
|
||||
if (alg->cra_blocksize > PAGE_SIZE)
|
||||
return -EINVAL;
|
||||
|
||||
down_write(&crypto_alg_sem);
|
||||
|
|
Loading…
Reference in a new issue