6 #ifndef _INC_cSSLSession_H
7 #define _INC_cSSLSession_H
13 #include "../Cert/cX509Crt.h"
35 BYTE m_MasterSecret[48];
46 , m_TimeStamp(
cTimeInt::GetTimeNow().GetTime())
49 cMem::Zero(m_MasterSecret,
sizeof(m_MasterSecret));
54 return(m_nIdSize >= 16 && m_nIdSize <=
sizeof(m_Id));
64 if (nIdSize != this->m_nIdSize || !isIdValid())
66 if (::memcmp(pId, this->m_Id, this->m_nIdSize) != 0)
82 return isMatchId(pSession);
85 void SetId(BYTE nIdSize,
const BYTE* pId)
87 BYTE nIdSizePrev = m_nIdSize;
90 ASSERT(nIdSize >= 16 && nIdSize <=
sizeof(m_Id));
91 ::memcpy(m_Id, pId, nIdSize);
94 if (nIdSize < nIdSizePrev)
96 ASSERT(nIdSizePrev >= 0 && nIdSizePrev <=
sizeof(m_Id));
97 cMem::Zero(m_Id + nIdSize, nIdSizePrev - nIdSizePrev);
105 return FVE_E_FIPS_RNG_CHECK_FAILED;
106 m_nIdSize =
sizeof(m_Id);
113 ASSERT(isMatchId(pSession));
114 ::memcpy(m_MasterSecret, pSession->
m_MasterSecret,
sizeof(m_MasterSecret));
123 ASSERT(m_nIdSize <=
sizeof(m_Id));
124 ::memcpy(m_Id, pSession->
m_Id, m_nIdSize);
125 SetPayload1(pSession);
147 , m_bEncryptThenMac(true)
148 , m_bTruncatedHMAC(true)
190 void SetZeroSession();
192 size_t WriteSession(BYTE* buf,
size_t buf_len)
const;
193 HRESULT ReadSession(
const BYTE* buf,
size_t len);
196 class cSSLSessionEntry;
214 void put_CacheMaxEntries(
int nMaxEntries);
217 virtual bool RestoreFromCache(
cSSLSession* pSession);
#define CATTR_PACKED
Definition: GrayCore.h:87
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
#define FAILED(x)
Definition: HResult.h:30
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
#define ASSERT(exp)
Definition: cDebugAssert.h:87
Definition: cSSLSession.h:22
SSL_CipherSuite_TYPE m_eCipherSuite
chosen ciphersuite. SSL_CipherSuite_TYPE
Definition: cSSLSession.h:31
bool isMatchId(BYTE nIdSize, const BYTE *pId) const
Definition: cSSLSession.h:62
SSL_COMPRESS_TYPE m_eCompression
chosen compression. SSL_COMPRESS_TYPE
Definition: cSSLSession.h:32
void SetPayload1(const cSSLSessionBase1 *pSession)
Definition: cSSLSession.h:110
BYTE m_nIdSize
session m_Id length actually used. >=16 && <=32
Definition: cSSLSession.h:28
cSSLSessionBase1() noexcept
Definition: cSSLSession.h:41
bool isMatchHead(const cSSLSessionBase1 *pSession) const
Definition: cSSLSession.h:76
TIMESEC_t m_TimeStamp
entry time stamp. cTimeInt // When last used.
Definition: cSSLSession.h:38
bool isIdValid() const noexcept
Definition: cSSLSession.h:52
BYTE m_Id[32]
session identifier. unique.
Definition: cSSLSession.h:27
BYTE get_IdSize() const noexcept
Definition: cSSLSession.h:57
void SetPayload2(const cSSLSessionBase1 *pSession)
Definition: cSSLSession.h:117
BYTE m_MasterSecret[48]
the master secret
Definition: cSSLSession.h:35
X509_Verify_t m_eVerifyResults
verification result
Definition: cSSLSession.h:36
void SetZeroSession()
Definition: cSSLSession.h:128
bool isMatchId(const cSSLSessionBase1 *pSession) const
Definition: cSSLSession.h:71
HRESULT SetIdRandom(IRandomNoise *pRandom)
Definition: cSSLSession.h:101
void SetId(BYTE nIdSize, const BYTE *pId)
Definition: cSSLSession.h:85
Definition: cSSLSession.h:154
void SetZeroSession() noexcept
Definition: cSSLSession.h:166
cSSLSessionBase2() noexcept
Definition: cSSLSession.h:163
Definition: cSSLSession.h:199
TIMESECD_t m_nTimeout
cache entry timeout
Definition: cSSLSession.h:206
cThreadLockMutex m_Mutex
mutex to lock the cache. _MT
Definition: cSSLSession.h:208
int m_nMaxEntries
maximum entries
Definition: cSSLSession.h:207
cSSLSessionEntry * m_pChain
start of the chain of stored sessions.
Definition: cSSLSession.h:205
Definition: cSSLSession.h:135
SSL_MAX_FRAG_TYPE m_eMaxFragLenCode
MaxFragmentLength chosen by us. RFC 6066.
Definition: cSSLSession.h:140
bool m_bTruncatedHMAC
negotiate truncated hmac? Enable support for RFC 6066 truncated HMAC in SSL.
Definition: cSSLSession.h:142
bool m_bEncryptThenMac
flag for encrypt-then-mac for use with CBC. Enable support for Encrypt-then-MAC, RFC 7366.
Definition: cSSLSession.h:141
cSSLSessionConfig() noexcept
Definition: cSSLSession.h:145
Definition: cSSLSession.h:175
cHeapBlock m_Ticket
RFC 5077 session ticket TLS_EXT_SessionTicket. Client only. opaque blob encrypted by server.
Definition: cSSLSession.h:184
cRefPtr< cX509Crt > m_pPeerCert
new peer X.509 cert chain. X509.v3 [X509] certificate of the peer. optional
Definition: cSSLSession.h:183
Definition: cRefPtr.h:225
Definition: cThreadLock.h:252
< similar to the MFC CTime and cTimeSpan, not as accurate or large ranged as COleDateTime
Definition: cTimeInt.h:101
X509_Verify_t
Definition: cX509.h:41
@ X509_VERIFY_INIT
All ok.
Definition: cX509.h:47
SSL_MAX_FRAG_TYPE
Definition: SSLTypes.h:170
@ SSL_MAX_FRAG_LEN_NONE
don't use this extension
Definition: SSLTypes.h:183
SSL_COMPRESS_TYPE
Definition: SSLTypes.h:79
@ SSL_COMPRESS_NULL
Definition: SSLTypes.h:82
SSL_CipherSuite_TYPE
Definition: SSLTypes.h:88
@ TLS_NULL_WITH_NULL_NULL
Definition: SSLTypes.h:100
int TIMESECD_t
signed delta seconds. like TIMESEC_t. redefined in TimeUnits.h.
Definition: cTimeSys.h:19
time_t TIMESEC_t
absolute seconds since January 1, 1970. (GMT?)(signed) NOTE: Changing to __time64_t just adds more ra...
Definition: cTimeUnits.h:23
virtual HRESULT GetNoise(void *pData, size_t iSize)=0
fill array with random bytes. return # bytes filled.
static void Zero(void *pData, size_t nSizeBlock) noexcept
Definition: cMem.h:100
static void ZeroSecure(void *pData, size_t nSizeBlock) noexcept
Definition: cMem.h:110