mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-25 09:41:00 +00:00
Move update of in_xxx fields in ssl_get_next_record()
ssl_get_next_record() updates the legacy in_xxx fields in two places, once before record decryption and once after. Now that record decryption doesn't use or affect the in_xxx fields anymore, setting up the these legacy fields can entirely be moved to the end of ssl_get_next_record(), which is what this comit does. This commit solely moves existing code, but doesn't yet simplify the now partially redundant settings of the in_xxx fields. This will be done in a separate commit.
This commit is contained in:
parent
8685c822c1
commit
44d89b2d53
@ -6056,19 +6056,6 @@ static int ssl_get_next_record( mbedtls_ssl_context *ssl )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset in pointers to default state for TLS/DTLS records,
|
|
||||||
* assuming no CID and no offset between record content and
|
|
||||||
* record plaintext. */
|
|
||||||
ssl_update_in_pointers( ssl );
|
|
||||||
|
|
||||||
/* Setup internal message pointers from record structure. */
|
|
||||||
ssl->in_msgtype = rec.type;
|
|
||||||
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
|
|
||||||
ssl->in_len = ssl->in_cid + rec.cid_len;
|
|
||||||
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
|
|
||||||
ssl->in_iv = ssl->in_msg = ssl->in_len + 2;
|
|
||||||
ssl->in_msglen = rec.data_len;
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||||
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
|
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
|
||||||
{
|
{
|
||||||
@ -6161,6 +6148,20 @@ static int ssl_get_next_record( mbedtls_ssl_context *ssl )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Reset in pointers to default state for TLS/DTLS records,
|
||||||
|
* assuming no CID and no offset between record content and
|
||||||
|
* record plaintext. */
|
||||||
|
ssl_update_in_pointers( ssl );
|
||||||
|
|
||||||
|
/* Setup internal message pointers from record structure. */
|
||||||
|
ssl->in_msgtype = rec.type;
|
||||||
|
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
|
||||||
|
ssl->in_len = ssl->in_cid + rec.cid_len;
|
||||||
|
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
|
||||||
|
ssl->in_iv = ssl->in_msg = ssl->in_len + 2;
|
||||||
|
ssl->in_msglen = rec.data_len;
|
||||||
|
|
||||||
/* The record content type may change during decryption,
|
/* The record content type may change during decryption,
|
||||||
* so re-read it. */
|
* so re-read it. */
|
||||||
ssl->in_msgtype = rec.type;
|
ssl->in_msgtype = rec.type;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user