From f92e5ae836bc12e44336d33de703494b234a1e76 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 30 Jun 2024 21:05:23 +0200 Subject: [PATCH] Fix flaky non-deterministic box_seal tests With very small messages, there's a significant probability that the ciphertext is identical to the message. Fixes #1388 --- test/default/box_seal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/default/box_seal.c b/test/default/box_seal.c index f28c0416..5e6c2f9d 100644 --- a/test/default/box_seal.c +++ b/test/default/box_seal.c @@ -65,7 +65,7 @@ void tv2(void) printf("crypto_box_seal_open() failure\n"); return; } - assert(m_len == 0 || memcmp(cm, m2, m_len) != 0); + assert(m_len < 8 || memcmp(cm, m2, m_len) != 0); sodium_free(cm); sodium_free(m2); } @@ -135,7 +135,7 @@ void tv4(void) printf("crypto_box_curve25519xchacha20poly1305_seal_open() failure\n"); return; } - assert(m_len == 0 || memcmp(cm, m2, m_len) != 0); + assert(m_len < 8 || memcmp(cm, m2, m_len) != 0); sodium_free(cm); sodium_free(m2); }