From 28ac85aefc7f12c04cc493917547793a9822f0f2 Mon Sep 17 00:00:00 2001 From: Jitesh Shah Date: Thu, 18 Jun 2009 13:10:41 +0200 Subject: [PATCH] Alignment fixes Signed-off-by: Jitesh Shah --- mhash-alignment.patch | 32 ++++++++++++++++++++++++++++++++ mhash.spec | 7 ++++++- 2 files changed, 38 insertions(+), 1 deletions(-) create mode 100644 mhash-alignment.patch diff --git a/mhash-alignment.patch b/mhash-alignment.patch new file mode 100644 index 0000000..aeac553 --- /dev/null +++ b/mhash-alignment.patch @@ -0,0 +1,32 @@ +diff -dru mhash-0.9.9.backup/lib/stdfns.c mhash-0.9.9/lib/stdfns.c +--- mhash-0.9.9.backup/lib/stdfns.c 2009-06-22 22:29:56.136556948 +0200 ++++ mhash-0.9.9/lib/stdfns.c 2009-06-22 22:30:31.686558217 +0200 +@@ -371,6 +371,13 @@ + bigptr1 = (mutils_word32 *) dest; + bigptr2 = (mutils_word32 *) src; + ++ /* copy byte-by-byte for small and/or unaligned copies */ ++ if ((n < 16) || ((mutils_word32)dest & 0x3) || ++((mutils_word32)src & 0x3)) ++ { ++ return mutils_memcpy8(dest, src, n); ++ } ++ + words = n >> 2; + remainder = n - (words << 2); + +Only in mhash-0.9.9/lib: stdfns.c.alignment1 +diff -dru mhash-0.9.9.backup/lib/tiger.c mhash-0.9.9/lib/tiger.c +--- mhash-0.9.9.backup/lib/tiger.c 2009-06-22 22:29:56.126557827 +0200 ++++ mhash-0.9.9/lib/tiger.c 2009-06-22 22:33:35.366556083 +0200 +@@ -252,7 +252,9 @@ + void tiger_final(struct tiger_ctx *ctx) + { + register mutils_word64 i, j; +- mutils_word8 temp[TIGER_DATASIZE]; ++ /* Force 64-bit alignment */ ++ mutils_word64 temp_64bit[TIGER_DATASIZE/8]; ++ mutils_word8 *temp = temp_64bit; + i = ctx->index; + + #if defined(WORDS_BIGENDIAN) diff --git a/mhash.spec b/mhash.spec index a66091b..3ecdf24 100644 --- a/mhash.spec +++ b/mhash.spec @@ -4,13 +4,14 @@ Summary: Thread-safe hash algorithms library Name: mhash Version: 0.9.9 -Release: 7 +Release: 7.fa1 URL: http://mhash.sourceforge.net/ License: LGPLv2+ Group: System Environment/Libraries Source: http://download.sourceforge.net/mhash/mhash-%{version}.tar.bz2 Patch1: mhash-0.9.9-multiarch.patch Patch2: mutils-align.patch +Patch100: mhash-alignment.patch Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot-%(%{__id_u} -n) Provides: libmhash = %{version}-%{release} @@ -43,6 +44,7 @@ develop programs that use the mhash library. %setup -q %patch1 -p1 -b .multiarch %patch2 -p1 -b .alignment +%patch100 -p1 -b .alignment1 %build @@ -95,6 +97,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Thu Jun 18 2009 Jitesh Shah - 0.9.9-7 +- Some alignment fixes + * Wed Feb 25 2009 Fedora Release Engineering - 0.9.9-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild -- 1.5.5.6