From a6a7d6ce079cabdaf2fa502b2e2cf15e5428ac6f Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Wed, 3 Jul 2024 15:52:39 +0200 Subject: format files --- src/include/dkimverify.h | 169 ++++++++++++++++++++++++----------------------- 1 file changed, 85 insertions(+), 84 deletions(-) (limited to 'src/include/dkimverify.h') diff --git a/src/include/dkimverify.h b/src/include/dkimverify.h index 64de2a1..685426b 100644 --- a/src/include/dkimverify.h +++ b/src/include/dkimverify.h @@ -22,131 +22,132 @@ #ifndef DKIMVERIFY_H #define DKIMVERIFY_H -#include "dkimbase.h" #include +#include "dkimbase.h" + /* not used anymore #define DKIM_ADSP_UNKNOWN 1 #define DKIM_ADSP_ALL 2 #define DKIM_ADSP_DISCARDABLE 3 */ -#define DKIM_POLICY_DOMAIN_NAME_TOO_LONG -50 // internal error -#define DKIM_POLICY_DNS_TEMP_FAILURE -51 // internal error -#define DKIM_POLICY_DNS_PERM_FAILURE -52 // internal error -#define DKIM_POLICY_INVALID -53 // internal error +#define DKIM_POLICY_DOMAIN_NAME_TOO_LONG -50 // internal error +#define DKIM_POLICY_DNS_TEMP_FAILURE -51 // internal error +#define DKIM_POLICY_DNS_PERM_FAILURE -52 // internal error +#define DKIM_POLICY_INVALID -53 // internal error /* dito #define DKIM_SIG_VERSION_PRE_02 0 #define DKIM_SIG_VERSION_02_PLUS 1 */ -class SelectorInfo -{ +class SelectorInfo { public: - SelectorInfo(const string &sSelector,const string &sDomain); - ~SelectorInfo(); + SelectorInfo(const string& sSelector, const string& sDomain); + ~SelectorInfo(); - string Domain; - string Selector; - string Granularity; - bool AllowSHA1; - bool AllowSHA256; - EVP_PKEY *PublicKey; /* the public key */ - bool Testing; - bool SameDomain; + string Domain; + string Selector; + string Granularity; + bool AllowSHA1; + bool AllowSHA256; + EVP_PKEY *PublicKey; /* the public key */ + bool Testing; + bool SameDomain; - int Status; + int Status; - int Parse(char* Buffer); + int Parse(char *Buffer); }; -class SignatureInfo -{ +class SignatureInfo { public: - SignatureInfo(bool SaveCanonicalizedData); - ~SignatureInfo(); - - void Hash(const char* szBuffer,unsigned nBufLength,bool IsBody=false); - - string Header; - unsigned Version; - string Domain; - string Selector; - string SignatureData; - string BodyHashData; - string IdentityLocalPart; - string IdentityDomain; - string CanonicalizedData; - vector SignedHeaders; - unsigned BodyLength; - unsigned HeaderCanonicalization; - unsigned BodyCanonicalization; - unsigned ExpireTime; - - unsigned VerifiedBodyCount; - unsigned UnverifiedBodyCount; - -#if ((OPENSSL_VERSION_NUMBER < 0x10100000L) || (LIBRESSL_VERSION_NUMBER > 0 && LIBRESSL_VERSION_NUMBER < 0x20700000L)) - EVP_MD_CTX m_Hdr_ctx; - EVP_MD_CTX m_Bdy_ctx; + SignatureInfo(bool SaveCanonicalizedData); + ~SignatureInfo(); + + void Hash(const char *szBuffer, unsigned nBufLength, bool IsBody = false); + + string Header; + unsigned Version; + string Domain; + string Selector; + string SignatureData; + string BodyHashData; + string IdentityLocalPart; + string IdentityDomain; + string CanonicalizedData; + vector SignedHeaders; + unsigned BodyLength; + unsigned HeaderCanonicalization; + unsigned BodyCanonicalization; + unsigned ExpireTime; + + unsigned VerifiedBodyCount; + unsigned UnverifiedBodyCount; + +#if ( \ + (OPENSSL_VERSION_NUMBER < 0x10100000L) \ + || (LIBRESSL_VERSION_NUMBER > 0 && LIBRESSL_VERSION_NUMBER < 0x20700000L)) + EVP_MD_CTX m_Hdr_ctx; + EVP_MD_CTX m_Bdy_ctx; #else - EVP_MD_CTX *m_Hdr_ctx; - EVP_MD_CTX *m_Bdy_ctx; + EVP_MD_CTX *m_Hdr_ctx; + EVP_MD_CTX *m_Bdy_ctx; #endif #if (OPENSSL_VERSION_NUMBER > 0x10101000L) - EVP_MD_CTX *m_Msg_ctx; + EVP_MD_CTX *m_Msg_ctx; #endif - SelectorInfo *m_pSelector; + SelectorInfo *m_pSelector; - int Status; - int m_nHash; // use one of the DKIM_HASH_xxx constants here - unsigned EmptyLineCount; - bool m_SaveCanonicalizedData; + int Status; + int m_nHash; // use one of the DKIM_HASH_xxx constants here + unsigned EmptyLineCount; + bool m_SaveCanonicalizedData; }; -class CDKIMVerify : public CDKIMBase -{ +class CDKIMVerify : public CDKIMBase { public: + CDKIMVerify(); + ~CDKIMVerify(); + // virtual ~CDKIMVerify() = 0; - CDKIMVerify(); - ~CDKIMVerify(); -// virtual ~CDKIMVerify() = 0; + int Init(DKIMVerifyOptions *pOptions); - int Init(DKIMVerifyOptions* pOptions); + int GetResults(void); + int GetDetails(int *nSigCount, DKIMVerifyDetails **pDetails); + // int _DNSGetTXT(const char* szFQDN,char* Buffer,int nBufLen); - int GetResults(void); - int GetDetails(int* nSigCount,DKIMVerifyDetails** pDetails); -// int _DNSGetTXT(const char* szFQDN,char* Buffer,int nBufLen); + virtual int ProcessHeaders(void); + virtual int ProcessBody(char *szBuffer, int nBufLength, bool bEOF); - virtual int ProcessHeaders(void); - virtual int ProcessBody(char* szBuffer,int nBufLength,bool bEOF); - - const char* GetPractices() { return Practices.c_str(); } + const char *GetPractices() + { + return Practices.c_str(); + } protected: + int ParseDKIMSignature(const string& sHeader, SignatureInfo& sig); - int ParseDKIMSignature(const string& sHeader,SignatureInfo &sig); - - SelectorInfo& GetSelector(const string &sSelector,const string &sDomain); + SelectorInfo& GetSelector(const string& sSelector, const string& sDomain); -// int GetADSP(const string &sDomain,int &iADSP); + // int GetADSP(const string &sDomain,int &iADSP); - list Signatures; - list Selectors; + list Signatures; + list Selectors; - DKIMDNSCALLBACK m_pfnSelectorCallback; // selector record callback -// DKIMDNSCALLBACK m_pfnPracticesCallback; // ADSP record callback + DKIMDNSCALLBACK m_pfnSelectorCallback; // selector record callback + // DKIMDNSCALLBACK m_pfnPracticesCallback; // ADSP record callback - bool m_HonorBodyLengthTag; - bool m_CheckPractices; - bool m_SubjectIsRequired; - bool m_SaveCanonicalizedData; - bool m_AllowUnsignedFromHeaders; + bool m_HonorBodyLengthTag; + bool m_CheckPractices; + bool m_SubjectIsRequired; + bool m_SaveCanonicalizedData; + bool m_AllowUnsignedFromHeaders; - vector Details; - string Practices; + vector Details; + string Practices; }; -#endif //DKIMVERIFY_H +#endif //DKIMVERIFY_H -- cgit v1.2.3