thirdparty: improve -cstrict -cc clang-18 -prod compatibility for programs that do import net.mbedtls

This commit is contained in:
Delyan Angelov 2025-02-10 21:18:36 +02:00
parent e129ec5b7a
commit dacc738c96
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
4 changed files with 18 additions and 15 deletions

View File

@ -576,6 +576,7 @@ int mbedtls_pk_sign_restartable( mbedtls_pk_context *ctx,
if( ( md_alg != MBEDTLS_MD_NONE || hash_len != 0 ) && hash == NULL )
return MBEDTLS_ERR_PK_BAD_INPUT_DATA;
if( ctx == NULL ) return MBEDTLS_ERR_PK_BAD_INPUT_DATA;
if( ctx->pk_info == NULL || pk_hashlen_helper( md_alg, &hash_len ) != 0 )
return( MBEDTLS_ERR_PK_BAD_INPUT_DATA );

View File

@ -1582,26 +1582,30 @@ static inline mbedtls_ssl_srtp_profile mbedtls_ssl_check_srtp_profile_value
#if defined(MBEDTLS_X509_CRT_PARSE_C)
static inline mbedtls_pk_context *mbedtls_ssl_own_key( mbedtls_ssl_context *ssl )
{
if( NULL == ssl) return NULL;
mbedtls_ssl_key_cert *key_cert;
if( ssl->handshake != NULL && ssl->handshake->key_cert != NULL )
if( ssl->handshake != NULL && ssl->handshake->key_cert != NULL ) {
key_cert = ssl->handshake->key_cert;
else
} else {
if( NULL == ssl->conf ) return NULL;
key_cert = ssl->conf->key_cert;
return( key_cert == NULL ? NULL : key_cert->key );
}
if( NULL == key_cert) return NULL;
return key_cert->key;
}
static inline mbedtls_x509_crt *mbedtls_ssl_own_cert( mbedtls_ssl_context *ssl )
{
if( NULL == ssl) return NULL;
mbedtls_ssl_key_cert *key_cert;
if( ssl->handshake != NULL && ssl->handshake->key_cert != NULL )
if( ssl->handshake != NULL && ssl->handshake->key_cert != NULL ) {
key_cert = ssl->handshake->key_cert;
else
} else {
if( NULL == ssl->conf ) return NULL;
key_cert = ssl->conf->key_cert;
return( key_cert == NULL ? NULL : key_cert->cert );
}
if( NULL == key_cert) return NULL;
return key_cert->cert;
}
/*

View File

@ -3774,9 +3774,8 @@ int mbedtls_ssl_handshake( mbedtls_ssl_context *ssl )
/* Sanity checks */
if( ssl == NULL || ssl->conf == NULL )
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
if( NULL == ssl ) return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
if( NULL == ssl->conf ) return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
#if defined(MBEDTLS_SSL_PROTO_DTLS)
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM &&
( ssl->f_set_timer == NULL || ssl->f_get_timer == NULL ) )

View File

@ -5131,8 +5131,7 @@ static int mz_mkdir(const char *pDirname) {
#define MZ_MKDIR(d) mkdir(d, 0755)
#else
#pragma message( \
"Using fopen, ftello, fseeko, stat() etc. path for file I/O - this path may not support large files.")
#pragma message("Using fopen, ftello, fseeko, stat() etc. path for file I/O - this path may not support large files.")
#ifndef MINIZ_NO_TIME
#include <utime.h>
#endif