Lines Matching refs:rngp
446 static uint16_t rng_pool_get(struct rng_pool *rngp, uint8_t *buf, in rng_pool_get() argument
449 uint32_t last = rngp->last; in rng_pool_get()
450 uint32_t mask = rngp->mask; in rng_pool_get()
457 first = rngp->first_alloc; in rng_pool_get()
464 other_read_in_progress = (rngp->first_read ^ first); in rng_pool_get()
475 rngp->first_alloc = (first + len) & mask; in rng_pool_get()
479 *dst++ = rngp->buffer[first]; in rng_pool_get()
490 rngp->first_read = rngp->first_alloc; in rng_pool_get()
496 if (available <= rngp->threshold) { in rng_pool_get()
512 static int rng_pool_put(struct rng_pool *rngp, uint8_t byte) in rng_pool_put() argument
514 uint8_t first = rngp->first_read; in rng_pool_put()
515 uint8_t last = rngp->last; in rng_pool_put()
516 uint8_t mask = rngp->mask; in rng_pool_put()
523 rngp->buffer[last] = byte; in rng_pool_put()
524 rngp->last = (last + 1) & mask; in rng_pool_put()
529 static void rng_pool_init(struct rng_pool *rngp, uint16_t size, in rng_pool_init() argument
532 rngp->first_alloc = 0U; in rng_pool_init()
533 rngp->first_read = 0U; in rng_pool_init()
534 rngp->last = 0U; in rng_pool_init()
535 rngp->mask = size - 1; in rng_pool_init()
536 rngp->threshold = threshold; in rng_pool_init()