From 5838d820581221a4166f3e1df0b2608a6952359e Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Mon, 26 Sep 2011 17:08:27 +0200 Subject: wip --- src/cmumble.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/cmumble.c') diff --git a/src/cmumble.c b/src/cmumble.c index 844a4d3..fb20e27 100644 --- a/src/cmumble.c +++ b/src/cmumble.c @@ -90,11 +90,25 @@ recv_server_sync(MumbleProto__ServerSync *sync, struct cmumble_context *ctx) g_print("got session: %d\n", ctx->session); } +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); } -- cgit