Mercurial > pidgin.yaz
comparison src/protocols/jabber/auth.c @ 11183:8dca96cbcd64
[gaim-migrate @ 13295]
I changed the cipher API to use guchar instead of guint8
This seems to be what gtk/glib uses for random bits of data
I don't know what got into me
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 03 Aug 2005 02:57:00 +0000 |
parents | 4cf257598691 |
children | 5cfc53ead482 |
comparison
equal
deleted
inserted
replaced
11182:5389d7d497ce | 11183:8dca96cbcd64 |
---|---|
225 xmlnode_insert_data(x, js->user->resource, -1); | 225 xmlnode_insert_data(x, js->user->resource, -1); |
226 | 226 |
227 x = xmlnode_new_child(query, "digest"); | 227 x = xmlnode_new_child(query, "digest"); |
228 s = g_strdup_printf("%s%s", js->stream_id, pw); | 228 s = g_strdup_printf("%s%s", js->stream_id, pw); |
229 | 229 |
230 gaim_cipher_digest_region("sha1", (guint8 *)s, strlen(s), | 230 gaim_cipher_digest_region("sha1", (guchar *)s, strlen(s), |
231 sizeof(hashval), hashval, NULL); | 231 sizeof(hashval), hashval, NULL); |
232 | 232 |
233 p = h; | 233 p = h; |
234 for(i=0; i<20; i++, p+=2) | 234 for(i=0; i<20; i++, p+=2) |
235 snprintf(p, 3, "%02x", hashval[i]); | 235 snprintf(p, 3, "%02x", hashval[i]); |
320 | 320 |
321 cipher = gaim_ciphers_find_cipher("md5"); | 321 cipher = gaim_ciphers_find_cipher("md5"); |
322 context = gaim_cipher_context_new(cipher, NULL); | 322 context = gaim_cipher_context_new(cipher, NULL); |
323 | 323 |
324 x = g_strdup_printf("%s:%s:%s", convnode, realm, convpasswd); | 324 x = g_strdup_printf("%s:%s:%s", convnode, realm, convpasswd); |
325 gaim_cipher_context_append(context, (const guint8 *)x, strlen(x)); | 325 gaim_cipher_context_append(context, (const guchar *)x, strlen(x)); |
326 gaim_cipher_context_digest(context, sizeof(result), result, NULL); | 326 gaim_cipher_context_digest(context, sizeof(result), result, NULL); |
327 | 327 |
328 a1 = g_strdup_printf("xxxxxxxxxxxxxxxx:%s:%s", nonce, cnonce); | 328 a1 = g_strdup_printf("xxxxxxxxxxxxxxxx:%s:%s", nonce, cnonce); |
329 a1len = strlen(a1); | 329 a1len = strlen(a1); |
330 g_memmove(a1, result, 16); | 330 g_memmove(a1, result, 16); |
331 | 331 |
332 gaim_cipher_context_reset(context, NULL); | 332 gaim_cipher_context_reset(context, NULL); |
333 gaim_cipher_context_append(context, (const guint8 *)a1, a1len); | 333 gaim_cipher_context_append(context, (const guchar *)a1, a1len); |
334 gaim_cipher_context_digest(context, sizeof(result), result, NULL); | 334 gaim_cipher_context_digest(context, sizeof(result), result, NULL); |
335 | 335 |
336 ha1 = gaim_base16_encode(result, 16); | 336 ha1 = gaim_base16_encode(result, 16); |
337 | 337 |
338 gaim_cipher_context_reset(context, NULL); | 338 gaim_cipher_context_reset(context, NULL); |
339 gaim_cipher_context_append(context, (const guint8 *)a2, strlen(a2)); | 339 gaim_cipher_context_append(context, (const guchar *)a2, strlen(a2)); |
340 gaim_cipher_context_digest(context, sizeof(result), result, NULL); | 340 gaim_cipher_context_digest(context, sizeof(result), result, NULL); |
341 | 341 |
342 ha2 = gaim_base16_encode(result, 16); | 342 ha2 = gaim_base16_encode(result, 16); |
343 | 343 |
344 kd = g_strdup_printf("%s:%s:00000001:%s:auth:%s", ha1, nonce, cnonce, ha2); | 344 kd = g_strdup_printf("%s:%s:00000001:%s:auth:%s", ha1, nonce, cnonce, ha2); |
345 | 345 |
346 gaim_cipher_context_reset(context, NULL); | 346 gaim_cipher_context_reset(context, NULL); |
347 gaim_cipher_context_append(context, (const guint8 *)kd, strlen(kd)); | 347 gaim_cipher_context_append(context, (const guchar *)kd, strlen(kd)); |
348 gaim_cipher_context_digest(context, sizeof(result), result, NULL); | 348 gaim_cipher_context_digest(context, sizeof(result), result, NULL); |
349 gaim_cipher_context_destroy(context); | 349 gaim_cipher_context_destroy(context); |
350 | 350 |
351 z = gaim_base16_encode(result, 16); | 351 z = gaim_base16_encode(result, 16); |
352 | 352 |