Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: hash - Add statesize to crypto_ahash

As ahash drivers may need to use fallbacks, their state size
is thus variable. Deal with this by making it an attribute
of crypto_ahash.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

+11 -1
+3
crypto/ahash.c
··· 432 432 433 433 hash->setkey = ahash_nosetkey; 434 434 435 + crypto_ahash_set_statesize(hash, alg->halg.statesize); 436 + 435 437 if (tfm->__crt_alg->cra_type != &crypto_ahash_type) 436 438 return crypto_init_shash_ops_async(tfm); 437 439 ··· 575 573 nhash->import = hash->import; 576 574 nhash->setkey = hash->setkey; 577 575 nhash->reqsize = hash->reqsize; 576 + nhash->statesize = hash->statesize; 578 577 579 578 if (tfm->__crt_alg->cra_type != &crypto_ahash_type) 580 579 return crypto_clone_shash_ops_async(nhash, hash);
+2 -1
include/crypto/hash.h
··· 260 260 int (*setkey)(struct crypto_ahash *tfm, const u8 *key, 261 261 unsigned int keylen); 262 262 263 + unsigned int statesize; 263 264 unsigned int reqsize; 264 265 struct crypto_tfm base; 265 266 }; ··· 401 400 */ 402 401 static inline unsigned int crypto_ahash_statesize(struct crypto_ahash *tfm) 403 402 { 404 - return crypto_hash_alg_common(tfm)->statesize; 403 + return tfm->statesize; 405 404 } 406 405 407 406 static inline u32 crypto_ahash_get_flags(struct crypto_ahash *tfm)
+6
include/crypto/internal/hash.h
··· 149 149 halg); 150 150 } 151 151 152 + static inline void crypto_ahash_set_statesize(struct crypto_ahash *tfm, 153 + unsigned int size) 154 + { 155 + tfm->statesize = size; 156 + } 157 + 152 158 static inline void crypto_ahash_set_reqsize(struct crypto_ahash *tfm, 153 159 unsigned int reqsize) 154 160 {