include/netpacket/netlink.h: Add definitions that will be needed for future NETLINK_CRYPTO support.

This commit is contained in:
Gregory Nutt 2019-11-14 09:18:11 -06:00
parent 3c707f6e71
commit 82a4111a2b
2 changed files with 187 additions and 84 deletions

View File

@ -345,6 +345,33 @@
#define RT_SCOPE_HOST 254 /* Route on local host */
#define RT_SCOPE_NOWHERE 255 /* Destination does not exist */
/* NETLINK_CRYPTO protocol message types ************************************/
#define CRYPTO_MSG_NEWALG 1
#define CRYPTO_MSG_DELALG 2
#define CRYPTO_MSG_UPDATEALG 3
#define CRYPTO_MSG_GETALG 4
/* Netlink message attributes. */
#define CRYPTOCFGA_UNSPEC 0
#define CRYPTOCFGA_PRIORITY_VAL 1 /* Argument: uint32_t */
#define CRYPTOCFGA_REPORT_LARVAL 2 /* Argument: struct crypto_report_larval */
#define CRYPTOCFGA_REPORT_HASH 3 /* Argument: struct crypto_report_hash */
#define CRYPTOCFGA_REPORT_BLKCIPHER 4 /* Argument: struct crypto_report_blkcipher */
#define CRYPTOCFGA_REPORT_AEAD 5 /* Argument: struct crypto_report_aead */
#define CRYPTOCFGA_REPORT_COMPRESS 6 /* Argument: struct crypto_report_comp */
#define CRYPTOCFGA_REPORT_RNG 7 /* Argument: struct crypto_report_rng */
#define CRYPTOCFGA_REPORT_CIPHER 8 /* Argument: struct crypto_report_cipher */
/* Max size of names. No magic here. These can be extended as necessary. */
#define CRYPTO_MAX_ALG_NAME 32
#define CRYPTO_MAX_NAME 32
#define CRYPTO_REPORT_MAXSIZE \
(sizeof(struct crypto_user_alg) + sizeof(struct crypto_report_blkcipher))
/****************************************************************************
* Public Type Definitions
****************************************************************************/
@ -377,6 +404,8 @@ struct nlmsghdr
/* Data follows */
};
/* NETLINK_ROUTE Message Structures *****************************************/
/* RTM_NEWLINK, RTM_DELLINK, RTM_GETLINK
*
* Create, remove or get information about a specific network interface.
@ -457,6 +486,69 @@ struct rtmsg
uint32_t rtm_flags;
};
/* NETLINK_CRYPTO Message Structures ***********\*****************************/
struct crypto_user_alg
{
char cru_name[CRYPTO_MAX_ALG_NAME];
char cru_driver_name[CRYPTO_MAX_ALG_NAME];
char cru_module_name[CRYPTO_MAX_ALG_NAME];
uint32_t cru_type;
uint32_t cru_mask;
uint32_t cru_refcnt;
uint32_t cru_flags;
};
struct crypto_report_larval
{
char type[CRYPTO_MAX_NAME];
};
struct crypto_report_hash
{
char type[CRYPTO_MAX_NAME];
size_t blocksize;
size_t digestsize;
};
struct crypto_report_cipher
{
char type[CRYPTO_MAX_ALG_NAME];
size_t blocksize;
size_t min_keysize;
size_t max_keysize;
};
struct crypto_report_blkcipher
{
char type[CRYPTO_MAX_NAME];
char geniv[CRYPTO_MAX_NAME];
size_t blocksize;
size_t min_keysize;
size_t max_keysize;
size_t ivsize;
};
struct crypto_report_aead
{
char type[CRYPTO_MAX_NAME];
char geniv[CRYPTO_MAX_NAME];
size_t blocksize;
size_t maxauthsize;
size_t ivsize;
};
struct crypto_report_comp
{
char type[CRYPTO_MAX_NAME];
};
struct crypto_report_rng
{
char type[CRYPTO_MAX_NAME];
size_t seedsize;
};
/****************************************************************************
* Public Function Prototypes
****************************************************************************/

View File

@ -55,6 +55,17 @@ config NETLINK_DISABLE_GETROUTE
RTM_GETROUTE is used to retrieve routing tables.
endif # NETLINK_ROUTE
config NETLINK_CRYPTO
bool "Netlink Crypto protocol"
default n
depends on EXPERIMENTAL
---help---
Support the NETLINK_CRYPTO protocol option.
if NETLINK_CRYPTO
endif # NETLINK_CRYPTO
endmenu # Netlink Protocols
endif # NET_NETLINK
endmenu # Netlink Socket Support