diff options
author | Eion Robb <eion@robbmob.com> | 2018-06-15 02:51:41 +0300 |
---|---|---|
committer | Eion Robb <eion@robbmob.com> | 2018-06-15 02:51:41 +0300 |
commit | d192665b8ff362c956cf7ab801730c9f736559c4 (patch) | |
tree | 4763590818b1960590b5c2c7f31629649c6cd9ee | |
parent | cf650950f937cf4faf834063128693a6c6a30a00 (diff) |
purple3 compat. Fixes issue #614
-rw-r--r-- | skypeweb/purple2compat/ciphers/sha256hash.h | 18 | ||||
-rw-r--r-- | skypeweb/skypeweb_login.c | 2 | ||||
-rw-r--r-- | skypeweb/skypeweb_util.c | 15 |
3 files changed, 8 insertions, 27 deletions
diff --git a/skypeweb/purple2compat/ciphers/sha256hash.h b/skypeweb/purple2compat/ciphers/sha256hash.h deleted file mode 100644 index 85d65b0..0000000 --- a/skypeweb/purple2compat/ciphers/sha256hash.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _CIPHERS_SHA256HASH_H_ -#define _CIPHERS_SHA256HASH_H_ - -#include "cipher.h" - -#define purple_sha256_hash_new() purple_cipher_context_new(purple_ciphers_find_cipher("sha256"), NULL) - -#ifndef PurpleHash -# define PurpleHash PurpleCipherContext -# define purple_hash_append purple_cipher_context_append -# define purple_hash_digest_to_str(ctx, data, size) \ - purple_cipher_context_digest_to_str(ctx, size, data, NULL) -# define purple_hash_digest(ctx, data, size) \ - purple_cipher_context_digest(ctx, size, data, NULL) -# define purple_hash_destroy purple_cipher_context_destroy -#endif /*PurpleHash*/ - -#endif /*_CIPHERS_SHA256HASH_H_*/ diff --git a/skypeweb/skypeweb_login.c b/skypeweb/skypeweb_login.c index bb91fd9..c05bbd1 100644 --- a/skypeweb/skypeweb_login.c +++ b/skypeweb/skypeweb_login.c @@ -389,7 +389,7 @@ skypeweb_skyper_hash(const gchar *username, const gchar *password) g_checksum_get_digest(gc, hashed, &len);
g_checksum_free(gc);
- return purple_base64_encode(hashed, len);
+ return g_base64_encode(hashed, len);
}
static void
diff --git a/skypeweb/skypeweb_util.c b/skypeweb/skypeweb_util.c index 9aea0ed..b119ec3 100644 --- a/skypeweb/skypeweb_util.c +++ b/skypeweb/skypeweb_util.c @@ -18,8 +18,6 @@ #include "skypeweb_util.h"
-#include "ciphers/sha256hash.h"
-
gchar *
skypeweb_string_get_chunk(const gchar *haystack, gsize len, const gchar *start, const gchar *end)
{
@@ -126,12 +124,13 @@ skypeweb_thread_url_to_name(const gchar *url) char *
skypeweb_hmac_sha256(char *input)
{
- PurpleHash *hash;
+ GChecksum *hash;
const guchar productKey[] = SKYPEWEB_LOCKANDKEY_SECRET;
const guchar productID[] = SKYPEWEB_LOCKANDKEY_APPID;
const char hexChars[] = "0123456789abcdef";
char buf[BUFSIZE];
unsigned char sha256Hash[32];
+ gsize sha256HashLen = sizeof(sha256Hash);
unsigned char *newHash;
unsigned int *sha256Parts;
unsigned int *chlStringParts;
@@ -143,11 +142,11 @@ skypeweb_hmac_sha256(char *input) int len;
int i;
- hash = purple_sha256_hash_new();
- purple_hash_append(hash, (guchar *)input, strlen(input));
- purple_hash_append(hash, productKey, sizeof(productKey) - 1);
- purple_hash_digest(hash, (guchar *)sha256Hash, sizeof(sha256Hash));
- purple_hash_destroy(hash);
+ hash = g_checksum_new(G_CHECKSUM_SHA256);
+ g_checksum_update(hash, (guchar *)input, strlen(input));
+ g_checksum_update(hash, productKey, sizeof(productKey) - 1);
+ g_checksum_get_digest(hash, (guchar *)sha256Hash, &sha256HashLen);
+ g_checksum_free(hash);
/* Split it into four integers */
sha256Parts = (unsigned int *)sha256Hash;
|