Skip to content

Commit

Permalink
Fix n2n v2 connection with empty encryption key
Browse files Browse the repository at this point in the history
When an empty encryption key is set, hin2n disables the encryption
  • Loading branch information
emanuele-f committed Dec 7, 2020
1 parent 953a2df commit f9ca5e8
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions Hin2n_android/app/src/main/cpp/edge_jni/edge_android_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,20 +353,21 @@ int start_edge_v2(n2n_edge_status_t* status)
conf.transop_id = N2N_TRANSFORM_ID_TWOFISH;
conf.encrypt_key = strdup(cmd->enc_key);
traceEvent(TRACE_DEBUG, "encrypt_key = '%s'\n", encrypt_key);
}

if(cmd->encryption_mode[0]) {
if(!strcmp(cmd->encryption_mode, "Twofish"))
conf.transop_id = N2N_TRANSFORM_ID_TWOFISH;
else if(!strcmp(cmd->encryption_mode, "AES-CBC"))
conf.transop_id = N2N_TRANSFORM_ID_AESCBC;
else if(!strcmp(cmd->encryption_mode, "Speck-CTR"))
conf.transop_id = N2N_TRANSFORM_ID_SPECK;
else if(!strcmp(cmd->encryption_mode, "ChaCha20"))
conf.transop_id = N2N_TRANSFORM_ID_CHACHA20;
else
traceEvent(TRACE_WARNING, "unknown encryption mode:'%s'\n", cmd->encryption_mode);
}
if(cmd->encryption_mode[0]) {
if(!strcmp(cmd->encryption_mode, "Twofish"))
conf.transop_id = N2N_TRANSFORM_ID_TWOFISH;
else if(!strcmp(cmd->encryption_mode, "AES-CBC"))
conf.transop_id = N2N_TRANSFORM_ID_AESCBC;
else if(!strcmp(cmd->encryption_mode, "Speck-CTR"))
conf.transop_id = N2N_TRANSFORM_ID_SPECK;
else if(!strcmp(cmd->encryption_mode, "ChaCha20"))
conf.transop_id = N2N_TRANSFORM_ID_CHACHA20;
else
traceEvent(TRACE_WARNING, "unknown encryption mode:'%s'\n", cmd->encryption_mode);
}
} else
conf.transop_id = N2N_TRANSFORM_ID_NULL;

scan_address(ip_addr, N2N_NETMASK_STR_SIZE,
ip_mode, N2N_IF_MODE_SIZE,
Expand Down

0 comments on commit f9ca5e8

Please sign in to comment.