summaryrefslogtreecommitdiff
path: root/src/cmumble.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmumble.c')
-rw-r--r--src/cmumble.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/cmumble.c b/src/cmumble.c
index 844a4d3..fb20e27 100644
--- a/src/cmumble.c
+++ b/src/cmumble.c
@@ -91,10 +91,24 @@ recv_server_sync(MumbleProto__ServerSync *sync, struct cmumble_context *ctx)
}
static void
+print_hex(char *hex, int num)
+{
+ int i;
+
+ for (i = 0; i < num; ++i)
+ printf("%02x", hex[i] & 0xff);
+
+}
+
+static void
recv_crypt_setup(MumbleProto__CryptSetup *crypt, struct cmumble_context *ctx)
{
/* FIXME: require all data lengths to be 16? */
+ if (crypt->key.len != 16 || crypt->client_nonce.len != 16 ||
+ crypt->server_nonce.len != 16)
+ return;
+
ctx->ocb_key = g_memdup(crypt->key.data,
crypt->key.len);
ctx->ocb_client_nonce = g_memdup(crypt->client_nonce.data,
@@ -102,8 +116,17 @@ recv_crypt_setup(MumbleProto__CryptSetup *crypt, struct cmumble_context *ctx)
ctx->ocb_server_nonce = g_memdup(crypt->server_nonce.data,
crypt->server_nonce.len);
- ctx->ocb = ocb_aes_init(ctx->ocb_key, 16, NULL);
+#if 1
+ ctx->ocb = ocb_aes_init(ctx->ocb_key, 3, NULL);
g_assert(ctx->ocb);
+#endif
+#if 1
+ CryptState_init(&ctx->crypt);
+ CryptState_setKey(&ctx->crypt,
+ ctx->ocb_key,
+ ctx->ocb_client_nonce,
+ ctx->ocb_server_nonce);
+#endif
cmumble_connection_udp_init(ctx);
}