libpurple/ciphers/rc4cipher.c

Sun, 16 Jun 2013 03:46:10 +0530

author
Ankit Vani <a@nevitus.org>
date
Sun, 16 Jun 2013 03:46:10 +0530
branch
soc.2013.gobjectification
changeset 34566
e0f887dee077
parent 34551
libpurple/ciphers/rc4.c@4f3fb841c618
child 34965
9abd15d6da07
permissions
-rw-r--r--

Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.

31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * purple
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 *
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * source distribution.
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 *
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * (at your option) any later version.
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 *
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * GNU General Public License for more details.
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 *
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
34566
e0f887dee077 Split PurpleCipher into PurpleCipher and PurpleHash. Hashes will subclass PurpleHash.
Ankit Vani <a@nevitus.org>
parents: 34551
diff changeset
22 #include "rc4cipher.h"
33911
a924aacd5a37 ciphers cleanup: encryption and decryption lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33910
diff changeset
23
34536
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
24 /*******************************************************************************
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
25 * Structs
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
26 ******************************************************************************/
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
27 #define PURPLE_RC4_CIPHER_GET_PRIVATE(obj) \
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
28 (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_RC4_CIPHER, PurpleRC4CipherPrivate))
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
34536
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
30 typedef struct {
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
31 guchar state[256];
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
32 guchar x;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
33 guchar y;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
34 gint key_len;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
35 } PurpleRC4CipherPrivate;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
36
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
37 /******************************************************************************
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
38 * Enums
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
39 *****************************************************************************/
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
40 enum {
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
41 PROP_ZERO,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
42 PROP_KEY_LEN,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
43 PROP_KEY,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
44 PROP_LAST,
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 };
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46
34536
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
47 /******************************************************************************
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
48 * Globals
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
49 *****************************************************************************/
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
50 static GObjectClass *parent_class = NULL;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
51
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
52 /******************************************************************************
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
53 * Cipher Stuff
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
54 *****************************************************************************/
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 static void
34536
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
56 purple_rc4_cipher_reset(PurpleCipher *cipher) {
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
57 PurpleRC4Cipher *rc4_cipher = PURPLE_RC4_CIPHER(cipher);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
58 PurpleRC4CipherPrivate *priv = PURPLE_RC4_CIPHER_GET_PRIVATE(rc4_cipher);
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 guint i;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 for(i = 0; i < 256; i++)
34536
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
62 priv->state[i] = i;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
63 priv->x = 0;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
64 priv->y = 0;
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 /* default is 5 bytes (40bit key) */
34536
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
67 priv->key_len = 5;
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 }
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 static void
34536
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
71 purple_rc4_cipher_set_key(PurpleCipher *cipher, const guchar *key, size_t len) {
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
72 PurpleRC4Cipher *rc4_cipher = PURPLE_RC4_CIPHER(cipher);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
73 PurpleRC4CipherPrivate *priv = PURPLE_RC4_CIPHER_GET_PRIVATE(rc4_cipher);
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 guchar *state;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 guchar temp_swap;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 guchar x, y;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 guint i;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 x = 0;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 y = 0;
34536
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
81 state = &priv->state[0];
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
82 priv->key_len = len;
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 for(i = 0; i < 256; i++)
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 {
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 y = (key[x] + state[i] + y) % 256;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 temp_swap = state[i];
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 state[i] = state[y];
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 state[y] = temp_swap;
33908
78b42fd69e02 ciphers cleanup: passing keys with length by default
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33881
diff changeset
89 x = (x + 1) % len;
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 }
34536
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
91
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
92 g_object_notify(G_OBJECT(rc4_cipher), "key");
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
93 }
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
94
33911
a924aacd5a37 ciphers cleanup: encryption and decryption lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33910
diff changeset
95 static ssize_t
34536
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
96 purple_rc4_cipher_encrypt(PurpleCipher *cipher, const guchar input[], size_t in_len,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
97 guchar output[], size_t out_size)
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
98 {
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
99 PurpleRC4Cipher *rc4_cipher = PURPLE_RC4_CIPHER(cipher);
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 guchar temp_swap;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 guchar x, y, z;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 guchar *state;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 guint i;
34536
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
104 PurpleRC4CipherPrivate *priv = PURPLE_RC4_CIPHER_GET_PRIVATE(rc4_cipher);
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105
34536
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
106 x = priv->x;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
107 y = priv->y;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
108 state = &priv->state[0];
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109
33911
a924aacd5a37 ciphers cleanup: encryption and decryption lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33910
diff changeset
110 for(i = 0; i < in_len; i++)
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 {
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 x = (x + 1) % 256;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 y = (state[x] + y) % 256;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 temp_swap = state[x];
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 state[x] = state[y];
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 state[y] = temp_swap;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 z = state[x] + (state[y]) % 256;
33911
a924aacd5a37 ciphers cleanup: encryption and decryption lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33910
diff changeset
118 output[i] = input[i] ^ state[z];
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 }
34536
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
120 priv->x = x;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
121 priv->y = y;
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122
33911
a924aacd5a37 ciphers cleanup: encryption and decryption lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33910
diff changeset
123 return in_len;
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 }
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125
34547
45b72366ddde Added get_name method to all PurpleCiphers
Ankit Vani <a@nevitus.org>
parents: 34536
diff changeset
126 static const gchar*
45b72366ddde Added get_name method to all PurpleCiphers
Ankit Vani <a@nevitus.org>
parents: 34536
diff changeset
127 purple_rc4_cipher_get_name(PurpleCipher *cipher)
45b72366ddde Added get_name method to all PurpleCiphers
Ankit Vani <a@nevitus.org>
parents: 34536
diff changeset
128 {
45b72366ddde Added get_name method to all PurpleCiphers
Ankit Vani <a@nevitus.org>
parents: 34536
diff changeset
129 return "rc4";
45b72366ddde Added get_name method to all PurpleCiphers
Ankit Vani <a@nevitus.org>
parents: 34536
diff changeset
130 }
45b72366ddde Added get_name method to all PurpleCiphers
Ankit Vani <a@nevitus.org>
parents: 34536
diff changeset
131
34536
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
132 /******************************************************************************
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
133 * Object Stuff
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
134 *****************************************************************************/
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
135 static void
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
136 purple_rc4_cipher_set_property(GObject *obj, guint param_id,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
137 const GValue *value, GParamSpec *pspec)
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
138 {
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
139 PurpleCipher *cipher = PURPLE_CIPHER(obj);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
140 PurpleRC4Cipher *rc4_cipher = PURPLE_RC4_CIPHER(obj);
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141
34536
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
142 switch(param_id) {
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
143 case PROP_KEY_LEN:
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
144 purple_rc4_cipher_set_key_len(rc4_cipher, g_value_get_int(value));
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
145 break;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
146 case PROP_KEY:
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
147 {
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
148 guchar *key = (guchar *)g_value_get_string(value);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
149 purple_rc4_cipher_set_key(cipher, key, strlen((gchar *) key));
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
150 }
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
151 break;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
152 default:
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
153 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
154 break;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
155 }
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
156 }
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
157
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
158 static void
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
159 purple_rc4_cipher_get_property(GObject *obj, guint param_id, GValue *value,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
160 GParamSpec *pspec)
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
161 {
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
162 PurpleRC4Cipher *rc4_cipher = PURPLE_RC4_CIPHER(obj);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
163
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
164 switch(param_id) {
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
165 case PROP_KEY_LEN:
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
166 g_value_set_int(value,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
167 purple_rc4_cipher_get_key_len(rc4_cipher));
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
168 break;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
169 default:
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
170 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
171 break;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
172 }
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 }
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174
34536
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
175 static void
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
176 purple_rc4_cipher_class_init(PurpleRC4CipherClass *klass) {
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
177 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
178 PurpleCipherClass *cipher_class = PURPLE_CIPHER_CLASS(klass);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
179 GParamSpec *pspec = NULL;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
180
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
181 parent_class = g_type_class_peek_parent(klass);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
182
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
183 obj_class->set_property = purple_rc4_cipher_set_property;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
184 obj_class->get_property = purple_rc4_cipher_get_property;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
185
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
186 cipher_class->reset = purple_rc4_cipher_reset;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
187 cipher_class->encrypt = purple_rc4_cipher_encrypt;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
188 cipher_class->set_key = purple_rc4_cipher_set_key;
34547
45b72366ddde Added get_name method to all PurpleCiphers
Ankit Vani <a@nevitus.org>
parents: 34536
diff changeset
189 cipher_class->get_name = purple_rc4_cipher_get_name;
34536
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
190
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
191 pspec = g_param_spec_int("key_len", "key_len", "key_len",
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
192 G_MININT, G_MAXINT, 0,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
193 G_PARAM_READWRITE);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
194 g_object_class_install_property(obj_class, PROP_KEY_LEN, pspec);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
195
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
196 pspec = g_param_spec_string("key", "key", "key", NULL,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
197 G_PARAM_WRITABLE);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
198 g_object_class_install_property(obj_class, PROP_KEY, pspec);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
199
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
200 g_type_class_add_private(klass, sizeof(PurpleRC4CipherPrivate));
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
201 }
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
202
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
203 static void
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
204 purple_rc4_cipher_init(PurpleCipher *cipher) {
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
205 purple_rc4_cipher_reset(cipher);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
206 }
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
207
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
208 /******************************************************************************
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
209 * API
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
210 *****************************************************************************/
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
211 GType
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
212 purple_rc4_cipher_get_gtype(void) {
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
213 static GType type = 0;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
214
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
215 if(type == 0) {
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
216 static const GTypeInfo info = {
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
217 sizeof(PurpleRC4CipherClass),
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
218 NULL,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
219 NULL,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
220 (GClassInitFunc)purple_rc4_cipher_class_init,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
221 NULL,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
222 NULL,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
223 sizeof(PurpleRC4Cipher),
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
224 0,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
225 (GInstanceInitFunc)purple_rc4_cipher_init,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
226 NULL,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
227 };
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
228
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
229 type = g_type_register_static(PURPLE_TYPE_CIPHER,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
230 "PurpleRC4Cipher",
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
231 &info, 0);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
232 }
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
233
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
234 return type;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
235 }
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
236
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
237 PurpleCipher *
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
238 purple_rc4_cipher_new(void) {
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
239 return g_object_new(PURPLE_TYPE_RC4_CIPHER, NULL);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
240 }
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
241
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
242 void
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
243 purple_rc4_cipher_set_key_len(PurpleRC4Cipher *rc4_cipher,
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
244 gint key_len)
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
245 {
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
246 PurpleRC4CipherPrivate *priv;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
247
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
248 g_return_if_fail(PURPLE_IS_RC4_CIPHER(rc4_cipher));
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
249
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
250 priv = PURPLE_RC4_CIPHER_GET_PRIVATE(rc4_cipher);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
251 priv->key_len = key_len;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
252
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
253 g_object_notify(G_OBJECT(rc4_cipher), "key_len");
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
254 }
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
255
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
256 gint
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
257 purple_rc4_cipher_get_key_len(PurpleRC4Cipher *rc4_cipher)
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
258 {
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
259 PurpleRC4CipherPrivate *priv;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
260
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
261 g_return_val_if_fail(PURPLE_IS_RC4_CIPHER(rc4_cipher), 0);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
262
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
263 priv = PURPLE_RC4_CIPHER_GET_PRIVATE(rc4_cipher);
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
264
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
265 return priv->key_len;
38cc893bae51 GObjectify RC4 cipher as PurpleRC4Cipher
Ankit Vani <a@nevitus.org>
parents: 33914
diff changeset
266 }

mercurial