src/wolfSSL/src/internal.c
static int HashInput(WOLFSSL* ssl, const byte* input, int sz)
{
    const byte* adj = input - HANDSHAKE_HEADER_SZ;
    sz += HANDSHAKE_HEADER_SZ;

#ifdef WOLFSSL_DTLS
    if (ssl->options.dtls) {
        adj -= DTLS_HANDSHAKE_EXTRA;
        sz  += DTLS_HANDSHAKE_EXTRA;
    }
#endif

#ifndef NO_OLD_TLS
#ifndef NO_SHA
    wc_ShaUpdate(&ssl->hsHashes->hashSha, adj, sz);
#endif
#ifndef NO_MD5
    wc_Md5Update(&ssl->hsHashes->hashMd5, adj, sz);
#endif
#endif

    if (IsAtLeastTLSv1_2(ssl)) {
        int ret;

#ifndef NO_SHA256
        ret = wc_Sha256Update(&ssl->hsHashes->hashSha256, adj, sz);
        if (ret != 0)
            return ret;
#endif
#ifdef WOLFSSL_SHA384
        ret = wc_Sha384Update(&ssl->hsHashes->hashSha384, adj, sz);
        if (ret != 0)
            return ret;
#endif
#ifdef WOLFSSL_SHA512
        ret = wc_Sha512Update(&ssl->hsHashes->hashSha512, adj, sz);
        if (ret != 0)
            return ret;
#endif
    }

    return 0;
}
/* add input to md5 and sha handshake hashes, include handshake header */
add input to md5 and sha handshake hashes, include handshake header
add input to md5 and sha handshake hashes include handshake header
static int HashInput(WOLFSSL* ssl, const byte* input, int sz)
{
    const byte* adj = input - HANDSHAKE_HEADER_SZ;
    sz += HANDSHAKE_HEADER_SZ;
#ifdef WOLFSSL_DTLS
    if (ssl->options.dtls) {
        adj -= DTLS_HANDSHAKE_EXTRA;
        sz  += DTLS_HANDSHAKE_EXTRA;
    }
#endif
#ifndef NO_OLD_TLS
#ifndef NO_SHA
    wc_ShaUpdate(&ssl->hsHashes->hashSha, adj, sz);
#endif
#ifndef NO_MD5
    wc_Md5Update(&ssl->hsHashes->hashMd5, adj, sz);
#endif
#endif
    if (IsAtLeastTLSv1_2(ssl)) {
        int ret;
#ifndef NO_SHA256
        ret = wc_Sha256Update(&ssl->hsHashes->hashSha256, adj, sz);
        if (ret != 0)
            return ret;
#endif
#ifdef WOLFSSL_SHA384
        ret = wc_Sha384Update(&ssl->hsHashes->hashSha384, adj, sz);
        if (ret != 0)
            return ret;
#endif
#ifdef WOLFSSL_SHA512
        ret = wc_Sha512Update(&ssl->hsHashes->hashSha512, adj, sz);
        if (ret != 0)
            return ret;
#endif
    }
    return 0;
}
static int HashInput ( WOLFSSL * ssl , const byte * input , int sz ) { const byte * adj = input - HANDSHAKE_HEADER_SZ ; sz += HANDSHAKE_HEADER_SZ ; #ifdef WOLFSSL_DTLS if ( ssl -> options . dtls ) { adj -= DTLS_HANDSHAKE_EXTRA ; sz += DTLS_HANDSHAKE_EXTRA ; } #endif #ifndef NO_OLD_TLS #ifndef NO_SHA wc_ShaUpdate ( & ssl -> hsHashes -> hashSha , adj , sz ) ; #endif #ifndef NO_MD5 wc_Md5Update ( & ssl -> hsHashes -> hashMd5 , adj , sz ) ; #endif #endif if ( IsAtLeastTLSv1_2 ( ssl ) ) { int ret ; #ifndef NO_SHA256 ret = wc_Sha256Update ( & ssl -> hsHashes -> hashSha256 , adj , sz ) ; if ( ret != 0 ) return ret ; #endif #ifdef WOLFSSL_SHA384 ret = wc_Sha384Update ( & ssl -> hsHashes -> hashSha384 , adj , sz ) ; if ( ret != 0 ) return ret ; #endif #ifdef WOLFSSL_SHA512 ret = wc_Sha512Update ( & ssl -> hsHashes -> hashSha512 , adj , sz ) ; if ( ret != 0 ) return ret ; #endif } return 0 ; }
add input to md5 and sha handshake hashes, include handshake header
add input to md5 and sha handshake hashes include handshake header