diff libpurple/ciphers/md5.c @ 31221:2b041e31b825

Removed the "new" api I added by moving it to ciphers/gchecksum.c. Moved the gchecksum implements into gchecksum.c as a preproc macro, removed them from their individual files
author Gary Kramlich <grim@reaperworld.com>
date Thu, 17 Feb 2011 00:42:53 +0000
parents 2d3c1197f930
children ca94413ccd0e
line wrap: on
line diff
--- a/libpurple/ciphers/md5.c	Mon Feb 14 07:38:41 2011 +0000
+++ b/libpurple/ciphers/md5.c	Thu Feb 17 00:42:53 2011 +0000
@@ -24,47 +24,9 @@
  */
 #include <cipher.h>
 
-#define MD5_HMAC_BLOCK_SIZE 64
-
-static size_t
-md5_get_block_size(PurpleCipherContext *context)
-{
-	/* This does not change (in this case) */
-	return MD5_HMAC_BLOCK_SIZE;
-}
-
-#if GLIB_CHECK_VERSION(2,16,0)
-
-static void
-md5_init(PurpleCipherContext *context, void *extra)
-{
-	purple_g_checksum_init(context, G_CHECKSUM_MD5);
-}
+#if !GLIB_CHECK_VERSION(2,16,0)
 
-static void
-md5_reset(PurpleCipherContext *context, void *extra)
-{
-	purple_g_checksum_reset(context, G_CHECKSUM_MD5);
-}
-
-static gboolean
-md5_digest(PurpleCipherContext *context, gsize in_len, guchar digest[16],
-		size_t *out_len)
-{
-	return purple_g_checksum_digest(context, G_CHECKSUM_MD5, in_len,
-			digest, out_len);
-}
-
-static PurpleCipherOps MD5Ops = {
-	.init = md5_init,
-	.reset = md5_reset,
-	.uninit = purple_g_checksum_uninit,
-	.append = purple_g_checksum_append,
-	.digest = md5_digest,
-	.get_block_size = md5_get_block_size,
-};
-
-#else /* GLIB_CHECK_VERSION(2,16,0) */
+#define MD5_HMAC_BLOCK_SIZE 64
 
 struct MD5Context {
 	guint32 total[2];
@@ -85,6 +47,13 @@
 	(b)[(i) + 3] = (guchar)((n) >> 24);     \
 }
 
+static size_t
+md5_get_block_size(PurpleCipherContext *context)
+{
+	/* This does not change (in this case) */
+	return MD5_HMAC_BLOCK_SIZE;
+}
+
 static void
 md5_init(PurpleCipherContext *context, gpointer extra) {
 	struct MD5Context *md5_context;
@@ -336,10 +305,10 @@
 	.get_block_size = md5_get_block_size,
 };
 
-#endif /* GLIB_CHECK_VERSION(2,16,0) */
-
 PurpleCipherOps *
 purple_md5_cipher_get_ops(void) {
 	return &MD5Ops;
 }
 
+#endif /* !GLIB_CHECK_VERSION(2,16,0) */
+