2019-02-24 10:34:46 -05:00
|
|
|
From: Tobias Geerinckx-Rice <me@tobias.gr>
|
|
|
|
Date: Sun, 24 Feb 2019 15:50:37 +0100
|
|
|
|
Subject: gnu: clamav: Add support for system tomsfastmath.
|
|
|
|
|
|
|
|
Adjusted from the original for clamav 0.101.1:
|
|
|
|
|
2016-10-28 23:42:59 -04:00
|
|
|
From 756ff89526b5ffaa7a4f49b1bbecf2ecbd6f85f9 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
|
|
|
|
Date: Wed, 11 Mar 2015 20:03:15 +0100
|
|
|
|
Subject: add support for system tomsfastmath
|
|
|
|
|
|
|
|
Patch-Name: add-support-for-system-tomsfastmath.patch
|
|
|
|
---
|
|
|
|
configure.ac | 2 ++
|
|
|
|
libclamav/Makefile.am | 10 ++++++++--
|
|
|
|
libclamav/bignum.h | 6 +++++-
|
|
|
|
libclamav/xdp.c | 2 +-
|
|
|
|
m4/reorganization/libs/tomsfastmath.m4 | 12 ++++++++++++
|
|
|
|
5 files changed, 28 insertions(+), 4 deletions(-)
|
|
|
|
create mode 100644 m4/reorganization/libs/tomsfastmath.m4
|
|
|
|
|
2019-02-24 10:34:46 -05:00
|
|
|
--- a/configure.ac 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
+++ b/configure.ac 2019-02-24 15:47:14.076992864 +0100
|
|
|
|
@@ -89,6 +89,7 @@
|
2016-10-28 23:42:59 -04:00
|
|
|
m4_include([m4/reorganization/libs/json.m4])
|
|
|
|
m4_include([m4/reorganization/libs/pcre.m4])
|
2019-02-24 10:34:46 -05:00
|
|
|
m4_include([m4/reorganization/libs/libmspack.m4])
|
2016-10-28 23:42:59 -04:00
|
|
|
+m4_include([m4/reorganization/libs/tomsfastmath.m4])
|
|
|
|
|
2019-02-24 10:34:46 -05:00
|
|
|
if test "x$use_internal_mspack" = "xno"; then
|
|
|
|
mspack_msg="External, $LIBMSPACK_CFLAGS $LIBMSPACK_LIBS"
|
|
|
|
@@ -297,6 +298,7 @@
|
2016-10-28 23:42:59 -04:00
|
|
|
fi
|
|
|
|
CL_MSG_STATUS([yara ],[$enable_yara],[$enable_yara])
|
|
|
|
CL_MSG_STATUS([fts ],[yes],[$lfs_fts_msg])
|
|
|
|
+CL_MSG_STATUS([tomsfastmath],[yes],[$tomsfastmath_msg])
|
|
|
|
|
|
|
|
|
|
|
|
# Yep, downgrading the compiler avoids the bug too:
|
2019-02-24 10:34:46 -05:00
|
|
|
diff -Naur clamav-0.101.1/libclamav/bignum.h clamav-0.101.1b/libclamav/bignum.h
|
|
|
|
--- a/libclamav/bignum.h 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
+++ b/libclamav/bignum.h 2019-02-24 15:46:36.216998323 +0100
|
|
|
|
@@ -1,9 +1,13 @@
|
|
|
|
#ifndef BIGNUM_H_
|
|
|
|
#define BIGNUM_H_
|
|
|
|
|
|
|
|
+#if HAVE_SYSTEM_TOMSFASTMATH
|
|
|
|
+#include <tfm.h>
|
|
|
|
+#else
|
|
|
|
#define TFM_CHECK
|
|
|
|
-
|
|
|
|
#include "bignum_fast.h"
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
typedef fp_int mp_int;
|
|
|
|
#define mp_cmp fp_cmp
|
|
|
|
#define mp_toradix_n(a,b,c,d) fp_toradix_n(a,b,c,d)
|
|
|
|
diff -Naur clamav-0.101.1/libclamav/Makefile.am clamav-0.101.1b/libclamav/Makefile.am
|
|
|
|
--- a/libclamav/Makefile.am 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
+++ b/libclamav/Makefile.am 2019-02-24 15:46:36.216998323 +0100
|
|
|
|
@@ -597,8 +597,10 @@
|
2016-10-28 23:42:59 -04:00
|
|
|
yara_clam.h
|
|
|
|
endif
|
|
|
|
|
|
|
|
-libclamav_la_SOURCES += bignum.h\
|
|
|
|
- bignum_fast.h\
|
|
|
|
+libclamav_la_SOURCES += bignum.h
|
|
|
|
+
|
|
|
|
+if !SYSTEM_TOMSFASTMATH
|
|
|
|
+libclamav_la_SOURCES += bignum_fast.h\
|
|
|
|
tomsfastmath/addsub/fp_add.c\
|
|
|
|
tomsfastmath/addsub/fp_add_d.c\
|
|
|
|
tomsfastmath/addsub/fp_addmod.c\
|
2019-02-24 10:34:46 -05:00
|
|
|
@@ -680,6 +682,10 @@
|
2016-10-28 23:42:59 -04:00
|
|
|
tomsfastmath/sqr/fp_sqr_comba_generic.c\
|
|
|
|
tomsfastmath/sqr/fp_sqr_comba_small_set.c\
|
|
|
|
tomsfastmath/sqr/fp_sqrmod.c
|
|
|
|
+else
|
|
|
|
+libclamav_la_CFLAGS += $(TOMSFASTMATH_CFLAGS)
|
|
|
|
+libclamav_la_LIBADD += $(TOMSFASTMATH_LIBS)
|
|
|
|
+endif
|
|
|
|
|
|
|
|
.PHONY: version.h.tmp
|
|
|
|
version.c: version.h
|
2019-02-24 10:34:46 -05:00
|
|
|
diff -Naur clamav-0.101.1/libclamav/xdp.c clamav-0.101.1b/libclamav/xdp.c
|
|
|
|
--- a/libclamav/xdp.c 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
+++ b/libclamav/xdp.c 2019-02-24 15:46:36.216998323 +0100
|
|
|
|
@@ -52,7 +52,7 @@
|
2016-10-28 23:42:59 -04:00
|
|
|
#include "scanners.h"
|
|
|
|
#include "conv.h"
|
|
|
|
#include "xdp.h"
|
|
|
|
-#include "bignum_fast.h"
|
|
|
|
+#include "bignum.h"
|
|
|
|
#include "filetypes.h"
|
|
|
|
|
|
|
|
static char *dump_xdp(cli_ctx *ctx, const char *start, size_t sz);
|
2019-02-24 10:34:46 -05:00
|
|
|
diff -Naur clamav-0.101.1/m4/reorganization/libs/tomsfastmath.m4 clamav-0.101.1b/m4/reorganization/libs/tomsfastmath.m4
|
|
|
|
--- a/m4/reorganization/libs/tomsfastmath.m4 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
+++ b/m4/reorganization/libs/tomsfastmath.m4 2019-02-24 15:46:36.216998323 +0100
|
2016-10-28 23:42:59 -04:00
|
|
|
@@ -0,0 +1,12 @@
|
|
|
|
+dnl Check for system tomsfastmath
|
|
|
|
+PKG_CHECK_MODULES([TOMSFASTMATH], [tomsfastmath], [have_system_tomsfastmath=yes], [have_system_tomsfastmath=no])
|
|
|
|
+
|
|
|
|
+AM_CONDITIONAL([SYSTEM_TOMSFASTMATH], [test "x$have_system_tomsfastmath" = "xyes"])
|
|
|
|
+
|
|
|
|
+if test "x$have_system_tomsfastmath" = "xyes"; then
|
|
|
|
+ AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [1], [link against system-wide tomsfastmath library])
|
|
|
|
+ tomsfastmath_msg="External, $TOMSFASTMATH_CFLAGS $TOMSFASTMATH_LIBS"
|
|
|
|
+else
|
|
|
|
+ AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [0], [don't link against system-wide tomsfastmath library])
|
|
|
|
+ tomsfastmath_msg="Internal"
|
|
|
|
+fi
|