Implement draft-ietf-curdle-pkix-04's serialization.

The resulting EVP_PKEYs do not do anything useful yet, but we are able
to parse them. Teaching them to sign will be done in a follow-up.

Creating these from in-memory keys is also slightly different from other
types. We don't have or need a public ED25519_KEY struct in
curve25519.h, so I've added tighter constructor functions which should
hopefully be easier to use anyway.

BUG=187

Change-Id: I0bbeea37350d4fdca05b6c6c0f152c15e6ade5bb
Reviewed-on: https://boringssl-review.googlesource.com/14446
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/obj/obj_dat.h b/crypto/obj/obj_dat.h
index 4905f0d..5f36d40 100644
--- a/crypto/obj/obj_dat.h
+++ b/crypto/obj/obj_dat.h
@@ -56,7 +56,7 @@
 
 /* This file is generated by crypto/obj/objects.go. */
 
-#define NUM_NID 949
+#define NUM_NID 950
 
 static const uint8_t kObjectData[] = {
     /* NID_rsadsi */
@@ -1811,6 +1811,8 @@
     0x2b, 0x81, 0x04, 0x01, 0x0e, 0x02,
     /* NID_dhSinglePass_cofactorDH_sha512kdf_scheme */
     0x2b, 0x81, 0x04, 0x01, 0x0e, 0x03,
+    /* NID_Ed25519 */
+    0x2b, 0x65, 0x70,
 };
 
 static const ASN1_OBJECT kObjects[NUM_NID] = {
@@ -3440,6 +3442,7 @@
     {"dh-std-kdf", "dh-std-kdf", NID_dh_std_kdf, 0, NULL, 0},
     {"dh-cofactor-kdf", "dh-cofactor-kdf", NID_dh_cofactor_kdf, 0, NULL, 0},
     {"X25519", "X25519", NID_X25519, 0, NULL, 0},
+    {"Ed25519", "Ed25519", NID_Ed25519, 3, &kObjectData[6175], 0},
 };
 
 static const unsigned kNIDsInShortNameOrder[] = {
@@ -3528,6 +3531,7 @@
     70 /* DSA-SHA1-old */,
     67 /* DSA-old */,
     297 /* DVCS */,
+    949 /* Ed25519 */,
     99 /* GN */,
     855 /* HMAC */,
     780 /* HMAC-MD5 */,
@@ -4400,6 +4404,7 @@
     382 /* Directory */,
     392 /* Domain */,
     132 /* E-mail Protection */,
+    949 /* Ed25519 */,
     389 /* Enterprises */,
     384 /* Experimental */,
     372 /* Extended OCSP Status */,
@@ -5334,7 +5339,8 @@
     378 /* 2.5.8 (OBJ_X500algorithms) */, 81 /* 2.5.29 (OBJ_id_ce) */,
     512 /* 2.23.42 (OBJ_id_set) */, 678 /* 2.23.43 (OBJ_wap) */,
     435 /* 0.9.2342 (OBJ_pss) */, 183 /* 1.2.840 (OBJ_ISO_US) */,
-    381 /* 1.3.6.1 (OBJ_iana) */, 677 /* 1.3.132 (OBJ_certicom_arc) */,
+    381 /* 1.3.6.1 (OBJ_iana) */, 949 /* 1.3.101.112 (OBJ_Ed25519) */,
+    677 /* 1.3.132 (OBJ_certicom_arc) */,
     394 /* 2.5.1.5 (OBJ_selected_attribute_types) */,
     13 /* 2.5.4.3 (OBJ_commonName) */, 100 /* 2.5.4.4 (OBJ_surname) */,
     105 /* 2.5.4.5 (OBJ_serialNumber) */, 14 /* 2.5.4.6 (OBJ_countryName) */,