summaryrefslogtreecommitdiff
path: root/security/mhash/files/patch-lib-md5.c
diff options
context:
space:
mode:
authorPeter Pentchev <roam@FreeBSD.org>2008-01-16 15:46:05 +0000
committerPeter Pentchev <roam@FreeBSD.org>2008-01-16 15:46:05 +0000
commitd9983ccbfaaedc5fba6456549dabee4f713d8403 (patch)
tree7c93c7b77f036d92775f1d912aadf0e3bb8cedfc /security/mhash/files/patch-lib-md5.c
parent- Update HPN patch to hpn12v20 (diff)
Update to mhash-0.9.9, fixing several style issues, lots of memory
leaks, and two serious (even if not easily triggered) bugs.
Notes
Notes: svn path=/head/; revision=205725
Diffstat (limited to 'security/mhash/files/patch-lib-md5.c')
-rw-r--r--security/mhash/files/patch-lib-md5.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/security/mhash/files/patch-lib-md5.c b/security/mhash/files/patch-lib-md5.c
new file mode 100644
index 000000000000..486b4c2bf046
--- /dev/null
+++ b/security/mhash/files/patch-lib-md5.c
@@ -0,0 +1,23 @@
+diff -urN -x .svn ../../branches/vendor/mhash/lib/md5.c ./lib/md5.c
+--- ../../branches/vendor/mhash/lib/md5.c 2008-01-16 14:26:51.000000000 +0200
++++ ./lib/md5.c 2008-01-16 15:11:08.000000000 +0200
+@@ -140,14 +140,14 @@
+ /* The four core functions - F1 is optimized somewhat */
+
+ /* #define F1(x, y, z) (x & y | ~x & z) */
+-#define F1(x, y, z) (z ^ (x & (y ^ z)))
+-#define F2(x, y, z) F1(z, x, y)
+-#define F3(x, y, z) (x ^ y ^ z)
+-#define F4(x, y, z) (y ^ (x | ~z))
++#define F1(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
++#define F2(x, y, z) F1((z), (x), (y))
++#define F3(x, y, z) ((x) ^ (y) ^ (z))
++#define F4(x, y, z) ((y) ^ ((x) | ~(z)))
+
+ /* This is the central step in the MD5 algorithm. */
+ #define MD5STEP(f, w, x, y, z, data, s) \
+- ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
++ ( (w) += f(x, y, z) + (data), (w) = (w)<<(s) | (w)>>(32-(s)), (w) += (x) )
+
+ /*
+ * The core of the MD5 algorithm, this alters an existing MD5 hash to