summaryrefslogtreecommitdiffstats
path: root/crypto/sha512_generic.c
diff options
context:
space:
mode:
authorJan Glauber <jang@linux.vnet.ibm.com>2008-03-06 12:55:38 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2008-04-21 04:19:21 +0200
commit78f8b3a24022c48fe600f4aba415d63ceeaec9cd (patch)
tree5323f386177d622bc0e7b6e5bd49085e8b832ce4 /crypto/sha512_generic.c
parent[CRYPTO] sha384: Hardware acceleration for s390 (diff)
downloadlinux-78f8b3a24022c48fe600f4aba415d63ceeaec9cd.tar.xz
linux-78f8b3a24022c48fe600f4aba415d63ceeaec9cd.zip
[CRYPTO] sha512: Rename sha512 to sha512_generic
Rename sha512 to sha512_generic and add a MODULE_ALIAS for sha512 so all sha512 implementations can be loaded automatically. Keep the broken tabs so git recognizes this as a rename. Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r--crypto/sha512_generic.c (renamed from crypto/sha512.c)23
1 files changed, 12 insertions, 11 deletions
diff --git a/crypto/sha512.c b/crypto/sha512_generic.c
index c39c803ecc02..82add4bf329a 100644
--- a/crypto/sha512.c
+++ b/crypto/sha512_generic.c
@@ -104,9 +104,9 @@ sha512_transform(u64 *state, u64 *W, const u8 *input)
}
/* load the state into our registers */
- a=state[0]; b=state[1]; c=state[2]; d=state[3];
- e=state[4]; f=state[5]; g=state[6]; h=state[7];
-
+ a=state[0]; b=state[1]; c=state[2]; d=state[3];
+ e=state[4]; f=state[5]; g=state[6]; h=state[7];
+
/* now iterate */
for (i=0; i<80; i+=8) {
t1 = h + e1(e) + Ch(e,f,g) + sha512_K[i ] + W[i ];
@@ -126,9 +126,9 @@ sha512_transform(u64 *state, u64 *W, const u8 *input)
t1 = a + e1(f) + Ch(f,g,h) + sha512_K[i+7] + W[i+7];
t2 = e0(b) + Maj(b,c,d); e+=t1; a=t1+t2;
}
-
- state[0] += a; state[1] += b; state[2] += c; state[3] += d;
- state[4] += e; state[5] += f; state[6] += g; state[7] += h;
+
+ state[0] += a; state[1] += b; state[2] += c; state[3] += d;
+ state[4] += e; state[5] += f; state[6] += g; state[7] += h;
/* erase our data */
a = b = c = d = e = f = g = h = t1 = t2 = 0;
@@ -173,7 +173,7 @@ sha512_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len)
/* Compute number of bytes mod 128 */
index = (unsigned int)((sctx->count[0] >> 3) & 0x7F);
-
+
/* Update number of bits */
if ((sctx->count[0] += (len << 3)) < (len << 3)) {
if ((sctx->count[1] += 1) < 1)
@@ -181,9 +181,9 @@ sha512_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len)
sctx->count[3]++;
sctx->count[1] += (len >> 29);
}
-
+
part_len = 128 - index;
-
+
/* Transform as many times as possible. */
if (len >= part_len) {
memcpy(&sctx->buf[index], data, part_len);
@@ -278,8 +278,6 @@ static struct crypto_alg sha384 = {
}
};
-MODULE_ALIAS("sha384");
-
static int __init init(void)
{
int ret = 0;
@@ -303,3 +301,6 @@ module_exit(fini);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("SHA-512 and SHA-384 Secure Hash Algorithms");
+
+MODULE_ALIAS("sha384");
+MODULE_ALIAS("sha512");