From: Niels Möller Date: Mon, 24 Nov 2014 20:05:29 +0000 (+0100) Subject: Fixed eddsa test case. X-Git-Tag: nettle_3.1rc1~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68fc6af9cd44cf5eb101ccc956b684a78ba5633d;p=thirdparty%2Fnettle.git Fixed eddsa test case. --- diff --git a/ChangeLog b/ChangeLog index f611ea2f..57de0f75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-11-24 Niels Möller + + * testsuite/eddsa-verify-test.c (test_eddsa): Fixed test case bug, + showing up as use of uninitialized data with valgrind. + 2014-10-23 Niels Möller * examples/nettle-benchmark.c (time_memxor): Allocate buffers as diff --git a/testsuite/eddsa-verify-test.c b/testsuite/eddsa-verify-test.c index 39f972a3..7eb445a2 100644 --- a/testsuite/eddsa-verify-test.c +++ b/testsuite/eddsa-verify-test.c @@ -87,11 +87,10 @@ test_eddsa (const struct ecc_curve *ecc, goto fail; } - memcpy (csignature, signature, 2*nbytes); if (msg->length == 0) { if (_eddsa_verify (ecc, H, pub, A, ctx, - 3, "foo", csignature, scratch)) + 3, "foo", signature, scratch)) { fprintf (stderr, "ecdsa_verify unexpectedly succeeded with different message.\n"); @@ -102,16 +101,16 @@ test_eddsa (const struct ecc_curve *ecc, { if (_eddsa_verify (ecc, H, pub, A, ctx, msg->length - 1, msg->data, - csignature, scratch)) + signature, scratch)) { fprintf (stderr, "ecdsa_verify unexpectedly succeeded with truncated message.\n"); goto fail; } - memcpy (csignature, signature, 2*nbytes); + memcpy (cmsg, msg->data, msg->length); cmsg[2*msg->length / 3] ^= 0x20; if (_eddsa_verify (ecc, H, pub, A, ctx, - msg->length, cmsg, csignature, scratch)) + msg->length, cmsg, signature, scratch)) { fprintf (stderr, "ecdsa_verify unexpectedly succeeded with modified message.\n");