gobjectification: 2fd60fa7: Add *_get_block_size to MD4, MD5, and SH...
qulogic at pidgin.im
qulogic at pidgin.im
Mon Jul 14 00:41:14 EDT 2008
-----------------------------------------------------------------
Revision: 2fd60fa70d8bf835eaa6e043c49253f823a3b01d
Ancestor: e38905243da52cdd1015fac5877deba22704cf2b
Author: qulogic at pidgin.im
Date: 2008-07-14T02:24:34
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/2fd60fa70d8bf835eaa6e043c49253f823a3b01d
Modified files:
libpurple/md4cipher.c libpurple/md5cipher.c
libpurple/sha1cipher.c
ChangeLog:
Add *_get_block_size to MD4, MD5, and SHA1 hash. This prevent HMAC from
trying to allocate (unsigned)-1 bytes. Adding a real check would
probably be a good idea, too, but I'm just trying to get MSN to run
right now.
-------------- next part --------------
============================================================
--- libpurple/md4cipher.c 52eaa518d7b9a71f1807a312edaefca9134c7580
+++ libpurple/md4cipher.c e55e3879be47e2a9800475ab7452d873f540073c
@@ -18,7 +18,7 @@
#include <string.h>
#define MD4_DIGEST_SIZE 16
-#define MD4_HMAX_BLOCK_SIZE 64
+#define MD4_HMAC_BLOCK_SIZE 64
#define MD4_BLOCK_WORDS 16
#define MD4_HASH_WORDS 4
@@ -248,6 +248,12 @@ purple_md4_cipher_digest(PurpleCipher *c
return TRUE;
}
+static size_t
+purple_md4_cipher_get_block_size(PurpleCipher *cipher)
+{
+ return MD4_HMAC_BLOCK_SIZE;
+}
+
/******************************************************************************
* Object Stuff
*****************************************************************************/
@@ -274,6 +280,7 @@ purple_md4_cipher_class_init(PurpleMD4Ci
cipher_class->reset = purple_md4_cipher_reset;
cipher_class->append = purple_md4_cipher_append;
cipher_class->digest = purple_md4_cipher_digest;
+ cipher_class->get_block_size = purple_md4_cipher_get_block_size;
}
static void
============================================================
--- libpurple/md5cipher.c cd6c50b0c7a911d405b62fff7b6b6c62ccb05b61
+++ libpurple/md5cipher.c 6c95b87d9f68d325966b5d818ba098cbfb65a060
@@ -6,6 +6,8 @@
#include <string.h>
+#define MD5_HMAC_BLOCK_SIZE 64
+
/******************************************************************************
* Structs
*****************************************************************************/
@@ -251,6 +253,12 @@ purple_md5_cipher_digest(PurpleCipher *c
return TRUE;
}
+static size_t
+purple_md5_cipher_get_block_size(PurpleCipher *cipher)
+{
+ return MD5_HMAC_BLOCK_SIZE;
+}
+
/******************************************************************************
* Object Stuff
*****************************************************************************/
@@ -277,6 +285,7 @@ purple_md5_cipher_class_init(PurpleMD5Ci
cipher_class->reset = purple_md5_cipher_reset;
cipher_class->append = purple_md5_cipher_append;
cipher_class->digest = purple_md5_cipher_digest;
+ cipher_class->get_block_size = purple_md5_cipher_get_block_size;
}
static void
============================================================
--- libpurple/sha1cipher.c 4ebad8240dd3d757b0839ab48b8cf2bf391b9b74
+++ libpurple/sha1cipher.c 7bb6002e4e408173e0f32384aa34debbbc96d505
@@ -5,7 +5,7 @@
#include <string.h>
#define SHA1_DIGEST_SIZE 16
-#define SHA1_HMAX_BLOCK_SIZE 64
+#define SHA1_HMAC_BLOCK_SIZE 64
#define SHA1_BLOCK_WORDS 16
#define SHA1_HASH_WORDS 4
@@ -189,6 +189,12 @@ purple_sha1_cipher_digest(PurpleCipher *
return TRUE;
}
+static size_t
+purple_sha1_cipher_get_block_size(PurpleCipher *cipher)
+{
+ return SHA1_HMAC_BLOCK_SIZE;
+}
+
/******************************************************************************
* Object Stuff
*****************************************************************************/
@@ -268,6 +274,7 @@ purple_sha1_cipher_class_init(PurpleSHA1
cipher_class->reset = purple_sha1_cipher_reset;
cipher_class->append = purple_sha1_cipher_append;
cipher_class->digest = purple_sha1_cipher_digest;
+ cipher_class->get_block_size = purple_sha1_cipher_get_block_size;
pspec = g_param_spec_int("sizeHi", "sizeHi", "sizeHi",
G_MININT, G_MAXINT, 0,
More information about the Commits
mailing list