Skip to content

Commit 64c888f

Browse files
committed
Limit opensc-pkcs11.dll only for debug build
IB-9047 Signed-off-by: Raul Metsma <raul@metsma.ee>
1 parent 52925df commit 64c888f

4 files changed

Lines changed: 17 additions & 11 deletions

File tree

client/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE
6464
QPCSC.cpp
6565
QPCSC_p.h
6666
QPCSC.h
67-
QPKCS11.cpp
68-
QPKCS11.h
67+
$<IF:$<PLATFORM_ID:Windows>,
68+
QCNG.cpp QCNG.h,
69+
QPKCS11.cpp QPKCS11.h
70+
>
6971
QSigner.cpp
7072
QSigner.h
7173
QSmartCard.cpp
@@ -194,7 +196,6 @@ if( APPLE )
194196
COMMAND zip -r ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-dbg_${VERSION}$ENV{VER_SUFFIX}.zip ${PROJECT_NAME}.dSYM
195197
)
196198
elseif(WIN32)
197-
target_sources(${PROJECT_NAME} PRIVATE QCNG.cpp QCNG.h)
198199
target_compile_options(${PROJECT_NAME} PRIVATE "/guard:cf")
199200
target_link_options(${PROJECT_NAME} PRIVATE "/guard:cf" $<$<BOOL:${CROSSSIGNCERT}>:/INTEGRITYCHECK>)
200201
target_link_libraries(${PROJECT_NAME} NCrypt Crypt32 Cryptui winscard)

client/QCryptoBackend.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
#include "TokenData.h"
2424
#ifdef Q_OS_WIN
2525
#include "QCNG.h"
26-
#endif
26+
#else
2727
#include "QPKCS11.h"
28+
#endif
2829
#include "QSigner.h"
2930
#include "QSmartCard.h"
3031

@@ -88,13 +89,13 @@ QString QCryptoBackend::errorString(Status error)
8889
switch( error )
8990
{
9091
case PinOK: return QString();
91-
case PinCanceled: return QCoreApplication::translate("QCryptoBackend", "PIN entry canceled");
92-
case PinLocked: return QCoreApplication::translate("QCryptoBackend", "PIN locked");
93-
case PinIncorrect: return QCoreApplication::translate("QCryptoBackend", "PIN incorrect");
94-
case InProgress: return QCoreApplication::translate("QCryptoBackend", "Signing/decrypting is already in progress another window.");
95-
case GeneralError: return QCoreApplication::translate("QCryptoBackend", "PKCS11 general error");
96-
case DeviceError: return QCoreApplication::translate("QCryptoBackend", "PKCS11 device error");
97-
default: return QCoreApplication::translate("QCryptoBackend", "Unknown error");
92+
case PinCanceled: return tr("PIN entry canceled");
93+
case PinLocked: return tr("PIN locked");
94+
case PinIncorrect: return tr("PIN incorrect");
95+
case InProgress: return tr("Signing/decrypting is already in progress another window.");
96+
case GeneralError: return tr("PKCS11 general error");
97+
case DeviceError: return tr("PKCS11 device error");
98+
default: return tr("Unknown error");
9899
}
99100
}
100101

client/QCryptoBackend.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include "TokenData.h"
2323

24+
#include <QtCore/QCoreApplication>
2425
#include <QtCore/QCryptographicHash>
2526

2627
#include <expected>
@@ -30,6 +31,7 @@ class QSslKey;
3031

3132
class QCryptoBackend
3233
{
34+
Q_DECLARE_TR_FUNCTIONS(QCryptoBackend);
3335
public:
3436
enum Status : quint8
3537
{

client/QPKCS11.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ std::shared_ptr<QPKCS11Library> QPKCS11Library::current()
135135
{ "/Library/Frameworks/eToken.framework/Versions/Current/libIDPrimePKCS11.dylib", "3BFF9600008131FE4380318065B0855956FB120FFE82900000" },
136136
{ "/Library/Frameworks/eToken.framework/Versions/Current/libIDPrimePKCS11.dylib", "3BFF9600008131FE4380318065B08505003912017882900040" },
137137
#elif defined(Q_OS_WIN)
138+
#ifdef _DEBUG
138139
{ "opensc-pkcs11.dll", {} },
140+
#endif
139141
#else
140142
{ "opensc-pkcs11.so", {} },
141143
#if defined(Q_OS_LINUX)

0 commit comments

Comments
 (0)