Skip to content

Commit

Permalink
Add patch to reduce library output on command line
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Magrone <luca@magrone.cc>
  • Loading branch information
Leuca committed Oct 15, 2024
1 parent 955b351 commit a414b37
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 0 deletions.
137 changes: 137 additions & 0 deletions cie-middleware-reduce-verbosity.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
From 5b93eaee1df0f84110820db511b4347a1d3cb81a Mon Sep 17 00:00:00 2001
From: Luca Magrone <luca@magrone.cc>
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 <luca@magrone.cc>
---
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

1 change: 1 addition & 0 deletions cie-middleware.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a414b37

Please sign in to comment.