1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Add smemclrs of all hash states we destroy.

(cherry picked from commit 16c46ecdaf)

Conflicts:
	sshsh512.c

Cherry-picker's notes: the conflict was because the original commit
also added smemclrs to SHA384_Simple and the ssh_hash structures for
SHA-384 and SHA-512, none of which exists on this branch so those
changes are irrelevant.
This commit is contained in:
Simon Tatham 2015-04-26 23:55:33 +01:00
parent 26d3ccdfc5
commit 2105b68e6e
4 changed files with 9 additions and 0 deletions

View File

@ -210,6 +210,7 @@ void MD5Simple(void const *p, unsigned len, unsigned char output[16])
MD5Init(&s);
MD5Update(&s, (unsigned char const *)p, len);
MD5Final(output, &s);
smemclr(&s, sizeof(s));
}
/* ----------------------------------------------------------------------
@ -227,6 +228,7 @@ void *hmacmd5_make_context(void)
void hmacmd5_free_context(void *handle)
{
smemclr(handle, 3*sizeof(struct MD5Context));
sfree(handle);
}

View File

@ -184,6 +184,7 @@ void SHA256_Simple(const void *p, int len, unsigned char *output) {
SHA256_Init(&s);
SHA256_Bytes(&s, p, len);
SHA256_Final(&s, output);
smemclr(&s, sizeof(s));
}
/*
@ -211,6 +212,7 @@ static void sha256_final(void *handle, unsigned char *output)
SHA256_State *s = handle;
SHA256_Final(s, output);
smemclr(s, sizeof(*s));
sfree(s);
}
@ -230,6 +232,7 @@ static void *sha256_make_context(void)
static void sha256_free_context(void *handle)
{
smemclr(handle, 3 * sizeof(SHA256_State));
sfree(handle);
}

View File

@ -274,6 +274,7 @@ void SHA512_Simple(const void *p, int len, unsigned char *output) {
SHA512_Init(&s);
SHA512_Bytes(&s, p, len);
SHA512_Final(&s, output);
smemclr(&s, sizeof(s));
}
#ifdef TEST

View File

@ -214,6 +214,7 @@ void SHA_Simple(const void *p, int len, unsigned char *output)
SHA_Init(&s);
SHA_Bytes(&s, p, len);
SHA_Final(&s, output);
smemclr(&s, sizeof(s));
}
/*
@ -241,6 +242,7 @@ static void sha1_final(void *handle, unsigned char *output)
SHA_State *s = handle;
SHA_Final(s, output);
smemclr(s, sizeof(*s));
sfree(s);
}
@ -260,6 +262,7 @@ static void *sha1_make_context(void)
static void sha1_free_context(void *handle)
{
smemclr(handle, 3 * sizeof(SHA_State));
sfree(handle);
}