aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Glauber <jang@linux.vnet.ibm.com>2008-03-06 06:55:38 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2008-04-20 22:19:21 -0400
commit78f8b3a24022c48fe600f4aba415d63ceeaec9cd (patch)
tree5323f386177d622bc0e7b6e5bd49085e8b832ce4
parent4e2c6d7f4d8f466f4420e10dda7126537de09c94 (diff)
[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>
-rw-r--r--crypto/Makefile2
-rw-r--r--crypto/sha512_generic.c (renamed from crypto/sha512.c)23
2 files changed, 13 insertions, 12 deletions
diff --git a/crypto/Makefile b/crypto/Makefile
index 7cf36253a75e..cf702a270c59 100644
--- a/crypto/Makefile
+++ b/crypto/Makefile
@@ -28,7 +28,7 @@ obj-$(CONFIG_CRYPTO_MD4) += md4.o
28obj-$(CONFIG_CRYPTO_MD5) += md5.o 28obj-$(CONFIG_CRYPTO_MD5) += md5.o
29obj-$(CONFIG_CRYPTO_SHA1) += sha1_generic.o 29obj-$(CONFIG_CRYPTO_SHA1) += sha1_generic.o
30obj-$(CONFIG_CRYPTO_SHA256) += sha256_generic.o 30obj-$(CONFIG_CRYPTO_SHA256) += sha256_generic.o
31obj-$(CONFIG_CRYPTO_SHA512) += sha512.o 31obj-$(CONFIG_CRYPTO_SHA512) += sha512_generic.o
32obj-$(CONFIG_CRYPTO_WP512) += wp512.o 32obj-$(CONFIG_CRYPTO_WP512) += wp512.o
33obj-$(CONFIG_CRYPTO_TGR192) += tgr192.o 33obj-$(CONFIG_CRYPTO_TGR192) += tgr192.o
34obj-$(CONFIG_CRYPTO_GF128MUL) += gf128mul.o 34obj-$(CONFIG_CRYPTO_GF128MUL) += gf128mul.o
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)
104 } 104 }
105 105
106 /* load the state into our registers */ 106 /* load the state into our registers */
107 a=state[0]; b=state[1]; c=state[2]; d=state[3]; 107 a=state[0]; b=state[1]; c=state[2]; d=state[3];
108 e=state[4]; f=state[5]; g=state[6]; h=state[7]; 108 e=state[4]; f=state[5]; g=state[6]; h=state[7];
109 109
110 /* now iterate */ 110 /* now iterate */
111 for (i=0; i<80; i+=8) { 111 for (i=0; i<80; i+=8) {
112 t1 = h + e1(e) + Ch(e,f,g) + sha512_K[i ] + W[i ]; 112 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)
126 t1 = a + e1(f) + Ch(f,g,h) + sha512_K[i+7] + W[i+7]; 126 t1 = a + e1(f) + Ch(f,g,h) + sha512_K[i+7] + W[i+7];
127 t2 = e0(b) + Maj(b,c,d); e+=t1; a=t1+t2; 127 t2 = e0(b) + Maj(b,c,d); e+=t1; a=t1+t2;
128 } 128 }
129 129
130 state[0] += a; state[1] += b; state[2] += c; state[3] += d; 130 state[0] += a; state[1] += b; state[2] += c; state[3] += d;
131 state[4] += e; state[5] += f; state[6] += g; state[7] += h; 131 state[4] += e; state[5] += f; state[6] += g; state[7] += h;
132 132
133 /* erase our data */ 133 /* erase our data */
134 a = b = c = d = e = f = g = h = t1 = t2 = 0; 134 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)
173 173
174 /* Compute number of bytes mod 128 */ 174 /* Compute number of bytes mod 128 */
175 index = (unsigned int)((sctx->count[0] >> 3) & 0x7F); 175 index = (unsigned int)((sctx->count[0] >> 3) & 0x7F);
176 176
177 /* Update number of bits */ 177 /* Update number of bits */
178 if ((sctx->count[0] += (len << 3)) < (len << 3)) { 178 if ((sctx->count[0] += (len << 3)) < (len << 3)) {
179 if ((sctx->count[1] += 1) < 1) 179 if ((sctx->count[1] += 1) < 1)
@@ -181,9 +181,9 @@ sha512_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len)
181 sctx->count[3]++; 181 sctx->count[3]++;
182 sctx->count[1] += (len >> 29); 182 sctx->count[1] += (len >> 29);
183 } 183 }
184 184
185 part_len = 128 - index; 185 part_len = 128 - index;
186 186
187 /* Transform as many times as possible. */ 187 /* Transform as many times as possible. */
188 if (len >= part_len) { 188 if (len >= part_len) {
189 memcpy(&sctx->buf[index], data, part_len); 189 memcpy(&sctx->buf[index], data, part_len);
@@ -278,8 +278,6 @@ static struct crypto_alg sha384 = {
278 } 278 }
279}; 279};
280 280
281MODULE_ALIAS("sha384");
282
283static int __init init(void) 281static int __init init(void)
284{ 282{
285 int ret = 0; 283 int ret = 0;
@@ -303,3 +301,6 @@ module_exit(fini);
303 301
304MODULE_LICENSE("GPL"); 302MODULE_LICENSE("GPL");
305MODULE_DESCRIPTION("SHA-512 and SHA-384 Secure Hash Algorithms"); 303MODULE_DESCRIPTION("SHA-512 and SHA-384 Secure Hash Algorithms");
304
305MODULE_ALIAS("sha384");
306MODULE_ALIAS("sha512");