Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/majn/telegram-purple.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEion Robb <eion@robbmob.com>2015-12-15 01:36:23 +0300
committerBen Wiederhake <BenWiederhake.GitHub@gmx.de>2015-12-30 16:34:44 +0300
commit0d7e8923c579a4236ce362a6d4b074f2776684f7 (patch)
treee45751db58b7a6a09b677550a6579ceb6697f8a8 /telegram-base.c
parent86f7fe0b9a443f340dbbe6e3094892553339152f (diff)
Remove the need for gcrypt in telegram-purple
Use libpurple's own SHA1 implementation
Diffstat (limited to 'telegram-base.c')
-rw-r--r--telegram-base.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/telegram-base.c b/telegram-base.c
index 5c58696..f6e4ac1 100644
--- a/telegram-base.c
+++ b/telegram-base.c
@@ -22,7 +22,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
-#include <gcrypt.h>
+#include <cipher.h>
#include "telegram-base.h"
@@ -379,7 +379,11 @@ void read_secret_chat (struct tgl_state *TLS, int fd, int v) {
if (v >= 2) {
assert (read (fd, sha, 20) == 20);
} else {
- gcry_md_hash_buffer (GCRY_MD_SHA1, sha, (void *)key, 256);
+ PurpleCipher *sha1_cipher = purple_ciphers_find_cipher("sha1");
+ PurpleCipherContext *sha1_ctx = purple_cipher_context_new(sha1_cipher, NULL);
+ purple_cipher_context_append(sha1_ctx, key, 256);
+ purple_cipher_context_digest(sha1_ctx, 20, sha, NULL);
+ purple_cipher_context_destroy(sha1_ctx);
}
int in_seq_no = 0, out_seq_no = 0, last_in_seq_no = 0;
if (v >= 1) {