summaryrefslogtreecommitdiff
path: root/src/uanytun.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-01-02 16:14:23 +0000
committerChristian Pointner <equinox@anytun.org>2009-01-02 16:14:23 +0000
commit5329cef63bfb88ecf44c6a4dc360e33d70b84b41 (patch)
tree20caacbf3afe4f758f250962227c47122f478b69 /src/uanytun.c
parentadded option ld-kdr for the key derivation rate (diff)
some cleanup at key derivation
cipher supports now multiple key lengths and uses key derivation directly
Diffstat (limited to 'src/uanytun.c')
-rw-r--r--src/uanytun.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/uanytun.c b/src/uanytun.c
index b4ea9c0..8f677a4 100644
--- a/src/uanytun.c
+++ b/src/uanytun.c
@@ -110,7 +110,7 @@ int main_loop(tun_device_t* dev, udp_socket_t* sock, options_t* opt)
if(ret) {
log_printf(ERR, "could not initialize key derivation of type %s", opt->kd_prf_);
return_value = ret;
- }
+ }
seq_win_t seq_win;
ret = seq_win_init(&seq_win, opt->seq_window_size_);
@@ -158,7 +158,7 @@ int main_loop(tun_device_t* dev, udp_socket_t* sock, options_t* opt)
else
plain_packet_set_type(&plain_packet, PAYLOAD_TYPE_UNKNOWN);
- cipher_encrypt(&c, &plain_packet, &encrypted_packet, seq_nr, opt->sender_id_, opt->mux_);
+ cipher_encrypt(&c, &kd, &plain_packet, &encrypted_packet, seq_nr, opt->sender_id_, opt->mux_);
seq_nr++;
// TODO: add auth-tag
@@ -201,7 +201,7 @@ int main_loop(tun_device_t* dev, udp_socket_t* sock, options_t* opt)
free(addrstring);
}
- cipher_decrypt(&c, &encrypted_packet, &plain_packet);
+ cipher_decrypt(&c, &kd, &encrypted_packet, &plain_packet);
len = tun_write(dev, plain_packet_get_payload(&plain_packet), plain_packet_get_payload_length(&plain_packet));
if(len == -1)
@@ -210,6 +210,7 @@ int main_loop(tun_device_t* dev, udp_socket_t* sock, options_t* opt)
}
cipher_close(&c);
+ key_derivation_close(&kd);
seq_win_clear(&seq_win);
return return_value;