FreeBSD/sys/dev/random/nehemiah.c
/* It is specifically allowed that buf is a multiple of sizeof(long) */
It is specifically allowed that buf is a multiple of sizeof(long)
It is specifically allowed that buf is a multiple of sizeof ( long )
static u_int
random_nehemiah_read(void *buf, u_int c)
{
	uint8_t *b;
	size_t count, ret;
	uint64_t tmp;
	if ((fpu_kern_enter(curthread, fpu_ctx_save, FPU_KERN_NORMAL) == 0)) {
		b = buf;
		for (count = c; count > 0; count -= ret) {
			ret = MIN(VIA_RNG_store(&tmp), count);
			memcpy(b, &tmp, ret);
			b += ret;
		}
		fpu_kern_leave(curthread, fpu_ctx_save);
	}
	else
		c = 0;
	return (c);
}
static u_int random_nehemiah_read ( void * buf , u_int c ) { uint8_t * b ; size_t count , ret ; uint64_t tmp ; if ( ( fpu_kern_enter ( curthread , fpu_ctx_save , FPU_KERN_NORMAL ) == 0 ) ) { b = buf ; for ( count = c ; count > 0 ; count -= ret ) { ret = MIN ( VIA_RNG_store ( & tmp ) , count ) ; memcpy ( b , & tmp , ret ) ; b += ret ; } fpu_kern_leave ( curthread , fpu_ctx_save ) ; } else c = 0 ; return ( c ) ; }
It is specifically allowed that buf is a multiple of sizeof(long)
It is specifically allowed that buf is a multiple of sizeof ( long )