changeset 16399:18d766d252f3

Add rc4_get_key_size, to match purple_cipher_context_get_option(ctx, "key_len")
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Wed, 25 Apr 2007 03:42:32 +0000
parents eca698c354d0
children 9c9c627dbbfe
files libpurple/cipher.c
diffstat 1 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/cipher.c	Wed Apr 25 03:14:11 2007 +0000
+++ b/libpurple/cipher.c	Wed Apr 25 03:42:32 2007 +0000
@@ -1300,6 +1300,8 @@
 	rc4_ctx = NULL;
 }
 
+
+
 static void
 rc4_set_key (PurpleCipherContext *context, const guchar * key) {
 	struct RC4Context *ctx;
@@ -1334,6 +1336,20 @@
 	}
 }
 
+static size_t 
+rc4_get_key_size (PurpleCipherContext *context)
+{
+	struct RC4Context *ctx;
+
+	g_return_val_if_fail(context, -1);
+
+	ctx = purple_cipher_context_get_data(context);
+
+	g_return_val_if_fail(ctx, -1);
+
+	return ctx->key_len;
+}
+
 static void *
 rc4_get_opt(PurpleCipherContext *context, const gchar *name) {
 	struct RC4Context *ctx;
@@ -1394,7 +1410,7 @@
 	NULL,          /* set salt      */
 	NULL,          /* get salt size */
 	rc4_set_key,   /* set key       */
-	NULL           /* get key size  */
+	rc4_get_key_size/* get key size  */
 };
 
 /*******************************************************************************