From 217a9330a4ef3ef167b49af3de2ee6c04e5148df Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Fri, 1 Dec 2017 17:21:59 +0100 Subject: [PATCH] More tests --- test/default/core_ed25519.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/default/core_ed25519.c b/test/default/core_ed25519.c index 141accde..e8a0f00d 100644 --- a/test/default/core_ed25519.c +++ b/test/default/core_ed25519.c @@ -120,6 +120,21 @@ main(void) assert(memcmp(p2, p, crypto_core_ed25519_BYTES) != 0); assert(memcmp(p3, p, crypto_core_ed25519_BYTES) == 0); + p[0] = 2; + assert(crypto_core_ed25519_add(p3, p2, p) == -1); + assert(crypto_core_ed25519_add(p3, p2, non_canonical_p) == 0); + assert(crypto_core_ed25519_add(p3, p2, non_canonical_invalid_p) == -1); + assert(crypto_core_ed25519_add(p3, p, p3) == -1); + assert(crypto_core_ed25519_add(p3, non_canonical_p, p3) == 0); + assert(crypto_core_ed25519_add(p3, non_canonical_invalid_p, p3) == -1); + + assert(crypto_core_ed25519_sub(p3, p2, p) == -1); + assert(crypto_core_ed25519_sub(p3, p2, non_canonical_p) == 0); + assert(crypto_core_ed25519_sub(p3, p2, non_canonical_invalid_p) == -1); + assert(crypto_core_ed25519_sub(p3, p, p3) == -1); + assert(crypto_core_ed25519_sub(p3, non_canonical_p, p3) == 0); + assert(crypto_core_ed25519_sub(p3, non_canonical_invalid_p, p3) == -1); + sodium_free(sc); sodium_free(p3); sodium_free(p2);