now works on OpenWRT
This commit is contained in:
parent
363965c364
commit
4598e09b78
2 changed files with 10 additions and 0 deletions
|
@ -42,11 +42,16 @@ def load_libsodium():
|
||||||
global loaded, libsodium, buf
|
global loaded, libsodium, buf
|
||||||
|
|
||||||
from ctypes.util import find_library
|
from ctypes.util import find_library
|
||||||
|
libsodium_path = None
|
||||||
for p in ('sodium', 'libsodium'):
|
for p in ('sodium', 'libsodium'):
|
||||||
libsodium_path = find_library(p)
|
libsodium_path = find_library(p)
|
||||||
if libsodium_path:
|
if libsodium_path:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
import glob
|
||||||
|
for libsodium_path in glob.glob('/usr/lib/libsodium.*'):
|
||||||
|
pass
|
||||||
|
if libsodium_path is None:
|
||||||
raise Exception('libsodium not found')
|
raise Exception('libsodium not found')
|
||||||
logging.info('loading libsodium from %s', libsodium_path)
|
logging.info('loading libsodium from %s', libsodium_path)
|
||||||
libsodium = CDLL(libsodium_path)
|
libsodium = CDLL(libsodium_path)
|
||||||
|
|
|
@ -39,11 +39,16 @@ def load_openssl():
|
||||||
global loaded, libcrypto, buf
|
global loaded, libcrypto, buf
|
||||||
|
|
||||||
from ctypes.util import find_library
|
from ctypes.util import find_library
|
||||||
|
libcrypto_path = None
|
||||||
for p in ('crypto', 'eay32', 'libeay32'):
|
for p in ('crypto', 'eay32', 'libeay32'):
|
||||||
libcrypto_path = find_library(p)
|
libcrypto_path = find_library(p)
|
||||||
if libcrypto_path:
|
if libcrypto_path:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
import glob
|
||||||
|
for libcrypto_path in glob.glob('/usr/lib/libcrypto.*'):
|
||||||
|
pass
|
||||||
|
if libcrypto_path is None:
|
||||||
raise Exception('libcrypto(OpenSSL) not found')
|
raise Exception('libcrypto(OpenSSL) not found')
|
||||||
logging.info('loading libcrypto from %s', libcrypto_path)
|
logging.info('loading libcrypto from %s', libcrypto_path)
|
||||||
libcrypto = CDLL(libcrypto_path)
|
libcrypto = CDLL(libcrypto_path)
|
||||||
|
|
Loading…
Add table
Reference in a new issue