1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-07-08 08:44:57 +03:00

Add DhParamBits configuration to set Diffie-Hellman parameters

This commit is contained in:
NV
2015-01-27 03:23:36 +09:00
parent 75f9836ce5
commit ad58da4179
9 changed files with 155 additions and 9 deletions

View File

@ -245,7 +245,7 @@ static UINT rand_port_numbers[256] = {0};
static bool g_use_privateip_file = false;
static bool g_source_ip_validation_force_disable = false;
static DH_CTX *dh_1024 = NULL;
static DH_CTX *dh_param = NULL;
typedef struct PRIVATE_IP_SUBNET
{
@ -17577,9 +17577,9 @@ DH *TmpDhCallback(SSL *ssl, int is_export, int keylength)
{
DH *ret = NULL;
if (dh_1024 != NULL)
if (dh_param != NULL)
{
ret = dh_1024->dh;
ret = dh_param->dh;
}
return ret;
@ -17696,8 +17696,6 @@ void InitNetwork()
disable_cache = false;
dh_1024 = DhNewGroup2();
Zero(rand_port_numbers, sizeof(rand_port_numbers));
SetGetIpThreadMaxNum(DEFAULT_GETIP_THREAD_MAX_NUM);
@ -18103,10 +18101,10 @@ void SetCurrentGlobalIP(IP *ip, bool ipv6)
void FreeNetwork()
{
if (dh_1024 != NULL)
if (dh_param != NULL)
{
DhFree(dh_1024);
dh_1024 = NULL;
DhFree(dh_param);
dh_param = NULL;
}
// Release of thread-related
@ -22650,6 +22648,16 @@ bool GetSniNameFromSslPacket(UCHAR *packet_buf, UINT packet_size, char *sni, UIN
return ret;
}
void SetDhParam(DH_CTX *dh)
{
if (dh_param)
{
DhFree(dh_param);
}
dh_param = dh;
}
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
// Department of Computer Science has dozens of overly-enthusiastic geeks.
// Join us: http://www.tsukuba.ac.jp/english/admission/