mirror of
https://github.com/noDRM/DeDRM_tools.git
synced 2025-10-23 23:07:47 -04:00
Add a fallback method for finding libcrypto DLL paths
This commit is contained in:
parent
866d1130b8
commit
55987225bd
1 changed files with 11 additions and 0 deletions
|
|
@ -124,17 +124,28 @@ if iswindows:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import _winreg as winreg
|
import _winreg as winreg
|
||||||
|
|
||||||
|
def _licrypto_dll_path():
|
||||||
|
import sys
|
||||||
|
for p in sys.path:
|
||||||
|
if p.endswith("DLLs"):
|
||||||
|
return os.path.join(p, "libcrypto-1_1.dll")
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
def _load_crypto_libcrypto():
|
def _load_crypto_libcrypto():
|
||||||
from ctypes.util import find_library
|
from ctypes.util import find_library
|
||||||
libcrypto = find_library('libcrypto-1_1')
|
libcrypto = find_library('libcrypto-1_1')
|
||||||
if libcrypto is None:
|
if libcrypto is None:
|
||||||
libcrypto = find_library('libeay32')
|
libcrypto = find_library('libeay32')
|
||||||
|
if libcrypto is None:
|
||||||
|
libcrypto = _licrypto_dll_path()
|
||||||
if libcrypto is None:
|
if libcrypto is None:
|
||||||
raise ADEPTError('libcrypto not found')
|
raise ADEPTError('libcrypto not found')
|
||||||
libcrypto = CDLL(libcrypto)
|
libcrypto = CDLL(libcrypto)
|
||||||
AES_MAXNR = 14
|
AES_MAXNR = 14
|
||||||
c_char_pp = POINTER(c_char_p)
|
c_char_pp = POINTER(c_char_p)
|
||||||
c_int_p = POINTER(c_int)
|
c_int_p = POINTER(c_int)
|
||||||
|
|
||||||
class AES_KEY(Structure):
|
class AES_KEY(Structure):
|
||||||
_fields_ = [('rd_key', c_long * (4 * (AES_MAXNR + 1))),
|
_fields_ = [('rd_key', c_long * (4 * (AES_MAXNR + 1))),
|
||||||
('rounds', c_int)]
|
('rounds', c_int)]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue