/soc/2013/ankitkv/gobjectification: 18cc6efb5194: Added reset at...

Ankit Vani a at nevitus.org
Fri Jun 14 12:59:09 EDT 2013


Changeset: 18cc6efb51940997f56555ff75d6960080ac9853
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-06-14 22:29 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/18cc6efb5194

Description:

Added reset at every cipher's initialization

diffstat:

 libpurple/ciphers/des.c  |  8 +-------
 libpurple/ciphers/des3.c |  2 ++
 libpurple/ciphers/hmac.c |  2 +-
 3 files changed, 4 insertions(+), 8 deletions(-)

diffs (56 lines):

diff --git a/libpurple/ciphers/des.c b/libpurple/ciphers/des.c
--- a/libpurple/ciphers/des.c
+++ b/libpurple/ciphers/des.c
@@ -513,12 +513,6 @@ purple_des_cipher_set_property(GObject *
 }
 
 static void
-purple_des_cipher_finalize(GObject *obj)
-{
-	parent_class->finalize(obj);
-}
-
-static void
 purple_des_cipher_class_init(PurpleDESCipherClass *klass)
 {
 	GObjectClass *obj_class = G_OBJECT_CLASS(klass);
@@ -527,7 +521,6 @@ purple_des_cipher_class_init(PurpleDESCi
 
 	parent_class = g_type_class_peek_parent(klass);
 
-	obj_class->finalize = purple_des_cipher_finalize;
 	obj_class->set_property = purple_des_cipher_set_property;
 
 	cipher_class->encrypt = purple_des_cipher_encrypt;
@@ -555,6 +548,7 @@ purple_des_cipher_get_type(void) {
 			.class_size = sizeof(PurpleDESCipherClass),
 			.class_init = (GClassInitFunc)purple_des_cipher_class_init,
 			.instance_size = sizeof(PurpleDESCipher),
+			.instance_init = (GInstanceInitFunc)purple_cipher_reset,
 		};
 
 		type = g_type_register_static(PURPLE_TYPE_CIPHER,
diff --git a/libpurple/ciphers/des3.c b/libpurple/ciphers/des3.c
--- a/libpurple/ciphers/des3.c
+++ b/libpurple/ciphers/des3.c
@@ -488,6 +488,8 @@ purple_des3_cipher_init(PurpleCipher *ci
 	priv->key1 = purple_des_cipher_new();
 	priv->key2 = purple_des_cipher_new();
 	priv->key3 = purple_des_cipher_new();
+
+	purple_des3_cipher_reset(cipher);
 }
 
 /******************************************************************************
diff --git a/libpurple/ciphers/hmac.c b/libpurple/ciphers/hmac.c
--- a/libpurple/ciphers/hmac.c
+++ b/libpurple/ciphers/hmac.c
@@ -314,7 +314,7 @@ purple_hmac_cipher_get_gtype(void) {
 			NULL,
 			sizeof(PurpleHMACCipher),
 			0,
-			NULL,
+			(GInstanceInitFunc)purple_cipher_reset,
 			NULL,
 		};
 



More information about the Commits mailing list