net/rxrpc/rxkad.c
Source file repositories/reference/linux-study-clean/net/rxrpc/rxkad.c
File Facts
- System
- Linux kernel
- Corpus path
net/rxrpc/rxkad.c- Extension
.c- Size
- 29091 bytes
- Lines
- 1142
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/des.hkunit/visibility.hlinux/export.hlinux/fips.hlinux/module.hlinux/net.hlinux/skbuff.hlinux/udp.hlinux/ctype.hlinux/slab.hlinux/key-type.hlinux/unaligned.hnet/sock.hnet/af_rxrpc.hkeys/rxrpc-type.har-internal.h
Detected Declarations
struct rxkad_level1_hdrstruct rxkad_level2_hdrfunction rxkad_preparse_server_keyfunction rxkad_free_preparse_server_keyfunction rxkad_destroy_server_keyfunction rxkad_init_connection_securityfunction rxkad_prime_packet_securityfunction rxkad_free_call_cryptofunction packetfunction rxkad_secure_packetfunction packetfunction packetfunction receivedfunction rxkad_issue_challengefunction rxkad_calc_response_checksumfunction rxkad_validate_challengefunction rxkad_insert_response_headerfunction rxkad_respond_to_challengefunction rxkad_sendmsg_respond_to_challengefunction rxkad_kernel_respond_to_challengefunction des_pcbc_decrypt_inplacefunction rxkad_decrypt_ticketfunction rxkad_decrypt_responsefunction rxkad_verify_responsefunction rxkad_clearfunction rxkad_initfunction rxkad_exitexport rxkad_kernel_respond_to_challenge
Annotated Snippet
struct rxkad_level1_hdr {
__be32 data_size; /* true data size (excluding padding) */
};
struct rxkad_level2_hdr {
__be32 data_size; /* true data size (excluding padding) */
__be32 checksum; /* decrypted data checksum */
};
static void rxkad_prime_packet_security(struct rxrpc_connection *conn,
const struct fcrypt_key *cipher);
/*
* Parse the information from a server key
*
* The data should be the 8-byte secret key.
*/
static int rxkad_preparse_server_key(struct key_preparsed_payload *prep)
{
struct des_ctx *des_key;
int err;
if (prep->datalen != 8)
return -EINVAL;
memcpy(&prep->payload.data[2], prep->data, 8);
des_key = kmalloc_obj(*des_key);
if (!des_key) {
_leave(" = -ENOMEM");
return -ENOMEM;
}
err = des_expand_key(des_key, prep->data, 8);
if (err) {
kfree_sensitive(des_key);
_leave(" = %d", err);
return err;
}
prep->payload.data[0] = des_key;
_leave(" = 0");
return 0;
}
static void rxkad_free_preparse_server_key(struct key_preparsed_payload *prep)
{
kfree_sensitive(prep->payload.data[0]);
}
static void rxkad_destroy_server_key(struct key *key)
{
kfree_sensitive(key->payload.data[0]);
key->payload.data[0] = NULL;
}
/*
* initialise connection security
*/
static int rxkad_init_connection_security(struct rxrpc_connection *conn,
struct rxrpc_key_token *token)
{
struct fcrypt_key *ci;
int ret;
_enter("{%d},{%x}", conn->debug_id, key_serial(conn->key));
conn->security_ix = token->security_index;
ci = kmalloc_obj(*ci);
if (!ci) {
ret = -ENOMEM;
goto error;
}
fcrypt_preparekey(ci, token->kad->session_key);
switch (conn->security_level) {
case RXRPC_SECURITY_PLAIN:
case RXRPC_SECURITY_AUTH:
case RXRPC_SECURITY_ENCRYPT:
break;
default:
ret = -EKEYREJECTED;
goto error_ci;
}
rxkad_prime_packet_security(conn, ci);
conn->rxkad.cipher = ci;
return 0;
Annotation
- Immediate include surface: `crypto/des.h`, `kunit/visibility.h`, `linux/export.h`, `linux/fips.h`, `linux/module.h`, `linux/net.h`, `linux/skbuff.h`, `linux/udp.h`.
- Detected declarations: `struct rxkad_level1_hdr`, `struct rxkad_level2_hdr`, `function rxkad_preparse_server_key`, `function rxkad_free_preparse_server_key`, `function rxkad_destroy_server_key`, `function rxkad_init_connection_security`, `function rxkad_prime_packet_security`, `function rxkad_free_call_crypto`, `function packet`, `function rxkad_secure_packet`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration 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.