From 6c785628a1babe3a5415f32b88d323ac2070c486 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 2 Jun 2020 20:45:44 -0500 Subject: [PATCH] Use central variable to define system PKCS library location Signed-off-by: Timothy Pearson --- usr/bin/cryptosmartcard.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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