From: Steffen Klassert <steffen.klassert@secunet.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-crypto@vger.kernel.org
Subject: [RFC] [PATCH 1/3] crypto: ahash - Add some helper functions
Date: Tue, 7 Jul 2009 09:24:51 +0200 [thread overview]
Message-ID: <20090707072451.GD20288@secunet.com> (raw)
In-Reply-To: <20090707072343.GC20288@secunet.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
include/crypto/hash.h | 25 +++++++++++++++++++++++++
include/crypto/internal/hash.h | 5 +++++
2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index d56bb71..bd473a0 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -14,6 +14,7 @@
#define _CRYPTO_HASH_H
#include <linux/crypto.h>
+#include <crypto/algapi.h>
struct shash_desc {
struct crypto_shash *tfm;
@@ -54,6 +55,15 @@ static inline struct crypto_ahash *__crypto_ahash_cast(struct crypto_tfm *tfm)
return (struct crypto_ahash *)tfm;
}
+static inline struct crypto_ahash *crypto_spawn_ahash(
+ struct crypto_spawn *spawn)
+{
+ u32 type = CRYPTO_ALG_TYPE_AHASH;
+ u32 mask = CRYPTO_ALG_TYPE_AHASH_MASK;
+
+ return __crypto_ahash_cast(crypto_spawn_tfm(spawn, type, mask));
+}
+
static inline struct crypto_ahash *crypto_alloc_ahash(const char *alg_name,
u32 type, u32 mask)
{
@@ -86,6 +96,11 @@ static inline struct ahash_tfm *crypto_ahash_crt(struct crypto_ahash *tfm)
return &crypto_ahash_tfm(tfm)->crt_ahash;
}
+static inline unsigned int crypto_ahash_blocksize(struct crypto_ahash *tfm)
+{
+ return crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm));
+}
+
static inline unsigned int crypto_ahash_digestsize(struct crypto_ahash *tfm)
{
return crypto_ahash_crt(tfm)->digestsize;
@@ -162,6 +177,16 @@ static inline int crypto_ahash_final(struct ahash_request *req)
return crt->final(req);
}
+static inline void ahash_request_complete(struct ahash_request *req, int err)
+{
+ req->base.complete(&req->base, err);
+}
+
+static inline u32 ahash_request_flags(struct ahash_request *req)
+{
+ return req->base.flags;
+}
+
static inline void ahash_request_set_tfm(struct ahash_request *req,
struct crypto_ahash *tfm)
{
diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h
index 82b7056..bbcc076 100644
--- a/include/crypto/internal/hash.h
+++ b/include/crypto/internal/hash.h
@@ -51,6 +51,11 @@ static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm)
return crypto_tfm_ctx(&tfm->base);
}
+static inline void *crypto_ahash_ctx_aligned(struct crypto_ahash *tfm)
+{
+ return crypto_tfm_ctx_aligned(&tfm->base);
+}
+
static inline struct ahash_alg *crypto_ahash_alg(
struct crypto_ahash *tfm)
{
--
1.5.4.2
next prev parent reply other threads:[~2009-07-07 7:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-07 7:23 [RFC] [PATCH 0/3] convert hmac to ahash Steffen Klassert
2009-07-07 7:24 ` Steffen Klassert [this message]
2009-07-07 7:25 ` [RFC] [PATCH 2/3] crypto: ahash - add crypto_ahash_finup Steffen Klassert
2009-07-07 7:26 ` [RFC] [PATCH 3/3] crypto: hmac - convert to ahash Steffen Klassert
2009-07-09 4:48 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090707072451.GD20288@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.