Imported Upstream version 1.3.4
[platform/upstream/libksba.git] / src / keyinfo.c
index 02dc7ae..265b475 100644 (file)
@@ -230,19 +230,30 @@ static const struct
   const char *name;
 } curve_names[] =
   {
+    { "1.3.6.1.4.1.3029.1.5.1", "Curve25519" },
+    { "1.3.6.1.4.1.11591.15.1", "Ed25519"    },
+
     { "1.2.840.10045.3.1.1", "NIST P-192" },
+    { "1.2.840.10045.3.1.1", "nistp192"   },
     { "1.2.840.10045.3.1.1", "prime192v1" },
     { "1.2.840.10045.3.1.1", "secp192r1"  },
 
-    { "1.3.132.0.33",        "secp224r1" },
+    { "1.3.132.0.33",        "NIST P-224" },
+    { "1.3.132.0.33",        "nistp224"   },
+    { "1.3.132.0.33",        "secp224r1"  },
 
-    { "1.2.840.10045.3.1.7", "NIST P-256", },
+    { "1.2.840.10045.3.1.7", "NIST P-256" },
+    { "1.2.840.10045.3.1.7", "nistp256"   },
     { "1.2.840.10045.3.1.7", "prime256v1" },
     { "1.2.840.10045.3.1.7", "secp256r1"  },
 
-    { "1.3.132.0.34",        "secp384r1" },
+    { "1.3.132.0.34",        "NIST P-384" },
+    { "1.3.132.0.34",        "nistp384"   },
+    { "1.3.132.0.34",        "secp384r1"  },
 
-    { "1.3.132.0.35",        "secp521r1" },
+    { "1.3.132.0.35",        "NIST P-521" },
+    { "1.3.132.0.35",        "nistp521"   },
+    { "1.3.132.0.35",        "secp521r1"  },
 
     { "1.3.36.3.3.2.8.1.1.1" , "brainpoolP160r1" },
     { "1.3.36.3.3.2.8.1.1.3" , "brainpoolP192r1" },
@@ -252,6 +263,15 @@ static const struct
     { "1.3.36.3.3.2.8.1.1.11", "brainpoolP384r1" },
     { "1.3.36.3.3.2.8.1.1.13", "brainpoolP512r1" },
 
+
+    { "1.2.643.2.2.35.1",    "GOST2001-CryptoPro-A" },
+    { "1.2.643.2.2.35.2",    "GOST2001-CryptoPro-B" },
+    { "1.2.643.2.2.35.3",    "GOST2001-CryptoPro-C" },
+    { "1.2.643.7.1.2.1.2.1", "GOST2012-tc26-A"      },
+    { "1.2.643.7.1.2.1.2.2", "GOST2012-tc26-B"      },
+
+    { "1.3.132.0.10",        "secp256k1" },
+
     { NULL, NULL}
   };
 
@@ -322,10 +342,10 @@ get_ecc_curve_oid (const unsigned char *buf, size_t buflen, size_t *r_oidlen)
         if (buflen == strlen (curve_names[i].name)
             && !memcmp (buf, curve_names[i].name, buflen))
           break;
-      if (curve_names[i].oid)
+      if (!curve_names[i].oid)
         return NULL; /* Not found.  */
-      buf = curve_names[i].name;
-      buflen = strlen (curve_names[i].name);
+      buf = curve_names[i].oid;
+      buflen = strlen (curve_names[i].oid);
     }
 
   if (_ksba_oid_from_buf (buf, buflen, &der_oid, r_oidlen))