Skip to content

Commit

Permalink
Improved description with information about allowed values.
Browse files Browse the repository at this point in the history
Simplified the calculations for the max_fragment_size value in bytes.
  • Loading branch information
Slavey Karadzhov authored and igrr committed Feb 18, 2018
1 parent 9c6183e commit f7e7a5b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ssl/ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ EXP_FUNC void STDCALL ssl_ext_set_host_name(SSL_EXTENSIONS * ext, const char* ho
/**
* @brief Set the maximum fragment size for the fragment size negotiation extension
* @param ssl_ext pointer returned by ssl_ext_new
* @param fragment_size fragment size, allowed values: 0/1/2/3/4 corresponding to off/512/1024/2048/4096 bytes
* @param fragment_size fragment size, allowed values: 0,1,2,3..6 corresponding to off,512,1024,2048..16384 bytes
*/
EXP_FUNC void STDCALL ssl_ext_set_max_fragment_size(SSL_EXTENSIONS * ext, uint8_t fragment_size);

Expand Down
2 changes: 1 addition & 1 deletion ssl/tls1.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ typedef struct
{
const char *host_name; /* Needed for the SNI support */
/* Needed for the Max Fragment Size Extension.
Allowed values: 0/1/2/3/4 corresponding to off/512/1024/2048/4096 bytes
Allowed values: 0,1,2,3..6 corresponding to off,512,1024,2048..16384 bytes
*/
uint8_t max_fragment_size;
} SSL_EXTENSIONS;
Expand Down
2 changes: 1 addition & 1 deletion ssl/tls1_clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ static int process_server_hello(SSL *ssl)
goto error;
}

ssl->max_plain_length = 512 << (ext_val - 1);
ssl->max_plain_length = 1 << (8 + ext_val); // 2 ^ (8 + ext_val)
}

offset += ext_len;
Expand Down

0 comments on commit f7e7a5b

Please sign in to comment.