summaryrefslogtreecommitdiff
path: root/random
Commit message (Collapse)AuthorAgeFilesLines
* w32: Silence GCC warning for -Wcast-function-type.NIIBE Yutaka2023-05-101-10/+10
| | | | | | | | | * random/rndw32.c (init_system_rng): Add (void *). (slow_gatherer): Likewise. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Update copyright notices to use URL.NIIBE Yutaka2023-04-272-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * build-aux/db2any: Update copyright notice. * cipher/arcfour.c, cipher/blowfish.ccipher/cast5.c: Likewise. * cipher/crc-armv8-ce.c, cipher/crc-intel-pclmul.c: Likewise. * cipher/crc-ppc.c, cipher/crc.c, cipher/des.c: Likewise. * cipher/md2.c, cipher/md4.c, cipher/md5.c: Likewise. * cipher/primegen.c, cipher/rfc2268.c, cipher/rmd160.c: Likewise. * cipher/seed.c, cipher/serpent.c, cipher/tiger.c: Likewise. * cipher/twofish.c: Likewise. * mpi/alpha/mpih-add1.S, mpi/alpha/mpih-lshift.S: Likewise. * mpi/alpha/mpih-mul1.S, mpi/alpha/mpih-mul2.S: Likewise. * mpi/alpha/mpih-mul3.S, mpi/alpha/mpih-rshift.S: Likewise. * mpi/alpha/mpih-sub1.S, mpi/alpha/udiv-qrnnd.S: Likewise. * mpi/amd64/mpih-add1.S, mpi/amd64/mpih-lshift.S: Likewise. * mpi/amd64/mpih-mul1.S, mpi/amd64/mpih-mul2.S: Likewise. * mpi/amd64/mpih-mul3.S, mpi/amd64/mpih-rshift.S: Likewise. * mpi/amd64/mpih-sub1.S, mpi/config.links: Likewise. * mpi/generic/mpih-add1.c, mpi/generic/mpih-lshift.c: Likewise. * mpi/generic/mpih-mul1.c, mpi/generic/mpih-mul2.c: Likewise. * mpi/generic/mpih-mul3.c, mpi/generic/mpih-rshift.c: Likewise. * mpi/generic/mpih-sub1.c, mpi/generic/udiv-w-sdiv.c: Likewise. * mpi/hppa/mpih-add1.S, mpi/hppa/mpih-lshift.S: Likewise. * mpi/hppa/mpih-rshift.S, mpi/hppa/mpih-sub1.S: Likewise. * mpi/hppa/udiv-qrnnd.S, mpi/hppa1.1/mpih-mul1.S: Likewise. * mpi/hppa1.1/mpih-mul2.S, mpi/hppa1.1/mpih-mul3.S: Likewise. * mpi/hppa1.1/udiv-qrnnd.S, mpi/i386/mpih-add1.S: Likewise. * mpi/i386/mpih-lshift.S, mpi/i386/mpih-mul1.S: Likewise. * mpi/i386/mpih-mul2.S, mpi/i386/mpih-mul3.S: Likewise. * mpi/i386/mpih-rshift.S, mpi/i386/mpih-sub1.S: Likewise. * mpi/i386/syntax.h, mpi/longlong.h: Likewise. * mpi/m68k/mc68020/mpih-mul1.S, mpi/m68k/mc68020/mpih-mul2.S: Likewise. * mpi/m68k/mc68020/mpih-mul3.S, mpi/m68k/mpih-add1.S: Likewise. * mpi/m68k/mpih-lshift.S, mpi/m68k/mpih-rshift.S: Likewise. * mpi/m68k/mpih-sub1.S, mpi/m68k/syntax.h: Likewise. * mpi/mips3/mpih-add1.S, mpi/mips3/mpih-lshift.S: Likewise. * mpi/mips3/mpih-mul1.S, mpi/mips3/mpih-mul2.S: Likewise. * mpi/mips3/mpih-mul3.S, mpi/mips3/mpih-rshift.S: Likewise. * mpi/mips3/mpih-sub1.S, mpi/mpi-add.c: Likewise. * mpi/mpi-bit.c, mpi/mpi-cmp.c, mpi/mpi-div.c: Likewise. * mpi/mpi-gcd.c, mpi/mpi-inline.c, mpi/mpi-inline.h: Likewise. * mpi/mpi-internal.h, mpi/mpi-mpow.c, mpi/mpi-mul.c: Likewise. * mpi/mpi-scan.c, mpi/mpih-div.c, mpi/mpih-mul.c: Likewise. * mpi/pa7100/mpih-lshift.S, mpi/pa7100/mpih-rshift.S: Likewise. * mpi/power/mpih-add1.S, mpi/power/mpih-lshift.S: Likewise. * mpi/power/mpih-mul1.S, mpi/power/mpih-mul2.S: Likewise. * mpi/power/mpih-mul3.S, mpi/power/mpih-rshift.S: Likewise. * mpi/power/mpih-sub1.S, mpi/powerpc32/mpih-add1.S: Likewise. * mpi/powerpc32/mpih-lshift.S, mpi/powerpc32/mpih-mul1.S: Likewise. * mpi/powerpc32/mpih-mul2.S, mpi/powerpc32/mpih-mul3.S: Likewise. * mpi/powerpc32/mpih-rshift.S, mpi/powerpc32/mpih-sub1.S: Likewise. * mpi/powerpc32/syntax.h, mpi/sparc32/mpih-add1.S: Likewise. * mpi/sparc32/mpih-lshift.S, mpi/sparc32/mpih-rshift.S: Likewise. * mpi/sparc32/udiv.S, mpi/sparc32v8/mpih-mul1.S: Likewise. * mpi/sparc32v8/mpih-mul2.S, mpi/sparc32v8/mpih-mul3.S: Likewise. * mpi/supersparc/udiv.S: Likewise. * random/random.h, random/rndegd.c: Likewise. * src/cipher.h, src/libgcrypt.def, src/libgcrypt.vers: Likewise. * src/missing-string.c, src/mpi.h, src/secmem.h: Likewise. * src/stdmem.h, src/types.h: Likewise. * tests/aeswrap.c, tests/curves.c, tests/hmac.c: Likewise. * tests/keygrip.c, tests/prime.c, tests/random.c: Likewise. * tests/t-kdf.c, tests/testapi.c: Likewise. -- GnuPG-bug-id: 6271 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random: Use getrandom only when it's appropriate.NIIBE Yutaka2023-04-101-0/+2
| | | | | | | | | | | | * random/rndgetentropy.c (_gcry_rndgetentropy_gather_random) [GRND_RANDOM]: Conditionalize the use of getrandom, as it's not a portable function. -- Fixes-commit: aab1d63e4def41593312f76de016c885ffafecde GnuPG-bug-id: 6442 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* build: Allow build with -Oz.NIIBE Yutaka2023-04-031-1/+1
| | | | | | | | | | * cipher/Makefile.am [ENABLE_O_FLAG_MUNGING]: Support -Oz. * random/Makefile.am [ENABLE_O_FLAG_MUNGING]: Support -Oz. -- GnuPG-bug-id: 6432 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random: Remove unused SHA384 DRBGs.Jakub Jelen2023-03-071-11/+2
| | | | | | | | | | | | | * random/random-drbg.c (global): Remove unused SHA384-based defines. (drbg_cores): Remove SHA384 configurations. (drbg_sec_strength): Remove unused SHA384. -- These are no longer allowed by FIPS and it looks like they were never usable as they do not have any conversion from the string flags. GnuPG-bug-id: 6393 Signed-off-by: Jakub Jelen <jjelen@redhat.com>
* random:w32: Don't emit message for diskperf when it's not useful.NIIBE Yutaka2022-11-211-2/+9
| | | | | | | | * random/rndw32.c (slow_gatherer): Suppress emitting by log_info. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random: Extend the comment about FIPS specificsJakub Jelen2022-10-061-1/+11
| | | | | | | | * random/rndgetentropy.c (_gcry_rndgetentropy_gather_random): Clarify description of the chainging DRBG in FIPS mode. -- Signed-off-by: Jakub Jelen <jjelen@redhat.com>
* random: Get maximum 32B of entropy at once in FIPS ModeJakub Jelen2022-10-041-3/+9
| | | | | | | | | | | | * random/rndgetentropy.c (_gcry_rndgetentropy_gather_random): In fips mode, gather max 32 B of strong entropy for initialization. -- The limitation of our current kernel patch guarantees that only 32B of strong random data can be gathered using getrandom(). Signed-off-by: Jakub Jelen <jjelen@redhat.com>
* Fix function prototypes.NIIBE Yutaka2022-09-081-1/+1
| | | | | | | | | | * random/random-csprng.c (random_poll): It's no args. * src/secmem.c (_gcry_secmem_module_init): Likewise. (_gcry_secmem_term): Likewise. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random: Use getrandom (GRND_RANDOM) in FIPS mode.Jakub Jelen2022-08-231-1/+4
| | | | | | | | | | | | | | | | * random/rndgetentropy.c (_gcry_rndgetentropy_gather_random): Use GRND_RANDOM in FIPS Mode -- The SP800-90C (clarified in IG D.K.) requires the following when different DRBGs are chained: * the parent needs to be reseeded before generate operation * the reseed & generate needs to be atomic In RHEL, this is addressed by change in the kernel, that will do this automatically, when the getentropy () is called with GRND_RANDOM flag. Signed-off-by: Jakub Jelen <jjelen@redhat.com>
* random: Fix rndjent for Windows.NIIBE Yutaka2022-05-102-1/+25
| | | | | | | | | | | | | * random/jitterentropy-base-user.h [HAVE_W32_SYSTEM] (jent_ncpu): Implement. * random/rndjent.c (_WIN32_WINNT): Define for GetNativeSystemInfo. (EOPNOTSUPP): Define when not available. -- Reported-by: Eli Zaretskii GnuPG-bug-id: 5891 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random: Not use secure memory for DRBG instance.NIIBE Yutaka2022-04-211-4/+4
| | | | | | | | | | | * random/random-drbg.c (drbg_instance): New at BSS. (_drbg_init_internal): Don't allocate at secure memory. (_gcry_rngdrbg_close_fds): Follow the change. -- GnuPG-bug-id: 5933 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random:drbg: Fix the behavior for child process.NIIBE Yutaka2022-03-311-0/+3
| | | | | | | | | | | | * random/random-drbg.c (_gcry_rngdrbg_randomize): Update change of PID detection. -- In a child process, it calls to drbg_reseed again and again, without this change. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* jitterentropy: Include <fcntl.h> and <limits.h>Heiko Becker2022-02-041-0/+3
| | | | | | | | | | | | | | * random/jitterentropy-base-user.h: Include <fcntl.h> for O_RDONLY * random/jitterentropy-base-user.h: Include <limits.h> for LONG_MAX -- Cherry-picked from LIBGCRYPT-1.10-BRANCH branch of: ffaef0be613121d3ee37867d82932a7a30c2bc6d Fixes the build with musl libc. Signed-off-by: Heiko Becker <heirecka@exherbo.org>
* random: Avoid dereference of the ec before checking for NULLJakub Jelen2022-01-311-4/+6
| | | | | | | * random/jitterentropy-noise.c (jent_memaccess): Move check before dereferencing the pointer. -- Signed-off-by: Jakub Jelen <jjelen@redhat.com>
* random: Include sys/random.h when available.NIIBE Yutaka2022-01-261-0/+3
| | | | | | | | | | * configure.ac (AC_CHECK_HEADERS): Check sys/random.h. * random/rndgetentropy.c [HAVE_SYS_RANDOM_H]: Include it. -- Reported-by: Christoph Badura <bad@bsd.de> Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random: Rename rndlinux module to rndoldlinux.NIIBE Yutaka2022-01-116-26/+26
| | | | | | | | | | | | | | | | | | * configure.ac (USE_RNDOLDLINUX): Rename from USE_RNDLINUX. (GCRYPT_RANDOM): Use rndoldlinux.lo. * doc/gcrypt.texi: Update. * random/Makefile.am (EXTRA_librandom_la_SOURCES): Update. * random/rndoldlinux.c: Rename from rndlinux.c. Rename the function. * random/rand-internal.h: Update the function name. * random/random-csprng.c: Update the calls to the function. * random/random-drbg.c: Likewise. * random/random-system.c: Likewise. * src/global.c: Use USE_RNDOLDLINUX. -- GnuPG-bug-id: 5759 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random: Remove random-daemon use remained.NIIBE Yutaka2021-12-172-12/+0
| | | | | | | | | | | | | * configure.ac (--enable-random-daemon): Fix the message. * random/random-csprng.c [USE_RANDOM_DAEMON] (initialize_basics): Remove the dependency to random daemon. * random/random.h [USE_RANDOM_DAEMON]: Likewise. -- GnuPG-bug-id: 5706 Fixes-commit: 754ad5815b5bb7462260414f2bc5f449bee0b1c6 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random: Remove random-fips.c from repo.NIIBE Yutaka2021-12-081-1131/+0
| | | | | | | | | | * random/random-fips.c: Remove. -- GnuPG-bug-id: 5723 Fixes-commit: e9b692d25d1c149b5417b70e18f2ce173bc25b6d Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random: Remove use of experimental random daemon.NIIBE Yutaka2021-12-076-433/+0
| | | | | | | | | | | | | | | | | | | * random/Makefile.am (librandom_la_SOURCES): Remove random-daemon.c. * random/random-daemon.c: Remove. * random/rand-internal.h: Remove declarations. * random/random-csprng.c (_gcry_rngcsprng_set_daemon_socket) (_gcry_rngcsprng_use_daemon): Remove. [USE_RANDOM_DAEMON] (_gcry_rngcsprng_randomize): Don't call _gcry_daemon_randomize. * random/random.c (_gcry_set_random_daemon_socket) (_gcry_use_random_daemon): Remove. * src/global.c (_gcry_vcontrol): Return GPG_ERR_NOT_SUPPORTED. * tests/benchmark.c (main): Remove support of use_random_daemon. -- GnuPG-bug-id: 5706 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random: Release memory in DRBG.NIIBE Yutaka2021-12-061-2/+4
| | | | | | | | | | * random/random-drbg.c (_gcry_rngdrbg_close_fds): Release DRBG_STATE. -- Fixes-commit: 204be8a385ae6140175e3b495989a261410c34d0 GnuPG-bug-id: 5636 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random: Add missing header file to the release tarballJakub Jelen2021-12-031-0/+1
| | | | | | | | * random/Makefile.am: Add missing header file. -- GnuPG-bug-id: 5523 Signed-off-by: Jakub Jelen <jjelen@redhat.com>
* random: Extend semantics of _gcry_random_close_fds.NIIBE Yutaka2021-11-242-1/+16
| | | | | | | | | | | * random/random-csprng.c (_gcry_rngcsprng_close_fds): Add de-initialization. * random/random-drbg.c (_gcry_rngdrbg_close_fds): Likewise. -- GnuPG-bug-id: 5636 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* jitterentropy: use wipememory for jent_memset_secureJussi Kivilinna2021-11-181-2/+1
| | | | | | | | | | | * random/jitterentropy-base-user.h (jent_memset_secure): Use wipememory. -- Patch removes GCC inline assembly dependency on compiler barrier by instead using wipememory for clearing memory. GnuPG-bug-id: 5523 Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
* jitterentropy: fix building on Win32Jussi Kivilinna2021-11-181-0/+2
| | | | | | | | | * random/jitterentropy.h (jent_notime_ctx): Add #ifdef JENT_CONF_ENABLE_INTERNAL_TIMER around pthread variables. -- GnuPG-bug-id: 5523 Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
* jitternetropy: Put our local change to use non-secure memory.NIIBE Yutaka2021-11-181-1/+1
| | | | | | | | | | * random/jitterentropy-base.c (jent_entropy_collector_alloc_internal): Let jent_memaccess use normal memory. -- GnuPG-bug-id: 5523 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random: Fix rndgetentropy correctly uses rndjent.NIIBE Yutaka2021-11-185-6/+22
| | | | | | | | | | * random/rndgetentropy.c (_gcry_rndgetentropy_gather_random): Call _gcry_rndjent_poll for GCRY_VERY_STRONG_RANDOM. -- GnuPG-bug-id: 5692 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* jitterentropy: Use jent_read_entropy_safe for rndjent.NIIBE Yutaka2021-11-171-1/+1
| | | | | | | | | * random/rndjent.c (_gcry_rndjent_poll): Use jent_read_entropy_safe. -- GnuPG-bug-id: 5523 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Fix jent_read_entropy for JENT_CPU_JITTERENTROPY_SECURE_MEMORY.NIIBE Yutaka2021-11-171-1/+1
| | | | | | | | | | | | | | * random/jitterentropy-base.c (jent_read_entropy): Fix conditional compile. -- The call of jent_random_data had been enabled wrongly, until this update. But it was safer side for the RNG. Peformance was bad, though. GnuPG-bug-id: 5523 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* jitterentropy: Fix for C90 compiler.NIIBE Yutaka2021-11-171-2/+4
| | | | | | | | | | * random/jitterentropy-noise.c (jent_hash_time): Declare hash_loop_cnt at the beginning of the function. -- GnuPG-bug-id: 5523 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* jitterentropy: Disable use of pthread.NIIBE Yutaka2021-11-173-1/+9
| | | | | | | | | | | | | | | * random/jitterentropy.h (JENT_CONF_ENABLE_INTERNAL_TIMER): Undefine. * random/jitterentropy-base.c [JENT_CONF_ENABLE_INTERNAL_TIMER] (jent_entropy_switch_notime_impl): Add conditional compilation. * random/jitterentropy-base-user.h [JENT_CONF_ENABLE_INTERNAL_TIMER] (jent_yield): Likewise. * random/jitterentropy.h [JENT_CONF_ENABLE_INTERNAL_TIMER] (jent_entropy_switch_notime_impl): Likewise. -- GnuPG-bug-id: 5523 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* jitterentropy: Fix building rndjent.NIIBE Yutaka2021-11-172-2/+25
| | | | | | | | | | * random/Makefile.am: Update for new jitterentropy. * random/rndjent.c: Update to include the other files. -- GnuPG-bug-id: 5523 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* jitterentropy: Merge from jitterentropy-library-3.3.0.NIIBE Yutaka2021-11-1714-587/+2931
| | | | | | | | | | | | | | | | | | | | | | | | | * random/jitterentropy-base.h: New. * random/jitterentropy-gcd.c: New. * random/jitterentropy-gcd.h: New. * random/jitterentropy-health.c: New. * random/jitterentropy-health.h: New. * random/jitterentropy-noise.c: New. * random/jitterentropy-noise.h: New. * random/jitterentropy-sha3.c: New. * random/jitterentropy-sha3.h: New. * random/jitterentropy-timer.c: New. * random/jitterentropy-timer.h: New. * random/jitterentropy-base.c: Update. * random/jitterentropy.h: Update. * random/jitterentropy-base-user.h: Update, keeping ours mostly. -- Unicode characters are replaced or removed (quotation mark, minus, and BOM). Inconsistent Tabs are replaced by spaces. GnuPG-bug-id: 5523 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random: Include getentropy random module.NIIBE Yutaka2021-11-156-11/+41
| | | | | | | | | | | | | | | * random/rand-internal.h (_gcry_rndgetentropy_gather_random): Add. * random/random-csprng.c [USE_RNDLINUX] (_gcry_rngcsprng_close_fds) (getfnc_gather_random): Support getentropy random module. * random/random-drbg.c: Likewise. * random/random-fips.c: Likewise. * random/random-system.c: Likewise. * src/global.c [USE_RNDLINUX] (print_config): Show getentropy. -- GnuPG-bug-id: 5636 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* build: Support rndgetentropy random module.NIIBE Yutaka2021-11-151-0/+1
| | | | | | | | | | * configure.ac: Add getentropy random module. * random/Makefile.am (EXTRA_librandom_la_SOURCES): Add. -- GnuPG-bug-id: 5636 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random:getentropy: Simplify more.NIIBE Yutaka2021-11-151-19/+16
| | | | | | | | | * random/rndgetentropy.c (_gcry_rndgetentropy_gather_random): Remove 'if'. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random:getentropy: Limit the size of buffer in exact size.NIIBE Yutaka2021-11-151-4/+2
| | | | | | | | | * random/rndgetentropy.c (_gcry_rndgetentropy_gather_random): Redundant space had no sense. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random: Simplify rndgetentropy.NIIBE Yutaka2021-11-151-276/+20
| | | | | | | | | | | | * random/rndgetentropy.c (_gcry_rndgetentropy_gather_random): Simply call getentropy. -- This is how actually rndlinux works on modern machine and OS. GnuPG-bug-id: 5636 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random: Start rnd-getentropy.c.NIIBE Yutaka2021-11-151-0/+349
| | | | | | | | * random/rnd-getentropy.c: Copied from rndlinux.c. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Fix building for Win64 targetJussi Kivilinna2021-10-061-0/+3
| | | | | | | | | | | | * random/random-csprng.c [HAVE_W32_SYSTEM]: Include <windows.h>. * tests/bench-slope.c [_WIN32]: Include <windows.h>. -- Removal of <winsock2.h> include from 'gcrypt.h' broke building random-csprng.c and bench-slope.c on x86_64-w64-mingw32 target. GnuPG-bug-id: 5637 Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
* random: Use poll instead of select.NIIBE Yutaka2021-10-051-43/+23
| | | | | | | | | | | | | | | | | * random/rndlinux.c (open_device): Use poll. (_gcry_rndlinux_gather_random): Use poll. -- Merging a patch for Fedora/RedHat for _gcry_rndlinux_gather_random. Also change open_device for completeness. Use of sleep(3) would be OK here, but it may use SIGALRM on some systems, which is not good as a library. GnuPG-bug-id: 5637 Co-authored-by: Tomáš Mráz <tm@t8m.info> Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random: Silence a warning for building rndjent by Clang.NIIBE Yutaka2021-06-011-0/+2
| | | | | | | | | * random/jitterentropy-base.c: Conditionalize by __OPTIMIZE__. -- GnuPG-bug-id: 5369 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random: Fix for iOS.NIIBE Yutaka2021-04-131-0/+3
| | | | | | | | | * random/rndlinux.c [TARGET_OS_IPHONE]: Don't define HAVE_GETENTROPY. -- GnuPG-bug-id: 5375 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* random: Fix build for macOS.NIIBE Yutaka2021-02-121-0/+3
| | | | | | | | | | * random/rndlinux.c [__APPLE__] (HAVE_GETENTROPY): Valid only when the macro __MAC_10_11 is available. -- GnuPG-bug-id: 5268 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Add handling for -Og with O-flag mungingJussi Kivilinna2021-02-031-1/+1
| | | | | | | | * cipher/Makefile.am (o_flag_munging): Add handling for '-Og'. * random/Makefile.am (o_flag_munging): Add handling for '-Og'. -- Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
* jent: silence ubsan warning about signed overflowJussi Kivilinna2021-02-031-1/+1
| | | | | | | | * random/jitterentropy-base.c (jent_stuck): Cast 'delta2' values to 'uint64_t' for calculation. -- Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
* Fix building with --disable-asm on x86Jussi Kivilinna2021-02-031-1/+1
| | | | | | | | | | * cipher/keccak.c (USE_64BIT_BMI2, USE_64BIT_SHLD) (USE_32BIT_BMI2): Depend also on HAVE_CPU_ARCH_X86. * random/rndjent.c [__i386__ || __x86_64__] (USE_JENT): Depend also on HAVE_CPU_ARCH_X86. -- Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
* random: Use getentropy on macOS when available.NIIBE Yutaka2021-01-271-0/+7
| | | | | | | | | | | * random/rndlinux.c [__APPLE__ && __MACH__] (getentropy): Declare. (_gcry_rndlinux_gather_random): Check the symbol and use getentropy. -- GnuPG-bug-id: 5268 Suggested-by: David Carlier Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Define HW-feature flags per architectureJussi Kivilinna2021-01-263-17/+17
| | | | | | | | | | | | | | | | | * random/rand-internal.h (_gcry_rndhw_poll_slow): Add requested length parameter. * random/rndhw.c (_gcry_rndhw_poll_slow): Limit accounted bytes to 50% (or 25% for RDRAND) - this code is moved from caller side. * random/rndlinux.c (_gcry_rndlinux_gather_random): Move HWF_INTEL_RDRAND check to _gcry_rndhw_poll_slow. * src/g10lib.h (HWF_PADLOCK_*, HWF_INTEL_*): Define only if HAVE_CPU_ARCH_X86. (HWF_ARM_*): Define only if HAVE_CPU_ARCH_ARM. (HWF_PPC_*): Define only if HAVE_CPU_ARCH_PPC. (HWF_S390X_*): Define only if HAVE_CPU_ARCH_S390X. -- Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
* random: Allow for a Unicode random seed file on Windows.Werner Koch2020-10-231-7/+89
| | | | | | | | | | | | | | | * random/random-csprng.c (utf8_to_wchar) [W32]: New. (any8bitchar) [W32]: New. (my_open): New. Replace all calls to open with this. -- Users with account names having an Unicode character in their name may now create a random_see file without running into an error. Note that depending on the code page this used to work but for sure no if more than one byte is required. For testing I used "Ⓐnne". GnuPG-bug-id: 5098 Signed-off-by: Werner Koch <wk@gnupg.org>