Amend vector variables

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron 2021-09-27 13:58:21 +02:00
parent b194466e99
commit 99733f0511

View File

@ -242,25 +242,24 @@ TLS 1.3 specific coding rules:
length in bytes of the vector, where <vector name> is the name of the length in bytes of the vector, where <vector name> is the name of the
vector as defined in the TLS 1.3 specification. vector as defined in the TLS 1.3 specification.
- Use `<vector_name>_len_ptr` for the name of a variable intended to hold - Use `p_<vector_name>_len` for the name of a variable intended to hold
the address of the first byte of the vector length. the address of the first byte of the vector length.
- Use `<vector_name>_ptr` for the name of a variable intended to hold the - Use `<vector_name>` for the name of a variable intended to hold the
address of the first byte of the vector value. address of the first byte of the vector value.
- Use `<vector_name>_end_ptr` for the name of a variable intended to hold - Use `<vector_name>_end` for the name of a variable intended to hold
the address of the first byte past the vector value. the address of the first byte past the vector value.
Those two last idioms should lower the risk of mis-using one of the address Those idioms should lower the risk of mis-using one of the address in place
in place of the other one which could potentially lead to some nasty of another one which could potentially lead to some nasty issues.
issues.
Example: `cipher_suites` vector of ClientHello in Example: `cipher_suites` vector of ClientHello in
`ssl_tls1_3_write_client_hello_cipher_suites()` `ssl_tls1_3_write_client_hello_cipher_suites()`
``` ```
size_t cipher_suites_len; size_t cipher_suites_len;
unsigned char *cipher_suites_len_ptr; unsigned char *p_cipher_suites_len;
unsigned char *cipher_suites_ptr; unsigned char *cipher_suites;
``` ```
- Use of MBEDTLS_BYTE_xyz, MBEDTLS_PUT/GET_xyz, MBEDTLS_SSL_CHK_BUF_PTR - Use of MBEDTLS_BYTE_xyz, MBEDTLS_PUT/GET_xyz, MBEDTLS_SSL_CHK_BUF_PTR