Skip to content

Commit

Permalink
chore: beautify with clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
M0Rf30 committed Mar 30, 2024
1 parent fe57d43 commit 4251870
Show file tree
Hide file tree
Showing 115 changed files with 2,377 additions and 2,509 deletions.
2 changes: 1 addition & 1 deletion libs/pkcs11/src/CSP/VerificaConCIE.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include <stdio.h>
#include <sys/types.h>

#include "Sign/CIEVerify.h"
#include "CSP/AbilitaCIE.h"
#include "Sign/CIEVerify.h"

typedef CK_RV (*verificaConCIEfn)(const char* inFilePath);
typedef CK_RV (*getNumberOfSignfn)(void);
Expand Down
4 changes: 2 additions & 2 deletions libs/pkcs11/src/PKCS11/CIEP11Template.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once
#include "PKCS11/CardTemplate.h"
#include "PKCS11/Slot.h"
#include <PCSC/wintypes.h>

#include "PKCS11/CardTemplate.h"
#include "PKCS11/Slot.h"

using namespace p11;

Expand Down
2 changes: 1 addition & 1 deletion libs/pkcs11/src/PKCS11/CardContext.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <PCSC/wintypes.h>
#include <PCSC/winscard.h>
#include <PCSC/wintypes.h>

class CCardContext {
public:
Expand Down
2 changes: 1 addition & 1 deletion libs/pkcs11/src/PKCS11/PKCS11Functions.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <PCSC/wintypes.h>
#include <PCSC/winscard.h>
#include <PCSC/wintypes.h>

#include "PKCS11/cryptoki.h"

Expand Down
3 changes: 1 addition & 2 deletions libs/pkcs11/src/PKCS11/Slot.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "Util/SyncroMutex.h"
#include "PKCS11/cryptoki.h"
#include "Util/SyncroMutex.h"

#pragma pack()
#include <map>
Expand All @@ -11,7 +11,6 @@

#include "PKCS11/CardContext.h"


namespace p11 {

typedef std::map<CK_SLOT_ID, std::shared_ptr<class CSlot>> SlotMap;
Expand Down
23 changes: 7 additions & 16 deletions libs/pkcs11/src/PKCS11/pkcs11.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,22 +220,19 @@ extern "C" {
* #endif
*/


/* All the various Cryptoki types and #define'd values are in the
* file pkcs11t.h. */
#include "PKCS11/pkcs11t.h"

#define __PASTE(x,y) x##y

#define __PASTE(x, y) x##y

/* ==============================================================
* Define the "extern" form of all the entry points.
* ==============================================================
*/

#define CK_NEED_ARG_LIST 1
#define CK_PKCS11_FUNCTION_INFO(name) \
extern CK_DECLARE_FUNCTION(CK_RV, name)
#define CK_NEED_ARG_LIST 1
#define CK_PKCS11_FUNCTION_INFO(name) extern CK_DECLARE_FUNCTION(CK_RV, name)

/* pkcs11f.h has all the information about the Cryptoki
* function prototypes. */
Expand All @@ -244,17 +241,16 @@ extern "C" {
#undef CK_NEED_ARG_LIST
#undef CK_PKCS11_FUNCTION_INFO


/* ==============================================================
* Define the typedef form of all the entry points. That is, for
* each Cryptoki function C_XXX, define a type CK_C_XXX which is
* a pointer to that kind of function.
* ==============================================================
*/

#define CK_NEED_ARG_LIST 1
#define CK_NEED_ARG_LIST 1
#define CK_PKCS11_FUNCTION_INFO(name) \
typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, __PASTE(CK_,name))
typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, __PASTE(CK_, name))

/* pkcs11f.h has all the information about the Cryptoki
* function prototypes. */
Expand All @@ -263,7 +259,6 @@ extern "C" {
#undef CK_NEED_ARG_LIST
#undef CK_PKCS11_FUNCTION_INFO


/* ==============================================================
* Define structed vector of entry points. A CK_FUNCTION_LIST
* contains a CK_VERSION indicating a library's Cryptoki version
Expand All @@ -273,23 +268,19 @@ extern "C" {
* ==============================================================
*/

#define CK_PKCS11_FUNCTION_INFO(name) \
__PASTE(CK_,name) name;
#define CK_PKCS11_FUNCTION_INFO(name) __PASTE(CK_, name) name;

struct CK_FUNCTION_LIST {

CK_VERSION version; /* Cryptoki version */
CK_VERSION version; /* Cryptoki version */

/* Pile all the function pointers into the CK_FUNCTION_LIST. */
/* pkcs11f.h has all the information about the Cryptoki
* function prototypes. */
#include "PKCS11/pkcs11f.h"

};

#undef CK_PKCS11_FUNCTION_INFO


#undef __PASTE

#ifdef __cplusplus
Expand Down
1 change: 0 additions & 1 deletion libs/pkcs11/src/keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@

#define ENCRYPTION_KEY "this is a fake key"


#endif // KEYS_H_
2 changes: 1 addition & 1 deletion libs/shared/src/CSP/ExtAuthKey.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Util/Array.h"
#include "Sign/definitions.h"
#include "Util/Array.h"

BYTE ExtAuth_PrivExp[] = {
0x18, 0x6B, 0x31, 0x48, 0x8C, 0x25, 0xDC, 0xF8, 0x5D, 0x95, 0x3D, 0x36,
Expand Down
3 changes: 2 additions & 1 deletion libs/shared/src/Crypto/ASNParser.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "Util/Array.h"
#include "ASNParser.h"

#include "Util/Array.h"

extern CLog Log;

#define BitValue(a, b) ((a >> b) & 1)
Expand Down
2 changes: 1 addition & 1 deletion libs/shared/src/Crypto/ASNParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <memory>
#include <vector>

#include "Sign/definitions.h"
#include "Util/Array.h"

size_t GetASN1DataLenght(ByteArray &data);

Expand Down
2 changes: 2 additions & 0 deletions libs/shared/src/Crypto/DES3.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "Crypto/DES3.h"

#include <cryptopp/misc.h>
#include <openssl/des.h>
#include <openssl/evp.h>

extern CLog Log;

Expand Down
2 changes: 1 addition & 1 deletion libs/shared/src/Crypto/RSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include <cryptopp/rsa.h>
#include <openssl/rsa.h>

#include "Util/Array.h"
#include "Sign/definitions.h"
#include "Util/Array.h"

class CRSA {
CryptoPP::RSA::PublicKey pubKey;
Expand Down
2 changes: 1 addition & 1 deletion libs/shared/src/PCSC/APDU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include "Crypto/DES3.h"
#include "Crypto/MAC.h"
#include "PCSC/Token.h"
#include "Util/TLV.h"
#include "Util/util.h"
#include "PCSC/Token.h"

extern CLog Log;

Expand Down
4 changes: 2 additions & 2 deletions libs/shared/src/PCSC/CardLocker.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once
#include <PCSC/wintypes.h>
#include <PCSC/winscard.h>
#include <PCSC/wintypes.h>

#include "Util/SyncroMutex.h"
#include "PCSC/Token.h"
#include "Util/SyncroMutex.h"

class CCardLocker {
SCARDHANDLE hCard;
Expand Down
2 changes: 1 addition & 1 deletion libs/shared/src/PCSC/PCSC.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef PCSC_H
#define PCSC_H

#include <PCSC/wintypes.h>
#include <PCSC/winscard.h>
#include <PCSC/wintypes.h>

#include <string>
#include <thread>
Expand Down
2 changes: 1 addition & 1 deletion libs/shared/src/PCSC/Token.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#include <vector>

#include "Util/TLV.h"
#include "PCSC/APDU.h"
#include "Util/TLV.h"

extern CLog Log;

Expand Down
4 changes: 2 additions & 2 deletions libs/shared/src/PCSC/Token.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

#include <PCSC/wintypes.h>
#include <PCSC/winscard.h>
#include <PCSC/wintypes.h>

#include "Util/SyncroMutex.h"
#include "PCSC/APDU.h"
#include "Util/SyncroMutex.h"

extern SCARDCONTEXT hContext;

Expand Down
23 changes: 7 additions & 16 deletions libs/shared/src/PKCS11/pkcs11.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,22 +220,19 @@ extern "C" {
* #endif
*/


/* All the various Cryptoki types and #define'd values are in the
* file pkcs11t.h. */
#include "PKCS11/pkcs11t.h"

#define __PASTE(x,y) x##y

#define __PASTE(x, y) x##y

/* ==============================================================
* Define the "extern" form of all the entry points.
* ==============================================================
*/

#define CK_NEED_ARG_LIST 1
#define CK_PKCS11_FUNCTION_INFO(name) \
extern CK_DECLARE_FUNCTION(CK_RV, name)
#define CK_NEED_ARG_LIST 1
#define CK_PKCS11_FUNCTION_INFO(name) extern CK_DECLARE_FUNCTION(CK_RV, name)

/* pkcs11f.h has all the information about the Cryptoki
* function prototypes. */
Expand All @@ -244,17 +241,16 @@ extern "C" {
#undef CK_NEED_ARG_LIST
#undef CK_PKCS11_FUNCTION_INFO


/* ==============================================================
* Define the typedef form of all the entry points. That is, for
* each Cryptoki function C_XXX, define a type CK_C_XXX which is
* a pointer to that kind of function.
* ==============================================================
*/

#define CK_NEED_ARG_LIST 1
#define CK_NEED_ARG_LIST 1
#define CK_PKCS11_FUNCTION_INFO(name) \
typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, __PASTE(CK_,name))
typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, __PASTE(CK_, name))

/* pkcs11f.h has all the information about the Cryptoki
* function prototypes. */
Expand All @@ -263,7 +259,6 @@ extern "C" {
#undef CK_NEED_ARG_LIST
#undef CK_PKCS11_FUNCTION_INFO


/* ==============================================================
* Define structed vector of entry points. A CK_FUNCTION_LIST
* contains a CK_VERSION indicating a library's Cryptoki version
Expand All @@ -273,23 +268,19 @@ extern "C" {
* ==============================================================
*/

#define CK_PKCS11_FUNCTION_INFO(name) \
__PASTE(CK_,name) name;
#define CK_PKCS11_FUNCTION_INFO(name) __PASTE(CK_, name) name;

struct CK_FUNCTION_LIST {

CK_VERSION version; /* Cryptoki version */
CK_VERSION version; /* Cryptoki version */

/* Pile all the function pointers into the CK_FUNCTION_LIST. */
/* pkcs11f.h has all the information about the Cryptoki
* function prototypes. */
#include "PKCS11/pkcs11f.h"

};

#undef CK_PKCS11_FUNCTION_INFO


#undef __PASTE

#ifdef __cplusplus
Expand Down
4 changes: 2 additions & 2 deletions libs/shared/src/Util/Array.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "Util/Array.h"

#include <cryptopp/cryptlib.h>
#include <cryptopp/misc.h>
#include <cryptopp/osrng.h>
Expand All @@ -6,8 +8,6 @@

#include <fstream>

#include "Util/Array.h"

ByteArray::ByteArray() {
_data = nullptr;
_size = 0;
Expand Down
2 changes: 1 addition & 1 deletion libs/shared/src/Util/CacheLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include <string>
#include <vector>

#include "keys.h"
#include "Util/util.h"
#include "keys.h"

using namespace CryptoPP;

Expand Down
4 changes: 2 additions & 2 deletions libs/shared/src/Util/CryptoppUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#include "CryptoppUtils.h"

#include <cryptopp/base64.h>
#include <cryptopp/hex.h>
#include <cryptopp/osrng.h>

#include <sstream>

#include "CryptoppUtils.h"

using namespace CryptoPP;

namespace lcp {
Expand Down
2 changes: 1 addition & 1 deletion libs/shared/src/Util/IniSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#include <string>
#include <vector>

#include "Util/Array.h"
#include "Sign/definitions.h"
#include "Util/Array.h"

class IniSettings;
extern std::vector<IniSettings*> _iniSettings;
Expand Down
1 change: 1 addition & 0 deletions libs/shared/src/Util/ModuleInfo.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <string>

#include "Util/util.h"

class CModuleInfo {
Expand Down
Loading

0 comments on commit 4251870

Please sign in to comment.