mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-02-24 11:56:53 +00:00
Add support for TLS 1.3 record protection to ssl_populate_transform()
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
This commit is contained in:
parent
447558df12
commit
f93c2d7ca5
|
@ -977,14 +977,24 @@ static int ssl_populate_transform( mbedtls_ssl_transform *transform,
|
||||||
* with mode and version:
|
* with mode and version:
|
||||||
* - For GCM and CCM in TLS 1.2, there's a static IV of 4 Bytes
|
* - For GCM and CCM in TLS 1.2, there's a static IV of 4 Bytes
|
||||||
* (to be concatenated with a dynamically chosen IV of 8 Bytes)
|
* (to be concatenated with a dynamically chosen IV of 8 Bytes)
|
||||||
* - For ChaChaPoly in TLS 1.2, there's a static IV of 12 Bytes
|
* - For ChaChaPoly in TLS 1.2, and all modes in TLS 1.3, there's
|
||||||
* (to be XOR'ed with the 8 Byte record sequence number).
|
* a static IV of 12 Bytes (to be XOR'ed with the 8 Byte record
|
||||||
|
* sequence number).
|
||||||
*/
|
*/
|
||||||
transform->ivlen = 12;
|
transform->ivlen = 12;
|
||||||
|
#if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL)
|
||||||
|
if( minor_ver == MBEDTLS_SSL_MINOR_VERSION_4 )
|
||||||
|
{
|
||||||
|
transform->fixed_ivlen = 12;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif /* MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */
|
||||||
|
{
|
||||||
if( cipher_info->mode == MBEDTLS_MODE_CHACHAPOLY )
|
if( cipher_info->mode == MBEDTLS_MODE_CHACHAPOLY )
|
||||||
transform->fixed_ivlen = 12;
|
transform->fixed_ivlen = 12;
|
||||||
else
|
else
|
||||||
transform->fixed_ivlen = 4;
|
transform->fixed_ivlen = 4;
|
||||||
|
}
|
||||||
|
|
||||||
/* Minimum length of encrypted record */
|
/* Minimum length of encrypted record */
|
||||||
explicit_ivlen = transform->ivlen - transform->fixed_ivlen;
|
explicit_ivlen = transform->ivlen - transform->fixed_ivlen;
|
||||||
|
|
Loading…
Reference in a new issue