diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2006-05-16 08:06:54 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2006-06-26 03:34:38 -0400 |
commit | 43600106e32809a4dead79fec67a63e9860e3d5d (patch) | |
tree | 20590746b98c41d6cc8b590b01cecddf9a185270 /arch/s390/crypto/sha1_s390.c | |
parent | 8b55ba0303bb59c34fab8e015634018780491614 (diff) |
[CRYPTO] digest: Remove unnecessary zeroing during init
Various digest algorithms operate one block at a time and therefore
keep a temporary buffer of partial blocks. This buffer does not need
to be initialised since there is a counter which indicates what is and
isn't valid in it.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch/s390/crypto/sha1_s390.c')
-rw-r--r-- | arch/s390/crypto/sha1_s390.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/arch/s390/crypto/sha1_s390.c b/arch/s390/crypto/sha1_s390.c index 98c896b86dcd..36bb5346a8c4 100644 --- a/arch/s390/crypto/sha1_s390.c +++ b/arch/s390/crypto/sha1_s390.c | |||
@@ -40,19 +40,20 @@ struct crypt_s390_sha1_ctx { | |||
40 | u8 buffer[2 * SHA1_BLOCK_SIZE]; | 40 | u8 buffer[2 * SHA1_BLOCK_SIZE]; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | static void | 43 | static void sha1_init(void *ctx_arg) |
44 | sha1_init(void *ctx) | ||
45 | { | 44 | { |
46 | static const struct crypt_s390_sha1_ctx initstate = { | 45 | struct crypt_s390_sha1_ctx *ctx = ctx_arg; |
47 | .state = { | 46 | static const u32 initstate[5] = { |
48 | 0x67452301, | 47 | 0x67452301, |
49 | 0xEFCDAB89, | 48 | 0xEFCDAB89, |
50 | 0x98BADCFE, | 49 | 0x98BADCFE, |
51 | 0x10325476, | 50 | 0x10325476, |
52 | 0xC3D2E1F0 | 51 | 0xC3D2E1F0 |
53 | }, | ||
54 | }; | 52 | }; |
55 | memcpy(ctx, &initstate, sizeof(initstate)); | 53 | |
54 | ctx->count = 0; | ||
55 | memcpy(ctx->state, &initstate, sizeof(initstate)); | ||
56 | ctx->buf_len = 0; | ||
56 | } | 57 | } |
57 | 58 | ||
58 | static void | 59 | static void |