summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordx <dx@dxzone.com.ar>2017-04-12 01:44:03 -0300
committerdx <dx@dxzone.com.ar>2017-04-12 01:44:03 -0300
commitfe824dd5cae18e312e35d740352f05b434ceb0ee (patch)
treeec612b32dbdf9fc3ee6ab50acec383c4191ef06d
parent86d30dad52ce5e0a57bee36e28e31b7af71cfc01 (diff)
downloadpidgin-fe824dd5cae18e312e35d740352f05b434ceb0ee.tar.gz
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
-rw-r--r--libpurple/protocols/jabber/auth_scram.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libpurple/protocols/jabber/auth_scram.c b/libpurple/protocols/jabber/auth_scram.c
index 7d59f72863..7f2a9c827c 100644
--- a/libpurple/protocols/jabber/auth_scram.c
+++ b/libpurple/protocols/jabber/auth_scram.c
@@ -129,12 +129,12 @@ guchar *jabber_scram_hi(const JabberScramHash *hash, const GString *str,
* 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 @@ hmac(const JabberScramHash *hash, guchar *out, const guchar *key, const gchar *s
}
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 @@ jabber_scram_calc_proofs(JabberScramData *data, GString *salt, guint iterations)
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)