mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-03-22 18:15:14 +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
bf256cdb0b
commit
bd70c8e771
|
@ -5890,19 +5890,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( MBEDTLS_SSL_TRANSPORT_IS_DTLS( ssl->conf->transport ) )
|
||||
{
|
||||
|
@ -5997,6 +5984,20 @@ static int ssl_get_next_record( mbedtls_ssl_context *ssl )
|
|||
#endif /* MBEDTLS_SSL_PROTO_TLS */
|
||||
}
|
||||
|
||||
|
||||
/* 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,
|
||||
* so re-read it. */
|
||||
ssl->in_msgtype = rec.type;
|
||||
|
|
Loading…
Reference in a new issue