1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 18:15:18 -07:00

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
This commit is contained in:
Frank Denis 2024-06-30 21:05:23 +02:00
parent 37179b5f01
commit 3e17b33c70

View File

@ -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);
}