Skip to content

Commit e7ea32e

Browse files
committed
msan: Add SECP256K1_CHECKMEM_MSAN_DEFINE which applies to memory sanitizer and not valgrind
1 parent 0653a25 commit e7ea32e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/checkmem.h

+7
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
* - SECP256K1_CHECKMEM_DEFINE(p, len):
3131
* - marks the len-byte memory pointed to by p as defined data (public data, in the
3232
* context of constant-time checking).
33+
* - SECP256K1_CHECKMEM_MSAN_DEFINE(p, len):
34+
* - Like SECP256K1_CHECKMEM_DEFINE, but applies only to memory_sanitizer.
3335
*
3436
*/
3537

@@ -48,11 +50,16 @@
4850
# define SECP256K1_CHECKMEM_ENABLED 1
4951
# define SECP256K1_CHECKMEM_UNDEFINE(p, len) __msan_allocated_memory((p), (len))
5052
# define SECP256K1_CHECKMEM_DEFINE(p, len) __msan_unpoison((p), (len))
53+
# define SECP256K1_CHECKMEM_MSAN_DEFINE(p, len) __msan_unpoison((p), (len))
5154
# define SECP256K1_CHECKMEM_CHECK(p, len) __msan_check_mem_is_initialized((p), (len))
5255
# define SECP256K1_CHECKMEM_RUNNING() (1)
5356
# endif
5457
#endif
5558

59+
#if !defined SECP256K1_CHECKMEM_MSAN_DEFINE
60+
# define SECP256K1_CHECKMEM_MSAN_DEFINE(p, len) SECP256K1_CHECKMEM_NOOP((p), (len))
61+
#endif
62+
5663
/* If valgrind integration is desired (through the VALGRIND define), implement the
5764
* SECP256K1_CHECKMEM_* macros using valgrind. */
5865
#if !defined SECP256K1_CHECKMEM_ENABLED

0 commit comments

Comments
 (0)