Skip to content

'Error initializing ctypes' when running provisionconfig CLI tool #36

@jbarlow-mcafee

Description

@jbarlow-mcafee

When attempting to run the "provisionconfig" CLI tool on macOS High Sierra, an "Error initializing ctypes" error is displayed and none of the provisioning artifacts - private key, certificates, or configuration - are created. Here a sample output from running this command:

› python -m dxlclient provisionconfig sample myeposerver client
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/.virtualenv/py-2.7.10/lib/python2.7/site-packages/dxlclient/__main__.py", line 9, in <module>
    from dxlclient._cli import cli_run
  File "/.virtualenv/py-2.7.10/lib/python2.7/site-packages/dxlclient/_cli/__init__.py", line 13, in <module>
    from dxlclient._cli._cli_subcommands import \
  File "/.virtualenv/py-2.7.10/lib/python2.7/site-packages/dxlclient/_cli/_cli_subcommands.py", line 18, in <module>
    from dxlclient._cli._crypto import X509Name, validate_cert_pem, \
  File "/.virtualenv/py-2.7.10/lib/python2.7/site-packages/dxlclient/_cli/_crypto.py", line 15, in <module>
    from oscrypto import asymmetric
  File "/.virtualenv/py-2.7.10/lib/python2.7/site-packages/oscrypto/asymmetric.py", line 15, in <module>
    from .kdf import pbkdf2, pbkdf2_iteration_calculator
  File "/.virtualenv/py-2.7.10/lib/python2.7/site-packages/oscrypto/kdf.py", line 9, in <module>
    from .util import rand_bytes
  File "/.virtualenv/py-2.7.10/lib/python2.7/site-packages/oscrypto/util.py", line 10, in <module>
    from ._osx.util import rand_bytes
  File "/.virtualenv/py-2.7.10/lib/python2.7/site-packages/oscrypto/_osx/util.py", line 208, in <module>
    from .._openssl._libcrypto import libcrypto
  File "/virtualenv/py-2.7.10/lib/python2.7/site-packages/oscrypto/_openssl/_libcrypto.py", line 14, in <module>
    from ._libcrypto_ctypes import (
  File "/virtualenv/py-2.7.10/lib/python2.7/site-packages/oscrypto/_openssl/_libcrypto_ctypes.py", line 668, in <module>
    raise FFIEngineError('Error initializing ctypes')
oscrypto._ffi.FFIEngineError: Error initializing ctypes

I saw the error both with Python 2.7.10 and 3.7.0. I was also able to reproduce the issue with two different SSL versions - LibreSSL 2.2.7 (default SSL installed with High Sierra) and a Homebrew-installed OpenSSL 1.0.2p (14 Aug 2018). In each case, I had the latest oscrypto release, 0.19.1, installed.

This was raised as an issue to the oscrypto project, wbond/oscrypto#22. The issue has been fixed but has not been delivered in a new release of the oscrypto library yet.

In each case, I was able to perform the provisionconfig command successfully by performing either (or both) of the following:

  • Run pip install cffi.
  • Run pip uninstall oscrypto, followed by pip install git+https://github.com/wbond/oscrypto@af778bf.

oscrypto version af778bf was the head of the master branch at the time I ran the test.

A separate PR which would include cffi as a formal project dependency, #35, has been proposed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions