STINNER Victor added the comment:

> Perhaps the getentropy() check can explicitly rule out Solaris (either at the 
> autoconf level or in the random.c source code) if you prefer to keep the 
> getentropy() call on OpenBSD.

Ok, here is a patch implementing this option. It keeps getentropy() on OpenBSD 
for os.urandom(), but it disables getentropy() on Solaris for os.urandom().

I don't know if my py_getrandom() function calling syscall(SYS_getrandom, 
buffer, size, 0) works on Solaris. The flags are hardcoded, and I don't know if 
the <sys/syscall.h> include is enough to get the syscall() function. (Does 
Solaris uses the GNU C library?)

@jbeck: Can you please test this patch on the default branch of Python? Can you 
tell if the HAVE_GETRANDOM_SYSCALL check succeed on Solaris? (do you have 
"#define HAVE_GETRANDOM_SYSCALL 1" in pyconfig.h?)

The configure scripts tries to compile the following C program:

    #include <sys/syscall.h>

    int main() {
        const int flags = 0;
        char buffer[1];
        int n;
        /* ignore the result, Python checks for ENOSYS at runtime */
        (void)syscall(SYS_getrandom, buffer, sizeof(buffer), flags);
        return 0;
    }

----------
Added file: http://bugs.python.org/file40412/urandom_solaris.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25003>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to