Branch: master

d4b7e6e7 2015-09-19 19:02:04 Timothy Pearson
Fix FTBFS when cryptsetup / pkcs options are disabled
This resolves Bug 2530
M tdecore/tdehw/tdecryptographiccarddevice.cpp
M tdecore/tdehw/tdestoragedevice.cpp
diff --git a/tdecore/tdehw/tdecryptographiccarddevice.cpp b/tdecore/tdehw/tdecryptographiccarddevice.cpp
index 5958e86..98706be 100644
--- a/tdecore/tdehw/tdecryptographiccarddevice.cpp
+++ b/tdecore/tdehw/tdecryptographiccarddevice.cpp
@@ -300,7 +300,7 @@
 #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::retrieveCardCertificates(TQString readerName) {
-#if WITH_PKCS
+#if defined(WITH_PKCS)
 	int ret = -1;
 
 	CK_RV rv;
@@ -571,6 +571,7 @@
 }
 
 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 @@
 	OBJ_cleanup();
 
 	return retString;
+#else
+	return TQString::null;
+#endif
 }
 
 void TDECryptographicCardDevice::workerRequestedPin(TQString prompt) {
@@ -654,7 +658,7 @@
 }
 
 int TDECryptographicCardDevice::decryptDataEncryptedWithCertPublicKey(TQValueList<TQByteArray> &cipherTextList, TQValueList<TQByteArray> &plainTextList, TQValueList<int> &retcodes, TQString *errstr) {
-#if WITH_PKCS
+#if defined(WITH_PKCS)
 	int ret = -1;
 
 	if (!m_watcherObject) {
@@ -840,6 +844,7 @@
 }
 
 int TDECryptographicCardDevice::createNewSecretRSAKeyFromCertificate(TQByteArray &plaintext, TQByteArray &ciphertext, X509* certificate) {
+#if defined(WITH_PKCS)
 	unsigned int i;
 	int retcode = -1;
 
@@ -885,10 +890,17 @@
 	}
 
 	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 d499a3c..1f01f59 100644
--- a/tdecore/tdehw/tdestoragedevice.cpp
+++ b/tdecore/tdehw/tdestoragedevice.cpp
@@ -188,7 +188,9 @@
 void TDEStorageDevice::cryptClearOperationsUnlockPassword() {
 	m_cryptDevicePassword.fill(0);
 	m_cryptDevicePassword.resize(0);
+#if defined(WITH_CRYPTSETUP)
 	crypt_memory_lock(NULL, 0);
+#endif
 }
 
 bool TDEStorageDevice::cryptOperationsUnlockPasswordSet() {