Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Hash algorithms.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (c) 2008 Herbert Xu <herbert@gondor.apana.org.au>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #ifndef _CRYPTO_INTERNAL_HASH_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #define _CRYPTO_INTERNAL_HASH_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <crypto/algapi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <crypto/hash.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) struct ahash_request;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) struct scatterlist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) struct crypto_hash_walk {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 	char *data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	unsigned int offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	unsigned int alignmask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	struct page *pg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	unsigned int entrylen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	unsigned int total;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	struct scatterlist *sg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	unsigned int flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) struct ahash_instance {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	void (*free)(struct ahash_instance *inst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 			char head[offsetof(struct ahash_alg, halg.base)];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 			struct crypto_instance base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 		} s;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 		struct ahash_alg alg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) struct shash_instance {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	void (*free)(struct shash_instance *inst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 			char head[offsetof(struct shash_alg, base)];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 			struct crypto_instance base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 		} s;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 		struct shash_alg alg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) struct crypto_ahash_spawn {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	struct crypto_spawn base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) struct crypto_shash_spawn {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	struct crypto_spawn base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) int crypto_hash_walk_first(struct ahash_request *req,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 			   struct crypto_hash_walk *walk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) static inline int crypto_hash_walk_last(struct crypto_hash_walk *walk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	return !(walk->entrylen | walk->total);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) int crypto_register_ahash(struct ahash_alg *alg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) void crypto_unregister_ahash(struct ahash_alg *alg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) int crypto_register_ahashes(struct ahash_alg *algs, int count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) void crypto_unregister_ahashes(struct ahash_alg *algs, int count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) int ahash_register_instance(struct crypto_template *tmpl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 			    struct ahash_instance *inst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) bool crypto_shash_alg_has_setkey(struct shash_alg *alg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) static inline bool crypto_shash_alg_needs_key(struct shash_alg *alg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	return crypto_shash_alg_has_setkey(alg) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		!(alg->base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) bool crypto_hash_alg_has_setkey(struct hash_alg_common *halg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) int crypto_grab_ahash(struct crypto_ahash_spawn *spawn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 		      struct crypto_instance *inst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 		      const char *name, u32 type, u32 mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) static inline void crypto_drop_ahash(struct crypto_ahash_spawn *spawn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	crypto_drop_spawn(&spawn->base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) static inline struct hash_alg_common *crypto_spawn_ahash_alg(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	struct crypto_ahash_spawn *spawn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	return __crypto_hash_alg_common(spawn->base.alg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) int crypto_register_shash(struct shash_alg *alg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) void crypto_unregister_shash(struct shash_alg *alg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) int crypto_register_shashes(struct shash_alg *algs, int count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) void crypto_unregister_shashes(struct shash_alg *algs, int count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) int shash_register_instance(struct crypto_template *tmpl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 			    struct shash_instance *inst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) void shash_free_singlespawn_instance(struct shash_instance *inst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) int crypto_grab_shash(struct crypto_shash_spawn *spawn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		      struct crypto_instance *inst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		      const char *name, u32 type, u32 mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) static inline void crypto_drop_shash(struct crypto_shash_spawn *spawn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	crypto_drop_spawn(&spawn->base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) static inline struct shash_alg *crypto_spawn_shash_alg(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	struct crypto_shash_spawn *spawn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	return __crypto_shash_alg(spawn->base.alg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) int shash_ahash_update(struct ahash_request *req, struct shash_desc *desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) int shash_ahash_finup(struct ahash_request *req, struct shash_desc *desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) int crypto_init_shash_ops_async(struct crypto_tfm *tfm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	return crypto_tfm_ctx(crypto_ahash_tfm(tfm));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) static inline struct ahash_alg *__crypto_ahash_alg(struct crypto_alg *alg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	return container_of(__crypto_hash_alg_common(alg), struct ahash_alg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 			    halg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) static inline void crypto_ahash_set_reqsize(struct crypto_ahash *tfm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 					    unsigned int reqsize)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	tfm->reqsize = reqsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) static inline struct crypto_instance *ahash_crypto_instance(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	struct ahash_instance *inst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	return &inst->s.base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) static inline struct ahash_instance *ahash_instance(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	struct crypto_instance *inst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	return container_of(inst, struct ahash_instance, s.base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) static inline struct ahash_instance *ahash_alg_instance(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	struct crypto_ahash *ahash)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	return ahash_instance(crypto_tfm_alg_instance(&ahash->base));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) static inline void *ahash_instance_ctx(struct ahash_instance *inst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	return crypto_instance_ctx(ahash_crypto_instance(inst));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) static inline void ahash_request_complete(struct ahash_request *req, int err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	req->base.complete(&req->base, err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) static inline u32 ahash_request_flags(struct ahash_request *req)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	return req->base.flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) static inline struct crypto_ahash *crypto_spawn_ahash(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	struct crypto_ahash_spawn *spawn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	return crypto_spawn_tfm2(&spawn->base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) static inline int ahash_enqueue_request(struct crypto_queue *queue,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 					     struct ahash_request *request)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	return crypto_enqueue_request(queue, &request->base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) static inline struct ahash_request *ahash_dequeue_request(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	struct crypto_queue *queue)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	return ahash_request_cast(crypto_dequeue_request(queue));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) static inline void *crypto_shash_ctx(struct crypto_shash *tfm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	return crypto_tfm_ctx(&tfm->base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) static inline struct crypto_instance *shash_crypto_instance(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	struct shash_instance *inst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	return &inst->s.base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) static inline struct shash_instance *shash_instance(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	struct crypto_instance *inst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	return container_of(inst, struct shash_instance, s.base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) static inline struct shash_instance *shash_alg_instance(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	struct crypto_shash *shash)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	return shash_instance(crypto_tfm_alg_instance(&shash->base));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) static inline void *shash_instance_ctx(struct shash_instance *inst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	return crypto_instance_ctx(shash_crypto_instance(inst));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) static inline struct crypto_shash *crypto_spawn_shash(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	struct crypto_shash_spawn *spawn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	return crypto_spawn_tfm2(&spawn->base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) static inline void *crypto_shash_ctx_aligned(struct crypto_shash *tfm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	return crypto_tfm_ctx_aligned(&tfm->base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) static inline struct crypto_shash *__crypto_shash_cast(struct crypto_tfm *tfm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	return container_of(tfm, struct crypto_shash, base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) #endif	/* _CRYPTO_INTERNAL_HASH_H */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)