diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2019-08-06 14:00:17 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2019-08-06 14:00:17 +0000 |
commit | 28c5912c0445ab66ed4229e05bc7ed64f5fbcba3 (patch) | |
tree | b787658bae225ded2b196174685080a9b07bc738 | |
parent | e6c99320a8af3e7287d79e933877e06fce7c9b2c (diff) | |
parent | ef80617d1e17e0878a909baad62a75ba265c0e00 (diff) | |
download | gnutls-28c5912c0445ab66ed4229e05bc7ed64f5fbcba3.tar.gz |
Merge branch 'tmp-fixes' into 'master'
Minor fixes in 3.6.9 release
Closes #810 and #812
See merge request gnutls/gnutls!1053
-rw-r--r-- | configure.ac | 13 | ||||
-rw-r--r-- | lib/accelerated/x86/x86-common.c | 24 | ||||
-rw-r--r-- | src/Makefile.am | 11 |
3 files changed, 37 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac index b31fa2c1ac..1bf9bce95e 100644 --- a/configure.ac +++ b/configure.ac @@ -182,6 +182,17 @@ case $host_cpu in ;; esac +# check for gcc's __get_cpuid_count functionality +AC_MSG_CHECKING([for __get_cpuid_count]) +AC_LINK_IFELSE( + [AC_LANG_SOURCE([ + #include <cpuid.h> + int main(void) { unsigned t1; return __get_cpuid_count(7, 0, &t1, &t1, &t1, &t1); } + ])], + [AC_DEFINE([HAVE_GET_CPUID_COUNT], [1], [use __get_cpuid_count]) AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])] +) + fi AC_ARG_ENABLE(tls13-interop, @@ -647,7 +658,7 @@ AC_DEFINE_UNQUOTED([UNBOUND_ROOT_KEY_FILE], system_config_file="/etc/gnutls/config" AC_ARG_WITH(system-priority-file, AS_HELP_STRING([--with-system-priority-file], - [specify the system-wide config file (set empty to disable; default is $config)]), + [specify the system-wide config file (set empty to disable)]), system_config_file="$withval" ) diff --git a/lib/accelerated/x86/x86-common.c b/lib/accelerated/x86/x86-common.c index fb3ff90919..516d6776c5 100644 --- a/lib/accelerated/x86/x86-common.c +++ b/lib/accelerated/x86/x86-common.c @@ -106,17 +106,33 @@ unsigned int _gnutls_x86_cpuid_s[4]; #define VIA_PADLOCK_PHE (1<<21) #define VIA_PADLOCK_PHE_SHA512 (1<<22) +#ifndef HAVE_GET_CPUID_COUNT +static inline void +get_cpuid_level7(unsigned int *eax, unsigned int *ebx, + unsigned int *ecx, unsigned int *edx) +{ + /* we avoid using __get_cpuid_count, because it is not available with gcc 4.8 */ + if (__get_cpuid_max(7, 0) < 7) + return; + + __cpuid_count(7, 0, *eax, *ebx, *ecx, *edx); + return; +} +#else +# define get_cpuid_level7(a,b,c,d) __get_cpuid_count(7, 0, a, b, c, d) +#endif + static unsigned read_cpuid_vals(unsigned int vals[4]) { unsigned t1, t2, t3; - if (!__get_cpuid(1, &t1, &vals[0], - &vals[1], &t2)) + vals[0] = vals[1] = vals[2] = vals[3] = 0; + + if (!__get_cpuid(1, &t1, &vals[0], &vals[1], &t2)) return 0; /* suppress AVX512; it works conditionally on certain CPUs on the original code */ vals[1] &= 0xfffff7ff; - if (!__get_cpuid_count(7, 0, &t1, &vals[2], &t2, &t3)) - return 0; + get_cpuid_level7(&t1, &vals[2], &t2, &t3); return 1; } diff --git a/src/Makefile.am b/src/Makefile.am index 501bca58c1..b2409fff2e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -275,16 +275,15 @@ SUFFIXES = .stamp .def .c.bak .h.bak if NEED_LIBOPTS # case --enable-local-libopts: We do not call AUTOGEN unless the .bak files are missing .def.stamp: - @b=`echo $@ | sed 's/.stamp$$//'`; \ - if ! test -f $${srcdir}$${b}.c.bak;then \ + $(AM_V_GEN) b=`echo $@ | sed 's/.stamp$$//'`; \ + if ! test -f $(srcdir)/$${b}.c.bak;then \ echo "No .bak files found; will call autogen"; \ - $(AM_V_GEN) $(AUTOGEN) $<; \ + $(AUTOGEN) $<; \ else \ echo "Re-using .bak files"; \ - srcdir=$(srcdir)/; \ rm -f $${b}.c $${b}.h; \ - cp -p $${srcdir}$${b}.c.bak $${b}.c; \ - cp -p $${srcdir}$${b}.h.bak $${b}.h; \ + cp -p $(srcdir)/$${b}.c.bak $${b}.c; \ + cp -p $(srcdir)/$${b}.h.bak $${b}.h; \ fi touch $@ else |