TLS1.3 FFDHE Support
[openssl.git] / crypto / dh / dh_ameth.c
index 1424c41abe19cfd3b79058911bf34f1df3292811..524cac5bd83073c20c567f6bd3cf1289aea99fea 100644 (file)
@@ -488,6 +488,18 @@ static int dh_cms_encrypt(CMS_RecipientInfo *ri);
 #endif
 
 static int dh_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
+{
+    switch (op) {
+    case ASN1_PKEY_CTRL_SET1_TLS_ENCPT:
+        return dh_buf2key(EVP_PKEY_get0_DH(pkey), arg2, arg1);
+    case ASN1_PKEY_CTRL_GET1_TLS_ENCPT:
+        return dh_key2buf(EVP_PKEY_get0_DH(pkey), arg2);
+    default:
+        return -2;
+    }
+}
+
+static int dhx_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
 {
     switch (op) {
 #ifndef OPENSSL_NO_CMS
@@ -558,7 +570,7 @@ const EVP_PKEY_ASN1_METHOD dh_asn1_meth = {
     0,
 
     int_dh_free,
-    0,
+    dh_pkey_ctrl,
 
     0, 0, 0, 0, 0,
 
@@ -597,7 +609,7 @@ const EVP_PKEY_ASN1_METHOD dhx_asn1_meth = {
     0,
 
     int_dh_free,
-    dh_pkey_ctrl,
+    dhx_pkey_ctrl,
 
     0, 0, 0, 0, 0,