diff options
| -rw-r--r-- | crypto/xcbc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crypto/xcbc.c b/crypto/xcbc.c index 1e30b31f33c6..bb7b67fba349 100644 --- a/crypto/xcbc.c +++ b/crypto/xcbc.c | |||
| @@ -199,6 +199,7 @@ static int xcbc_create(struct crypto_template *tmpl, struct rtattr **tb) | |||
| 199 | { | 199 | { |
| 200 | struct shash_instance *inst; | 200 | struct shash_instance *inst; |
| 201 | struct crypto_alg *alg; | 201 | struct crypto_alg *alg; |
| 202 | unsigned long alignmask; | ||
| 202 | int err; | 203 | int err; |
| 203 | 204 | ||
| 204 | err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_SHASH); | 205 | err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_SHASH); |
| @@ -228,19 +229,20 @@ static int xcbc_create(struct crypto_template *tmpl, struct rtattr **tb) | |||
| 228 | if (err) | 229 | if (err) |
| 229 | goto out_free_inst; | 230 | goto out_free_inst; |
| 230 | 231 | ||
| 232 | alignmask = alg->cra_alignmask | 3; | ||
| 233 | inst->alg.base.cra_alignmask = alignmask; | ||
| 231 | inst->alg.base.cra_priority = alg->cra_priority; | 234 | inst->alg.base.cra_priority = alg->cra_priority; |
| 232 | inst->alg.base.cra_blocksize = alg->cra_blocksize; | 235 | inst->alg.base.cra_blocksize = alg->cra_blocksize; |
| 233 | inst->alg.base.cra_alignmask = alg->cra_alignmask | 3; | ||
| 234 | 236 | ||
| 235 | inst->alg.digestsize = alg->cra_blocksize; | 237 | inst->alg.digestsize = alg->cra_blocksize; |
| 236 | inst->alg.descsize = ALIGN(sizeof(struct xcbc_desc_ctx), | 238 | inst->alg.descsize = ALIGN(sizeof(struct xcbc_desc_ctx), |
| 237 | crypto_tfm_ctx_alignment()) + | 239 | crypto_tfm_ctx_alignment()) + |
| 238 | (alg->cra_alignmask & | 240 | (alignmask & |
| 239 | ~(crypto_tfm_ctx_alignment() - 1)) + | 241 | ~(crypto_tfm_ctx_alignment() - 1)) + |
| 240 | alg->cra_blocksize * 2; | 242 | alg->cra_blocksize * 2; |
| 241 | 243 | ||
| 242 | inst->alg.base.cra_ctxsize = ALIGN(sizeof(struct xcbc_tfm_ctx), | 244 | inst->alg.base.cra_ctxsize = ALIGN(sizeof(struct xcbc_tfm_ctx), |
| 243 | alg->cra_alignmask) + | 245 | alignmask + 1) + |
| 244 | alg->cra_blocksize * 2; | 246 | alg->cra_blocksize * 2; |
| 245 | inst->alg.base.cra_init = xcbc_init_tfm; | 247 | inst->alg.base.cra_init = xcbc_init_tfm; |
| 246 | inst->alg.base.cra_exit = xcbc_exit_tfm; | 248 | inst->alg.base.cra_exit = xcbc_exit_tfm; |
