utility function
authorDr. Stephen Henson <steve@openssl.org>
Fri, 18 Dec 2015 15:58:28 +0000 (15:58 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Wed, 23 Dec 2015 22:26:31 +0000 (22:26 +0000)
Reviewed-by: Matt Caswell <matt@openssl.org>
ssl/s3_lib.c
ssl/ssl_locl.h

index f3bf017042e4a6ddfd733f4bed50ae974fdfc051..30fcd393e69a4b8ad6019cef3678deec3cd235bc 100644 (file)
@@ -4639,3 +4639,16 @@ int ssl_derive(SSL *s, EVP_PKEY *privkey, EVP_PKEY *pubkey)
     EVP_PKEY_CTX_free(pctx);
     return rv;
 }
+
+EVP_PKEY *ssl_dh_to_pkey(DH *dh)
+{
+    EVP_PKEY *ret;
+    if (dh == NULL)
+        return NULL;
+    ret = EVP_PKEY_new();
+    if (EVP_PKEY_set1_DH(ret, dh) <= 0) {
+        EVP_PKEY_free(ret);
+        return NULL;
+    }
+    return ret;
+}
index c213aa471e814d74c6df95bc2f26b219fd38e98d..bff20adc43869d6aad22870e2ef3b0dcb44ac646 100644 (file)
@@ -1859,6 +1859,7 @@ __owur int ssl_generate_master_secret(SSL *s, unsigned char *pms, size_t pmslen,
                                       int free_pms);
 __owur EVP_PKEY *ssl_generate_pkey(EVP_PKEY *pm, int nid);
 __owur int ssl_derive(SSL *s, EVP_PKEY *privkey, EVP_PKEY *pubkey);
+__owur EVP_PKEY *ssl_dh_to_pkey(DH *dh);
 
 __owur const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p);
 __owur int ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);