From 3e1a18f33a4395cd54ebf0641fd9504831f6653b Mon Sep 17 00:00:00 2001 From: yosh Date: Sun, 10 Sep 2023 12:28:33 -0400 Subject: [PATCH] mhash: make boolean usage musl C++ portable. --- srcpkgs/mhash/patches/fix-cpp-bools.patch | 21 ++++++++++++++++++ .../patches/fix-tests-use-after-free.patch | 22 +++++++++++++++++++ srcpkgs/mhash/template | 3 ++- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/mhash/patches/fix-cpp-bools.patch create mode 100644 srcpkgs/mhash/patches/fix-tests-use-after-free.patch diff --git a/srcpkgs/mhash/patches/fix-cpp-bools.patch b/srcpkgs/mhash/patches/fix-cpp-bools.patch new file mode 100644 index 0000000000000..418d25c7207e1 --- /dev/null +++ b/srcpkgs/mhash/patches/fix-cpp-bools.patch @@ -0,0 +1,21 @@ +--- a/include/mutils/mutils.h ++++ b/include/mutils/mutils.h +@@ -21,6 +21,9 @@ + #if !defined(__MUTILS_H) + #define __MUTILS_H + ++#ifndef __cplusplus ++#include ++#endif + #include + + #if defined(const) +@@ -97,7 +100,7 @@ typedef unsigned char mutils_word8; + */ + + #if defined(HAVE__BOOL) +-#define mutils_boolean _Bool ++#define mutils_boolean bool + #else + typedef char mutils_boolean; + #endif diff --git a/srcpkgs/mhash/patches/fix-tests-use-after-free.patch b/srcpkgs/mhash/patches/fix-tests-use-after-free.patch new file mode 100644 index 0000000000000..8208a8e028214 --- /dev/null +++ b/srcpkgs/mhash/patches/fix-tests-use-after-free.patch @@ -0,0 +1,22 @@ +--- a/src/hmac_test.c ++++ b/src/hmac_test.c +@@ -76,8 +76,6 @@ int main() + + /* Test No 2 */ + +- mutils_memset(tmp, 0, sizeof(tmp)); +- + passlen=sizeof(KEY2) - 1; + password = (mutils_word8 *) mutils_malloc(passlen+1); + mutils_memcpy(password, KEY2, passlen); +--- a/src/keygen_test.c ++++ b/src/keygen_test.c +@@ -121,8 +121,6 @@ int main() + + 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/srcpkgs/mhash/template b/srcpkgs/mhash/template index 6f753713a513d..95964b73abada 100644 --- a/srcpkgs/mhash/template +++ b/srcpkgs/mhash/template @@ -1,8 +1,9 @@ # Template file for 'mhash' pkgname=mhash version=0.9.9.9 -revision=1 +revision=2 build_style=gnu-configure +checkdepends="perl" short_desc="Uniform interface to a large number of hash algorithms" maintainer="Andrew Benson " license="LGPL-2.1-or-later"