diff options
author | Michal Gorny <mgorny@gentoo.org> | 2018-12-19 17:22:14 +0000 |
---|---|---|
committer | Michal Gorny <mgorny@gentoo.org> | 2018-12-19 17:22:14 +0000 |
commit | 0f71c17e7c5e791168930e0f936d4fbe604f1d3c (patch) | |
tree | d9afab766ac9caf2e9475ccaf265c44ff30dec53 | |
parent | ce28791e20e8a88581723da3eeb4b72695295f3e (diff) | |
download | bcm5719-llvm-0f71c17e7c5e791168930e0f936d4fbe604f1d3c.tar.gz bcm5719-llvm-0f71c17e7c5e791168930e0f936d4fbe604f1d3c.zip |
[sanitizer_common] Fix sha2 interceptors not to use vars in array len
Fix the sha2 interceptor macros to use a constant for array parameter
length rather than referencing the extern variable. Since the digest
length is provided in hash name, reuse the macro parameter for it.
Verify that the calculated value matches the one provided by system
headers.
Differential Revision: https://reviews.llvm.org/D55811
llvm-svn: 349645
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc index 37743a0fe61..ff378e1e93b 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc @@ -8511,9 +8511,10 @@ INTERCEPTOR(char *, MD2Data, const unsigned char *data, unsigned int len, if (context) \ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, context, SHA##LEN##_CTX_sz); \ } \ - INTERCEPTOR(void, SHA##LEN##_Final, u8 digest[SHA##LEN##_digest_length], \ + INTERCEPTOR(void, SHA##LEN##_Final, u8 digest[LEN/8], \ void *context) { \ void *ctx; \ + CHECK_EQ(SHA##LEN##_digest_length, LEN/8); \ COMMON_INTERCEPTOR_ENTER(ctx, SHA##LEN##_Final, digest, context); \ if (context) \ COMMON_INTERCEPTOR_READ_RANGE(ctx, context, SHA##LEN##_CTX_sz); \ |