Hi: The context area is already zeroed by crypto_alloc_tfm so there is no need for individual algorithms to zero it in their init functions.
Signed-off-by: Herbert Xu <[EMAIL PROTECTED]> Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
diff --git a/arch/s390/crypto/sha1_s390.c b/arch/s390/crypto/sha1_s390.c --- a/arch/s390/crypto/sha1_s390.c +++ b/arch/s390/crypto/sha1_s390.c @@ -40,19 +40,17 @@ struct crypt_s390_sha1_ctx { u8 buffer[2 * SHA1_BLOCK_SIZE]; }; -static void -sha1_init(void *ctx) +static void sha1_init(void *ctx_arg) { - static const struct crypt_s390_sha1_ctx initstate = { - .state = { - 0x67452301, - 0xEFCDAB89, - 0x98BADCFE, - 0x10325476, - 0xC3D2E1F0 - }, + struct crypt_s390_sha1_ctx *ctx = ctx_arg; + static const u32 initstate[5] = { + 0x67452301, + 0xEFCDAB89, + 0x98BADCFE, + 0x10325476, + 0xC3D2E1F0 }; - memcpy(ctx, &initstate, sizeof(initstate)); + memcpy(ctx->state, &initstate, sizeof(initstate)); } static void diff --git a/arch/s390/crypto/sha256_s390.c b/arch/s390/crypto/sha256_s390.c --- a/arch/s390/crypto/sha256_s390.c +++ b/arch/s390/crypto/sha256_s390.c @@ -43,8 +43,6 @@ static void sha256_init(void *ctx) sctx->state[5] = 0x9b05688c; sctx->state[6] = 0x1f83d9ab; sctx->state[7] = 0x5be0cd19; - sctx->count = 0; - memset(sctx->buf, 0, sizeof(sctx->buf)); } static void sha256_update(void *ctx, const u8 *data, unsigned int len) diff --git a/crypto/sha256.c b/crypto/sha256.c --- a/crypto/sha256.c +++ b/crypto/sha256.c @@ -241,8 +241,6 @@ static void sha256_init(void *ctx) sctx->state[5] = H5; sctx->state[6] = H6; sctx->state[7] = H7; - sctx->count[0] = sctx->count[1] = 0; - memset(sctx->buf, 0, sizeof(sctx->buf)); } static void sha256_update(void *ctx, const u8 *data, unsigned int len) diff --git a/crypto/sha512.c b/crypto/sha512.c --- a/crypto/sha512.c +++ b/crypto/sha512.c @@ -172,8 +172,6 @@ sha512_init(void *ctx) sctx->state[5] = H5; sctx->state[6] = H6; sctx->state[7] = H7; - sctx->count[0] = sctx->count[1] = sctx->count[2] = sctx->count[3] = 0; - memset(sctx->buf, 0, sizeof(sctx->buf)); } static void @@ -188,8 +186,6 @@ sha384_init(void *ctx) sctx->state[5] = HP5; sctx->state[6] = HP6; sctx->state[7] = HP7; - sctx->count[0] = sctx->count[1] = sctx->count[2] = sctx->count[3] = 0; - memset(sctx->buf, 0, sizeof(sctx->buf)); } static void diff --git a/crypto/tgr192.c b/crypto/tgr192.c --- a/crypto/tgr192.c +++ b/crypto/tgr192.c @@ -500,12 +500,9 @@ static void tgr192_init(void *ctx) { struct tgr192_ctx *tctx = ctx; - memset (tctx->hash, 0, 64); tctx->a = 0x0123456789abcdefULL; tctx->b = 0xfedcba9876543210ULL; tctx->c = 0xf096a5b4c3b2e187ULL; - tctx->nblocks = 0; - tctx->count = 0; } diff --git a/crypto/wp512.c b/crypto/wp512.c --- a/crypto/wp512.c +++ b/crypto/wp512.c @@ -981,16 +981,8 @@ static void wp512_process_buffer(struct } -static void wp512_init (void *ctx) { - int i; - struct wp512_ctx *wctx = ctx; - - memset(wctx->bitLength, 0, 32); - wctx->bufferBits = wctx->bufferPos = 0; - wctx->buffer[0] = 0; - for (i = 0; i < 8; i++) { - wctx->hash[i] = 0L; - } +static void wp512_init(void *ctx) +{ } static void wp512_update(void *ctx, const u8 *source, unsigned int len)