mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-02-09 01:06:00 +00:00
Fix memset calls in APR sha2 implementation
The implementation clears the context / state data from memory when it is finished with it. Prior to this commit, however, it was actually only clearing the first 4 bytes on x86 or 8 bytes on x86_64. clang warns: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess]
This commit is contained in:
parent
f1183ef970
commit
a973fb6347
@ -557,7 +557,7 @@ void apr__SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Clean up state data: */
|
/* Clean up state data: */
|
||||||
MEMSET_BZERO(context, sizeof(context));
|
MEMSET_BZERO(context, sizeof(*context));
|
||||||
usedspace = 0;
|
usedspace = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,7 +578,7 @@ char *apr__SHA256_End(SHA256_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;
|
||||||
@ -889,7 +889,7 @@ void apr__SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Zero out state data */
|
/* Zero out state data */
|
||||||
MEMSET_BZERO(context, sizeof(context));
|
MEMSET_BZERO(context, sizeof(*context));
|
||||||
}
|
}
|
||||||
|
|
||||||
char *apr__SHA512_End(SHA512_CTX* context, char buffer[]) {
|
char *apr__SHA512_End(SHA512_CTX* context, char buffer[]) {
|
||||||
@ -909,7 +909,7 @@ char *apr__SHA512_End(SHA512_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;
|
||||||
@ -964,7 +964,7 @@ void apr__SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Zero out state data */
|
/* Zero out state data */
|
||||||
MEMSET_BZERO(context, sizeof(context));
|
MEMSET_BZERO(context, sizeof(*context));
|
||||||
}
|
}
|
||||||
|
|
||||||
char *apr__SHA384_End(SHA384_CTX* context, char buffer[]) {
|
char *apr__SHA384_End(SHA384_CTX* context, char buffer[]) {
|
||||||
@ -984,7 +984,7 @@ char *apr__SHA384_End(SHA384_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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user