diff options
author | Antony Polukhin <antoshkka@gmail.com> | 2023-06-06 18:09:27 +0300 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-06-08 11:29:02 +0200 |
commit | 2c4124a3a1373036141ee8f07fdd5806cab12aeb (patch) | |
tree | 23ed0c2436cda53af701a3ad09622623687ce68b /crypto | |
parent | ac083de6513324a5ea9aecbaeccd17ed32716b8e (diff) | |
download | openssl-2c4124a3a1373036141ee8f07fdd5806cab12aeb.tar.gz |
Workaround false positive warning of MSAN in eng_rdrand.c
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21136)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/engine/eng_rdrand.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crypto/engine/eng_rdrand.c b/crypto/engine/eng_rdrand.c index f46a514597..6245d68206 100644 --- a/crypto/engine/eng_rdrand.c +++ b/crypto/engine/eng_rdrand.c @@ -20,6 +20,12 @@ #include <openssl/err.h> #include <openssl/crypto.h> +#if defined(__has_feature) +# if __has_feature(memory_sanitizer) +# include <sanitizer/msan_interface.h> +# endif +#endif + #if (defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ defined(__x86_64) || defined(__x86_64__) || \ defined(_M_AMD64) || defined (_M_X64)) && defined(OPENSSL_CPUID_OBJ) @@ -32,6 +38,16 @@ static int get_random_bytes(unsigned char *buf, int num) return 0; } +# if defined(__has_feature) +# if __has_feature(memory_sanitizer) + /* + * MemorySanitizer fails to understand asm and produces false positive + * use-of-uninitialized-value warnings. + */ + __msan_unpoison(buf, num); +# endif +# endif + return (size_t)num == OPENSSL_ia32_rdrand_bytes(buf, (size_t)num); } |