Lines Matching refs:rngp
120 static uint16_t rng_pool_get(struct rng_pool *rngp, uint8_t *buf, uint16_t len) in rng_pool_get() argument
122 uint32_t last = rngp->last; in rng_pool_get()
123 uint32_t mask = rngp->mask; in rng_pool_get()
130 first = rngp->first_alloc; in rng_pool_get()
137 other_read_in_progress = (rngp->first_read ^ first); in rng_pool_get()
148 rngp->first_alloc = (first + len) & mask; in rng_pool_get()
152 *dst++ = rngp->buffer[first]; in rng_pool_get()
163 rngp->first_read = rngp->first_alloc; in rng_pool_get()
169 if (available <= rngp->threshold) { in rng_pool_get()
176 static int rng_pool_put(struct rng_pool *rngp, uint8_t byte) in rng_pool_put() argument
178 uint8_t first = rngp->first_read; in rng_pool_put()
179 uint8_t last = rngp->last; in rng_pool_put()
180 uint8_t mask = rngp->mask; in rng_pool_put()
187 rngp->buffer[last] = byte; in rng_pool_put()
188 rngp->last = (last + 1) & mask; in rng_pool_put()
193 static void rng_pool_init(struct rng_pool *rngp, uint16_t size, uint8_t threshold) in rng_pool_init() argument
195 rngp->first_alloc = 0U; in rng_pool_init()
196 rngp->first_read = 0U; in rng_pool_init()
197 rngp->last = 0U; in rng_pool_init()
198 rngp->mask = size - 1; in rng_pool_init()
199 rngp->threshold = threshold; in rng_pool_init()