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 /lib/oauth.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 'lib/oauth.c')
-rw-r--r-- | lib/oauth.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/oauth.c b/lib/oauth.c index 6bf8e4e0..54c272c8 100644 --- a/lib/oauth.c +++ b/lib/oauth.c @@ -37,7 +37,7 @@ static char *oauth_sign( const char *method, const char *url, const char *params, struct oauth_info *oi ) { - uint8_t hash[sha1_hash_size]; + uint8_t hash[SHA1_HASH_SIZE]; GString *payload = g_string_new( "" ); char *key; char *s; @@ -65,7 +65,7 @@ static char *oauth_sign( const char *method, const char *url, /* base64_encode + HTTP escape it (both consumers need it that away) and we're done. */ - s = base64_encode( hash, sha1_hash_size ); + s = base64_encode( hash, SHA1_HASH_SIZE ); s = g_realloc( s, strlen( s ) * 3 + 1 ); http_encode( s ); |