Changeset 34afea7 for protocols


Ignore:
Timestamp:
2015-01-31T23:58:57Z (10 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
0ca1d79
Parents:
e41cc40
git-author:
dequis <dx@…> (18-01-15 06:39:20)
git-committer:
dequis <dx@…> (31-01-15 23:58:57)
Message:

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)

Location:
protocols/jabber
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber.c

    re41cc40 r34afea7  
    317317       
    318318        xt_free( jd->xt );
     319
     320        md5_free( &jd->cached_id_prefix );
    319321       
    320322        g_free( jd->oauth2_access_token );
  • protocols/jabber/jabber_util.c

    re41cc40 r34afea7  
    148148        id_hash = jd->cached_id_prefix;
    149149        md5_append( &id_hash, (md5_byte_t*) &next_id, sizeof( next_id ) );
    150         md5_finish( &id_hash, id_sum );
     150        md5_digest_keep( &id_hash, id_sum );
    151151        asc_hash = base64_encode( id_sum, 12 );
    152152       
Note: See TracChangeset for help on using the changeset viewer.