diff --git a/libmcrypt-2.5.8-nolibltdl.patch b/libmcrypt-2.5.8-nolibltdl.patch new file mode 100644 index 0000000..317a2d7 --- /dev/null +++ b/libmcrypt-2.5.8-nolibltdl.patch @@ -0,0 +1,35 @@ +diff -up libmcrypt-2.5.8/Makefile.in.orig libmcrypt-2.5.8/Makefile.in +--- libmcrypt-2.5.8/Makefile.in.orig 2007-02-19 00:32:38.000000000 -0600 ++++ libmcrypt-2.5.8/Makefile.in 2007-07-19 21:23:39.000000000 -0500 +@@ -209,8 +209,8 @@ target_os = @target_os@ + target_vendor = @target_vendor@ + INCLUDES = $(INCLTDL) + EXTRA_DIST = KNOWN-BUGS THANKS NEWS libmcrypt.spec.in libmcrypt.spec COPYING.LIB +-DIST_SUBDIRS = libltdl modules include lib src doc +-SUBDIRS = $(LIBLTDL_DIR) modules include lib src doc ++DIST_SUBDIRS = modules include lib src doc ++SUBDIRS = modules include lib src doc + all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +diff -up libmcrypt-2.5.8/configure.orig libmcrypt-2.5.8/configure +--- libmcrypt-2.5.8/configure.orig 2007-02-19 00:32:39.000000000 -0600 ++++ libmcrypt-2.5.8/configure 2007-07-19 21:21:38.000000000 -0500 +@@ -426,7 +426,7 @@ PACKAGE_STRING= + PACKAGE_BUGREPORT= + + ac_unique_file="lib/mcrypt.c" +-ac_subdirs_all="$ac_subdirs_all libltdl" ++ac_subdirs_all="$ac_subdirs_all" + # Factoring default headers for most tests. + ac_includes_default="\ + #include +@@ -4425,7 +4425,7 @@ fi + + + +-subdirs="$subdirs libltdl" ++subdirs="$subdirs" + + # Check whether --enable-static or --disable-static was given. + if test "${enable_static+set}" = set; then diff --git a/libmcrypt-2.5.8-prototypes.patch b/libmcrypt-2.5.8-prototypes.patch new file mode 100644 index 0000000..eca6e77 --- /dev/null +++ b/libmcrypt-2.5.8-prototypes.patch @@ -0,0 +1,35 @@ +diff -up libmcrypt-2.5.8/modules/algorithms/des.c.BAD libmcrypt-2.5.8/modules/algorithms/des.c +--- libmcrypt-2.5.8/modules/algorithms/des.c.BAD 2008-08-25 17:40:29.000000000 -0400 ++++ libmcrypt-2.5.8/modules/algorithms/des.c 2008-08-25 17:40:51.000000000 -0400 +@@ -35,9 +35,12 @@ + + /* #define NULL 0 */ + +-static void permute_ip(), permute_fp(), perminit_ip(), spinit(), +-perminit_fp(); +-static word32 f(); ++static void permute_ip(char *, DES_KEY *, char *); ++static void permute_fp(char *, DES_KEY *, char *); ++static void perminit_ip(DES_KEY *); ++static void spinit(DES_KEY *); ++static void perminit_fp(DES_KEY *); ++static word32 f(DES_KEY *, register word32, register char *); + + + /* Tables defined in the Data Encryption Standard documents */ +diff -up libmcrypt-2.5.8/modules/algorithms/tripledes.c.BAD libmcrypt-2.5.8/modules/algorithms/tripledes.c +--- libmcrypt-2.5.8/modules/algorithms/tripledes.c.BAD 2008-08-25 17:40:56.000000000 -0400 ++++ libmcrypt-2.5.8/modules/algorithms/tripledes.c 2008-08-25 17:41:13.000000000 -0400 +@@ -36,8 +36,10 @@ + + /* #define NULL 0 */ + +-static void permute(), perminit(), spinit(); +-static word32 f(); ++static void permute(char *, char[16][16][8], char *); ++static void perminit(char[16][16][8], char[64]); ++static void spinit(TRIPLEDES_KEY *, int); ++static word32 f(TRIPLEDES_KEY *, int, register word32, register char *); + + + /* Tables defined in the Data Encryption Standard documents */ diff --git a/libmcrypt-2.5.8-uninitialized.patch b/libmcrypt-2.5.8-uninitialized.patch new file mode 100644 index 0000000..f52dc93 --- /dev/null +++ b/libmcrypt-2.5.8-uninitialized.patch @@ -0,0 +1,12 @@ +diff -up libmcrypt-2.5.8/modules/algorithms/twofish.c.BAD libmcrypt-2.5.8/modules/algorithms/twofish.c +--- libmcrypt-2.5.8/modules/algorithms/twofish.c.BAD 2008-08-25 17:38:21.000000000 -0400 ++++ libmcrypt-2.5.8/modules/algorithms/twofish.c 2008-08-25 17:38:30.000000000 -0400 +@@ -499,7 +499,7 @@ static void f_rnd(int i, word32* blk, TW + /* encrypt a block of text */ + WIN32DLL_DEFINE void _mcrypt_encrypt(TWI * pkey, word32 * in_blk) + { +- word32 t0, t1, blk[4]; ++ word32 t0 = 0, t1 = 0, blk[4]; + #ifdef WORDS_BIGENDIAN + blk[0] = byteswap32(in_blk[0]) ^ pkey->l_key[0]; + blk[1] = byteswap32(in_blk[1]) ^ pkey->l_key[1]; diff --git a/libmcrypt-2.5.8.tar.gz b/libmcrypt-2.5.8.tar.gz new file mode 100644 index 0000000..398adfb Binary files /dev/null and b/libmcrypt-2.5.8.tar.gz differ diff --git a/libmcrypt-c99.patch b/libmcrypt-c99.patch new file mode 100644 index 0000000..916bf8a --- /dev/null +++ b/libmcrypt-c99.patch @@ -0,0 +1,36 @@ +Add return and argument types to fake prototypes in mcrypt_symb.c. +This avoids build failures with future compilers that do not support +implicit function declarations. + +Submitted upstream: + +diff --git a/lib/Makefile.am b/lib/Makefile.am +index a1a09578858aaf3c..a92f150627a1f610 100644 +--- a/lib/Makefile.am ++++ b/lib/Makefile.am +@@ -23,8 +23,8 @@ mcrypt_symb.c: mcrypt_internal.h + @echo "/* This is automatically created. Don't touch... */" >> mcrypt_symb.c + @echo "" >> mcrypt_symb.c + -@for i in $(EXTRA_ALGOS); do \ +- if test -f ../modules/algorithms/$$i.c; then cat ../modules/algorithms/$$i.c 2>/dev/null|grep define|grep LTX|awk '{print "extern "$$3"();";}' >> mcrypt_symb.c 2>/dev/null; fi; \ +- if test -f ../modules/modes/$$i.c; then cat ../modules/modes/$$i.c 2>/dev/null|grep define|grep LTX|awk '{print "extern "$$3"();";}' >> mcrypt_symb.c 2>/dev/null; fi; \ ++ if test -f ../modules/algorithms/$$i.c; then cat ../modules/algorithms/$$i.c 2>/dev/null|grep define|grep LTX|awk '{print "extern void "$$3"(void);";}' >> mcrypt_symb.c 2>/dev/null; fi; \ ++ if test -f ../modules/modes/$$i.c; then cat ../modules/modes/$$i.c 2>/dev/null|grep define|grep LTX|awk '{print "extern void "$$3"(void);";}' >> mcrypt_symb.c 2>/dev/null; fi; \ + done + @echo "" >> mcrypt_symb.c + @echo "const mcrypt_preloaded mps[] = {" >> mcrypt_symb.c +diff --git a/lib/Makefile.in b/lib/Makefile.in +index 1baaa1e94be1abce..e0e690d1c831370f 100644 +--- a/lib/Makefile.in ++++ b/lib/Makefile.in +@@ -561,8 +561,8 @@ mcrypt_symb.c: mcrypt_internal.h + @echo "/* This is automatically created. Don't touch... */" >> mcrypt_symb.c + @echo "" >> mcrypt_symb.c + -@for i in $(EXTRA_ALGOS); do \ +- if test -f ../modules/algorithms/$$i.c; then cat ../modules/algorithms/$$i.c 2>/dev/null|grep define|grep LTX|awk '{print "extern "$$3"();";}' >> mcrypt_symb.c 2>/dev/null; fi; \ +- if test -f ../modules/modes/$$i.c; then cat ../modules/modes/$$i.c 2>/dev/null|grep define|grep LTX|awk '{print "extern "$$3"();";}' >> mcrypt_symb.c 2>/dev/null; fi; \ ++ if test -f ../modules/algorithms/$$i.c; then cat ../modules/algorithms/$$i.c 2>/dev/null|grep define|grep LTX|awk '{print "extern void "$$3"(void);";}' >> mcrypt_symb.c 2>/dev/null; fi; \ ++ if test -f ../modules/modes/$$i.c; then cat ../modules/modes/$$i.c 2>/dev/null|grep define|grep LTX|awk '{print "extern void "$$3"(void);";}' >> mcrypt_symb.c 2>/dev/null; fi; \ + done + @echo "" >> mcrypt_symb.c + @echo "const mcrypt_preloaded mps[] = {" >> mcrypt_symb.c diff --git a/libmcrypt-configure-c99.patch b/libmcrypt-configure-c99.patch new file mode 100644 index 0000000..35f2ea5 --- /dev/null +++ b/libmcrypt-configure-c99.patch @@ -0,0 +1,92 @@ +Generic fixes for the configure script for C99 compatibility. These +changes are already part of current autoconf and do not need to be +upstreamed separately. + +diff --git a/aclocal.m4 b/aclocal.m4 +index 345e600b35ab530a..630f383376f016f1 100644 +--- a/aclocal.m4 ++++ b/aclocal.m4 +@@ -870,10 +870,6 @@ else + # endif + #endif + +-#ifdef __cplusplus +-extern "C" void exit (int); +-#endif +- + void fnord() { int i=42;} + int main () + { +@@ -889,7 +885,7 @@ int main () + else + puts (dlerror ()); + +- exit (status); ++ return status; + }] + EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then +diff --git a/configure b/configure +index 175581ff2a37e615..d0fb8783e147654b 100755 +--- a/configure ++++ b/configure +@@ -3431,7 +3431,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ +- '' \ ++ '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ +@@ -5023,8 +5023,8 @@ main () + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) +- exit(2); +- exit (0); ++ return 2; ++ return 0; + } + _ACEOF + rm -f conftest$ac_exeext +@@ -14000,10 +14000,6 @@ else + # endif + #endif + +-#ifdef __cplusplus +-extern "C" void exit (int); +-#endif +- + void fnord() { int i=42;} + int main () + { +@@ -14019,7 +14015,7 @@ int main () + else + puts (dlerror ()); + +- exit (status); ++ return status; + } + EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +@@ -14100,10 +14096,6 @@ else + # endif + #endif + +-#ifdef __cplusplus +-extern "C" void exit (int); +-#endif +- + void fnord() { int i=42;} + int main () + { +@@ -14119,7 +14111,7 @@ int main () + else + puts (dlerror ()); + +- exit (status); ++ return status; + } + EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 diff --git a/libmcrypt.spec b/libmcrypt.spec new file mode 100644 index 0000000..8d3286f --- /dev/null +++ b/libmcrypt.spec @@ -0,0 +1,71 @@ +Name: libmcrypt +Version: 2.5.8 +Release: 1 +License: LGPLv2+ +Summary: Encryption algorithms library +URL: http://mcrypt.sourceforge.net/ +Source0: http://downloads.sourceforge.net/mcrypt/libmcrypt-%{version}.tar.gz +Patch0: libmcrypt-2.5.8-nolibltdl.patch +# Upstream: +# http://sourceforge.net/tracker/index.php?func=detail&aid=1872801&group_id=87941&atid=584895 +Patch1: libmcrypt-2.5.8-uninitialized.patch +# Upstream: +# http://sourceforge.net/tracker/index.php?func=detail&aid=1872799&group_id=87941&atid=584895 +Patch2: libmcrypt-2.5.8-prototypes.patch +Patch3: libmcrypt-configure-c99.patch +Patch4: libmcrypt-c99.patch +BuildRequires: libtool-ltdl-devel +BuildRequires: gcc-c++ +BuildRequires: make + +%description +Libmcrypt is a thread-safe library providing a uniform interface +to access several block and stream encryption algorithms. + +%package devel +Summary: Development libraries and headers for libmcrypt +Requires: %{name} = %{version}-%{release} + +%description devel +Development libraries and headers for use in building applications that +use libmcrypt. + +%prep +%setup -q +%patch0 -p1 +%patch1 -p1 -b .uninitialized +%patch2 -p1 -b .prototypes +%patch3 -p1 +%patch4 -p1 + +%build +%configure +make %{?_smp_mflags} + +%install +rm -rf $RPM_BUILD_ROOT +make DESTDIR=$RPM_BUILD_ROOT install +find $RPM_BUILD_ROOT -type f -name '*.la' -exec rm -f {} \; + +# Multilib fix +sed -i 's|-L%{_libdir}||g' $RPM_BUILD_ROOT%{_bindir}/libmcrypt-config +touch -r NEWS $RPM_BUILD_ROOT%{_bindir}/libmcrypt-config + +%ldconfig_scriptlets + +%files +%doc AUTHORS COPYING.LIB ChangeLog KNOWN-BUGS README NEWS THANKS TODO +%{_libdir}/*.so.* +%{_mandir}/man3/* + +%files devel +%doc doc/README.key doc/README.xtea doc/example.c +%{_bindir}/libmcrypt-config +%{_includedir}/mutils/ +%{_includedir}/mcrypt.h +%{_libdir}/*.so +%{_datadir}/aclocal/libmcrypt.m4 + +%changelog +* Tue Jun 27 2023 wangtaozhi - 2.5.8-1 +- Package init diff --git a/libmcrypt.yaml b/libmcrypt.yaml new file mode 100644 index 0000000..022ccec --- /dev/null +++ b/libmcrypt.yaml @@ -0,0 +1,4 @@ +version_control: github +src_repo: https://github.com/winlibs/libmcrypt +tag_prefix: "v" +separator: "."