mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-23 03:35:39 +01:00
Fix multiple quality issues in the source
This PR fixes multiple issues in the source code to address issues raised by tests/scripts/check-files.py. Specifically: * incorrect file permissions * missing newline at the end of files * trailing whitespace * Tabs present * TODOs in the souce code
This commit is contained in:
parent
b9197bffd0
commit
ad761c45b9
2
include/mbedtls/ssl.h
Executable file → Normal file
2
include/mbedtls/ssl.h
Executable file → Normal file
@ -1587,7 +1587,7 @@ void mbedtls_ssl_conf_sig_hashes( mbedtls_ssl_config *conf,
|
|||||||
*
|
*
|
||||||
* \param ssl SSL context
|
* \param ssl SSL context
|
||||||
* \param hostname the server hostname, may be NULL to clear hostname
|
* \param hostname the server hostname, may be NULL to clear hostname
|
||||||
|
*
|
||||||
* \note Maximum hostname length MBEDTLS_SSL_MAX_HOST_NAME_LEN.
|
* \note Maximum hostname length MBEDTLS_SSL_MAX_HOST_NAME_LEN.
|
||||||
*
|
*
|
||||||
* \return 0 if successful, MBEDTLS_ERR_SSL_ALLOC_FAILED on
|
* \return 0 if successful, MBEDTLS_ERR_SSL_ALLOC_FAILED on
|
||||||
|
@ -205,7 +205,6 @@ int mbedtls_asn1_write_int( unsigned char **p, unsigned char *start, int val )
|
|||||||
int ret;
|
int ret;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
|
||||||
// TODO negative values and values larger than 128
|
|
||||||
// DER format assumes 2s complement for numbers, so the leftmost bit
|
// DER format assumes 2s complement for numbers, so the leftmost bit
|
||||||
// should be 0 for positive numbers and 1 for negative numbers.
|
// should be 0 for positive numbers and 1 for negative numbers.
|
||||||
//
|
//
|
||||||
|
@ -1890,8 +1890,6 @@ static int ssl_parse_server_psk_hint( mbedtls_ssl_context *ssl,
|
|||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Retrieve PSK identity hint and callback to app
|
|
||||||
//
|
|
||||||
*p += len;
|
*p += len;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
@ -2464,9 +2462,6 @@ static int ssl_parse_certificate_request( mbedtls_ssl_context *ssl )
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: handshake_failure alert for an anonymous server to request
|
|
||||||
// client authentication
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* struct {
|
* struct {
|
||||||
* ClientCertificateType certificate_types<1..2^8-1>;
|
* ClientCertificateType certificate_types<1..2^8-1>;
|
||||||
@ -2538,7 +2533,6 @@ static int ssl_parse_certificate_request( mbedtls_ssl_context *ssl )
|
|||||||
if( ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_3 )
|
if( ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_3 )
|
||||||
{
|
{
|
||||||
/* Ignored, see comments about hash in write_certificate_verify */
|
/* Ignored, see comments about hash in write_certificate_verify */
|
||||||
// TODO: should check the signature part against our pk_key though
|
|
||||||
size_t sig_alg_len = ( ( buf[mbedtls_ssl_hs_hdr_len( ssl ) + 1 + n] << 8 )
|
size_t sig_alg_len = ( ( buf[mbedtls_ssl_hs_hdr_len( ssl ) + 1 + n] << 8 )
|
||||||
| ( buf[mbedtls_ssl_hs_hdr_len( ssl ) + 2 + n] ) );
|
| ( buf[mbedtls_ssl_hs_hdr_len( ssl ) + 2 + n] ) );
|
||||||
#if defined(MBEDTLS_DEBUG_C)
|
#if defined(MBEDTLS_DEBUG_C)
|
||||||
@ -2580,7 +2574,6 @@ static int ssl_parse_certificate_request( mbedtls_ssl_context *ssl )
|
|||||||
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */
|
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */
|
||||||
|
|
||||||
/* Ignore certificate_authorities, we only have one cert anyway */
|
/* Ignore certificate_authorities, we only have one cert anyway */
|
||||||
// TODO: should not send cert if no CA matches
|
|
||||||
dn_len = ( ( buf[mbedtls_ssl_hs_hdr_len( ssl ) + 1 + n] << 8 )
|
dn_len = ( ( buf[mbedtls_ssl_hs_hdr_len( ssl ) + 1 + n] << 8 )
|
||||||
| ( buf[mbedtls_ssl_hs_hdr_len( ssl ) + 2 + n] ) );
|
| ( buf[mbedtls_ssl_hs_hdr_len( ssl ) + 2 + n] ) );
|
||||||
|
|
||||||
|
@ -3744,7 +3744,6 @@ static int ssl_prepare_record_content( mbedtls_ssl_context *ssl )
|
|||||||
return( ret );
|
return( ret );
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: what's the purpose of these lines? is in_len used?
|
|
||||||
ssl->in_len[0] = (unsigned char)( ssl->in_msglen >> 8 );
|
ssl->in_len[0] = (unsigned char)( ssl->in_msglen >> 8 );
|
||||||
ssl->in_len[1] = (unsigned char)( ssl->in_msglen );
|
ssl->in_len[1] = (unsigned char)( ssl->in_msglen );
|
||||||
}
|
}
|
||||||
@ -5170,7 +5169,6 @@ int mbedtls_ssl_write_finished( mbedtls_ssl_context *ssl )
|
|||||||
|
|
||||||
ssl->handshake->calc_finished( ssl, ssl->out_msg + 4, ssl->conf->endpoint );
|
ssl->handshake->calc_finished( ssl, ssl->out_msg + 4, ssl->conf->endpoint );
|
||||||
|
|
||||||
// TODO TLS/1.2 Hash length is determined by cipher suite (Page 63)
|
|
||||||
hash_len = ( ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_0 ) ? 36 : 12;
|
hash_len = ( ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_0 ) ? 36 : 12;
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_RENEGOTIATION)
|
#if defined(MBEDTLS_SSL_RENEGOTIATION)
|
||||||
|
@ -522,9 +522,6 @@ static int x509_get_subject_alt_name( unsigned char **p,
|
|||||||
/*
|
/*
|
||||||
* X.509 v3 extensions
|
* X.509 v3 extensions
|
||||||
*
|
*
|
||||||
* TODO: Perform all of the basic constraints tests required by the RFC
|
|
||||||
* TODO: Set values for undetected extensions to a sane default?
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
static int x509_get_crt_ext( unsigned char **p,
|
static int x509_get_crt_ext( unsigned char **p,
|
||||||
const unsigned char *end,
|
const unsigned char *end,
|
||||||
@ -1638,12 +1635,6 @@ static int x509_crt_verifycrl( mbedtls_x509_crt *crt, mbedtls_x509_crt *ca,
|
|||||||
if( ca == NULL )
|
if( ca == NULL )
|
||||||
return( flags );
|
return( flags );
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: What happens if no CRL is present?
|
|
||||||
* Suggestion: Revocation state should be unknown if no CRL is present.
|
|
||||||
* For backwards compatibility this is not yet implemented.
|
|
||||||
*/
|
|
||||||
|
|
||||||
while( crl_list != NULL )
|
while( crl_list != NULL )
|
||||||
{
|
{
|
||||||
if( crl_list->version == 0 ||
|
if( crl_list->version == 0 ||
|
||||||
|
@ -214,7 +214,6 @@ int mbedtls_x509_csr_parse_der( mbedtls_x509_csr *csr,
|
|||||||
mbedtls_x509_csr_free( csr );
|
mbedtls_x509_csr_free( csr );
|
||||||
return( MBEDTLS_ERR_X509_INVALID_FORMAT + ret );
|
return( MBEDTLS_ERR_X509_INVALID_FORMAT + ret );
|
||||||
}
|
}
|
||||||
// TODO Parse Attributes / extension requests
|
|
||||||
|
|
||||||
p += len;
|
p += len;
|
||||||
|
|
||||||
|
0
tests/scripts/run-test-suites.pl
Normal file → Executable file
0
tests/scripts/run-test-suites.pl
Normal file → Executable file
@ -53,3 +53,4 @@ void ssl_set_hostname_twice( char *hostname0, char *hostname1 )
|
|||||||
mbedtls_ssl_free( &ssl );
|
mbedtls_ssl_free( &ssl );
|
||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user