net/tls/tls.h
Source file repositories/reference/linux-study-clean/net/tls/tls.h
File Facts
- System
- Linux kernel
- Corpus path
net/tls/tls.h- Extension
.h- Size
- 12094 bytes
- Lines
- 384
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
asm/byteorder.hlinux/types.hlinux/skmsg.hnet/tls.hnet/tls_prot.h
Detected Declarations
struct tls_cipher_descstruct tls_recfunction tls_strp_msg_readyfunction tls_strp_msg_mixed_decryptedfunction tls_device_initfunction tls_device_cleanupfunction tls_device_free_resources_txfunction tls_device_offload_cleanup_rxfunction tls_is_partially_sent_recordfunction tls_is_pending_open_recordfunction tls_bigint_incrementfunction tls_bigint_subtractfunction tls_advance_record_snfunction tls_xor_iv_with_seqfunction tls_fill_prependfunction tls_make_aad
Annotated Snippet
struct tls_cipher_desc {
unsigned int nonce;
unsigned int iv;
unsigned int key;
unsigned int salt;
unsigned int tag;
unsigned int rec_seq;
unsigned int iv_offset;
unsigned int key_offset;
unsigned int salt_offset;
unsigned int rec_seq_offset;
char *cipher_name;
bool offloadable;
size_t crypto_info;
};
#define TLS_CIPHER_MIN TLS_CIPHER_AES_GCM_128
#define TLS_CIPHER_MAX TLS_CIPHER_ARIA_GCM_256
extern const struct tls_cipher_desc tls_cipher_desc[TLS_CIPHER_MAX + 1 - TLS_CIPHER_MIN];
static inline const struct tls_cipher_desc *get_cipher_desc(u16 cipher_type)
{
if (cipher_type < TLS_CIPHER_MIN || cipher_type > TLS_CIPHER_MAX)
return NULL;
return &tls_cipher_desc[cipher_type - TLS_CIPHER_MIN];
}
static inline char *crypto_info_iv(struct tls_crypto_info *crypto_info,
const struct tls_cipher_desc *cipher_desc)
{
return (char *)crypto_info + cipher_desc->iv_offset;
}
static inline char *crypto_info_key(struct tls_crypto_info *crypto_info,
const struct tls_cipher_desc *cipher_desc)
{
return (char *)crypto_info + cipher_desc->key_offset;
}
static inline char *crypto_info_salt(struct tls_crypto_info *crypto_info,
const struct tls_cipher_desc *cipher_desc)
{
return (char *)crypto_info + cipher_desc->salt_offset;
}
static inline char *crypto_info_rec_seq(struct tls_crypto_info *crypto_info,
const struct tls_cipher_desc *cipher_desc)
{
return (char *)crypto_info + cipher_desc->rec_seq_offset;
}
/* TLS records are maintained in 'struct tls_rec'. It stores the memory pages
* allocated or mapped for each TLS record. After encryption, the records are
* stores in a linked list.
*/
struct tls_rec {
struct list_head list;
int tx_ready;
int tx_flags;
struct sk_msg msg_plaintext;
struct sk_msg msg_encrypted;
/* AAD | msg_plaintext.sg.data | sg_tag */
struct scatterlist sg_aead_in[2];
/* AAD | msg_encrypted.sg.data (data contains overhead for hdr & iv & tag) */
struct scatterlist sg_aead_out[2];
char content_type;
struct scatterlist sg_content_type;
struct sock *sk;
char aad_space[TLS_AAD_SPACE_SIZE];
u8 iv_data[TLS_MAX_IV_SIZE];
/* Must be last --ends in a flexible-array member. */
struct aead_request aead_req;
};
int __net_init tls_proc_init(struct net *net);
void __net_exit tls_proc_fini(struct net *net);
struct tls_context *tls_ctx_create(struct sock *sk);
void tls_ctx_free(struct sock *sk, struct tls_context *ctx);
void update_sk_prot(struct sock *sk, struct tls_context *ctx);
int wait_on_pending_writer(struct sock *sk, long *timeo);
Annotation
- Immediate include surface: `asm/byteorder.h`, `linux/types.h`, `linux/skmsg.h`, `net/tls.h`, `net/tls_prot.h`.
- Detected declarations: `struct tls_cipher_desc`, `struct tls_rec`, `function tls_strp_msg_ready`, `function tls_strp_msg_mixed_decrypted`, `function tls_device_init`, `function tls_device_cleanup`, `function tls_device_free_resources_tx`, `function tls_device_offload_cleanup_rx`, `function tls_is_partially_sent_record`, `function tls_is_pending_open_record`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
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.