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.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hasm/byteorder.hlinux/crypto.hlinux/socket.hlinux/tcp.hlinux/mutex.hlinux/netdevice.hlinux/rcupdate.hnet/net_namespace.hnet/tcp.hnet/strparser.hcrypto/aead.huapi/linux/tls.h
Detected Declarations
struct tls_recstruct tx_workstruct tls_sw_context_txstruct tls_strparserstruct tls_sw_context_rxstruct tls_record_infostruct tls_offload_context_txstruct cipher_contextstruct tls_prot_infostruct tls_contextstruct tlsdev_opsstruct tls_offload_resync_asyncstruct tls_offload_context_rxenum tls_context_flagsenum tls_offload_ctx_direnum tls_offload_sync_typefunction tls_record_is_start_markerfunction tls_record_start_seqfunction tls_is_skb_tx_device_offloadedfunction tls_offload_ctx_txfunction tls_sw_has_ctx_txfunction tls_sw_has_ctx_rxfunction tls_offload_ctx_rxfunction tls_driver_ctxfunction tls_offload_rx_resync_requestfunction tls_offload_rx_resync_async_request_startfunction tls_offload_rx_resync_async_request_endfunction tls_offload_rx_resync_async_request_cancelfunction tls_offload_rx_resync_set_typefunction tls_offload_tx_resync_pendingfunction tls_is_sk_rx_device_offloaded
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
- Immediate include surface: `linux/types.h`, `asm/byteorder.h`, `linux/crypto.h`, `linux/socket.h`, `linux/tcp.h`, `linux/mutex.h`, `linux/netdevice.h`, `linux/rcupdate.h`.
- Detected declarations: `struct tls_rec`, `struct tx_work`, `struct tls_sw_context_tx`, `struct tls_strparser`, `struct tls_sw_context_rx`, `struct tls_record_info`, `struct tls_offload_context_tx`, `struct cipher_context`, `struct tls_prot_info`, `struct tls_context`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.