Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elim unused param and use getrandom API. #48

Closed
wants to merge 1 commit into from

Conversation

mariaschopp
Copy link

The function randombytes_init included an unused parameter which has been removed.
In 2017, glibc added an API call for getrandom. This update checks the glibc version and uses the getrandom API call if available instead of making a syscall.

Copy link

@thomwiggers thomwiggers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aiui these files (except randombytes.c) were supplied by NIST as part of the framework for PQC submissions. Fixing these problems isn't very helpful as they're only used for generation of the KATs...

void randombytes(uint8_t *out, size_t outlen) {
ssize_t ret;

while(outlen > 0) {
ret = syscall(SYS_getrandom, out, outlen, 0);
ret = getrandom (out, outlen, 0);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't using syscall by accident; it allows for use of getrandom on e.g. older versions of Ubuntu where getrandom() isn't available but the syscall does work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants