Skip to content

Commit

Permalink
crypto: af_alg - add setsockopt for auth tag size
Browse files Browse the repository at this point in the history
Use setsockopt on the tfm FD to provide the authentication tag size for
an AEAD cipher. This is achieved by adding a callback function which is
intended to be used by the AEAD AF_ALG implementation.

The optlen argument of the setsockopt specifies the authentication tag
size to be used with the AEAD tfm.

Signed-off-by: Stephan Mueller <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
smuellerDD authored and herbertx committed Dec 22, 2014
1 parent 905b42e commit 25fb863
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crypto/af_alg.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ static int alg_setsockopt(struct socket *sock, int level, int optname,
goto unlock;

err = alg_setkey(sk, optval, optlen);
break;
case ALG_SET_AEAD_AUTHSIZE:
if (sock->state == SS_CONNECTED)
goto unlock;
if (!type->setauthsize)
goto unlock;
err = type->setauthsize(ask->private, optlen);
}

unlock:
Expand Down
1 change: 1 addition & 0 deletions include/crypto/if_alg.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct af_alg_type {
void (*release)(void *private);
int (*setkey)(void *private, const u8 *key, unsigned int keylen);
int (*accept)(void *private, struct sock *sk);
int (*setauthsize)(void *private, unsigned int authsize);

struct proto_ops *ops;
struct module *owner;
Expand Down

0 comments on commit 25fb863

Please sign in to comment.