diff options
Diffstat (limited to 'arch/s390/crypto/sha1_s390.c')
-rw-r--r-- | arch/s390/crypto/sha1_s390.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/arch/s390/crypto/sha1_s390.c b/arch/s390/crypto/sha1_s390.c index b3cb5a89b00d..e85ba348722a 100644 --- a/arch/s390/crypto/sha1_s390.c +++ b/arch/s390/crypto/sha1_s390.c | |||
@@ -23,17 +23,17 @@ | |||
23 | * any later version. | 23 | * any later version. |
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | #include <crypto/internal/hash.h> | ||
26 | #include <linux/init.h> | 27 | #include <linux/init.h> |
27 | #include <linux/module.h> | 28 | #include <linux/module.h> |
28 | #include <linux/crypto.h> | ||
29 | #include <crypto/sha.h> | 29 | #include <crypto/sha.h> |
30 | 30 | ||
31 | #include "crypt_s390.h" | 31 | #include "crypt_s390.h" |
32 | #include "sha.h" | 32 | #include "sha.h" |
33 | 33 | ||
34 | static void sha1_init(struct crypto_tfm *tfm) | 34 | static int sha1_init(struct shash_desc *desc) |
35 | { | 35 | { |
36 | struct s390_sha_ctx *sctx = crypto_tfm_ctx(tfm); | 36 | struct s390_sha_ctx *sctx = shash_desc_ctx(desc); |
37 | 37 | ||
38 | sctx->state[0] = SHA1_H0; | 38 | sctx->state[0] = SHA1_H0; |
39 | sctx->state[1] = SHA1_H1; | 39 | sctx->state[1] = SHA1_H1; |
@@ -42,34 +42,36 @@ static void sha1_init(struct crypto_tfm *tfm) | |||
42 | sctx->state[4] = SHA1_H4; | 42 | sctx->state[4] = SHA1_H4; |
43 | sctx->count = 0; | 43 | sctx->count = 0; |
44 | sctx->func = KIMD_SHA_1; | 44 | sctx->func = KIMD_SHA_1; |
45 | |||
46 | return 0; | ||
45 | } | 47 | } |
46 | 48 | ||
47 | static struct crypto_alg alg = { | 49 | static struct shash_alg alg = { |
48 | .cra_name = "sha1", | 50 | .digestsize = SHA1_DIGEST_SIZE, |
49 | .cra_driver_name= "sha1-s390", | 51 | .init = sha1_init, |
50 | .cra_priority = CRYPT_S390_PRIORITY, | 52 | .update = s390_sha_update, |
51 | .cra_flags = CRYPTO_ALG_TYPE_DIGEST, | 53 | .final = s390_sha_final, |
52 | .cra_blocksize = SHA1_BLOCK_SIZE, | 54 | .descsize = sizeof(struct s390_sha_ctx), |
53 | .cra_ctxsize = sizeof(struct s390_sha_ctx), | 55 | .base = { |
54 | .cra_module = THIS_MODULE, | 56 | .cra_name = "sha1", |
55 | .cra_list = LIST_HEAD_INIT(alg.cra_list), | 57 | .cra_driver_name= "sha1-s390", |
56 | .cra_u = { .digest = { | 58 | .cra_priority = CRYPT_S390_PRIORITY, |
57 | .dia_digestsize = SHA1_DIGEST_SIZE, | 59 | .cra_flags = CRYPTO_ALG_TYPE_SHASH, |
58 | .dia_init = sha1_init, | 60 | .cra_blocksize = SHA1_BLOCK_SIZE, |
59 | .dia_update = s390_sha_update, | 61 | .cra_module = THIS_MODULE, |
60 | .dia_final = s390_sha_final } } | 62 | } |
61 | }; | 63 | }; |
62 | 64 | ||
63 | static int __init sha1_s390_init(void) | 65 | static int __init sha1_s390_init(void) |
64 | { | 66 | { |
65 | if (!crypt_s390_func_available(KIMD_SHA_1)) | 67 | if (!crypt_s390_func_available(KIMD_SHA_1)) |
66 | return -EOPNOTSUPP; | 68 | return -EOPNOTSUPP; |
67 | return crypto_register_alg(&alg); | 69 | return crypto_register_shash(&alg); |
68 | } | 70 | } |
69 | 71 | ||
70 | static void __exit sha1_s390_fini(void) | 72 | static void __exit sha1_s390_fini(void) |
71 | { | 73 | { |
72 | crypto_unregister_alg(&alg); | 74 | crypto_unregister_shash(&alg); |
73 | } | 75 | } |
74 | 76 | ||
75 | module_init(sha1_s390_init); | 77 | module_init(sha1_s390_init); |