FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/src/sniffer.c
/* Copies the session's information to the provided sslInfo. Skip copy if
 * SSLInfo is not provided. */
Copies the session's information to the provided sslInfo. Skip copy if
SSLInfo is not provided.
Copies the session ' s information to the provided sslInfo . Skip copy if SSLInfo is not provided .
static void CopySessionInfo(SnifferSession* session, SSLInfo* sslInfo)
{
    if (NULL != sslInfo) {
        XMEMSET(sslInfo, 0, sizeof(SSLInfo));
        if (0 != session->sslServer->options.cipherSuite) {
            const char* pCipher;
            sslInfo->isValid = 1;
            sslInfo->protocolVersionMajor = session->sslServer->version.major;
            sslInfo->protocolVersionMinor = session->sslServer->version.minor;
            sslInfo->serverCipherSuite0 =
                        session->sslServer->options.cipherSuite0;
            sslInfo->serverCipherSuite =
                        session->sslServer->options.cipherSuite;
            pCipher = wolfSSL_get_cipher(session->sslServer);
            if (NULL != pCipher) {
                XSTRNCPY((char*)sslInfo->serverCipherSuiteName, pCipher,
                         sizeof(sslInfo->serverCipherSuiteName));
                sslInfo->serverCipherSuiteName
                         [sizeof(sslInfo->serverCipherSuiteName) - 1] = '\0';
            }
            sslInfo->keySize = session->keySz;
        #ifdef HAVE_SNI
            if (NULL != session->sni) {
                XSTRNCPY((char*)sslInfo->serverNameIndication,
                         session->sni, sizeof(sslInfo->serverNameIndication));
                sslInfo->serverNameIndication
                         [sizeof(sslInfo->serverNameIndication) - 1] = '\0';
            }
        #endif
            TraceSessionInfo(sslInfo);
        }
    }
}
static void CopySessionInfo ( SnifferSession * session , SSLInfo * sslInfo ) { if ( NULL != sslInfo ) { XMEMSET ( sslInfo , 0 , sizeof ( SSLInfo ) ) ; if ( 0 != session -> sslServer -> options . cipherSuite ) { const char * pCipher ; sslInfo -> isValid = 1 ; sslInfo -> protocolVersionMajor = session -> sslServer -> version . major ; sslInfo -> protocolVersionMinor = session -> sslServer -> version . minor ; sslInfo -> serverCipherSuite0 = session -> sslServer -> options . cipherSuite0 ; sslInfo -> serverCipherSuite = session -> sslServer -> options . cipherSuite ; pCipher = wolfSSL_get_cipher ( session -> sslServer ) ; if ( NULL != pCipher ) { XSTRNCPY ( ( char * ) sslInfo -> serverCipherSuiteName , pCipher , sizeof ( sslInfo -> serverCipherSuiteName ) ) ; sslInfo -> serverCipherSuiteName [ sizeof ( sslInfo -> serverCipherSuiteName ) - 1 ] = ' \0 ' ; } sslInfo -> keySize = session -> keySz ; #ifdef HAVE_SNI if ( NULL != session -> sni ) { XSTRNCPY ( ( char * ) sslInfo -> serverNameIndication , session -> sni , sizeof ( sslInfo -> serverNameIndication ) ) ; sslInfo -> serverNameIndication [ sizeof ( sslInfo -> serverNameIndication ) - 1 ] = ' \0 ' ; } #endif TraceSessionInfo ( sslInfo ) ; } } }
Copies the session's information to the provided sslInfo.
Copies the session ' s information to the provided sslInfo .
/* Pass back Session Info after we have processed the Server Hello. */