mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-24 08:45:13 +00:00
parent
3a064aba56
commit
c973040bad
2 changed files with 21 additions and 8 deletions
1
CHANGES
1
CHANGES
|
@ -13,6 +13,7 @@ Version 0.9
|
||||||
- Improved error handling / reporting. (#12)
|
- Improved error handling / reporting. (#12)
|
||||||
- Use fcntl() instead of flock() when locking repository/cache. (#15)
|
- Use fcntl() instead of flock() when locking repository/cache. (#15)
|
||||||
- Let ssh figure out port/user if not specified so we don't override .ssh/config (#9)
|
- Let ssh figure out port/user if not specified so we don't override .ssh/config (#9)
|
||||||
|
- Improved libcrypto path detection (#23).
|
||||||
|
|
||||||
Version 0.8.1
|
Version 0.8.1
|
||||||
-------------
|
-------------
|
||||||
|
|
|
@ -1,17 +1,29 @@
|
||||||
"""A thin ctypes based wrapper for OpenSSL 1.0
|
"""A thin ctypes based wrapper for OpenSSL 1.0
|
||||||
"""
|
"""
|
||||||
import sys
|
import os
|
||||||
from ctypes import cdll, c_char_p, c_int, c_uint, c_void_p, POINTER, create_string_buffer
|
from ctypes import cdll, c_char_p, c_int, c_uint, c_void_p, POINTER, create_string_buffer
|
||||||
from ctypes.util import find_library
|
from ctypes.util import find_library
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
libcrypto = cdll.LoadLibrary(find_library('crypto'))
|
|
||||||
# Default libcrypto on OS X is too old, try the brew version
|
def _find_libcrypto():
|
||||||
if not hasattr(libcrypto, 'PKCS5_PBKDF2_HMAC') and sys.platform == 'darwin':
|
_possible_paths = [
|
||||||
libcrypto = cdll.LoadLibrary('/usr/local/opt/openssl/lib/libcrypto.dylib')
|
find_library('crypto'),
|
||||||
# Default libcrypto on FreeBSD is too old, try the ports version
|
os.environ.get('ATTIC_LIBCRYPTO_PATH'),
|
||||||
if not hasattr(libcrypto, 'PKCS5_PBKDF2_HMAC') and sys.platform.startswith('freebsd'):
|
'/usr/local/opt/openssl/lib/libcrypto.dylib', # OS X Brew
|
||||||
libcrypto = cdll.LoadLibrary('/usr/local/lib/libcrypto.so')
|
'/usr/local/lib/libcrypto.so', # FreeBSD Ports
|
||||||
|
'/usr/local/ssl/lib/libcrypto.so'
|
||||||
|
]
|
||||||
|
for path in _possible_paths:
|
||||||
|
try:
|
||||||
|
lib = cdll.LoadLibrary(path)
|
||||||
|
if hasattr(lib, 'PKCS5_PBKDF2_HMAC'):
|
||||||
|
return lib
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
raise Exception('Failed to find libcrypto version >= 1.0')
|
||||||
|
|
||||||
|
libcrypto = _find_libcrypto()
|
||||||
|
|
||||||
libcrypto.PKCS5_PBKDF2_HMAC.argtypes = (c_char_p, c_int, c_char_p, c_int, c_int, c_void_p, c_int, c_char_p)
|
libcrypto.PKCS5_PBKDF2_HMAC.argtypes = (c_char_p, c_int, c_char_p, c_int, c_int, c_void_p, c_int, c_char_p)
|
||||||
libcrypto.EVP_sha256.restype = c_void_p
|
libcrypto.EVP_sha256.restype = c_void_p
|
||||||
|
|
Loading…
Reference in a new issue