From a414b37a7be6c0c0b2bb5ba2321752943e5be29e Mon Sep 17 00:00:00 2001 From: Luca Magrone Date: Wed, 16 Oct 2024 00:10:14 +0200 Subject: [PATCH] Add patch to reduce library output on command line Signed-off-by: Luca Magrone --- cie-middleware-reduce-verbosity.patch | 137 ++++++++++++++++++++++++++ cie-middleware.spec | 1 + 2 files changed, 138 insertions(+) create mode 100644 cie-middleware-reduce-verbosity.patch diff --git a/cie-middleware-reduce-verbosity.patch b/cie-middleware-reduce-verbosity.patch new file mode 100644 index 0000000..5c113f7 --- /dev/null +++ b/cie-middleware-reduce-verbosity.patch @@ -0,0 +1,137 @@ +From 5b93eaee1df0f84110820db511b4347a1d3cb81a Mon Sep 17 00:00:00 2001 +From: Luca Magrone +Date: Wed, 16 Oct 2024 00:07:33 +0200 +Subject: [PATCH] libcie-pkcs11: reduce verbosity + +Because it is wildly annoying. (Might even improve performance a tad). + +Signed-off-by: Luca Magrone +--- + cie-pkcs11/CSP/IAS.cpp | 2 -- + cie-pkcs11/PKCS11/CIEP11Template.cpp | 2 -- + cie-pkcs11/Util/CacheLib.cpp | 2 -- + cie-pkcs11/Util/log.cpp | 25 ------------------------- + 4 files changed, 31 deletions(-) + +diff --git a/cie-pkcs11/CSP/IAS.cpp b/cie-pkcs11/CSP/IAS.cpp +index 5ed8fa1..7ea9f92 100644 +--- a/cie-pkcs11/CSP/IAS.cpp ++++ b/cie-pkcs11/CSP/IAS.cpp +@@ -652,11 +652,9 @@ ByteDynArray IAS::SM(ByteArray &keyEnc, ByteArray &keySig, ByteArray &apdu, Byte + init_func + + std::string dmp; +- ODS("%s\n", dumpHexData(seq, dmp).c_str()); + + increment(seq); + +- ODS("%s\n", dumpHexData(seq, dmp).c_str()); + + ByteDynArray smHead; + smHead = apdu.left(4); +diff --git a/cie-pkcs11/PKCS11/CIEP11Template.cpp b/cie-pkcs11/PKCS11/CIEP11Template.cpp +index 5ed271e..d1f6258 100755 +--- a/cie-pkcs11/PKCS11/CIEP11Template.cpp ++++ b/cie-pkcs11/PKCS11/CIEP11Template.cpp +@@ -41,7 +41,6 @@ int TokenTransmitCallback(CSlot *data, BYTE *apdu, DWORD apduSize, BYTE *resp, D + } + else if (code == 0xfffe) { + DWORD protocol = 0; +- ODS("UNPOWER CARD"); + auto ris = SCardReconnect(data->hCard, SCARD_SHARE_SHARED, SCARD_PROTOCOL_Tx, SCARD_UNPOWER_CARD, &protocol); + + +@@ -62,7 +61,6 @@ int TokenTransmitCallback(CSlot *data, BYTE *apdu, DWORD apduSize, BYTE *resp, D + resp[0] = 0x90; + resp[1] = 0x00; + } +- ODS("RESET CARD"); + return ris; + } + } +diff --git a/cie-pkcs11/Util/CacheLib.cpp b/cie-pkcs11/Util/CacheLib.cpp +index c91424c..1381528 100644 +--- a/cie-pkcs11/Util/CacheLib.cpp ++++ b/cie-pkcs11/Util/CacheLib.cpp +@@ -238,8 +238,6 @@ std::string GetCardDir() + + path.append("/.CIEPKI/"); + +- printf("Card Dir: %s\n", path.c_str()); +- + return path.c_str(); + } + +diff --git a/cie-pkcs11/Util/log.cpp b/cie-pkcs11/Util/log.cpp +index 78fa967..8eefa19 100644 +--- a/cie-pkcs11/Util/log.cpp ++++ b/cie-pkcs11/Util/log.cpp +@@ -51,8 +51,6 @@ void initLog(const char *moduleName, const char *iniFile,const char *version) + + logGlobalVersion=version; + +- OutputDebugString("File INI: %s\n", iniFile); +- + UUCProperties settings; + //settings.load(iniFile); + +@@ -188,13 +186,9 @@ DWORD CLog::write(const char *format,...) { + + if (!firstGlobal && LogMode==LM_Single) { + firstGlobal =true; +- write("Inizio Sessione - versione: %s",logGlobalVersion); +- writeModuleInfo(); + } + if (!FirstLog && (LogMode==LM_Module || LogMode==LM_Module_Thread)) { + FirstLog=true; +- write("%s - Inizio Sessione - versione file: %s",logName.c_str(), logVersion.c_str()); +- writeModuleInfo(); + } + + //DWORD thNum; +@@ -323,15 +317,9 @@ void CLog::writePure(const char *format,...) { + if (Enabled && Initialized && mainEnable) { + if (!firstGlobal && LogMode==LM_Single) { + firstGlobal =true; +- //write("Inizio Sessione - versione: %s",logGlobalVersion); +- printf("Inizio Sessione - versione: %s",logGlobalVersion); +- writeModuleInfo(); + } + if (!FirstLog && (LogMode==LM_Module || LogMode==LM_Module_Thread)) { + FirstLog=true; +- //write("%s - Inizio Sessione - versione file: %s",logName.c_str(), logVersion.c_str()); +- printf("%s - Inizio Sessione - versione file: %s",logName.c_str(), logVersion.c_str()); +- writeModuleInfo(); + } + + // se siamo in LM_thread devo scrivere il thread nel nome del file +@@ -413,13 +401,9 @@ void CLog::writeBinData(BYTE *data, size_t datalen) { + if (!Enabled || !Initialized || !mainEnable) return; + if (!firstGlobal && LogMode==LM_Single) { + firstGlobal =true; +- write("Inizio Sessione - versione: %s",logGlobalVersion); +- writeModuleInfo(); + } + if (!FirstLog && (LogMode==LM_Module || LogMode==LM_Module_Thread)) { + FirstLog=true; +- write("%s - Inizio Sessione - versione file: %s",logName.c_str(), logVersion.c_str()); +- writeModuleInfo(); + } + + // char pbtDate[0x800]={NULL}; +@@ -485,12 +469,3 @@ void CLog::writeBinData(BYTE *data, size_t datalen) { + fclose(lf); + } + } +- +-void CLog::writeModuleInfo() { +- if (!Enabled) return; +- CModuleInfo module; +- HANDLE mainModule = module.getApplicationModule(); +- module.init(mainModule); +- write("Applicazione chiamante: %s",module.szModuleName.c_str()); +-} +- +-- +2.43.5 + diff --git a/cie-middleware.spec b/cie-middleware.spec index 11d3333..190dadf 100644 --- a/cie-middleware.spec +++ b/cie-middleware.spec @@ -28,6 +28,7 @@ Patch10: cie-middleware-fix-pkcs11-info-output.patch Patch11: cie-middleware-fix-pkcs11-cant-lock.patch Patch12: cie-middleware-fix-chromium-buffer-overflow.patch Patch13: cie-middleware-override-tutorial.patch +Patch14: cie-middleware-reduce-verbosity.patch %if 0%{?fedora} < 40 || (0%{?rhel} && 0%{?rhel} < 10) BuildRequires: maven-local-openjdk11