diff plugins/ciphertest.c @ 10687:b256ce6b85b8

[gaim-migrate @ 12235] grim says this is really fixed this time. committer: Tailor Script <tailor@pidgin.im>
author Etan Reisner <pidgin@unreliablesource.net>
date Sat, 12 Mar 2005 01:10:37 +0000
parents 72a5babfa8b4
children 50224ac8184d
line wrap: on
line diff
--- a/plugins/ciphertest.c	Fri Mar 11 22:45:41 2005 +0000
+++ b/plugins/ciphertest.c	Sat Mar 12 01:10:37 2005 +0000
@@ -65,6 +65,7 @@
 	GaimCipher *cipher;
 	GaimCipherContext *context;
 	gchar digest[32];
+	gboolean ret;
 	gint i = 0;
 
 	cipher = gaim_ciphers_find_cipher("md5");
@@ -85,10 +86,16 @@
 		gaim_cipher_context_append(context, md5_tests[i].question,
 								   strlen(md5_tests[i].question));
 
-		gaim_cipher_context_digest_to_str(context, NULL, digest);
+		ret = gaim_cipher_context_digest_to_str(context, sizeof(digest),
+												digest, NULL);
 
-		gaim_debug_info("cipher-test", "\tGot:    %s\n", digest);
-		gaim_debug_info("cipher-test", "\tWanted: %s\n", md5_tests[i].answer);
+		if(!ret) {
+			gaim_debug_info("cipher-test", "failed\n");
+		} else {
+			gaim_debug_info("cipher-test", "\tGot:    %s\n", digest);
+			gaim_debug_info("cipher-test", "\tWanted: %s\n",
+							md5_tests[i].answer);
+		}
 
 		gaim_cipher_context_reset(context, NULL);
 		i++;
@@ -116,6 +123,7 @@
 	GaimCipherContext *context;
 	gchar digest[40];
 	gint i = 0;
+	gboolean ret;
 
 	cipher = gaim_ciphers_find_cipher("sha1");
 	if(!cipher) {
@@ -147,10 +155,16 @@
 				gaim_cipher_context_append(context, buff, 1000);
 		}
 
-		gaim_cipher_context_digest_to_str(context, NULL, digest);
+		ret = gaim_cipher_context_digest_to_str(context, sizeof(digest),
+												digest, NULL);
 
-		gaim_debug_info("cipher-test", "\tGot:    %s\n", digest);
-		gaim_debug_info("cipher-test", "\tWanted: %s\n", sha1_tests[i].answer);
+		if(!ret) {
+			gaim_debug_info("cipher-test", "failed\n");
+		} else {
+			gaim_debug_info("cipher-test", "\tGot:    %s\n", digest);
+			gaim_debug_info("cipher-test", "\tWanted: %s\n",
+							sha1_tests[i].answer);
+		}
 
 		gaim_cipher_context_reset(context, NULL);
 		i++;