Hello community, here is the log from the commit of package haveged for openSUSE:Factory checked in at Sun Oct 2 10:12:50 CEST 2011.
-------- --- openSUSE:Factory/haveged/haveged.changes 2011-09-23 02:02:44.000000000 +0200 +++ /mounts/work_src_done/STABLE/haveged/haveged.changes 2011-10-01 16:55:37.000000000 +0200 @@ -1,0 +2,11 @@ +Sat Oct 1 14:55:05 UTC 2011 - [email protected] + +- There is no support for arm targets here, may be fixable + later. + +------------------------------------------------------------------- +Sun Jul 24 19:23:34 UTC 2011 - [email protected] + +- Update to version 1.2. + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- haveged-1.1.tar.gz New: ---- haveged-1.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ haveged.spec ++++++ --- /var/tmp/diff_new_pack.fYPwUj/_old 2011-10-02 10:12:46.000000000 +0200 +++ /var/tmp/diff_new_pack.fYPwUj/_new 2011-10-02 10:12:46.000000000 +0200 @@ -18,7 +18,7 @@ Name: haveged -Version: 1.1 +Version: 1.2 Release: 2 License: GPLv3 Summary: Feed entropy into random pool @@ -29,6 +29,7 @@ Source2: haveged.service Patch1: haveged-ppc64.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build +ExcludeArch: %{arm} Requires(pre): %insserv_prereq %if 0%{suse_version} >= 1140 Requires(pre): sysvinit(syslog) ++++++ haveged-1.1.tar.gz -> haveged-1.2.tar.gz ++++++ ++++ 3340 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/haveged-1.1/README new/haveged-1.2/README --- old/haveged-1.1/README 2011-01-11 22:12:14.000000000 +0100 +++ new/haveged-1.2/README 2011-06-26 22:56:00.000000000 +0200 @@ -1,5 +1,11 @@ Haveged, a Linux entropy source +June 26, 2011 + +After a long delay, more work towards using intrinsics to make the build more +reliable. Also went another round with gcc optimization and am planing monitoring +extensions for the near future. + January 11, 2011 The havege algorithm has been improved to better stand up to aggressive compiler diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/haveged-1.1/config.h.in new/haveged-1.2/config.h.in --- old/haveged-1.1/config.h.in 2011-01-11 21:51:20.000000000 +0100 +++ new/haveged-1.2/config.h.in 2011-06-26 22:58:27.000000000 +0200 @@ -1,5 +1,8 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Define to 1 if you have the <cpuid.h> header file. */ +#undef HAVE_CPUID_H + /* Define to 1 if you have the <fcntl.h> header file. */ #undef HAVE_FCNTL_H @@ -70,6 +73,9 @@ /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the <x86intrin.h> header file. */ +#undef HAVE_X86INTRIN_H + /* Name of package */ #undef PACKAGE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/haveged-1.1/configure.ac new/haveged-1.2/configure.ac --- old/haveged-1.1/configure.ac 2011-01-11 21:50:41.000000000 +0100 +++ new/haveged-1.2/configure.ac 2011-06-26 22:58:05.000000000 +0200 @@ -1,9 +1,9 @@ ## Process this file with autoconf to produce a configure script. ## Minimum Autoconf version -AC_PREREQ(2.61) +AC_PREREQ(1.9) # -AC_INIT([haveged],[1.1]) +AC_INIT([haveged],[1.2]) AC_CONFIG_AUX_DIR(config) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE @@ -61,6 +61,7 @@ AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/ioctl.h sys/time.h syslog.h unistd.h]) +AC_CHECK_HEADERS([cpuid.h x86intrin.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/haveged-1.1/src/Makefile.am new/haveged-1.2/src/Makefile.am --- old/haveged-1.1/src/Makefile.am 2011-01-11 20:23:27.000000000 +0100 +++ new/haveged-1.2/src/Makefile.am 2011-06-26 22:31:37.000000000 +0200 @@ -3,6 +3,6 @@ AM_CFLAGS=-Wall AM_CPPFLAGS = @HA_CPPFLAGS@ -haveged_SOURCES = haveged.c havege.c havegecollect.c haveged.h havege.h havegecollect.h oneiteration.h +haveged_SOURCES = haveged.c havege.c havegecollect.c cpuid-43.h haveged.h havege.h havegecollect.h oneiteration.h MAINTAINERCLEANFILES = Makefile.in diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/haveged-1.1/src/cpuid-43.h new/haveged-1.2/src/cpuid-43.h --- old/haveged-1.1/src/cpuid-43.h 1970-01-01 01:00:00.000000000 +0100 +++ new/haveged-1.2/src/cpuid-43.h 2011-06-26 18:13:04.000000000 +0200 @@ -0,0 +1,181 @@ +/* + * Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + * + * This file is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 3, or (at your option) any + * later version. + * + * This file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Under Section 7 of GPL version 3, you are granted additional + * permissions described in the GCC Runtime Library Exception, version + * 3.1, as published by the Free Software Foundation. + * + * You should have received a copy of the GNU General Public License and + * a copy of the GCC Runtime Library Exception along with this program; + * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + * <http://www.gnu.org/licenses/>. + */ + +/* %ecx */ +#define bit_SSE3 (1 << 0) +#define bit_PCLMUL (1 << 1) +#define bit_SSSE3 (1 << 9) +#define bit_FMA (1 << 12) +#define bit_CMPXCHG16B (1 << 13) +#define bit_SSE4_1 (1 << 19) +#define bit_SSE4_2 (1 << 20) +#define bit_MOVBE (1 << 22) +#define bit_POPCNT (1 << 23) +#define bit_AES (1 << 25) +#define bit_XSAVE (1 << 26) +#define bit_OSXSAVE (1 << 27) +#define bit_AVX (1 << 28) + +/* %edx */ +#define bit_CMPXCHG8B (1 << 8) +#define bit_CMOV (1 << 15) +#define bit_MMX (1 << 23) +#define bit_FXSAVE (1 << 24) +#define bit_SSE (1 << 25) +#define bit_SSE2 (1 << 26) + +/* Extended Features */ +/* %ecx */ +#define bit_LAHF_LM (1 << 0) +#define bit_ABM (1 << 5) +#define bit_SSE4a (1 << 6) +#define bit_XOP (1 << 11) +#define bit_LWP (1 << 15) +#define bit_FMA4 (1 << 16) + +/* %edx */ +#define bit_LM (1 << 29) +#define bit_3DNOWP (1 << 30) +#define bit_3DNOW (1 << 31) + + +#if defined(__i386__) && defined(__PIC__) +/* %ebx may be the PIC register. */ +#if __GNUC__ >= 3 +#define __cpuid(level, a, b, c, d) \ + __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \ + "cpuid\n\t" \ + "xchg{l}\t{%%}ebx, %1\n\t" \ + : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ + : "0" (level)) + +#define __cpuid_count(level, count, a, b, c, d) \ + __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \ + "cpuid\n\t" \ + "xchg{l}\t{%%}ebx, %1\n\t" \ + : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ + : "0" (level), "2" (count)) +#else +/* Host GCCs older than 3.0 weren't supporting Intel asm syntax + nor alternatives in i386 code. */ +#define __cpuid(level, a, b, c, d) \ + __asm__ ("xchgl\t%%ebx, %1\n\t" \ + "cpuid\n\t" \ + "xchgl\t%%ebx, %1\n\t" \ + : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ + : "0" (level)) + +#define __cpuid_count(level, count, a, b, c, d) \ + __asm__ ("xchgl\t%%ebx, %1\n\t" \ + "cpuid\n\t" \ + "xchgl\t%%ebx, %1\n\t" \ + : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ + : "0" (level), "2" (count)) +#endif +#else +#define __cpuid(level, a, b, c, d) \ + __asm__ ("cpuid\n\t" \ + : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ + : "0" (level)) + +#define __cpuid_count(level, count, a, b, c, d) \ + __asm__ ("cpuid\n\t" \ + : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ + : "0" (level), "2" (count)) +#endif + +/* Return highest supported input value for cpuid instruction. ext can + be either 0x0 or 0x8000000 to return highest supported value for + basic or extended cpuid information. Function returns 0 if cpuid + is not supported or whatever cpuid returns in eax register. If sig + pointer is non-null, then first four bytes of the signature + (as found in ebx register) are returned in location pointed by sig. */ + +static __inline unsigned int +__get_cpuid_max (unsigned int __ext, unsigned int *__sig) +{ + unsigned int __eax, __ebx, __ecx, __edx; + +#ifndef __x86_64__ + /* See if we can use cpuid. On AMD64 we always can. */ +#if __GNUC__ >= 3 + __asm__ ("pushf{l|d}\n\t" + "pushf{l|d}\n\t" + "pop{l}\t%0\n\t" + "mov{l}\t{%0, %1|%1, %0}\n\t" + "xor{l}\t{%2, %0|%0, %2}\n\t" + "push{l}\t%0\n\t" + "popf{l|d}\n\t" + "pushf{l|d}\n\t" + "pop{l}\t%0\n\t" + "popf{l|d}\n\t" + : "=&r" (__eax), "=&r" (__ebx) + : "i" (0x00200000)); +#else +/* Host GCCs older than 3.0 weren't supporting Intel asm syntax + nor alternatives in i386 code. */ + __asm__ ("pushfl\n\t" + "pushfl\n\t" + "popl\t%0\n\t" + "movl\t%0, %1\n\t" + "xorl\t%2, %0\n\t" + "pushl\t%0\n\t" + "popfl\n\t" + "pushfl\n\t" + "popl\t%0\n\t" + "popfl\n\t" + : "=&r" (__eax), "=&r" (__ebx) + : "i" (0x00200000)); +#endif + + if (!((__eax ^ __ebx) & 0x00200000)) + return 0; +#endif + + /* Host supports cpuid. Return highest supported cpuid input value. */ + __cpuid (__ext, __eax, __ebx, __ecx, __edx); + + if (__sig) + *__sig = __ebx; + + return __eax; +} + +/* Return cpuid data for requested cpuid level, as found in returned + eax, ebx, ecx and edx registers. The function checks if cpuid is + supported and returns 1 for valid cpuid information or 0 for + unsupported cpuid level. All pointers are required to be non-null. */ + +static __inline int +__get_cpuid (unsigned int __level, + unsigned int *__eax, unsigned int *__ebx, + unsigned int *__ecx, unsigned int *__edx) +{ + unsigned int __ext = __level & 0x80000000; + + if (__get_cpuid_max (__ext, 0) < __level) + return 0; + + __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx); + return 1; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/haveged-1.1/src/havege.c new/haveged-1.2/src/havege.c --- old/haveged-1.1/src/havege.c 2011-01-11 20:30:36.000000000 +0100 +++ new/haveged-1.2/src/havege.c 2011-06-26 21:49:31.000000000 +0200 @@ -34,7 +34,6 @@ static struct hinfo info; // configuration MSC_DATA; -int havege_collect(volatile H_PTR hptr); /** ** local prototypes */ @@ -54,24 +53,24 @@ { unsigned char regs[4*sizeof(int)]; unsigned int *p = (unsigned int *)regs; - int f; - + if (info.i_cache>0 && info.d_cache>0) return 1; - HASCPUID(f); - if (f) - cpuid(0,p,"cache_configure"); - else p[0] = 0; - switch(p[1]) { - case 0x68747541: info.vendor = "amd"; break; - case 0x69727943: info.vendor = "cyrix"; break; - case 0x746e6543: info.vendor = "centaur"; break; // aka via - case 0x756e6547: info.vendor = "intel"; break; - case 0x646f6547: info.vendor = "natsemi"; break; - case 0x52697365: - case 0x65736952: info.vendor = "rise"; break; // now owned by sis - case 0x20536953: info.vendor = "sis"; break; + if (HASCPUID(p)) { + cpuid(0,p,"max info type"); + switch(p[1]) { + case 0x68747541: info.vendor = "amd"; break; + case 0x69727943: info.vendor = "cyrix"; break; + case 0x746e6543: info.vendor = "centaur"; break; // aka via + case 0x756e6547: info.vendor = "intel"; break; + case 0x646f6547: info.vendor = "natsemi"; break; + case 0x52697365: + case 0x65736952: info.vendor = "rise"; break; // now owned by sis + case 0x20536953: info.vendor = "sis"; break; + default: info.vendor = "other"; break; + } } + else p[0] = 0; info.arch = ARCH; info.generic = 0; if (!strcmp(info.vendor,"amd") && configure_amd()) @@ -179,7 +178,7 @@ lines = p[1] & 0xfff; parts = (p[1]>>12) & 0x3ff; ways = (p[1]>>22) & 0x3ff; - n = ((ways+1)*(parts+1)*(lines+1)*(p[3]+1))/1024; + n = ((ways+1)*(parts+1)*(lines+1)*(p[2]+1))/1024; if (DEBUG_ENABLED(DEBUG_CPUID)) DEBUG_OUT("type=%d,level=%d,ways=%d,parts=%d,lines=%d,sets=%d: %d\n", type,level,ways+1,parts+1,lines+1,p[3]+1,n); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/haveged-1.1/src/havegecollect.c new/haveged-1.2/src/havegecollect.c --- old/haveged-1.1/src/havegecollect.c 2011-01-11 20:23:29.000000000 +0100 +++ new/haveged-1.2/src/havegecollect.c 2011-06-26 21:41:08.000000000 +0200 @@ -76,6 +76,8 @@ /** * Local prototypes */ +// int havege_collect(volatile H_PTR hptr) __attribute__((optimize(1))); + static int havege_sp(int i, int n, char *p); static volatile int *havege_tune(H_PTR h); /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/haveged-1.1/src/havegecollect.h new/haveged-1.2/src/havegecollect.h --- old/haveged-1.1/src/havegecollect.h 2011-01-11 20:23:27.000000000 +0100 +++ new/haveged-1.2/src/havegecollect.h 2011-06-26 21:46:26.000000000 +0200 @@ -19,52 +19,82 @@ #ifndef HAVEGECOLLECT_H #define HAVEGECOLLECT_H /** - * These definitions define the environment needed to build havege - * using the gcc compiler. + ** These definitions define the environment needed to build havege + ** using the gcc compiler. */ +#include "havege.h" #include <sys/time.h> /** - * Hardware constraints + ** Hardware constraints */ #define CRYPTOSIZECOLLECT 0x040000 /* 256k (1MB int) */ #define NDSIZECOLLECT 0x100000 /* 1M (4MB int) */ #define NDSIZECOLLECTx2 0x200000 /* 2x NDSIZECOLLECT */ #define MININITRAND 32 /** - * Microsecond resolution times use gettimeofday + ** Microsecond resolution times use gettimeofday */ #define MSC_DATA static struct timeval et0,et1; #define MSC_ELAPSED() (et1.tv_sec - et0.tv_sec)*1000000 + et1.tv_usec - et0.tv_usec #define MSC_START() gettimeofday(&et0,NULL) #define MSC_STOP() gettimeofday(&et1,NULL) -/* - * Only GNU Compilers need apply +/** + ** Compiler intrinsics are used to make the build more portable and stable + ** with fallbacks provided where the intrisics cannot be used. */ -#define GNUCC -#ifdef GNUCC +#ifdef __GNUC__ #define ASM __asm__ volatile -#endif /** - * For intel iron, configuration uses the cpuid instruction. This app assumes it - * is present if this is a 64 bit architecture because the 32 bit test uses the - * stack and won't fly in 64 bit land. - * - * N.B. The definition of HARDCLOCK AS 'ASM("rdtsc":"=A"(x))' is incorrect for x86_64 - * and even documented as such in the gnu assembler doc under machine constraints. + ** The collection mechanism cannot withstand agressive optimization + */ +int havege_collect(volatile H_PTR hptr) __attribute__((optimize(1))); +/** + ** For the intel world... */ #ifdef HAVE_ISA_X86 #define ARCH "x86" -#define CPUID(op,regs) ASM("xchgl %%ebx,%0\n\tcpuid \n\txchgl %%ebx,%0\n\t"\ - : "+r" (regs[1]), "=a" (regs[0]), "=c" (regs[3]), "=d" (regs[2])\ - : "1" (op), "2" (regs[3]) : "%ebx") -#define HARDCLOCK(x) ASM("rdtsc;movl %%eax,%0":"=m"(x)::"ax","dx") -#ifdef HAVE_64 -#define HASCPUID(x) x=1 +/** + ** For the GNU compiler, the use of a cpuid intrinsic is somewhat garbled by the + ** fact that some distributions (Centos 5.x) carry an empty cpuid.h (in order + ** to back patch glicb?). AFAIK cpuid did not appear in gcc until version 4.3 + ** although it was in existance before. If we do not have a valid cpuid.h, + ** we provide our own copy of the file (from gcc 4.3) + */ +#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) + +#if GCC_VERSION<40300 +#undef HAVE_CPUID_H +#endif +#ifdef HAVE_CPUID_H +#include <cpuid.h> #else -#define HASCPUID(x) ASM ("pushfl;popl %%eax;movl %%eax,%%ecx;xorl $0x00200000,%%eax;"\ - "pushl %%eax;popfl;pushfl;popl %%eax;xorl %%ecx,%%eax":"=a" (x)) +#include "cpuid-43.h" #endif +/** + ** Compatability wrappers + */ +#define CPUID(level,p)\ + {\ + __cpuid_count (level,p[3],p[0],p[1],p[2],p[3]);\ + } +#define HASCPUID(p) __get_cpuid_max(0, p) +/** + ** The rdtsc intrinsic is called in by x86intrin.h - also a recent gcc innovation + ** There have been some discussions of the code in 4.5 and 4.6, so you may opt + ** to use the inline alternative based on GCC_VERSION + */ +#ifdef HAVE_X86INTRIN_H +#include <x86intrin.h> +#define HARDCLOCK(x) x=__rdtsc() +#else +#define HARDCLOCK(x) ASM("rdtsc;movl %%eax,%0":"=m"(x)::"ax","dx") #endif +#else +/** + * No cpuid support outside of the x86 family + */ +#define CPUID(level,p) 0 +#define HASCPUID(p) 0 #ifdef HAVE_ISA_SPARC #define ARCH "sparc" @@ -90,10 +120,45 @@ #define HARDCLOCK(x) ASM("mov %0=ar.itc" : "=r"(x)) #define HASCPUID(x) x=1 #endif + + +#endif /** - * Use gcc's "&&" extension to calculate the LOOP_PT + * Use the "&&" extension to calculate the LOOP_PT */ #define CODE_PT(a) a #define LOOP_PT(a) &&loop##a +/** + * For the MSVC world + */ +#endif +#if _MSVC_VERS +#define ARCH "x86" +/** + ** The collection mechanism + */ +int havege_collect(volatile H_PTR hptr); +/** + * For the MSVC compilers V8 and above + */ +#include <intrin.h> +/** + * Read the processor timestamp counter + */ +#define HARDCLOCK(x) x=__rdtsc() +/** + * Normalize to the gcc interface + */ +#define CPUID(level,p) return __cpuidx(p, p[3], level) +#define HASCPUID(p) \ + { + CPUID(0,a,b,c,d) + } +/** + * Use the __ReturnAddress intrisic to calculate the LOOP_PT + */ +#define CODE_PT(a) __ReturnAddress() +#define LOOP_PT(a) 0 +#endif #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/haveged-1.1/src/haveged.c new/haveged-1.2/src/haveged.c --- old/haveged-1.1/src/haveged.c 2011-01-11 20:44:52.000000000 +0100 +++ new/haveged-1.2/src/haveged.c 2011-06-26 21:48:46.000000000 +0200 @@ -39,7 +39,6 @@ #include "haveged.h" #include "havege.h" -//#include "havegecollect.h" /** * Parameters */ continue with "q"... Remember to have fun... -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
