mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 21:21:41 +00:00
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 <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
c626910f3f
commit
58e4bb5f16
@ -141,9 +141,6 @@ static int crypto_authenc_genicv(struct aead_request *req, unsigned int flags)
|
|||||||
u8 *hash = areq_ctx->tail;
|
u8 *hash = areq_ctx->tail;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
hash = (u8 *)ALIGN((unsigned long)hash + crypto_ahash_alignmask(auth),
|
|
||||||
crypto_ahash_alignmask(auth) + 1);
|
|
||||||
|
|
||||||
ahash_request_set_tfm(ahreq, auth);
|
ahash_request_set_tfm(ahreq, auth);
|
||||||
ahash_request_set_crypt(ahreq, req->dst, hash,
|
ahash_request_set_crypt(ahreq, req->dst, hash,
|
||||||
req->assoclen + req->cryptlen);
|
req->assoclen + req->cryptlen);
|
||||||
@ -286,9 +283,6 @@ static int crypto_authenc_decrypt(struct aead_request *req)
|
|||||||
u8 *hash = areq_ctx->tail;
|
u8 *hash = areq_ctx->tail;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
hash = (u8 *)ALIGN((unsigned long)hash + crypto_ahash_alignmask(auth),
|
|
||||||
crypto_ahash_alignmask(auth) + 1);
|
|
||||||
|
|
||||||
ahash_request_set_tfm(ahreq, auth);
|
ahash_request_set_tfm(ahreq, auth);
|
||||||
ahash_request_set_crypt(ahreq, req->src, hash,
|
ahash_request_set_crypt(ahreq, req->src, hash,
|
||||||
req->assoclen + req->cryptlen - authsize);
|
req->assoclen + req->cryptlen - authsize);
|
||||||
@ -400,8 +394,7 @@ static int crypto_authenc_create(struct crypto_template *tmpl,
|
|||||||
goto err_free_inst;
|
goto err_free_inst;
|
||||||
enc = crypto_spawn_skcipher_alg_common(&ctx->enc);
|
enc = crypto_spawn_skcipher_alg_common(&ctx->enc);
|
||||||
|
|
||||||
ctx->reqoff = ALIGN(2 * auth->digestsize + auth_base->cra_alignmask,
|
ctx->reqoff = 2 * auth->digestsize;
|
||||||
auth_base->cra_alignmask + 1);
|
|
||||||
|
|
||||||
err = -ENAMETOOLONG;
|
err = -ENAMETOOLONG;
|
||||||
if (snprintf(inst->alg.base.cra_name, CRYPTO_MAX_ALG_NAME,
|
if (snprintf(inst->alg.base.cra_name, CRYPTO_MAX_ALG_NAME,
|
||||||
@ -418,8 +411,7 @@ static int crypto_authenc_create(struct crypto_template *tmpl,
|
|||||||
inst->alg.base.cra_priority = enc->base.cra_priority * 10 +
|
inst->alg.base.cra_priority = enc->base.cra_priority * 10 +
|
||||||
auth_base->cra_priority;
|
auth_base->cra_priority;
|
||||||
inst->alg.base.cra_blocksize = enc->base.cra_blocksize;
|
inst->alg.base.cra_blocksize = enc->base.cra_blocksize;
|
||||||
inst->alg.base.cra_alignmask = auth_base->cra_alignmask |
|
inst->alg.base.cra_alignmask = enc->base.cra_alignmask;
|
||||||
enc->base.cra_alignmask;
|
|
||||||
inst->alg.base.cra_ctxsize = sizeof(struct crypto_authenc_ctx);
|
inst->alg.base.cra_ctxsize = sizeof(struct crypto_authenc_ctx);
|
||||||
|
|
||||||
inst->alg.ivsize = enc->ivsize;
|
inst->alg.ivsize = enc->ivsize;
|
||||||
|
Loading…
Reference in New Issue
Block a user