summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Chvatal <scarabeus@gentoo.org>2012-02-19 16:13:25 +0000
committerTomas Chvatal <scarabeus@gentoo.org>2012-02-19 16:13:25 +0000
commitd69bdf9047361c74599cf764995fe3768e654682 (patch)
tree9e8a5b4194358f001be3c619e10fe5b558ca5dbe /app-crypt/mhash/files
parentalpha/ia64/s390/sh/sparc stable wrt #397189 (diff)
downloadgentoo-2-d69bdf9047361c74599cf764995fe3768e654682.tar.gz
gentoo-2-d69bdf9047361c74599cf764995fe3768e654682.tar.bz2
gentoo-2-d69bdf9047361c74599cf764995fe3768e654682.zip
Fix tests and add few more patches to play nicer wrt bug#294548. Stable 0.9.9.9-r1 on amd64 and x86 wrt bug#287397.
(Portage version: 2.2.0_alpha87/cvs/Linux x86_64, RepoMan options: --force)
Diffstat (limited to 'app-crypt/mhash/files')
-rw-r--r--app-crypt/mhash/files/mhash-0.9.9.9-align.patch119
-rw-r--r--app-crypt/mhash/files/mhash-0.9.9.9-alignment.patch16
-rw-r--r--app-crypt/mhash/files/mhash-0.9.9.9-force64bit-tiger.patch14
-rw-r--r--app-crypt/mhash/files/mhash-0.9.9.9-remove_premature_free.patch12
4 files changed, 161 insertions, 0 deletions
diff --git a/app-crypt/mhash/files/mhash-0.9.9.9-align.patch b/app-crypt/mhash/files/mhash-0.9.9.9-align.patch
new file mode 100644
index 000000000000..04bb310aa772
--- /dev/null
+++ b/app-crypt/mhash/files/mhash-0.9.9.9-align.patch
@@ -0,0 +1,119 @@
+diff -up mhash-0.9.9.9/lib/stdfns.c.BAD mhash-0.9.9.9/lib/stdfns.c
+--- mhash-0.9.9.9/lib/stdfns.c.BAD 2009-07-02 16:38:43.217029623 -0400
++++ mhash-0.9.9.9/lib/stdfns.c 2009-07-02 16:41:58.647120391 -0400
+@@ -152,6 +152,18 @@ mutils_bzero(void *s, __const mutils_wor
+ }
+ }
+
++static void
++mutils_memset8(void *s, __const mutils_word8 c, __const mutils_word32 n)
++{
++ mutils_word8 *stmp = s;
++ mutils_word32 i;
++
++ for (i = 0; i < n; i++, stmp++)
++ {
++ *stmp = c;
++ }
++}
++
+ WIN32DLL_DEFINE
+ void
+ mutils_memset(void *s, __const mutils_word8 c, __const mutils_word32 n)
+@@ -160,8 +172,7 @@ mutils_memset(void *s, __const mutils_wo
+ /* Sparc needs 8-bit alignment - just use standard memset */
+ memset(s, (int) c, (size_t) n);
+ #else
+- mutils_word8 *stmp;
+- mutils_word32 *ltmp = (mutils_word32 *) s;
++ mutils_word32 *ltmp;
+ mutils_word32 lump;
+ mutils_word32 i;
+ mutils_word32 words;
+@@ -172,22 +183,30 @@ mutils_memset(void *s, __const mutils_wo
+ return;
+ }
+
++ if (n < 16)
++ {
++ return mutils_memset8(s, c, n);
++ }
++
++ /* unaligned portion at beginning */
++ remainder = (-(mutils_word32)s) & 0x3;
++ mutils_memset8(s, c, remainder);
++
++ /* aligned words in the middle */
++ ltmp = (mutils_word32 *) (s + remainder);
++
+ lump = (c << 24) + (c << 16) + (c << 8) + c;
+
+- words = n >> 2;
+- remainder = n - (words << 2);
++ words = (n - remainder) >> 2;
++ remainder = n - remainder - (words << 2);
+
+ for (i = 0; i < words; i++, ltmp++)
+ {
+ *ltmp = lump;
+ }
+
+- stmp = (mutils_word8 *) ltmp;
+-
+- for (i = 0; i < remainder; i++, stmp++)
+- {
+- *stmp = c;
+- }
++ /* unaligned portion at end */
++ return mutils_memset8(ltmp, c, remainder);
+ #endif
+ }
+
+@@ -281,6 +300,9 @@ mutils_word32nswap(mutils_word32 *x, mut
+ mutils_word32 *buffer;
+ mutils_word32 *ptrIn;
+ mutils_word32 *ptrOut;
++ mutils_word8 *ptr8In;
++ mutils_word8 *ptr8Out;
++ mutils_word8 tmp8;
+ mutils_word32 count = n * 4;
+
+ if (destructive == MUTILS_FALSE)
+@@ -301,9 +323,35 @@ mutils_word32nswap(mutils_word32 *x, mut
+ * data on a little-endian machine.
+ */
+
+- for (loop = 0, ptrIn = x, ptrOut = buffer; loop < n; loop++, ptrOut++, ptrIn++)
++ if ((mutils_word32)x & 0x3)
++ {
++ ptr8In = (mutils_word8 *) x;
++ ptr8Out = (mutils_word8 *) buffer;
++ for (loop = 0; loop < n; loop++)
++ {
++#ifdef WORDS_BIGENDIAN
++ tmp8 = ptr8In[0];
++ ptr8Out[0] = ptr8In[3];
++ ptr8Out[3] = tmp8;
++ tmp8 = ptr8In[1];
++ ptr8Out[1] = ptr8In[2];
++ ptr8Out[2] = tmp8;
++#else
++ ptr8Out[0] = ptr8In[0];
++ ptr8Out[1] = ptr8In[1];
++ ptr8Out[2] = ptr8In[2];
++ ptr8Out[3] = ptr8In[3];
++#endif
++ ptr8Out += 4;
++ ptr8In += 4;
++ }
++ }
++ else
+ {
+- *ptrOut = mutils_lend32(*ptrIn);
++ for (loop = 0, ptrIn = x, ptrOut = buffer; loop < n; loop++, ptrOut++, ptrIn++)
++ {
++ *ptrOut = mutils_lend32(*ptrIn);
++ }
+ }
+
+ return(buffer);
diff --git a/app-crypt/mhash/files/mhash-0.9.9.9-alignment.patch b/app-crypt/mhash/files/mhash-0.9.9.9-alignment.patch
new file mode 100644
index 000000000000..04df22167a3f
--- /dev/null
+++ b/app-crypt/mhash/files/mhash-0.9.9.9-alignment.patch
@@ -0,0 +1,16 @@
+diff -up mhash-0.9.9.9/lib/stdfns.c.BAD mhash-0.9.9.9/lib/stdfns.c
+--- mhash-0.9.9.9/lib/stdfns.c.BAD 2009-07-21 12:05:40.139461097 -0400
++++ mhash-0.9.9.9/lib/stdfns.c 2009-07-21 12:06:52.151190927 -0400
+@@ -378,6 +378,12 @@ mutils_memmove(void *dest, __const void
+ 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);
+
diff --git a/app-crypt/mhash/files/mhash-0.9.9.9-force64bit-tiger.patch b/app-crypt/mhash/files/mhash-0.9.9.9-force64bit-tiger.patch
new file mode 100644
index 000000000000..2248bcc6a308
--- /dev/null
+++ b/app-crypt/mhash/files/mhash-0.9.9.9-force64bit-tiger.patch
@@ -0,0 +1,14 @@
+diff -up mhash-0.9.9.9/lib/tiger.c.BAD mhash-0.9.9.9/lib/tiger.c
+--- mhash-0.9.9.9/lib/tiger.c.BAD 2009-07-02 16:42:47.683029940 -0400
++++ mhash-0.9.9.9/lib/tiger.c 2009-07-02 16:43:46.085049317 -0400
+@@ -252,7 +252,9 @@ void tiger_update(struct tiger_ctx *ctx,
+ 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/app-crypt/mhash/files/mhash-0.9.9.9-remove_premature_free.patch b/app-crypt/mhash/files/mhash-0.9.9.9-remove_premature_free.patch
new file mode 100644
index 000000000000..5ed4ecbe6292
--- /dev/null
+++ b/app-crypt/mhash/files/mhash-0.9.9.9-remove_premature_free.patch
@@ -0,0 +1,12 @@
+diff -ru mhash-0.9.9.9.orig/src/keygen_test.c mhash-0.9.9.9/src/keygen_test.c
+--- mhash-0.9.9.9.orig/src/keygen_test.c 2007-02-21 07:39:08.000000000 +0100
++++ mhash-0.9.9.9/src/keygen_test.c 2009-12-04 01:29:16.000000000 +0100
+@@ -121,8 +121,6 @@
+
+ mhash_keygen_ext(KEYGEN_S2K_SALTED, data, key, keysize, password, passlen);
+
+- mutils_memset(tmp, 0, keysize * 2);
+-
+ tmp = mutils_asciify(key, keysize);
+
+ result = mutils_strcmp((mutils_word8 *) KEY2, tmp);