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: ahash - Set default reqsize from ahash_alg

Add a reqsize field to struct ahash_alg and use it to set the
default reqsize so that algorithms with a static reqsize are
not forced to create an init_tfm function.

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

+7
+4
crypto/ahash.c
··· 879 879 struct ahash_alg *alg = crypto_ahash_alg(hash); 880 880 881 881 crypto_ahash_set_statesize(hash, alg->halg.statesize); 882 + crypto_ahash_set_reqsize(hash, alg->reqsize); 882 883 883 884 if (tfm->__crt_alg->cra_type == &crypto_shash_type) 884 885 return crypto_init_ahash_using_shash(tfm); ··· 1043 1042 int err; 1044 1043 1045 1044 if (alg->halg.statesize == 0) 1045 + return -EINVAL; 1046 + 1047 + if (alg->reqsize && alg->reqsize < alg->halg.statesize) 1046 1048 return -EINVAL; 1047 1049 1048 1050 err = hash_prepare_alg(&alg->halg);
+3
include/crypto/hash.h
··· 135 135 * This is a counterpart to @init_tfm, used to remove 136 136 * various changes set in @init_tfm. 137 137 * @clone_tfm: Copy transform into new object, may allocate memory. 138 + * @reqsize: Size of the request context. 138 139 * @halg: see struct hash_alg_common 139 140 */ 140 141 struct ahash_alg { ··· 151 150 int (*init_tfm)(struct crypto_ahash *tfm); 152 151 void (*exit_tfm)(struct crypto_ahash *tfm); 153 152 int (*clone_tfm)(struct crypto_ahash *dst, struct crypto_ahash *src); 153 + 154 + unsigned int reqsize; 154 155 155 156 struct hash_alg_common halg; 156 157 };