net/tipc/crypto.c
Source file repositories/reference/linux-study-clean/net/tipc/crypto.c
File Facts
- System
- Linux kernel
- Corpus path
net/tipc/crypto.c- Extension
.c- Size
- 67307 bytes
- Lines
- 2476
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
crypto/aead.hcrypto/aes.hcrypto/rng.hcrypto.hmsg.hbcast.h
Detected Declarations
struct tipc_keystruct tipc_tfmstruct tipc_aeadstruct tipc_crypto_statsstruct tipc_cryptostruct tipc_crypto_tx_ctxstruct tipc_crypto_rx_ctxfunction tipc_aead_key_validatefunction tipc_aead_key_generatefunction tipc_aead_putfunction tipc_aead_freefunction list_for_each_entry_safefunction tipc_aead_usersfunction tipc_aead_users_incfunction tipc_aead_users_decfunction tipc_aead_users_setfunction afunction for_each_possible_cpufunction tipc_aead_clonefunction for_each_possible_cpufunction tipc_aead_encryptfunction tipc_aead_encrypt_donefunction tipc_aead_decryptfunction tipc_aead_decrypt_donefunction tipc_ehdr_sizefunction tipc_ehdr_validatefunction tipc_ehdr_buildfunction tipc_crypto_key_set_statefunction tipc_crypto_key_initfunction tipc_crypto_key_attachfunction tipc_crypto_key_flushfunction tipc_crypto_key_try_alignfunction messagefunction tipc_crypto_key_synchfunction atomic_cmpxchgfunction tipc_crypto_key_revokefunction tipc_crypto_startfunction tipc_crypto_stopfunction tipc_crypto_timeoutfunction tipc_crypto_clone_msgfunction tipc_crypto_xmitfunction tipc_rcvfunction tipc_crypto_rcv_completefunction tipc_crypto_do_cmdfunction for_each_possible_cpufunction tipc_crypto_msg_rcvfunction tipc_crypto_key_distrfunction tipc_crypto_key_xmit
Annotated Snippet
struct tipc_key {
#define KEY_BITS (2)
#define KEY_MASK ((1 << KEY_BITS) - 1)
union {
struct {
#if defined(__LITTLE_ENDIAN_BITFIELD)
u8 pending:2,
active:2,
passive:2, /* rx only */
reserved:2;
#elif defined(__BIG_ENDIAN_BITFIELD)
u8 reserved:2,
passive:2, /* rx only */
active:2,
pending:2;
#else
#error "Please fix <asm/byteorder.h>"
#endif
} __packed;
u8 keys;
};
};
/**
* struct tipc_tfm - TIPC TFM structure to form a list of TFMs
* @tfm: cipher handle/key
* @list: linked list of TFMs
*/
struct tipc_tfm {
struct crypto_aead *tfm;
struct list_head list;
};
/**
* struct tipc_aead - TIPC AEAD key structure
* @tfm_entry: per-cpu pointer to one entry in TFM list
* @crypto: TIPC crypto owns this key
* @cloned: reference to the source key in case cloning
* @users: the number of the key users (TX/RX)
* @salt: the key's SALT value
* @authsize: authentication tag size (max = 16)
* @mode: crypto mode is applied to the key
* @hint: a hint for user key
* @rcu: struct rcu_head
* @key: the aead key
* @gen: the key's generation
* @seqno: the key seqno (cluster scope)
* @refcnt: the key reference counter
*/
struct tipc_aead {
#define TIPC_AEAD_HINT_LEN (5)
struct tipc_tfm * __percpu *tfm_entry;
struct tipc_crypto *crypto;
struct tipc_aead *cloned;
atomic_t users;
u32 salt;
u8 authsize;
u8 mode;
char hint[2 * TIPC_AEAD_HINT_LEN + 1];
struct rcu_head rcu;
struct tipc_aead_key *key;
u16 gen;
atomic64_t seqno ____cacheline_aligned;
refcount_t refcnt ____cacheline_aligned;
} ____cacheline_aligned;
/**
* struct tipc_crypto_stats - TIPC Crypto statistics
* @stat: array of crypto statistics
*/
struct tipc_crypto_stats {
unsigned int stat[MAX_STATS];
};
/**
* struct tipc_crypto - TIPC TX/RX crypto structure
* @net: struct net
* @node: TIPC node (RX)
* @aead: array of pointers to AEAD keys for encryption/decryption
* @peer_rx_active: replicated peer RX active key index
* @key_gen: TX/RX key generation
* @key: the key states
* @skey_mode: session key's mode
* @skey: received session key
* @wq: common workqueue on TX crypto
* @work: delayed work sched for TX/RX
* @key_distr: key distributing state
* @rekeying_intv: rekeying interval (in minutes)
Annotation
- Immediate include surface: `crypto/aead.h`, `crypto/aes.h`, `crypto/rng.h`, `crypto.h`, `msg.h`, `bcast.h`.
- Detected declarations: `struct tipc_key`, `struct tipc_tfm`, `struct tipc_aead`, `struct tipc_crypto_stats`, `struct tipc_crypto`, `struct tipc_crypto_tx_ctx`, `struct tipc_crypto_rx_ctx`, `function tipc_aead_key_validate`, `function tipc_aead_key_generate`, `function tipc_aead_put`.
- 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.