fix usage of iteration
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
diff --git a/library/ssl_tls13_client.c b/library/ssl_tls13_client.c
index fe2e6f8..b10e33b 100644
--- a/library/ssl_tls13_client.c
+++ b/library/ssl_tls13_client.c
@@ -132,9 +132,9 @@
unsigned char *end,
size_t *olen )
{
+ unsigned char *p = buf; /* Iteration over the cipher_suites list */
const int *ciphersuite_list;
unsigned char *cipher_suites_ptr; /* Start of the cipher_suites list */
- unsigned char *p; /* Iteration over the cipher_suites list */
size_t cipher_suites_len;
*olen = 0 ;
@@ -150,12 +150,11 @@
ciphersuite_list = ssl->conf->ciphersuite_list;
/* Check there is space for the cipher suite list length (2 bytes). */
- MBEDTLS_SSL_CHK_BUF_PTR( buf, end, 2 );
+ MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 );
+ p += 2;
/* Write cipher_suites */
- cipher_suites_ptr = buf + 2;
- p = cipher_suites_ptr;
-
+ cipher_suites_ptr = p;
for ( size_t i = 0; ciphersuite_list[i] != 0; i++ )
{
int cipher_suite = ciphersuite_list[i];