summaryrefslogtreecommitdiff
path: root/src/cmumble.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmumble.c')
-rw-r--r--src/cmumble.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/src/cmumble.c b/src/cmumble.c
index e76920e..dea3de9 100644
--- a/src/cmumble.c
+++ b/src/cmumble.c
@@ -98,28 +98,32 @@ recv_server_sync(MumbleProto__ServerSync *sync, struct cmumlbe *cm)
static void
recv_crypt_setup(MumbleProto__CryptSetup *crypt, struct cmumlbe *cm)
{
-#if 0
- int i;
-
- if (crypt->has_key) {
- g_print("key: 0x");
- for (i = 0; i < crypt->key.len; ++i)
- g_print("%x", crypt->key.data[i]);
- g_print("\n");
- }
- if (crypt->has_client_nonce) {
- g_print("client nonce: 0x");
- for (i = 0; i < crypt->client_nonce.len; ++i)
- g_print("%x", crypt->client_nonce.data[i]);
- g_print("\n");
- }
- if (crypt->has_server_nonce) {
- g_print("server nonce: 0x");
- for (i = 0; i < crypt->server_nonce.len; ++i)
- g_print("%x", crypt->server_nonce.data[i]);
- g_print("\n");
- }
+ /* FIXME: require all data lengths to be 16? */
+
+ if (crypt->key.len != 16 || crypt->client_nonce.len != 16 ||
+ crypt->server_nonce.len != 16)
+ return;
+
+ cm->ocb_key = g_memdup(crypt->key.data,
+ crypt->key.len);
+ cm->ocb_client_nonce = g_memdup(crypt->client_nonce.data,
+ crypt->client_nonce.len);
+ cm->ocb_server_nonce = g_memdup(crypt->server_nonce.data,
+ crypt->server_nonce.len);
+
+#if 1
+ cm->ocb = ocb_aes_init(cm->ocb_key, 3, NULL);
+ g_assert(cm->ocb);
#endif
+#if 1
+ CryptState_init(&cm->crypt);
+ CryptState_setKey(&cm->crypt,
+ cm->ocb_key,
+ cm->ocb_client_nonce,
+ cm->ocb_server_nonce);
+#endif
+
+ cmumble_connection_udp_init(cm);
}
static void