/pidgin/main: 8967e773228f: Merging

Gary Kramlich grim at reaperworld.com
Sun Jun 23 03:43:13 EDT 2013


Changeset: 8967e773228f9131123b9dd353cb34f6f7821392
Author:	 Gary Kramlich <grim at reaperworld.com>
Date:	 2013-06-23 02:37 -0500
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/8967e773228f

Description:

Merging

diffstat:

 .hgignore                     |   4 ++++
 libpurple/tests/test_cipher.c |  43 ++++++++++++++++---------------------------
 2 files changed, 20 insertions(+), 27 deletions(-)

diffs (130 lines):

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -1,3 +1,6 @@
+syntax: glob
+.*.swp
+
 syntax: regexp
 (.*/)?TAGS$
 (.*/)?\.svn
@@ -71,6 +74,7 @@ libpurple/purple-client-example
 libpurple/purple.h$
 libpurple/tests/check_libpurple
 libpurple/tests/libpurple..
+^libpurple/tests/test-suite\.log$
 libpurple/version.h$
 libpurple/win32/libpurplerc.rc$
 libtool
diff --git a/libpurple/tests/test_cipher.c b/libpurple/tests/test_cipher.c
--- a/libpurple/tests/test_cipher.c
+++ b/libpurple/tests/test_cipher.c
@@ -22,8 +22,7 @@
 	context = purple_cipher_context_new(cipher, NULL); \
 	purple_cipher_context_append(context, (guchar *)(data), strlen((data))); \
 	\
-	ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \
-	                                        NULL); \
+	ret = purple_cipher_context_digest_to_str(context, cdigest, sizeof(cdigest)); \
 	\
 	fail_unless(ret == TRUE, NULL); \
 	\
@@ -85,8 +84,7 @@ END_TEST
 	context = purple_cipher_context_new(cipher, NULL); \
 	purple_cipher_context_append(context, (guchar *)(data), strlen((data))); \
 	\
-	ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \
-	                                        NULL); \
+	ret = purple_cipher_context_digest_to_str(context, cdigest, sizeof(cdigest)); \
 	\
 	fail_unless(ret == TRUE, NULL); \
 	\
@@ -159,8 +157,7 @@ END_TEST
 			purple_cipher_context_append(context, buff, 1000); \
 	} \
 	\
-	ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \
-	                                        NULL); \
+	ret = purple_cipher_context_digest_to_str(context, cdigest, sizeof(cdigest)); \
 	\
 	fail_unless(ret == TRUE, NULL); \
 	\
@@ -220,8 +217,7 @@ END_TEST
 			purple_cipher_context_append(context, buff, 1000); \
 	} \
 	\
-	ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \
-	                                        NULL); \
+	ret = purple_cipher_context_digest_to_str(context, cdigest, sizeof(cdigest)); \
 	\
 	fail_unless(ret == TRUE, NULL); \
 	\
@@ -267,20 +263,17 @@ END_TEST
 	guchar decrypt[len+1] = in; \
 	guchar key[8+1] = keyz;\
 	guchar encrypt[len+1] = out;\
-	size_t outlen; \
 	\
 	cipher = purple_ciphers_find_cipher("des"); \
 	context = purple_cipher_context_new(cipher, NULL); \
-	purple_cipher_context_set_key(context, key); \
+	purple_cipher_context_set_key(context, key, sizeof(key)); \
 	\
-	ret = purple_cipher_context_encrypt(context, decrypt, len, answer, &outlen); \
-	fail_unless(ret == 0, NULL); \
-	fail_unless(outlen == (len), NULL); \
+	ret = purple_cipher_context_encrypt(context, decrypt, len, answer, sizeof(answer)); \
+	fail_unless(ret == len, NULL); \
 	fail_unless(memcmp(encrypt, answer, len) == 0, NULL); \
 	\
-	ret = purple_cipher_context_decrypt(context, encrypt, len, answer, &outlen); \
-	fail_unless(ret == 0, NULL); \
-	fail_unless(outlen == (len), NULL); \
+	ret = purple_cipher_context_decrypt(context, encrypt, len, answer, sizeof(answer)); \
+	fail_unless(ret == len, NULL); \
 	fail_unless(memcmp(decrypt, answer, len) == 0, NULL); \
 	\
 	purple_cipher_context_destroy(context); \
@@ -314,23 +307,20 @@ END_TEST
 	guchar answer[len+1]; \
 	guchar decrypt[len+1] = in; \
 	guchar encrypt[len+1] = out; \
-	size_t outlen; \
 	gint ret = 0; \
 	\
 	cipher = purple_ciphers_find_cipher("des3"); \
 	context = purple_cipher_context_new(cipher, NULL); \
-	purple_cipher_context_set_key(context, (guchar *)key); \
+	purple_cipher_context_set_key(context, (guchar *)key, sizeof(key)); \
 	purple_cipher_context_set_batch_mode(context, (mode)); \
 	purple_cipher_context_set_iv(context, (guchar *)iv, 8); \
 	\
-	ret = purple_cipher_context_encrypt(context, decrypt, len, answer, &outlen); \
-	fail_unless(ret == 0, NULL); \
-	fail_unless(outlen == (len), NULL); \
+	ret = purple_cipher_context_encrypt(context, decrypt, len, answer, sizeof(answer)); \
+	fail_unless(ret == len, NULL); \
 	fail_unless(memcmp(encrypt, answer, len) == 0, NULL); \
 	\
-	ret = purple_cipher_context_decrypt(context, encrypt, len, answer, &outlen); \
-	fail_unless(ret == 0, NULL); \
-	fail_unless(outlen == (len), NULL); \
+	ret = purple_cipher_context_decrypt(context, encrypt, len, answer, sizeof(answer)); \
+	fail_unless(ret == len, NULL); \
 	fail_unless(memcmp(decrypt, answer, len) == 0, NULL); \
 	\
 	purple_cipher_context_destroy(context); \
@@ -488,11 +478,10 @@ END_TEST
 	cipher = purple_ciphers_find_cipher("hmac"); \
 	context = purple_cipher_context_new(cipher, NULL); \
 	purple_cipher_context_set_option(context, "hash", type); \
-	purple_cipher_context_set_key_with_len(context, (guchar *)key, (key_len)); \
+	purple_cipher_context_set_key(context, (guchar *)key, (key_len)); \
 	\
 	purple_cipher_context_append(context, (guchar *)(data), (data_len)); \
-	ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \
-	                                        NULL); \
+	ret = purple_cipher_context_digest_to_str(context, cdigest, sizeof(cdigest)); \
 	\
 	fail_unless(ret == TRUE, NULL); \
 	fail_unless(strcmp((digest), cdigest) == 0, NULL); \



More information about the Commits mailing list