Skip to content

Commit 58e4bb5

Browse files
ebiggersherbertx
authored andcommitted
crypto: authenc - stop using alignmask of ahash
Now that the alignmask for ahash and shash algorithms is always 0, simplify the code in authenc accordingly. Signed-off-by: Eric Biggers <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent c626910 commit 58e4bb5

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

crypto/authenc.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,6 @@ static int crypto_authenc_genicv(struct aead_request *req, unsigned int flags)
141141
u8 *hash = areq_ctx->tail;
142142
int err;
143143

144-
hash = (u8 *)ALIGN((unsigned long)hash + crypto_ahash_alignmask(auth),
145-
crypto_ahash_alignmask(auth) + 1);
146-
147144
ahash_request_set_tfm(ahreq, auth);
148145
ahash_request_set_crypt(ahreq, req->dst, hash,
149146
req->assoclen + req->cryptlen);
@@ -286,9 +283,6 @@ static int crypto_authenc_decrypt(struct aead_request *req)
286283
u8 *hash = areq_ctx->tail;
287284
int err;
288285

289-
hash = (u8 *)ALIGN((unsigned long)hash + crypto_ahash_alignmask(auth),
290-
crypto_ahash_alignmask(auth) + 1);
291-
292286
ahash_request_set_tfm(ahreq, auth);
293287
ahash_request_set_crypt(ahreq, req->src, hash,
294288
req->assoclen + req->cryptlen - authsize);
@@ -400,8 +394,7 @@ static int crypto_authenc_create(struct crypto_template *tmpl,
400394
goto err_free_inst;
401395
enc = crypto_spawn_skcipher_alg_common(&ctx->enc);
402396

403-
ctx->reqoff = ALIGN(2 * auth->digestsize + auth_base->cra_alignmask,
404-
auth_base->cra_alignmask + 1);
397+
ctx->reqoff = 2 * auth->digestsize;
405398

406399
err = -ENAMETOOLONG;
407400
if (snprintf(inst->alg.base.cra_name, CRYPTO_MAX_ALG_NAME,
@@ -418,8 +411,7 @@ static int crypto_authenc_create(struct crypto_template *tmpl,
418411
inst->alg.base.cra_priority = enc->base.cra_priority * 10 +
419412
auth_base->cra_priority;
420413
inst->alg.base.cra_blocksize = enc->base.cra_blocksize;
421-
inst->alg.base.cra_alignmask = auth_base->cra_alignmask |
422-
enc->base.cra_alignmask;
414+
inst->alg.base.cra_alignmask = enc->base.cra_alignmask;
423415
inst->alg.base.cra_ctxsize = sizeof(struct crypto_authenc_ctx);
424416

425417
inst->alg.ivsize = enc->ivsize;

0 commit comments

Comments
 (0)