plugins/ciphertest.c

changeset 10687
5ac4b470bee8
parent 10684
0325b164a7eb
child 11033
dc68e074f10d
--- 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++;

mercurial