diff options
Diffstat (limited to 'crypto/sha1.c')
-rw-r--r-- | crypto/sha1.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/crypto/sha1.c b/crypto/sha1.c index b96f57d95a82..6c77b689f87e 100644 --- a/crypto/sha1.c +++ b/crypto/sha1.c | |||
@@ -34,9 +34,9 @@ struct sha1_ctx { | |||
34 | u8 buffer[64]; | 34 | u8 buffer[64]; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | static void sha1_init(void *ctx) | 37 | static void sha1_init(struct crypto_tfm *tfm) |
38 | { | 38 | { |
39 | struct sha1_ctx *sctx = ctx; | 39 | struct sha1_ctx *sctx = crypto_tfm_ctx(tfm); |
40 | static const struct sha1_ctx initstate = { | 40 | static const struct sha1_ctx initstate = { |
41 | 0, | 41 | 0, |
42 | { 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0 }, | 42 | { 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0 }, |
@@ -46,9 +46,10 @@ static void sha1_init(void *ctx) | |||
46 | *sctx = initstate; | 46 | *sctx = initstate; |
47 | } | 47 | } |
48 | 48 | ||
49 | static void sha1_update(void *ctx, const u8 *data, unsigned int len) | 49 | static void sha1_update(struct crypto_tfm *tfm, const u8 *data, |
50 | unsigned int len) | ||
50 | { | 51 | { |
51 | struct sha1_ctx *sctx = ctx; | 52 | struct sha1_ctx *sctx = crypto_tfm_ctx(tfm); |
52 | unsigned int partial, done; | 53 | unsigned int partial, done; |
53 | const u8 *src; | 54 | const u8 *src; |
54 | 55 | ||
@@ -80,9 +81,9 @@ static void sha1_update(void *ctx, const u8 *data, unsigned int len) | |||
80 | 81 | ||
81 | 82 | ||
82 | /* Add padding and return the message digest. */ | 83 | /* Add padding and return the message digest. */ |
83 | static void sha1_final(void* ctx, u8 *out) | 84 | static void sha1_final(struct crypto_tfm *tfm, u8 *out) |
84 | { | 85 | { |
85 | struct sha1_ctx *sctx = ctx; | 86 | struct sha1_ctx *sctx = crypto_tfm_ctx(tfm); |
86 | __be32 *dst = (__be32 *)out; | 87 | __be32 *dst = (__be32 *)out; |
87 | u32 i, index, padlen; | 88 | u32 i, index, padlen; |
88 | __be64 bits; | 89 | __be64 bits; |
@@ -93,10 +94,10 @@ static void sha1_final(void* ctx, u8 *out) | |||
93 | /* Pad out to 56 mod 64 */ | 94 | /* Pad out to 56 mod 64 */ |
94 | index = sctx->count & 0x3f; | 95 | index = sctx->count & 0x3f; |
95 | padlen = (index < 56) ? (56 - index) : ((64+56) - index); | 96 | padlen = (index < 56) ? (56 - index) : ((64+56) - index); |
96 | sha1_update(sctx, padding, padlen); | 97 | sha1_update(tfm, padding, padlen); |
97 | 98 | ||
98 | /* Append length */ | 99 | /* Append length */ |
99 | sha1_update(sctx, (const u8 *)&bits, sizeof(bits)); | 100 | sha1_update(tfm, (const u8 *)&bits, sizeof(bits)); |
100 | 101 | ||
101 | /* Store state in digest */ | 102 | /* Store state in digest */ |
102 | for (i = 0; i < 5; i++) | 103 | for (i = 0; i < 5; i++) |