diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2011-09-26 17:08:27 +0200 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2011-09-26 17:08:27 +0200 |
commit | 5838d820581221a4166f3e1df0b2608a6952359e (patch) | |
tree | 12da0065b9233187c8e0cb6c228d4372d5083082 /src/cmumble.c | |
parent | b53fa04f47b54e08733ba3859bfaac171ab1c7af (diff) | |
download | cmumble-5838d820581221a4166f3e1df0b2608a6952359e.tar.gz cmumble-5838d820581221a4166f3e1df0b2608a6952359e.tar.bz2 cmumble-5838d820581221a4166f3e1df0b2608a6952359e.zip |
wip
Diffstat (limited to 'src/cmumble.c')
-rw-r--r-- | src/cmumble.c | 25 |
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); } |