函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:lib\random32.c Create Date:2022-07-27 07:16:28
首页 Copyright©Brick

171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/**
 *  prandom_seed - add entropy to pseudo random number generator
 *  @entropy: entropy value
 *
 *  Add some additional entropy to the prandom pool.
 */
void prandom_seed(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, 2U);
        prandom_warmup(state);
    }
}