mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
net/tls: Describe ciphers sizes by const structs
Introduce cipher sizes descriptor. It helps reducing the amount of code duplications and repeated switch/cases that assigns the proper sizes according to the cipher type. Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: Gal Pressman <gal@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
8db3d514e9
commit
2d2c5ea242
2 changed files with 27 additions and 0 deletions
|
@ -58,6 +58,23 @@ enum {
|
|||
TLS_NUM_PROTS,
|
||||
};
|
||||
|
||||
#define CIPHER_SIZE_DESC(cipher) [cipher] = { \
|
||||
.iv = cipher ## _IV_SIZE, \
|
||||
.key = cipher ## _KEY_SIZE, \
|
||||
.salt = cipher ## _SALT_SIZE, \
|
||||
.tag = cipher ## _TAG_SIZE, \
|
||||
.rec_seq = cipher ## _REC_SEQ_SIZE, \
|
||||
}
|
||||
|
||||
const struct tls_cipher_size_desc tls_cipher_size_desc[] = {
|
||||
CIPHER_SIZE_DESC(TLS_CIPHER_AES_GCM_128),
|
||||
CIPHER_SIZE_DESC(TLS_CIPHER_AES_GCM_256),
|
||||
CIPHER_SIZE_DESC(TLS_CIPHER_AES_CCM_128),
|
||||
CIPHER_SIZE_DESC(TLS_CIPHER_CHACHA20_POLY1305),
|
||||
CIPHER_SIZE_DESC(TLS_CIPHER_SM4_GCM),
|
||||
CIPHER_SIZE_DESC(TLS_CIPHER_SM4_CCM),
|
||||
};
|
||||
|
||||
static const struct proto *saved_tcpv6_prot;
|
||||
static DEFINE_MUTEX(tcpv6_prot_mutex);
|
||||
static const struct proto *saved_tcpv4_prot;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue