[Pypy3] _ssl: NameError: name 'RAND_egd' is not defined

Issue #2500 resolved
created an issue

Last time I translated about a month ago it used to work. March 17th on the 3.5 release brach tip I get:

Python 3.5.3 (74c8ff71e7aee0649d087acfc14072e7c29e9623, Mar 17 2017, 02:13:06)
[PyPy 5.8.0-alpha0 with GCC 6.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``forward compatibility with
optimizations that haven't been invented yet''
>>>> import _ssl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/portable-pypy/pypy3.5-5.8-alpha-20170317-linux_x86_64-portable/lib_pypy/_ssl/__init__.py", line 11, in <module>
    RAND_egd          = builtinify(RAND_egd)
NameError: name 'RAND_egd' is not defined

PyPy is translated with OpenSSL 1.1:

ldd  pypy3.5-5.8-alpha-20170317-linux_x86_64-portable/lib_pypy/_pypy_openssl.pypy3-58-x86_64-linux-gnu.so
    linux-vdso.so.1 =>  (0x00007ffd057dd000)
    libssl.so.1.1 => /root/portable-pypy/pypy3.5-5.8-alpha-20170317-linux_x86_64-portable/lib_pypy/../lib/libssl.so.1.1 (0x00007fe900fd8000)
    libcrypto.so.1.1 => /root/portable-pypy/pypy3.5-5.8-alpha-20170317-linux_x86_64-portable/lib_pypy/../lib/libcrypto.so.1.1 (0x00007fe900b4f000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe90092e000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe900565000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe900360000)
    /lib64/ld-linux-x86-64.so.2 (0x0000558cc9a57000)

Comments (7)

  1. squeaky reporter


    >>>> from _cffi_ssl._stdssl import *
    >>>> g = globals()
    >>>> for x in g:
    ....     if not x.startswith('RAND_'):
    ....         continue
    ....     print(x)
  2. squeaky reporter

    I was tring to understand man RAND_egd which seems to mention an entropy gathering daemon EGD which might be not installed? How is this queried, during translation or during runtime?

    Going down the rabbit hole I see this in _cffi_ssl._stdssl

    if lib.Cryptography_HAS_EGD:
        def RAND_egd(path):
            bytecount = lib.RAND_egd_bytes(ffi.from_buffer(path), len(path))
            if bytecount == -1:
                raise SSLError("EGD connection failed or EGD did not return "
                               "enough data to seed the PRNG");
            return bytecount
  3. Log in to comment