src/wolfSSL/src/internal.c
DtlsMsg* DtlsMsgNew(word32 sz, void* heap)
{
    DtlsMsg* msg = NULL;

    msg = (DtlsMsg*)XMALLOC(sizeof(DtlsMsg), heap, DYNAMIC_TYPE_DTLS_MSG);

    if (msg != NULL) {
        XMEMSET(msg, 0, sizeof(DtlsMsg));
        msg->buf = (byte*)XMALLOC(sz + DTLS_HANDSHAKE_HEADER_SZ,
                                                heap, DYNAMIC_TYPE_DTLS_BUFFER);
        if (msg->buf != NULL) {
            msg->sz = sz;
            msg->type = no_shake;
            msg->msg = msg->buf + DTLS_HANDSHAKE_HEADER_SZ;
        }
        else {
            XFREE(msg, heap, DYNAMIC_TYPE_DTLS_MSG);
            msg = NULL;
        }
    }

    return msg;
}
/* Need to allocate space for the handshake message header. The hashing
 * routines assume the message pointer is still within the buffer that
 * has the headers, and will include those headers in the hash. The store
 * routines need to take that into account as well. New will allocate
 * extra space for the headers. */
Need to allocate space for the handshake message header. The hashing
routines assume the message pointer is still within the buffer that
has the headers, and will include those headers in the hash. The store
routines need to take that into account as well. New will allocate
extra space for the headers.
Need to allocate space for the handshake message header . The hashing routines assume the message pointer is still within the buffer that has the headers and will include those headers in the hash . The store routines need to take that into account as well . New will allocate extra space for the headers .
DtlsMsg* DtlsMsgNew(word32 sz, void* heap)
{
    DtlsMsg* msg = NULL;
    msg = (DtlsMsg*)XMALLOC(sizeof(DtlsMsg), heap, DYNAMIC_TYPE_DTLS_MSG);
    if (msg != NULL) {
        XMEMSET(msg, 0, sizeof(DtlsMsg));
        msg->buf = (byte*)XMALLOC(sz + DTLS_HANDSHAKE_HEADER_SZ,
                                                heap, DYNAMIC_TYPE_DTLS_BUFFER);
        if (msg->buf != NULL) {
            msg->sz = sz;
            msg->type = no_shake;
            msg->msg = msg->buf + DTLS_HANDSHAKE_HEADER_SZ;
        }
        else {
            XFREE(msg, heap, DYNAMIC_TYPE_DTLS_MSG);
            msg = NULL;
        }
    }
    return msg;
}
DtlsMsg * DtlsMsgNew ( word32 sz , void * heap ) { DtlsMsg * msg = NULL ; msg = ( DtlsMsg * ) XMALLOC ( sizeof ( DtlsMsg ) , heap , DYNAMIC_TYPE_DTLS_MSG ) ; if ( msg != NULL ) { XMEMSET ( msg , 0 , sizeof ( DtlsMsg ) ) ; msg -> buf = ( byte * ) XMALLOC ( sz + DTLS_HANDSHAKE_HEADER_SZ , heap , DYNAMIC_TYPE_DTLS_BUFFER ) ; if ( msg -> buf != NULL ) { msg -> sz = sz ; msg -> type = no_shake ; msg -> msg = msg -> buf + DTLS_HANDSHAKE_HEADER_SZ ; } else { XFREE ( msg , heap , DYNAMIC_TYPE_DTLS_MSG ) ; msg = NULL ; } } return msg ; }
Need to allocate space for the handshake message header.
Need to allocate space for the handshake message header .