static DH *make_ephemeral_key(EVP_PKEY *pubk,BIGNUM *ephemeral_key)
	{
	DH *dh = DH_new();
	dh->g = BN_dup(pubk->pkey.dsa->g);
	dh->p = BN_dup(pubk->pkey.dsa->p);
	dh->priv_key = BN_dup(ephemeral_key);
	/* Generate ephemeral key pair */
	if (!DH_generate_key(dh))
		{
		DH_free(dh);
		return NULL;
		}	
	return dh;
	}