src/wolfSSL/src/internal.c
static void AddRecordHeader(byte* output, word32 length, byte type, WOLFSSL* ssl)
{
    RecordLayerHeader* rl;

    /* record layer header */
    rl = (RecordLayerHeader*)output;
    rl->type    = type;
    rl->pvMajor = ssl->version.major;       /* type and version same in each */
    rl->pvMinor = ssl->version.minor;

#ifdef WOLFSSL_ALTERNATIVE_DOWNGRADE
    if (ssl->options.side == WOLFSSL_CLIENT_END
    &&  ssl->options.connectState == CONNECT_BEGIN
    && !ssl->options.resuming)
        rl->pvMinor = ssl->options.downgrade ? ssl->options.minDowngrade
                                             : ssl->version.minor;
#endif

    if (!ssl->options.dtls)
        c16toa((word16)length, rl->length);
    else {
#ifdef WOLFSSL_DTLS
        DtlsRecordLayerHeader* dtls;

        /* dtls record layer header extensions */
        dtls = (DtlsRecordLayerHeader*)output;
        c16toa(ssl->keys.dtls_epoch, dtls->epoch);
        c32to48(ssl->keys.dtls_sequence_number++, dtls->sequence_number);
        c16toa((word16)length, dtls->length);
#endif
    }
}
/* add record layer header for message */
add record layer header for message
add record layer header for message
static void AddRecordHeader(byte* output, word32 length, byte type, WOLFSSL* ssl)
{
    RecordLayerHeader* rl;
    rl = (RecordLayerHeader*)output;
    rl->type    = type;
    rl->pvMajor = ssl->version.major;       
    rl->pvMinor = ssl->version.minor;
#ifdef WOLFSSL_ALTERNATIVE_DOWNGRADE
    if (ssl->options.side == WOLFSSL_CLIENT_END
    &&  ssl->options.connectState == CONNECT_BEGIN
    && !ssl->options.resuming)
        rl->pvMinor = ssl->options.downgrade ? ssl->options.minDowngrade
                                             : ssl->version.minor;
#endif
    if (!ssl->options.dtls)
        c16toa((word16)length, rl->length);
    else {
#ifdef WOLFSSL_DTLS
        DtlsRecordLayerHeader* dtls;
        dtls = (DtlsRecordLayerHeader*)output;
        c16toa(ssl->keys.dtls_epoch, dtls->epoch);
        c32to48(ssl->keys.dtls_sequence_number++, dtls->sequence_number);
        c16toa((word16)length, dtls->length);
#endif
    }
}
static void AddRecordHeader ( byte * output , word32 length , byte type , WOLFSSL * ssl ) { RecordLayerHeader * rl ; rl = ( RecordLayerHeader * ) output ; rl -> type = type ; rl -> pvMajor = ssl -> version . major ; rl -> pvMinor = ssl -> version . minor ; #ifdef WOLFSSL_ALTERNATIVE_DOWNGRADE if ( ssl -> options . side == WOLFSSL_CLIENT_END && ssl -> options . connectState == CONNECT_BEGIN && ! ssl -> options . resuming ) rl -> pvMinor = ssl -> options . downgrade ? ssl -> options . minDowngrade : ssl -> version . minor ; #endif if ( ! ssl -> options . dtls ) c16toa ( ( word16 ) length , rl -> length ) ; else { #ifdef WOLFSSL_DTLS DtlsRecordLayerHeader * dtls ; dtls = ( DtlsRecordLayerHeader * ) output ; c16toa ( ssl -> keys . dtls_epoch , dtls -> epoch ) ; c32to48 ( ssl -> keys . dtls_sequence_number ++ , dtls -> sequence_number ) ; c16toa ( ( word16 ) length , dtls -> length ) ; #endif } }
add record layer header for message
add record layer header for message
/* record layer header */ /* type and version same in each */ /* dtls record layer header extensions */