DBG("RANDOM[%s]: Detected changed pid from %u to %u", sr->name, (uint)srs->last_pid, (uint)pid);
srs->last_pid = pid;
if (srs->flags & STRONGRAND_STD_ASSERT_RESET)
- ASSERT(!srs->buf_avail);
+ ASSERT(!srs->buf_avail); // Note: Does not catch all cases of wrong usage (already read multiples of buf_size)
srs->buf_avail = 0;
}
}
}
}
-static struct strongrand *strongrand_std_open_internal(int fd, const char *name, uint buf_size, uint flags)
+static struct strongrand *strongrand_std_open_internal(int fd, const char *name, uint flags, uint buf_size)
{
struct strongrand_std *srs = xmalloc(sizeof(*srs) + buf_size);
bzero(srs, sizeof(*srs));
return &srs->sr;
}
-struct strongrand *strongrand_std_open(uint buf_size, uint flags)
+struct strongrand *strongrand_std_open(uint flags, uint buf_size)
{
const char *name;
if (flags & STRONGRAND_STD_URANDOM)
}
#ifdef CONFIG_UCW_GETRANDOM
if (strongrand_getrandom_detect())
- return strongrand_std_open_internal(STRONGRAND_FD_KERNEL_GETRANDOM, name, buf_size, flags);
+ return strongrand_std_open_internal(STRONGRAND_FD_KERNEL_GETRANDOM, name, flags, buf_size);
#endif
- struct strongrand *sr = strongrand_std_open_internal(STRONGRAND_FD_KERNEL_DEVICE, name, buf_size, flags);
+ struct strongrand *sr = strongrand_std_open_internal(STRONGRAND_FD_KERNEL_DEVICE, name, flags, buf_size);
if (!(flags & STRONGRAND_STD_DELAYED))
strongrand_std_open_device((struct strongrand_std *)sr);
return sr;