include/net/tls.h

Source file repositories/reference/linux-study-clean/include/net/tls.h

File Facts

System
Linux kernel
Corpus path
include/net/tls.h
Extension
.h
Size
13895 bytes
Lines
517
Domain
Networking Core
Bucket
Sockets, Protocols, Packet Path, And Network Policy
Inferred role
Networking Core: implementation source
Status
source implementation candidate

Why This File Exists

Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.

Dependency Surface

Detected Declarations

Annotated Snippet

struct tx_work {
	struct delayed_work work;
	struct sock *sk;
};

struct tls_sw_context_tx {
	struct crypto_aead *aead_send;
	struct crypto_wait async_wait;
	struct tx_work tx_work;
	struct tls_rec *open_rec;
	struct list_head tx_list;
	atomic_t encrypt_pending;
	u8 async_capable:1;

#define BIT_TX_SCHEDULED	0
#define BIT_TX_CLOSING		1
	unsigned long tx_bitmask;
};

struct tls_strparser {
	struct sock *sk;

	/* Bitfield word and msg_ready are serialized by the lower
	 * socket lock; BH and worker contexts both acquire it.
	 */
	u32 mark : 8;
	u32 stopped : 1;
	u32 copy_mode : 1;
	u32 mixed_decrypted : 1;

	u32 msg_announced : 1;

	bool msg_ready;

	struct strp_msg stm;

	struct sk_buff *anchor;
	struct work_struct work;
};

struct tls_sw_context_rx {
	struct crypto_aead *aead_recv;
	struct crypto_wait async_wait;
	struct sk_buff_head rx_list;	/* list of decrypted 'data' records */
	void (*saved_data_ready)(struct sock *sk);

	u8 reader_present;
	u8 async_capable:1;
	u8 zc_capable:1;
	u8 reader_contended:1;
	bool key_update_pending;

	struct tls_strparser strp;

	atomic_t decrypt_pending;
	struct sk_buff_head async_hold;
	struct wait_queue_head wq;
};

struct tls_record_info {
	struct list_head list;
	u32 end_seq;
	int len;
	int num_frags;
	skb_frag_t frags[MAX_SKB_FRAGS];
};

#define TLS_DRIVER_STATE_SIZE_TX	16
struct tls_offload_context_tx {
	struct crypto_aead *aead_send;
	spinlock_t lock;	/* protects records list */
	struct list_head records_list;
	struct tls_record_info *open_record;
	struct tls_record_info *retransmit_hint;
	u64 hint_record_sn;
	u64 unacked_record_sn;

	struct scatterlist sg_tx_data[MAX_SKB_FRAGS];
	void (*sk_destruct)(struct sock *sk);
	struct work_struct destruct_work;
	struct tls_context *ctx;
	/* The TLS layer reserves room for driver specific state
	 * Currently the belief is that there is not enough
	 * driver specific state to justify another layer of indirection
	 */
	u8 driver_state[TLS_DRIVER_STATE_SIZE_TX] __aligned(8);
};

enum tls_context_flags {
	/* tls_device_down was called after the netdev went down, device state

Annotation

Implementation Notes