Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion archinstall/lib/crypt.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import base64
import ctypes
import os
from ctypes.util import find_library
from pathlib import Path

from cryptography.fernet import Fernet, InvalidToken
from cryptography.hazmat.primitives.kdf.argon2 import Argon2id

from archinstall.lib.log import debug

libcrypt = ctypes.CDLL('libcrypt.so')
libcrypt_name = find_library('crypt') or 'libcrypt.so'
try:
libcrypt = ctypes.CDLL(libcrypt_name)
except OSError as exc:
raise ImportError('Could not load system libcrypt library; make sure libcrypt is installed and accessible.') from exc

libcrypt.crypt.argtypes = [ctypes.c_char_p, ctypes.c_char_p]
libcrypt.crypt.restype = ctypes.c_char_p
Expand Down