Mxit: fix cipher.h conflict
--- a/libpurple/protocols/mxit/Makefile.am Thu Apr 03 04:20:57 2014 +0200
+++ b/libpurple/protocols/mxit/Makefile.am Thu Apr 03 04:23:35 2014 +0200
@@ -8,8 +8,8 @@
--- a/libpurple/protocols/mxit/actions.c Thu Apr 03 04:20:57 2014 +0200
+++ b/libpurple/protocols/mxit/actions.c Thu Apr 03 04:23:35 2014 +0200
@@ -32,7 +32,7 @@
#include "splashscreen.h"
+#include "cipher-mxit.h" --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/protocols/mxit/cipher-mxit.c Thu Apr 03 04:23:35 2014 +0200
@@ -0,0 +1,83 @@
+ * Purple is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +#include "cipher-mxit.h" +#include "ciphers/aescipher.h" +#define INITIAL_KEY "6170383452343567" +#define SECRET_HEADER "<mxit/>" + * Encrypt the user's cleartext password using the AES 128-bit (ECB) + * encryption algorithm. + * @param session The MXit session object + * @return The encrypted & encoded password. Must be g_free'd when +mxit_encrypt_password(struct MXitSession* session) + size_t clientkey_len, header_len, pass_len, plaintext_len; + const gchar *plaintext_passwd; + guchar encrypted[64]; /* shouldn't be longer than 17 */ + ssize_t encrypted_size; + purple_debug_info(MXIT_PLUGIN_ID, "mxit_encrypt_password"); + /* build the AES encryption key */ + g_assert(strlen(INITIAL_KEY) == sizeof(key)); + memcpy(key, INITIAL_KEY, sizeof(key)); + clientkey_len = strlen(session->clientkey); + if (clientkey_len > sizeof(key)) + clientkey_len = sizeof(key); + memcpy(key, session->clientkey, clientkey_len); + /* build the secret data to be encrypted: SECRET_HEADER + password */ + plaintext_passwd = purple_connection_get_password(session->con); + g_return_val_if_fail(plaintext_passwd, NULL); + pass_len = strlen(plaintext_passwd); + header_len = strlen(SECRET_HEADER); + /* Trailing NUL, just to be safe. But PKCS#7 seems to be enough. */ + plaintext_len = header_len + pass_len + 1; + plaintext = g_new0(guchar, plaintext_len); + memcpy(plaintext, SECRET_HEADER, header_len); + memcpy(plaintext + header_len, plaintext_passwd, pass_len); + cipher = purple_aes_cipher_new(); + purple_cipher_set_key(cipher, key, sizeof(key)); + purple_cipher_set_batch_mode(cipher, PURPLE_CIPHER_BATCH_MODE_ECB); + encrypted_size = purple_cipher_encrypt(cipher, + plaintext, plaintext_len, encrypted, sizeof(encrypted)); + g_return_val_if_fail(encrypted_size > 0, NULL); + return purple_base64_encode(encrypted, encrypted_size); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/protocols/mxit/cipher-mxit.h Thu Apr 03 04:23:35 2014 +0200
@@ -0,0 +1,31 @@
+ * Purple is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +mxit_encrypt_password(struct MXitSession* session); +#endif /* _MXIT_CIPHER_H_ */ --- a/libpurple/protocols/mxit/cipher.c Thu Apr 03 04:20:57 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
-#include "libpurple/cipher.h"
-#include "ciphers/aescipher.h"
-#define INITIAL_KEY "6170383452343567"
-#define SECRET_HEADER "<mxit/>"
- * Encrypt the user's cleartext password using the AES 128-bit (ECB)
- * encryption algorithm.
- * @param session The MXit session object
- * @return The encrypted & encoded password. Must be g_free'd when
-mxit_encrypt_password(struct MXitSession* session)
- size_t clientkey_len, header_len, pass_len, plaintext_len;
- const gchar *plaintext_passwd;
- guchar encrypted[64]; /* shouldn't be longer than 17 */
- ssize_t encrypted_size;
- purple_debug_info(MXIT_PLUGIN_ID, "mxit_encrypt_password");
- /* build the AES encryption key */
- g_assert(strlen(INITIAL_KEY) == sizeof(key));
- memcpy(key, INITIAL_KEY, sizeof(key));
- clientkey_len = strlen(session->clientkey);
- if (clientkey_len > sizeof(key))
- clientkey_len = sizeof(key);
- memcpy(key, session->clientkey, clientkey_len);
- /* build the secret data to be encrypted: SECRET_HEADER + password */
- plaintext_passwd = purple_connection_get_password(session->con);
- g_return_val_if_fail(plaintext_passwd, NULL);
- pass_len = strlen(plaintext_passwd);
- header_len = strlen(SECRET_HEADER);
- /* Trailing NUL, just to be safe. But PKCS#7 seems to be enough. */
- plaintext_len = header_len + pass_len + 1;
- plaintext = g_new0(guchar, plaintext_len);
- memcpy(plaintext, SECRET_HEADER, header_len);
- memcpy(plaintext + header_len, plaintext_passwd, pass_len);
- cipher = purple_aes_cipher_new();
- purple_cipher_set_key(cipher, key, sizeof(key));
- purple_cipher_set_batch_mode(cipher, PURPLE_CIPHER_BATCH_MODE_ECB);
- encrypted_size = purple_cipher_encrypt(cipher,
- plaintext, plaintext_len, encrypted, sizeof(encrypted));
- g_return_val_if_fail(encrypted_size > 0, NULL);
- return purple_base64_encode(encrypted, encrypted_size);
--- a/libpurple/protocols/mxit/cipher.h Thu Apr 03 04:20:57 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
-mxit_encrypt_password(struct MXitSession* session);
-#endif /* _MXIT_CIPHER_H_ */
--- a/libpurple/protocols/mxit/login.c Thu Apr 03 04:20:57 2014 +0200
+++ b/libpurple/protocols/mxit/login.c Thu Apr 03 04:23:35 2014 +0200
@@ -31,7 +31,7 @@
+#include "cipher-mxit.h"