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.