Skip to content

Commit

Permalink
Fix flaky non-deterministic box_seal tests
Browse files Browse the repository at this point in the history
With very small messages, there's a significant probability that the
ciphertext is identical to the message.

Fixes #1388
  • Loading branch information
jedisct1 committed Jun 30, 2024
1 parent 37179b5 commit 3e17b33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/default/box_seal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 3e17b33

Please sign in to comment.