]> Pileus Git - ~andy/linux/blobdiff - include/crypto/hash.h
Merge tag 'v3.12-rc3' into irq/core
[~andy/linux] / include / crypto / hash.h
index 262861d8f0cb58a442c1ee62c2297c06233d67ed..26cb1eb16f4c0df0be234d081a419596fb081167 100644 (file)
@@ -31,6 +31,9 @@ struct ahash_request {
        struct scatterlist *src;
        u8 *result;
 
+       /* This field may only be used by the ahash API code. */
+       void *priv;
+
        void *__ctx[] CRYPTO_MINALIGN_ATTR;
 };
 
@@ -72,7 +75,8 @@ struct shash_alg {
        unsigned int descsize;
 
        /* These fields must match hash_alg_common. */
-       unsigned int digestsize;
+       unsigned int digestsize
+               __attribute__ ((aligned(__alignof__(struct hash_alg_common))));
        unsigned int statesize;
 
        struct crypto_alg base;
@@ -89,7 +93,6 @@ struct crypto_ahash {
        int (*setkey)(struct crypto_ahash *tfm, const u8 *key,
                      unsigned int keylen);
 
-       unsigned int digestsize;
        unsigned int reqsize;
        struct crypto_tfm base;
 };
@@ -137,7 +140,7 @@ static inline struct hash_alg_common *crypto_hash_alg_common(
 
 static inline unsigned int crypto_ahash_digestsize(struct crypto_ahash *tfm)
 {
-       return tfm->digestsize;
+       return crypto_hash_alg_common(tfm)->digestsize;
 }
 
 static inline unsigned int crypto_ahash_statesize(struct crypto_ahash *tfm)
@@ -176,16 +179,11 @@ static inline void *ahash_request_ctx(struct ahash_request *req)
        return req->__ctx;
 }
 
-static inline int crypto_ahash_setkey(struct crypto_ahash *tfm,
-                                     const u8 *key, unsigned int keylen)
-{
-       return tfm->setkey(tfm, key, keylen);
-}
-
-static inline int crypto_ahash_digest(struct ahash_request *req)
-{
-       return crypto_ahash_reqtfm(req)->digest(req);
-}
+int crypto_ahash_setkey(struct crypto_ahash *tfm, const u8 *key,
+                       unsigned int keylen);
+int crypto_ahash_finup(struct ahash_request *req);
+int crypto_ahash_final(struct ahash_request *req);
+int crypto_ahash_digest(struct ahash_request *req);
 
 static inline int crypto_ahash_export(struct ahash_request *req, void *out)
 {
@@ -207,11 +205,6 @@ static inline int crypto_ahash_update(struct ahash_request *req)
        return crypto_ahash_reqtfm(req)->update(req);
 }
 
-static inline int crypto_ahash_final(struct ahash_request *req)
-{
-       return crypto_ahash_reqtfm(req)->final(req);
-}
-
 static inline void ahash_request_set_tfm(struct ahash_request *req,
                                         struct crypto_ahash *tfm)
 {