crypto: ahash - Add unaligned handling and default operations
This patch exports the finup operation where available and adds
a default finup operation for ahash. The operations final, finup
and digest also will now deal with unaligned result pointers by
copying it. Finally export/import operations are will now be
exported too.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index 45c2bdd..3e89ce1 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -31,6 +31,9 @@
struct scatterlist *src;
u8 *result;
+ /* This field may only be used by the ahash API code. */
+ void *priv;
+
void *__ctx[] CRYPTO_MINALIGN_ATTR;
};
@@ -175,16 +178,11 @@
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)
{
@@ -206,11 +204,6 @@
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)
{