summaryrefslogtreecommitdiff
path: root/ot_udp.c
diff options
context:
space:
mode:
Diffstat (limited to 'ot_udp.c')
-rw-r--r--ot_udp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ot_udp.c b/ot_udp.c
index 990868c..a625dba 100644
--- a/ot_udp.c
+++ b/ot_udp.c
@@ -52,7 +52,7 @@ static void udp_generate_rijndael_round_key(void) {
52static void udp_make_connectionid(uint32_t connid[2], const ot_ip6 remoteip, int age) { 52static void udp_make_connectionid(uint32_t connid[2], const ot_ip6 remoteip, int age) {
53 uint32_t plain[4], crypt[4]; 53 uint32_t plain[4], crypt[4];
54 int i; 54 int i;
55 if (g_now_minutes + 60 > g_hour_of_the_key) { 55 if (g_now_minutes - g_hour_of_the_key >= 60) {
56 g_hour_of_the_key = g_now_minutes; 56 g_hour_of_the_key = g_now_minutes;
57 g_key_of_the_hour[1] = g_key_of_the_hour[0]; 57 g_key_of_the_hour[1] = g_key_of_the_hour[0];
58#ifdef WANT_ARC4RANDOM 58#ifdef WANT_ARC4RANDOM
@@ -65,7 +65,7 @@ static void udp_make_connectionid(uint32_t connid[2], const ot_ip6 remoteip, int
65 memcpy(plain, remoteip, sizeof(plain)); 65 memcpy(plain, remoteip, sizeof(plain));
66 for (i = 0; i < 4; ++i) 66 for (i = 0; i < 4; ++i)
67 plain[i] ^= g_key_of_the_hour[age]; 67 plain[i] ^= g_key_of_the_hour[age];
68 rijndaelEncrypt128(g_rijndael_round_key, (uint8_t *)remoteip, (uint8_t *)crypt); 68 rijndaelEncrypt128(g_rijndael_round_key, (uint8_t *)plain, (uint8_t *)crypt);
69 connid[0] = crypt[0] ^ crypt[1]; 69 connid[0] = crypt[0] ^ crypt[1];
70 connid[1] = crypt[2] ^ crypt[3]; 70 connid[1] = crypt[2] ^ crypt[3];
71} 71}