Add guards for mbedtls_psa_crypto_free()
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
774f9debf2
commit
758aef60c5
32 changed files with 71 additions and 4 deletions
|
@ -182,7 +182,9 @@ exit:
|
|||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_ssl_config_free(&conf);
|
||||
mbedtls_ssl_free(&ssl);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
#else
|
||||
(void) Data;
|
||||
|
|
|
@ -126,7 +126,9 @@ exit:
|
|||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_ssl_config_free(&conf);
|
||||
mbedtls_ssl_free(&ssl);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
#else
|
||||
(void) Data;
|
||||
|
|
|
@ -171,7 +171,9 @@ exit:
|
|||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_ssl_config_free(&conf);
|
||||
mbedtls_ssl_free(&ssl);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
#else
|
||||
(void) Data;
|
||||
|
|
|
@ -94,7 +94,9 @@ exit:
|
|||
mbedtls_entropy_free(&entropy);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_pk_free(&pk);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
#else
|
||||
(void) Data;
|
||||
(void) Size;
|
||||
|
|
|
@ -72,9 +72,11 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
|
|||
abort();
|
||||
}
|
||||
}
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
exit:
|
||||
mbedtls_pk_free(&pk);
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
mbedtls_pk_free(&pk);
|
||||
#else
|
||||
(void) Data;
|
||||
(void) Size;
|
||||
|
|
|
@ -26,9 +26,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
|
|||
((void) ret);
|
||||
((void) buf);
|
||||
#endif /* !MBEDTLS_X509_REMOVE_INFO */
|
||||
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
exit:
|
||||
mbedtls_x509_crl_free(&crl);
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
mbedtls_x509_crl_free(&crl);
|
||||
#else
|
||||
(void) Data;
|
||||
(void) Size;
|
||||
|
|
|
@ -26,9 +26,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
|
|||
((void) ret);
|
||||
((void) buf);
|
||||
#endif /* !MBEDTLS_X509_REMOVE_INFO */
|
||||
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
exit:
|
||||
mbedtls_x509_crt_free(&crt);
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
mbedtls_x509_crt_free(&crt);
|
||||
#else
|
||||
(void) Data;
|
||||
(void) Size;
|
||||
|
|
|
@ -26,9 +26,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
|
|||
((void) ret);
|
||||
((void) buf);
|
||||
#endif /* !MBEDTLS_X509_REMOVE_INFO */
|
||||
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
exit:
|
||||
mbedtls_x509_csr_free(&csr);
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
mbedtls_x509_csr_free(&csr);
|
||||
#else
|
||||
(void) Data;
|
||||
(void) Size;
|
||||
|
|
|
@ -416,7 +416,9 @@ exit:
|
|||
mbedtls_pk_free(&key);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
mbedtls_exit(exit_code);
|
||||
}
|
||||
|
|
|
@ -315,7 +315,9 @@ cleanup:
|
|||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
mbedtls_pk_free(&pk);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q);
|
||||
mbedtls_mpi_free(&D); mbedtls_mpi_free(&E); mbedtls_mpi_free(&DP);
|
||||
mbedtls_mpi_free(&DQ); mbedtls_mpi_free(&QP);
|
||||
|
|
|
@ -431,7 +431,9 @@ exit:
|
|||
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
mbedtls_exit(exit_code);
|
||||
}
|
||||
|
|
|
@ -148,7 +148,9 @@ exit:
|
|||
mbedtls_pk_free(&pk);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
#if defined(MBEDTLS_ERROR_C)
|
||||
if (exit_code != MBEDTLS_EXIT_SUCCESS) {
|
||||
|
|
|
@ -149,7 +149,9 @@ exit:
|
|||
mbedtls_pk_free(&pk);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
#if defined(MBEDTLS_ERROR_C)
|
||||
if (exit_code != MBEDTLS_EXIT_SUCCESS) {
|
||||
|
|
|
@ -149,7 +149,9 @@ exit:
|
|||
mbedtls_pk_free(&pk);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
#if defined(MBEDTLS_ERROR_C)
|
||||
if (exit_code != MBEDTLS_EXIT_SUCCESS) {
|
||||
|
|
|
@ -123,7 +123,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
exit:
|
||||
mbedtls_pk_free(&pk);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
#if defined(MBEDTLS_ERROR_C)
|
||||
if (exit_code != MBEDTLS_EXIT_SUCCESS) {
|
||||
|
|
|
@ -162,7 +162,9 @@ exit:
|
|||
mbedtls_pk_free(&pk);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
mbedtls_exit(exit_code);
|
||||
}
|
||||
|
|
|
@ -138,7 +138,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
exit:
|
||||
mbedtls_pk_free(&pk);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
mbedtls_exit(exit_code);
|
||||
}
|
||||
|
|
|
@ -339,7 +339,9 @@ exit:
|
|||
mbedtls_ssl_config_free(&conf);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
/* Shell can not handle large exit numbers -> 1 for errors */
|
||||
if (ret < 0) {
|
||||
|
|
|
@ -404,7 +404,9 @@ exit:
|
|||
#endif
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
/* Shell can not handle large exit numbers -> 1 for errors */
|
||||
if (ret < 0) {
|
||||
|
|
|
@ -277,7 +277,9 @@ exit:
|
|||
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||
mbedtls_x509_crt_free(&ca);
|
||||
#endif
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
mbedtls_exit(ret);
|
||||
}
|
||||
|
|
|
@ -289,7 +289,9 @@ exit:
|
|||
mbedtls_ssl_config_free(&conf);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
mbedtls_exit(exit_code);
|
||||
}
|
||||
|
|
|
@ -1011,7 +1011,9 @@ int main(int argc, char *argv[])
|
|||
printf("Finished. No valid base64 code found\n");
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -381,7 +381,9 @@ exit:
|
|||
mbedtls_ssl_config_free(&conf);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
mbedtls_exit(exit_code);
|
||||
}
|
||||
|
|
|
@ -805,7 +805,9 @@ exit:
|
|||
mbedtls_ssl_config_free(&conf);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
mbedtls_exit(exit_code);
|
||||
}
|
||||
|
|
|
@ -488,7 +488,9 @@ exit:
|
|||
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
|
||||
mbedtls_memory_buffer_alloc_free();
|
||||
#endif
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
mbedtls_exit(ret);
|
||||
}
|
||||
|
|
|
@ -362,7 +362,9 @@ exit:
|
|||
#endif
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
mbedtls_exit(ret);
|
||||
}
|
||||
|
|
|
@ -457,7 +457,9 @@ exit:
|
|||
#endif
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
mbedtls_exit(exit_code);
|
||||
}
|
||||
|
|
|
@ -469,7 +469,9 @@ exit:
|
|||
mbedtls_pk_free(&key);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
cur = opt.san_list;
|
||||
while (cur != NULL) {
|
||||
|
|
|
@ -894,7 +894,9 @@ exit:
|
|||
mbedtls_pk_free(&loaded_issuer_key);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
mbedtls_exit(exit_code);
|
||||
}
|
||||
|
|
|
@ -134,7 +134,9 @@ usage:
|
|||
|
||||
exit:
|
||||
mbedtls_x509_crl_free(&crl);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
mbedtls_exit(exit_code);
|
||||
}
|
||||
|
|
|
@ -196,7 +196,9 @@ int main(int argc, char *argv[])
|
|||
exit_code = MBEDTLS_EXIT_SUCCESS;
|
||||
|
||||
exit:
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
mbedtls_exit(exit_code);
|
||||
}
|
||||
#endif /* necessary configuration */
|
||||
|
|
|
@ -134,7 +134,9 @@ usage:
|
|||
|
||||
exit:
|
||||
mbedtls_x509_csr_free(&csr);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_psa_crypto_free();
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
mbedtls_exit(exit_code);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue