include/crypto/internal/kpp.h

Source file repositories/reference/linux-study-clean/include/crypto/internal/kpp.h

File Facts

System
Linux kernel
Corpus path
include/crypto/internal/kpp.h
Extension
.h
Size
7206 bytes
Lines
246
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct kpp_instance {
	void (*free)(struct kpp_instance *inst);
	union {
		struct {
			char head[offsetof(struct kpp_alg, base)];
			struct crypto_instance base;
		} s;
		struct kpp_alg alg;
	};
};

/**
 * struct crypto_kpp_spawn - KPP algorithm spawn
 * @base: Internal. Generic crypto core spawn state.
 *
 * Template instances can get a hold on some inner KPP algorithm by
 * binding a &struct crypto_kpp_spawn via
 * crypto_grab_kpp(). Transforms may subsequently get instantiated
 * from the referenced inner &struct kpp_alg by means of
 * crypto_spawn_kpp().
 */
struct crypto_kpp_spawn {
	struct crypto_spawn base;
};

/*
 * Transform internal helpers.
 */
static inline void *kpp_request_ctx(struct kpp_request *req)
{
	return req->__ctx;
}

static inline void *kpp_request_ctx_dma(struct kpp_request *req)
{
	unsigned int align = crypto_dma_align();

	if (align <= crypto_tfm_ctx_alignment())
		align = 1;

	return PTR_ALIGN(kpp_request_ctx(req), align);
}

static inline void kpp_set_reqsize(struct crypto_kpp *kpp,
				   unsigned int reqsize)
{
	kpp->reqsize = reqsize;
}

static inline void kpp_set_reqsize_dma(struct crypto_kpp *kpp,
				       unsigned int reqsize)
{
	reqsize += crypto_dma_align() & ~(crypto_tfm_ctx_alignment() - 1);
	kpp->reqsize = reqsize;
}

static inline void *kpp_tfm_ctx(struct crypto_kpp *tfm)
{
	return crypto_tfm_ctx(&tfm->base);
}

static inline void *kpp_tfm_ctx_dma(struct crypto_kpp *tfm)
{
	return crypto_tfm_ctx_dma(&tfm->base);
}

static inline void kpp_request_complete(struct kpp_request *req, int err)
{
	crypto_request_complete(&req->base, err);
}

static inline const char *kpp_alg_name(struct crypto_kpp *tfm)
{
	return crypto_kpp_tfm(tfm)->__crt_alg->cra_name;
}

/*
 * Template instance internal helpers.
 */
/**
 * kpp_crypto_instance() - Cast a &struct kpp_instance to the corresponding
 *                         generic &struct crypto_instance.
 * @inst: Pointer to the &struct kpp_instance to be cast.
 * Return: A pointer to the &struct crypto_instance embedded in @inst.
 */
static inline struct crypto_instance *kpp_crypto_instance(
	struct kpp_instance *inst)
{
	return &inst->s.base;
}

Annotation

Implementation Notes