include/crypto/kpp.h
Source file repositories/reference/linux-study-clean/include/crypto/kpp.h
File Facts
- System
- Linux kernel
- Corpus path
include/crypto/kpp.h- Extension
.h- Size
- 9762 bytes
- Lines
- 351
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- 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
linux/atomic.hlinux/container_of.hlinux/crypto.hlinux/slab.h
Detected Declarations
struct kpp_requeststruct crypto_kppstruct kpp_algstruct kpp_secretfunction crypto_kpp_reqsizefunction kpp_request_set_tfmfunction crypto_kpp_get_flagsfunction crypto_kpp_set_flagsfunction crypto_free_kppfunction kpp_request_allocfunction kpp_request_freefunction kpp_request_set_callbackfunction kpp_request_set_inputfunction kpp_request_set_outputfunction crypto_kpp_set_secretfunction crypto_kpp_generate_public_keyfunction crypto_kpp_compute_shared_secretfunction crypto_kpp_maxsize
Annotated Snippet
struct kpp_request {
struct crypto_async_request base;
struct scatterlist *src;
struct scatterlist *dst;
unsigned int src_len;
unsigned int dst_len;
void *__ctx[] CRYPTO_MINALIGN_ATTR;
};
/**
* struct crypto_kpp - user-instantiated object which encapsulate
* algorithms and core processing logic
*
* @reqsize: Request context size required by algorithm
* implementation
* @base: Common crypto API algorithm data structure
*/
struct crypto_kpp {
unsigned int reqsize;
struct crypto_tfm base;
};
/**
* struct kpp_alg - generic key-agreement protocol primitives
*
* @set_secret: Function invokes the protocol specific function to
* store the secret private key along with parameters.
* The implementation knows how to decode the buffer
* @generate_public_key: Function generate the public key to be sent to the
* counterpart. In case of error, where output is not big
* enough req->dst_len will be updated to the size
* required
* @compute_shared_secret: Function compute the shared secret as defined by
* the algorithm. The result is given back to the user.
* In case of error, where output is not big enough,
* req->dst_len will be updated to the size required
* @max_size: Function returns the size of the output buffer
* @init: Initialize the object. This is called only once at
* instantiation time. In case the cryptographic hardware
* needs to be initialized. Software fallback should be
* put in place here.
* @exit: Undo everything @init did.
*
* @base: Common crypto API algorithm data structure
*/
struct kpp_alg {
int (*set_secret)(struct crypto_kpp *tfm, const void *buffer,
unsigned int len);
int (*generate_public_key)(struct kpp_request *req);
int (*compute_shared_secret)(struct kpp_request *req);
unsigned int (*max_size)(struct crypto_kpp *tfm);
int (*init)(struct crypto_kpp *tfm);
void (*exit)(struct crypto_kpp *tfm);
struct crypto_alg base;
};
/**
* DOC: Generic Key-agreement Protocol Primitives API
*
* The KPP API is used with the algorithm type
* CRYPTO_ALG_TYPE_KPP (listed as type "kpp" in /proc/crypto)
*/
/**
* crypto_alloc_kpp() - allocate KPP tfm handle
* @alg_name: is the name of the kpp algorithm (e.g. "dh", "ecdh")
* @type: specifies the type of the algorithm
* @mask: specifies the mask for the algorithm
*
* Allocate a handle for kpp algorithm. The returned struct crypto_kpp
* is required for any following API invocation
*
* Return: allocated handle in case of success; IS_ERR() is true in case of
* an error, PTR_ERR() returns the error code.
*/
struct crypto_kpp *crypto_alloc_kpp(const char *alg_name, u32 type, u32 mask);
int crypto_has_kpp(const char *alg_name, u32 type, u32 mask);
static inline struct crypto_tfm *crypto_kpp_tfm(struct crypto_kpp *tfm)
{
return &tfm->base;
}
static inline struct kpp_alg *__crypto_kpp_alg(struct crypto_alg *alg)
{
Annotation
- Immediate include surface: `linux/atomic.h`, `linux/container_of.h`, `linux/crypto.h`, `linux/slab.h`.
- Detected declarations: `struct kpp_request`, `struct crypto_kpp`, `struct kpp_alg`, `struct kpp_secret`, `function crypto_kpp_reqsize`, `function kpp_request_set_tfm`, `function crypto_kpp_get_flags`, `function crypto_kpp_set_flags`, `function crypto_free_kpp`, `function kpp_request_alloc`.
- Atlas domain: Repository Root And Misc / include.
- 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.