diff options
Diffstat (limited to 'src/include/dkimsign.h')
-rw-r--r-- | src/include/dkimsign.h | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/src/include/dkimsign.h b/src/include/dkimsign.h index 150a0b8..af1dd70 100644 --- a/src/include/dkimsign.h +++ b/src/include/dkimsign.h @@ -24,58 +24,60 @@ #include "dkimbase.h" -class CDKIMSign : public CDKIMBase -{ +class CDKIMSign : public CDKIMBase { public: CDKIMSign(); ~CDKIMSign(); //int Init() = delete; - int Init(DKIMSignOptions* pOptions); - int GetSig2(char* szRSAPrivKey,char* szECCPrivKey,char** pszSignature); + int Init(DKIMSignOptions *pOptions); + int GetSig2(char *szRSAPrivKey, char *szECCPrivKey, char **pszSignature); virtual int ProcessHeaders(void) override; - virtual int ProcessBody(char* szBuffer,int nBufLength,bool bEOF) override; + virtual int ProcessBody(char *szBuffer, int nBufLength, bool bEOF) override; - enum CKDKIMConstants { OptimalHeaderLineLength = 65 }; + enum CKDKIMConstants { + OptimalHeaderLineLength = 65 + }; - void Hash(const char* szBuffer,int nBufLength,bool bHdr); + void Hash(const char *szBuffer, int nBufLength, bool bHdr); protected: - bool SignThisTag(const string& sTag); void GetHeaderParams(const string& sHdr); void ProcessHeader(const string& sHdr); bool ParseFromAddress(void); void InitSig(void); - void AddTagToSig(const char* const Tag,const string &sValue,char cbrk,bool bFold); - void AddTagToSig(const char* const Tag,unsigned long nValue); + void AddTagToSig(const char *const Tag, const string& sValue, char cbrk, bool bFold); + void AddTagToSig(const char *const Tag, unsigned long nValue); void AddInterTagSpace(int nSizeOfNextTag); - void AddFoldedValueToSig(const string &sValue,char cbrk); + void AddFoldedValueToSig(const string& sValue, char cbrk); bool IsRequiredHeader(const string& sTag); - int ConstructSignature(char* szSignKey,int nSigAlg); + int ConstructSignature(char *szSignKey, int nSigAlg); - int AssembleReturnedSig(char* szRSAPrivKey,char* szECCPrivKey); + int AssembleReturnedSig(char *szRSAPrivKey, char *szECCPrivKey); -#if ((OPENSSL_VERSION_NUMBER < 0x10100000L) || (LIBRESSL_VERSION_NUMBER > 0 && LIBRESSL_VERSION_NUMBER < 0x20700000L)) - EVP_MD_CTX m_Hdr_sha1ctx; /* the RSA SHA1 signature */ - EVP_MD_CTX m_Hdr_sha256ctx; /* the RSA SHA256 signature */ +#if ( \ + (OPENSSL_VERSION_NUMBER < 0x10100000L) \ + || (LIBRESSL_VERSION_NUMBER > 0 && LIBRESSL_VERSION_NUMBER < 0x20700000L)) + EVP_MD_CTX m_Hdr_sha1ctx; /* the RSA SHA1 signature */ + EVP_MD_CTX m_Hdr_sha256ctx; /* the RSA SHA256 signature */ - EVP_MD_CTX m_Bdy_sha1ctx; /* the SHA1 digest */ - EVP_MD_CTX m_Bdy_sha256ctx; /* the SHA256 digest */ + EVP_MD_CTX m_Bdy_sha1ctx; /* the SHA1 digest */ + EVP_MD_CTX m_Bdy_sha256ctx; /* the SHA256 digest */ #else EVP_MD_CTX *m_Hdr_sha1ctx; /* the RSA SHA1 signature */ EVP_MD_CTX *m_Hdr_sha256ctx; /* the RSA SHA256 signature */ EVP_MD_CTX *m_Hdr_ed25519ctx; /* the PureEd25519 signature */ - EVP_MD_CTX *m_Bdy_sha1ctx; /* the SHA1 digest */ - EVP_MD_CTX *m_Bdy_sha256ctx; /* the SHA256 digest for RSA */ - EVP_MD_CTX *m_Edy_sha256ctx; /* the SHA256 digest for Ed25519 */ + EVP_MD_CTX *m_Bdy_sha1ctx; /* the SHA1 digest */ + EVP_MD_CTX *m_Bdy_sha256ctx; /* the SHA256 digest for RSA */ + EVP_MD_CTX *m_Edy_sha256ctx; /* the SHA256 digest for Ed25519 */ #endif - int m_Canon; /* canonization method */ + int m_Canon; /* canonization method */ int m_EmptyLineCount; @@ -83,9 +85,9 @@ protected: string sFrom; string sSender; string sSelector; - string eSelector; /* Used for Ed25519 signatures */ + string eSelector; /* Used for Ed25519 signatures */ string sDomain; - string sIdentity; /* for i= tag, if empty tag will not be included in sig */ + string sIdentity; /* for i= tag, if empty tag will not be included in sig */ string sRequiredHeaders; bool m_IncludeBodyLengthTag; @@ -98,7 +100,7 @@ protected: DKIMHEADERCALLBACK m_pfnHdrCallback; - string m_sSig; // DKIM-Signature .... + string m_sSig; // DKIM-Signature .... int m_nSigPos; string m_sReturnedSig; @@ -110,4 +112,4 @@ protected: int m_SigHdrs; }; -#endif // DKIMSIGN_H +#endif // DKIMSIGN_H |