mirror of
https://github.com/seemoo-lab/opendrop.git
synced 2026-09-14 15:16:11 -04:00
Automatically look for non-standard library paths on macOS
Also fixes #19 `abort` error on macOS 10.15 when trying to load default openssl library
This commit is contained in:
@@ -17,22 +17,16 @@ To achieve compatibility with Apple AirDrop, OpenDrop requires the target platfo
|
||||
In addition, it requires Python >=3.6 as well as several libraries.
|
||||
|
||||
**Apple Wireless Direct Link.**
|
||||
As AirDrop exclusively runs over Apple Wireless Direct Link (AWDL), OpenDrop is only supported on macOS or on Linux systems running
|
||||
an open re-implementation of AWDL such as [OWL](https://github.com/seemoo-lab/owl).
|
||||
As AirDrop exclusively runs over Apple Wireless Direct Link (AWDL), OpenDrop is only supported on macOS or on Linux systems running an open re-implementation of AWDL such as [OWL](https://github.com/seemoo-lab/owl).
|
||||
|
||||
**Libraries.**
|
||||
OpenDrop relies on current versions of [OpenSSL](https://www.openssl.org) and [libarchive](https://www.libarchive.org).
|
||||
macOS ships with rather old versions of the two, so you will need to install newer version, for example, via [Homebrew](https://brew.sh).
|
||||
In any case, you will need to set the two environmental variables `LIBARCHIVE` and `LIBCRYPTO` accordingly.
|
||||
For example, use `brew` to install the libraries:
|
||||
macOS ships with rather old versions of the two, so you will need to install newer version, for example, via [Homebrew](https://brew.sh):
|
||||
```bash
|
||||
brew install libarchive openssl@1.1
|
||||
```
|
||||
Then set environmental variables:
|
||||
```bash
|
||||
export LIBARCHIVE=/usr/local/opt/libarchive/lib/libarchive.dylib
|
||||
export LIBCRYPTO=/usr/local/opt/openssl@1.1/lib/libcrypto.dylib
|
||||
brew install libarchive openssl
|
||||
```
|
||||
OpenDrop automatically sets `DYLD_LIBRARY_PATH` to look for the Homebrew versions. You may need to update the variable yourself if you install the libraries differently.
|
||||
|
||||
Linux distributions should ship with more up-to-date versions, so this won't be necessary.
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import platform
|
||||
import os
|
||||
|
||||
__version__ = '0.10.2'
|
||||
|
||||
if platform.system() == 'Darwin':
|
||||
dyld_path = os.environ.get('DYLD_LIBRARY_PATH', '') # save old path
|
||||
openssl_path = '/usr/local/opt/openssl/lib'
|
||||
archive_path = '/usr/local/opt/libarchive/lib'
|
||||
os.environ['DYLD_LIBRARY_PATH'] = '{}:{}:{}'.format(dyld_path, openssl_path, archive_path)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -22,7 +22,6 @@ import datetime
|
||||
import io
|
||||
import ipaddress
|
||||
import os
|
||||
import platform
|
||||
import plistlib
|
||||
import hashlib
|
||||
import ifaddr
|
||||
@@ -40,18 +39,6 @@ from libarchive.ffi import (
|
||||
write_finish_entry,
|
||||
)
|
||||
from libarchive.write import ArchiveWrite, new_archive_read_disk
|
||||
if platform.system() == 'Darwin' and os.getenv('LIBCRYPTO') is not None:
|
||||
import ctypescrypto
|
||||
from ctypes import CDLL, c_uint64, c_void_p
|
||||
ctypescrypto.__libname__ = os.environ['LIBCRYPTO']
|
||||
ctypescrypto.libcrypto = CDLL(ctypescrypto.__libname__)
|
||||
if hasattr(ctypescrypto.libcrypto,'OPENSSL_init_crypto'):
|
||||
ctypescrypto.libcrypto.OPENSSL_init_crypto.argtypes = (c_uint64,c_void_p)
|
||||
ctypescrypto.libcrypto.OPENSSL_init_crypto(2+4+8+0x40,None)
|
||||
strings_loaded = True
|
||||
else:
|
||||
ctypescrypto.libcrypto.OPENSSL_add_all_algorithms_conf()
|
||||
strings_loaded = False
|
||||
from ctypescrypto import cms, x509, pkey, oid
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user