From d4b7e6e7dadff1f92fc16bc53b1d7a3608e19e15 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 19 Sep 2015 19:02:04 -0500 Subject: Fix FTBFS when cryptsetup / pkcs options are disabled This resolves Bug 2530 --- tdecore/tdehw/tdecryptographiccarddevice.cpp | 18 +++++++++++++++--- tdecore/tdehw/tdestoragedevice.cpp | 2 ++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/tdecore/tdehw/tdecryptographiccarddevice.cpp b/tdecore/tdehw/tdecryptographiccarddevice.cpp index 5958e86d7..98706befd 100644 --- a/tdecore/tdehw/tdecryptographiccarddevice.cpp +++ b/tdecore/tdehw/tdecryptographiccarddevice.cpp @@ -300,7 +300,7 @@ static PKCS11H_BOOL pkcs_pin_hook(IN void * const global_data, IN void * const u #endif int CryptoCardDeviceWatcher::initializePkcs() { -#if WITH_PKCS +#if defined(WITH_PKCS) CK_RV rv; printf("Initializing pkcs11-helper\n"); if ((rv = pkcs11h_initialize()) != CKR_OK) { @@ -346,7 +346,7 @@ int CryptoCardDeviceWatcher::initializePkcs() { } int CryptoCardDeviceWatcher::retrieveCardCertificates(TQString readerName) { -#if WITH_PKCS +#if defined(WITH_PKCS) int ret = -1; CK_RV rv; @@ -571,6 +571,7 @@ void TDECryptographicCardDevice::setProvidedPin(TQString pin) { } TQString TDECryptographicCardDevice::autoPIN() { +#if defined(WITH_PKCS) TQString retString = TQString::null; // Use subjAltName field in card certificate to provide the card's PIN, @@ -634,6 +635,9 @@ TQString TDECryptographicCardDevice::autoPIN() { OBJ_cleanup(); return retString; +#else + return TQString::null; +#endif } void TDECryptographicCardDevice::workerRequestedPin(TQString prompt) { @@ -654,7 +658,7 @@ int TDECryptographicCardDevice::decryptDataEncryptedWithCertPublicKey(TQByteArra } int TDECryptographicCardDevice::decryptDataEncryptedWithCertPublicKey(TQValueList &cipherTextList, TQValueList &plainTextList, TQValueList &retcodes, TQString *errstr) { -#if WITH_PKCS +#if defined(WITH_PKCS) int ret = -1; if (!m_watcherObject) { @@ -840,6 +844,7 @@ int TDECryptographicCardDevice::decryptDataEncryptedWithCertPublicKey(TQValueLis } int TDECryptographicCardDevice::createNewSecretRSAKeyFromCertificate(TQByteArray &plaintext, TQByteArray &ciphertext, X509* certificate) { +#if defined(WITH_PKCS) unsigned int i; int retcode = -1; @@ -885,10 +890,17 @@ int TDECryptographicCardDevice::createNewSecretRSAKeyFromCertificate(TQByteArray } return retcode; +#else + return -1; +#endif } TQString TDECryptographicCardDevice::pkcsProviderLibrary() { +#if defined(WITH_PKCS) return OPENSC_PKCS11_PROVIDER_LIBRARY; +#else + return TQString::null; +#endif } #include "tdecryptographiccarddevice.moc" diff --git a/tdecore/tdehw/tdestoragedevice.cpp b/tdecore/tdehw/tdestoragedevice.cpp index d499a3cfd..1f01f59b2 100644 --- a/tdecore/tdehw/tdestoragedevice.cpp +++ b/tdecore/tdehw/tdestoragedevice.cpp @@ -188,7 +188,9 @@ void TDEStorageDevice::cryptSetOperationsUnlockPassword(TQByteArray password) { void TDEStorageDevice::cryptClearOperationsUnlockPassword() { m_cryptDevicePassword.fill(0); m_cryptDevicePassword.resize(0); +#if defined(WITH_CRYPTSETUP) crypt_memory_lock(NULL, 0); +#endif } bool TDEStorageDevice::cryptOperationsUnlockPasswordSet() { -- cgit v1.2.3