From: Herbert Xu <herbert@gondor.apana.org.au>
To: Alexander Sverdlin <alexander.sverdlin@nokia.com>,
"David S. Miller" <davem@davemloft.net>,
linux-crypto@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH 2/4] crypto: af_alg - Allow arbitrarily long algorithm names
Date: Thu, 06 Apr 2017 16:16:09 +0800 [thread overview]
Message-ID: <E1cw2aP-00085S-Q4@gondobar> (raw)
In-Reply-To: 20170406081509.GB30557@gondor.apana.org.au
This patch removes the hard-coded 64-byte limit on the length
of the algorithm name through bind(2). The address length can
now exceed that. The user-space structure remains unchanged.
In order to use a longer name simply extend the salg_name array
beyond its defined 64 bytes length.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
crypto/af_alg.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index 690deca..3556d8e 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -160,11 +160,11 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
if (sock->state == SS_CONNECTED)
return -EINVAL;
- if (addr_len != sizeof(*sa))
+ if (addr_len < sizeof(*sa))
return -EINVAL;
sa->salg_type[sizeof(sa->salg_type) - 1] = 0;
- sa->salg_name[sizeof(sa->salg_name) - 1] = 0;
+ sa->salg_name[sizeof(sa->salg_name) + addr_len - sizeof(*sa) - 1] = 0;
type = alg_get_type(sa->salg_type);
if (IS_ERR(type) && PTR_ERR(type) == -ENOENT) {
next prev parent reply other threads:[~2017-04-06 8:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <e96825bd-4e1d-c6c1-160e-0dc10f7f3981@nokia.com>
[not found] ` <367298c5-aa5d-3708-72d0-8a44702d0caa@nokia.com>
2017-04-06 8:15 ` [PATCH 0/4] crypto: CRYPTO_MAX_ALG_NAME is too low Herbert Xu
2017-04-06 8:16 ` [PATCH 1/4] crypto: user - Prepare for CRYPTO_MAX_ALG_NAME expansion Herbert Xu
2017-04-06 15:10 ` Alexander Sverdlin
2017-04-06 8:16 ` Herbert Xu [this message]
2017-04-06 12:32 ` [PATCH 2/4] crypto: af_alg - Allow arbitrarily long algorithm names Alexander Sverdlin
2017-04-07 5:25 ` Herbert Xu
2017-04-06 8:16 ` [PATCH 3/4] xfrm: Prepare for CRYPTO_MAX_ALG_NAME expansion Herbert Xu
2017-04-06 15:10 ` Alexander Sverdlin
2017-04-06 21:15 ` Steffen Klassert
2017-04-06 8:16 ` [PATCH 4/4] crypto: api - Extend algorithm name limit to 128 bytes Herbert Xu
2017-04-06 15:11 ` Alexander Sverdlin
2017-04-06 15:10 ` [PATCH 0/4] crypto: CRYPTO_MAX_ALG_NAME is too low Alexander Sverdlin
2017-04-06 20:58 ` David Miller
2017-04-06 21:14 ` Steffen Klassert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1cw2aP-00085S-Q4@gondobar \
--to=herbert@gondor.apana.org.au \
--cc=alexander.sverdlin@nokia.com \
--cc=davem@davemloft.net \
--cc=linux-crypto@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).