comparison libpurple/protocols/jabber/auth_scram.c @ 28752:a6cd1db77aee

jabber: Ugh, make this C89-compliant. Bah.
author Paul Aurich <paul@darkrain42.org>
date Fri, 04 Dec 2009 05:07:26 +0000
parents 4f45aae3ace1
children b94fd073187c
comparison
equal deleted inserted replaced
28751:5af6304fde5d 28752:a6cd1db77aee
138 guint i; 138 guint i;
139 139
140 GString *pass = g_string_new(data->password); 140 GString *pass = g_string_new(data->password);
141 141
142 guchar *salted_password; 142 guchar *salted_password;
143 guchar client_key[hash_len]; 143 guchar *client_key, *stored_key, *client_signature, *server_key;
144 guchar stored_key[hash_len]; 144
145 guchar client_signature[hash_len]; 145 client_key = g_new0(guchar, hash_len);
146 guchar server_key[hash_len]; 146 stored_key = g_new0(guchar, hash_len);
147 client_signature = g_new0(guchar, hash_len);
148 server_key = g_new0(guchar, hash_len);
147 149
148 data->client_proof = g_string_sized_new(hash_len); 150 data->client_proof = g_string_sized_new(hash_len);
149 data->client_proof->len = hash_len; 151 data->client_proof->len = hash_len;
150 data->server_signature = g_string_sized_new(hash_len); 152 data->server_signature = g_string_sized_new(hash_len);
151 data->server_signature->len = hash_len; 153 data->server_signature->len = hash_len;
173 hmac(data->hash, (guchar *)data->server_signature->str, server_key, data->auth_message->str); 175 hmac(data->hash, (guchar *)data->server_signature->str, server_key, data->auth_message->str);
174 176
175 /* client_proof = client_key XOR client_signature */ 177 /* client_proof = client_key XOR client_signature */
176 for (i = 0; i < hash_len; ++i) 178 for (i = 0; i < hash_len; ++i)
177 data->client_proof->str[i] = client_key[i] ^ client_signature[i]; 179 data->client_proof->str[i] = client_key[i] ^ client_signature[i];
180
181 g_free(server_key);
182 g_free(client_signature);
183 g_free(stored_key);
184 g_free(client_key);
178 185
179 return TRUE; 186 return TRUE;
180 } 187 }
181 188
182 static gboolean 189 static gboolean