aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2020-08-18 18:25:34 +1000
committerHerbert Xu <herbert@gondor.apana.org.au>2020-08-28 16:58:28 +1000
commite73d340db6448013ac219d105654d2b9868a8dd2 (patch)
tree2b14a7315bba9263ac5ff9f92528b86436318afb /include/crypto
parentcrypto: arm/curve25519 - include <linux/scatterlist.h> (diff)
downloadlinux-dev-e73d340db6448013ac219d105654d2b9868a8dd2.tar.xz
linux-dev-e73d340db6448013ac219d105654d2b9868a8dd2.zip
crypto: ahash - Add init_tfm/exit_tfm
This patch adds the type-safe init_tfm/exit_tfm functions to the ahash interface. This is meant to replace the unsafe cra_init and cra_exit interface. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto')
-rw-r--r--include/crypto/hash.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index 0d1b403888c9..a2563a59fadd 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -123,6 +123,17 @@ struct ahash_request {
* data so the transformation can continue from this point onward. No
* data processing happens at this point. Driver must not use
* req->result.
+ * @init_tfm: Initialize the cryptographic transformation object.
+ * This function is called only once at the instantiation
+ * time, right after the transformation context was
+ * allocated. In case the cryptographic hardware has
+ * some special requirements which need to be handled
+ * by software, this function shall check for the precise
+ * requirement of the transformation and put any software
+ * fallbacks in place.
+ * @exit_tfm: Deinitialize the cryptographic transformation object.
+ * This is a counterpart to @init_tfm, used to remove
+ * various changes set in @init_tfm.
* @halg: see struct hash_alg_common
*/
struct ahash_alg {
@@ -135,6 +146,8 @@ struct ahash_alg {
int (*import)(struct ahash_request *req, const void *in);
int (*setkey)(struct crypto_ahash *tfm, const u8 *key,
unsigned int keylen);
+ int (*init_tfm)(struct crypto_ahash *tfm);
+ void (*exit_tfm)(struct crypto_ahash *tfm);
struct hash_alg_common halg;
};