mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-02-02 15:01:05 +00:00
Document how tested prefix lengths are chosen
This commit is contained in:
parent
d27a88438f
commit
ef4183858a
|
@ -185,6 +185,10 @@ void parse_prefixes( const data_t *input,
|
||||||
size_t buffer_size;
|
size_t buffer_size;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
/* Test every prefix of the input, except the empty string.
|
||||||
|
* The first byte of the string is the tag. Without a tag byte,
|
||||||
|
* we wouldn't know what to parse the input as.
|
||||||
|
*/
|
||||||
for( buffer_size = 1; buffer_size <= input->len; buffer_size++ )
|
for( buffer_size = 1; buffer_size <= input->len; buffer_size++ )
|
||||||
{
|
{
|
||||||
test_set_step( buffer_size );
|
test_set_step( buffer_size );
|
||||||
|
@ -221,6 +225,12 @@ void get_len( const data_t *input, int actual_length_arg )
|
||||||
size_t actual_length = actual_length_arg;
|
size_t actual_length = actual_length_arg;
|
||||||
size_t buffer_size;
|
size_t buffer_size;
|
||||||
|
|
||||||
|
/* Test prefixes of a buffer containing the given length string
|
||||||
|
* followed by `actual_length` bytes of payload. To save a bit of
|
||||||
|
* time, we skip some "boring" prefixes: we don't test prefixes where
|
||||||
|
* the payload is truncated more than one byte away from either end,
|
||||||
|
* and we only test the empty string on a 1-byte input.
|
||||||
|
*/
|
||||||
for( buffer_size = 1; buffer_size <= input->len + 1; buffer_size++ )
|
for( buffer_size = 1; buffer_size <= input->len + 1; buffer_size++ )
|
||||||
{
|
{
|
||||||
if( ! get_len_step( input, buffer_size, actual_length ) )
|
if( ! get_len_step( input, buffer_size, actual_length ) )
|
||||||
|
|
Loading…
Reference in a new issue