diff options
author | dequis <dx@dxzone.com.ar> | 2015-01-18 03:39:20 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-01-31 20:58:57 -0300 |
commit | 34afea7dd6b066a9e7153d16a8e386c7c90ffe87 (patch) | |
tree | ea152e8c35fe5c9c273a8d2a64dfe0b91c51bf4b /protocols/jabber/jabber_util.c | |
parent | e41cc4034741547c17ec4d24b9fdc50a8d2a5ee5 (diff) |
Use glib's GChecksum for md5/sha1
This changes behavior slightly:
- md5_init()/sha1_init() allocate a GChecksum
- md5_finish()/sha1_finish() close and free() it
- md5_digest_keep() was added (no sha1 equivalent needed)
And yes, glib has this concept of "closing" the GChecksum, which means
it can't be used anymore after g_checksum_get_digest().
jabber_cache_add() actually seems to need to do that to generate some
random-ish values, so i kept that working by adding a md5_digest_keep()
function that copies the GChecksum before it gets closed
GChecksum was introduced in glib 2.16, so the configure script version
was bumped. We were already depending on glib 2.16 accidentally
(some post-3.2.2 code uses GHashTableIter)
Diffstat (limited to 'protocols/jabber/jabber_util.c')
-rw-r--r-- | protocols/jabber/jabber_util.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c index 1a3d9fd4..0276db9f 100644 --- a/protocols/jabber/jabber_util.c +++ b/protocols/jabber/jabber_util.c @@ -147,7 +147,7 @@ void jabber_cache_add( struct im_connection *ic, struct xt_node *node, jabber_ca id_hash = jd->cached_id_prefix; md5_append( &id_hash, (md5_byte_t*) &next_id, sizeof( next_id ) ); - md5_finish( &id_hash, id_sum ); + md5_digest_keep( &id_hash, id_sum ); asc_hash = base64_encode( id_sum, 12 ); id = g_strdup_printf( "%s%s", JABBER_CACHED_ID, asc_hash ); |