summaryrefslogtreecommitdiff
path: root/app-crypt/mhash
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /app-crypt/mhash
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'app-crypt/mhash')
-rw-r--r--app-crypt/mhash/Manifest11
-rw-r--r--app-crypt/mhash/files/mhash-0.9.9-autotools-namespace-stomping.patch96
-rw-r--r--app-crypt/mhash/files/mhash-0.9.9-fix-mem-leak.patch27
-rw-r--r--app-crypt/mhash/files/mhash-0.9.9-fix-snefru-segfault.patch27
-rw-r--r--app-crypt/mhash/files/mhash-0.9.9-fix-whirlpool-segfault.patch27
-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
-rw-r--r--app-crypt/mhash/metadata.xml11
-rw-r--r--app-crypt/mhash/mhash-0.9.9.9-r2.ebuild60
11 files changed, 420 insertions, 0 deletions
diff --git a/app-crypt/mhash/Manifest b/app-crypt/mhash/Manifest
new file mode 100644
index 000000000000..2db0e2693d97
--- /dev/null
+++ b/app-crypt/mhash/Manifest
@@ -0,0 +1,11 @@
+AUX mhash-0.9.9-autotools-namespace-stomping.patch 3087 BLAKE2B fc603a771f074f35ea6a95f5c8bbf8964c9310cee1c04a77189b3416414ccb0b6924988602bdfd3bbaefeca16a93d289a8379325c8288cabc70acabf05f79f88 SHA512 f32bcbf244aa38755b99c0bb1b328974a9dc6b927bf56073061821827f7b2017c98eb042d11f52d0befb654c58db6540fe1bec0ce7d5f980bfd26914ac49b596
+AUX mhash-0.9.9-fix-mem-leak.patch 1016 BLAKE2B 33037f2d2ed56b22b70ff9f6fd97d885476afa3a7c140533fab983c7bcbf11b9b34e78437685ac9d4bf0fe5d0872053543f266634417bc4f098b388316a1097a SHA512 2255a24f1053ef657750196fbf3e07cb68fc630db5d07356e048a4470a99b2eeeb932a7ecc344211b08bb705a176083f7f36bf0cf245ae684d8cc76b37dcbac0
+AUX mhash-0.9.9-fix-snefru-segfault.patch 1005 BLAKE2B f505dc18602d20772fdc8ea3756a2650848adb53c469da94ad5d373ae2de629dd133591f0771dd14b86b4f02e87937e3097a3afbe7f0c2d1ce9533e85ebeab19 SHA512 20f23f4d3ba20b61942e09915fa3e355f679f3e9747fec888d1c576c0e7144611b432cf005184938b86d080d8e626bc31af6ea2877762ec3e3205563b5cbfb09
+AUX mhash-0.9.9-fix-whirlpool-segfault.patch 1011 BLAKE2B c7c7a846fb50df6b1bfc6df33466dd3ba5468d5e833580542de4b30a1cc682805485a64f68d5c5dd42f1b133c88c64322f63294805cae910e31ec57cb0d63244 SHA512 4132174e3b1bf08a296fb36a1bc516eedc79d59c5bd5f17e32ddcf70ad243e24bc733fecafe9bbc3a776c573022496ab2593a0201d3576ebf94402588a4f4889
+AUX mhash-0.9.9.9-align.patch 3037 BLAKE2B d93a4bc58de7df96ed07fdefa066d368e342fff186c3282e25c4c2bd359187fe76aceb3e68e9748768c5cf594a25fb091870532ddae4eb3f9b6eb54ec3f7f73b SHA512 ce52d1caf3f9dc5bcc388aefacebb93fd422f905ab82f4d7aa6b66ac4ecfcbd32d576778cf3c0ad34f48461a016a08f2cc9ea7063fcb1f29b5188dea04f1ae03
+AUX mhash-0.9.9.9-alignment.patch 579 BLAKE2B 2865e4d035a145f84de68730fb86929e333c4b64ace3b4f7f220e4035423c8873b6ea66ade3d8ddd68fa49540ff02c53a262fb87c401fdecfba3921df25958ac SHA512 6272d5e346067861235b8c5cbb5f4ec1bbb1cd80910ea913860e09ed34661df02ed3d4ed9fa55e870d7e22827fad84cc56bb701195908acca435643018fe81d3
+AUX mhash-0.9.9.9-force64bit-tiger.patch 537 BLAKE2B b37015b12eb213cd91207163b6eb922e3c9956081505066a01ac64a3cceb8d5eaf802a125168f2f6c5d7c3d2a0e18cb6913a33a66d66edfe1e1336edf3bca173 SHA512 7ca2118569ad28107672f081fa4d06758bc78da48612ba31d6655e91ebf4928055b1643a012d60538b915b05d906adf23a8aeb3d7b9f5d8c12eaf1058b9f5454
+AUX mhash-0.9.9.9-remove_premature_free.patch 464 BLAKE2B 89569b1addc287dc6ccce15142ca2d7f228b78ff0fa3412482dbe1aa98e3dd20c1e6e360934018cdf605330b9c0480989bf898ff110d9a9236fbe3ae63e4e226 SHA512 f8f9814c39890f14e760c6600998b628db27ca52efd864be123b646425be1edd106179840d8720c36948cfe509d2b320fd98c2aee0b3fcc7ae1fac8ccdba792e
+DIST mhash-0.9.9.9.tar.gz 931437 BLAKE2B 2daed92b731148c388d4340e67d99959f71783e68617614c9be797dae655ba1aeb087d4f604015edb752dedc2d69add305510996a06633ef26fd997ab7601bed SHA512 82ad8b8e9b0463c5a14f5c0e572badc42c4697bac5505443b144287b3f8510b1410721b4277f092a0d6045c4342e997831011cdfcbfa8f1dae6edd5d9e3cefee
+EBUILD mhash-0.9.9.9-r2.ebuild 1438 BLAKE2B 0722da99796190fc4b0240f88486e5a35d080cec1ef56a425d754e2d55cc800de9065a11892e4b33ab599b76883a0678b5c78298748727ec66c556687112f08d SHA512 9dbd5075d99c23f9274cbbaf5bdcd13833f0c4c353796e888b64fbcf7e83c39f67df1d270da65e139b42a75416fece6a5e16b4c643602debae6dcae897e5c92a
+MISC metadata.xml 325 BLAKE2B 07d8e2f3ec1adec0b16be91a853079e875a3d318fb47ec60e43a6ea87fbbdbbf5f22ec364af47ae311070081235752cebac0fbca30785731cc4b924a9a14edba SHA512 32c365b53e7c9d2a3c6dcef43cc33163a690a0e2f3401e275d3511faa388149ade4b9f5c583307f5b94e6df005796b4ec935ecf35c6cda8d236e46ed0ab7336c
diff --git a/app-crypt/mhash/files/mhash-0.9.9-autotools-namespace-stomping.patch b/app-crypt/mhash/files/mhash-0.9.9-autotools-namespace-stomping.patch
new file mode 100644
index 000000000000..19981b6b9072
--- /dev/null
+++ b/app-crypt/mhash/files/mhash-0.9.9-autotools-namespace-stomping.patch
@@ -0,0 +1,96 @@
+Per debian 473204: http://bugs.debian.org/473204, mhash exports #defines that
+are customarily autotools-private. This results in warnings when other packages
+attempt to use mhash's headers.
+
+Gentoo-Bug: 221093
+Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=221093
+Patch-URL: http://bugs.gentoo.org/attachment.cgi?id=152625&action=view
+Signed-off-by: Peter Alfredson <loki_val@gentoo.org>
+
+diff -NrU5 mhash-0.9.9.orig/configure.in mhash-0.9.9/configure.in
+--- mhash-0.9.9.orig/configure.in 2008-05-09 16:17:52.000000000 +0200
++++ mhash-0.9.9/configure.in 2008-05-09 16:18:20.000000000 +0200
+@@ -4,10 +4,11 @@
+ AC_CANONICAL_TARGET
+ AC_CONFIG_SRCDIR([lib/mhash.c])
+ AM_INIT_AUTOMAKE
+
+ AC_DEFINE([MHASH_VERSION], PROGRAM_VERSION, "MHash Version")
++AC_CONFIG_HEADER([include/mutils/config.h])
+ AC_CONFIG_HEADER([include/mutils/mhash_config.h])
+
+
+ dnl Check system.
+
+diff -NrU5 mhash-0.9.9.orig/include/mutils/config.h.in mhash-0.9.9/include/mutils/config.h.in
+--- mhash-0.9.9.orig/include/mutils/config.h.in 1970-01-01 01:00:00.000000000 +0100
++++ mhash-0.9.9/include/mutils/config.h.in 2008-05-09 16:18:20.000000000 +0200
+@@ -0,0 +1,22 @@
++/* Name of package */
++#undef PACKAGE
++
++/* Define to the address where bug reports for this package should be sent. */
++#undef PACKAGE_BUGREPORT
++
++/* Define to the full name of this package. */
++#undef PACKAGE_NAME
++
++/* Define to the full name and version of this package. */
++#undef PACKAGE_STRING
++
++/* Define to the one symbol short name of this package. */
++#undef PACKAGE_TARNAME
++
++/* Define to the version of this package. */
++#undef PACKAGE_VERSION
++
++/* Version number of package */
++#undef VERSION
++
++
+diff -NrU5 mhash-0.9.9.orig/include/mutils/mhash_config.h.in mhash-0.9.9/include/mutils/mhash_config.h.in
+--- mhash-0.9.9.orig/include/mutils/mhash_config.h.in 2008-05-09 16:17:52.000000000 +0200
++++ mhash-0.9.9/include/mutils/mhash_config.h.in 2008-05-09 16:19:17.000000000 +0200
+@@ -179,28 +179,10 @@
+ #undef MHASH_VERSION
+
+ /* Define to 1 if your C compiler doesn't accept -c and -o together. */
+ #undef NO_MINUS_C_MINUS_O
+
+-/* Name of package */
+-#undef PACKAGE
+-
+-/* Define to the address where bug reports for this package should be sent. */
+-#undef PACKAGE_BUGREPORT
+-
+-/* Define to the full name of this package. */
+-#undef PACKAGE_NAME
+-
+-/* Define to the full name and version of this package. */
+-#undef PACKAGE_STRING
+-
+-/* Define to the one symbol short name of this package. */
+-#undef PACKAGE_TARNAME
+-
+-/* Define to the version of this package. */
+-#undef PACKAGE_VERSION
+-
+ /* Define to 1 if the C compiler supports function prototypes. */
+ #undef PROTOTYPES
+
+ /* The size of `unsigned char', as computed by sizeof. */
+ #undef SIZEOF_UNSIGNED_CHAR
+@@ -221,13 +203,10 @@
+ #undef STDC_HEADERS
+
+ /* dmalloc */
+ #undef USE_DMALLOC
+
+-/* Version number of package */
+-#undef VERSION
+-
+ /* Define if using the dmalloc debugging malloc package */
+ #undef WITH_DMALLOC
+
+ /* Define to 1 if your processor stores words with the most significant byte
+ first (like Motorola and SPARC, unlike Intel and VAX). */
diff --git a/app-crypt/mhash/files/mhash-0.9.9-fix-mem-leak.patch b/app-crypt/mhash/files/mhash-0.9.9-fix-mem-leak.patch
new file mode 100644
index 000000000000..74552499501f
--- /dev/null
+++ b/app-crypt/mhash/files/mhash-0.9.9-fix-mem-leak.patch
@@ -0,0 +1,27 @@
+The package app-crypt/mhash-0.9.9 as well as app-crypt/mhash-0.9.9-r1 are
+affected by a bug which causes memory to be leaked during
+mhash_restore_state_mem.
+
+In this function/patch, ret->state is allocated towards the beginning and later
+on replaced with a new allocated area without freeing the old. The patch fixes
+it.
+
+Patch already submitted upstream, but depending on speed, this may be faster to
+patch in a new patchset.
+
+Gentoo-Bug: 255006
+Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=255006
+Patch-URL: http://bugs.gentoo.org/attachment.cgi?id=178560
+Signed-off-by: Thomas Harning <harningt@gmail.com>
+
+--- mhash-0.9.9/lib/mhash.c 2007-02-21 01:18:46.000000000 -0500
++++ mhash-0.9.9-new/lib/mhash.c 2009-01-15 01:57:53.000000000 -0500
+@@ -719,6 +719,8 @@
+ mutils_memcpy( &ret->state_size, &mem[pos], sizeof(ret->state_size));
+ pos += sizeof( ret->state_size);
+
++ if (ret->state)
++ mutils_free(ret->state);
+ ret->state = mutils_malloc(ret->state_size);
+ if (ret->state==NULL)
+ goto freeall;
diff --git a/app-crypt/mhash/files/mhash-0.9.9-fix-snefru-segfault.patch b/app-crypt/mhash/files/mhash-0.9.9-fix-snefru-segfault.patch
new file mode 100644
index 000000000000..c308269c1b24
--- /dev/null
+++ b/app-crypt/mhash/files/mhash-0.9.9-fix-snefru-segfault.patch
@@ -0,0 +1,27 @@
+The package app-crypt/mhash-0.9.9 as well as app-crypt/mhash-0.9.9-r1 are
+affected by a bug which causes a NULL ptr dereference in whirlpool/snefru
+digest-completion functionality.
+
+In this patch, whirlpool and snefru's code is updated to bail if 'digest' is
+NULL. The code portion aborted is only responsible for writing data to the
+digest, so this appears to be correct behavior.
+
+Patch already submitted upstream, but depending on speed, this may be faster to
+patch in a new patchset.
+
+Gentoo-Bug: 255131
+Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=255131
+Patch-URL: http://bugs.gentoo.org/attachment.cgi?id=178666&action=view
+Signed-off-by: Thomas Harning <harningt@gmail.com>
+
+--- mhash-0.9.9/lib/snefru.c 2009-01-16 00:16:04.000000000 -0500
++++ mhash-0.9.9-new/lib/snefru.c 2009-01-16 00:16:21.000000000 -0500
+@@ -859,6 +859,8 @@
+ {
+ mutils_word32 i;
+
++ if(!digest) return;
++
+ for (i = 0; i < len; i++, digest += 4)
+ {
+ *(mutils_word32 *)digest = mutils_bend2sys32(ctx->hash[i]);
diff --git a/app-crypt/mhash/files/mhash-0.9.9-fix-whirlpool-segfault.patch b/app-crypt/mhash/files/mhash-0.9.9-fix-whirlpool-segfault.patch
new file mode 100644
index 000000000000..6c79139d5793
--- /dev/null
+++ b/app-crypt/mhash/files/mhash-0.9.9-fix-whirlpool-segfault.patch
@@ -0,0 +1,27 @@
+The package app-crypt/mhash-0.9.9 as well as app-crypt/mhash-0.9.9-r1 are
+affected by a bug which causes a NULL ptr dereference in whirlpool/snefru
+digest-completion functionality.
+
+In this patch, whirlpool and snefru's code is updated to bail if 'digest' is
+NULL. The code portion aborted is only responsible for writing data to the
+digest, so this appears to be correct behavior.
+
+Patch already submitted upstream, but depending on speed, this may be faster to
+patch in a new patchset.
+
+Gentoo-Bug: 255131
+Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=255131
+Patch-URL: http://bugs.gentoo.org/attachment.cgi?id=178667&action=view
+Signed-off-by: Thomas Harning <harningt@gmail.com>
+
+--- mhash-0.9.9/lib/whirlpool.c 2006-01-08 03:14:47.000000000 -0500
++++ mhash-0.9.9-new/lib/whirlpool.c 2009-01-16 00:17:34.000000000 -0500
+@@ -970,6 +970,8 @@
+ mutils_word8 * digest)
+ {
+ mutils_word32 i;
++
++ if(!digest) return;
+ /*
+ * return the completed message digest:
+ */
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);
diff --git a/app-crypt/mhash/metadata.xml b/app-crypt/mhash/metadata.xml
new file mode 100644
index 000000000000..4d45a5368800
--- /dev/null
+++ b/app-crypt/mhash/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>crypto@gentoo.org</email>
+ <name>Crypto</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="sourceforge">mhash</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/app-crypt/mhash/mhash-0.9.9.9-r2.ebuild b/app-crypt/mhash/mhash-0.9.9.9-r2.ebuild
new file mode 100644
index 000000000000..300d6c81abea
--- /dev/null
+++ b/app-crypt/mhash/mhash-0.9.9.9-r2.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit ltprune
+
+DESCRIPTION="library providing a uniform interface to a large number of hash algorithms"
+HOMEPAGE="http://mhash.sourceforge.net/"
+SRC_URI="mirror://sourceforge/mhash/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="static-libs"
+
+RDEPEND=""
+DEPEND="dev-lang/perl" # pod2html
+
+PATCHES=(
+ "${FILESDIR}/${PN}-0.9.9-fix-mem-leak.patch"
+ "${FILESDIR}/${PN}-0.9.9-fix-snefru-segfault.patch"
+ "${FILESDIR}/${PN}-0.9.9-fix-whirlpool-segfault.patch"
+ "${FILESDIR}/${PN}-0.9.9-autotools-namespace-stomping.patch"
+ "${FILESDIR}/${P}-remove_premature_free.patch"
+ "${FILESDIR}/${P}-force64bit-tiger.patch"
+ "${FILESDIR}/${P}-align.patch"
+ "${FILESDIR}/${P}-alignment.patch"
+)
+
+DOCS=(
+ doc/example.c
+ doc/skid2-authentication
+)
+HTML_DOCS=(
+ doc/mhash.html
+)
+
+src_prepare() {
+ default
+ sed -i \
+ -e 's/--netscape//' \
+ "${S}"/doc/Makefile.in
+}
+
+src_configure() {
+ # https://sourceforge.net/p/mhash/patches/11/
+ export ac_cv_func_malloc_0_nonnull=yes
+
+ econf $(use_enable static-libs static)
+}
+
+src_compile() {
+ default
+ emake -C doc mhash.html
+}
+
+src_install() {
+ default
+ prune_libtool_files
+}