Skip to content

Commit 3f69cc6

Browse files
committed
crypto: af_alg - Allow arbitrarily long algorithm names
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>
1 parent 4473710 commit 3f69cc6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎crypto/af_alg.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
160160
if (sock->state == SS_CONNECTED)
161161
return -EINVAL;
162162

163-
if (addr_len != sizeof(*sa))
163+
if (addr_len < sizeof(*sa))
164164
return -EINVAL;
165165

166166
sa->salg_type[sizeof(sa->salg_type) - 1] = 0;
167-
sa->salg_name[sizeof(sa->salg_name) - 1] = 0;
167+
sa->salg_name[sizeof(sa->salg_name) + addr_len - sizeof(*sa) - 1] = 0;
168168

169169
type = alg_get_type(sa->salg_type);
170170
if (IS_ERR(type) && PTR_ERR(type) == -ENOENT) {

0 commit comments

Comments
 (0)