mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-10 15:40:30 +00:00
Merge pull request #9723 from paul-elliott-arm/fix_new_coverity_issues_3.6
[Backport 3.6] Fix new coverity issues
This commit is contained in:
commit
d37d70a6de
@ -11,14 +11,14 @@
|
||||
#if defined(MBEDTLS_TEST_HOOKS) && !defined(MBEDTLS_THREADING_C)
|
||||
int mbedtls_codepath_check = MBEDTLS_MPI_IS_TEST;
|
||||
|
||||
void mbedtls_codepath_take_safe(void)
|
||||
static void mbedtls_codepath_take_safe(void)
|
||||
{
|
||||
if (mbedtls_codepath_check == MBEDTLS_MPI_IS_TEST) {
|
||||
mbedtls_codepath_check = MBEDTLS_MPI_IS_SECRET;
|
||||
}
|
||||
}
|
||||
|
||||
void mbedtls_codepath_take_unsafe(void)
|
||||
static void mbedtls_codepath_take_unsafe(void)
|
||||
{
|
||||
mbedtls_codepath_check = MBEDTLS_MPI_IS_PUBLIC;
|
||||
}
|
||||
|
@ -363,14 +363,14 @@ void ctr_drbg_threads(data_t *expected_result, int reseed, int arg_thread_count)
|
||||
* as this was the value used when the expected answers were calculated. */
|
||||
const size_t entropy_len = 48;
|
||||
|
||||
mbedtls_ctr_drbg_context ctx;
|
||||
mbedtls_ctr_drbg_init(&ctx);
|
||||
|
||||
AES_PSA_INIT();
|
||||
|
||||
TEST_CALLOC(threads, sizeof(mbedtls_test_thread_t) * thread_count);
|
||||
memset(out, 0, sizeof(out));
|
||||
|
||||
mbedtls_ctr_drbg_context ctx;
|
||||
mbedtls_ctr_drbg_init(&ctx);
|
||||
|
||||
test_offset_idx = 0;
|
||||
|
||||
/* Need to set a non-default fixed entropy len, to ensure same output across
|
||||
|
@ -107,7 +107,10 @@ void local_input_alloc(int input_len, psa_status_t exp_status)
|
||||
|
||||
exit:
|
||||
mbedtls_free(local_input.buffer);
|
||||
mbedtls_free(input);
|
||||
|
||||
if (local_input.buffer != input) {
|
||||
mbedtls_free(input);
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
@ -243,7 +246,7 @@ void local_output_round_trip()
|
||||
TEST_CALLOC(buffer_copy_for_comparison, local_output.length);
|
||||
memcpy(buffer_copy_for_comparison, local_output.buffer, local_output.length);
|
||||
|
||||
psa_crypto_local_output_free(&local_output);
|
||||
TEST_EQUAL(psa_crypto_local_output_free(&local_output), PSA_SUCCESS);
|
||||
TEST_ASSERT(local_output.buffer == NULL);
|
||||
TEST_EQUAL(local_output.length, 0);
|
||||
|
||||
|
@ -287,21 +287,24 @@ void x509_csr_check_opaque(char *key_file, int md_type, int key_usage,
|
||||
int cert_type)
|
||||
{
|
||||
mbedtls_pk_context key;
|
||||
mbedtls_pk_init(&key);
|
||||
|
||||
mbedtls_svc_key_id_t key_id = MBEDTLS_SVC_KEY_ID_INIT;
|
||||
psa_key_attributes_t key_attr = PSA_KEY_ATTRIBUTES_INIT;
|
||||
|
||||
mbedtls_x509write_csr req;
|
||||
mbedtls_x509write_csr_init(&req);
|
||||
|
||||
unsigned char buf[4096];
|
||||
int ret;
|
||||
size_t pem_len = 0;
|
||||
const char *subject_name = "C=NL,O=PolarSSL,CN=PolarSSL Server 1";
|
||||
mbedtls_test_rnd_pseudo_info rnd_info;
|
||||
|
||||
mbedtls_x509write_csr_init(&req);
|
||||
MD_OR_USE_PSA_INIT();
|
||||
|
||||
memset(&rnd_info, 0x2a, sizeof(mbedtls_test_rnd_pseudo_info));
|
||||
|
||||
mbedtls_pk_init(&key);
|
||||
TEST_ASSERT(mbedtls_pk_parse_keyfile(&key, key_file, NULL,
|
||||
mbedtls_test_rnd_std_rand, NULL) == 0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user