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: hmac - Add export_core and import_core

Add export_import and import_core so that hmac can be used as a
fallback by block-only drivers.

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

+19
+19
crypto/hmac.c
··· 90 90 return crypto_shash_import(desc, in); 91 91 } 92 92 93 + static int hmac_export_core(struct shash_desc *pdesc, void *out) 94 + { 95 + struct shash_desc *desc = shash_desc_ctx(pdesc); 96 + 97 + return crypto_shash_export_core(desc, out); 98 + } 99 + 100 + static int hmac_import_core(struct shash_desc *pdesc, const void *in) 101 + { 102 + const struct hmac_ctx *tctx = crypto_shash_ctx(pdesc->tfm); 103 + struct shash_desc *desc = shash_desc_ctx(pdesc); 104 + 105 + desc->tfm = tctx->hash; 106 + return crypto_shash_import_core(desc, in); 107 + } 108 + 93 109 static int hmac_init(struct shash_desc *pdesc) 94 110 { 95 111 const struct hmac_ctx *tctx = crypto_shash_ctx(pdesc->tfm); ··· 193 177 return -ENOMEM; 194 178 spawn = shash_instance_ctx(inst); 195 179 180 + mask |= CRYPTO_AHASH_ALG_NO_EXPORT_CORE; 196 181 err = crypto_grab_shash(spawn, shash_crypto_instance(inst), 197 182 crypto_attr_alg_name(tb[1]), 0, mask); 198 183 if (err) ··· 228 211 inst->alg.finup = hmac_finup; 229 212 inst->alg.export = hmac_export; 230 213 inst->alg.import = hmac_import; 214 + inst->alg.export_core = hmac_export_core; 215 + inst->alg.import_core = hmac_import_core; 231 216 inst->alg.setkey = hmac_setkey; 232 217 inst->alg.init_tfm = hmac_init_tfm; 233 218 inst->alg.clone_tfm = hmac_clone_tfm;