Skip to content
Snippets Groups Projects
Commit cb7894ef authored by cyberta's avatar cyberta
Browse files

add missing data-cipher flags to VpnProfile and ConfigParser, fixes cipher negotiation issues

parent 50cf8dc8
Branches
No related tags found
No related merge requests found
...@@ -145,6 +145,7 @@ public class VpnProfile implements Serializable, Cloneable { ...@@ -145,6 +145,7 @@ public class VpnProfile implements Serializable, Cloneable {
public String mCustomConfigOptions = ""; public String mCustomConfigOptions = "";
public String mVerb = "1"; //ignored public String mVerb = "1"; //ignored
public String mCipher = ""; public String mCipher = "";
public String mDataCiphers = "";
public boolean mNobind = true; public boolean mNobind = true;
public boolean mUseDefaultRoutev6 = true; public boolean mUseDefaultRoutev6 = true;
public String mCustomRoutesv6 = ""; public String mCustomRoutesv6 = "";
...@@ -630,6 +631,12 @@ public class VpnProfile implements Serializable, Cloneable { ...@@ -630,6 +631,12 @@ public class VpnProfile implements Serializable, Cloneable {
cfg.append("remote-cert-tls server\n"); cfg.append("remote-cert-tls server\n");
} }
if (!TextUtils.isEmpty(mDataCiphers))
{
cfg.append("data-ciphers ").append(mDataCiphers).append("\n");
}
if (!TextUtils.isEmpty(mCipher)) { if (!TextUtils.isEmpty(mCipher)) {
cfg.append("cipher ").append(mCipher).append("\n"); cfg.append("cipher ").append(mCipher).append("\n");
} }
......
...@@ -537,10 +537,33 @@ public class ConfigParser { ...@@ -537,10 +537,33 @@ public class ConfigParser {
np.mUseLzo = Boolean.valueOf(useLzo.get(1)); np.mUseLzo = Boolean.valueOf(useLzo.get(1));
} }
Vector<String> ncp_ciphers = getOption("ncp-ciphers", 1, 1);
Vector<String> data_ciphers = getOption("data-ciphers", 1, 1);
Vector<String> cipher = getOption("cipher", 1, 1); Vector<String> cipher = getOption("cipher", 1, 1);
if (cipher != null) if (cipher != null)
np.mCipher = cipher.get(1); np.mCipher = cipher.get(1);
if (data_ciphers == null)
{
data_ciphers = ncp_ciphers;
}
/* The world is not yet ready to only use data-ciphers, add --cipher to data-ciphers
* for now on import */
if (data_ciphers != null)
{
np.mDataCiphers = data_ciphers.get(1);
if (!TextUtils.isEmpty(np.mCipher) && !np.mDataCiphers.contains(np.mCipher))
{
np.mDataCiphers += ":" + np.mCipher;
}
} else if (!TextUtils.isEmpty(np.mCipher) && !np.mCipher.equals("AES-128-GCM") && !np.mCipher.equals("AES-256"))
{
np.mDataCiphers += "AES-256-GCM:AES-128-GCM:" + np.mCipher;
}
Vector<String> auth = getOption("auth", 1, 1); Vector<String> auth = getOption("auth", 1, 1);
if (auth != null) if (auth != null)
np.mAuth = auth.get(1); np.mAuth = auth.get(1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment