crypto: ahash - Convert to new style algorithms
[firefly-linux-kernel-4.4.55.git] / include / crypto / internal / hash.h
index 6cc824b79331f8e4dc36a33d3d4cb6533f775fee..08bdffafefad24bd7b05d2476aab07e3f652631d 100644 (file)
@@ -51,26 +51,43 @@ int crypto_hash_walk_first_compat(struct hash_desc *hdesc,
                                  struct crypto_hash_walk *walk,
                                  struct scatterlist *sg, unsigned int len);
 
+int crypto_register_ahash(struct ahash_alg *alg);
+int crypto_unregister_ahash(struct ahash_alg *alg);
+
 int crypto_register_shash(struct shash_alg *alg);
 int crypto_unregister_shash(struct shash_alg *alg);
-
+int shash_register_instance(struct crypto_template *tmpl,
+                           struct shash_instance *inst);
 void shash_free_instance(struct crypto_instance *inst);
 
 int crypto_init_shash_spawn(struct crypto_shash_spawn *spawn,
                            struct shash_alg *alg,
                            struct crypto_instance *inst);
 
+struct shash_alg *shash_attr_alg(struct rtattr *rta, u32 type, u32 mask);
+
+int shash_ahash_update(struct ahash_request *req, struct shash_desc *desc);
+int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc);
+
+int crypto_init_shash_ops_async(struct crypto_tfm *tfm);
+
 static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm)
 {
-       return crypto_tfm_ctx(&tfm->base);
+       return crypto_tfm_ctx(crypto_ahash_tfm(tfm));
 }
 
-static inline struct ahash_alg *crypto_ahash_alg(
+static inline struct old_ahash_alg *crypto_old_ahash_alg(
        struct crypto_ahash *tfm)
 {
        return &crypto_ahash_tfm(tfm)->__crt_alg->cra_ahash;
 }
 
+static inline void crypto_ahash_set_reqsize(struct crypto_ahash *tfm,
+                                           unsigned int reqsize)
+{
+       tfm->reqsize = reqsize;
+}
+
 static inline int ahash_enqueue_request(struct crypto_queue *queue,
                                             struct ahash_request *request)
 {
@@ -107,6 +124,11 @@ static inline struct shash_instance *shash_instance(
                            struct shash_instance, alg);
 }
 
+static inline void *shash_instance_ctx(struct shash_instance *inst)
+{
+       return crypto_instance_ctx(shash_crypto_instance(inst));
+}
+
 static inline struct shash_instance *shash_alloc_instance(
        const char *name, struct crypto_alg *alg)
 {
@@ -120,5 +142,15 @@ static inline struct crypto_shash *crypto_spawn_shash(
        return crypto_spawn_tfm2(&spawn->base);
 }
 
+static inline void *crypto_shash_ctx_aligned(struct crypto_shash *tfm)
+{
+       return crypto_tfm_ctx_aligned(&tfm->base);
+}
+
+static inline struct crypto_shash *__crypto_shash_cast(struct crypto_tfm *tfm)
+{
+       return container_of(tfm, struct crypto_shash, base);
+}
+
 #endif /* _CRYPTO_INTERNAL_HASH_H */