Update dependencies.
[openssl.git] / crypto / dh / dh_pmeth.c
index b8b1362ebaecba296f0946ae4e437f288d8488a8..5ae72b7d4cc271481279309140fb6b976fd365d3 100644 (file)
@@ -1,4 +1,4 @@
-/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
+/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
  * project 2006.
  */
 /* ====================================================================
@@ -59,8 +59,9 @@
 #include "cryptlib.h"
 #include <openssl/asn1t.h>
 #include <openssl/x509.h>
-#include <openssl/rsa.h>
 #include <openssl/evp.h>
+#include <openssl/dh.h>
+#include <openssl/bn.h>
 #include "evp_locl.h"
 
 /* DH pkey context structure */
@@ -93,6 +94,19 @@ static int pkey_dh_init(EVP_PKEY_CTX *ctx)
        return 1;
        }
 
+static int pkey_dh_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
+       {
+       DH_PKEY_CTX *dctx, *sctx;
+       if (!pkey_dh_init(dst))
+               return 0;
+               sctx = src->data;
+       dctx = dst->data;
+       dctx->prime_len = sctx->prime_len;
+       dctx->generator = sctx->generator;
+       dctx->use_dsa = sctx->use_dsa;
+       return 1;
+       }
+
 static void pkey_dh_cleanup(EVP_PKEY_CTX *ctx)
        {
        DH_PKEY_CTX *dctx = ctx->data;
@@ -208,6 +222,7 @@ const EVP_PKEY_METHOD dh_pkey_meth =
        EVP_PKEY_DH,
        EVP_PKEY_FLAG_AUTOARGLEN,
        pkey_dh_init,
+       pkey_dh_copy,
        pkey_dh_cleanup,
 
        0,