sha2: Zero entire SHA_CTX structure during cleanup

Convert lines of the form

  MEMSET_BZERO(context, sizeof(context));

to the correct form

  MEMSET_BZERO(context, sizeof(*context));

as suggested by Clang.
This commit is contained in:
Brad King 2011-11-17 11:18:08 -05:00
parent 0a6705cbda
commit 0599c5f546
1 changed files with 11 additions and 11 deletions

View File

@ -704,7 +704,7 @@ void SHA1_Final(sha_byte digest[], SHA_CTX* context) {
* No digest buffer, so we can do nothing * No digest buffer, so we can do nothing
* except clean up and go home * except clean up and go home
*/ */
MEMSET_BZERO(context, sizeof(context)); MEMSET_BZERO(context, sizeof(*context));
return; return;
} }
@ -760,7 +760,7 @@ void SHA1_Final(sha_byte digest[], SHA_CTX* context) {
#endif #endif
/* Clean up: */ /* Clean up: */
MEMSET_BZERO(context, sizeof(context)); MEMSET_BZERO(context, sizeof(*context));
} }
char *SHA1_End(SHA_CTX* context, char buffer[]) { char *SHA1_End(SHA_CTX* context, char buffer[]) {
@ -780,7 +780,7 @@ char *SHA1_End(SHA_CTX* context, char buffer[]) {
} }
*buffer = (char)0; *buffer = (char)0;
} else { } else {
MEMSET_BZERO(context, sizeof(context)); MEMSET_BZERO(context, sizeof(*context));
} }
MEMSET_BZERO(digest, SHA1_DIGEST_LENGTH); MEMSET_BZERO(digest, SHA1_DIGEST_LENGTH);
return buffer; return buffer;
@ -1099,7 +1099,7 @@ void SHA256_Final(sha_byte digest[], SHA_CTX* context) {
} }
/* Clean up state data: */ /* Clean up state data: */
MEMSET_BZERO(context, sizeof(context)); MEMSET_BZERO(context, sizeof(*context));
} }
char *SHA256_End(SHA_CTX* context, char buffer[]) { char *SHA256_End(SHA_CTX* context, char buffer[]) {
@ -1119,7 +1119,7 @@ char *SHA256_End(SHA_CTX* context, char buffer[]) {
} }
*buffer = (char)0; *buffer = (char)0;
} else { } else {
MEMSET_BZERO(context, sizeof(context)); MEMSET_BZERO(context, sizeof(*context));
} }
MEMSET_BZERO(digest, SHA256_DIGEST_LENGTH); MEMSET_BZERO(digest, SHA256_DIGEST_LENGTH);
return buffer; return buffer;
@ -1173,7 +1173,7 @@ void SHA224_Final(sha_byte digest[], SHA_CTX* context) {
} }
/* Clean up state data: */ /* Clean up state data: */
MEMSET_BZERO(context, sizeof(context)); MEMSET_BZERO(context, sizeof(*context));
} }
char *SHA224_End(SHA_CTX* context, char buffer[]) { char *SHA224_End(SHA_CTX* context, char buffer[]) {
@ -1193,7 +1193,7 @@ char *SHA224_End(SHA_CTX* context, char buffer[]) {
} }
*buffer = (char)0; *buffer = (char)0;
} else { } else {
MEMSET_BZERO(context, sizeof(context)); MEMSET_BZERO(context, sizeof(*context));
} }
MEMSET_BZERO(digest, SHA224_DIGEST_LENGTH); MEMSET_BZERO(digest, SHA224_DIGEST_LENGTH);
return buffer; return buffer;
@ -1508,7 +1508,7 @@ void SHA512_Final(sha_byte digest[], SHA_CTX* context) {
} }
/* Zero out state data */ /* Zero out state data */
MEMSET_BZERO(context, sizeof(context)); MEMSET_BZERO(context, sizeof(*context));
} }
char *SHA512_End(SHA_CTX* context, char buffer[]) { char *SHA512_End(SHA_CTX* context, char buffer[]) {
@ -1528,7 +1528,7 @@ char *SHA512_End(SHA_CTX* context, char buffer[]) {
} }
*buffer = (char)0; *buffer = (char)0;
} else { } else {
MEMSET_BZERO(context, sizeof(context)); MEMSET_BZERO(context, sizeof(*context));
} }
MEMSET_BZERO(digest, SHA512_DIGEST_LENGTH); MEMSET_BZERO(digest, SHA512_DIGEST_LENGTH);
return buffer; return buffer;
@ -1578,7 +1578,7 @@ void SHA384_Final(sha_byte digest[], SHA_CTX* context) {
} }
/* Zero out state data */ /* Zero out state data */
MEMSET_BZERO(context, sizeof(context)); MEMSET_BZERO(context, sizeof(*context));
} }
char *SHA384_End(SHA_CTX* context, char buffer[]) { char *SHA384_End(SHA_CTX* context, char buffer[]) {
@ -1598,7 +1598,7 @@ char *SHA384_End(SHA_CTX* context, char buffer[]) {
} }
*buffer = (char)0; *buffer = (char)0;
} else { } else {
MEMSET_BZERO(context, sizeof(context)); MEMSET_BZERO(context, sizeof(*context));
} }
MEMSET_BZERO(digest, SHA384_DIGEST_LENGTH); MEMSET_BZERO(digest, SHA384_DIGEST_LENGTH);
return buffer; return buffer;