Skip to content

Commit a414b37

Browse files
committed
Add patch to reduce library output on command line
Signed-off-by: Luca Magrone <luca@magrone.cc>
1 parent 955b351 commit a414b37

2 files changed

Lines changed: 138 additions & 0 deletions

File tree

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
From 5b93eaee1df0f84110820db511b4347a1d3cb81a Mon Sep 17 00:00:00 2001
2+
From: Luca Magrone <luca@magrone.cc>
3+
Date: Wed, 16 Oct 2024 00:07:33 +0200
4+
Subject: [PATCH] libcie-pkcs11: reduce verbosity
5+
6+
Because it is wildly annoying. (Might even improve performance a tad).
7+
8+
Signed-off-by: Luca Magrone <luca@magrone.cc>
9+
---
10+
cie-pkcs11/CSP/IAS.cpp | 2 --
11+
cie-pkcs11/PKCS11/CIEP11Template.cpp | 2 --
12+
cie-pkcs11/Util/CacheLib.cpp | 2 --
13+
cie-pkcs11/Util/log.cpp | 25 -------------------------
14+
4 files changed, 31 deletions(-)
15+
16+
diff --git a/cie-pkcs11/CSP/IAS.cpp b/cie-pkcs11/CSP/IAS.cpp
17+
index 5ed8fa1..7ea9f92 100644
18+
--- a/cie-pkcs11/CSP/IAS.cpp
19+
+++ b/cie-pkcs11/CSP/IAS.cpp
20+
@@ -652,11 +652,9 @@ ByteDynArray IAS::SM(ByteArray &keyEnc, ByteArray &keySig, ByteArray &apdu, Byte
21+
init_func
22+
23+
std::string dmp;
24+
- ODS("%s\n", dumpHexData(seq, dmp).c_str());
25+
26+
increment(seq);
27+
28+
- ODS("%s\n", dumpHexData(seq, dmp).c_str());
29+
30+
ByteDynArray smHead;
31+
smHead = apdu.left(4);
32+
diff --git a/cie-pkcs11/PKCS11/CIEP11Template.cpp b/cie-pkcs11/PKCS11/CIEP11Template.cpp
33+
index 5ed271e..d1f6258 100755
34+
--- a/cie-pkcs11/PKCS11/CIEP11Template.cpp
35+
+++ b/cie-pkcs11/PKCS11/CIEP11Template.cpp
36+
@@ -41,7 +41,6 @@ int TokenTransmitCallback(CSlot *data, BYTE *apdu, DWORD apduSize, BYTE *resp, D
37+
}
38+
else if (code == 0xfffe) {
39+
DWORD protocol = 0;
40+
- ODS("UNPOWER CARD");
41+
auto ris = SCardReconnect(data->hCard, SCARD_SHARE_SHARED, SCARD_PROTOCOL_Tx, SCARD_UNPOWER_CARD, &protocol);
42+
43+
44+
@@ -62,7 +61,6 @@ int TokenTransmitCallback(CSlot *data, BYTE *apdu, DWORD apduSize, BYTE *resp, D
45+
resp[0] = 0x90;
46+
resp[1] = 0x00;
47+
}
48+
- ODS("RESET CARD");
49+
return ris;
50+
}
51+
}
52+
diff --git a/cie-pkcs11/Util/CacheLib.cpp b/cie-pkcs11/Util/CacheLib.cpp
53+
index c91424c..1381528 100644
54+
--- a/cie-pkcs11/Util/CacheLib.cpp
55+
+++ b/cie-pkcs11/Util/CacheLib.cpp
56+
@@ -238,8 +238,6 @@ std::string GetCardDir()
57+
58+
path.append("/.CIEPKI/");
59+
60+
- printf("Card Dir: %s\n", path.c_str());
61+
-
62+
return path.c_str();
63+
}
64+
65+
diff --git a/cie-pkcs11/Util/log.cpp b/cie-pkcs11/Util/log.cpp
66+
index 78fa967..8eefa19 100644
67+
--- a/cie-pkcs11/Util/log.cpp
68+
+++ b/cie-pkcs11/Util/log.cpp
69+
@@ -51,8 +51,6 @@ void initLog(const char *moduleName, const char *iniFile,const char *version)
70+
71+
logGlobalVersion=version;
72+
73+
- OutputDebugString("File INI: %s\n", iniFile);
74+
-
75+
UUCProperties settings;
76+
//settings.load(iniFile);
77+
78+
@@ -188,13 +186,9 @@ DWORD CLog::write(const char *format,...) {
79+
80+
if (!firstGlobal && LogMode==LM_Single) {
81+
firstGlobal =true;
82+
- write("Inizio Sessione - versione: %s",logGlobalVersion);
83+
- writeModuleInfo();
84+
}
85+
if (!FirstLog && (LogMode==LM_Module || LogMode==LM_Module_Thread)) {
86+
FirstLog=true;
87+
- write("%s - Inizio Sessione - versione file: %s",logName.c_str(), logVersion.c_str());
88+
- writeModuleInfo();
89+
}
90+
91+
//DWORD thNum;
92+
@@ -323,15 +317,9 @@ void CLog::writePure(const char *format,...) {
93+
if (Enabled && Initialized && mainEnable) {
94+
if (!firstGlobal && LogMode==LM_Single) {
95+
firstGlobal =true;
96+
- //write("Inizio Sessione - versione: %s",logGlobalVersion);
97+
- printf("Inizio Sessione - versione: %s",logGlobalVersion);
98+
- writeModuleInfo();
99+
}
100+
if (!FirstLog && (LogMode==LM_Module || LogMode==LM_Module_Thread)) {
101+
FirstLog=true;
102+
- //write("%s - Inizio Sessione - versione file: %s",logName.c_str(), logVersion.c_str());
103+
- printf("%s - Inizio Sessione - versione file: %s",logName.c_str(), logVersion.c_str());
104+
- writeModuleInfo();
105+
}
106+
107+
// se siamo in LM_thread devo scrivere il thread nel nome del file
108+
@@ -413,13 +401,9 @@ void CLog::writeBinData(BYTE *data, size_t datalen) {
109+
if (!Enabled || !Initialized || !mainEnable) return;
110+
if (!firstGlobal && LogMode==LM_Single) {
111+
firstGlobal =true;
112+
- write("Inizio Sessione - versione: %s",logGlobalVersion);
113+
- writeModuleInfo();
114+
}
115+
if (!FirstLog && (LogMode==LM_Module || LogMode==LM_Module_Thread)) {
116+
FirstLog=true;
117+
- write("%s - Inizio Sessione - versione file: %s",logName.c_str(), logVersion.c_str());
118+
- writeModuleInfo();
119+
}
120+
121+
// char pbtDate[0x800]={NULL};
122+
@@ -485,12 +469,3 @@ void CLog::writeBinData(BYTE *data, size_t datalen) {
123+
fclose(lf);
124+
}
125+
}
126+
-
127+
-void CLog::writeModuleInfo() {
128+
- if (!Enabled) return;
129+
- CModuleInfo module;
130+
- HANDLE mainModule = module.getApplicationModule();
131+
- module.init(mainModule);
132+
- write("Applicazione chiamante: %s",module.szModuleName.c_str());
133+
-}
134+
-
135+
--
136+
2.43.5
137+

cie-middleware.spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Patch10: cie-middleware-fix-pkcs11-info-output.patch
2828
Patch11: cie-middleware-fix-pkcs11-cant-lock.patch
2929
Patch12: cie-middleware-fix-chromium-buffer-overflow.patch
3030
Patch13: cie-middleware-override-tutorial.patch
31+
Patch14: cie-middleware-reduce-verbosity.patch
3132

3233
%if 0%{?fedora} < 40 || (0%{?rhel} && 0%{?rhel} < 10)
3334
BuildRequires: maven-local-openjdk11

0 commit comments

Comments
 (0)