/openbmc/linux/drivers/firmware/efi/libstub/ |
H A D | random.c | 1 // SPDX-License-Identifier: GPL-2.0 29 * efi_get_random_bytes() - fill a buffer with random bytes 53 * efi_random_get_seed() - provide random seed as configuration table 70 struct linux_efi_random_seed *prev_seed, *seed = NULL; in efi_random_get_seed() local 88 * Check whether a seed was provided by a prior boot stage. In that in efi_random_get_seed() 91 * Note that we should read the seed size with caution, in case the in efi_random_get_seed() 95 if (prev_seed && prev_seed->size <= 512U) { in efi_random_get_seed() 96 prev_seed_size = prev_seed->size; in efi_random_get_seed() 102 * allocation will survive a kexec reboot (although we refresh the seed in efi_random_get_seed() 106 struct_size(seed, bits, seed_size), in efi_random_get_seed() [all …]
|
/openbmc/linux/include/crypto/ |
H A D | rng.h | 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 33 * struct rng_alg - random number generator definition 40 * @seed: Seed or reseed the random number generator. With the 43 * random number generator requires a seed for setting 44 * up a new state, the seed must be provided by the 46 * size of the seed is defined with @seedsize . 50 * @seedsize: The seed size required for a random number generator 52 * random number generators does not require a seed 55 * the seed size is set to zero. 62 int (*seed)(struct crypto_rng *tfm, const u8 *seed, unsigned int slen); member [all …]
|
/openbmc/u-boot/net/ |
H A D | net_rand.h | 2 * Copied from LiMon - BOOTP. 15 * Return a seed for the PRNG derived from the eth0 MAC address. 20 unsigned int seed; in seed_mac() local 25 seed = enetaddr[5]; in seed_mac() 26 seed ^= enetaddr[4] << 8; in seed_mac() 27 seed ^= enetaddr[3] << 16; in seed_mac() 28 seed ^= enetaddr[2] << 24; in seed_mac() 29 seed ^= enetaddr[1]; in seed_mac() 30 seed ^= enetaddr[0] << 8; in seed_mac() 32 return seed; in seed_mac() [all …]
|
/openbmc/linux/include/linux/ |
H A D | prandom.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 5 * Include file for the fast pseudo-random 32-bit 36 * prandom_seed_state - set seed for prandom_u32_state(). 37 * @state: pointer to state structure to receive the seed. 38 * @seed: arbitrary 64-bit value to use as a seed. 40 static inline void prandom_seed_state(struct rnd_state *state, u64 seed) in prandom_seed_state() argument 42 u32 i = ((seed >> 32) ^ (seed << 10) ^ seed) & 0xffffffffUL; in prandom_seed_state() 44 state->s1 = __seed(i, 2U); in prandom_seed_state() 45 state->s2 = __seed(i, 8U); in prandom_seed_state() 46 state->s3 = __seed(i, 16U); in prandom_seed_state() [all …]
|
H A D | xxhash.h | 2 * xxHash - Extremely Fast Hash algorithm 3 * Copyright (C) 2012-2016, Yann Collet. 5 * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) 32 * Free Software Foundation. This program is dual-licensed; you may select 37 * - xxHash homepage: https://cyan4973.github.io/xxHash/ 38 * - xxHash source repository: https://github.com/Cyan4973/xxHash 61 * MD5-32 0.33 GB/s 10 Ronald L. Rivest 62 * SHA1-32 0.28 GB/s 10 68 * A 64-bits version, named xxh64 offers much better speed, 69 * but for 64-bits applications only. [all …]
|
/openbmc/bios-settings-mgr/src/ |
H A D | password.cpp | 8 http:www.apache.org/licenses/LICENSE-2.0 23 #include <phosphor-logging/elog-errors.hpp> 24 #include <phosphor-logging/lg2.hpp> 38 const std::array<uint8_t, maxSeedSize>& seed, in compareDigest() argument 46 reinterpret_cast<const unsigned char*>(seed.data()), in compareDigest() 47 seed.size(), iterValue, digestFunc, hashLen, in compareDigest() 64 const std::array<uint8_t, maxSeedSize>& seed, in isMatch() argument 71 return compareDigest(EVP_sha256(), SHA256_DIGEST_LENGTH, expected, seed, in isMatch() 77 return compareDigest(EVP_sha384(), SHA384_DIGEST_LENGTH, expected, seed, in isMatch() 86 std::array<uint8_t, maxSeedSize>& seed, in getParam() argument [all …]
|
/openbmc/linux/drivers/crypto/allwinner/sun8i-ss/ |
H A D | sun8i-ss-prng.c | 1 // SPDX-License-Identifier: GPL-2.0 3 * sun8i-ss-prng.c - hardware cryptographic offloader for 6 * Copyright (C) 2015-2020 Corentin Labbe <clabbe@baylibre.com> 12 #include "sun8i-ss.h" 13 #include <linux/dma-mapping.h> 19 int sun8i_ss_prng_seed(struct crypto_rng *tfm, const u8 *seed, in sun8i_ss_prng_seed() argument 24 if (ctx->seed && ctx->slen != slen) { in sun8i_ss_prng_seed() 25 kfree_sensitive(ctx->seed); in sun8i_ss_prng_seed() 26 ctx->slen = 0; in sun8i_ss_prng_seed() 27 ctx->seed = NULL; in sun8i_ss_prng_seed() [all …]
|
/openbmc/linux/drivers/crypto/allwinner/sun8i-ce/ |
H A D | sun8i-ce-prng.c | 1 // SPDX-License-Identifier: GPL-2.0 3 * sun8i-ce-prng.c - hardware cryptographic offloader for 6 * Copyright (C) 2015-2020 Corentin Labbe <clabbe@baylibre.com> 12 #include "sun8i-ce.h" 13 #include <linux/dma-mapping.h> 29 kfree_sensitive(ctx->seed); in sun8i_ce_prng_exit() 30 ctx->seed = NULL; in sun8i_ce_prng_exit() 31 ctx->slen = 0; in sun8i_ce_prng_exit() 34 int sun8i_ce_prng_seed(struct crypto_rng *tfm, const u8 *seed, in sun8i_ce_prng_seed() argument 39 if (ctx->seed && ctx->slen != slen) { in sun8i_ce_prng_seed() [all …]
|
/openbmc/linux/scripts/basic/ |
H A D | Makefile | 1 # SPDX-License-Identifier: GPL-2.0-only 5 hostprogs-always-y += fixdep 7 # randstruct: the seed is needed before building the gcc-plugin or 9 gen-randstruct-seed := $(srctree)/scripts/gen-randstruct-seed.sh 12 $(CONFIG_SHELL) $(gen-randstruct-seed) \ 14 $(obj)/randstruct.seed: $(gen-randstruct-seed) FORCE 16 always-$(CONFIG_RANDSTRUCT) += randstruct.seed
|
/openbmc/openbmc/poky/meta/recipes-kernel/kexec/kexec-tools/ |
H A D | 0001-arm64-kexec-disabled-check-if-kaslr-seed-dtb-propert.patch | 3 Date: Thu, 12 Nov 2020 12:56:46 -0800 4 Subject: [PATCH] arm64: kexec: disabled check if kaslr-seed dtb property was 7 Kexec when loading arm64 kernel checks if chosen/kaslr-seed dtb property is 9 if bootloader creates and fills kaslr-seed property and kernel is not 11 kaslr-seed does not run. As a result kaslr-seed property is not zero and when 14 setup_2nd_dtb: kaslr-seed is not wiped to 0. 19 qemu 5.1.0. Qemu created kaslr-seed property but kernel was not configured 22 Although check has some value, there is a use-case where it breaks kexec, 25 Note in described use-case the fact that kaslr-seed is not wiped and user 27 /sys/firmware/devicetree/base/chosen/kaslr-seed is not a security problem [all …]
|
/openbmc/linux/lib/ |
H A D | xxhash.c | 2 * xxHash - Extremely Fast Hash algorithm 3 * Copyright (C) 2012-2016, Yann Collet. 5 * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) 32 * Free Software Foundation. This program is dual-licensed; you may select 37 * - xxHash homepage: https://cyan4973.github.io/xxHash/ 38 * - xxHash source repository: https://github.com/Cyan4973/xxHash 49 /*-************************************* 52 #define xxh_rotl32(x, r) ((x << r) | (x >> (32 - r))) 53 #define xxh_rotl64(x, r) ((x << r) | (x >> (64 - r))) 61 /*-************************************* [all …]
|
H A D | test_hash.c | 1 // SPDX-License-Identifier: GPL-2.0-only 5 * produce the same thing and, for cases where a k-bit hash 8 * We fill a buffer with a 255-byte null-terminated string, 24 /* 32-bit XORSHIFT generator. Seed must not be zero. */ 26 xorshift(u32 seed) in xorshift() argument 28 seed ^= seed << 13; in xorshift() 29 seed ^= seed >> 17; in xorshift() 30 seed ^= seed << 5; in xorshift() 31 return seed; in xorshift() 34 /* Given a non-zero x, returns a non-zero byte. */ [all …]
|
/openbmc/linux/drivers/crypto/ |
H A D | exynos-rng.c | 1 // SPDX-License-Identifier: GPL-2.0 3 * exynos-rng.c - Random Number Generator driver for the Exynos 7 * Loosely based on old driver from drivers/char/hw_random/exynos-rng.c: 40 /* Five seed and output registers, each 4 bytes */ 51 * Driver re-seeds itself with generated random numbers to hinder 52 * backtracking of the original seed. 54 * Time for next re-seed in ms. 89 return readl_relaxed(rng->mem + offset); in exynos_rng_readl() 94 writel_relaxed(val, rng->mem + offset); in exynos_rng_writel() 98 const u8 *seed, unsigned int slen) in exynos_rng_set_seed() argument [all …]
|
/openbmc/linux/arch/x86/tools/ |
H A D | insn_sanity.c | 1 // SPDX-License-Identifier: GPL-2.0-or-later 3 * x86 decoder sanity test - based on test_get_insn.c 24 * access out-of-instruction-buffer. 32 static int x86_64; /* x86-64 bit mode flag */ 33 static unsigned int seed; /* Random seed */ variable 42 fprintf(stderr, "Usage: %s [-y|-n|-v] [-s seed[,no]] [-m max] [-i input]\n", prog); in usage() 43 fprintf(stderr, "\t-y 64bit mode\n"); in usage() 44 fprintf(stderr, "\t-n 32bit mode\n"); in usage() 45 fprintf(stderr, "\t-v Verbosity(-vv dumps any decoded result)\n"); in usage() 46 fprintf(stderr, "\t-s Give a random seed (and iteration number)\n"); in usage() [all …]
|
/openbmc/linux/drivers/char/hw_random/ |
H A D | hisi-rng.c | 1 // SPDX-License-Identifier: GPL-2.0-only 27 MODULE_PARM_DESC(seed_sel, "Auto reload seed. 0, use LFSR(default); 1, use ring oscillator."); 38 u32 seed; in hisi_rng_init() local 40 /* get a random number as initial seed */ in hisi_rng_init() 41 get_random_bytes(&seed, sizeof(seed)); in hisi_rng_init() 43 writel_relaxed(seed, hrng->base + RNG_SEED); in hisi_rng_init() 46 * The seed is reload periodically, there are two choice in hisi_rng_init() 47 * of seeds, default seed using the value from LFSR, or in hisi_rng_init() 48 * will use seed generated by ring oscillator. in hisi_rng_init() 53 writel_relaxed(val, hrng->base + RNG_CTRL); in hisi_rng_init() [all …]
|
/openbmc/qemu/util/ |
H A D | guest-random.c | 2 * QEMU guest-visible random functions 15 #include "qemu/guest-random.h" 17 #include "exec/replay-core.h" 31 /* Thread not initialized for a cpu, or main w/o -seed. */ in glib_random_bytes() 41 __builtin_memcpy(buf + i, &x, len - i); in glib_random_bytes() 56 /* Non-deterministic implementation using crypto routines. */ in qemu_guest_getrandom() 80 void qemu_guest_random_seed_thread_part2(uint64_t seed) in qemu_guest_random_seed_thread_part2() argument 85 g_rand_new_with_seed_array((const guint32 *)&seed, in qemu_guest_random_seed_thread_part2() 86 sizeof(seed) / sizeof(guint32)); in qemu_guest_random_seed_thread_part2() 92 uint64_t seed; in qemu_guest_random_seed_main() local [all …]
|
/openbmc/openbmc/poky/meta/recipes-core/initscripts/initscripts-1.0/ |
H A D | urandom | 3 # SPDX-License-Identifier: GPL-2.0-only 8 # Required-Start: $local_fs mountvirtfs 9 # Required-Stop: $local_fs 10 # Default-Start: S 11 # Default-Stop: 0 6 12 # Short-Description: Save and restore the random seed 13 # Description: Save the random seed on shutdown and restore it on boot, 14 # to ensure that the seed isn't predicable on startup 18 test -c /dev/urandom || exit 0 20 RANDOM_SEED_FILE=/var/lib/urandom/random-seed [all …]
|
/openbmc/linux/drivers/crypto/allwinner/sun4i-ss/ |
H A D | sun4i-ss-prng.c | 1 // SPDX-License-Identifier: GPL-2.0-or-later 2 #include "sun4i-ss.h" 4 int sun4i_ss_prng_seed(struct crypto_rng *tfm, const u8 *seed, in sun4i_ss_prng_seed() argument 11 memcpy(algt->ss->seed, seed, slen); in sun4i_ss_prng_seed() 30 ss = algt->ss; in sun4i_ss_prng_generate() 32 err = pm_runtime_resume_and_get(ss->dev); in sun4i_ss_prng_generate() 37 algt->stat_req++; in sun4i_ss_prng_generate() 38 algt->stat_bytes += todo; in sun4i_ss_prng_generate() 41 spin_lock_bh(&ss->slock); in sun4i_ss_prng_generate() 43 writel(mode, ss->base + SS_CTL); in sun4i_ss_prng_generate() [all …]
|
/openbmc/qemu/tests/image-fuzzer/ |
H A D | runner.py | 40 "'--config' and '--command' options are not supported.", file=sys.stderr) 96 return -term_signal 117 The test log will include application (e.g. 'qemu-img') logs besides info 121 def __init__(self, test_id, seed, work_dir, run_log, argument 125 Path to qemu-img and qemu-io will be retrieved from 'QEMU_IMG' and 128 if seed is not None: 129 self.seed = seed 131 self.seed = str(random.randint(0, sys.maxsize)) 132 random.seed(self.seed) 136 self.current_dir = os.path.join(work_dir, 'test-' + test_id) [all …]
|
/openbmc/linux/kernel/trace/ |
H A D | trace_benchmark.c | 1 // SPDX-License-Identifier: GPL-2.0 43 u64 seed; in trace_do_benchmark() local 60 delta = stop - start; in trace_do_benchmark() 99 * s^2 = 1 / (n * (n-1)) * (n * \Sum (x_i)^2 - (\Sum x_i)^2) in trace_do_benchmark() 101 stddev = (u64)bm_cnt * bm_totalsq - bm_total * bm_total; in trace_do_benchmark() 103 do_div(stddev, (u32)bm_cnt - 1); in trace_do_benchmark() 116 * as our seed to find the std. in trace_do_benchmark() 124 seed = avg; in trace_do_benchmark() 126 last_seed = seed; in trace_do_benchmark() 127 seed = stddev; in trace_do_benchmark() [all …]
|
/openbmc/linux/arch/arm64/kernel/pi/ |
H A D | kaslr_early.c | 1 // SPDX-License-Identifier: GPL-2.0-only 28 l1--; in __strstr() 40 return str == cmdline || (str > cmdline && *(str - 1) == ' '); in cmdline_contains_nokaslr() 79 prop = fdt_getprop_w(fdt, node, "kaslr-seed", &len); in get_kaslr_seed() 90 u64 seed; in kaslr_early_init() local 95 seed = get_kaslr_seed(fdt); in kaslr_early_init() 96 if (!seed) { in kaslr_early_init() 98 !__arm64_rndr((unsigned long *)&seed)) in kaslr_early_init() 104 * kernel image offset from the seed. Let's place the kernel in the in kaslr_early_init() 105 * middle half of the VMALLOC area (VA_BITS_MIN - 2), and stay clear of in kaslr_early_init() [all …]
|
/openbmc/qemu/include/qemu/ |
H A D | guest-random.h | 2 * QEMU guest-visible random functions 17 * @seedstr: a non-NULL pointer to a C string 20 * The @seedstr value is that which accompanies the -seed argument. 31 * independent seed for the new thread. Otherwise returns 0. 36 * qemu_guest_random_seed_thread_part2(uint64_t seed) 37 * @seed: a value for the new thread. 40 * independent seed for the new thread. Otherwise a no-op. 42 void qemu_guest_random_seed_thread_part2(uint64_t seed); 51 * for data presented to the guest. Host-side crypto services should
|
/openbmc/linux/arch/powerpc/mm/nohash/ |
H A D | kaslr_booke.c | 1 // SPDX-License-Identifier: GPL-2.0-only 53 hash = (hash << ((sizeof(hash) * 8) - 7)) | (hash >> 7); in rotate_xor() 68 /* build-specific string for starting entropy. */ in get_boot_seed() 85 prop = fdt_getprop_w(fdt, node, "kaslr-seed", &len); in get_kaslr_seed() 116 /* check for overlap with static reservations in /reserved-memory */ in overlaps_reserved_region() 132 len -= 4 * regions.reserved_mem_addr_cells; in overlaps_reserved_region() 139 len -= 4 * regions.reserved_mem_size_cells; in overlaps_reserved_region() 204 prop = fdt_getprop(fdt, node, "linux,initrd-start", &len); in get_initrd_range() 209 prop = fdt_getprop(fdt, node, "linux,initrd-end", &len); in get_initrd_range() 227 for (pa = offset; (long)pa > (long)start; pa -= SZ_16K) { in get_usable_address() [all …]
|
/openbmc/linux/drivers/firmware/efi/ |
H A D | efi.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * efi.c - EFI subsystem 101 return -EINVAL; in parse_efi_cmdline() 134 return -EINVAL; in systab_show() 153 return str - buf; in systab_show() 182 return attr->mode; in efi_attr_is_visible() 266 return -ENOMEM; in efivar_ssdt_load() 282 return -ENOMEM; in efivar_ssdt_load() 289 ucs2_as_utf8(utf8_name, name, limit - 1); in efivar_ssdt_load() 293 pr_info("loading SSDT from variable %s-%pUl\n", efivar_ssdt, &guid); in efivar_ssdt_load() [all …]
|
/openbmc/linux/block/ |
H A D | t10-pi.c | 1 // SPDX-License-Identifier: GPL-2.0 3 * t10_pi.c - Functions for generating and verifying T10 Protection 7 #include <linux/t10-pi.h> 8 #include <linux/blk-integrity.h> 9 #include <linux/crc-t10dif.h> 37 for (i = 0 ; i < iter->data_size ; i += iter->interval) { in t10_pi_generate() 38 struct t10_pi_tuple *pi = iter->prot_buf; in t10_pi_generate() 40 pi->guard_tag = fn(iter->data_buf, iter->interval); in t10_pi_generate() 41 pi->app_tag = 0; in t10_pi_generate() 44 pi->ref_tag = cpu_to_be32(lower_32_bits(iter->seed)); in t10_pi_generate() [all …]
|