Add encoded points to other EC curves too.
authorDr. Stephen Henson <steve@openssl.org>
Thu, 11 Aug 2016 14:38:37 +0000 (15:38 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Sat, 13 Aug 2016 13:11:05 +0000 (14:11 +0100)
Add encoded point ctrl support for other curves: this makes it possible
to handle X25519 and other EC curve point encoding in a similar way
for TLS.

Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/ec/ec_ameth.c

index b1dc011953648c212d8f8bcaf3cbe4f39bb0a22e..f6a3f5c15fab7c735c0d0353c01bcb2bee8c70cf 100644 (file)
@@ -496,6 +496,13 @@ static int ec_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
         *(int *)arg2 = NID_sha256;
         return 2;
 
+    case ASN1_PKEY_CTRL_SET1_TLS_ENCPT:
+        return EC_KEY_oct2key(EVP_PKEY_get0_EC_KEY(pkey), arg2, arg1, NULL);
+
+    case ASN1_PKEY_CTRL_GET1_TLS_ENCPT:
+        return EC_KEY_key2buf(EVP_PKEY_get0_EC_KEY(pkey),
+                              POINT_CONVERSION_UNCOMPRESSED, arg2, NULL);
+
     default:
         return -2;