[issue33528] os.getentropy support

2018-05-20 Thread David Carlier

Change by David Carlier :


--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33528] os.getentropy support

2018-05-19 Thread Christian Heimes

Christian Heimes  added the comment:

I'm -1 on this feature.

It's both confusing and unnecessary to have this feature in the standard 
library. In general we prefer portable functions or expose platform-specific 
functions for unique features. The getentropy function is neither portable nor 
more useful than the high-level wrapper os.urandom().

If you truly require to access the raw function, then you can easily access the 
libc function with a simple C-types wrapper:

>>> from ctypes import cdll, create_string_buffer
>>> libc = cdll.LoadLibrary("libc.so.6") 
>>> buf = create_string_buffer(8)
>>> buf.raw
b'\x00\x00\x00\x00\x00\x00\x00\x00'
>>> libc.getentropy(buf, len(buf))
0
>>> buf.raw
b'\xd9\x83`\x8a\x89\xc7\x9eX'

--
nosy: +christian.heimes

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33528] os.getentropy support

2018-05-18 Thread David Carlier

David Carlier  added the comment:

Those are valid points honestly. OpenBSD's getentropy works that way indeed 
(getentropy has also been implemented into FreeBSD in the CURRENT branch couple 
of months ago).
So indeed os.urandom provides already a wrapping usage only this one gives the 
responsibility to the caller to handle cases when more than 256 bytes at a time.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33528] os.getentropy support

2018-05-18 Thread STINNER Victor

STINNER Victor  added the comment:

I know two main use cases for random numbers:

* security: use os.urandom(), secrets and random.SystemRandom
* not security: use the random module

Exposing os.getentropy() seems like a new non-portable function for the first 
use case, security. What does it add compared to directly call os.urandom() for 
example?

I chose to expose os.getrandom() for one very specific use case, described in 
the PEP 524: check if os.urandom() is going to block.

On OpenBSD, os.urandom() and getentropy() does never block, so os.getentropy() 
seems useless to me. OpenBSD design is different: the CSRPNG is feeded from the 
boot loader. Or tell me if I missed something.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33528] os.getentropy support

2018-05-16 Thread David Carlier

David Carlier  added the comment:

To have same usage as I would use getentropy under OpenBSD (e.g. 256 bytes max 
at a time) really as a wrapper.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33528] os.getentropy support

2018-05-16 Thread Eitan Adler

Eitan Adler  added the comment:

There are few if any valid reasons to make direct use of the syscall from 
python code. Portable code would have to reimplement most of the logic from 
`getentropy` in any case. 

What you're usecase for the direct syscall?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33528] os.getentropy support

2018-05-16 Thread David Carlier

David Carlier  added the comment:

These are valid point. In fact it was just to have direct access to the 
function like os.getrandom accesses directly the Linux syscall. But if there is 
no enough valid reason I can drop this PR.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33528] os.getentropy support

2018-05-16 Thread Eitan Adler

Change by Eitan Adler :


--
nosy: +eitan.adler

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33528] os.getentropy support

2018-05-16 Thread STINNER Victor

STINNER Victor  added the comment:

"os.getentropy support"

David Carlier: Would you mind to elaborate a little bit? This feature request 
is a little bit short.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33528] os.getentropy support

2018-05-16 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

AFAIK os.urandom is implemented via getentropy() if it is the most preferable 
source of randomness. See Python/bootstrap_hash.c and PEP 524 for details.

--
nosy: +rhettinger, serhiy.storchaka, vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33528] os.getentropy support

2018-05-16 Thread Benjamin Peterson

New submission from Benjamin Peterson :

Why isn't os.urandom sufficient?

--
nosy: +benjamin.peterson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33528] os.getentropy support

2018-05-15 Thread David Carlier

Change by David Carlier :


--
components: Library (Lib)
nosy: David Carlier
priority: normal
pull_requests: 6558
severity: normal
status: open
title: os.getentropy support
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com