]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - include/crypto/hash.h
crypto: shash - Add init_tfm/exit_tfm and verify descsize
[linux.git] / include / crypto / hash.h
index fe7f73bad1e2be2b7d2aee72a0ef8bda015d36db..cee446c59497c610c4c72398b615424ecc13b8bf 100644 (file)
@@ -169,6 +169,17 @@ struct shash_desc {
  * @export: see struct ahash_alg
  * @import: see struct ahash_alg
  * @setkey: see struct ahash_alg
+ * @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.
  * @digestsize: see struct ahash_alg
  * @statesize: see struct ahash_alg
  * @descsize: Size of the operational state for the message digest. This state
@@ -189,6 +200,8 @@ struct shash_alg {
        int (*import)(struct shash_desc *desc, const void *in);
        int (*setkey)(struct crypto_shash *tfm, const u8 *key,
                      unsigned int keylen);
+       int (*init_tfm)(struct crypto_shash *tfm);
+       void (*exit_tfm)(struct crypto_shash *tfm);
 
        unsigned int descsize;