Browse Source

Added #ifdef's for AES

pull/66/head
Luca 6 years ago
parent
commit
dcf96a0809
  1. 14
      edge.c
  2. 1
      transform_aes.c

14
edge.c

@ -162,7 +162,9 @@ static void help() {
" | eg. -m 01:02:03:04:05:06\n");
printf("-M <mtu> | Specify n2n MTU of edge interface (default %d).\n", DEFAULT_MTU);
printf("-r | Enable packet forwarding through n2n community.\n");
#ifdef N2N_HAVE_AES
printf("-A | Set AES CBC as the preferred encryption mode.\n");
#endif
printf("-E | Accept multicast MAC addresses (default=drop).\n");
printf("-v | Make more verbose. Repeat as required.\n");
printf("-t <port> | Management UDP Port (for multiple edges on a machine).\n");
@ -269,11 +271,13 @@ static int setOption(int optkey, char *optargument, edge_conf_t *ec, n2n_edge_t
break;
}
#ifdef N2N_HAVE_AES
case 'A':
{
eee->preferred_aes = 1;
break;
}
#endif
case 'l': /* supernode-list */
if(optargument) {
@ -364,7 +368,11 @@ static int loadFromCLI(int argc, char *argv[], edge_conf_t *ec, n2n_edge_t *eee)
u_char c;
while((c = getopt_long(argc, argv,
"K:k:a:bc:Eu:g:m:M:s:d:l:p:fvhrAt:",
"K:k:a:bc:Eu:g:m:M:s:d:l:p:fvhrt:"
#ifdef N2N_HAVE_AES
"A"
#endif
,
long_options, NULL)) != '?') {
if(c == 255) break;
setOption(c, optarg, ec, eee);
@ -672,14 +680,18 @@ int main(int argc, char* argv[]) {
traceEvent(TRACE_NORMAL, "Binding to local port %d", (signed int)ec.local_port);
if(ec.encrypt_key) {
#ifdef N2N_HAVE_AES
if(edge_init_aes_psk(&eee, (uint8_t *)(ec.encrypt_key), strlen(ec.encrypt_key)) < 0) {
fprintf(stderr, "Error: AES PSK setup failed.\n");
return(-1);
}
#endif
if(edge_init_twofish_psk(&eee, (uint8_t *)(ec.encrypt_key), strlen(ec.encrypt_key)) < 0) {
fprintf(stderr, "Error: twofish PSK setup failed.\n");
return(-1);
}
} else if(strlen(eee.keyschedule) > 0) {
if(edge_init_keyschedule(&eee) != 0) {
fprintf(stderr, "Error: keyschedule setup failed.\n");

1
transform_aes.c

@ -21,7 +21,6 @@
#if defined(N2N_HAVE_AES)
#include "openssl/aes.h"
#ifndef _MSC_VER
/* Not included in Visual Studio 2008 */

Loading…
Cancel
Save