diff options
author | Michael Hamburg <mike@shiftleft.org> | 2017-05-23 16:09:36 -0700 |
---|---|---|
committer | Michael Hamburg <mike@shiftleft.org> | 2017-05-23 16:09:36 -0700 |
commit | 72484a054fe6014691a476fe3b0ec8e4179b777c (patch) | |
tree | 11678aab2c4e2b61719c12b6250ed1c2db82e54e | |
parent | fix(?! needs testing) a critical bug in SHAKE XOF: the state would never transition to SQUEEZING, resulting in incorrect outputs (diff) | |
download | goldilocks-72484a054fe6014691a476fe3b0ec8e4179b777c.tar.xz goldilocks-72484a054fe6014691a476fe3b0ec8e4179b777c.zip |
test to make sure bug is gone
-rw-r--r-- | test/test_decaf.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_decaf.cxx b/test/test_decaf.cxx index db0a497..99a827a 100644 --- a/test/test_decaf.cxx +++ b/test/test_decaf.cxx @@ -12,6 +12,7 @@ #include <decaf.hxx> #include <decaf/spongerng.hxx> #include <decaf/eddsa.hxx> +#include <decaf/shake.hxx> #include <stdio.h> using namespace decaf; @@ -598,6 +599,22 @@ static void run() { }; /* template<GroupId GROUP> struct Tests */ +static void test_xof() { + Test test("XOF"); + + FixedArrayBuffer<1024> a,b; + + SHAKE<128> s1, s2; + unsigned i; + for (i=0; i<a.size(); i++) s1.output(a.slice(i,1)); + s2.output(b); + + if (!a.contents_equal(b)) { + test.fail(); + printf(" Buffers aren't equal!\n"); + } +} + static void test_rng() { Test test("RNG"); SpongeRng rng_d1(Block("test_rng"),SpongeRng::DETERMINISTIC); @@ -649,6 +666,7 @@ static void test_rng() { int main(int argc, char **argv) { (void) argc; (void) argv; test_rng(); + test_xof(); printf("\n"); run_for_all_curves<Tests>(); if (passing) printf("Passed all tests.\n"); |