From b645d8924b2163f2a4c417948d599ef3ae5a3ae3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Sat, 18 Oct 2014 22:26:01 +0200
Subject: [PATCH] Tweaked argument order for _eddsa_verify.

---
 ChangeLog                     |  8 ++++++++
 eddsa-verify.c                |  2 +-
 eddsa.h                       |  2 +-
 testsuite/eddsa-verify-test.c | 12 ++++++------
 4 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 682d0454..4087cc56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2014-10-18  Niels Möller  <nisse@lysator.liu.se>
+
+	* eddsa-verify.c (_eddsa_verify): Change argument order, putting A
+	before ctx.
+	* eddsa.h: Updated prototype.
+	* testsuite/eddsa-verify-test.c (test_eddsa): Updated
+	_eddsa_verify calls.
+
 2014-10-14  Niels Möller  <nisse@lysator.liu.se>
 
 	* eddsa-verify.c (equal_h): New function.
diff --git a/eddsa-verify.c b/eddsa-verify.c
index b519f7bd..5541d975 100644
--- a/eddsa-verify.c
+++ b/eddsa-verify.c
@@ -76,8 +76,8 @@ int
 _eddsa_verify (const struct ecc_curve *ecc,
 	       const struct nettle_hash *H,
 	       const uint8_t *pub,
-	       void *ctx,
 	       const mp_limb_t *A,
+	       void *ctx,
 	       size_t length,
 	       const uint8_t *msg,
 	       const uint8_t *signature,
diff --git a/eddsa.h b/eddsa.h
index 582e969b..50214862 100644
--- a/eddsa.h
+++ b/eddsa.h
@@ -96,8 +96,8 @@ int
 _eddsa_verify (const struct ecc_curve *ecc,
 	       const struct nettle_hash *H,
 	       const uint8_t *pub,
-	       void *ctx,
 	       const mp_limb_t *A,
+	       void *ctx,
 	       size_t length,
 	       const uint8_t *msg,
 	       const uint8_t *signature,
diff --git a/testsuite/eddsa-verify-test.c b/testsuite/eddsa-verify-test.c
index f78057b8..39f972a3 100644
--- a/testsuite/eddsa-verify-test.c
+++ b/testsuite/eddsa-verify-test.c
@@ -51,7 +51,7 @@ test_eddsa (const struct ecc_curve *ecc,
     die ("Invalid eddsa public key.\n");
 
   memcpy (csignature, signature, 2*nbytes);
-  if (!_eddsa_verify (ecc, H, pub, ctx, A,
+  if (!_eddsa_verify (ecc, H, pub, A, ctx,
 		      msg->length, msg->data, csignature, scratch))
     {
       fprintf (stderr, "eddsa_verify failed with valid signature.\n");
@@ -68,7 +68,7 @@ test_eddsa (const struct ecc_curve *ecc,
 
   memcpy (csignature, signature, 2*nbytes);
   csignature[nbytes/3] ^= 0x40;
-  if (_eddsa_verify (ecc, H, pub, ctx, A,
+  if (_eddsa_verify (ecc, H, pub, A, ctx,
 		     msg->length, msg->data, csignature, scratch))
     {
       fprintf (stderr,
@@ -79,7 +79,7 @@ test_eddsa (const struct ecc_curve *ecc,
   memcpy (csignature, signature, 2*nbytes);
   csignature[5*nbytes/3] ^= 0x8;
 
-  if (_eddsa_verify (ecc, H, pub, ctx, A,
+  if (_eddsa_verify (ecc, H, pub, A, ctx,
 		     msg->length, msg->data, csignature, scratch))
     {
       fprintf (stderr,
@@ -90,7 +90,7 @@ test_eddsa (const struct ecc_curve *ecc,
   memcpy (csignature, signature, 2*nbytes);
   if (msg->length == 0)
     {
-      if (_eddsa_verify  (ecc, H, pub, ctx, A,
+      if (_eddsa_verify  (ecc, H, pub, A, ctx,
 			  3, "foo", csignature, scratch))
 	{
 	  fprintf (stderr,
@@ -100,7 +100,7 @@ test_eddsa (const struct ecc_curve *ecc,
     }
   else
     {
-      if (_eddsa_verify  (ecc, H, pub, ctx, A,
+      if (_eddsa_verify  (ecc, H, pub, A, ctx,
 			  msg->length - 1, msg->data,
 			  csignature, scratch))
 	{
@@ -110,7 +110,7 @@ test_eddsa (const struct ecc_curve *ecc,
 	}
       memcpy (csignature, signature, 2*nbytes);
       cmsg[2*msg->length / 3] ^= 0x20;
-      if (_eddsa_verify  (ecc, H, pub, ctx, A,
+      if (_eddsa_verify  (ecc, H, pub, A, ctx,
 			  msg->length, cmsg, csignature, scratch))
 	{
 	  fprintf (stderr,
-- 
GitLab