On 04/04/2011 01:14 PM, Lucian Horga wrote:
@@ -2192,17 +2204,33 @@ ag_account_sign (AgAccount *account, const gchar *key, 
const gchar *token)

      g_return_if_fail (data != NULL);

-    /* TODO: sign data with token - depends on libmaemosec */
+    aegis_crypto_result result_sign =
+              aegis_crypto_sign (data,
+                                 strlen (data),
+                                 token,
+&signature);
+    aegis_crypto_free (data);

Who allocated "data"? I think this should be a g_free().

+    token_name = NULL;
+    result_convert =  aegis_crypto_string_to_signature (sgn.signature,
+&signature,
+&token_name);

-    /* TODO: verify data with sgn->signature - depends on libmaemosec */
+    if (result_convert != aegis_crypto_ok) {
+        *token = NULL;
+        aegis_crypto_finish ();
+        aegis_crypto_free (data);

Same here: g_free.

+        return FALSE;
+    }

-    g_free (data);
+    result_verify = aegis_crypto_verify (&signature,
+                                         token_name,
+                                         data,
+                                         strlen (data),
+&made_in_mode);
+
+    if (result_verify != aegis_crypto_ok) {
+        *token = NULL;
+        aegis_crypto_finish ();
+        aegis_crypto_free (data);

g_free, and also free the token_name (I'll let you guess how :-) ).

+        return FALSE;
+    }
+
+    *token = g_strdup (token_name);
+    if (token_name)
+       aegis_crypto_free (token_name);
+
+    aegis_crypto_finish ();
+    aegis_crypto_free (data);

g_free().

Ciao,
  Alberto

--
http://blog.mardy.it <-- geek in un lingua international!
_______________________________________________
MeeGo-dev mailing list
MeeGo-dev@meego.com
http://lists.meego.com/listinfo/meego-dev
http://wiki.meego.com/Mailing_list_guidelines

Reply via email to