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

[paid contracting available] SHA256_init not found with bundled Cryptodome #109

Closed
tom-james-watson opened this issue Apr 13, 2021 · 1 comment
Labels
state:triage We're still figuring out how severe this issue is

Comments

@tom-james-watson
Copy link

At $dayjob we are building a python binary that bundles in a bunch of different packages, one of which is https://github.com/snowflakedb/snowflake-connector-python.

We are hitting the following runtime error on macOS:

2021-04-13 10:41:20.903001 (MainThread): Runtime Error
  Database error while listing schemas in database "DEV"
  Database Error
    250003: Failed to execute request: 'AttributeError' object has no attribute 'errno'
2021-04-13 10:41:20.905342 (MainThread): Traceback (most recent call last):
  File "site-packages/snowflake/connector/ocsp_snowflake.py", line 1175, in validate_by_direct_connection
  File "site-packages/snowflake/connector/ocsp_asn1crypto.py", line 301, in process_ocsp_response
  File "site-packages/snowflake/connector/ocsp_asn1crypto.py", line 348, in verify_signature
  File "site-packages/Cryptodome/Hash/SHA256.py", line 158, in new
  File "site-packages/Cryptodome/Hash/SHA256.py", line 73, in __init__
  File "site-packages/cffi/api.py", line 912, in __getattr__
  File "site-packages/cffi/api.py", line 908, in make_accessor
  File "site-packages/cffi/api.py", line 838, in accessor_function
AttributeError: function/symbol 'SHA256_init' not found in library '/var/folders/k4/30b2np490d99bs47gl_w4j180000gn/T/_MEIYPwutn/_SHA256.cpython-36m-darwin.so': dlsym(0x7faa3bbdfcc0
, SHA256_init): symbol not found

This only seems to happen when the binary is built on macOS <= 10.15 (pre-Big Sur).

From my understanding, it looks like the issue is in https://github.com/pyinstaller/pyinstaller-hooks-contrib/blob/master/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-Cryptodome.py, though I'm not too sure on how to debug this and so I could be wrong there.

Reproduction is difficult because I only have access to a Big Sur machine at the moment. We see the above runtime error when we build the binary on CI on macOS 10.13.3. When I build the binary from Big Sur, I don't see this error.

I'm not actually sure whether this is a bug with the hook or not. If there is not an obvious fix then we are open and happy to pay any interested maintainers as a consultant to come in and help us get to the bottom of the issue.

@tom-james-watson tom-james-watson added the state:triage We're still figuring out how severe this issue is label Apr 13, 2021
@tom-james-watson tom-james-watson changed the title SHA256_init not found with bundled Cryptodome [paid contracting available] [paid contracting available] SHA256_init not found with bundled Cryptodome Apr 13, 2021
@rokm
Copy link
Member

rokm commented Apr 13, 2021

This is duplicate of pyinstaller/pyinstaller#5583, and is caused by shared library belonging to built-in extension shadowing the cryptodome's shared library. The issue is specific to PyInstaller-frozen applications on macOS, and should be fixed once we stop collecting built-in extensions to application's root directory - see pyinstaller/pyinstaller#5604 (which requires rebuild of bootloaders).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:triage We're still figuring out how severe this issue is
Projects
None yet
Development

No branches or pull requests

2 participants