Skip to content
Snippets Groups Projects
Commit 68fc6af9 authored by Niels Möller's avatar Niels Möller
Browse files

Fixed eddsa test case.

parent dac00f57
No related branches found
No related tags found
No related merge requests found
2014-11-24 Niels Möller <nisse@lysator.liu.se>
* 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 <nisse@lysator.liu.se> 2014-10-23 Niels Möller <nisse@lysator.liu.se>
* examples/nettle-benchmark.c (time_memxor): Allocate buffers as * examples/nettle-benchmark.c (time_memxor): Allocate buffers as
......
...@@ -87,11 +87,10 @@ test_eddsa (const struct ecc_curve *ecc, ...@@ -87,11 +87,10 @@ test_eddsa (const struct ecc_curve *ecc,
goto fail; goto fail;
} }
memcpy (csignature, signature, 2*nbytes);
if (msg->length == 0) if (msg->length == 0)
{ {
if (_eddsa_verify (ecc, H, pub, A, ctx, if (_eddsa_verify (ecc, H, pub, A, ctx,
3, "foo", csignature, scratch)) 3, "foo", signature, scratch))
{ {
fprintf (stderr, fprintf (stderr,
"ecdsa_verify unexpectedly succeeded with different message.\n"); "ecdsa_verify unexpectedly succeeded with different message.\n");
...@@ -102,16 +101,16 @@ test_eddsa (const struct ecc_curve *ecc, ...@@ -102,16 +101,16 @@ test_eddsa (const struct ecc_curve *ecc,
{ {
if (_eddsa_verify (ecc, H, pub, A, ctx, if (_eddsa_verify (ecc, H, pub, A, ctx,
msg->length - 1, msg->data, msg->length - 1, msg->data,
csignature, scratch)) signature, scratch))
{ {
fprintf (stderr, fprintf (stderr,
"ecdsa_verify unexpectedly succeeded with truncated message.\n"); "ecdsa_verify unexpectedly succeeded with truncated message.\n");
goto fail; goto fail;
} }
memcpy (csignature, signature, 2*nbytes); memcpy (cmsg, msg->data, msg->length);
cmsg[2*msg->length / 3] ^= 0x20; cmsg[2*msg->length / 3] ^= 0x20;
if (_eddsa_verify (ecc, H, pub, A, ctx, if (_eddsa_verify (ecc, H, pub, A, ctx,
msg->length, cmsg, csignature, scratch)) msg->length, cmsg, signature, scratch))
{ {
fprintf (stderr, fprintf (stderr,
"ecdsa_verify unexpectedly succeeded with modified message.\n"); "ecdsa_verify unexpectedly succeeded with modified message.\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment