diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2015-09-14 03:54:16 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2015-09-14 03:54:16 -0500 |
commit | ffa54887cef6a8e36b2d63e7e9139ac11863a525 (patch) | |
tree | a36d7ade29b74464af1f87e61e8cbc05441dd64b /tdecore/tdehw/tdestoragedevice.cpp | |
parent | 4238dc9cea6c543abf993d3a28af564f1c8dea0c (diff) | |
download | tdelibs-ffa54887cef6a8e36b2d63e7e9139ac11863a525.tar.gz tdelibs-ffa54887cef6a8e36b2d63e7e9139ac11863a525.zip |
Add additional cryptographic card functions to tdehwlib
Fix FTBFS on old distributions
Diffstat (limited to 'tdecore/tdehw/tdestoragedevice.cpp')
-rw-r--r-- | tdecore/tdehw/tdestoragedevice.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/tdecore/tdehw/tdestoragedevice.cpp b/tdecore/tdehw/tdestoragedevice.cpp index 781c08885..1b4be9283 100644 --- a/tdecore/tdehw/tdestoragedevice.cpp +++ b/tdecore/tdehw/tdestoragedevice.cpp @@ -41,9 +41,17 @@ #include "config.h" #if defined(WITH_CRYPTSETUP) - #include <libcryptsetup.h> - #ifndef CRYPT_SLOT_INACTIVE - #define CRYPTSETUP_OLD_API + #ifdef CRYPTSETUP_OLD_API + #define class cryptsetup_class + #define CRYPT_SLOT_INVALID INVALID + #define CRYPT_SLOT_INACTIVE INACTIVE + #define CRYPT_SLOT_ACTIVE ACTIVE + #define CRYPT_SLOT_BUSY BUSY + #define CRYPT_SLOT_ACTIVE_LAST ACTIVE + #include <libcryptsetup.h> + #undef class + #else + #include <libcryptsetup.h> #endif #endif @@ -102,9 +110,6 @@ TDEDiskDeviceType::TDEDiskDeviceType TDEStorageDevice::diskType() { void TDEStorageDevice::internalGetLUKSKeySlotStatus() { #if defined(WITH_CRYPTSETUP) -#ifdef CRYPTSETUP_OLD_API - kdWarning() << "TDEStorageDevice: The version of libcryptsetup that TDE was compiled against was too old! Most LUKS features will not function" << endl; -#else unsigned int i; crypt_keyslot_info keyslot_status; TDELUKSKeySlotStatus::TDELUKSKeySlotStatus tde_keyslot_status; @@ -125,14 +130,10 @@ void TDEStorageDevice::internalGetLUKSKeySlotStatus() { m_cryptKeyslotStatus.append(tde_keyslot_status); } #endif -#endif } void TDEStorageDevice::internalInitializeLUKSIfNeeded() { #if defined(WITH_CRYPTSETUP) -#ifdef CRYPTSETUP_OLD_API - kdWarning() << "TDEStorageDevice: The version of libcryptsetup that TDE was compiled against was too old! Most LUKS features will not function" << endl; -#else int ret; if (m_diskType & TDEDiskDeviceType::LUKS) { @@ -145,8 +146,14 @@ void TDEStorageDevice::internalInitializeLUKSIfNeeded() { ret = crypt_load(m_cryptDevice, NULL, NULL); if (ret == 0) { int keyslot_count; +#ifdef CRYPTSETUP_OLD_API + kdWarning() << "TDEStorageDevice: The version of libcryptsetup that TDE was compiled against was too old! Most LUKS features will not function" << endl; + m_cryptDeviceType = TQString::null; + keyslot_count = 0; +#else m_cryptDeviceType = crypt_get_type(m_cryptDevice); keyslot_count = crypt_keyslot_max(m_cryptDeviceType.ascii()); +#endif if (keyslot_count < 0) { m_cryptKeySlotCount = 0; } @@ -169,7 +176,6 @@ void TDEStorageDevice::internalInitializeLUKSIfNeeded() { } } #endif -#endif } void TDEStorageDevice::cryptSetOperationsUnlockPassword(TQByteArray password) { |