diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2009-01-18 04:33:33 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2009-02-18 03:48:07 -0500 |
commit | 563f346d04e8373739240604a51ce8529dd9f07e (patch) | |
tree | e08f528e442c6861b591a283f5cf3a5666b92015 /arch/s390/crypto/sha_common.c | |
parent | 9749598633efc2561224954217ff0d70aeed8b50 (diff) |
crypto: sha-s390 - Switch to shash
This patch converts the S390 sha algorithms to the new shash interface.
With fixes by Jan Glauber.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch/s390/crypto/sha_common.c')
-rw-r--r-- | arch/s390/crypto/sha_common.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/arch/s390/crypto/sha_common.c b/arch/s390/crypto/sha_common.c index 9d6eb8c3d37e..7903ec47e6b9 100644 --- a/arch/s390/crypto/sha_common.c +++ b/arch/s390/crypto/sha_common.c | |||
@@ -13,14 +13,14 @@ | |||
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/crypto.h> | 16 | #include <crypto/internal/hash.h> |
17 | #include "sha.h" | 17 | #include "sha.h" |
18 | #include "crypt_s390.h" | 18 | #include "crypt_s390.h" |
19 | 19 | ||
20 | void s390_sha_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len) | 20 | int s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len) |
21 | { | 21 | { |
22 | struct s390_sha_ctx *ctx = crypto_tfm_ctx(tfm); | 22 | struct s390_sha_ctx *ctx = shash_desc_ctx(desc); |
23 | unsigned int bsize = crypto_tfm_alg_blocksize(tfm); | 23 | unsigned int bsize = crypto_shash_blocksize(desc->tfm); |
24 | unsigned int index; | 24 | unsigned int index; |
25 | int ret; | 25 | int ret; |
26 | 26 | ||
@@ -51,13 +51,15 @@ void s390_sha_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len) | |||
51 | store: | 51 | store: |
52 | if (len) | 52 | if (len) |
53 | memcpy(ctx->buf + index , data, len); | 53 | memcpy(ctx->buf + index , data, len); |
54 | |||
55 | return 0; | ||
54 | } | 56 | } |
55 | EXPORT_SYMBOL_GPL(s390_sha_update); | 57 | EXPORT_SYMBOL_GPL(s390_sha_update); |
56 | 58 | ||
57 | void s390_sha_final(struct crypto_tfm *tfm, u8 *out) | 59 | int s390_sha_final(struct shash_desc *desc, u8 *out) |
58 | { | 60 | { |
59 | struct s390_sha_ctx *ctx = crypto_tfm_ctx(tfm); | 61 | struct s390_sha_ctx *ctx = shash_desc_ctx(desc); |
60 | unsigned int bsize = crypto_tfm_alg_blocksize(tfm); | 62 | unsigned int bsize = crypto_shash_blocksize(desc->tfm); |
61 | u64 bits; | 63 | u64 bits; |
62 | unsigned int index, end, plen; | 64 | unsigned int index, end, plen; |
63 | int ret; | 65 | int ret; |
@@ -87,9 +89,11 @@ void s390_sha_final(struct crypto_tfm *tfm, u8 *out) | |||
87 | BUG_ON(ret != end); | 89 | BUG_ON(ret != end); |
88 | 90 | ||
89 | /* copy digest to out */ | 91 | /* copy digest to out */ |
90 | memcpy(out, ctx->state, crypto_hash_digestsize(crypto_hash_cast(tfm))); | 92 | memcpy(out, ctx->state, crypto_shash_digestsize(desc->tfm)); |
91 | /* wipe context */ | 93 | /* wipe context */ |
92 | memset(ctx, 0, sizeof *ctx); | 94 | memset(ctx, 0, sizeof *ctx); |
95 | |||
96 | return 0; | ||
93 | } | 97 | } |
94 | EXPORT_SYMBOL_GPL(s390_sha_final); | 98 | EXPORT_SYMBOL_GPL(s390_sha_final); |
95 | 99 | ||