Commit 662bb52f authored by Herbert Xu's avatar Herbert Xu

crypto: af_alg - Fix regression on empty requests

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: default avatarSachin Sant <sachinp@linux.vnet.ibm.com>
Reported-by: default avatarNaresh Kamboju <naresh.kamboju@linaro.org>
Fixes: f3c802a1 ("crypto: algif_aead - Only wake up when...")
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent ad6a0664
...@@ -851,6 +851,7 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size, ...@@ -851,6 +851,7 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size,
err = -EINVAL; err = -EINVAL;
goto unlock; goto unlock;
} }
ctx->init = true;
if (init) { if (init) {
ctx->enc = enc; ctx->enc = enc;
...@@ -858,7 +859,6 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size, ...@@ -858,7 +859,6 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size,
memcpy(ctx->iv, con.iv->iv, ivsize); memcpy(ctx->iv, con.iv->iv, ivsize);
ctx->aead_assoclen = con.aead_assoclen; ctx->aead_assoclen = con.aead_assoclen;
ctx->init = true;
} }
while (size) { while (size) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment