include/crypto/sig.h
Source file repositories/reference/linux-study-clean/include/crypto/sig.h
File Facts
- System
- Linux kernel
- Corpus path
include/crypto/sig.h- Extension
.h- Size
- 8452 bytes
- Lines
- 266
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/crypto.h
Detected Declarations
struct crypto_sigstruct sig_algfunction crypto_free_sigfunction crypto_sig_keysizefunction crypto_sig_digestsizefunction crypto_sig_maxsizefunction crypto_sig_signfunction crypto_sig_verifyfunction crypto_sig_set_pubkeyfunction crypto_sig_set_privkey
Annotated Snippet
struct crypto_sig {
struct crypto_tfm base;
};
/**
* struct sig_alg - generic public key signature algorithm
*
* @sign: Function performs a sign operation as defined by public key
* algorithm. On success, the signature size is returned.
* Optional.
* @verify: Function performs a complete verify operation as defined by
* public key algorithm, returning verification status. Optional.
* @set_pub_key: Function invokes the algorithm specific set public key
* function, which knows how to decode and interpret
* the BER encoded public key and parameters. Mandatory.
* @set_priv_key: Function invokes the algorithm specific set private key
* function, which knows how to decode and interpret
* the BER encoded private key and parameters. Optional.
* @key_size: Function returns key size. Mandatory.
* @digest_size: Function returns maximum digest size. Optional.
* @max_size: Function returns maximum signature size. Optional.
* @init: Initialize the cryptographic transformation object.
* This function is used to initialize the cryptographic
* transformation object. This function is called only once at
* the instantiation time, right after the transformation context
* was allocated. In case the cryptographic hardware has some
* special requirements which need to be handled by software, this
* function shall check for the precise requirement of the
* transformation and put any software fallbacks in place.
* @exit: Deinitialize the cryptographic transformation object. This is a
* counterpart to @init, used to remove various changes set in
* @init.
*
* @base: Common crypto API algorithm data structure
*/
struct sig_alg {
int (*sign)(struct crypto_sig *tfm,
const void *src, unsigned int slen,
void *dst, unsigned int dlen);
int (*verify)(struct crypto_sig *tfm,
const void *src, unsigned int slen,
const void *digest, unsigned int dlen);
int (*set_pub_key)(struct crypto_sig *tfm,
const void *key, unsigned int keylen);
int (*set_priv_key)(struct crypto_sig *tfm,
const void *key, unsigned int keylen);
unsigned int (*key_size)(struct crypto_sig *tfm);
unsigned int (*digest_size)(struct crypto_sig *tfm);
unsigned int (*max_size)(struct crypto_sig *tfm);
int (*init)(struct crypto_sig *tfm);
void (*exit)(struct crypto_sig *tfm);
struct crypto_alg base;
};
/**
* DOC: Generic Public Key Signature API
*
* The Public Key Signature API is used with the algorithms of type
* CRYPTO_ALG_TYPE_SIG (listed as type "sig" in /proc/crypto)
*/
/**
* crypto_alloc_sig() - allocate signature tfm handle
* @alg_name: is the cra_name / name or cra_driver_name / driver name of the
* signing algorithm e.g. "ecdsa"
* @type: specifies the type of the algorithm
* @mask: specifies the mask for the algorithm
*
* Allocate a handle for public key signature algorithm. The returned struct
* crypto_sig is the handle that is required for any subsequent
* API invocation for signature operations.
*
* Return: allocated handle in case of success; IS_ERR() is true in case
* of an error, PTR_ERR() returns the error code.
*/
struct crypto_sig *crypto_alloc_sig(const char *alg_name, u32 type, u32 mask);
static inline struct crypto_tfm *crypto_sig_tfm(struct crypto_sig *tfm)
{
return &tfm->base;
}
static inline struct crypto_sig *__crypto_sig_tfm(struct crypto_tfm *tfm)
{
return container_of(tfm, struct crypto_sig, base);
}
static inline struct sig_alg *__crypto_sig_alg(struct crypto_alg *alg)
{
Annotation
- Immediate include surface: `linux/crypto.h`.
- Detected declarations: `struct crypto_sig`, `struct sig_alg`, `function crypto_free_sig`, `function crypto_sig_keysize`, `function crypto_sig_digestsize`, `function crypto_sig_maxsize`, `function crypto_sig_sign`, `function crypto_sig_verify`, `function crypto_sig_set_pubkey`, `function crypto_sig_set_privkey`.
- 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.