pidgin/pidgin

Parents 5fce95601b6d
Children 38a40ddbb9b7
jabber/auth_scram: prefix the names of the 'hmac' and 'hash' functions

Trac ticket #17061 says that netbsd added a function called hmac to its libc.

These are private (static) functions so it's safe to rename them. Also renaming
the hash function just in case.

Fixes #17061
--- a/libpurple/protocols/jabber/auth_scram.c Sat May 27 20:04:10 2017 -0300
+++ b/libpurple/protocols/jabber/auth_scram.c Wed Apr 12 01:44:03 2017 -0300
@@ -129,12 +129,12 @@
* is the hash algorithm. All buffers must be of the appropriate size
* according to the JabberScramHash.
*
- * "str" is a NULL-terminated string for hmac().
+ * "str" is a NULL-terminated string for jabber_scram_hmac().
*
* Needless to say, these are fragile.
*/
static void
-hmac(const JabberScramHash *hash, guchar *out, const guchar *key, const gchar *str)
+jabber_scram_hmac(const JabberScramHash *hash, guchar *out, const guchar *key, const gchar *str)
{
PurpleCipherContext *context;
@@ -147,7 +147,7 @@
}
static void
-hash(const JabberScramHash *hash, guchar *out, const guchar *data)
+jabber_scram_hash(const JabberScramHash *hash, guchar *out, const guchar *data)
{
PurpleCipherContext *context;
@@ -187,18 +187,18 @@
return FALSE;
/* client_key = HMAC(salted_password, "Client Key") */
- hmac(data->hash, client_key, salted_password, "Client Key");
+ jabber_scram_hmac(data->hash, client_key, salted_password, "Client Key");
/* server_key = HMAC(salted_password, "Server Key") */
- hmac(data->hash, server_key, salted_password, "Server Key");
+ jabber_scram_hmac(data->hash, server_key, salted_password, "Server Key");
g_free(salted_password);
/* stored_key = HASH(client_key) */
- hash(data->hash, stored_key, client_key);
+ jabber_scram_hash(data->hash, stored_key, client_key);
/* client_signature = HMAC(stored_key, auth_message) */
- hmac(data->hash, client_signature, stored_key, data->auth_message->str);
+ jabber_scram_hmac(data->hash, client_signature, stored_key, data->auth_message->str);
/* server_signature = HMAC(server_key, auth_message) */
- hmac(data->hash, (guchar *)data->server_signature->str, server_key, data->auth_message->str);
+ jabber_scram_hmac(data->hash, (guchar *)data->server_signature->str, server_key, data->auth_message->str);
/* client_proof = client_key XOR client_signature */
for (i = 0; i < hash_len; ++i)