include/crypto/internal/hash.h

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

File Facts

System
Linux kernel
Corpus path
include/crypto/internal/hash.h
Extension
.h
Size
11398 bytes
Lines
406
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 crypto_hash_walk {
	const char *data;

	unsigned int offset;
	unsigned int flags;

	struct page *pg;
	unsigned int entrylen;

	unsigned int total;
	struct scatterlist *sg;
};

struct ahash_instance {
	void (*free)(struct ahash_instance *inst);
	union {
		struct {
			char head[offsetof(struct ahash_alg, halg.base)];
			struct crypto_instance base;
		} s;
		struct ahash_alg alg;
	};
};

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

struct crypto_ahash_spawn {
	struct crypto_spawn base;
};

struct crypto_shash_spawn {
	struct crypto_spawn base;
};

int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err);
int crypto_hash_walk_first(struct ahash_request *req,
			   struct crypto_hash_walk *walk);

static inline int crypto_hash_walk_last(struct crypto_hash_walk *walk)
{
	return !(walk->entrylen | walk->total);
}

int crypto_register_ahash(struct ahash_alg *alg);
void crypto_unregister_ahash(struct ahash_alg *alg);
int crypto_register_ahashes(struct ahash_alg *algs, int count);
void crypto_unregister_ahashes(struct ahash_alg *algs, int count);
int ahash_register_instance(struct crypto_template *tmpl,
			    struct ahash_instance *inst);
void ahash_free_singlespawn_instance(struct ahash_instance *inst);

int shash_no_setkey(struct crypto_shash *tfm, const u8 *key,
		    unsigned int keylen);

static inline bool crypto_shash_alg_has_setkey(struct shash_alg *alg)
{
	return alg->setkey != shash_no_setkey;
}

bool crypto_hash_alg_has_setkey(struct hash_alg_common *halg);

static inline bool crypto_shash_alg_needs_key(struct shash_alg *alg)
{
	return crypto_shash_alg_has_setkey(alg) &&
		!(alg->base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY);
}

static inline bool crypto_hash_alg_needs_key(struct hash_alg_common *alg)
{
	return crypto_hash_alg_has_setkey(alg) &&
		!(alg->base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY);
}

static inline bool crypto_hash_no_export_core(struct crypto_ahash *tfm)
{
	return crypto_hash_alg_common(tfm)->base.cra_flags &
	       CRYPTO_AHASH_ALG_NO_EXPORT_CORE;
}

int crypto_grab_ahash(struct crypto_ahash_spawn *spawn,
		      struct crypto_instance *inst,

Annotation

Implementation Notes