src/wolfSSL/src/internal.c
int DoClientTicket(WOLFSSL* ssl, const byte* input, word32 len)
    {
        ExternalTicket* et;
        InternalTicket* it;
        int             ret;
        int             outLen;
        word16          inLen;

        if (len > SESSION_TICKET_LEN ||
             len < (word32)(sizeof(InternalTicket) + WOLFSSL_TICKET_FIXED_SZ)) {
            return BAD_TICKET_MSG_SZ;
        }

        et = (ExternalTicket*)input;
        it = (InternalTicket*)et->enc_ticket;

        /* decrypt */
        ato16(et->enc_len, &inLen);
        if (inLen > (word16)(len - WOLFSSL_TICKET_FIXED_SZ)) {
            return BAD_TICKET_MSG_SZ;
        }
        outLen = inLen;   /* may be reduced by user padding */
        ret = ssl->ctx->ticketEncCb(ssl, et->key_name, et->iv,
                                    et->enc_ticket + inLen, 0,
                                    et->enc_ticket, inLen, &outLen,
                                    ssl->ctx->ticketEncCtx);
        if (ret == WOLFSSL_TICKET_RET_FATAL || ret < 0) return ret;
        if (outLen > inLen || outLen < (int)sizeof(InternalTicket)) {
            WOLFSSL_MSG("Bad user ticket decrypt len");
            return BAD_TICKET_KEY_CB_SZ;
        }

        /* get master secret */
        if (ret == WOLFSSL_TICKET_RET_OK || ret == WOLFSSL_TICKET_RET_CREATE)
            XMEMCPY(ssl->arrays->masterSecret, it->msecret, SECRET_LEN);

        return ret;
    }
/* Parse ticket sent by client, returns callback return value */
Parse ticket sent by client, returns callback return value
Parse ticket sent by client returns callback return value
int DoClientTicket(WOLFSSL* ssl, const byte* input, word32 len)
    {
        ExternalTicket* et;
        InternalTicket* it;
        int             ret;
        int             outLen;
        word16          inLen;
        if (len > SESSION_TICKET_LEN ||
             len < (word32)(sizeof(InternalTicket) + WOLFSSL_TICKET_FIXED_SZ)) {
            return BAD_TICKET_MSG_SZ;
        }
        et = (ExternalTicket*)input;
        it = (InternalTicket*)et->enc_ticket;
        ato16(et->enc_len, &inLen);
        if (inLen > (word16)(len - WOLFSSL_TICKET_FIXED_SZ)) {
            return BAD_TICKET_MSG_SZ;
        }
        outLen = inLen;   
        ret = ssl->ctx->ticketEncCb(ssl, et->key_name, et->iv,
                                    et->enc_ticket + inLen, 0,
                                    et->enc_ticket, inLen, &outLen,
                                    ssl->ctx->ticketEncCtx);
        if (ret == WOLFSSL_TICKET_RET_FATAL || ret < 0) return ret;
        if (outLen > inLen || outLen < (int)sizeof(InternalTicket)) {
            WOLFSSL_MSG("Bad user ticket decrypt len");
            return BAD_TICKET_KEY_CB_SZ;
        }
        if (ret == WOLFSSL_TICKET_RET_OK || ret == WOLFSSL_TICKET_RET_CREATE)
            XMEMCPY(ssl->arrays->masterSecret, it->msecret, SECRET_LEN);
        return ret;
    }
int DoClientTicket ( WOLFSSL * ssl , const byte * input , word32 len ) { ExternalTicket * et ; InternalTicket * it ; int ret ; int outLen ; word16 inLen ; if ( len > SESSION_TICKET_LEN || len < ( word32 ) ( sizeof ( InternalTicket ) + WOLFSSL_TICKET_FIXED_SZ ) ) { return BAD_TICKET_MSG_SZ ; } et = ( ExternalTicket * ) input ; it = ( InternalTicket * ) et -> enc_ticket ; ato16 ( et -> enc_len , & inLen ) ; if ( inLen > ( word16 ) ( len - WOLFSSL_TICKET_FIXED_SZ ) ) { return BAD_TICKET_MSG_SZ ; } outLen = inLen ; ret = ssl -> ctx -> ticketEncCb ( ssl , et -> key_name , et -> iv , et -> enc_ticket + inLen , 0 , et -> enc_ticket , inLen , & outLen , ssl -> ctx -> ticketEncCtx ) ; if ( ret == WOLFSSL_TICKET_RET_FATAL || ret < 0 ) return ret ; if ( outLen > inLen || outLen < ( int ) sizeof ( InternalTicket ) ) { WOLFSSL_MSG ( " " ) ; return BAD_TICKET_KEY_CB_SZ ; } if ( ret == WOLFSSL_TICKET_RET_OK || ret == WOLFSSL_TICKET_RET_CREATE ) XMEMCPY ( ssl -> arrays -> masterSecret , it -> msecret , SECRET_LEN ) ; return ret ; }
Parse ticket sent by client, returns callback return value
Parse ticket sent by client returns callback return value
/* decrypt */ /* may be reduced by user padding */ /* get master secret */