From: Tim Chen <tim.c.chen@linux.intel.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
"H. Peter Anvin" <hpa@zytor.com>,
"David S.Miller" <davem@davemloft.net>
Cc: Jussi Kivilinna <jussi.kivilinna@iki.fi>,
Jim Kukunas <james.t.kukunas@linux.intel.com>,
Kirk Yap <kirk.s.yap@intel.com>,
David Cote <david.m.cote@intel.com>,
James Guilford <james.guilford@intel.com>,
Wajdi Feghali <wajdi.k.feghali@intel.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-crypto@vger.kernel.org
Subject: [PATCH v2 01/10] Expose SHA256 generic routine to be callable externally.
Date: Tue, 26 Mar 2013 13:58:49 -0700 [thread overview]
Message-ID: <1364331529.27102.11.camel@schen9-DESK> (raw)
In-Reply-To: <cover.1364303479.git.tim.c.chen@linux.intel.com>
Other SHA256 routine may need to use the generic routine when
FPU is not available.
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
---
crypto/sha256_generic.c | 11 ++++++-----
include/crypto/sha.h | 2 ++
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/crypto/sha256_generic.c b/crypto/sha256_generic.c
index c3ed4ec..5433667 100644
--- a/crypto/sha256_generic.c
+++ b/crypto/sha256_generic.c
@@ -246,7 +246,7 @@ static int sha256_init(struct shash_desc *desc)
return 0;
}
-static int sha256_update(struct shash_desc *desc, const u8 *data,
+int crypto_sha256_update(struct shash_desc *desc, const u8 *data,
unsigned int len)
{
struct sha256_state *sctx = shash_desc_ctx(desc);
@@ -277,6 +277,7 @@ static int sha256_update(struct shash_desc *desc, const u8 *data,
return 0;
}
+EXPORT_SYMBOL(crypto_sha256_update);
static int sha256_final(struct shash_desc *desc, u8 *out)
{
@@ -293,10 +294,10 @@ static int sha256_final(struct shash_desc *desc, u8 *out)
/* Pad out to 56 mod 64. */
index = sctx->count & 0x3f;
pad_len = (index < 56) ? (56 - index) : ((64+56) - index);
- sha256_update(desc, padding, pad_len);
+ crypto_sha256_update(desc, padding, pad_len);
/* Append length (before padding) */
- sha256_update(desc, (const u8 *)&bits, sizeof(bits));
+ crypto_sha256_update(desc, (const u8 *)&bits, sizeof(bits));
/* Store state in digest */
for (i = 0; i < 8; i++)
@@ -339,7 +340,7 @@ static int sha256_import(struct shash_desc *desc, const void *in)
static struct shash_alg sha256_algs[2] = { {
.digestsize = SHA256_DIGEST_SIZE,
.init = sha256_init,
- .update = sha256_update,
+ .update = crypto_sha256_update,
.final = sha256_final,
.export = sha256_export,
.import = sha256_import,
@@ -355,7 +356,7 @@ static struct shash_alg sha256_algs[2] = { {
}, {
.digestsize = SHA224_DIGEST_SIZE,
.init = sha224_init,
- .update = sha256_update,
+ .update = crypto_sha256_update,
.final = sha224_final,
.descsize = sizeof(struct sha256_state),
.base = {
diff --git a/include/crypto/sha.h b/include/crypto/sha.h
index c6c9c1f..f46ff61 100644
--- a/include/crypto/sha.h
+++ b/include/crypto/sha.h
@@ -87,4 +87,6 @@ struct shash_desc;
extern int crypto_sha1_update(struct shash_desc *desc, const u8 *data,
unsigned int len);
+extern int crypto_sha256_update(struct shash_desc *desc, const u8 *data,
+ unsigned int len);
#endif
--
1.7.11.7
next prev parent reply other threads:[~2013-03-26 20:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1364303479.git.tim.c.chen@linux.intel.com>
2013-03-26 20:58 ` [PATCH v2 00/10] Optimize SHA256 and SHA512 for Intel x86_64 with SSSE3, AVX or AVX2 instructions Tim Chen
2013-04-03 1:53 ` Herbert Xu
2013-04-19 20:25 ` [PATCH] Fix prototype definitions of sha256_transform_asm, sha512_transform_asm Tim Chen
2013-04-25 13:04 ` Herbert Xu
2013-06-07 16:47 ` Tim Chen
2013-06-07 16:51 ` Tim Chen
2013-03-26 20:58 ` Tim Chen [this message]
2013-03-26 20:58 ` [PATCH v2 02/10] Optimized sha256 x86_64 assembly routine using Supplemental SSE3 instructions Tim Chen
2013-03-26 20:59 ` [PATCH v2 03/10] Optimized sha256 x86_64 assembly routine with AVX instructions Tim Chen
2013-03-26 20:59 ` [PATCH v2 04/10] Optimized sha256 x86_64 routine using AVX2's RORX instructions Tim Chen
2013-03-26 20:59 ` [PATCH v2 05/10] Create module providing optimized SHA256 routines using SSSE3, AVX or AVX2 instructions Tim Chen
2013-03-26 20:59 ` [PATCH v2 06/10] Expose generic sha512 routine to be callable from other modules Tim Chen
2013-03-26 20:59 ` [PATCH v2 07/10] Optimized SHA512 x86_64 assembly routine using Supplemental SSE3 instructions Tim Chen
2013-03-26 20:59 ` [PATCH v2 08/10] Optimized SHA512 x86_64 assembly routine using AVX instructions Tim Chen
2013-03-26 20:59 ` [PATCH v2 09/10] Optimized SHA512 x86_64 assembly routine using AVX2 RORX instruction Tim Chen
2013-03-26 21:00 ` [PATCH v2 10/10] Create module providing optimized SHA512 routines using SSSE3, AVX or AVX2 instructions Tim Chen
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=1364331529.27102.11.camel@schen9-DESK \
--to=tim.c.chen@linux.intel.com \
--cc=davem@davemloft.net \
--cc=david.m.cote@intel.com \
--cc=herbert@gondor.apana.org.au \
--cc=hpa@zytor.com \
--cc=james.guilford@intel.com \
--cc=james.t.kukunas@linux.intel.com \
--cc=jussi.kivilinna@iki.fi \
--cc=kirk.s.yap@intel.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wajdi.k.feghali@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox