From 4a5bbc4ef57e21ac7b2f000c2dcbe86e01b2a882 Mon Sep 17 00:00:00 2001
From: "Dr. Stephen Henson" <steve@openssl.org>
Date: Tue, 23 Feb 2016 14:35:33 +0000
Subject: [PATCH] skip inappropriate X25519 tests
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
---
 test/ecdhtest.c  | 7 +++++++
 test/ecdsatest.c | 2 +-
 test/ectest.c    | 6 ++++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/test/ecdhtest.c b/test/ecdhtest.c
index e37a020cc7..fb4df79ea7 100644
--- a/test/ecdhtest.c
+++ b/test/ecdhtest.c
@@ -493,6 +493,13 @@ int main(int argc, char *argv[])
     /* NAMED CURVES TESTS */
     for (n = 0; n < crv_len; n++) {
         nid = curves[n].nid;
+        /*
+         * Skipped for X25519 because affine coordinate operations are not
+         * supported for this curve.
+         * Higher level ECDH tests are performed in evptests.txt instead.
+         */
+        if (nid == NID_X25519)
+            continue;
         if (!test_ecdh_curve(nid, ctx, out)) goto err;
     }
 
diff --git a/test/ecdsatest.c b/test/ecdsatest.c
index 55ebad904c..f5b753a110 100644
--- a/test/ecdsatest.c
+++ b/test/ecdsatest.c
@@ -338,7 +338,7 @@ int test_builtin(BIO *out)
         unsigned char dirt, offset;
 
         nid = curves[n].nid;
-        if (nid == NID_ipsec4)
+        if (nid == NID_ipsec4 || nid == NID_X25519)
             continue;
         /* create new ecdsa key (== EC_KEY) */
         if ((eckey = EC_KEY_new()) == NULL)
diff --git a/test/ectest.c b/test/ectest.c
index b0fbcdc612..bbc7ed0ac9 100644
--- a/test/ectest.c
+++ b/test/ectest.c
@@ -1417,6 +1417,12 @@ static void internal_curve_test(void)
     for (n = 0; n < crv_len; n++) {
         EC_GROUP *group = NULL;
         int nid = curves[n].nid;
+        /*
+         * Skip for X25519 because low level operations such as EC_POINT_mul()
+         * are not supported for this curve
+         */
+        if (nid == NID_X25519)
+            continue;
         fprintf(stdout, "%s:\n", OBJ_nid2sn(nid));
         fflush(stdout);
         if ((group = EC_GROUP_new_by_curve_name(nid)) == NULL) {
-- 
2.25.1