mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-30 06:46:41 +07:00
03c8efc1ff
This patch creates the backbone of the user-space interface for the Crypto API, through a new socket family AF_ALG. Each session corresponds to one or more connections obtained from that socket. The number depends on the number of inputs/outputs of that particular type of operation. For most types there will be a s ingle connection/file descriptor that is used for both input and output. AEAD is one of the few that require two inputs. Each algorithm type will provide its own implementation that plugs into af_alg. They're keyed using a string such as "skcipher" or "hash". IOW this patch only contains the boring bits that is required to hold everything together. Thakns to Miloslav Trmac for reviewing this and contributing fixes and improvements. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Acked-by: David S. Miller <davem@davemloft.net> Tested-by: Martin Willi <martin@strongswan.org>
41 lines
816 B
C
41 lines
816 B
C
/*
|
|
* if_alg: User-space algorithm interface
|
|
*
|
|
* Copyright (c) 2010 Herbert Xu <herbert@gondor.apana.org.au>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the Free
|
|
* Software Foundation; either version 2 of the License, or (at your option)
|
|
* any later version.
|
|
*
|
|
*/
|
|
|
|
#ifndef _LINUX_IF_ALG_H
|
|
#define _LINUX_IF_ALG_H
|
|
|
|
#include <linux/types.h>
|
|
|
|
struct sockaddr_alg {
|
|
__u16 salg_family;
|
|
__u8 salg_type[14];
|
|
__u32 salg_feat;
|
|
__u32 salg_mask;
|
|
__u8 salg_name[64];
|
|
};
|
|
|
|
struct af_alg_iv {
|
|
__u32 ivlen;
|
|
__u8 iv[0];
|
|
};
|
|
|
|
/* Socket options */
|
|
#define ALG_SET_KEY 1
|
|
#define ALG_SET_IV 2
|
|
#define ALG_SET_OP 3
|
|
|
|
/* Operations */
|
|
#define ALG_OP_DECRYPT 0
|
|
#define ALG_OP_ENCRYPT 1
|
|
|
|
#endif /* _LINUX_IF_ALG_H */
|