mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 08:54:23 +01:00
Shut up a few clang-analyze warnings about use of uninitialized variables
The functions are all safe, Clang just isn't clever enough to realise it.
This commit is contained in:
parent
2cc69fffcf
commit
409401c044
@ -93,7 +93,7 @@ static int pkcs12_pbe_derive_key_iv( mbedtls_asn1_buf *pbe_params, mbedtls_md_ty
|
|||||||
unsigned char *key, size_t keylen,
|
unsigned char *key, size_t keylen,
|
||||||
unsigned char *iv, size_t ivlen )
|
unsigned char *iv, size_t ivlen )
|
||||||
{
|
{
|
||||||
int ret, iterations;
|
int ret, iterations = 0;
|
||||||
mbedtls_asn1_buf salt;
|
mbedtls_asn1_buf salt;
|
||||||
size_t i;
|
size_t i;
|
||||||
unsigned char unipwd[PKCS12_MAX_PWDLEN * 2 + 2];
|
unsigned char unipwd[PKCS12_MAX_PWDLEN * 2 + 2];
|
||||||
|
@ -797,7 +797,12 @@ int mbedtls_rsa_rsaes_pkcs1_v15_decrypt( mbedtls_rsa_context *ctx,
|
|||||||
int ret;
|
int ret;
|
||||||
size_t ilen, pad_count = 0, i;
|
size_t ilen, pad_count = 0, i;
|
||||||
unsigned char *p, bad, pad_done = 0;
|
unsigned char *p, bad, pad_done = 0;
|
||||||
|
#ifdef __clang_analyzer__
|
||||||
|
/* Shut up Clang, mbedtls_rsa_public/private writes to this */
|
||||||
|
unsigned char buf[MBEDTLS_MPI_MAX_SIZE] = { };
|
||||||
|
#else
|
||||||
unsigned char buf[MBEDTLS_MPI_MAX_SIZE];
|
unsigned char buf[MBEDTLS_MPI_MAX_SIZE];
|
||||||
|
#endif
|
||||||
|
|
||||||
if( mode == MBEDTLS_RSA_PRIVATE && ctx->padding != MBEDTLS_RSA_PKCS_V15 )
|
if( mode == MBEDTLS_RSA_PRIVATE && ctx->padding != MBEDTLS_RSA_PKCS_V15 )
|
||||||
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
|
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
|
||||||
@ -1175,13 +1180,18 @@ int mbedtls_rsa_rsassa_pss_verify_ext( mbedtls_rsa_context *ctx,
|
|||||||
int ret;
|
int ret;
|
||||||
size_t siglen;
|
size_t siglen;
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
unsigned char buf[MBEDTLS_MPI_MAX_SIZE];
|
|
||||||
unsigned char result[MBEDTLS_MD_MAX_SIZE];
|
unsigned char result[MBEDTLS_MD_MAX_SIZE];
|
||||||
unsigned char zeros[8];
|
unsigned char zeros[8];
|
||||||
unsigned int hlen;
|
unsigned int hlen;
|
||||||
size_t slen, msb;
|
size_t slen, msb;
|
||||||
const mbedtls_md_info_t *md_info;
|
const mbedtls_md_info_t *md_info;
|
||||||
mbedtls_md_context_t md_ctx;
|
mbedtls_md_context_t md_ctx;
|
||||||
|
#ifdef __clang_analyzer__
|
||||||
|
/* Shut up Clang, mbedtls_rsa_public/private writes to this */
|
||||||
|
unsigned char buf[MBEDTLS_MPI_MAX_SIZE] = { };
|
||||||
|
#else
|
||||||
|
unsigned char buf[MBEDTLS_MPI_MAX_SIZE];
|
||||||
|
#endif
|
||||||
|
|
||||||
if( mode == MBEDTLS_RSA_PRIVATE && ctx->padding != MBEDTLS_RSA_PKCS_V21 )
|
if( mode == MBEDTLS_RSA_PRIVATE && ctx->padding != MBEDTLS_RSA_PKCS_V21 )
|
||||||
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
|
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
|
||||||
@ -1320,10 +1330,15 @@ int mbedtls_rsa_rsassa_pkcs1_v15_verify( mbedtls_rsa_context *ctx,
|
|||||||
int ret;
|
int ret;
|
||||||
size_t len, siglen, asn1_len;
|
size_t len, siglen, asn1_len;
|
||||||
unsigned char *p, *end;
|
unsigned char *p, *end;
|
||||||
unsigned char buf[MBEDTLS_MPI_MAX_SIZE];
|
|
||||||
mbedtls_md_type_t msg_md_alg;
|
mbedtls_md_type_t msg_md_alg;
|
||||||
const mbedtls_md_info_t *md_info;
|
const mbedtls_md_info_t *md_info;
|
||||||
mbedtls_asn1_buf oid;
|
mbedtls_asn1_buf oid;
|
||||||
|
#ifdef __clang_analyzer__
|
||||||
|
/* Shut up Clang, mbedtls_rsa_public/private writes to this */
|
||||||
|
unsigned char buf[MBEDTLS_MPI_MAX_SIZE] = { };
|
||||||
|
#else
|
||||||
|
unsigned char buf[MBEDTLS_MPI_MAX_SIZE];
|
||||||
|
#endif
|
||||||
|
|
||||||
if( mode == MBEDTLS_RSA_PRIVATE && ctx->padding != MBEDTLS_RSA_PKCS_V15 )
|
if( mode == MBEDTLS_RSA_PRIVATE && ctx->padding != MBEDTLS_RSA_PKCS_V15 )
|
||||||
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
|
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
|
||||||
|
@ -83,7 +83,7 @@ static int generic_check( const mbedtls_md_info_t *md_info, char *filename )
|
|||||||
int nb_err1, nb_err2;
|
int nb_err1, nb_err2;
|
||||||
int nb_tot1, nb_tot2;
|
int nb_tot1, nb_tot2;
|
||||||
unsigned char sum[MBEDTLS_MD_MAX_SIZE];
|
unsigned char sum[MBEDTLS_MD_MAX_SIZE];
|
||||||
char buf[MBEDTLS_MD_MAX_SIZE * 2 + 1], line[1024];
|
char buf[MBEDTLS_MD_MAX_SIZE * 2 + 1] = { }, line[1024];
|
||||||
char diff;
|
char diff;
|
||||||
|
|
||||||
if( ( f = fopen( filename, "rb" ) ) == NULL )
|
if( ( f = fopen( filename, "rb" ) ) == NULL )
|
||||||
|
Loading…
Reference in New Issue
Block a user