From e0b2687a2d972c60c744a4bdb1a3b969143e431a Mon Sep 17 00:00:00 2001 From: Ouss4 Date: Tue, 11 Aug 2020 16:07:09 +0100 Subject: [PATCH] Undef ASSERT before defining it to ensure that no previous definition has sneaked in through included files. Signed-off-by: Ouss4 --- library/chacha20.c | 3 +++ library/chachapoly.c | 3 +++ library/poly1305.c | 3 +++ undef_assert_before_defining_it.txt | 3 +++ 4 files changed, 12 insertions(+) create mode 100644 undef_assert_before_defining_it.txt diff --git a/library/chacha20.c b/library/chacha20.c index bda39b2ae..d8a51ecad 100644 --- a/library/chacha20.c +++ b/library/chacha20.c @@ -516,6 +516,9 @@ static const size_t test_lengths[2] = 375U }; +/* Make sure no other definition is already present. */ +#undef ASSERT + #define ASSERT( cond, args ) \ do \ { \ diff --git a/library/chachapoly.c b/library/chachapoly.c index d51227a55..b05a145bf 100644 --- a/library/chachapoly.c +++ b/library/chachapoly.c @@ -472,6 +472,9 @@ static const unsigned char test_mac[1][16] = } }; +/* Make sure no other definition is already present. */ +#undef ASSERT + #define ASSERT( cond, args ) \ do \ { \ diff --git a/library/poly1305.c b/library/poly1305.c index 069b82d95..9fc79a9cf 100644 --- a/library/poly1305.c +++ b/library/poly1305.c @@ -509,6 +509,9 @@ static const unsigned char test_mac[2][16] = } }; +/* Make sure no other definition is already present. */ +#undef ASSERT + #define ASSERT( cond, args ) \ do \ { \ diff --git a/undef_assert_before_defining_it.txt b/undef_assert_before_defining_it.txt new file mode 100644 index 000000000..74a20188c --- /dev/null +++ b/undef_assert_before_defining_it.txt @@ -0,0 +1,3 @@ +Changes + * Undefine the ASSERT macro before defining it locally, in case it is defined + in a platform header. Contributed by Abdelatif Guettouche in #3557.