From 6cf6b47b5ce6de55ff6817b6733745b4c7dfdee7 Mon Sep 17 00:00:00 2001 From: Jerry Yu Date: Tue, 16 Aug 2022 14:50:28 +0800 Subject: [PATCH] fix format and comment issues Signed-off-by: Jerry Yu --- library/ssl_tls.c | 2 +- library/ssl_tls13_keys.c | 6 +++--- library/ssl_tls13_keys.h | 6 +++--- library/ssl_tls13_server.c | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 1cda3a744..c0703a2c3 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -1710,7 +1710,7 @@ int mbedtls_ssl_set_hs_psk( mbedtls_ssl_context *ssl, #if defined(MBEDTLS_SSL_PROTO_TLS1_2) if( ssl->tls_version == MBEDTLS_SSL_VERSION_TLS1_2 ) { - if( ssl->handshake->ciphersuite_info->mac == MBEDTLS_MD_SHA384) + if( ssl->handshake->ciphersuite_info->mac == MBEDTLS_MD_SHA384 ) alg = PSA_ALG_TLS12_PSK_TO_MS( PSA_ALG_SHA_384 ); else alg = PSA_ALG_TLS12_PSK_TO_MS( PSA_ALG_SHA_256 ); diff --git a/library/ssl_tls13_keys.c b/library/ssl_tls13_keys.c index 8d01fc8dd..c5ec5bfbc 100644 --- a/library/ssl_tls13_keys.c +++ b/library/ssl_tls13_keys.c @@ -359,7 +359,7 @@ int mbedtls_ssl_tls13_evolve_secret( ret = 0; - if( ( input != NULL ) && ( input_len != 0 ) ) + if( input != NULL && input_len != 0 ) { memcpy( tmp_input, input, input_len ); ilen = input_len; @@ -1579,7 +1579,7 @@ int mbedtls_ssl_tls13_export_handshake_psk( mbedtls_ssl_context *ssl, return( 0 ); status = psa_get_key_attributes( ssl->handshake->psk_opaque, &key_attributes ); - if( status != PSA_SUCCESS) + if( status != PSA_SUCCESS ) { return( psa_ssl_status_to_mbedtls( status ) ); } @@ -1593,7 +1593,7 @@ int mbedtls_ssl_tls13_export_handshake_psk( mbedtls_ssl_context *ssl, status = psa_export_key( ssl->handshake->psk_opaque, (uint8_t *)*psk, *psk_len, psk_len ); - if( status != PSA_SUCCESS) + if( status != PSA_SUCCESS ) { mbedtls_free( (void *)*psk ); return( psa_ssl_status_to_mbedtls( status ) ); diff --git a/library/ssl_tls13_keys.h b/library/ssl_tls13_keys.h index c5baf2885..34c00a479 100644 --- a/library/ssl_tls13_keys.h +++ b/library/ssl_tls13_keys.h @@ -693,12 +693,12 @@ MBEDTLS_CHECK_RETURN_CRITICAL int mbedtls_ssl_tls13_compute_application_transform( mbedtls_ssl_context *ssl ); /** - * \brief Export TLS 1.3 PSK key from handshake context + * \brief Export TLS 1.3 PSK from handshake context * * \param ssl The SSL context to operate on. - * \param psk PSK key output pointer. + * \param psk PSK output pointer. * \param psk_len - * Length of PSK key. + * Length of PSK. * * \returns \c 0 on success. * \returns A negative error code on failure. diff --git a/library/ssl_tls13_server.c b/library/ssl_tls13_server.c index d52795954..04fa5de32 100644 --- a/library/ssl_tls13_server.c +++ b/library/ssl_tls13_server.c @@ -1057,9 +1057,9 @@ static int ssl_tls13_parse_client_hello( mbedtls_ssl_context *ssl, ciphersuite_info == NULL ? "Unkown": ciphersuite_info->name ) ); } -#else +#else /* MBEDTLS_DEBUG_C */ p = cipher_suites_end; -#endif /* MBEDTLS_DEBUG_C */ +#endif /* !MBEDTLS_DEBUG_C */ /* ... * opaque legacy_compression_methods<1..2^8-1>; @@ -1331,7 +1331,7 @@ static int ssl_tls13_parse_client_hello( mbedtls_ssl_context *ssl, * Search for a matching ciphersuite */ for ( const unsigned char * p_chiper_suite = cipher_suites ; - p_chiper_suite < cipher_suites_end; p_chiper_suite += 2 ) + p_chiper_suite < cipher_suites_end; p_chiper_suite += 2 ) { uint16_t cipher_suite; const mbedtls_ssl_ciphersuite_t* ciphersuite_info;