File openssl-speed_skip_binary_curves_NO_EC2M.patch of Package openssl-1_1.13606

Backported from https://github.com/openssl/openssl/pull/8422

Index: openssl-1.1.0i/apps/speed.c
===================================================================
--- openssl-1.1.0i.orig/apps/speed.c	2019-03-12 17:24:58.619294028 +0100
+++ openssl-1.1.0i/apps/speed.c	2019-03-12 18:39:42.633362079 +0100
@@ -479,23 +479,27 @@ static const OPT_PAIR rsa_choices[] = {
 
 static double rsa_results[RSA_NUM][2];  /* 2 ops: sign then verify */
 
-#define R_EC_P160    0
-#define R_EC_P192    1
-#define R_EC_P224    2
-#define R_EC_P256    3
-#define R_EC_P384    4
-#define R_EC_P521    5
-#define R_EC_K163    6
-#define R_EC_K233    7
-#define R_EC_K283    8
-#define R_EC_K409    9
-#define R_EC_K571    10
-#define R_EC_B163    11
-#define R_EC_B233    12
-#define R_EC_B283    13
-#define R_EC_B409    14
-#define R_EC_B571    15
-#define R_EC_X25519  16
+enum {
+    R_EC_P160,
+    R_EC_P192,
+    R_EC_P224,
+    R_EC_P256,
+    R_EC_P384,
+    R_EC_P521,
+#ifndef OPENSSL_NO_EC2M
+    R_EC_K163,
+    R_EC_K233,
+    R_EC_K283,
+    R_EC_K409,
+    R_EC_K571,
+    R_EC_B163,
+    R_EC_B233,
+    R_EC_B283,
+    R_EC_B409,
+    R_EC_B571,
+#endif
+    R_EC_X25519,
+};
 #ifndef OPENSSL_NO_EC
 static const OPT_PAIR ecdsa_choices[] = {
     {"ecdsap160", R_EC_P160},
@@ -504,6 +508,7 @@ static const OPT_PAIR ecdsa_choices[] =
     {"ecdsap256", R_EC_P256},
     {"ecdsap384", R_EC_P384},
     {"ecdsap521", R_EC_P521},
+# ifndef OPENSSL_NO_EC2M
     {"ecdsak163", R_EC_K163},
     {"ecdsak233", R_EC_K233},
     {"ecdsak283", R_EC_K283},
@@ -514,6 +519,7 @@ static const OPT_PAIR ecdsa_choices[] =
     {"ecdsab283", R_EC_B283},
     {"ecdsab409", R_EC_B409},
     {"ecdsab571", R_EC_B571}
+# endif
 };
 # define ECDSA_NUM       OSSL_NELEM(ecdsa_choices)
 
@@ -526,6 +532,7 @@ static const OPT_PAIR ecdh_choices[] = {
     {"ecdhp256", R_EC_P256},
     {"ecdhp384", R_EC_P384},
     {"ecdhp521", R_EC_P521},
+# ifndef OPENSSL_NO_EC2M
     {"ecdhk163", R_EC_K163},
     {"ecdhk233", R_EC_K233},
     {"ecdhk283", R_EC_K283},
@@ -536,6 +543,7 @@ static const OPT_PAIR ecdh_choices[] = {
     {"ecdhb283", R_EC_B283},
     {"ecdhb409", R_EC_B409},
     {"ecdhb571", R_EC_B571},
+# endif
     {"ecdhx25519", R_EC_X25519},
 };
 # define EC_NUM       OSSL_NELEM(ecdh_choices)
@@ -1338,21 +1346,26 @@ int speed_main(int argc, char **argv)
         /* Prime Curves */
         "secp160r1", "nistp192", "nistp224",
         "nistp256", "nistp384", "nistp521",
+# ifndef OPENSSL_NO_EC2M
         /* Binary Curves */
         "nistk163", "nistk233", "nistk283",
         "nistk409", "nistk571", "nistb163",
         "nistb233", "nistb283", "nistb409",
         "nistb571",
+# endif
         /* Other */
         "X25519"
     };
     static const int test_curves_bits[EC_NUM] = {
         160, 192, 224,
         256, 384, 521,
+# ifndef OPENSSL_NO_EC2M
         163, 233, 283,
         409, 571, 163,
         233, 283, 409,
-        571, 253 /* X25519 */
+        571,
+# endif
+        253 /* X25519 */
     };
 
     int ecdsa_doit[ECDSA_NUM] = { 0 };
@@ -1805,6 +1818,7 @@ int speed_main(int argc, char **argv)
             }
         }
     }
+#   ifndef OPENSSL_NO_EC2M
     ecdsa_c[R_EC_K163][0] = count / 1000;
     ecdsa_c[R_EC_K163][1] = count / 1000 / 2;
     for (i = R_EC_K233; i <= R_EC_K571; i++) {
@@ -1833,6 +1847,7 @@ int speed_main(int argc, char **argv)
             }
         }
     }
+#   endif
 
     ecdh_c[R_EC_P160][0] = count / 1000;
     for (i = R_EC_P192; i <= R_EC_P521; i++) {
@@ -1845,6 +1860,7 @@ int speed_main(int argc, char **argv)
             }
         }
     }
+#   ifndef OPENSSL_NO_EC2M
     ecdh_c[R_EC_K163][0] = count / 1000;
     for (i = R_EC_K233; i <= R_EC_K571; i++) {
         ecdh_c[i][0] = ecdh_c[i - 1][0] / 2;
@@ -1867,6 +1883,7 @@ int speed_main(int argc, char **argv)
             }
         }
     }
+#   endif
     /* default iteration count for the last EC Curve */
     ecdh_c[R_EC_X25519][0] = count / 1800;
 #  endif