Define EVP compatibility constants for X448 and Ed448.

We do not support these, but Node expects the constants to be there, so
define them. Also fill in X25519's OID. Now that we can wrap it in
EVP_PKEY, we should have the OID there. (Our serializers don't use the
giant OID table, which is why it didn't matter.)

Change-Id: Ie0637f0e525c5704a9354c743075c027ace2f631
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/39724
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/obj/obj_dat.h b/crypto/obj/obj_dat.h
index d472ba5..888ea67 100644
--- a/crypto/obj/obj_dat.h
+++ b/crypto/obj/obj_dat.h
@@ -57,7 +57,7 @@
 /* This file is generated by crypto/obj/objects.go. */
 
 
-#define NUM_NID 961
+#define NUM_NID 962
 
 static const uint8_t kObjectData[] = {
     /* NID_rsadsi */
@@ -7111,6 +7111,10 @@
     0x01,
     0x0e,
     0x03,
+    /* NID_X25519 */
+    0x2b,
+    0x65,
+    0x6e,
     /* NID_ED25519 */
     0x2b,
     0x65,
@@ -7119,6 +7123,10 @@
     0x2b,
     0x65,
     0x71,
+    /* NID_X448 */
+    0x2b,
+    0x65,
+    0x6f,
 };
 
 static const ASN1_OBJECT kObjects[NUM_NID] = {
@@ -8747,8 +8755,8 @@
      NID_dhSinglePass_cofactorDH_sha512kdf_scheme, 6, &kObjectData[6169], 0},
     {"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},
+    {"X25519", "X25519", NID_X25519, 3, &kObjectData[6175], 0},
+    {"ED25519", "ED25519", NID_ED25519, 3, &kObjectData[6178], 0},
     {"ChaCha20-Poly1305", "chacha20-poly1305", NID_chacha20_poly1305, 0, NULL,
      0},
     {"KxRSA", "kx-rsa", NID_kx_rsa, 0, NULL, 0},
@@ -8760,7 +8768,8 @@
     {"KxANY", "kx-any", NID_kx_any, 0, NULL, 0},
     {"AuthANY", "auth-any", NID_auth_any, 0, NULL, 0},
     {"CECPQ2", "CECPQ2", NID_CECPQ2, 0, NULL, 0},
-    {"ED448", "ED448", NID_ED448, 3, &kObjectData[6178], 0},
+    {"ED448", "ED448", NID_ED448, 3, &kObjectData[6181], 0},
+    {"X448", "X448", NID_X448, 3, &kObjectData[6184], 0},
 };
 
 static const uint16_t kNIDsInShortNameOrder[] = {
@@ -8958,6 +8967,7 @@
     458 /* UID */,
     0 /* UNDEF */,
     948 /* X25519 */,
+    961 /* X448 */,
     11 /* X500 */,
     378 /* X500algorithms */,
     12 /* X509 */,
@@ -9828,6 +9838,7 @@
     133 /* Time Stamping */,
     375 /* Trust Root */,
     948 /* X25519 */,
+    961 /* X448 */,
     12 /* X509 */,
     402 /* X509v3 AC Targeting */,
     746 /* X509v3 Any Policy */,
@@ -10674,8 +10685,8 @@
 static const uint16_t kNIDsInOIDOrder[] = {
     434 /* 0.9 (OBJ_data) */,
     182 /* 1.2 (OBJ_member_body) */,
-    676 /* 1.3 (OBJ_identified_organization) */,
     379 /* 1.3 (OBJ_org) */,
+    676 /* 1.3 (OBJ_identified_organization) */,
     11 /* 2.5 (OBJ_X500) */,
     647 /* 2.23 (OBJ_international_organizations) */,
     380 /* 1.3.6 (OBJ_dod) */,
@@ -10687,6 +10698,8 @@
     435 /* 0.9.2342 (OBJ_pss) */,
     183 /* 1.2.840 (OBJ_ISO_US) */,
     381 /* 1.3.6.1 (OBJ_iana) */,
+    948 /* 1.3.101.110 (OBJ_X25519) */,
+    961 /* 1.3.101.111 (OBJ_X448) */,
     949 /* 1.3.101.112 (OBJ_ED25519) */,
     960 /* 1.3.101.113 (OBJ_ED448) */,
     677 /* 1.3.132 (OBJ_certicom_arc) */,
diff --git a/crypto/obj/obj_mac.num b/crypto/obj/obj_mac.num
index 5310ceb..f73ebf9 100644
--- a/crypto/obj/obj_mac.num
+++ b/crypto/obj/obj_mac.num
@@ -949,3 +949,4 @@
 auth_any		958
 CECPQ2		959
 ED448		960
+X448		961
diff --git a/crypto/obj/objects.txt b/crypto/obj/objects.txt
index 3d7c7a0..798da1e 100644
--- a/crypto/obj/objects.txt
+++ b/crypto/obj/objects.txt
@@ -1331,14 +1331,14 @@
                  : dh-std-kdf
                  : dh-cofactor-kdf
 
-# NID for X25519 (no corresponding OID).
- : X25519
-
 # NID for CECPQ2 (no corresponding OID).
  : CECPQ2
 
 # See RFC 8410.
+1 3 101 110 : X25519
+1 3 101 111 : X448
 1 3 101 112 : ED25519
+1 3 101 113 : ED448
 
  : ChaCha20-Poly1305 : chacha20-poly1305
 
@@ -1355,6 +1355,3 @@
 # TLS 1.3 cipher suites do not specify key exchange or authentication.
  : KxANY : kx-any
  : AuthANY : auth-any
-
-# From RFC8410
-1 3 101 113 : ED448
\ No newline at end of file
diff --git a/include/openssl/evp.h b/include/openssl/evp.h
index 19baa64..fe6c8b6 100644
--- a/include/openssl/evp.h
+++ b/include/openssl/evp.h
@@ -812,6 +812,14 @@
 // 2.5.8.1.1), but is no longer accepted.
 #define EVP_PKEY_RSA2 NID_rsa
 
+// EVP_PKEY_X448 is defined for OpenSSL compatibility, but we do not support
+// X448 and attempts to create keys will fail.
+#define EVP_PKEY_X448 NID_X448
+
+// EVP_PKEY_ED448 is defined for OpenSSL compatibility, but we do not support
+// Ed448 and attempts to create keys will fail.
+#define EVP_PKEY_ED448 NID_ED448
+
 // OpenSSL_add_all_algorithms does nothing.
 OPENSSL_EXPORT void OpenSSL_add_all_algorithms(void);
 
diff --git a/include/openssl/nid.h b/include/openssl/nid.h
index b7fb207..a15f4e3 100644
--- a/include/openssl/nid.h
+++ b/include/openssl/nid.h
@@ -4193,6 +4193,7 @@
 
 #define SN_X25519 "X25519"
 #define NID_X25519 948
+#define OBJ_X25519 1L, 3L, 101L, 110L
 
 #define SN_ED25519 "ED25519"
 #define NID_ED25519 949
@@ -4241,6 +4242,10 @@
 #define NID_ED448 960
 #define OBJ_ED448 1L, 3L, 101L, 113L
 
+#define SN_X448 "X448"
+#define NID_X448 961
+#define OBJ_X448 1L, 3L, 101L, 111L
+
 
 #if defined(__cplusplus)
 } /* extern C */