libpurple/ciphers/rc4.c

Sun, 05 May 2013 16:29:14 +0200

author
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
date
Sun, 05 May 2013 16:29:14 +0200
changeset 33911
a924aacd5a37
parent 33910
5749f2724b12
child 33913
9effc94565d8
permissions
-rw-r--r--

ciphers cleanup: encryption and decryption lengths

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 */
33911
a924aacd5a37 ciphers cleanup: encryption and decryption lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33910
diff changeset
22
a924aacd5a37 ciphers cleanup: encryption and decryption lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33910
diff changeset
23 #include "internal.h"
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 #include <cipher.h>
33881
9b112a06cbdc Fix warnings for ciphers
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31553
diff changeset
25 #include "ciphers.h"
31434
d9b76cfd8500 rc4.c and sha1.c needs to include libpurple/util.h as well
Gary Kramlich <grim@reaperworld.com>
parents: 31429
diff changeset
26 #include <util.h>
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 struct RC4Context {
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 guchar state[256];
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 guchar x;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 guchar y;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 gint key_len;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 };
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 static void
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 rc4_init(PurpleCipherContext *context, void *extra) {
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 struct RC4Context *rc4_ctx;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 rc4_ctx = g_new0(struct RC4Context, 1);
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 purple_cipher_context_set_data(context, rc4_ctx);
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 purple_cipher_context_reset(context, extra);
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 }
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 static void
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 rc4_reset(PurpleCipherContext *context, void *extra) {
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 struct RC4Context *rc4_ctx;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 guint i;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 rc4_ctx = purple_cipher_context_get_data(context);
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 g_return_if_fail(rc4_ctx);
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 for(i = 0; i < 256; i++)
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 rc4_ctx->state[i] = i;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 rc4_ctx->x = 0;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 rc4_ctx->y = 0;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 /* default is 5 bytes (40bit key) */
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 rc4_ctx->key_len = 5;
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 }
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 static void
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 rc4_uninit(PurpleCipherContext *context) {
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 struct RC4Context *rc4_ctx;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 rc4_ctx = purple_cipher_context_get_data(context);
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 memset(rc4_ctx, 0, sizeof(*rc4_ctx));
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 g_free(rc4_ctx);
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 rc4_ctx = NULL;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 }
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 static void
33908
78b42fd69e02 ciphers cleanup: passing keys with length by default
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33881
diff changeset
77 rc4_set_key (PurpleCipherContext *context, const guchar * key, size_t len) {
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 struct RC4Context *ctx;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 guchar *state;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 guchar temp_swap;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 guchar x, y;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 guint i;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 ctx = purple_cipher_context_get_data(context);
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 x = 0;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 y = 0;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 state = &ctx->state[0];
33908
78b42fd69e02 ciphers cleanup: passing keys with length by default
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33881
diff changeset
89 ctx->key_len = len;
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 for(i = 0; i < 256; i++)
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 {
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 y = (key[x] + state[i] + y) % 256;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 temp_swap = state[i];
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 state[i] = state[y];
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 state[y] = temp_swap;
33908
78b42fd69e02 ciphers cleanup: passing keys with length by default
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33881
diff changeset
96 x = (x + 1) % len;
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 }
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 }
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99
33911
a924aacd5a37 ciphers cleanup: encryption and decryption lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33910
diff changeset
100
a924aacd5a37 ciphers cleanup: encryption and decryption lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33910
diff changeset
101 static ssize_t
a924aacd5a37 ciphers cleanup: encryption and decryption lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33910
diff changeset
102 rc4_encrypt(PurpleCipherContext *context, const guchar input[], size_t in_len,
a924aacd5a37 ciphers cleanup: encryption and decryption lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33910
diff changeset
103 guchar output[], size_t out_size) {
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 struct RC4Context *ctx;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 guchar temp_swap;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 guchar x, y, z;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 guchar *state;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 guint i;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 ctx = purple_cipher_context_get_data(context);
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 = ctx->x;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 y = ctx->y;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 state = &ctx->state[0];
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115
33911
a924aacd5a37 ciphers cleanup: encryption and decryption lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33910
diff changeset
116 for(i = 0; i < in_len; i++)
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 {
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 x = (x + 1) % 256;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 y = (state[x] + y) % 256;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 temp_swap = state[x];
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 state[x] = state[y];
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 state[y] = temp_swap;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 z = state[x] + (state[y]) % 256;
33911
a924aacd5a37 ciphers cleanup: encryption and decryption lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33910
diff changeset
124 output[i] = input[i] ^ state[z];
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 }
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 ctx->x = x;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 ctx->y = y;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128
33911
a924aacd5a37 ciphers cleanup: encryption and decryption lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33910
diff changeset
129 return in_len;
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 }
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 static PurpleCipherOps RC4Ops = {
33908
78b42fd69e02 ciphers cleanup: passing keys with length by default
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33881
diff changeset
133 NULL, /* Set Option */
78b42fd69e02 ciphers cleanup: passing keys with length by default
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33881
diff changeset
134 NULL, /* Get Option */
31553
45a14a4b0a87 Named initializers and most other C99isms don't work in Visual C++ .NET 2005 in
Florian Quèze <florian@instantbird.org>
parents: 31434
diff changeset
135 rc4_init, /* init */
45a14a4b0a87 Named initializers and most other C99isms don't work in Visual C++ .NET 2005 in
Florian Quèze <florian@instantbird.org>
parents: 31434
diff changeset
136 rc4_reset, /* reset */
45a14a4b0a87 Named initializers and most other C99isms don't work in Visual C++ .NET 2005 in
Florian Quèze <florian@instantbird.org>
parents: 31434
diff changeset
137 rc4_uninit, /* uninit */
45a14a4b0a87 Named initializers and most other C99isms don't work in Visual C++ .NET 2005 in
Florian Quèze <florian@instantbird.org>
parents: 31434
diff changeset
138 NULL, /* set iv */
45a14a4b0a87 Named initializers and most other C99isms don't work in Visual C++ .NET 2005 in
Florian Quèze <florian@instantbird.org>
parents: 31434
diff changeset
139 NULL, /* append */
45a14a4b0a87 Named initializers and most other C99isms don't work in Visual C++ .NET 2005 in
Florian Quèze <florian@instantbird.org>
parents: 31434
diff changeset
140 NULL, /* digest */
33909
773899cbd05a ciphers cleanup: salt and digest lengths
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33908
diff changeset
141 NULL, /* get digest size */
31553
45a14a4b0a87 Named initializers and most other C99isms don't work in Visual C++ .NET 2005 in
Florian Quèze <florian@instantbird.org>
parents: 31434
diff changeset
142 rc4_encrypt, /* encrypt */
45a14a4b0a87 Named initializers and most other C99isms don't work in Visual C++ .NET 2005 in
Florian Quèze <florian@instantbird.org>
parents: 31434
diff changeset
143 NULL, /* decrypt */
45a14a4b0a87 Named initializers and most other C99isms don't work in Visual C++ .NET 2005 in
Florian Quèze <florian@instantbird.org>
parents: 31434
diff changeset
144 NULL, /* set salt */
45a14a4b0a87 Named initializers and most other C99isms don't work in Visual C++ .NET 2005 in
Florian Quèze <florian@instantbird.org>
parents: 31434
diff changeset
145 NULL, /* get salt size */
45a14a4b0a87 Named initializers and most other C99isms don't work in Visual C++ .NET 2005 in
Florian Quèze <florian@instantbird.org>
parents: 31434
diff changeset
146 rc4_set_key, /* set key */
33910
5749f2724b12 ciphers cleanup: get key size
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33909
diff changeset
147 NULL, /* get key size */
31553
45a14a4b0a87 Named initializers and most other C99isms don't work in Visual C++ .NET 2005 in
Florian Quèze <florian@instantbird.org>
parents: 31434
diff changeset
148 NULL, /* set batch mode */
45a14a4b0a87 Named initializers and most other C99isms don't work in Visual C++ .NET 2005 in
Florian Quèze <florian@instantbird.org>
parents: 31434
diff changeset
149 NULL, /* get batch mode */
45a14a4b0a87 Named initializers and most other C99isms don't work in Visual C++ .NET 2005 in
Florian Quèze <florian@instantbird.org>
parents: 31434
diff changeset
150 NULL, /* get block size */
31425
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151 };
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 PurpleCipherOps *
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 purple_rc4_cipher_get_ops(void) {
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 return &RC4Ops;
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 }
e8113737ec1a Moved rc4 to the ciphers sublibrary
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157

mercurial