diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/key_derivation.c | 2 | ||||
-rw-r--r-- | src/options.c | 6 | ||||
-rw-r--r-- | src/options.h | 1 | ||||
-rw-r--r-- | src/uanytun.c | 2 |
4 files changed, 8 insertions, 3 deletions
diff --git a/src/key_derivation.c b/src/key_derivation.c index 49fb2a2..28e9a1c 100644 --- a/src/key_derivation.c +++ b/src/key_derivation.c @@ -296,7 +296,7 @@ int key_derivation_aesctr_generate(key_derivation_t* kd, satp_prf_label_t label, } else if(!ret) { if(len > kd->key_store_[label].length_) { - log_printf(WARNING, "stored (old) key for label 0x%02X is to short, filling with zeros", label); + log_printf(WARNING, "stored (old) key for label 0x%02X is too short, filling with zeros", label); memset(key, 0, len); len = kd->key_store_[label].length_; } diff --git a/src/options.c b/src/options.c index 360e85d..b74092b 100644 --- a/src/options.c +++ b/src/options.c @@ -51,7 +51,7 @@ #define PARSE_INT_PARAM(SHORT, LONG, VALUE) \ else if(!strcmp(str,SHORT) || !strcmp(str,LONG)) \ { \ - if(argc < 1 || argv[i+1][0] == '-') \ + if(argc < 1) \ return i; \ VALUE = atoi(argv[i+1]); \ argc--; \ @@ -176,6 +176,7 @@ int options_parse(options_t* opt, int argc, char* argv[]) PARSE_INT_PARAM("-w","--window-size", opt->seq_window_size_) PARSE_STRING_PARAM("-c","--cipher", opt->cipher_) PARSE_STRING_PARAM("-k","--kd-prf", opt->kd_prf_) + PARSE_INT_PARAM("-l","--ld-kdr", opt->ld_kdr_) PARSE_STRING_PARAM("-a","--auth-algo", opt->auth_algo_) PARSE_HEXSTRING_PARAM_SEC("-K","--key", opt->key_) PARSE_HEXSTRING_PARAM_SEC("-A","--salt", opt->salt_) @@ -223,6 +224,7 @@ void options_default(options_t* opt) opt->seq_window_size_ = 100; opt->cipher_ = strdup("null"); opt->kd_prf_ = strdup("null"); + opt->ld_kdr_ = 0; opt->auth_algo_ = strdup("null"); opt->mux_ = 0; opt->key_.buf_ = NULL; @@ -299,6 +301,7 @@ void options_print_usage() printf(" [-c|--cipher] <cipher type> payload encryption algorithm\n"); printf(" [-a|--auth-algo] <algo type> message authentication algorithm\n"); // printf(" [-k|--kd-prf] <kd-prf type> key derivation pseudo random function\n"); + printf(" [-l|--ld-kdr] <ld-kdr> log2 of key derivation rate\n"); printf(" [-K|--key] <master key> master key to use for encryption\n"); printf(" [-A|--salt] <master salt> master salt to use for encryption\n"); } @@ -326,6 +329,7 @@ void options_print(options_t* opt) printf("cipher: '%s'\n", opt->cipher_); printf("auth_algo: '%s'\n", opt->auth_algo_); printf("kd_prf: '%s'\n", opt->kd_prf_); + printf("ld_kdr: %d\n", opt->ld_kdr_); u_int32_t i; printf("key_[%d]: '", opt->key_.length_); diff --git a/src/options.h b/src/options.h index 8fd413d..93836b5 100644 --- a/src/options.h +++ b/src/options.h @@ -55,6 +55,7 @@ struct options_struct { window_size_t seq_window_size_; char* cipher_; char* kd_prf_; + int ld_kdr_; char* auth_algo_; mux_t mux_; buffer_t key_; diff --git a/src/uanytun.c b/src/uanytun.c index b666575..b4ea9c0 100644 --- a/src/uanytun.c +++ b/src/uanytun.c @@ -106,7 +106,7 @@ int main_loop(tun_device_t* dev, udp_socket_t* sock, options_t* opt) } key_derivation_t kd; - ret = key_derivation_init(&kd, opt->kd_prf_, 0, opt->key_.buf_, opt->key_.length_, opt->salt_.buf_, opt->salt_.length_); + ret = key_derivation_init(&kd, opt->kd_prf_, opt->ld_kdr_, opt->key_.buf_, opt->key_.length_, opt->salt_.buf_, opt->salt_.length_); if(ret) { log_printf(ERR, "could not initialize key derivation of type %s", opt->kd_prf_); return_value = ret; |