wbond / package_control

The Sublime Text package manager
https://packagecontrol.io
4.78k stars 814 forks source link

Function 'BCryptDeriveKeyPBKDF2' not found. #1556

Closed casper closed 1 year ago

casper commented 3 years ago

Sublime Text 3 on Windows Vista 32-bit. Package Control fails to load with below error.

Is there some way to fix this problem? It used to work fine before, but not any more.

...
reloading plugin Package Control.1_reloader
reloading plugin Package Control.2_bootstrap
Traceback (most recent call last):
  File "C:\Users\Casper\AppData\Roaming\Sublime Text 3\Installed Packages\Package Control.sublime-package\package_control/deps/oscrypto/_win/_cng_ctypes.py", line 143, in <module>
  File "./python3.3/ctypes/__init__.py", line 366, in __getattr__
  File "./python3.3/ctypes/__init__.py", line 371, in __getitem__
AttributeError: function 'BCryptDeriveKeyPBKDF2' not found
...
casper commented 3 years ago

The problem seems to be here: https://github.com/wbond/package_control/blob/8b947d227bfee2b514283e650c3f88c954ae1026/package_control/deps/oscrypto/__init__.py#L49

Windows Vista SP2 does not include BCryptDeriveKeyPBKDF2, unless manually patched with Windows Server 2008 SP2, which most distributions will not have installed.

Therefore on Vista it seems the backend should be changed to winlegacy and not win.

casper commented 3 years ago

Confirmed. This change fixes the issue:

       if sys.platform == 'win32':
            # Windows XP was major version 5, Vista was 6
            if sys.getwindowsversion()[0] <= 6:         # <- FIXED!!
               _module_values['backend'] = 'winlegacy'
deathaxe commented 1 year ago

Should be addressed upstream at https://github.com/wbond/oscrypto