| 50 |
50 |
| 51 for (i = 0; i < G_N_ELEMENTS(mech_hashes); ++i) { |
51 for (i = 0; i < G_N_ELEMENTS(mech_hashes); ++i) { |
| 52 if (strstr(mech, mech_hashes[i].mech_substr)) |
52 if (strstr(mech, mech_hashes[i].mech_substr)) |
| 53 return mech_hashes[i].hash; |
53 return mech_hashes[i].hash; |
| 54 } |
54 } |
| |
55 |
| |
56 purple_debug_error("jabber", "Unknown SCRAM mechanism %s\n", mech); |
| 55 |
57 |
| 56 return NULL; |
58 return NULL; |
| 57 } |
59 } |
| 58 |
60 |
| 59 static guint hash_to_output_len(const gchar *hash) |
61 static guint hash_to_output_len(const gchar *hash) |
| 373 #ifdef CHANNEL_BINDING |
375 #ifdef CHANNEL_BINDING |
| 374 if (strstr(js->auth_mech_name, "-PLUS")) |
376 if (strstr(js->auth_mech_name, "-PLUS")) |
| 375 data->channel_binding = TRUE; |
377 data->channel_binding = TRUE; |
| 376 #endif |
378 #endif |
| 377 cnonce = ((guint64)g_random_int() << 32) | g_random_int(); |
379 cnonce = ((guint64)g_random_int() << 32) | g_random_int(); |
| 378 data->cnonce = purple_base64_encode((guchar *)cnonce, sizeof(cnonce)); |
380 data->cnonce = purple_base64_encode((guchar *)&cnonce, sizeof(cnonce)); |
| 379 |
381 |
| 380 data->auth_message = g_string_new(NULL); |
382 data->auth_message = g_string_new(NULL); |
| 381 g_string_printf(data->auth_message, "n=%s,r=%s", |
383 g_string_printf(data->auth_message, "n=%s,r=%s", |
| 382 js->user->node /* TODO: SaslPrep */, |
384 js->user->node /* TODO: SaslPrep */, |
| 383 data->cnonce); |
385 data->cnonce); |