diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2005-10-03 01:15:36 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2005-10-29 20:19:43 -0400 |
commit | 1b40efd772f4419fbc1a8940506424246985c333 (patch) | |
tree | 0f1ade69806e7f02196534b008ef8d2c925bf34b | |
parent | 6df5b9f48dd0e77fa796b9b7d3fde7cc5f1237f2 (diff) |
[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>
-rw-r--r-- | crypto/api.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/api.c b/crypto/api.c index 959c4e5f264f..40ae42e9b6a6 100644 --- a/crypto/api.c +++ b/crypto/api.c | |||
@@ -215,7 +215,10 @@ int crypto_register_alg(struct crypto_alg *alg) | |||
215 | if (alg->cra_alignmask & (alg->cra_alignmask + 1)) | 215 | if (alg->cra_alignmask & (alg->cra_alignmask + 1)) |
216 | return -EINVAL; | 216 | return -EINVAL; |
217 | 217 | ||
218 | if (alg->cra_alignmask > PAGE_SIZE) | 218 | if (alg->cra_alignmask & alg->cra_blocksize) |
219 | return -EINVAL; | ||
220 | |||
221 | if (alg->cra_blocksize > PAGE_SIZE) | ||
219 | return -EINVAL; | 222 | return -EINVAL; |
220 | 223 | ||
221 | down_write(&crypto_alg_sem); | 224 | down_write(&crypto_alg_sem); |