Exemple #1
0
/*
 *	Generate some initially weak seeding values to allow
 *	to start the random32() engine.
 */
static int __init random32_init(void)
{

  /* dacashman change */
  struct rnd_state *state_cpy;


	int i;
	
	for_each_possible_cpu(i) {
		struct rnd_state *state = &per_cpu(net_rand_state,i);

#define LCG(x)	((x) * 69069)	/* super-duper LCG */
		state->s1 = __seed(LCG(i + jiffies), 1);
		state->s2 = __seed(LCG(state->s1), 7);
		state->s3 = __seed(LCG(state->s2), 15);

		/* "warm it up" */
		__random32(state);
		__random32(state);
		__random32(state);
		__random32(state);
		__random32(state);
		__random32(state);


		/* dacashman change */
		state_cpy = state;
	}

	/* dacashman change */
	printk(KERN_DEBUG "RANDOM - random32 init called.  Value: %x\t%x\t%x\n", state_cpy->s1, state_cpy->s2, state_cpy->s3);
	return 0;
}
Exemple #2
0
static void __init_rand(struct frand_state *state, unsigned int seed)
{
	int cranks = 6;

#define LCG(x, seed)  ((x) * 69069 ^ (seed))

	state->s1 = __seed(LCG((2^31) + (2^17) + (2^7), seed), 1);
	state->s2 = __seed(LCG(state->s1, seed), 7);
	state->s3 = __seed(LCG(state->s2, seed), 15);

	while (cranks--)
		__rand(state);
}
Exemple #3
0
void init_rand(struct frand_state *state)
{
#define LCG(x)  ((x) * 69069)   /* super-duper LCG */

	state->s1 = __seed(LCG((2^31) + (2^17) + (2^7)), 1);
	state->s2 = __seed(LCG(state->s1), 7);
	state->s3 = __seed(LCG(state->s2), 15);

	__rand(state);
	__rand(state);
	__rand(state);
	__rand(state);
	__rand(state);
	__rand(state);
}
Exemple #4
0
Fichier : rand.c Projet : chjs/fio
static void __init_rand64(struct taus258_state *state, uint64_t seed)
{
    int cranks = 6;

#define LCG64(x, seed)  ((x) * 6906969069ULL ^ (seed))

    state->s1 = __seed(LCG64((2^31) + (2^17) + (2^7), seed), 1);
    state->s2 = __seed(LCG64(state->s1, seed), 7);
    state->s3 = __seed(LCG64(state->s2, seed), 15);
    state->s4 = __seed(LCG64(state->s3, seed), 33);
    state->s5 = __seed(LCG64(state->s4, seed), 49);

    while (cranks--)
        __rand64(state);
}
void srandom32(u32 entropy)
{
	int i;
	for_each_possible_cpu (i) {
		struct rnd_state *state = &per_cpu(net_rand_state, i);
		state->s1 = __seed(state->s1 ^ entropy, 1);
	}
}
static int __init random32_reseed(void)
{
	int i;

	for_each_possible_cpu(i) {
		struct rnd_state *state = &per_cpu(net_rand_state,i);
		u32 seeds[3];

		get_random_bytes(&seeds, sizeof(seeds));
		state->s1 = __seed(seeds[0], 1);
		state->s2 = __seed(seeds[1], 7);
		state->s3 = __seed(seeds[2], 15);

		
		prandom32(state);
	}
	return 0;
}
Exemple #7
0
/**
 *	srandom32 - add entropy to pseudo random number generator
 *	@seed: seed value
 *
 *	Add some additional seeding to the random32() pool.
 */
void srandom32(u32 entropy)
{
	int i;
	/*
	 * No locking on the CPUs, but then somewhat random results are, well,
	 * expected.
	 */
	for_each_possible_cpu (i) {
		struct rnd_state *state = &per_cpu(net_rand_state, i);
		state->s1 = __seed(state->s1 ^ entropy, 1);
	}
}
static int __init random32_init(void)
{
	int i;

	for_each_possible_cpu(i) {
		struct rnd_state *state = &per_cpu(net_rand_state,i);

#define LCG(x)	((x) * 69069)	
		state->s1 = __seed(LCG(i + jiffies), 1);
		state->s2 = __seed(LCG(state->s1), 7);
		state->s3 = __seed(LCG(state->s2), 15);

		
		prandom32(state);
		prandom32(state);
		prandom32(state);
		prandom32(state);
		prandom32(state);
		prandom32(state);
	}
	return 0;
}
Exemple #9
0
/*
 *	Generate better values after random number generator
 *	is fully initalized.
 */
static int __init random32_reseed(void)
{
	int i;

	for_each_possible_cpu(i) {
		struct rnd_state *state = &per_cpu(net_rand_state,i);
		u32 seeds[3];

		get_random_bytes(&seeds, sizeof(seeds));
		state->s1 = __seed(seeds[0], 1);
		state->s2 = __seed(seeds[1], 7);
		state->s3 = __seed(seeds[2], 15);

		/* mix it in */
		__random32(state);
		/* dacashman change */
	printk(KERN_DEBUG "RANDOM - random32_reseed called.  Value: %x\t%x\t%x\n", state->s1, state->s2, state->s3);
	state_change_num = 0;

	}
	return 0;
}
Exemple #10
0
/*
 *	Generate some initially weak seeding values to allow
 *	to start the random32() engine.
 */
static int __init random32_init(void)
{
	int i;

	for_each_possible_cpu(i) {
		struct rnd_state *state = &per_cpu(net_rand_state,i);

#define LCG(x)	((x) * 69069)	/* super-duper LCG */
		state->s1 = __seed(LCG(i + jiffies), 2);
		state->s2 = __seed(LCG(state->s1), 8);
		state->s3 = __seed(LCG(state->s2), 16);

		/* "warm it up" */
		prandom32(state);
		prandom32(state);
		prandom32(state);
		prandom32(state);
		prandom32(state);
		prandom32(state);
	}
	return 0;
}
Exemple #11
0
/**
 *	srandom32 - add entropy to pseudo random number generator
 *	@seed: seed value
 *
 *	Add some additional seeding to the random32() pool.
 */
void srandom32(u32 entropy)
{

  /* dacashman change */
  struct rnd_state *state_cpy;


	int i;
	/*
	 * No locking on the CPUs, but then somewhat random results are, well,
	 * expected.
	 */
	for_each_possible_cpu (i) {
		struct rnd_state *state = &per_cpu(net_rand_state, i);
		state->s1 = __seed(state->s1 ^ entropy, 1);
		state_cpy = state;
	}

	/* dacashman change */
	printk(KERN_DEBUG "RANDOM - srandom32 called with seed %d. Change num %d Value: %x\t%x\t%x\n", entropy,++state_change_num, state_cpy->s1, state_cpy->s2, state_cpy->s3);
	dump_stack();
}