From 6e67e6225fe79b7c45f369ba2a87af559f096011 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Sun, 2 Feb 2025 15:47:40 +0100 Subject: [PATCH] fixed encrypt_decrypt_message base64 problems --- src/chat/misc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/chat/misc.c b/src/chat/misc.c index 028e8cb..23db65c 100644 --- a/src/chat/misc.c +++ b/src/chat/misc.c @@ -173,6 +173,11 @@ void remove_non_ascii(char **text) (*text)[j] = '\0'; } +char *__fake_base64(char *text, WHY2_UNUSED size_t *length) +{ + return why2_strdup(text); +} + void encrypt_decrypt_message(char **message, char *key, enum ENCRYPTION_DECRYPTION operation) { //NO ENCRYPTION @@ -180,19 +185,22 @@ void encrypt_decrypt_message(char **message, char *key, enum ENCRYPTION_DECRYPTI //CALLBACKS why2_output_flags (*operation_cb)(char*, char*) = NULL; - char *(*base64_cb)(char*, size_t*) = NULL; + char *(*base64_before_cb)(char*, size_t*) = NULL; + char *(*base64_after_cb)(char*, size_t*) = NULL; //SELECT CORRECT CALLBACK switch (operation) { case ENCRYPTION: operation_cb = why2_encrypt_text; - base64_cb = why2_chat_base64_encode; + base64_before_cb = __fake_base64; + base64_after_cb = why2_chat_base64_encode; break; case DECRYPTION: operation_cb = why2_decrypt_text; - base64_cb = why2_chat_base64_decode; + base64_before_cb = why2_chat_base64_decode; + base64_after_cb = __fake_base64; break; default: