crypto_uint4 alt_arc4random(void) { crypto_uint4 val; _alt_arc4_LOCK(); alt_arc4_count -= 4; alt_arc4_stir_if_needed(); val = alt_arc4_getword(); _alt_arc4_UNLOCK(); return val; }
unsigned int alt_arc4random(void) { unsigned int val; _alt_arc4_LOCK(); alt_arc4_count -= 4; alt_arc4_stir_if_needed(); val = alt_arc4_getword(); _alt_arc4_UNLOCK(); return (unsigned int) val; }
void alt_arc4random_buf(void *_buf, size_t n) { unsigned char *buf = (unsigned char *)_buf; _alt_arc4_LOCK(); alt_arc4_stir_if_needed(); while (n--) { if (--alt_arc4_count <= 0) { alt_arc4_stir(); } buf[n] = alt_arc4_getbyte(); } _alt_arc4_UNLOCK(); }