Skip to content

Commit

Permalink
crypto: af_alg - Fix regression on empty requests
Browse files Browse the repository at this point in the history
Some user-space programs rely on crypto requests that have no
control metadata.  This broke when a check was added to require
the presence of control metadata with the ctx->init flag.

This patch fixes the regression by setting ctx->init as long as
one sendmsg(2) has been made, with or without a control message.

Reported-by: Sachin Sant <[email protected]>
Reported-by: Naresh Kamboju <[email protected]>
Fixes: f3c802a ("crypto: algif_aead - Only wake up when...")
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed Jul 9, 2020
1 parent ad6a066 commit 662bb52
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crypto/af_alg.c
Original file line number Diff line number Diff line change
Expand Up @@ -851,14 +851,14 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size,
err = -EINVAL;
goto unlock;
}
ctx->init = true;

if (init) {
ctx->enc = enc;
if (con.iv)
memcpy(ctx->iv, con.iv->iv, ivsize);

ctx->aead_assoclen = con.aead_assoclen;
ctx->init = true;
}

while (size) {
Expand Down

0 comments on commit 662bb52

Please sign in to comment.