From dirk.eibach at gdsys.cc Mon May 7 11:56:54 2018 From: dirk.eibach at gdsys.cc (Dirk Eibach) Date: Mon, 7 May 2018 11:56:54 +0200 Subject: [PATCH] mpi: Fix powerpc32 build In-Reply-To: References: <1524658146-19509-1-git-send-email-dirk.eibach@gdsys.cc> <874ljzcmee.fsf@wheatstone.g10code.de> Message-ID: Ping. 2018-04-26 8:39 GMT+02:00 Dirk Eibach : > Hi Werner, > > sorry my last try to reply got HTML encoded and had the wrong sender > address. Using android for sending emails is probably not a wise > choice m( > > 2018-04-25 17:54 GMT+02:00 Werner Koch : >> On Wed, 25 Apr 2018 14:09, dirk.eibach at gdsys.cc said: >> >>> The ENTRY macro is called with C format parameter. >>> Adding a second underscore breaks the build. >> >> This code has not been changed for ages. Thus I am wondering why you >> see a build problem only now. Well, I can't remember that I ever used a >> powerpc32 box and this leads to the question why you start to use >> powerpc32 now. > > We are using ppc32 in our products for ages. This is simply the first > time we need libgcrypt. > > I saw that the code has not been changed for ages. But if you have a > look at syntax.h, it is pretty obvious that it cannot work this way. > EALIGN adds another underscore while END does not. > But they are called (e.g. inmpih-add1.S) with > EALIGN(_gcry_mpih_add_n,3,0) and END(_gcry_mpih_add_n). > Both start the parameter with an underscore. > > After passing the preprocessor this results in: > .globl __gcry_mpih_add_n; .type __gcry_mpih_add_n, at function; .align 3; > ; __gcry_mpih_add_n: > ... > .size _gcry_mpih_add_n,.-_gcry_mpih_add_n > > This leads to > Error: .size expression for _gcry_mpih_add_n does not evaluate to a constant > > Cheers > Dirk From gniibe at fsij.org Wed May 9 02:38:32 2018 From: gniibe at fsij.org (NIIBE Yutaka) Date: Wed, 09 May 2018 09:38:32 +0900 Subject: [PATCH] mpi: Fix powerpc32 build In-Reply-To: References: <1524658146-19509-1-git-send-email-dirk.eibach@gdsys.cc> <874ljzcmee.fsf@wheatstone.g10code.de> Message-ID: <87k1sdr7cn.fsf@iwagami.gniibe.org> Dirk Eibach wrote: > We are using ppc32 in our products for ages. This is simply the first > time we need libgcrypt. What's your build and host environment? For powerpc-unknown-linux-gnu, it has been built successfuly for years. Example build: https://buildd.debian.org/status/fetch.php?pkg=libgcrypt20&arch=powerpc&ver=1.8.2-2&stamp=1522261299&raw=0 > After passing the preprocessor this results in: > .globl __gcry_mpih_add_n; .type __gcry_mpih_add_n, at function; .align 3; > ; __gcry_mpih_add_n: > ... > .size _gcry_mpih_add_n,.-_gcry_mpih_add_n > > This leads to > Error: .size expression for _gcry_mpih_add_n does not evaluate to a constant This particular issue is handled by configure script with the var ac_cv_sys_symbol_underscore. Like: $ ./configure ac_cv_sys_symbol_underscore=no But I wonder why this is needed on your machine. Do you cross-compiling? In libgcrypt/acinclude.m4, it defaults to "yes" for cross-compiling, now: if test "$cross_compiling" = yes; then if test "x$ac_cv_sys_symbol_underscore" = x ; then ac_cv_sys_symbol_underscore=yes fi else tmp_do_check="yes" fi I think that given the situation for modern tool-chain like ELF, probably, it's better to default to "no". -- From dirk.eibach at gdsys.cc Wed May 9 09:30:48 2018 From: dirk.eibach at gdsys.cc (Dirk Eibach) Date: Wed, 9 May 2018 09:30:48 +0200 Subject: [PATCH] mpi: Fix powerpc32 build In-Reply-To: <4a16898f-32bb-1ef2-5888-d6888330f755@mbnet.fi> References: <1524658146-19509-1-git-send-email-dirk.eibach@gdsys.cc> <874ljzcmee.fsf@wheatstone.g10code.de> <4a16898f-32bb-1ef2-5888-d6888330f755@mbnet.fi> Message-ID: > I've noticed underscore build problem with powerpc when cross-compiling on > x86-64 system. This can be avoided by giving 'ac_cv_sys_symbol_underscore=no' > parameter to 'configure'. When building on native powerpc system this does > not appear to be required. I am cross-compiling on a x86-64 machine. Configuring with 'ac_cv_sys_symbol_underscore=no' results in a succesful build. Nevertheless there is still a bug in mpi/powerpc32/syntax.h that has not shown up yet, because no one needs a build with 'ac_cv_sys_symbol_underscore=yes' . ac_cv_sys_symbol_underscore is evaluated in mpi/config.links: # Make sysdep.h echo '/* created by config.links - do not edit */' >./mpi/sysdep.h if test x$ac_cv_sys_symbol_underscore = xyes; then cat <>./mpi/sysdep.h #if __STDC__ #define C_SYMBOL_NAME(name) _##name #else #define C_SYMBOL_NAME(name) _/**/name #endif EOF else cat <>./mpi/sysdep.h #define C_SYMBOL_NAME(name) name EOF fi In the 'yes'-case the C_SYMBOL_NAME()-macro adds some kind of prefix, in the 'no'-case it doesn't. The ENTRY() macro in mpi/powerpc32/syntax.h uses C_SYMBOL_NAME() to adapt the symbol while the END()-macro does not. This will work fine int the 'no'-case (because C_SYMBOL_NAME() does nothing anyway) but will blow up in the yes case. The proposed fix is: diff --git a/mpi/powerpc32/syntax.h b/mpi/powerpc32/syntax.h index 5d4af9f0..e6e27838 100644 --- a/mpi/powerpc32/syntax.h +++ b/mpi/powerpc32/syntax.h @@ -71,5 +71,5 @@ #undef END #define END(name) \ - ASM_SIZE_DIRECTIVE(name) + ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(name)) You can simply give it a try. Configure with 'ac_cv_sys_symbol_underscore=yes' (even though you don't need it). Without the patch applied, the build will fail on assembly: libtool: compile: powerpc-e300c3-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I.. -I../src -I../src -Wa,--noexecstack -I/home/de/root/root-e300/include -MT mpih-add1-asm.lo -MD -MP -MF .deps/mpih-add1-asm.Tpo -c mpih-add1-asm.S -fPIC -DPIC -o .libs/mpih-add1-asm.o /tmp/ccfWCRAp.s: Assembler messages: /tmp/ccfWCRAp.s: Error: .size expression for _gcry_mpih_add_n does not evaluate to a constant With the patch applied the build will fail much later, when linking: libtool: link: powerpc-e300c3-linux-gnu-gcc -I/home/de/root/root-e300/include -fvisibility=hidden -Wall -o .libs/mpicalc mpicalc-mpicalc.o -L/home/de/root/root-e300/lib ./.libs/libgcrypt.so /home/de/root/root-e300/lib/libgpg-error.so -Wl,-rpath -Wl,/home/de/root/root-e300/lib ./.libs/libgcrypt.so: undefined reference to `_gcry_mpih_lshift' ./.libs/libgcrypt.so: undefined reference to `_gcry_mpih_add_n' ./.libs/libgcrypt.so: undefined reference to `_gcry_mpih_addmul_1' ./.libs/libgcrypt.so: undefined reference to `_gcry_mpih_submul_1' ./.libs/libgcrypt.so: undefined reference to `_gcry_mpih_mul_1' ./.libs/libgcrypt.so: undefined reference to `_gcry_mpih_sub_n' ./.libs/libgcrypt.so: undefined reference to `_gcry_mpih_rshift' So this will work for a toolchain that actually needs 'ac_cv_sys_symbol_underscore=yes' while it will certainly not work without the patch applied. From jussi.kivilinna at mbnet.fi Wed May 9 07:13:25 2018 From: jussi.kivilinna at mbnet.fi (Jussi Kivilinna) Date: Wed, 9 May 2018 08:13:25 +0300 Subject: [PATCH] mpi: Fix powerpc32 build In-Reply-To: References: <1524658146-19509-1-git-send-email-dirk.eibach@gdsys.cc> <874ljzcmee.fsf@wheatstone.g10code.de> Message-ID: <4a16898f-32bb-1ef2-5888-d6888330f755@mbnet.fi> On 07.05.2018 12:56, Dirk Eibach wrote: > Ping. > I've noticed underscore build problem with powerpc when cross-compiling on x86-64 system. This can be avoided by giving 'ac_cv_sys_symbol_underscore=no' parameter to 'configure'. When building on native powerpc system this does not appear to be required. On native build [1] and cross-compile with 'ac_cv_sys_symbol_underscore=no', configure gives: checking for _ prefix in compiled symbols... no Cross-compile without 'ac_cv_sys_symbol_underscore=no' on Ubuntu x86-64 gives: checking for _ prefix in compiled symbols... yes -Jussi [1] https://buildd.debian.org/status/fetch.php?pkg=libgcrypt20&arch=powerpc&ver=1.8.2-2&stamp=1522261299&raw=0 > 2018-04-26 8:39 GMT+02:00 Dirk Eibach : >> Hi Werner, >> >> sorry my last try to reply got HTML encoded and had the wrong sender >> address. Using android for sending emails is probably not a wise >> choice m( >> >> 2018-04-25 17:54 GMT+02:00 Werner Koch : >>> On Wed, 25 Apr 2018 14:09, dirk.eibach at gdsys.cc said: >>> >>>> The ENTRY macro is called with C format parameter. >>>> Adding a second underscore breaks the build. >>> >>> This code has not been changed for ages. Thus I am wondering why you >>> see a build problem only now. Well, I can't remember that I ever used a >>> powerpc32 box and this leads to the question why you start to use >>> powerpc32 now. >> >> We are using ppc32 in our products for ages. This is simply the first >> time we need libgcrypt. >> >> I saw that the code has not been changed for ages. But if you have a >> look at syntax.h, it is pretty obvious that it cannot work this way. >> EALIGN adds another underscore while END does not. >> But they are called (e.g. inmpih-add1.S) with >> EALIGN(_gcry_mpih_add_n,3,0) and END(_gcry_mpih_add_n). >> Both start the parameter with an underscore. >> >> After passing the preprocessor this results in: >> .globl __gcry_mpih_add_n; .type __gcry_mpih_add_n, at function; .align 3; >> ; __gcry_mpih_add_n: >> ... >> .size _gcry_mpih_add_n,.-_gcry_mpih_add_n >> >> This leads to >> Error: .size expression for _gcry_mpih_add_n does not evaluate to a constant >> >> Cheers >> Dirk > > _______________________________________________ > Gcrypt-devel mailing list > Gcrypt-devel at gnupg.org > http://lists.gnupg.org/mailman/listinfo/gcrypt-devel > From Jeff.Martin at panasonic.aero Fri May 18 21:45:29 2018 From: Jeff.Martin at panasonic.aero (Jeff Martin) Date: Fri, 18 May 2018 19:45:29 +0000 Subject: gmake check fails - undefined symbol .LLC3074 Message-ID: <8A64F17A24104F44BAAAE7CA37EDF8D93ADAB6CB@MAIL-SNA04.mascorp.com> Hello, I am trying to compile libgcrypt 1.8.2 on Solaris 10 SPARC 64-bit, sun4v. I am encountering this error and cannot seem to get past it. The configure output is below. Any suggestions on solutions to try? ..... /bin/bash ../libtool --tag=CC --mode=link gcc -I/usr/local/include -D_REENTRANT -g -O2 -Wall -no-install -o t-lock t_lock-t-lock.o ../src/libgcrypt.la ../compat/libcompat.la -L/usr/local/lib -lgpg-error -lrt -lsocket -lnsl -lpthread -lsocket -lsocket libtool: link: gcc -I/usr/local/include -D_REENTRANT -g -O2 -Wall -o t-lock t_lock-t-lock.o ../src/.libs/libgcrypt.so -L/usr/local/lib ../compat/.libs/libcompat.a /usr/local/lib/libgpg-error.so -lrt -lnsl -lpthread -lsocket -R/tmp/libgcrypt-1.8.2/src/.libs -R/usr/local/lib -R/usr/local/lib gcc -DHAVE_CONFIG_H -I. -I.. -I../src -I../src -I/usr/local/include -g -O2 -Wall -MT prime.o -MD -MP -MF .deps/prime.Tpo -c -o prime.o prime.c t-common.h:103: warning: 'fail' defined but not used t-common.h:131: warning: 'info' defined but not used mv -f .deps/prime.Tpo .deps/prime.Po /bin/bash ../libtool --tag=CC --mode=link gcc -I/usr/local/include -g -O2 -Wall -no-install -o prime prime.o ../src/libgcrypt.la ../compat/libcompat.la -L/usr/local/lib -lgpg-error -lrt -lsocket -lnsl -lsocket -lsocket libtool: link: gcc -I/usr/local/include -g -O2 -Wall -o prime prime.o ../src/.libs/libgcrypt.so -L/usr/local/lib ../compat/.libs/libcompat.a /usr/local/lib/libgpg-error.so -lrt -lnsl -lsocket -R/tmp/libgcrypt-1.8.2/src/.libs -R/usr/local/lib -R/usr/local/lib gcc -DHAVE_CONFIG_H -I. -I.. -I../src -I../src -I/usr/local/include -g -O2 -Wall -MT basic.o -MD -MP -MF .deps/basic.Tpo -c -o basic.o basic.c t-common.h:131: warning: 'info' defined but not used mv -f .deps/basic.Tpo .deps/basic.Po /bin/bash ../libtool --tag=CC --mode=link gcc -I/usr/local/include -g -O2 -Wall -no-install -o basic basic.o ../src/libgcrypt.la ../compat/libcompat.la -L/usr/local/lib -lgpg-error -lrt -lsocket -lnsl -lsocket -lsocket libtool: link: gcc -I/usr/local/include -g -O2 -Wall -o basic basic.o ../src/.libs/libgcrypt.so -L/usr/local/lib ../compat/.libs/libcompat.a /usr/local/lib/libgpg-error.so -lrt -lnsl -lsocket -R/tmp/libgcrypt-1.8.2/src/.libs -R/usr/local/lib -R/usr/local/lib Undefined first referenced symbol in file .LLC3074 basic.o ld: fatal: symbol referencing errors. No output written to basic collect2: ld returned 1 exit status gmake[1]: *** [basic] Error 1 gmake[1]: Leaving directory `/tmp/libgcrypt-1.8.2/tests' gmake: *** [check-recursive] Error 1 #################################### ./configure checking for a BSD-compatible install... build-aux/install-sh -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... build-aux/install-sh -c -d checking for gawk... no checking for mawk... no checking for nawk... nawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking build system type... sparc-sun-solaris2.10 checking host system type... sparc-sun-solaris2.10 checking whether to enable maintainer-specific portions of Makefiles... no checking whether make supports nested variables... (cached) yes checking whether make sets $(MAKE)... (cached) yes checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether gcc understands -c and -o together... yes checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking how to run the C preprocessor... gcc -E checking dependency style of gcc... gcc3 checking for library containing strerror... none required checking for gawk... (cached) nawk checking for grep that handles long lines and -e... /usr/sfw/bin/ggrep checking for egrep... /usr/sfw/bin/ggrep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking minix/config.h usability... no checking minix/config.h presence... no checking for minix/config.h... no checking whether it is safe to define __EXTENSIONS__... yes checking for cc for build... gcc checking how to print strings... printf checking for a sed that does not truncate output... /usr/bin/sed checking for fgrep... /usr/sfw/bin/ggrep -F checking for ld used by gcc... /usr/ccs/bin/ld checking if the linker (/usr/ccs/bin/ld) is GNU ld... no checking for BSD- or MS-compatible name lister (nm)... /usr/ccs/bin/nm -p checking the name lister (/usr/ccs/bin/nm -p) interface... BSD nm checking whether ln -s works... yes checking the maximum length of command line arguments... 786240 checking whether the shell understands some XSI constructs... yes checking whether the shell understands "+="... yes checking how to convert sparc-sun-solaris2.10 file names to sparc-sun-solaris2.10 format... func_convert_file_noop checking how to convert sparc-sun-solaris2.10 file names to toolchain format... func_convert_file_noop checking for /usr/ccs/bin/ld option to reload object files... -r checking for objdump... no checking how to recognize dependent libraries... pass_all checking for dlltool... no checking how to associate runtime and link libraries... printf %s\n checking for ar... ar checking for archiver @FILE support... no checking for strip... strip checking for ranlib... ranlib checking command to parse /usr/ccs/bin/nm -p output from gcc object... ok checking for sysroot... no checking for mt... mt checking if mt is a manifest tool... no checking for dlfcn.h... yes checking for objdir... .libs checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fPIC -DPIC checking if gcc PIC flag -fPIC -DPIC works... yes checking if gcc static flag -static works... no checking if gcc supports -c -o file.o... yes checking if gcc supports -c -o file.o... (cached) yes checking whether the gcc linker (/usr/ccs/bin/ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... yes checking dynamic linker characteristics... solaris2.10 ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... no checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no checking for windres... no checking whether byte ordering is bigendian... yes checking size of unsigned short... 2 checking size of unsigned int... 4 checking size of unsigned long... 4 checking size of unsigned long long... 8 checking size of void *... 4 checking for uintptr_t... yes checking for UINT64_C... yes checking size of uint64_t... 8 checking which symmetric ciphers to include... arcfour blowfish cast5 des aes twofish serpent rfc2268 seed camellia idea salsa20 gost28147 chacha20 checking which public-key ciphers to include... dsa elgamal rsa ecc checking which message digests to include... crc gostr3411-94 md4 md5 rmd160 sha1 sha256 sha512 sha3 tiger whirlpool stribog blake2 checking which key derivation functions to include... s2k pkdf2 scrypt checking which random module to use... default checking whether use of /dev/random is requested... yes checking whether the experimental random daemon is requested... no checking whether MPI assembler modules are requested... yes checking whether memory guard is requested... no checking whether to run large data tests... no checking whether use of capabilities is requested... no checking whether a HMAC binary check is requested... no checking whether jitter entropy support is requested... yes checking whether padlock support is requested... yes checking whether AESNI support is requested... yes checking whether PCLMUL support is requested... yes checking whether SSE4.1 support is requested... yes checking whether DRNG support is requested... yes checking whether AVX support is requested... yes checking whether AVX2 support is requested... yes checking whether NEON support is requested... yes checking whether ARMv8 Crypto Extension support is requested... yes checking whether a -O flag munging is requested... yes checking whether to enable AMD64 as(1) feature detection... yes checking for gpg-error-config... /usr/local/bin/gpg-error-config checking for GPG Error - version >= 1.25... yes (1.31) checking for pthread_create in -lpthread... yes checking for library containing setsockopt... -lsocket checking for library containing setsockopt... (cached) -lsocket checking for ANSI C header files... (cached) yes checking for unistd.h... (cached) yes checking sys/select.h usability... yes checking sys/select.h presence... yes checking for sys/select.h... yes checking sys/msg.h usability... yes checking sys/msg.h presence... yes checking for sys/msg.h... yes checking for an ANSI C-conforming const... yes checking for inline... inline checking for size_t... yes checking return type of signal handlers... void checking whether sys_siglist is declared... no checking for pid_t... yes checking for byte typedef... no checking for ushort typedef... yes checking for ulong typedef... yes checking for u16 typedef... no checking for u32 typedef... no checking sys/socket.h usability... yes checking sys/socket.h presence... yes checking for sys/socket.h... yes checking for socklen_t... yes checking for __builtin_bswap32... no checking for __builtin_bswap64... no checking for __builtin_ctz... yes checking whether the variable length arrays are supported... yes checking whether the visibility attribute is supported... no checking whether the GCC style aligned attribute is supported... yes checking whether the GCC style packed attribute is supported... yes checking whether the GCC style may_alias attribute is supported... yes checking whether 'asm' assembler keyword is supported... yes checking whether '__asm__' assembler keyword is supported... yes checking whether inline assembly memory barrier is supported... yes checking whether GCC assembler is compatible for ARM assembly implementations... no checking whether GCC assembler is compatible for ARMv8/Aarch64 assembly implementations... no checking for _ prefix in compiled symbols... no checking architecture and mpi assembler functions... sparc checking whether compiler supports 'ms_abi' function attribute... no checking whether compiler supports 'sysv_abi' function attribute... no checking whether GCC inline assembler supports SSSE3 instructions... n/a checking whether GCC inline assembler supports PCLMUL instructions... n/a checking whether GCC inline assembler supports SSE4.1 instructions... n/a checking whether GCC inline assembler supports AVX instructions... n/a checking whether GCC inline assembler supports AVX2 instructions... n/a checking whether GCC inline assembler supports BMI2 instructions... n/a checking whether GCC assembler handles division correctly... no checking whether GCC assembler handles division correctly with "-Wa,--divide"... no checking whether GCC assembler is compatible for amd64 assembly implementations... n/a checking whether GCC assembler is compatible for Intel syntax assembly implementations... n/a checking whether compiler is configured for ARMv6 or newer architecture... n/a checking whether GCC inline assembler supports NEON instructions... n/a checking whether GCC inline assembler supports AArch32 Crypto Extension instructions... n/a checking whether GCC inline assembler supports AArch64 NEON instructions... n/a checking whether GCC inline assembler supports AArch64 Crypto Extension instructions... n/a checking for vprintf... yes checking for _doprnt... yes checking for stpcpy... no checking for strcasecmp... yes checking for strtoul... yes checking for memmove... yes checking for stricmp... no checking for atexit... yes checking for raise... yes checking for strerror... yes checking for rand... yes checking for mmap... yes checking for getpagesize... yes checking for sysconf... yes checking for waitpid... yes checking for wait4... yes checking for gettimeofday... yes checking for getrusage... yes checking for gethrtime... yes checking for clock_gettime... no checking for syslog... yes checking for syscall... yes checking for fcntl... yes checking for ftruncate... yes checking for flockfile... yes checking for mlock... yes checking for sysconf... (cached) yes checking for getpagesize... (cached) yes checking whether mlock is broken... no checking for getpid... yes checking for clock... yes checking for random device... yes checking whether non excutable stack support is requested... yes checking whether assembler supports --noexecstack option... no checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating m4/Makefile config.status: creating compat/Makefile config.status: creating mpi/Makefile config.status: creating cipher/Makefile config.status: creating random/Makefile config.status: creating doc/Makefile config.status: creating src/Makefile config.status: creating src/gcrypt.h config.status: creating src/libgcrypt-config config.status: creating src/versioninfo.rc config.status: creating tests/Makefile config.status: creating tests/hashtest-256g config.status: creating tests/basic-disable-all-hwf config.status: creating config.h config.status: config.h is unchanged config.status: linking mpi/sparc32/mpih-add1.S to mpi/mpih-add1-asm.S config.status: linking mpi/generic/mpih-sub1.c to mpi/mpih-sub1.c config.status: linking mpi/generic/mpih-mul1.c to mpi/mpih-mul1.c config.status: linking mpi/generic/mpih-mul2.c to mpi/mpih-mul2.c config.status: linking mpi/generic/mpih-mul3.c to mpi/mpih-mul3.c config.status: linking mpi/sparc32/mpih-lshift.S to mpi/mpih-lshift-asm.S config.status: linking mpi/sparc32/mpih-rshift.S to mpi/mpih-rshift-asm.S config.status: linking mpi/sparc32/udiv.S to mpi/udiv-asm.S config.status: linking mpi/generic/mpi-asm-defs.h to mpi/mpi-asm-defs.h config.status: executing depfiles commands config.status: executing libtool commands config.status: executing gcrypt-conf commands Libgcrypt v1.8.2 has been configured as follows: Platform: SunOS (sparc-sun-solaris2.10) Hardware detection module: none Enabled cipher algorithms: arcfour blowfish cast5 des aes twofish serpent rfc2268 seed camellia idea salsa20 gost28147 chacha20 Enabled digest algorithms: crc gostr3411-94 md4 md5 rmd160 sha1 sha256 sha512 sha3 tiger whirlpool stribog blake2 Enabled kdf algorithms: s2k pkdf2 scrypt Enabled pubkey algorithms: dsa elgamal rsa ecc Random number generator: default Try using jitter entropy: n/a Using linux capabilities: no Try using Padlock crypto: n/a Try using AES-NI crypto: n/a Try using Intel PCLMUL: n/a Try using Intel SSE4.1: n/a Try using DRNG (RDRAND): n/a Try using Intel AVX: n/a Try using Intel AVX2: n/a Try using ARM NEON: n/a Try using ARMv8 crypto: n/a From smueller at chronox.de Tue May 22 18:29:50 2018 From: smueller at chronox.de (Stephan Mueller) Date: Tue, 22 May 2018 18:29:50 +0200 Subject: PQG generation and verification testing Message-ID: <2873857.PYnuKXCgzD@tauon.chronox.de> Hi, I see the following code in libgcrypt 1.5.3 in function generate_fips186: if (deriveparms) { initial_seed.sexp = gcry_sexp_find_token (deriveparms, "seed", 0); if (initial_seed.sexp) initial_seed.seed = gcry_sexp_nth_data (initial_seed.sexp, 1, &initial_seed.seedlen); } if (use_fips186_2) ec = _gcry_generate_fips186_2_prime (nbits, qbits, initial_seed.seed, initial_seed.seedlen, &prime_q, &prime_p, r_counter, r_seed, r_seedlen); else if (!domain->p || !domain->q) ec = _gcry_generate_fips186_3_prime (nbits, qbits, initial_seed.seed, initial_seed.seedlen, &prime_q, &prime_p, r_counter, r_seed, r_seedlen, NULL); In the current upstream code, it is implemented differently: if (deriveparms) { initial_seed.sexp = sexp_find_token (deriveparms, "seed", 0); if (initial_seed.sexp) initial_seed.seed = sexp_nth_data (initial_seed.sexp, 1, &initial_seed.seedlen); } if (use_fips186_2) ec = _gcry_generate_fips186_2_prime (nbits, qbits, initial_seed.seed, initial_seed.seedlen, &prime_q, &prime_p, r_counter, r_seed, r_seedlen); else ec = _gcry_generate_fips186_3_prime (nbits, qbits, NULL, 0, &prime_q, &prime_p, r_counter, r_seed, r_seedlen, NULL); See 3rd and 4th parameter for _gcry_generate_fips186_3_prime which is now NULL instead of initial_seed. With that, there is no way to set a pre-defined seed to verify that the P/Q generation function works correctly. Is there any other way how to test the P/Q generation by supplying the seed? If not, could the current upstream code be changed back to the old implementation? Thanks. Ciao Stephan From smueller at chronox.de Tue May 22 19:40:24 2018 From: smueller at chronox.de (Stephan Mueller) Date: Tue, 22 May 2018 19:40:24 +0200 Subject: PQG generation and verification testing In-Reply-To: <2873857.PYnuKXCgzD@tauon.chronox.de> References: <2873857.PYnuKXCgzD@tauon.chronox.de> Message-ID: <2394316.41fvIgyley@tauon.chronox.de> Am Dienstag, 22. Mai 2018, 18:29:50 CEST schrieb Stephan Mueller: Hi, > Hi, > > I see the following code in libgcrypt 1.5.3 in function generate_fips186: Please disregard this message. I just found out that the Fedora code base modified the following code path to make it testable: > else if (!domain->p || !domain->q) > ec = _gcry_generate_fips186_3_prime (nbits, qbits, > initial_seed.seed, > initial_seed.seedlen, > &prime_q, &prime_p, > r_counter, > r_seed, r_seedlen, NULL); > > Though, would it make sense to equally change it upstream? Ciao Stephan