mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-01 22:14:24 +01:00
Improve comments about padlen convention
The convention from the TLS RFC is a bit unusual, so even if the test function's introductory comment mentions that we're taking the RFC's definition, it doesn't hurt to repeat it in crucial places. Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
parent
b51f04466f
commit
e55653f085
@ -3479,7 +3479,7 @@ void ssl_decrypt_non_etm_cbc( int cipher_type, int hash_id, int trunc_hmac,
|
|||||||
unsigned char *buf = NULL, *buf_save = NULL;
|
unsigned char *buf = NULL, *buf_save = NULL;
|
||||||
size_t buflen, olen = 0;
|
size_t buflen, olen = 0;
|
||||||
size_t plaintext_len, block_size, i;
|
size_t plaintext_len, block_size, i;
|
||||||
unsigned char padlen;
|
unsigned char padlen; /* excluding the padding_length byte */
|
||||||
unsigned char add_data[13];
|
unsigned char add_data[13];
|
||||||
unsigned char mac[MBEDTLS_MD_MAX_SIZE];
|
unsigned char mac[MBEDTLS_MD_MAX_SIZE];
|
||||||
int exp_ret;
|
int exp_ret;
|
||||||
@ -3502,7 +3502,8 @@ void ssl_decrypt_non_etm_cbc( int cipher_type, int hash_id, int trunc_hmac,
|
|||||||
{
|
{
|
||||||
plaintext_len = 0;
|
plaintext_len = 0;
|
||||||
|
|
||||||
/* Minimal padding */
|
/* Minimal padding
|
||||||
|
* The +1 is for the padding_length byte, not counted in padlen. */
|
||||||
padlen = block_size - ( t0.maclen + 1 ) % block_size;
|
padlen = block_size - ( t0.maclen + 1 ) % block_size;
|
||||||
|
|
||||||
/* Maximal padding? */
|
/* Maximal padding? */
|
||||||
@ -3513,7 +3514,8 @@ void ssl_decrypt_non_etm_cbc( int cipher_type, int hash_id, int trunc_hmac,
|
|||||||
{
|
{
|
||||||
padlen = length_selector;
|
padlen = length_selector;
|
||||||
|
|
||||||
/* Minimal non-zero plaintext_length givin desired padding */
|
/* Minimal non-zero plaintext_length giving desired padding.
|
||||||
|
* The +1 is for the padding_length byte, not counted in padlen. */
|
||||||
plaintext_len = block_size - ( padlen + t0.maclen + 1 ) % block_size;
|
plaintext_len = block_size - ( padlen + t0.maclen + 1 ) % block_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user