/linux/drivers/firmware/efi/libstub/ |
H A D | random.c | 70 struct linux_efi_random_seed *prev_seed, *seed = NULL; in efi_random_get_seed() local 106 struct_size(seed, bits, seed_size), in efi_random_get_seed() 107 (void **)&seed); in efi_random_get_seed() 115 EFI_RANDOM_SEED_SIZE, seed->bits); in efi_random_get_seed() 123 EFI_RANDOM_SEED_SIZE, seed->bits); in efi_random_get_seed() 131 &nv_seed_size, seed->bits + offset); in efi_random_get_seed() 148 memzero_explicit(seed->bits + offset, nv_seed_size); in efi_random_get_seed() 155 memcpy(seed->bits + offset, prev_seed->bits, prev_seed_size); in efi_random_get_seed() 159 seed->size = offset; in efi_random_get_seed() 160 status = efi_bs_call(install_configuration_table, &rng_table_guid, seed); in efi_random_get_seed() [all …]
|
H A D | zboot.c | 101 u32 seed = U32_MAX; in efi_zboot_entry() local 106 seed = 0; in efi_zboot_entry() 110 status = efi_get_random_bytes(sizeof(seed), (u8 *)&seed); in efi_zboot_entry() 122 seed, EFI_LOADER_CODE, 0, EFI_ALLOC_LIMIT); in efi_zboot_entry()
|
/linux/drivers/crypto/allwinner/sun8i-ss/ |
H A D | sun8i-ss-prng.c | 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() 27 ctx->seed = NULL; in sun8i_ss_prng_seed() 29 if (!ctx->seed) in sun8i_ss_prng_seed() 30 ctx->seed = kmalloc(slen, GFP_KERNEL); in sun8i_ss_prng_seed() 31 if (!ctx->seed) in sun8i_ss_prng_seed() 34 memcpy(ctx->seed, seed, slen); in sun8i_ss_prng_seed() 52 kfree_sensitive(ctx->seed); in sun8i_ss_prng_exit() 53 ctx->seed = NULL; in sun8i_ss_prng_exit() [all …]
|
/linux/drivers/crypto/allwinner/sun8i-ce/ |
H A D | sun8i-ce-prng.c | 29 kfree_sensitive(ctx->seed); in sun8i_ce_prng_exit() 30 ctx->seed = NULL; 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() 40 kfree_sensitive(ctx->seed); in sun8i_ce_prng_seed() 42 ctx->seed = NULL; in sun8i_ce_prng_seed() 44 if (!ctx->seed) in sun8i_ce_prng_seed() 45 ctx->seed = kmalloc(slen, GFP_KERNEL | GFP_DMA); in sun8i_ce_prng_seed() 46 if (!ctx->seed) in sun8i_ce_prng_seed() 49 memcpy(ctx->seed, seed, slen); in sun8i_ce_prng_seed() [all …]
|
/linux/lib/ |
H A D | xxhash.c | 94 static uint32_t xxh32_round(uint32_t seed, const uint32_t input) in xxh32_round() argument 96 seed += input * PRIME32_2; in xxh32_round() 97 seed = xxh_rotl32(seed, 13); in xxh32_round() 98 seed *= PRIME32_1; in xxh32_round() 99 return seed; in xxh32_round() 102 uint32_t xxh32(const void *input, const size_t len, const uint32_t seed) in xxh32() argument 110 uint32_t v1 = seed + PRIME32_1 + PRIME32_2; in xxh32() 111 uint32_t v2 = seed + PRIME32_2; in xxh32() 112 uint32_t v3 = seed + 0; in xxh32() 113 uint32_t v4 = seed - PRIME32_1; in xxh32() [all …]
|
H A D | test_hash.c | 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() 46 static void fill_buf(char *buf, size_t len, u32 seed) in fill_buf() argument 51 seed = xorshift(seed); in fill_buf() 52 buf[i] = mod255(seed); in fill_buf()
|
/linux/kernel/trace/ |
H A D | trace_benchmark.c | 43 u64 seed; in trace_do_benchmark() local 123 seed = avg; in trace_do_benchmark() 125 last_seed = seed; in trace_do_benchmark() 126 seed = stddev; in trace_do_benchmark() 129 seed = div64_u64(seed, last_seed); in trace_do_benchmark() 130 seed += last_seed; in trace_do_benchmark() 131 do_div(seed, 2); in trace_do_benchmark() 132 } while (i++ < 10 && last_seed != seed); in trace_do_benchmark() 134 std = seed; in trace_do_benchmark()
|
/linux/scripts/basic/ |
H A D | Makefile | 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
|
/linux/include/linux/ |
H A D | xxhash.h | 95 uint32_t xxh32(const void *input, size_t length, uint32_t seed); 108 uint64_t xxh64(const void *input, size_t length, uint64_t seed); 124 uint64_t seed) in xxhash() argument 127 return xxh64(input, length, seed); in xxhash() 129 return xxh32(input, length, seed); in xxhash() 178 void xxh32_reset(struct xxh32_state *state, uint32_t seed); 212 void xxh64_reset(struct xxh64_state *state, uint64_t seed);
|
/linux/arch/arm64/kernel/pi/ |
H A D | kaslr_early.c | 44 u64 seed, range; in kaslr_early_init() local 49 seed = get_kaslr_seed(fdt, chosen); in kaslr_early_init() 50 if (!seed) { in kaslr_early_init() 52 !__arm64_rndr((unsigned long *)&seed)) in kaslr_early_init() 56 memstart_offset_seed = seed & U16_MAX; in kaslr_early_init() 65 return range / 2 + (((__uint128_t)range * seed) >> 64); in kaslr_early_init()
|
/linux/block/ |
H A D | t10-pi.c | 18 sector_t seed; member 54 pi->ref_tag = cpu_to_be32(lower_32_bits(iter->seed)); in t10_pi_generate() 60 iter->seed++; in t10_pi_generate() 79 lower_32_bits(iter->seed)) { in t10_pi_verify() 83 iter->seed, be32_to_cpu(pi->ref_tag)); in t10_pi_verify() 101 (unsigned long long)iter->seed, in t10_pi_verify() 109 iter->seed++; in t10_pi_verify() 232 put_unaligned_be48(iter->seed, pi->ref_tag); in ext_pi_crc64_generate() 238 iter->seed++; in ext_pi_crc64_generate() 257 u64 ref, seed; in ext_pi_crc64_verify() local [all …]
|
/linux/drivers/firmware/efi/ |
H A D | efi.c | 731 struct linux_efi_random_seed *seed; in efi_config_parse_tables() local 734 seed = early_memremap(efi_rng_seed, sizeof(*seed)); in efi_config_parse_tables() 735 if (seed != NULL) { in efi_config_parse_tables() 736 size = min_t(u32, seed->size, SZ_1K); // sanity check in efi_config_parse_tables() 737 early_memunmap(seed, sizeof(*seed)); in efi_config_parse_tables() 742 seed = early_memremap(efi_rng_seed, in efi_config_parse_tables() 743 sizeof(*seed) + size); in efi_config_parse_tables() 744 if (seed != NULL) { in efi_config_parse_tables() 745 add_bootloader_randomness(seed->bits, size); in efi_config_parse_tables() 746 memzero_explicit(seed->bits, size); in efi_config_parse_tables() [all …]
|
/linux/arch/x86/tools/ |
H A D | insn_sanity.c | 33 static unsigned int seed; /* Random seed */ variable 101 fprintf(fp, " $ %s -s 0x%x,%lu\n", prog, seed, nr_iter); in dump_stream() 113 if (read(fd, &seed, sizeof(seed)) != sizeof(seed)) in init_random_seed() 185 seed = (unsigned int)strtoul(optarg, &tmp, 0); in parse_args() 215 srand(seed); in parse_args() 262 seed); in main()
|
/linux/drivers/crypto/allwinner/sun4i-ss/ |
H A D | sun4i-ss-prng.c | 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() 48 writel(ss->seed[i], ss->base + SS_KEY0 + i * 4); in sun4i_ss_prng_generate() 59 ss->seed[i] = v; in sun4i_ss_prng_generate()
|
/linux/crypto/ |
H A D | xxhash_generic.c | 13 u64 seed; member 25 if (keylen != sizeof(tctx->seed)) in xxhash64_setkey() 27 tctx->seed = get_unaligned_le64(key); in xxhash64_setkey() 36 xxh64_reset(&dctx->xxhstate, tctx->seed); in xxhash64_init() 65 put_unaligned_le64(xxh64(data, length, tctx->seed), out); in xxhash64_digest()
|
H A D | ansi_cprng.c | 365 const u8 *seed, unsigned int slen) in cprng_reset() argument 368 const u8 *key = seed + DEFAULT_BLK_SZ; in cprng_reset() 377 reset_prng_context(prng, key, DEFAULT_PRNG_KSZ, seed, dt); in cprng_reset() 395 const u8 *seed, unsigned int slen) in fips_cprng_reset() argument 398 const u8 *key = seed + DEFAULT_BLK_SZ; in fips_cprng_reset() 407 if (!memcmp(seed, key, DEFAULT_PRNG_KSZ)) in fips_cprng_reset() 410 rc = cprng_reset(tfm, seed, slen); in fips_cprng_reset() 426 .seed = cprng_reset, 440 .seed = fips_cprng_reset,
|
H A D | rng.c | 31 int crypto_rng_reset(struct crypto_rng *tfm, const u8 *seed, unsigned int slen) in crypto_rng_reset() argument 36 if (!seed && slen) { in crypto_rng_reset() 44 seed = buf; in crypto_rng_reset() 47 err = crypto_rng_alg(tfm)->seed(tfm, seed, slen); in crypto_rng_reset()
|
/linux/arch/powerpc/mm/nohash/ |
H A D | kaslr_booke.c | 288 u64 seed; in kaslr_choose_location() local 297 seed = get_tb() << 32; in kaslr_choose_location() 298 seed ^= get_tb(); in kaslr_choose_location() 299 random = rotate_xor(random, &seed, sizeof(seed)); in kaslr_choose_location() 304 seed = get_kaslr_seed(dt_ptr); in kaslr_choose_location() 305 if (seed) in kaslr_choose_location() 306 random = rotate_xor(random, &seed, sizeof(seed)); in kaslr_choose_location()
|
/linux/drivers/base/power/ |
H A D | trace.c | 143 static unsigned int hash_string(unsigned int seed, const char *data, unsigned int mod) in hash_string() argument 147 seed = (seed << 16) + (seed << 6) - seed + c; in hash_string() 149 return seed % mod; in hash_string()
|
/linux/arch/s390/boot/ |
H A D | kaslr.c | 57 unsigned long seed, random; in get_random() local 63 seed = get_tod_clock_fast(); in get_random() 70 (u8 *) &seed, sizeof(seed)); in get_random() 76 *(unsigned long *) prng.parm_block ^= seed; in get_random() 83 random = seed; in get_random()
|
/linux/arch/riscv/kernel/pi/ |
H A D | archrandom_early.c | 21 unsigned long seed = 0; in get_kaslr_seed_zkr() local 26 if (!csr_seed_long(&seed)) in get_kaslr_seed_zkr() 29 return seed; in get_kaslr_seed_zkr()
|
/linux/drivers/crypto/hisilicon/trng/ |
H A D | trng.c | 67 static void hisi_trng_set_seed(struct hisi_trng *trng, const u8 *seed) in hisi_trng_set_seed() argument 73 val = seed[i] << SEED_SHIFT_24; in hisi_trng_set_seed() 74 val |= seed[i + 1UL] << SEED_SHIFT_16; in hisi_trng_set_seed() 75 val |= seed[i + 2UL] << SEED_SHIFT_8; in hisi_trng_set_seed() 76 val |= seed[i + 3UL]; in hisi_trng_set_seed() 83 static int hisi_trng_seed(struct crypto_rng *tfm, const u8 *seed, in hisi_trng_seed() argument 98 hisi_trng_set_seed(trng, seed); in hisi_trng_seed() 216 .seed = hisi_trng_seed,
|
/linux/drivers/char/hw_random/ |
H A D | hisi-rng.c | 38 u32 seed; in hisi_rng_init() local 41 get_random_bytes(&seed, sizeof(seed)); in hisi_rng_init() 43 writel_relaxed(seed, hrng->base + RNG_SEED); in hisi_rng_init()
|
/linux/drivers/mtd/tests/ |
H A D | nandbiterrs.c | 49 static unsigned seed; variable 50 module_param(seed, uint, S_IRUGO); 51 MODULE_PARM_DESC(seed, "Random seed"); 162 if (rbuffer[i] != hash(i+seed)) { in verify_page() 164 i, hash(i+seed), rbuffer[i]); in verify_page() 209 wbuffer[i] = hash(i+seed); in incremental_errors_test() 272 wbuffer[i] = hash(i+seed); in overwrite_test()
|
/linux/fs/nilfs2/ |
H A D | segbuf.c | 176 nilfs_segbuf_fill_in_segsum_crc(struct nilfs_segment_buffer *segbuf, u32 seed) in nilfs_segbuf_fill_in_segsum_crc() argument 188 crc = crc32_le(seed, in nilfs_segbuf_fill_in_segsum_crc() 204 u32 seed) in nilfs_segbuf_fill_in_data_crc() argument 213 crc = crc32_le(seed, in nilfs_segbuf_fill_in_data_crc() 235 u32 seed) in nilfs_segbuf_fill_in_super_root_crc() argument 244 crc = crc32_le(seed, in nilfs_segbuf_fill_in_super_root_crc() 322 void nilfs_add_checksums_on_logs(struct list_head *logs, u32 seed) in nilfs_add_checksums_on_logs() argument 328 nilfs_segbuf_fill_in_super_root_crc(segbuf, seed); in nilfs_add_checksums_on_logs() 329 nilfs_segbuf_fill_in_segsum_crc(segbuf, seed); in nilfs_add_checksums_on_logs() 330 nilfs_segbuf_fill_in_data_crc(segbuf, seed); in nilfs_add_checksums_on_logs()
|