diff --git a/usr/bin/cryptosmartcard.sh b/usr/bin/cryptosmartcard.sh index ac8c206..75d9251 100755 --- a/usr/bin/cryptosmartcard.sh +++ b/usr/bin/cryptosmartcard.sh @@ -21,6 +21,9 @@ # # Updated by Timothy Pearson 9/15/2015 # Rewrite to use on-card RSA encryption +# +# Updated by Timothy Pearson 6/02/2020 +# Use central variable for PKCS library location # define counter-intuitive shell logic values (based on /bin/true & /bin/false) TRUE=0 @@ -37,6 +40,9 @@ fi # Find plymouth PLYDIR=/bin/plymouth +# Set system PKCS library path +SYSTEM_PKCS_LIBRARY=/usr/lib/opensc-pkcs11.so + # print message to usplash or stderr # usage: msg "message" [switch] # command: TEXT | STATUS | SUCCESS | FAILURE | CLEAR (see 'man usplash_write' for all commands) @@ -143,14 +149,14 @@ if [ $LUKS_KEY_COUNT -gt 0 ]; then rm -f /tmp/kmsg fi - PIN=$(cardpincheck /usr/lib/opensc-pkcs11.so) + PIN=$(cardpincheck $SYSTEM_PKCS_LIBRARY) RET=$? if [ $RET -eq 0 ]; then # PIN valid msg "SmartCard unlocked" for KEYFILE in ${LUKS_KEY_DIR}/${DISK_UUID}_slot*; do # Try decrypting - echo "$PIN" | cardpincheck /usr/lib/opensc-pkcs11.so $KEYFILE 2> /dev/null + echo "$PIN" | cardpincheck $SYSTEM_PKCS_LIBRARY $KEYFILE 2> /dev/null RET=$? if [ $RET -eq 0 ]; then OPENED=$TRUE