Skip to content

Commit

Permalink
fix: accomodate SCardListReaders parameters on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
M0Rf30 committed Mar 30, 2024
1 parent f6a0629 commit 5998deb
Show file tree
Hide file tree
Showing 58 changed files with 291 additions and 460 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*.o
*.orig
*.so
.cache/
.idea/
.trunk
.vscode
Expand Down
4 changes: 2 additions & 2 deletions libs/pkcs11/src/CSP/AbilitaCIE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <string>
#include <vector>

#include "CSP/IAS.h"
#include "Crypto/AES.h"
#include "Crypto/ASNParser.h"
#include "Crypto/CryptoUtil.h"
Expand All @@ -35,12 +36,11 @@
#include "LOGGER/Logger.h"
#include "PKCS11/PKCS11Functions.h"
#include "PKCS11/Slot.h"
#include "Sign/definitions.h"
#include "Sign/CIESign.h"
#include "Sign/CIEVerify.h"
#include "Sign/definitions.h"
#include "Util/CryptoppUtils.h"
#include "Util/ModuleInfo.h"
#include "CSP/IAS.h"

using namespace CieIDLogger;

Expand Down
1 change: 0 additions & 1 deletion libs/pkcs11/src/CSP/AbilitaCIE.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// Created by ugo chirico on 02/09/18. http://www.ugochirico.com
// Copyright © 2018 IPZS. All rights reserved.
//
#include <string>

#include "PCSC/PCSC.h"
#include "PKCS11/cryptoki.h"
Expand Down
7 changes: 2 additions & 5 deletions libs/pkcs11/src/CSP/FirmaConCIE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@

#include "CSP/FirmaConCIE.h"

#include "Crypto/ASNParser.h"
#include "CSP/AbilitaCIE.h"
#include "CSP/IAS.h"
#include "LOGGER/Logger.h"
#include "PCSC/PCSC.h"
#include "PKCS11/PKCS11Functions.h"
#include "PKCS11/Slot.h"
#include "Sign/definitions.h"
#include "Sign/CIESign.h"
#include "Util/ModuleInfo.h"
#include "CSP/AbilitaCIE.h"
#include "CSP/IAS.h"

using namespace CieIDLogger;

Expand Down
7 changes: 1 addition & 6 deletions libs/pkcs11/src/CSP/FirmaConCIE.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@
#ifndef FirmaConCIE_h
#define FirmaConCIE_h

#include <stdio.h>

#include <string>

#include "PKCS11/cryptoki.h"
#include "Sign/CIESign.h"
#include "CSP/AbilitaCIE.h"
#include "PKCS11/cryptoki.h"

typedef CK_CALLBACK_FUNCTION(CK_RV, SIGN_COMPLETED_CALLBACK)(const int ret);

Expand Down
9 changes: 4 additions & 5 deletions libs/pkcs11/src/CSP/IAS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
#include "Crypto/SHA1.h"
#include "Crypto/sha256.h"
#include "Crypto/sha512.h"
#include "Util/ModuleInfo.h"

#include "Util/CacheLib.h"
#include "LOGGER/Logger.h"
#include "Util/CacheLib.h"
#include "Util/ModuleInfo.h"

using namespace CieIDLogger;

Expand Down Expand Up @@ -393,8 +392,8 @@ void IAS::SelectAID_IAS(bool SM) {
throw scard_error(sw);
}
} else if (type == CIE_Type::CIE_Gemalto || type == CIE_Type::CIE_STM ||
CIE_Type::CIE_STM2 || CIE_Type::CIE_STM3 ||
CIE_Type::CIE_ACTALIS || CIE_Type::CIE_BIT4ID) {
type == CIE_Type::CIE_STM2 || type == CIE_Type::CIE_STM3 ||
type == CIE_Type::CIE_ACTALIS || type == CIE_Type::CIE_BIT4ID) {
uint8_t selectIAS[] = {0x00, 0xa4, 0x04, 0x0c};
if (SM) {
if ((sw = SendAPDU_SM(VarToByteArray(selectIAS), IAS_AID, resp)) !=
Expand Down
9 changes: 2 additions & 7 deletions libs/pkcs11/src/CSP/PINManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,14 @@

#include <cryptopp/misc.h>

#include <functional>
#include <string>

#include "Crypto/ASNParser.h"
#include "Crypto/sha256.h"
#include "CSP/AbilitaCIE.h"
#include "CSP/IAS.h"
#include "LOGGER/Logger.h"
#include "PCSC/PCSC.h"
#include "PKCS11/PKCS11Functions.h"
#include "PKCS11/Slot.h"
#include "Sign/definitions.h"
#include "Util/ModuleInfo.h"
#include "CSP/AbilitaCIE.h"
#include "CSP/IAS.h"

using namespace CieIDLogger;

Expand Down
1 change: 1 addition & 0 deletions libs/pkcs11/src/CSP/VerificaConCIE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#include "CSP/VerificaConCIE.h"

#include <sys/types.h>

#include "LOGGER/Logger.h"
Expand Down
1 change: 0 additions & 1 deletion libs/pkcs11/src/LOGGER/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <ctime>
#include <iomanip>
#include <iostream>
#include <regex>

using namespace std;
using namespace CieIDLogger;
Expand Down
2 changes: 0 additions & 2 deletions libs/pkcs11/src/LOGGER/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define _LOGGER_H_

// C++ Header File(s)
#include <errno.h>
#include <pthread.h>
#include <stdint.h>

Expand Down Expand Up @@ -103,7 +102,6 @@ class Logger {
std::ofstream m_File;
std::fstream m_ConfigFile;
char pbLog[MAX_PATH];
char pbConfig[MAX_PATH];
time_t t_configTime;
pthread_mutexattr_t m_Attr;
pthread_mutex_t m_Mutex;
Expand Down
4 changes: 2 additions & 2 deletions libs/pkcs11/src/PKCS11/CIEP11Template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ class CIEData {
CToken token;
bool init;
CIEData(CSlot *slot, ByteArray atr)
: ias((CToken::TokenTransmitCallback)TokenTransmitCallback, atr),
slot(*slot) {
: slot(*slot),
ias((CToken::TokenTransmitCallback)TokenTransmitCallback, atr) {
ByteDynArray key(32);
ByteDynArray iv(16);
aesKey.Init(key.random(), iv.random());
Expand Down
3 changes: 2 additions & 1 deletion libs/pkcs11/src/PKCS11/CardContext.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "PKCS11/CardContext.h"

#include "Util/util.h"
#include <PCSC/wintypes.h>

#include "Util/util.h"

extern CLog Log;

void CCardContext::getContext() {
Expand Down
2 changes: 1 addition & 1 deletion libs/pkcs11/src/PKCS11/CardTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include <utility>

#include "Util/ModuleInfo.h"
#include "PKCS11/CIEP11Template.h"
#include "Util/ModuleInfo.h"

extern CLog Log;

Expand Down
2 changes: 0 additions & 2 deletions libs/pkcs11/src/PKCS11/CardTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
#include <memory>
#include <string>

#include "PCSC/Token.h"
#include "PKCS11/session.h"


namespace p11 {

class CCardTemplate;
Expand Down
7 changes: 4 additions & 3 deletions libs/pkcs11/src/PKCS11/Mechanism.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "PKCS11/Mechanism.h"

#include "Crypto/RSA.h"
#include "Util/util.h"
#include "PKCS11/P11Object.h"
#include "PKCS11/session.h"
#include "Util/util.h"

extern CLog Log;

Expand Down Expand Up @@ -425,7 +426,7 @@ ByteDynArray CRSA_PKCS1::SignRecover(ByteArray &Data) {
CSignRSAwithDigest::CSignRSAwithDigest(CK_MECHANISM_TYPE type,
std::shared_ptr<CSession> Session,
CDigest *Digest)
: pDigest(Digest), CSignRSA(type, std::move(Session)) {}
: CSignRSA(type, std::move(Session)), pDigest(Digest) {}
CSignRSAwithDigest::~CSignRSAwithDigest() {}

bool CSignRSAwithDigest::SignSupportMultipart() { init_func return true; }
Expand Down Expand Up @@ -467,7 +468,7 @@ void CSignRSAwithDigest::SignSetOperationState(ByteArray &OperationState) {
CVerifyRSAwithDigest::CVerifyRSAwithDigest(CK_MECHANISM_TYPE type,
std::shared_ptr<CSession> Session,
CDigest *Digest)
: pDigest(Digest), CVerifyRSA(type, std::move(Session)) {}
: CVerifyRSA(type, std::move(Session)), pDigest(Digest) {}
CVerifyRSAwithDigest::~CVerifyRSAwithDigest() {}

bool CVerifyRSAwithDigest::VerifySupportMultipart() { init_func return true; }
Expand Down
Loading

0 comments on commit 5998deb

Please sign in to comment.