Clarify comment about integer division by a variable

This commit is contained in:
Gilles Peskine 2018-06-04 11:58:44 +02:00
parent 20b4408fbd
commit 1bd9d58b21

View File

@ -2005,9 +2005,10 @@ static int ssl_decrypt_buf( mbedtls_ssl_context *ssl )
* correctly. We round down instead of up, so -56 is the correct * correctly. We round down instead of up, so -56 is the correct
* value for our calculations instead of -55. * value for our calculations instead of -55.
* *
* Repeat the formula rather than defining a block_size variable * Repeat the formula rather than defining a block_size variable.
* so that the code only uses division by a constant, not division * This avoids requiring division by a variable at runtime
* by a variable. * (which would be marginally less efficient and would require
* linking an extra division function in some builds).
*/ */
size_t j, extra_run = 0; size_t j, extra_run = 0;
switch( ssl->transform_in->ciphersuite_info->mac ) switch( ssl->transform_in->ciphersuite_info->mac )