Skip to content

Commit

Permalink
crypto: af_alg - Allow arbitrarily long algorithm names
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
herbertx committed Apr 10, 2017
1 parent 4473710 commit 3f69cc6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crypto/af_alg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3f69cc6

Please sign in to comment.