isaacpittman-hitachi / rpms / openssl

Forked from rpms/openssl 2 years ago
Clone
b3353e
diff -up openssl-1.1.1h/apps/speed.c.curves openssl-1.1.1h/apps/speed.c
b3353e
--- openssl-1.1.1h/apps/speed.c.curves	2020-09-22 14:55:07.000000000 +0200
b3353e
+++ openssl-1.1.1h/apps/speed.c	2020-11-06 13:27:15.659288431 +0100
acdedc
@@ -490,90 +490,30 @@ static double rsa_results[RSA_NUM][2];
acdedc
 #endif /* OPENSSL_NO_RSA */
acdedc
 
acdedc
 enum {
acdedc
-    R_EC_P160,
acdedc
-    R_EC_P192,
acdedc
     R_EC_P224,
acdedc
     R_EC_P256,
acdedc
     R_EC_P384,
acdedc
     R_EC_P521,
acdedc
-#ifndef OPENSSL_NO_EC2M
acdedc
-    R_EC_K163,
acdedc
-    R_EC_K233,
acdedc
-    R_EC_K283,
acdedc
-    R_EC_K409,
acdedc
-    R_EC_K571,
acdedc
-    R_EC_B163,
acdedc
-    R_EC_B233,
acdedc
-    R_EC_B283,
acdedc
-    R_EC_B409,
acdedc
-    R_EC_B571,
acdedc
-#endif
acdedc
-    R_EC_BRP256R1,
acdedc
-    R_EC_BRP256T1,
acdedc
-    R_EC_BRP384R1,
acdedc
-    R_EC_BRP384T1,
acdedc
-    R_EC_BRP512R1,
acdedc
-    R_EC_BRP512T1,
acdedc
     R_EC_X25519,
acdedc
     R_EC_X448
acdedc
 };
acdedc
 
acdedc
 #ifndef OPENSSL_NO_EC
acdedc
 static OPT_PAIR ecdsa_choices[] = {
acdedc
-    {"ecdsap160", R_EC_P160},
acdedc
-    {"ecdsap192", R_EC_P192},
acdedc
     {"ecdsap224", R_EC_P224},
acdedc
     {"ecdsap256", R_EC_P256},
acdedc
     {"ecdsap384", R_EC_P384},
acdedc
     {"ecdsap521", R_EC_P521},
acdedc
-# ifndef OPENSSL_NO_EC2M
acdedc
-    {"ecdsak163", R_EC_K163},
acdedc
-    {"ecdsak233", R_EC_K233},
acdedc
-    {"ecdsak283", R_EC_K283},
acdedc
-    {"ecdsak409", R_EC_K409},
acdedc
-    {"ecdsak571", R_EC_K571},
acdedc
-    {"ecdsab163", R_EC_B163},
acdedc
-    {"ecdsab233", R_EC_B233},
acdedc
-    {"ecdsab283", R_EC_B283},
acdedc
-    {"ecdsab409", R_EC_B409},
acdedc
-    {"ecdsab571", R_EC_B571},
acdedc
-# endif
acdedc
-    {"ecdsabrp256r1", R_EC_BRP256R1},
acdedc
-    {"ecdsabrp256t1", R_EC_BRP256T1},
acdedc
-    {"ecdsabrp384r1", R_EC_BRP384R1},
acdedc
-    {"ecdsabrp384t1", R_EC_BRP384T1},
acdedc
-    {"ecdsabrp512r1", R_EC_BRP512R1},
acdedc
-    {"ecdsabrp512t1", R_EC_BRP512T1}
acdedc
 };
acdedc
 # define ECDSA_NUM       OSSL_NELEM(ecdsa_choices)
acdedc
 
acdedc
 static double ecdsa_results[ECDSA_NUM][2];    /* 2 ops: sign then verify */
acdedc
 
acdedc
 static const OPT_PAIR ecdh_choices[] = {
acdedc
-    {"ecdhp160", R_EC_P160},
acdedc
-    {"ecdhp192", R_EC_P192},
acdedc
     {"ecdhp224", R_EC_P224},
acdedc
     {"ecdhp256", R_EC_P256},
acdedc
     {"ecdhp384", R_EC_P384},
acdedc
     {"ecdhp521", R_EC_P521},
acdedc
-# ifndef OPENSSL_NO_EC2M
acdedc
-    {"ecdhk163", R_EC_K163},
acdedc
-    {"ecdhk233", R_EC_K233},
acdedc
-    {"ecdhk283", R_EC_K283},
acdedc
-    {"ecdhk409", R_EC_K409},
acdedc
-    {"ecdhk571", R_EC_K571},
acdedc
-    {"ecdhb163", R_EC_B163},
acdedc
-    {"ecdhb233", R_EC_B233},
acdedc
-    {"ecdhb283", R_EC_B283},
acdedc
-    {"ecdhb409", R_EC_B409},
acdedc
-    {"ecdhb571", R_EC_B571},
acdedc
-# endif
acdedc
-    {"ecdhbrp256r1", R_EC_BRP256R1},
acdedc
-    {"ecdhbrp256t1", R_EC_BRP256T1},
acdedc
-    {"ecdhbrp384r1", R_EC_BRP384R1},
acdedc
-    {"ecdhbrp384t1", R_EC_BRP384T1},
acdedc
-    {"ecdhbrp512r1", R_EC_BRP512R1},
acdedc
-    {"ecdhbrp512t1", R_EC_BRP512T1},
acdedc
     {"ecdhx25519", R_EC_X25519},
acdedc
     {"ecdhx448", R_EC_X448}
acdedc
 };
b3353e
@@ -1502,31 +1442,10 @@ int speed_main(int argc, char **argv)
acdedc
         unsigned int bits;
acdedc
     } test_curves[] = {
acdedc
         /* Prime Curves */
acdedc
-        {"secp160r1", NID_secp160r1, 160},
acdedc
-        {"nistp192", NID_X9_62_prime192v1, 192},
acdedc
         {"nistp224", NID_secp224r1, 224},
acdedc
         {"nistp256", NID_X9_62_prime256v1, 256},
acdedc
         {"nistp384", NID_secp384r1, 384},
acdedc
         {"nistp521", NID_secp521r1, 521},
acdedc
-# ifndef OPENSSL_NO_EC2M
acdedc
-        /* Binary Curves */
acdedc
-        {"nistk163", NID_sect163k1, 163},
acdedc
-        {"nistk233", NID_sect233k1, 233},
acdedc
-        {"nistk283", NID_sect283k1, 283},
acdedc
-        {"nistk409", NID_sect409k1, 409},
acdedc
-        {"nistk571", NID_sect571k1, 571},
acdedc
-        {"nistb163", NID_sect163r2, 163},
acdedc
-        {"nistb233", NID_sect233r1, 233},
acdedc
-        {"nistb283", NID_sect283r1, 283},
acdedc
-        {"nistb409", NID_sect409r1, 409},
acdedc
-        {"nistb571", NID_sect571r1, 571},
acdedc
-# endif
acdedc
-        {"brainpoolP256r1", NID_brainpoolP256r1, 256},
acdedc
-        {"brainpoolP256t1", NID_brainpoolP256t1, 256},
acdedc
-        {"brainpoolP384r1", NID_brainpoolP384r1, 384},
acdedc
-        {"brainpoolP384t1", NID_brainpoolP384t1, 384},
acdedc
-        {"brainpoolP512r1", NID_brainpoolP512r1, 512},
acdedc
-        {"brainpoolP512t1", NID_brainpoolP512t1, 512},
acdedc
         /* Other and ECDH only ones */
acdedc
         {"X25519", NID_X25519, 253},
acdedc
         {"X448", NID_X448, 448}
b3353e
@@ -2026,9 +1945,9 @@ int speed_main(int argc, char **argv)
acdedc
 #  endif
acdedc
 
acdedc
 #  ifndef OPENSSL_NO_EC
acdedc
-    ecdsa_c[R_EC_P160][0] = count / 1000;
acdedc
-    ecdsa_c[R_EC_P160][1] = count / 1000 / 2;
acdedc
-    for (i = R_EC_P192; i <= R_EC_P521; i++) {
acdedc
+    ecdsa_c[R_EC_P224][0] = count / 1000;
acdedc
+    ecdsa_c[R_EC_P224][1] = count / 1000 / 2;
acdedc
+    for (i = R_EC_P256; i <= R_EC_P521; i++) {
acdedc
         ecdsa_c[i][0] = ecdsa_c[i - 1][0] / 2;
acdedc
         ecdsa_c[i][1] = ecdsa_c[i - 1][1] / 2;
acdedc
         if (ecdsa_doit[i] <= 1 && ecdsa_c[i][0] == 0)
b3353e
@@ -2040,7 +1959,7 @@ int speed_main(int argc, char **argv)
acdedc
             }
acdedc
         }
acdedc
     }
acdedc
-#   ifndef OPENSSL_NO_EC2M
acdedc
+#   if 0
acdedc
     ecdsa_c[R_EC_K163][0] = count / 1000;
acdedc
     ecdsa_c[R_EC_K163][1] = count / 1000 / 2;
acdedc
     for (i = R_EC_K233; i <= R_EC_K571; i++) {
b3353e
@@ -2071,8 +1990,8 @@ int speed_main(int argc, char **argv)
acdedc
     }
acdedc
 #   endif
acdedc
 
acdedc
-    ecdh_c[R_EC_P160][0] = count / 1000;
acdedc
-    for (i = R_EC_P192; i <= R_EC_P521; i++) {
acdedc
+    ecdh_c[R_EC_P224][0] = count / 1000;
acdedc
+    for (i = R_EC_P256; i <= R_EC_P521; i++) {
acdedc
         ecdh_c[i][0] = ecdh_c[i - 1][0] / 2;
acdedc
         if (ecdh_doit[i] <= 1 && ecdh_c[i][0] == 0)
acdedc
             ecdh_doit[i] = 0;
b3353e
@@ -2082,7 +2001,7 @@ int speed_main(int argc, char **argv)
acdedc
             }
acdedc
         }
acdedc
     }
acdedc
-#   ifndef OPENSSL_NO_EC2M
acdedc
+#   if 0
acdedc
     ecdh_c[R_EC_K163][0] = count / 1000;
acdedc
     for (i = R_EC_K233; i <= R_EC_K571; i++) {
acdedc
         ecdh_c[i][0] = ecdh_c[i - 1][0] / 2;
b3353e
diff -up openssl-1.1.1h/crypto/ec/ecp_smpl.c.curves openssl-1.1.1h/crypto/ec/ecp_smpl.c
b3353e
--- openssl-1.1.1h/crypto/ec/ecp_smpl.c.curves	2020-09-22 14:55:07.000000000 +0200
b3353e
+++ openssl-1.1.1h/crypto/ec/ecp_smpl.c	2020-11-06 13:27:15.659288431 +0100
acdedc
@@ -145,6 +145,11 @@ int ec_GFp_simple_group_set_curve(EC_GRO
acdedc
         return 0;
acdedc
     }
acdedc
 
acdedc
+    if (BN_num_bits(p) < 224) {
acdedc
+        ECerr(EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE, EC_R_UNSUPPORTED_FIELD);
acdedc
+        return 0;
acdedc
+    }
acdedc
+
acdedc
     if (ctx == NULL) {
acdedc
         ctx = new_ctx = BN_CTX_new();
acdedc
         if (ctx == NULL)
b3353e
diff -up openssl-1.1.1h/test/ecdsatest.h.curves openssl-1.1.1h/test/ecdsatest.h
b3353e
--- openssl-1.1.1h/test/ecdsatest.h.curves	2020-11-06 13:27:15.627288114 +0100
b3353e
+++ openssl-1.1.1h/test/ecdsatest.h	2020-11-06 13:27:15.660288441 +0100
acdedc
@@ -32,23 +32,6 @@ typedef struct {
acdedc
 } ecdsa_cavs_kat_t;
acdedc
 
acdedc
 static const ecdsa_cavs_kat_t ecdsa_cavs_kats[] = {
acdedc
-    /* prime KATs from X9.62 */
acdedc
-    {NID_X9_62_prime192v1, NID_sha1,
acdedc
-     "616263",                  /* "abc" */
acdedc
-     "1a8d598fc15bf0fd89030b5cb1111aeb92ae8baf5ea475fb",
acdedc
-     "0462b12d60690cdcf330babab6e69763b471f994dd702d16a563bf5ec08069705ffff65e"
acdedc
-     "5ca5c0d69716dfcb3474373902",
acdedc
-     "fa6de29746bbeb7f8bb1e761f85f7dfb2983169d82fa2f4e",
acdedc
-     "885052380ff147b734c330c43d39b2c4a89f29b0f749fead",
acdedc
-     "e9ecc78106def82bf1070cf1d4d804c3cb390046951df686"},
acdedc
-    {NID_X9_62_prime239v1, NID_sha1,
acdedc
-     "616263",                  /* "abc" */
acdedc
-     "7ef7c6fabefffdea864206e80b0b08a9331ed93e698561b64ca0f7777f3d",
acdedc
-     "045b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c707fd9f1ed2e"
acdedc
-     "65f09f6ce0893baf5e8e31e6ae82ea8c3592335be906d38dee",
acdedc
-     "656c7196bf87dcc5d1f1020906df2782360d36b2de7a17ece37d503784af",
acdedc
-     "2cb7f36803ebb9c427c58d8265f11fc5084747133078fc279de874fbecb0",
acdedc
-     "2eeae988104e9c2234a3c2beb1f53bfa5dc11ff36a875d1e3ccb1f7e45cf"},
acdedc
     /* prime KATs from NIST CAVP */
acdedc
     {NID_secp224r1, NID_sha224,
acdedc
      "699325d6fc8fbbb4981a6ded3c3a54ad2e4e3db8a5669201912064c64e700c139248cdc1"
b3353e
--- openssl-1.1.1h/test/recipes/15-test_genec.t.ec-curves	2020-11-06 13:58:36.402895540 +0100
b3353e
+++ openssl-1.1.1h/test/recipes/15-test_genec.t	2020-11-06 13:59:38.508484498 +0100
b3353e
@@ -20,45 +20,11 @@ plan skip_all => "This test is unsupport
b3353e
     if disabled("ec");
b3353e
 
b3353e
 my @prime_curves = qw(
b3353e
-    secp112r1
b3353e
-    secp112r2
b3353e
-    secp128r1
b3353e
-    secp128r2
b3353e
-    secp160k1
b3353e
-    secp160r1
b3353e
-    secp160r2
b3353e
-    secp192k1
b3353e
-    secp224k1
b3353e
     secp224r1
b3353e
     secp256k1
b3353e
     secp384r1
b3353e
     secp521r1
b3353e
-    prime192v1
b3353e
-    prime192v2
b3353e
-    prime192v3
b3353e
-    prime239v1
b3353e
-    prime239v2
b3353e
-    prime239v3
b3353e
     prime256v1
b3353e
-    wap-wsg-idm-ecid-wtls6
b3353e
-    wap-wsg-idm-ecid-wtls7
b3353e
-    wap-wsg-idm-ecid-wtls8
b3353e
-    wap-wsg-idm-ecid-wtls9
b3353e
-    wap-wsg-idm-ecid-wtls12
b3353e
-    brainpoolP160r1
b3353e
-    brainpoolP160t1
b3353e
-    brainpoolP192r1
b3353e
-    brainpoolP192t1
b3353e
-    brainpoolP224r1
b3353e
-    brainpoolP224t1
b3353e
-    brainpoolP256r1
b3353e
-    brainpoolP256t1
b3353e
-    brainpoolP320r1
b3353e
-    brainpoolP320t1
b3353e
-    brainpoolP384r1
b3353e
-    brainpoolP384t1
b3353e
-    brainpoolP512r1
b3353e
-    brainpoolP512t1
b3353e
 );
b3353e
 
b3353e
 my @binary_curves = qw(
b3353e
@@ -115,7 +81,6 @@ push(@other_curves, 'SM2')
b3353e
     if !disabled("sm2");
b3353e
 
b3353e
 my @curve_aliases = qw(
b3353e
-    P-192
b3353e
     P-224
b3353e
     P-256
b3353e
     P-384